Initial Commit

This commit is contained in:
2026-03-06 04:54:20 -04:00
commit 63677bfcf5
9332 changed files with 1507319 additions and 0 deletions

51
node_modules/@firebase/functions/dist/esm/src/api.d.ts generated vendored Normal file
View File

@@ -0,0 +1,51 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { FirebaseApp } from '@firebase/app';
import { Functions, HttpsCallableOptions, HttpsCallable } from './public-types';
export { FunctionsError } from './error';
export * from './public-types';
/**
* Returns a {@link Functions} instance for the given app.
* @param app - The {@link @firebase/app#FirebaseApp} to use.
* @param regionOrCustomDomain - one of:
* a) The region the callable functions are located in (ex: us-central1)
* b) A custom domain hosting the callable functions (ex: https://mydomain.com)
* @public
*/
export declare function getFunctions(app?: FirebaseApp, regionOrCustomDomain?: string): Functions;
/**
* Modify this instance to communicate with the Cloud Functions emulator.
*
* Note: this must be called before this instance has been used to do any operations.
*
* @param host - The emulator host (ex: localhost)
* @param port - The emulator port (ex: 5001)
* @public
*/
export declare function connectFunctionsEmulator(functionsInstance: Functions, host: string, port: number): void;
/**
* Returns a reference to the callable HTTPS trigger with the given name.
* @param name - The name of the trigger.
* @public
*/
export declare function httpsCallable<RequestData = unknown, ResponseData = unknown, StreamData = unknown>(functionsInstance: Functions, name: string, options?: HttpsCallableOptions): HttpsCallable<RequestData, ResponseData, StreamData>;
/**
* Returns a reference to the callable HTTPS trigger with the specified url.
* @param url - The url of the trigger.
* @public
*/
export declare function httpsCallableFromURL<RequestData = unknown, ResponseData = unknown, StreamData = unknown>(functionsInstance: Functions, url: string, options?: HttpsCallableOptions): HttpsCallable<RequestData, ResponseData, StreamData>;

View File

@@ -0,0 +1,17 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export declare function registerFunctions(variant?: string): void;

View File

@@ -0,0 +1,20 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Type constant for Firebase Functions.
*/
export declare const FUNCTIONS_TYPE = "functions";

View File

@@ -0,0 +1,46 @@
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Provider } from '@firebase/component';
import { FirebaseApp } from '@firebase/app';
import { AppCheckInternalComponentName } from '@firebase/app-check-interop-types';
import { MessagingInternalComponentName } from '@firebase/messaging-interop-types';
import { FirebaseAuthInternalName } from '@firebase/auth-interop-types';
/**
* The metadata that should be supplied with function calls.
* @internal
*/
export interface Context {
authToken?: string;
messagingToken?: string;
appCheckToken: string | null;
}
/**
* Helper class to get metadata that should be included with a function call.
* @internal
*/
export declare class ContextProvider {
readonly app: FirebaseApp;
private auth;
private messaging;
private appCheck;
private serverAppAppCheckToken;
constructor(app: FirebaseApp, authProvider: Provider<FirebaseAuthInternalName>, messagingProvider: Provider<MessagingInternalComponentName>, appCheckProvider: Provider<AppCheckInternalComponentName>);
getAuthToken(): Promise<string | undefined>;
getMessagingToken(): Promise<string | undefined>;
getAppCheckToken(limitedUseAppCheckTokens?: boolean): Promise<string | null>;
getContext(limitedUseAppCheckTokens?: boolean): Promise<Context>;
}

View File

@@ -0,0 +1,49 @@
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { FunctionsErrorCodeCore as FunctionsErrorCode } from './public-types';
import { HttpResponseBody } from './service';
import { FirebaseError } from '@firebase/util';
/**
* An error returned by the Firebase Functions client SDK.
*
* See {@link FunctionsErrorCode} for full documentation of codes.
*
* @public
*/
export declare class FunctionsError extends FirebaseError {
/**
* Additional details to be converted to JSON and included in the error response.
*/
readonly details?: unknown;
/**
* Constructs a new instance of the `FunctionsError` class.
*/
constructor(
/**
* A standard error code that will be returned to the client. This also
* determines the HTTP status code of the response, as defined in code.proto.
*/
code: FunctionsErrorCode, message?: string,
/**
* Additional details to be converted to JSON and included in the error response.
*/
details?: unknown);
}
/**
* Takes an HTTP response and returns the corresponding Error, if any.
*/
export declare function _errorForResponse(status: number, bodyJSON: HttpResponseBody | null): Error | null;

