@depup/firebase__functions 0.13.2-depup.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,208 @@
1
+ /**
2
+ * Cloud Functions for Firebase
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+
7
+ import { FirebaseApp } from '@firebase/app';
8
+ import { FirebaseError } from '@firebase/util';
9
+
10
+ /**
11
+ * Modify this instance to communicate with the Cloud Functions emulator.
12
+ *
13
+ * Note: this must be called before this instance has been used to do any operations.
14
+ *
15
+ * @param host - The emulator host (ex: localhost)
16
+ * @param port - The emulator port (ex: 5001)
17
+ * @public
18
+ */
19
+ export declare function connectFunctionsEmulator(functionsInstance: Functions, host: string, port: number): void;
20
+
21
+ /**
22
+ * A `Functions` instance.
23
+ * @public
24
+ */
25
+ export declare interface Functions {
26
+ /**
27
+ * The {@link @firebase/app#FirebaseApp} this `Functions` instance is associated with.
28
+ */
29
+ app: FirebaseApp;
30
+ /**
31
+ * The region the callable Cloud Functions are located in.
32
+ * Default is `us-central-1`.
33
+ */
34
+ region: string;
35
+ /**
36
+ * A custom domain hosting the callable Cloud Functions.
37
+ * ex: https://mydomain.com
38
+ */
39
+ customDomain: string | null;
40
+ }
41
+
42
+ /**
43
+ * An error returned by the Firebase Functions client SDK.
44
+ *
45
+ * See {@link FunctionsErrorCode} for full documentation of codes.
46
+ *
47
+ * @public
48
+ */
49
+ export declare class FunctionsError extends FirebaseError {
50
+ /**
51
+ * Additional details to be converted to JSON and included in the error response.
52
+ */
53
+ readonly details?: unknown;
54
+ /**
55
+ * Constructs a new instance of the `FunctionsError` class.
56
+ */
57
+ constructor(
58
+ /**
59
+ * A standard error code that will be returned to the client. This also
60
+ * determines the HTTP status code of the response, as defined in code.proto.
61
+ */
62
+ code: FunctionsErrorCodeCore, message?: string,
63
+ /**
64
+ * Additional details to be converted to JSON and included in the error response.
65
+ */
66
+ details?: unknown);
67
+ }
68
+
69
+ /**
70
+ * The set of Firebase Functions status codes. The codes are the same at the
71
+ * ones exposed by gRPC here:
72
+ * https://github.com/grpc/grpc/blob/master/doc/statuscodes.md
73
+ *
74
+ * Possible values:
75
+ * - 'cancelled': The operation was cancelled (typically by the caller).
76
+ * - 'unknown': Unknown error or an error from a different error domain.
77
+ * - 'invalid-argument': Client specified an invalid argument. Note that this
78
+ * differs from 'failed-precondition'. 'invalid-argument' indicates
79
+ * arguments that are problematic regardless of the state of the system
80
+ * (e.g. an invalid field name).
81
+ * - 'deadline-exceeded': Deadline expired before operation could complete.
82
+ * For operations that change the state of the system, this error may be
83
+ * returned even if the operation has completed successfully. For example,
84
+ * a successful response from a server could have been delayed long enough
85
+ * for the deadline to expire.
86
+ * - 'not-found': Some requested document was not found.
87
+ * - 'already-exists': Some document that we attempted to create already
88
+ * exists.
89
+ * - 'permission-denied': The caller does not have permission to execute the
90
+ * specified operation.
91
+ * - 'resource-exhausted': Some resource has been exhausted, perhaps a
92
+ * per-user quota, or perhaps the entire file system is out of space.
93
+ * - 'failed-precondition': Operation was rejected because the system is not
94
+ * in a state required for the operation's execution.
95
+ * - 'aborted': The operation was aborted, typically due to a concurrency
96
+ * issue like transaction aborts, etc.
97
+ * - 'out-of-range': Operation was attempted past the valid range.
98
+ * - 'unimplemented': Operation is not implemented or not supported/enabled.
99
+ * - 'internal': Internal errors. Means some invariants expected by
100
+ * underlying system has been broken. If you see one of these errors,
101
+ * something is very broken.
102
+ * - 'unavailable': The service is currently unavailable. This is most likely
103
+ * a transient condition and may be corrected by retrying with a backoff.
104
+ * - 'data-loss': Unrecoverable data loss or corruption.
105
+ * - 'unauthenticated': The request does not have valid authentication
106
+ * credentials for the operation.
107
+ * @public
108
+ */
109
+ export declare type FunctionsErrorCode = `functions/${FunctionsErrorCodeCore}`;
110
+
111
+ /**
112
+ * Functions error code string appended after "functions/" product prefix.
113
+ * See {@link FunctionsErrorCode} for full documentation of codes.
114
+ * @public
115
+ */
116
+ export declare 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';
117
+
118
+ /**
119
+ * Returns a {@link Functions} instance for the given app.
120
+ * @param app - The {@link @firebase/app#FirebaseApp} to use.
121
+ * @param regionOrCustomDomain - one of:
122
+ * a) The region the callable functions are located in (ex: us-central1)
123
+ * b) A custom domain hosting the callable functions (ex: https://mydomain.com)
124
+ * @public
125
+ */
126
+ export declare function getFunctions(app?: FirebaseApp, regionOrCustomDomain?: string): Functions;
127
+
128
+ /**
129
+ * A reference to a "callable" HTTP trigger in Cloud Functions.
130
+ * @param data - Data to be passed to callable function.
131
+ * @public
132
+ */
133
+ export declare interface HttpsCallable<RequestData = unknown, ResponseData = unknown, StreamData = unknown> {
134
+ (data?: RequestData | null): Promise<HttpsCallableResult<ResponseData>>;
135
+ stream: (data?: RequestData | null, options?: HttpsCallableStreamOptions) => Promise<HttpsCallableStreamResult<ResponseData, StreamData>>;
136
+ }
137
+
138
+ /**
139
+ * Returns a reference to the callable HTTPS trigger with the given name.
140
+ * @param name - The name of the trigger.
141
+ * @public
142
+ */
143
+ export declare function httpsCallable<RequestData = unknown, ResponseData = unknown, StreamData = unknown>(functionsInstance: Functions, name: string, options?: HttpsCallableOptions): HttpsCallable<RequestData, ResponseData, StreamData>;
144
+
145
+ /**
146
+ * Returns a reference to the callable HTTPS trigger with the specified url.
147
+ * @param url - The url of the trigger.
148
+ * @public
149
+ */
150
+ export declare function httpsCallableFromURL<RequestData = unknown, ResponseData = unknown, StreamData = unknown>(functionsInstance: Functions, url: string, options?: HttpsCallableOptions): HttpsCallable<RequestData, ResponseData, StreamData>;
151
+
152
+ /**
153
+ * An interface for metadata about how calls should be executed.
154
+ * @public
155
+ */
156
+ export declare interface HttpsCallableOptions {
157
+ /**
158
+ * Time in milliseconds after which to cancel if there is no response.
159
+ * Default is 70000.
160
+ */
161
+ timeout?: number;
162
+ /**
163
+ * If set to true, uses a limited-use App Check token for callable function requests from this
164
+ * instance of {@link Functions}. You must use limited-use tokens to call functions with
165
+ * replay protection enabled. By default, this is false.
166
+ */
167
+ limitedUseAppCheckTokens?: boolean;
168
+ }
169
+
170
+ /**
171
+ * An `HttpsCallableResult` wraps a single result from a function call.
172
+ * @public
173
+ */
174
+ export declare interface HttpsCallableResult<ResponseData = unknown> {
175
+ /**
176
+ * Data returned from callable function.
177
+ */
178
+ readonly data: ResponseData;
179
+ }
180
+
181
+ /**
182
+ * An interface for metadata about how a stream call should be executed.
183
+ * @public
184
+ */
185
+ export declare interface HttpsCallableStreamOptions {
186
+ /**
187
+ * An `AbortSignal` that can be used to cancel the streaming response. When the signal is aborted,
188
+ * the underlying HTTP connection will be terminated.
189
+ */
190
+ signal?: AbortSignal;
191
+ /**
192
+ * If set to true, uses a limited-use App Check token for callable function requests from this
193
+ * instance of {@link Functions}. You must use limited-use tokens to call functions with
194
+ * replay protection enabled. By default, this is false.
195
+ */
196
+ limitedUseAppCheckTokens?: boolean;
197
+ }
198
+
199
+ /**
200
+ * An `HttpsCallableStreamResult` wraps a single streaming result from a function call.
201
+ * @public
202
+ */
203
+ export declare interface HttpsCallableStreamResult<ResponseData = unknown, StreamData = unknown> {
204
+ readonly data: Promise<ResponseData>;
205
+ readonly stream: AsyncIterable<StreamData>;
206
+ }
207
+
208
+ export { }
@@ -0,0 +1,208 @@
1
+ /**
2
+ * Cloud Functions for Firebase
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+
7
+ import { FirebaseApp } from '@firebase/app';
8
+ import { FirebaseError } from '@firebase/util';
9
+
10
+ /**
11
+ * Modify this instance to communicate with the Cloud Functions emulator.
12
+ *
13
+ * Note: this must be called before this instance has been used to do any operations.
14
+ *
15
+ * @param host - The emulator host (ex: localhost)
16
+ * @param port - The emulator port (ex: 5001)
17
+ * @public
18
+ */
19
+ export declare function connectFunctionsEmulator(functionsInstance: Functions, host: string, port: number): void;
20
+
21
+ /**
22
+ * A `Functions` instance.
23
+ * @public
24
+ */
25
+ export declare interface Functions {
26
+ /**
27
+ * The {@link @firebase/app#FirebaseApp} this `Functions` instance is associated with.
28
+ */
29
+ app: FirebaseApp;
30
+ /**
31
+ * The region the callable Cloud Functions are located in.
32
+ * Default is `us-central-1`.
33
+ */
34
+ region: string;
35
+ /**
36
+ * A custom domain hosting the callable Cloud Functions.
37
+ * ex: https://mydomain.com
38
+ */
39
+ customDomain: string | null;
40
+ }
41
+
42
+ /**
43
+ * An error returned by the Firebase Functions client SDK.
44
+ *
45
+ * See {@link FunctionsErrorCode} for full documentation of codes.
46
+ *
47
+ * @public
48
+ */
49
+ export declare class FunctionsError extends FirebaseError {
50
+ /**
51
+ * Additional details to be converted to JSON and included in the error response.
52
+ */
53
+ readonly details?: unknown;
54
+ /**
55
+ * Constructs a new instance of the `FunctionsError` class.
56
+ */
57
+ constructor(
58
+ /**
59
+ * A standard error code that will be returned to the client. This also
60
+ * determines the HTTP status code of the response, as defined in code.proto.
61
+ */
62
+ code: FunctionsErrorCodeCore, message?: string,
63
+ /**
64
+ * Additional details to be converted to JSON and included in the error response.
65
+ */
66
+ details?: unknown);
67
+ }
68
+
69
+ /**
70
+ * The set of Firebase Functions status codes. The codes are the same at the
71
+ * ones exposed by gRPC here:
72
+ * https://github.com/grpc/grpc/blob/master/doc/statuscodes.md
73
+ *
74
+ * Possible values:
75
+ * - 'cancelled': The operation was cancelled (typically by the caller).
76
+ * - 'unknown': Unknown error or an error from a different error domain.
77
+ * - 'invalid-argument': Client specified an invalid argument. Note that this
78
+ * differs from 'failed-precondition'. 'invalid-argument' indicates
79
+ * arguments that are problematic regardless of the state of the system
80
+ * (e.g. an invalid field name).
81
+ * - 'deadline-exceeded': Deadline expired before operation could complete.
82
+ * For operations that change the state of the system, this error may be
83
+ * returned even if the operation has completed successfully. For example,
84
+ * a successful response from a server could have been delayed long enough
85
+ * for the deadline to expire.
86
+ * - 'not-found': Some requested document was not found.
87
+ * - 'already-exists': Some document that we attempted to create already
88
+ * exists.
89
+ * - 'permission-denied': The caller does not have permission to execute the
90
+ * specified operation.
91
+ * - 'resource-exhausted': Some resource has been exhausted, perhaps a
92
+ * per-user quota, or perhaps the entire file system is out of space.
93
+ * - 'failed-precondition': Operation was rejected because the system is not
94
+ * in a state required for the operation's execution.
95
+ * - 'aborted': The operation was aborted, typically due to a concurrency
96
+ * issue like transaction aborts, etc.
97
+ * - 'out-of-range': Operation was attempted past the valid range.
98
+ * - 'unimplemented': Operation is not implemented or not supported/enabled.
99
+ * - 'internal': Internal errors. Means some invariants expected by
100
+ * underlying system has been broken. If you see one of these errors,
101
+ * something is very broken.
102
+ * - 'unavailable': The service is currently unavailable. This is most likely
103
+ * a transient condition and may be corrected by retrying with a backoff.
104
+ * - 'data-loss': Unrecoverable data loss or corruption.
105
+ * - 'unauthenticated': The request does not have valid authentication
106
+ * credentials for the operation.
107
+ * @public
108
+ */
109
+ export declare type FunctionsErrorCode = `functions/${FunctionsErrorCodeCore}`;
110
+
111
+ /**
112
+ * Functions error code string appended after "functions/" product prefix.
113
+ * See {@link FunctionsErrorCode} for full documentation of codes.
114
+ * @public
115
+ */
116
+ export declare 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';
117
+
118
+ /**
119
+ * Returns a {@link Functions} instance for the given app.
120
+ * @param app - The {@link @firebase/app#FirebaseApp} to use.
121
+ * @param regionOrCustomDomain - one of:
122
+ * a) The region the callable functions are located in (ex: us-central1)
123
+ * b) A custom domain hosting the callable functions (ex: https://mydomain.com)
124
+ * @public
125
+ */
126
+ export declare function getFunctions(app?: FirebaseApp, regionOrCustomDomain?: string): Functions;
127
+
128
+ /**
129
+ * A reference to a "callable" HTTP trigger in Cloud Functions.
130
+ * @param data - Data to be passed to callable function.
131
+ * @public
132
+ */
133
+ export declare interface HttpsCallable<RequestData = unknown, ResponseData = unknown, StreamData = unknown> {
134
+ (data?: RequestData | null): Promise<HttpsCallableResult<ResponseData>>;
135
+ stream: (data?: RequestData | null, options?: HttpsCallableStreamOptions) => Promise<HttpsCallableStreamResult<ResponseData, StreamData>>;
136
+ }
137
+
138
+ /**
139
+ * Returns a reference to the callable HTTPS trigger with the given name.
140
+ * @param name - The name of the trigger.
141
+ * @public
142
+ */
143
+ export declare function httpsCallable<RequestData = unknown, ResponseData = unknown, StreamData = unknown>(functionsInstance: Functions, name: string, options?: HttpsCallableOptions): HttpsCallable<RequestData, ResponseData, StreamData>;
144
+
145
+ /**
146
+ * Returns a reference to the callable HTTPS trigger with the specified url.
147
+ * @param url - The url of the trigger.
148
+ * @public
149
+ */
150
+ export declare function httpsCallableFromURL<RequestData = unknown, ResponseData = unknown, StreamData = unknown>(functionsInstance: Functions, url: string, options?: HttpsCallableOptions): HttpsCallable<RequestData, ResponseData, StreamData>;
151
+
152
+ /**
153
+ * An interface for metadata about how calls should be executed.
154
+ * @public
155
+ */
156
+ export declare interface HttpsCallableOptions {
157
+ /**
158
+ * Time in milliseconds after which to cancel if there is no response.
159
+ * Default is 70000.
160
+ */
161
+ timeout?: number;
162
+ /**
163
+ * If set to true, uses a limited-use App Check token for callable function requests from this
164
+ * instance of {@link Functions}. You must use limited-use tokens to call functions with
165
+ * replay protection enabled. By default, this is false.
166
+ */
167
+ limitedUseAppCheckTokens?: boolean;
168
+ }
169
+
170
+ /**
171
+ * An `HttpsCallableResult` wraps a single result from a function call.
172
+ * @public
173
+ */
174
+ export declare interface HttpsCallableResult<ResponseData = unknown> {
175
+ /**
176
+ * Data returned from callable function.
177
+ */
178
+ readonly data: ResponseData;
179
+ }
180
+
181
+ /**
182
+ * An interface for metadata about how a stream call should be executed.
183
+ * @public
184
+ */
185
+ export declare interface HttpsCallableStreamOptions {
186
+ /**
187
+ * An `AbortSignal` that can be used to cancel the streaming response. When the signal is aborted,
188
+ * the underlying HTTP connection will be terminated.
189
+ */
190
+ signal?: AbortSignal;
191
+ /**
192
+ * If set to true, uses a limited-use App Check token for callable function requests from this
193
+ * instance of {@link Functions}. You must use limited-use tokens to call functions with
194
+ * replay protection enabled. By default, this is false.
195
+ */
196
+ limitedUseAppCheckTokens?: boolean;
197
+ }
198
+
199
+ /**
200
+ * An `HttpsCallableStreamResult` wraps a single streaming result from a function call.
201
+ * @public
202
+ */
203
+ export declare interface HttpsCallableStreamResult<ResponseData = unknown, StreamData = unknown> {
204
+ readonly data: Promise<ResponseData>;
205
+ readonly stream: AsyncIterable<StreamData>;
206
+ }
207
+
208
+ export { }