firebase-tools 12.4.0 → 12.4.1

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.
Files changed (49) hide show
  1. package/lib/api/frameworks.js +21 -0
  2. package/lib/api.js +4 -2
  3. package/lib/auth.js +3 -3
  4. package/lib/command.js +15 -4
  5. package/lib/commands/ext-install.js +10 -4
  6. package/lib/commands/index.js +2 -0
  7. package/lib/commands/init.js +8 -0
  8. package/lib/commands/internaltesting-frameworks-init.js +14 -0
  9. package/lib/config.js +1 -0
  10. package/lib/deploy/extensions/prepare.js +1 -0
  11. package/lib/deploy/extensions/release.js +11 -1
  12. package/lib/deploy/functions/checkIam.js +4 -1
  13. package/lib/deploy/functions/prepare.js +2 -1
  14. package/lib/deploy/functions/runtimes/discovery/index.js +6 -0
  15. package/lib/deploy/functions/runtimes/node/index.js +12 -4
  16. package/lib/deploy/functions/runtimes/python/index.js +19 -25
  17. package/lib/deploy/hosting/deploy.js +0 -6
  18. package/lib/deploy/hosting/prepare.js +7 -1
  19. package/lib/deploy/index.js +11 -4
  20. package/lib/deploy/lifecycleHooks.js +3 -0
  21. package/lib/detectProjectRoot.js +4 -1
  22. package/lib/dynamicImport.js +11 -1
  23. package/lib/emulator/commandUtils.js +4 -4
  24. package/lib/emulator/controller.js +9 -7
  25. package/lib/emulator/downloadableEmulators.js +3 -3
  26. package/lib/emulator/functionsEmulator.js +1 -2
  27. package/lib/emulator/storage/index.js +6 -0
  28. package/lib/emulator/storage/rules/manager.js +0 -4
  29. package/lib/emulator/storage/server.js +52 -0
  30. package/lib/ensureApiEnabled.js +3 -1
  31. package/lib/experiments.js +5 -0
  32. package/lib/extensions/paramHelper.js +0 -5
  33. package/lib/frameworks/constants.js +2 -15
  34. package/lib/frameworks/index.js +13 -8
  35. package/lib/frameworks/utils.js +50 -20
  36. package/lib/functionsConfig.js +2 -2
  37. package/lib/gcp/cloudbuild.js +50 -0
  38. package/lib/init/features/composer/repo.js +121 -0
  39. package/lib/init/features/frameworks/constants.js +7 -0
  40. package/lib/init/features/frameworks/index.js +36 -0
  41. package/lib/init/features/index.js +3 -1
  42. package/lib/init/index.js +4 -0
  43. package/lib/management/projects.js +5 -1
  44. package/lib/monospace/index.js +7 -7
  45. package/lib/requireAuth.js +1 -1
  46. package/lib/track.js +91 -52
  47. package/lib/utils.js +6 -1
  48. package/package.json +1 -1
  49. package/schema/extension-yaml.json +432 -0
