@firebase/functions
- Version 0.12.3
- Published
- 251 kB
- 6 dependencies
- Apache-2.0 license
Install
npm i @firebase/functions
yarn add @firebase/functions
pnpm add @firebase/functions
Overview
Cloud Functions for Firebase
Index
Functions
Classes
Interfaces
Type Aliases
Functions
function connectFunctionsEmulator
connectFunctionsEmulator: ( functionsInstance: Functions, host: string, port: number) => void;
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.
Parameter host
The emulator host (ex: localhost)
Parameter port
The emulator port (ex: 5001)
Modifiers
@public
function getFunctions
getFunctions: (app?: FirebaseApp, regionOrCustomDomain?: string) => Functions;
Returns a Functions instance for the given app.
Parameter app
The @firebase/app#FirebaseApp to use.
Parameter 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)
Modifiers
@public
function httpsCallable
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 given name.
Parameter name
The name of the trigger.
Modifiers
@public
function httpsCallableFromURL
httpsCallableFromURL: < RequestData = unknown, ResponseData = unknown, StreamData = unknown>( functionsInstance: Functions, url: string, options?: HttpsCallableOptions) => HttpsCallable<RequestData, ResponseData, StreamData>;
Returns a reference to the callable HTTPS trigger with the specified url.
Parameter url
The url of the trigger.
Modifiers
@public
Classes
class FunctionsError
class FunctionsError extends FirebaseError {}
An error returned by the Firebase Functions client SDK.
See FunctionsErrorCode for full documentation of codes.
Modifiers
@public
constructor
constructor(code: FunctionsErrorCodeCore, message?: string, details?: {});
Constructs a new instance of the
FunctionsError
class.
property details
readonly details?: {};
Additional details to be converted to JSON and included in the error response.
Interfaces
interface Functions
interface Functions {}
A
Functions
instance.Modifiers
@public
property app
app: FirebaseApp;
The @firebase/app#FirebaseApp this
Functions
instance is associated with.
property customDomain
customDomain: string | null;
A custom domain hosting the callable Cloud Functions. ex: https://mydomain.com
property region
region: string;
The region the callable Cloud Functions are located in. Default is
us-central-1
.
interface HttpsCallable
interface HttpsCallable< RequestData = unknown, ResponseData = unknown, StreamData = unknown> {}
A reference to a "callable" HTTP trigger in Cloud Functions.
Parameter data
Data to be passed to callable function.
Modifiers
@public
property stream
stream: ( data?: RequestData | null, options?: HttpsCallableStreamOptions) => Promise<HttpsCallableStreamResult<ResponseData, StreamData>>;
call signature
(data?: RequestData | null): Promise<HttpsCallableResult<ResponseData>>;
interface HttpsCallableOptions
interface HttpsCallableOptions {}
An interface for metadata about how calls should be executed.
Modifiers
@public
property limitedUseAppCheckTokens
limitedUseAppCheckTokens?: boolean;
If set to true, uses a limited-use App Check token for callable function requests from this instance of Functions. You must use limited-use tokens to call functions with replay protection enabled. By default, this is false.
property timeout
timeout?: number;
Time in milliseconds after which to cancel if there is no response. Default is 70000.
interface HttpsCallableResult
interface HttpsCallableResult<ResponseData = unknown> {}
An
HttpsCallableResult
wraps a single result from a function call.Modifiers
@public
property data
readonly data: ResponseData;
Data returned from callable function.
interface HttpsCallableStreamOptions
interface HttpsCallableStreamOptions {}
An interface for metadata about how a stream call should be executed.
Modifiers
@public
property limitedUseAppCheckTokens
limitedUseAppCheckTokens?: boolean;
If set to true, uses a limited-use App Check token for callable function requests from this instance of Functions. You must use limited-use tokens to call functions with replay protection enabled. By default, this is false.
property signal
signal?: AbortSignal;
An
AbortSignal
that can be used to cancel the streaming response. When the signal is aborted, the underlying HTTP connection will be terminated.
interface HttpsCallableStreamResult
interface HttpsCallableStreamResult<ResponseData = unknown, StreamData = unknown> {}
An
HttpsCallableStreamResult
wraps a single streaming result from a function call.Modifiers
@public
Type Aliases
type FunctionsErrorCode
type FunctionsErrorCode = `functions/${FunctionsErrorCodeCore}`;
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.
Modifiers
@public
type FunctionsErrorCodeCore
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';
Functions error code string appended after "functions/" product prefix. See FunctionsErrorCode for full documentation of codes.
Modifiers
@public
Package Files (1)
Dependencies (6)
Dev Dependencies (5)
Peer Dependencies (1)
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@firebase/functions
.
- Markdown[](https://www.jsdocs.io/package/@firebase/functions)
- HTML<a href="https://www.jsdocs.io/package/@firebase/functions"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 3420 ms. - Missing or incorrect documentation? Open an issue for this package.