View File

@@ -0,0 +1,7 @@
/**
* Cloud Functions for Firebase
*
* @packageDocumentation
*/
export * from './api';
export * from './public-types';

View File

@@ -0,0 +1,150 @@
/**
* @license
* Copyright 2018 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { FirebaseApp } from '@firebase/app';
/**
* An `HttpsCallableResult` wraps a single result from a function call.
* @public
*/
export interface HttpsCallableResult<ResponseData = unknown> {
/**
* Data returned from callable function.
*/
readonly data: ResponseData;
}
/**
* An `HttpsCallableStreamResult` wraps a single streaming result from a function call.
* @public
*/
export interface HttpsCallableStreamResult<ResponseData = unknown, StreamData = unknown> {
readonly data: Promise<ResponseData>;
readonly stream: AsyncIterable<StreamData>;
}
/**
* A reference to a "callable" HTTP trigger in Cloud Functions.
* @param data - Data to be passed to callable function.
* @public
*/
export interface HttpsCallable<RequestData = unknown, ResponseData = unknown, StreamData = unknown> {
(data?: RequestData | null): Promise<HttpsCallableResult<ResponseData>>;
stream: (data?: RequestData | null, options?: HttpsCallableStreamOptions) => Promise<HttpsCallableStreamResult<ResponseData, StreamData>>;
}
/**
* An interface for metadata about how calls should be executed.
* @public
*/
export interface HttpsCallableOptions {
/**
* Time in milliseconds after which to cancel if there is no response.
* Default is 70000.
*/
timeout?: number;
/**
* If set to true, uses a limited-use App Check token for callable function requests from this
* instance of {@link Functions}. You must use limited-use tokens to call functions with
* replay protection enabled. By default, this is false.
*/
limitedUseAppCheckTokens?: boolean;
}
/**
* An interface for metadata about how a stream call should be executed.
* @public
*/
export interface HttpsCallableStreamOptions {
/**
* An `AbortSignal` that can be used to cancel the streaming response. When the signal is aborted,
* the underlying HTTP connection will be terminated.
*/
signal?: AbortSignal;
/**
* If set to true, uses a limited-use App Check token for callable function requests from this
* instance of {@link Functions}. You must use limited-use tokens to call functions with
* replay protection enabled. By default, this is false.
*/
limitedUseAppCheckTokens?: boolean;
}
/**
* A `Functions` instance.
* @public
*/
export interface Functions {
/**
* The {@link @firebase/app#FirebaseApp} this `Functions` instance is associated with.
*/
app: FirebaseApp;
/**
* The region the callable Cloud Functions are located in.
* Default is `us-central-1`.
*/
region: string;
/**
* A custom domain hosting the callable Cloud Functions.
* ex: https://mydomain.com
*/
customDomain: string | null;
}
/**
* Functions error code string appended after "functions/" product prefix.
* See {@link FunctionsErrorCode} for full documentation of codes.
* @public
*/
export type FunctionsErrorCodeCore = 'ok' | 'cancelled' | 'unknown' | 'invalid-argument' | 'deadline-exceeded' | 'not-found' | 'already-exists' | 'permission-denied' | 'resource-exhausted' | 'failed-precondition' | 'aborted' | 'out-of-range' | 'unimplemented' | 'internal' | 'unavailable' | 'data-loss' | 'unauthenticated';
/**
* The set of Firebase Functions status codes. The codes are the same at the
* ones exposed by gRPC here:
* https://github.com/grpc/grpc/blob/master/doc/statuscodes.md
*
* Possible values:
* - 'cancelled': The operation was cancelled (typically by the caller).
* - 'unknown': Unknown error or an error from a different error domain.
* - 'invalid-argument': Client specified an invalid argument. Note that this
* differs from 'failed-precondition'. 'invalid-argument' indicates
* arguments that are problematic regardless of the state of the system
* (e.g. an invalid field name).
* - 'deadline-exceeded': Deadline expired before operation could complete.
* For operations that change the state of the system, this error may be
* returned even if the operation has completed successfully. For example,
* a successful response from a server could have been delayed long enough
* for the deadline to expire.
* - 'not-found': Some requested document was not found.
* - 'already-exists': Some document that we attempted to create already
* exists.
* - 'permission-denied': The caller does not have permission to execute the
* specified operation.
* - 'resource-exhausted': Some resource has been exhausted, perhaps a
* per-user quota, or perhaps the entire file system is out of space.
* - 'failed-precondition': Operation was rejected because the system is not
* in a state required for the operation's execution.
* - 'aborted': The operation was aborted, typically due to a concurrency
* issue like transaction aborts, etc.
* - 'out-of-range': Operation was attempted past the valid range.
* - 'unimplemented': Operation is not implemented or not supported/enabled.
* - 'internal': Internal errors. Means some invariants expected by
* underlying system has been broken. If you see one of these errors,
* something is very broken.
* - 'unavailable': The service is currently unavailable. This is most likely
* a transient condition and may be corrected by retrying with a backoff.
* - 'data-loss': Unrecoverable data loss or corruption.
* - 'unauthenticated': The request does not have valid authentication
* credentials for the operation.
* @public
*/
export type FunctionsErrorCode = `functions/${FunctionsErrorCodeCore}`;
declare module '@firebase/component' {
interface NameServiceMapping {
'functions': Functions;
}
}

