firebase-functions 3.24.1 → 4.0.0-rc.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.
- package/README.md +7 -9
- package/lib/bin/firebase-functions.js +13 -15
- package/lib/common/app.d.ts +14 -0
- package/lib/common/app.js +62 -0
- package/lib/common/change.d.ts +0 -5
- package/lib/common/change.js +5 -7
- package/lib/common/config.d.ts +6 -0
- package/lib/common/config.js +49 -0
- package/lib/common/debug.js +2 -2
- package/lib/common/encoding.d.ts +0 -8
- package/lib/common/encoding.js +6 -29
- package/lib/common/options.d.ts +14 -0
- package/lib/common/options.js +44 -0
- package/lib/common/params.d.ts +32 -0
- package/lib/common/params.js +23 -0
- package/lib/common/providers/database.d.ts +17 -19
- package/lib/common/providers/database.js +68 -39
- package/lib/common/providers/https.d.ts +11 -52
- package/lib/common/providers/https.js +115 -110
- package/lib/common/providers/identity.d.ts +8 -8
- package/lib/common/providers/identity.js +71 -79
- package/lib/common/providers/tasks.d.ts +11 -10
- package/lib/common/providers/tasks.js +10 -9
- package/lib/common/timezone.js +538 -538
- package/lib/common/trace.d.ts +14 -0
- package/lib/common/trace.js +69 -0
- package/lib/{encoder.d.ts → common/utilities/encoder.d.ts} +0 -0
- package/lib/{encoder.js → common/utilities/encoder.js} +1 -1
- package/lib/{utilities → common/utilities}/path-pattern.d.ts +0 -0
- package/lib/{utilities → common/utilities}/path-pattern.js +17 -16
- package/lib/{utilities → common/utilities}/path.d.ts +0 -0
- package/lib/{utilities → common/utilities}/path.js +5 -7
- package/lib/{utils.d.ts → common/utilities/utils.d.ts} +1 -1
- package/lib/{utils.js → common/utilities/utils.js} +18 -12
- package/lib/logger/common.d.ts +1 -3
- package/lib/logger/common.js +9 -14
- package/lib/logger/compat.js +9 -9
- package/lib/logger/index.d.ts +1 -1
- package/lib/logger/index.js +24 -30
- package/lib/{v2/params → params}/index.d.ts +22 -9
- package/lib/{v2/params → params}/index.js +22 -14
- package/lib/params/types.d.ts +180 -0
- package/lib/params/types.js +289 -0
- package/lib/runtime/loader.js +12 -14
- package/lib/runtime/manifest.d.ts +56 -24
- package/lib/runtime/manifest.js +114 -4
- package/lib/v1/cloud-functions.d.ts +232 -0
- package/lib/v1/cloud-functions.js +205 -0
- package/lib/v1/config.d.ts +8 -0
- package/lib/v1/config.js +75 -0
- package/lib/{function-builder.d.ts → v1/function-builder.d.ts} +16 -16
- package/lib/{function-builder.js → v1/function-builder.js} +56 -46
- package/lib/v1/function-configuration.d.ts +197 -0
- package/lib/v1/function-configuration.js +70 -0
- package/lib/v1/index.d.ts +20 -0
- package/lib/{index.js → v1/index.js} +5 -10
- package/lib/{providers → v1/providers}/analytics.d.ts +5 -11
- package/lib/{providers → v1/providers}/analytics.js +49 -43
- package/lib/{providers → v1/providers}/auth.d.ts +28 -18
- package/lib/{providers → v1/providers}/auth.js +45 -34
- package/lib/{providers → v1/providers}/database.d.ts +25 -42
- package/lib/{providers → v1/providers}/database.js +46 -46
- package/lib/{providers → v1/providers}/firestore.d.ts +15 -33
- package/lib/{providers → v1/providers}/firestore.js +40 -44
- package/lib/{providers → v1/providers}/https.d.ts +3 -8
- package/lib/{providers → v1/providers}/https.js +14 -22
- package/lib/{providers → v1/providers}/pubsub.d.ts +8 -16
- package/lib/{providers → v1/providers}/pubsub.js +22 -26
- package/lib/{providers → v1/providers}/remoteConfig.d.ts +2 -11
- package/lib/{providers → v1/providers}/remoteConfig.js +9 -9
- package/lib/{providers → v1/providers}/storage.d.ts +11 -26
- package/lib/{providers → v1/providers}/storage.js +24 -29
- package/lib/{providers → v1/providers}/tasks.d.ts +6 -8
- package/lib/{providers → v1/providers}/tasks.js +12 -17
- package/lib/{providers → v1/providers}/testLab.d.ts +86 -46
- package/lib/{providers → v1/providers}/testLab.js +14 -14
- package/lib/v2/core.d.ts +4 -5
- package/lib/v2/index.d.ts +16 -14
- package/lib/v2/index.js +5 -1
- package/lib/v2/options.d.ts +52 -32
- package/lib/v2/options.js +32 -47
- package/lib/v2/providers/alerts/alerts.d.ts +20 -18
- package/lib/v2/providers/alerts/alerts.js +9 -6
- package/lib/v2/providers/alerts/appDistribution.d.ts +28 -26
- package/lib/v2/providers/alerts/appDistribution.js +8 -7
- package/lib/v2/providers/alerts/billing.d.ts +5 -5
- package/lib/v2/providers/alerts/billing.js +5 -4
- package/lib/v2/providers/alerts/crashlytics.d.ts +32 -30
- package/lib/v2/providers/alerts/crashlytics.js +10 -9
- package/lib/v2/providers/alerts/index.d.ts +5 -5
- package/lib/v2/providers/alerts/performance.d.ts +3 -3
- package/lib/v2/providers/alerts/performance.js +5 -7
- package/lib/v2/providers/database.d.ts +41 -38
- package/lib/v2/providers/database.js +22 -17
- package/lib/v2/providers/eventarc.d.ts +25 -23
- package/lib/v2/providers/eventarc.js +10 -7
- package/lib/v2/providers/https.d.ts +43 -33
- package/lib/v2/providers/https.js +18 -56
- package/lib/v2/providers/identity.d.ts +25 -23
- package/lib/v2/providers/identity.js +10 -7
- package/lib/v2/providers/pubsub.d.ts +25 -23
- package/lib/v2/providers/pubsub.js +11 -27
- package/lib/v2/providers/remoteConfig.d.ts +63 -0
- package/lib/v2/providers/remoteConfig.js +65 -0
- package/lib/v2/providers/scheduler.d.ts +14 -12
- package/lib/v2/providers/scheduler.js +16 -14
- package/lib/v2/providers/storage.d.ts +32 -30
- package/lib/v2/providers/storage.js +16 -32
- package/lib/v2/providers/tasks.d.ts +30 -26
- package/lib/v2/providers/tasks.js +14 -31
- package/lib/v2/providers/testLab.d.ts +110 -0
- package/lib/v2/providers/testLab.js +65 -0
- package/lib/v2/trace.d.ts +4 -0
- package/lib/v2/trace.js +21 -0
- package/package.json +61 -66
- package/lib/apps.d.ts +0 -35
- package/lib/apps.js +0 -112
- package/lib/cloud-functions.d.ts +0 -231
- package/lib/cloud-functions.js +0 -251
- package/lib/config.d.ts +0 -24
- package/lib/config.js +0 -117
- package/lib/function-configuration.d.ts +0 -108
- package/lib/function-configuration.js +0 -71
- package/lib/handler-builder.d.ts +0 -256
- package/lib/handler-builder.js +0 -349
- package/lib/index.d.ts +0 -19
- package/lib/setup.d.ts +0 -1
- package/lib/setup.js +0 -60
- package/lib/v2/params/types.d.ts +0 -118
- package/lib/v2/params/types.js +0 -196
package/lib/handler-builder.js
DELETED
|
@@ -1,349 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// The MIT License (MIT)
|
|
3
|
-
//
|
|
4
|
-
// Copyright (c) 2017 Firebase
|
|
5
|
-
//
|
|
6
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
-
// of this software and associated documentation files (the "Software"), to deal
|
|
8
|
-
// in the Software without restriction, including without limitation the rights
|
|
9
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
-
// copies of the Software, and to permit persons to whom the Software is
|
|
11
|
-
// furnished to do so, subject to the following conditions:
|
|
12
|
-
//
|
|
13
|
-
// The above copyright notice and this permission notice shall be included in all
|
|
14
|
-
// copies or substantial portions of the Software.
|
|
15
|
-
//
|
|
16
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
-
// SOFTWARE.
|
|
23
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
-
exports.handler = exports.HandlerBuilder = void 0;
|
|
25
|
-
const apps_1 = require("./apps");
|
|
26
|
-
const analytics = require("./providers/analytics");
|
|
27
|
-
const auth = require("./providers/auth");
|
|
28
|
-
const database = require("./providers/database");
|
|
29
|
-
const firestore = require("./providers/firestore");
|
|
30
|
-
const https = require("./providers/https");
|
|
31
|
-
const pubsub = require("./providers/pubsub");
|
|
32
|
-
const remoteConfig = require("./providers/remoteConfig");
|
|
33
|
-
const storage = require("./providers/storage");
|
|
34
|
-
const tasks = require("./providers/tasks");
|
|
35
|
-
const testLab = require("./providers/testLab");
|
|
36
|
-
/**
|
|
37
|
-
* The `HandlerBuilder` class facilitates the writing of functions by developers
|
|
38
|
-
* building Firebase Extensions as well as developers who want to use the gcloud CLI or
|
|
39
|
-
* Google Cloud Console to deploy their functions.
|
|
40
|
-
*
|
|
41
|
-
* **Do not use `HandlerBuilder` when writing normal functions for deployment via
|
|
42
|
-
* the Firebase CLI.** For normal purposes, use
|
|
43
|
-
* [`FunctionBuilder`](/docs/reference/functions/function_builder_.functionbuilder).
|
|
44
|
-
*/
|
|
45
|
-
class HandlerBuilder {
|
|
46
|
-
constructor() { }
|
|
47
|
-
/**
|
|
48
|
-
* Create a handler for HTTPS events.
|
|
49
|
-
|
|
50
|
-
* `onRequest` handles an HTTPS request and has the same signature as an Express app.
|
|
51
|
-
*
|
|
52
|
-
* @example
|
|
53
|
-
* ```javascript
|
|
54
|
-
* exports.myFunction = functions.handler.https.onRequest((req, res) => { ... })
|
|
55
|
-
* ```
|
|
56
|
-
*
|
|
57
|
-
* `onCall` declares a callable function for clients to call using a Firebase SDK.
|
|
58
|
-
*
|
|
59
|
-
* @example
|
|
60
|
-
* ```javascript
|
|
61
|
-
* exports.myFunction = functions.handler.https.onCall((data, context) => { ... })
|
|
62
|
-
* ```
|
|
63
|
-
*/
|
|
64
|
-
get https() {
|
|
65
|
-
return {
|
|
66
|
-
onRequest: (handler) => {
|
|
67
|
-
const func = https._onRequestWithOptions(handler, {});
|
|
68
|
-
func.__trigger = {};
|
|
69
|
-
func.__endpoint = undefined;
|
|
70
|
-
func.__requiredAPIs = undefined;
|
|
71
|
-
return func;
|
|
72
|
-
},
|
|
73
|
-
onCall: (handler) => {
|
|
74
|
-
const func = https._onCallWithOptions(handler, {});
|
|
75
|
-
func.__trigger = {};
|
|
76
|
-
func.__endpoint = undefined;
|
|
77
|
-
func.__requiredAPIs = undefined;
|
|
78
|
-
return func;
|
|
79
|
-
},
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Create a handler for tasks functions.
|
|
84
|
-
*
|
|
85
|
-
* @example
|
|
86
|
-
* ```javascript
|
|
87
|
-
* exports.myFunction = functions.handler.tasks.onDispatch((data, context) => { ... })
|
|
88
|
-
* ```
|
|
89
|
-
*/
|
|
90
|
-
/** @hidden */
|
|
91
|
-
get tasks() {
|
|
92
|
-
return {
|
|
93
|
-
get taskQueue() {
|
|
94
|
-
return {
|
|
95
|
-
onDispatch: (handler) => {
|
|
96
|
-
const builder = new tasks.TaskQueueBuilder();
|
|
97
|
-
const func = builder.onDispatch(handler);
|
|
98
|
-
func.__trigger = {};
|
|
99
|
-
func.__endpoint = undefined;
|
|
100
|
-
func.__requiredAPIs = undefined;
|
|
101
|
-
return func;
|
|
102
|
-
},
|
|
103
|
-
};
|
|
104
|
-
},
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Create a handler for Firebase Realtime Database events.
|
|
109
|
-
*
|
|
110
|
-
* `ref.onCreate` handles the creation of new data.
|
|
111
|
-
*
|
|
112
|
-
* @example
|
|
113
|
-
* ```javascript
|
|
114
|
-
* exports.myFunction = functions.handler.database.ref.onCreate((snap, context) => { ... })
|
|
115
|
-
* ```
|
|
116
|
-
*
|
|
117
|
-
* `ref.onUpdate` handles updates to existing data.
|
|
118
|
-
*
|
|
119
|
-
* @example
|
|
120
|
-
* ```javascript
|
|
121
|
-
* exports.myFunction = functions.handler.database.ref.onUpdate((change, context) => { ... })
|
|
122
|
-
* ```
|
|
123
|
-
|
|
124
|
-
* `ref.onDelete` handles the deletion of existing data.
|
|
125
|
-
*
|
|
126
|
-
* @example
|
|
127
|
-
* ```javascript
|
|
128
|
-
* exports.myFunction = functions.handler.database.ref.onDelete((snap, context) => { ... })
|
|
129
|
-
* ```
|
|
130
|
-
|
|
131
|
-
* `ref.onWrite` handles the creation, update, or deletion of data.
|
|
132
|
-
*
|
|
133
|
-
* @example
|
|
134
|
-
* ```javascript
|
|
135
|
-
* exports.myFunction = functions.handler.database.ref.onWrite((change, context) => { ... })
|
|
136
|
-
* ```
|
|
137
|
-
*/
|
|
138
|
-
get database() {
|
|
139
|
-
return {
|
|
140
|
-
/** @hidden */
|
|
141
|
-
get instance() {
|
|
142
|
-
return {
|
|
143
|
-
get ref() {
|
|
144
|
-
return new database.RefBuilder((0, apps_1.apps)(), () => null, {});
|
|
145
|
-
},
|
|
146
|
-
};
|
|
147
|
-
},
|
|
148
|
-
get ref() {
|
|
149
|
-
return new database.RefBuilder((0, apps_1.apps)(), () => null, {});
|
|
150
|
-
},
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* Create a handler for Cloud Firestore events.
|
|
155
|
-
*
|
|
156
|
-
* `document.onCreate` handles the creation of new documents.
|
|
157
|
-
*
|
|
158
|
-
* @example
|
|
159
|
-
* ```javascript
|
|
160
|
-
* exports.myFunction = functions.handler.firestore.document.onCreate((snap, context) => { ... })
|
|
161
|
-
* ```
|
|
162
|
-
|
|
163
|
-
* `document.onUpdate` handles updates to existing documents.
|
|
164
|
-
*
|
|
165
|
-
* @example
|
|
166
|
-
* ```javascript
|
|
167
|
-
* exports.myFunction = functions.handler.firestore.document.onUpdate((change, context) => { ... })
|
|
168
|
-
* ```
|
|
169
|
-
|
|
170
|
-
* `document.onDelete` handles the deletion of existing documents.
|
|
171
|
-
*
|
|
172
|
-
* @example
|
|
173
|
-
* ```javascript
|
|
174
|
-
* exports.myFunction = functions.handler.firestore.document.onDelete((snap, context) =>
|
|
175
|
-
* { ... })
|
|
176
|
-
* ```
|
|
177
|
-
|
|
178
|
-
* `document.onWrite` handles the creation, update, or deletion of documents.
|
|
179
|
-
*
|
|
180
|
-
* @example
|
|
181
|
-
* ```javascript
|
|
182
|
-
* exports.myFunction = functions.handler.firestore.document.onWrite((change, context) =>
|
|
183
|
-
* { ... })
|
|
184
|
-
* ```
|
|
185
|
-
*/
|
|
186
|
-
get firestore() {
|
|
187
|
-
return {
|
|
188
|
-
get document() {
|
|
189
|
-
return new firestore.DocumentBuilder(() => null, {});
|
|
190
|
-
},
|
|
191
|
-
/** @hidden */
|
|
192
|
-
get namespace() {
|
|
193
|
-
return new firestore.DocumentBuilder(() => null, {});
|
|
194
|
-
},
|
|
195
|
-
/** @hidden */
|
|
196
|
-
get database() {
|
|
197
|
-
return new firestore.DocumentBuilder(() => null, {});
|
|
198
|
-
},
|
|
199
|
-
};
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* Create a handler for Firebase Remote Config events.
|
|
203
|
-
|
|
204
|
-
* `remoteConfig.onUpdate` handles events that update a Remote Config template.
|
|
205
|
-
|
|
206
|
-
* @example
|
|
207
|
-
* ```javascript
|
|
208
|
-
* exports.myFunction = functions.handler.remoteConfig.onUpdate() => { ... })
|
|
209
|
-
* ```
|
|
210
|
-
*/
|
|
211
|
-
get remoteConfig() {
|
|
212
|
-
return {
|
|
213
|
-
onUpdate: (handler) => {
|
|
214
|
-
return new remoteConfig.UpdateBuilder(() => null, {}).onUpdate(handler);
|
|
215
|
-
},
|
|
216
|
-
};
|
|
217
|
-
}
|
|
218
|
-
/**
|
|
219
|
-
* Create a handler for Google Analytics events.
|
|
220
|
-
|
|
221
|
-
* `event.onLog` handles the logging of Analytics conversion events.
|
|
222
|
-
|
|
223
|
-
* @example
|
|
224
|
-
* ```javascript
|
|
225
|
-
* exports.myFunction = functions.handler.analytics.event.onLog((event) => { ... })
|
|
226
|
-
* ```
|
|
227
|
-
*/
|
|
228
|
-
get analytics() {
|
|
229
|
-
return {
|
|
230
|
-
get event() {
|
|
231
|
-
return new analytics.AnalyticsEventBuilder(() => null, {});
|
|
232
|
-
},
|
|
233
|
-
};
|
|
234
|
-
}
|
|
235
|
-
/**
|
|
236
|
-
* Create a handler for Cloud Storage for Firebase events.
|
|
237
|
-
*
|
|
238
|
-
* `object.onArchive` handles the archiving of Storage objects.
|
|
239
|
-
*
|
|
240
|
-
* @example
|
|
241
|
-
* ```javascript
|
|
242
|
-
* exports.myFunction = functions.handler.storage.object.onArchive((object) => { ... })
|
|
243
|
-
* ```
|
|
244
|
-
|
|
245
|
-
* `object.onDelete` handles the deletion of Storage objects.
|
|
246
|
-
*
|
|
247
|
-
* @example
|
|
248
|
-
* ```javascript
|
|
249
|
-
* exports.myFunction = functions.handler.storage.object.onDelete((object) => { ... })
|
|
250
|
-
* ```
|
|
251
|
-
|
|
252
|
-
* `object.onFinalize` handles the creation of Storage objects.
|
|
253
|
-
*
|
|
254
|
-
* @example
|
|
255
|
-
* ```javascript
|
|
256
|
-
* exports.myFunction = functions.handler.storage.object.onFinalize((object) =>
|
|
257
|
-
* { ... })
|
|
258
|
-
* ```
|
|
259
|
-
|
|
260
|
-
* `object.onMetadataUpdate` handles changes to the metadata of existing Storage objects.
|
|
261
|
-
*
|
|
262
|
-
* @example
|
|
263
|
-
* ```javascript
|
|
264
|
-
* exports.myFunction = functions.handler.storage.object.onMetadataUpdate((object) =>
|
|
265
|
-
* { ... })
|
|
266
|
-
* ```
|
|
267
|
-
*/
|
|
268
|
-
get storage() {
|
|
269
|
-
return {
|
|
270
|
-
get bucket() {
|
|
271
|
-
return new storage.BucketBuilder(() => null, {}).object();
|
|
272
|
-
},
|
|
273
|
-
get object() {
|
|
274
|
-
return new storage.ObjectBuilder(() => null, {});
|
|
275
|
-
},
|
|
276
|
-
};
|
|
277
|
-
}
|
|
278
|
-
/**
|
|
279
|
-
* Create a handler for Cloud Pub/Sub events.
|
|
280
|
-
*
|
|
281
|
-
* `topic.onPublish` handles messages published to a Pub/Sub topic from SDKs, Cloud Console, or gcloud CLI.
|
|
282
|
-
*
|
|
283
|
-
* @example
|
|
284
|
-
* ```javascript
|
|
285
|
-
* exports.myFunction = functions.handler.pubsub.topic.onPublish((message) => { ... })
|
|
286
|
-
* ```
|
|
287
|
-
|
|
288
|
-
* `schedule.onPublish` handles messages published to a Pub/Sub topic on a schedule.
|
|
289
|
-
*
|
|
290
|
-
* @example
|
|
291
|
-
* ```javascript
|
|
292
|
-
* exports.myFunction = functions.handler.pubsub.schedule.onPublish((message) => { ... })
|
|
293
|
-
* ```
|
|
294
|
-
*/
|
|
295
|
-
get pubsub() {
|
|
296
|
-
return {
|
|
297
|
-
get topic() {
|
|
298
|
-
return new pubsub.TopicBuilder(() => null, {});
|
|
299
|
-
},
|
|
300
|
-
get schedule() {
|
|
301
|
-
return new pubsub.ScheduleBuilder(() => null, {});
|
|
302
|
-
},
|
|
303
|
-
};
|
|
304
|
-
}
|
|
305
|
-
/**
|
|
306
|
-
* Create a handler for Firebase Authentication events.
|
|
307
|
-
*
|
|
308
|
-
* `user.onCreate` handles the creation of users.
|
|
309
|
-
*
|
|
310
|
-
* @example
|
|
311
|
-
* ```javascript
|
|
312
|
-
* exports.myFunction = functions.handler.auth.user.onCreate((user) => { ... })
|
|
313
|
-
* ```
|
|
314
|
-
|
|
315
|
-
* `user.onDelete` handles the deletion of users.
|
|
316
|
-
*
|
|
317
|
-
* @example
|
|
318
|
-
* ```javascript
|
|
319
|
-
* exports.myFunction = functions.handler.auth.user.onDelete((user => { ... })
|
|
320
|
-
* ```
|
|
321
|
-
|
|
322
|
-
*/
|
|
323
|
-
get auth() {
|
|
324
|
-
return {
|
|
325
|
-
get user() {
|
|
326
|
-
return new auth.UserBuilder(() => null, {}, {});
|
|
327
|
-
},
|
|
328
|
-
};
|
|
329
|
-
}
|
|
330
|
-
/**
|
|
331
|
-
* Create a handler for Firebase Test Lab events.
|
|
332
|
-
|
|
333
|
-
* `testMatrix.onComplete` handles the completion of a test matrix.
|
|
334
|
-
|
|
335
|
-
* @example
|
|
336
|
-
* ```javascript
|
|
337
|
-
* exports.myFunction = functions.handler.testLab.testMatrix.onComplete((testMatrix) => { ... })
|
|
338
|
-
* ```
|
|
339
|
-
*/
|
|
340
|
-
get testLab() {
|
|
341
|
-
return {
|
|
342
|
-
get testMatrix() {
|
|
343
|
-
return new testLab.TestMatrixBuilder(() => null, {});
|
|
344
|
-
},
|
|
345
|
-
};
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
exports.HandlerBuilder = HandlerBuilder;
|
|
349
|
-
exports.handler = new HandlerBuilder();
|
package/lib/index.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import * as analytics from './providers/analytics';
|
|
2
|
-
import * as auth from './providers/auth';
|
|
3
|
-
import * as database from './providers/database';
|
|
4
|
-
import * as firestore from './providers/firestore';
|
|
5
|
-
import * as https from './providers/https';
|
|
6
|
-
import * as pubsub from './providers/pubsub';
|
|
7
|
-
import * as remoteConfig from './providers/remoteConfig';
|
|
8
|
-
import * as storage from './providers/storage';
|
|
9
|
-
import * as tasks from './providers/tasks';
|
|
10
|
-
import * as testLab from './providers/testLab';
|
|
11
|
-
import * as apps from './apps';
|
|
12
|
-
import { handler } from './handler-builder';
|
|
13
|
-
import * as logger from './logger';
|
|
14
|
-
declare const app: apps.apps.Apps;
|
|
15
|
-
export { analytics, app, auth, database, firestore, handler, https, pubsub, remoteConfig, storage, tasks, testLab, logger, };
|
|
16
|
-
export * from './cloud-functions';
|
|
17
|
-
export * from './config';
|
|
18
|
-
export * from './function-builder';
|
|
19
|
-
export * from './function-configuration';
|
package/lib/setup.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function setup(): void;
|
package/lib/setup.js
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// The MIT License (MIT)
|
|
3
|
-
//
|
|
4
|
-
// Copyright (c) 2017 Firebase
|
|
5
|
-
//
|
|
6
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
-
// of this software and associated documentation files (the "Software"), to deal
|
|
8
|
-
// in the Software without restriction, including without limitation the rights
|
|
9
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
-
// copies of the Software, and to permit persons to whom the Software is
|
|
11
|
-
// furnished to do so, subject to the following conditions:
|
|
12
|
-
//
|
|
13
|
-
// The above copyright notice and this permission notice shall be included in all
|
|
14
|
-
// copies or substantial portions of the Software.
|
|
15
|
-
//
|
|
16
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
-
// SOFTWARE.
|
|
23
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
-
exports.setup = void 0;
|
|
25
|
-
/** @hidden */
|
|
26
|
-
const config_1 = require("./config");
|
|
27
|
-
const logger_1 = require("./logger");
|
|
28
|
-
// Set up for config and vars
|
|
29
|
-
function setup() {
|
|
30
|
-
// TEMPORARY WORKAROUND (BUG 63586213):
|
|
31
|
-
// Until the Cloud Functions builder can publish FIREBASE_CONFIG, automatically provide it on import based on what
|
|
32
|
-
// we can deduce.
|
|
33
|
-
if (!process.env.FIREBASE_CONFIG) {
|
|
34
|
-
const cfg = (0, config_1.firebaseConfig)();
|
|
35
|
-
if (cfg) {
|
|
36
|
-
process.env.FIREBASE_CONFIG = JSON.stringify(cfg);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
// WORKAROUND (BUG 134416569): GCLOUD_PROJECT missing in Node 10
|
|
40
|
-
if (!process.env.GCLOUD_PROJECT && process.env.FIREBASE_CONFIG) {
|
|
41
|
-
process.env.GCLOUD_PROJECT = JSON.parse(process.env.FIREBASE_CONFIG).projectId;
|
|
42
|
-
}
|
|
43
|
-
// If FIREBASE_CONFIG is still not found, try using GCLOUD_PROJECT to estimate
|
|
44
|
-
if (!process.env.FIREBASE_CONFIG) {
|
|
45
|
-
if (process.env.GCLOUD_PROJECT) {
|
|
46
|
-
(0, logger_1.warn)('Warning, estimating Firebase Config based on GCLOUD_PROJECT. Initializing firebase-admin may fail');
|
|
47
|
-
process.env.FIREBASE_CONFIG = JSON.stringify({
|
|
48
|
-
databaseURL: process.env.DATABASE_URL ||
|
|
49
|
-
`https://${process.env.GCLOUD_PROJECT}.firebaseio.com`,
|
|
50
|
-
storageBucket: process.env.STORAGE_BUCKET_URL ||
|
|
51
|
-
`${process.env.GCLOUD_PROJECT}.appspot.com`,
|
|
52
|
-
projectId: process.env.GCLOUD_PROJECT,
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
(0, logger_1.warn)('Warning, FIREBASE_CONFIG and GCLOUD_PROJECT environment variables are missing. Initializing firebase-admin will fail');
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
exports.setup = setup;
|
package/lib/v2/params/types.d.ts
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
export declare abstract class Expression<T extends string | number | boolean | string[]> {
|
|
2
|
-
value(): T;
|
|
3
|
-
toCEL(): string;
|
|
4
|
-
toJSON(): string;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* A CEL expression corresponding to a ternary operator, e.g {{ cond ? ifTrue : ifFalse }}
|
|
8
|
-
*/
|
|
9
|
-
export declare class TernaryExpression<T extends string | number | boolean | string[]> extends Expression<T> {
|
|
10
|
-
private readonly test;
|
|
11
|
-
private readonly ifTrue;
|
|
12
|
-
private readonly ifFalse;
|
|
13
|
-
constructor(test: Expression<boolean>, ifTrue: T, ifFalse: T);
|
|
14
|
-
value(): T;
|
|
15
|
-
toString(): string;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* A CEL expression that evaluates to boolean true or false based on a comparison
|
|
19
|
-
* between the value of another expression and a literal of that same type.
|
|
20
|
-
*/
|
|
21
|
-
export declare class CompareExpression<T extends string | number | boolean | string[]> extends Expression<boolean> {
|
|
22
|
-
cmp: '==' | '>' | '>=' | '<' | '<=';
|
|
23
|
-
lhs: Expression<T>;
|
|
24
|
-
rhs: T;
|
|
25
|
-
constructor(cmp: '==' | '>' | '>=' | '<' | '<=', lhs: Expression<T>, rhs: T);
|
|
26
|
-
value(): boolean;
|
|
27
|
-
toString(): string;
|
|
28
|
-
then(ifTrue: T, ifFalse: T): TernaryExpression<T>;
|
|
29
|
-
}
|
|
30
|
-
/** @hidden */
|
|
31
|
-
declare type ParamValueType = 'string' | 'list' | 'boolean' | 'int' | 'float' | 'secret';
|
|
32
|
-
declare type ParamInput<T> = {
|
|
33
|
-
text: TextInput<T>;
|
|
34
|
-
} | {
|
|
35
|
-
select: SelectInput<T>;
|
|
36
|
-
} | {
|
|
37
|
-
resource: ResourceInput;
|
|
38
|
-
};
|
|
39
|
-
/**
|
|
40
|
-
* Specifies that a Param's value should be determined by prompting the user
|
|
41
|
-
* to type it in interactively at deploy-time. Input that does not match the
|
|
42
|
-
* provided validationRegex, if present, will be retried.
|
|
43
|
-
*/
|
|
44
|
-
export interface TextInput<T = unknown> {
|
|
45
|
-
example?: string;
|
|
46
|
-
validationRegex?: string;
|
|
47
|
-
validationErrorMessage?: string;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Specifies that a Param's value should be determined by having the user
|
|
51
|
-
* select from a list containing all the project's resources of a certain
|
|
52
|
-
* type. Currently, only type:"storage.googleapis.com/Bucket" is supported.
|
|
53
|
-
*/
|
|
54
|
-
export interface ResourceInput {
|
|
55
|
-
resource: {
|
|
56
|
-
type: string;
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Specifies that a Param's value should be determined by having the user select
|
|
61
|
-
* from a list of pre-canned options interactively at deploy-time.
|
|
62
|
-
*/
|
|
63
|
-
export interface SelectInput<T = unknown> {
|
|
64
|
-
options: Array<SelectOptions<T>>;
|
|
65
|
-
}
|
|
66
|
-
export interface SelectOptions<T = unknown> {
|
|
67
|
-
label?: string;
|
|
68
|
-
value: T;
|
|
69
|
-
}
|
|
70
|
-
export interface ParamSpec<T = unknown> {
|
|
71
|
-
name: string;
|
|
72
|
-
default?: T;
|
|
73
|
-
label?: string;
|
|
74
|
-
description?: string;
|
|
75
|
-
type: ParamValueType;
|
|
76
|
-
input?: ParamInput<T>;
|
|
77
|
-
}
|
|
78
|
-
export declare type ParamOptions<T = unknown> = Omit<ParamSpec<T>, 'name' | 'type'>;
|
|
79
|
-
export declare abstract class Param<T extends string | number | boolean | string[]> extends Expression<T> {
|
|
80
|
-
readonly name: string;
|
|
81
|
-
readonly options: ParamOptions<T>;
|
|
82
|
-
static type: ParamValueType;
|
|
83
|
-
constructor(name: string, options?: ParamOptions<T>);
|
|
84
|
-
value(): T;
|
|
85
|
-
cmp(cmp: '==' | '>' | '>=' | '<' | '<=', rhs: T): CompareExpression<T>;
|
|
86
|
-
equals(rhs: T): CompareExpression<T>;
|
|
87
|
-
toString(): string;
|
|
88
|
-
toSpec(): ParamSpec<T>;
|
|
89
|
-
}
|
|
90
|
-
export declare class SecretParam {
|
|
91
|
-
static type: ParamValueType;
|
|
92
|
-
name: string;
|
|
93
|
-
constructor(name: string);
|
|
94
|
-
value(): string;
|
|
95
|
-
toSpec(): ParamSpec<string>;
|
|
96
|
-
}
|
|
97
|
-
export declare class StringParam extends Param<string> {
|
|
98
|
-
value(): string;
|
|
99
|
-
}
|
|
100
|
-
export declare class IntParam extends Param<number> {
|
|
101
|
-
static type: ParamValueType;
|
|
102
|
-
value(): number;
|
|
103
|
-
}
|
|
104
|
-
export declare class FloatParam extends Param<number> {
|
|
105
|
-
static type: ParamValueType;
|
|
106
|
-
value(): number;
|
|
107
|
-
}
|
|
108
|
-
export declare class BooleanParam extends Param<boolean> {
|
|
109
|
-
static type: ParamValueType;
|
|
110
|
-
value(): boolean;
|
|
111
|
-
then<T extends string | number | boolean>(ifTrue: T, ifFalse: T): TernaryExpression<T>;
|
|
112
|
-
}
|
|
113
|
-
export declare class ListParam extends Param<string[]> {
|
|
114
|
-
static type: ParamValueType;
|
|
115
|
-
value(): string[];
|
|
116
|
-
toSpec(): ParamSpec<string[]>;
|
|
117
|
-
}
|
|
118
|
-
export {};
|