@@ -0,0 +1,432 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "additionalProperties": false,
4
+ "definitions": {
5
+ "author": {
6
+ "additionalProperties": false,
7
+ "type": "object",
8
+ "properties": {
9
+ "authorName": {
10
+ "type": "string",
11
+ "description": "The author's name"
12
+ },
13
+ "email": {
14
+ "type": "string",
15
+ "description": "A contact email for the author"
16
+ },
17
+ "url": {
18
+ "type": "string",
19
+ "description": "URL of the author's website"
20
+ }
21
+ }
22
+ },
23
+ "role": {
24
+ "additionalProperties": false,
25
+ "type": "object",
26
+ "description": "An IAM role to grant to this extension.",
27
+ "properties": {
28
+ "role": {
29
+ "type": "string",
30
+ "description": "Name of the IAM role to grant. Must be on the list of allowed roles: https://firebase.google.com/docs/extensions/publishers/access#supported-roles",
31
+ "pattern": "[a-zA-Z]+\\.[a-zA-Z]+"
32
+ },
33
+ "reason": {
34
+ "type": "string",
35
+ "description": "Why this extension needs this IAM role"
36
+ },
37
+ "resource": {
38
+ "type": "string",
39
+ "description": "What resource to grant this role on. If omitted, defaults to projects/${project_id}"
40
+ }
41
+ },
42
+ "required": ["role", "reason"]
43
+ },
44
+ "api": {
45
+ "additionalProperties": false,
46
+ "type": "object",
47
+ "description": "A Google API used by this extension. Will be enabled on extension deployment.",
48
+ "properties": {
49
+ "apiName": {
50
+ "type": "string",
51
+ "description": "Name of the Google API to enable. Should match the service name listed in https://console.cloud.google.com/apis/library",
52
+ "pattern": "[^\\.]+\\.googleapis\\.com"
53
+ },
54
+ "reason": {
55
+ "type": "string",
56
+ "description": "Why this extension needs this API enabled"
57
+ }
58
+ },
59
+ "required": ["apiName", "reason"]
60
+ },
61
+ "externalService": {
62
+ "additionalProperties": false,
63
+ "type": "object",
64
+ "description": "A non-Google API used by this extension",
65
+ "properties": {
66
+ "name": {
67
+ "type": "string",
68
+ "description": "Name of the external service"
69
+ },
70
+ "pricingUri": {
71
+ "type": "string",
72
+ "description": "URI to pricing information for the service"
73
+ }
74
+ }
75
+ },
76
+ "param": {
77
+ "additionalProperties": false,
78
+ "type": "object",
79
+ "description": "A parameter that users installing this extension can configure",
80
+ "properties": {
81
+ "param": {
82
+ "type": "string",
83
+ "description": "The name of the param. This is how you reference the param in your code"
84
+ },
85
+ "label": {
86
+ "type": "string",
87
+ "description": "Short description for the parameter. Displayed to users when they're prompted for the parameter's value."
88
+ },
89
+ "description": {
90
+ "type": "string",
91
+ "description": "Detailed description for the parameter. Displayed to users when they're prompted for the parameter's value."
92
+ },
93
+ "example": {
94
+ "type": "string",
95
+ "description": "Example value for the parameter."
96
+ },
97
+ "validationRegex": {
98
+ "type": "string",
99
+ "description": "Regular expression for validation of the parameter's user-configured value. Uses Google RE2 syntax."
100
+ },
101
+ "validationErrorMessage": {
102
+ "type": "string",
103
+ "description": "Error message to display if regex validation fails."
104
+ },
105
+ "default": {
106
+ "type": "string",
107
+ "description": "Default value for the parameter if the user leaves the parameter's value blank."
108
+ },
109
+ "required": {
110
+ "type": "boolean",
111
+ "description": "Defines whether the user can submit an empty string when they're prompted for the parameter's value. Defaults to true."
112
+ },
113
+ "immutable": {
114
+ "type": "boolean",
115
+ "description": "Defines whether the user can change the parameter's value after installation (such as if they reconfigure the extension). Defaults to false."
116
+ },
117
+ "advanced": {
118
+ "type": "boolean",
119
+ "description": "Whether this a param for advanced users. When true, only users who choose 'advanced configuration' will see this param."
120
+ },
121
+ "type": {
122
+ "type": "string",
123
+ "description": "The parameter type. Special parameter types might have additional requirements or different UI presentation. See https://firebase.google.com/docs/extensions/reference/extension-yaml#params for more details.",
124
+ "pattern": "string|STRING|select|SELECT|multiselect|MULTISELECT|secret|SECRET|selectresource|SELECTRESOURCE"
125
+ },
126
+ "resourceType": {
127
+ "type": "string",
128
+ "description": "The type of resource to prompt the user to select. Provides a special UI treatment for the param.",
129
+ "pattern": "storage\\.googleapis\\.com\\/Bucket|firestore\\.googleapis\\.com\\/Database|firebasedatabase\\.googleapis\\.com\\/DatabaseInstance"
130
+ },
131
+ "options": {
132
+ "type": "array",
133
+ "description": "Options for a select or multiselect type param.",
134
+ "items": {
135
+ "$ref": "#/definitions/paramOption"
136
+ }
137
+ }
138
+ },
139
+ "required": ["param"]
140
+ },
141
+ "paramOption": {
142
+ "additionalProperties": false,
143
+ "type": "object",
144
+ "properties": {
145
+ "value": {
146
+ "type": "string",
147
+ "description": "One of the values the user can choose. This is the value you get when you read the parameter value in code."
148
+ },
149
+ "label": {
150
+ "type": "string",
151
+ "description": "Short description of the selectable option. If omitted, defaults to value."
152
+ }
153
+ },
154
+ "required": ["value"]
155
+ },
156
+ "resource":{
157
+ "additionalProperties": false,
158
+ "type": "object",
159
+ "properties": {
160
+ "name": {
161
+ "type": "string",
162
+ "description": "The name of this resource"
163
+ },
164
+ "type": {
165
+ "type": "string",
166
+ "description": "What type of resource this is. See https://firebase.google.com/docs/extensions/reference/extension-yaml#resources for a full list of options."
167
+ },
168
+ "description": {
169
+ "type": "string",
170
+ "description": "A brief description of what this resource does"
171
+ },
172
+ "properties": {
173
+ "type": "object",
174
+ "description": "The properties of this resource",
175
+ "additionalProperties": true,
176
+ "properties": {
177
+ "location": {
178
+ "type": "string",
179
+ "description": "The location for this resource"
180
+ },
181
+ "entryPoint": {
182
+ "type": "string",
183
+ "description": "The entry point for a function resource"
184
+ },
185
+ "sourceDirectory": {
186
+ "type": "string",
187
+ "description": "Directory that contains your package.json at its root. The file for your functions source code must be in this directory. Defaults to functions"
188
+ },
189
+ "timeout": {
190
+ "type": "string",
191
+ "description": "A function resources's maximum execution time.",
192
+ "pattern": "\\d+s"
193
+ },
194
+ "availableMemoryMb": {
195
+ "type": "string",
196
+ "description": "Amount of memory in MB available for the function.",
197
+ "pattern": "\\d+"
198
+ },
199
+ "runtime": {
200
+ "type": "string",
201
+ "description": "Runtime environment for the function. Defaults to the most recent LTS version of node."
202
+ },
203
+ "httpsTrigger": {
204
+ "type": "object",
205
+ "description": "A function triggered by HTTPS calls",
206
+ "properties": {}
207
+ },
208
+ "eventTrigger": {
209
+ "type": "object",
210
+ "description": "A function triggered by a background event",
211
+ "properties": {
212
+ "eventType": {
213
+ "type": "string",
214
+ "description": "The type of background event to trigger on. See https://firebase.google.com/docs/extensions/publishers/functions#supported for a full list."
215
+ },
216
+ "resource": {
217
+ "type": "string",
218
+ "description": "The name or pattern of the resource to trigger on"
219
+ },
220
+ "eventFilters": {
221
+ "type": "string",
222
+ "description": "Filters that further limit the events to listen to."
223
+ },
224
+ "channel": {
225
+ "type": "string",
226
+ "description": "The name of the channel associated with the trigger in projects/{project}/locations/{location}/channels/{channel} format. If you omit this property, the function will listen for events on the project's default channel."
227
+ },
228
+ "triggerRegion": {
229
+ "type": "string",
230
+ "description": "The trigger will only receive events originating in this region. It can be the same region as the function, a different region or multi-region, or the global region. If not provided, defaults to the same region as the function."
231
+ }
232
+ },
233
+ "required": ["eventType"]
234
+ },
235
+ "scheduleTrigger": {
236
+ "type": "object",
237
+ "description": "A function triggered at a regular interval by a Cloud Scheduler job",
238
+ "properties": {
239
+ "schedule": {
240
+ "type": "string",
241
+ "description": "The frequency at which you want the function to run. Accepts unix-cron (https://cloud.google.com/scheduler/docs/configuring/cron-job-schedules) or App Engine (https://cloud.google.com/appengine/docs/standard/nodejs/scheduling-jobs-with-cron-yaml#defining_the_cron_job_schedule) syntax."
242
+ },
243
+ "timeZone": {
244
+ "type": "string",
245
+ "description": "The time zone in which the schedule will run. Defaults to UTC."
246
+ }
247
+ },
248
+ "required": ["schedule"]
249
+ },
250
+ "taskQueueTrigger": {
251
+ "type": "object",
252
+ "description": "A function triggered by a Cloud Task",
253
+ "properties": {}
254
+ },
255
+ "buildConfig": {
256
+ "type": "object",
257
+ "description": "Build configuration for a gen 2 Cloud Function",
258
+ "properties": {
259
+ "runtime": {
260
+ "type": "string",
261
+ "description": "Runtime environment for the function. Defaults to the most recent LTS version of node."
262
+ },
263
+ "entryPoint": {
264
+ "type": "string",
265
+ "description": "The entry point for a function resource"
266
+ }
267
+ }
268
+ },
269
+ "serviceConfig": {
270
+ "type": "object",
271
+ "description": "Service configuration for a gen 2 Cloud Function",
272
+ "properties": {
273
+ "timeoutSeconds": {
274
+ "type": "string",
275
+ "description": "The function's maximum execution time. Default: 60, max value: 540."
276
+ },
277
+ "availableMemory": {
278
+ "type": "string",
279
+ "description": "The amount of memory available for a function. Defaults to 256M. Supported units are k, M, G, Mi, Gi. If no unit is supplied, the value is interpreted as bytes."
280
+ }
281
+ }
282
+ }
283
+ }
284
+ }
285
+ },
286
+ "required": ["name", "type", "description", "properties"]
287
+ },
288
+ "lifecycleEvent": {
289
+ "type": "object",
290
+ "additionalProperties": false,
291
+ "properties": {
292
+ "onInstall": {
293
+ "$ref": "#/definitions/lifecycleEventSpec"
294
+ },
295
+ "onUpdate": {
296
+ "$ref": "#/definitions/lifecycleEventSpec"
297
+ },
298
+ "onConfigure": {
299
+ "$ref": "#/definitions/lifecycleEventSpec"
300
+ }
301
+ }
302
+ },
303
+ "lifecycleEventSpec": {
304
+ "type": "object",
305
+ "additionalProperties": false,
306
+ "properties": {
307
+ "function": {
308
+ "type": "string",
309
+ "description": "Name of the task queue-triggered function that will handle the event. This function must be a taskQueueTriggered function declared in the resources section."
310
+ },
311
+ "processingMessage": {
312
+ "type": "string",
313
+ "description": "Message to display in the Firebase console while the task is in progress."
314
+ }
315
+ }
316
+ },
317
+ "event": {
318
+ "type": "object",
319
+ "additionalProperties": false,
320
+ "properties": {
321
+ "type": {
322
+ "type": "string",
323
+ "description": "The type identifier of the event. Construct the identifier out of 3-4 dot-delimited fields: the publisher ID, extension name, and event name fields are required; the version field is recommended. Choose a unique and descriptive event name for each event type you publish."
324
+ },
325
+ "description": {
326
+ "type": "string",
327
+ "description": "A description of the event"
328
+ }
329
+ }
330
+ }
331
+ },
332
+ "properties": {
333
+ "name": {
334
+ "type": "string",
335
+ "description": "ID of this extension (ie your-extension-name)"
336
+ },
337
+ "version": {
338
+ "type": "string",
339
+ "description": "Version of this extension. Follows https://semver.org/."
340
+ },
341
+ "specVersion": {
342
+ "type":"string",
343
+ "description": "Version of the extension.yaml spec that this file follows. Currently always 'v1beta'"
344
+ },
345
+ "license": {
346
+ "type": "string",
347
+ "description": "The software license agreement for this extension. Currently, only 'Apache-2.0' is permitted on extensions.dev"
348
+ },
349
+ "displayName": {
350
+ "type": "string",
351
+ "description": "Human readable name for this extension (ie 'Your Extension Name')"
352
+ },
353
+ "description": {
354
+ "type": "string",
355
+ "description": "A one to two sentence description of what this extension does"
356
+ },
357
+ "icon": {
358
+ "type": "string",
359
+ "description": "The file name of this extension's icon"
360
+ },
361
+ "billingRequired": {
362
+ "type": "boolean",
363
+ "description": "Whether this extension requires a billing to be enabled on the project it is installed on"
364
+ },
365
+ "tags": {
366
+ "type": "array",
367
+ "items": {
368
+ "type": "string"
369
+ },
370
+ "description": "A list of tags to help users find your extension in search"
371
+ },
372
+ "sourceUrl": {
373
+ "type": "string",
374
+ "description": "The URL of the GitHub repo hosting this code"
375
+ },
376
+ "releaseNotesUrl": {
377
+ "type": "string",
378
+ "description": "A URL where users can view the full changelog or release notes for this extension"
379
+ },
380
+ "author": {
381
+ "$ref": "#/definitions/author"
382
+ },
383
+ "contributors": {
384
+ "type": "array",
385
+ "items": {
386
+ "$ref": "#/definitions/author"
387
+ }
388
+ },
389
+ "apis": {
390
+ "type": "array",
391
+ "items": {
392
+ "$ref": "#/definitions/api"
393
+ }
394
+ },
395
+ "roles": {
396
+ "type": "array",
397
+ "items": {
398
+ "$ref": "#/definitions/role"
399
+ }
400
+ },
401
+ "externalServices": {
402
+ "type": "array",
403
+ "items": {
404
+ "$ref": "#/definitions/externalService"
405
+ }
406
+ },
407
+ "params": {
408
+ "type": "array",
409
+ "items": {
410
+ "$ref": "#/definitions/param"
411
+ }
412
+ },
413
+ "resources": {
414
+ "type": "array",
415
+ "items": {
416
+ "$ref": "#/definitions/resource"
417
+ }
418
+ },
419
+ "lifecycleEvents": {
420
+ "type": "array",
421
+ "items": {
422
+ "$ref": "#/definitions/lifecycleEvent"
423
+ }
424
+ },
425
+ "events": {
426
+ "type": "array",
427
+ "items": {
428
+ "$ref": "#/definitions/event"
429
+ }
430
+ }
431
+ }
432
+ }