View File

@@ -0,0 +1,14 @@
/**
* Takes data and encodes it in a JSON-friendly way, such that types such as
* Date are preserved.
* @internal
* @param data - Data to encode.
*/
export declare function encode(data: unknown): unknown;
/**
* Takes data that's been encoded in a JSON-friendly form and returns a form
* with richer datatypes, such as Dates, etc.
* @internal
* @param json - JSON to convert.
*/
export declare function decode(json: unknown): unknown;

View File

@@ -0,0 +1,86 @@
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { FirebaseApp, _FirebaseService } from '@firebase/app';
import { HttpsCallable, HttpsCallableOptions } from './public-types';
import { ContextProvider } from './context';
import { Provider } from '@firebase/component';
import { FirebaseAuthInternalName } from '@firebase/auth-interop-types';
import { MessagingInternalComponentName } from '@firebase/messaging-interop-types';
import { AppCheckInternalComponentName } from '@firebase/app-check-interop-types';
export declare const DEFAULT_REGION = "us-central1";
/**
* Describes the shape of the HttpResponse body.
* It makes functions that would otherwise take {} able to access the
* possible elements in the body more easily
*/
export interface HttpResponseBody {
data?: unknown;
result?: unknown;
error?: {
message?: unknown;
status?: unknown;
details?: unknown;
};
}
/**
* The main class for the Firebase Functions SDK.
* @internal
*/
export declare class FunctionsService implements _FirebaseService {
readonly app: FirebaseApp;
readonly fetchImpl: typeof fetch;
readonly contextProvider: ContextProvider;
emulatorOrigin: string | null;
cancelAllRequests: Promise<void>;
deleteService: () => Promise<void>;
region: string;
customDomain: string | null;
/**
* Creates a new Functions service for the given app.
* @param app - The FirebaseApp to use.
*/
constructor(app: FirebaseApp, authProvider: Provider<FirebaseAuthInternalName>, messagingProvider: Provider<MessagingInternalComponentName>, appCheckProvider: Provider<AppCheckInternalComponentName>, regionOrCustomDomain?: string, fetchImpl?: typeof fetch);
_delete(): Promise<void>;
/**
* Returns the URL for a callable with the given name.
* @param name - The name of the callable.
* @internal
*/
_url(name: string): string;
}
/**
* Modify this instance to communicate with the Cloud Functions emulator.
*
* Note: this must be called before this instance has been used to do any operations.
*
* @param host The emulator host (ex: localhost)
* @param port The emulator port (ex: 5001)
* @public
*/
export declare function connectFunctionsEmulator(functionsInstance: FunctionsService, host: string, port: number): void;
/**
* Returns a reference to the callable https trigger with the given name.
* @param name - The name of the trigger.
* @public
*/
export declare function httpsCallable<RequestData, ResponseData, StreamData = unknown>(functionsInstance: FunctionsService, name: string, options?: HttpsCallableOptions): HttpsCallable<RequestData, ResponseData, StreamData>;
/**
* Returns a reference to the callable https trigger with the given url.
* @param url - The url of the trigger.
* @public
*/
export declare function httpsCallableFromURL<RequestData, ResponseData, StreamData = unknown>(functionsInstance: FunctionsService, url: string, options?: HttpsCallableOptions): HttpsCallable<RequestData, ResponseData, StreamData>;