firebase-tools 11.24.0 → 11.25.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.
Files changed (40) hide show
  1. package/lib/commands/database-import.js +74 -0
  2. package/lib/commands/ext-dev-init.js +1 -1
  3. package/lib/commands/firestore-delete.js +12 -7
  4. package/lib/commands/firestore-indexes-list.js +5 -2
  5. package/lib/commands/index.js +1 -0
  6. package/lib/commands/init.js +5 -3
  7. package/lib/commands/logout.js +15 -15
  8. package/lib/database/import.js +125 -0
  9. package/lib/deploy/extensions/prepare.js +0 -14
  10. package/lib/deploy/firestore/deploy.js +22 -16
  11. package/lib/deploy/firestore/prepare.js +34 -24
  12. package/lib/deploy/firestore/release.js +13 -9
  13. package/lib/deploy/functions/prepare.js +1 -1
  14. package/lib/deploy/functions/release/fabricator.js +2 -24
  15. package/lib/deploy/functions/release/index.js +5 -5
  16. package/lib/deploy/functions/services/firestore.js +17 -0
  17. package/lib/deploy/functions/services/index.js +14 -0
  18. package/lib/emulator/controller.js +14 -3
  19. package/lib/extensions/emulator/optionsHelper.js +1 -1
  20. package/lib/extensions/emulator/triggerHelper.js +19 -1
  21. package/lib/extensions/paramHelper.js +7 -49
  22. package/lib/extensions/warnings.js +1 -7
  23. package/lib/firestore/delete.js +6 -1
  24. package/lib/firestore/fsConfig.js +67 -0
  25. package/lib/firestore/indexes.js +13 -13
  26. package/lib/firestore/options.js +2 -0
  27. package/lib/firestore/util.js +9 -7
  28. package/lib/functions/events/v2.js +7 -1
  29. package/lib/gcp/cloudfunctions.js +4 -1
  30. package/lib/gcp/cloudfunctionsv2.js +6 -1
  31. package/lib/gcp/firestore.js +14 -1
  32. package/lib/gcp/run.js +6 -0
  33. package/lib/init/features/hosting/github.js +1 -1
  34. package/lib/rulesDeploy.js +1 -3
  35. package/npm-shrinkwrap.json +2 -2
  36. package/package.json +1 -1
  37. package/schema/firebase-config.json +137 -29
  38. package/templates/extensions/CL-template.md +2 -0
  39. package/templates/init/functions/python/main.py +4 -4
  40. package/templates/init/functions/typescript/_eslintrc +1 -1
package/lib/gcp/run.js CHANGED
@@ -24,6 +24,7 @@ function gcpIds(service) {
24
24
  }
25
25
  exports.gcpIds = gcpIds;
26
26
  async function getService(name) {
27
+ var _a, _b;
27
28
  try {
28
29
  const response = await client.get(name);
29
30
  return response.body;
@@ -31,6 +32,7 @@ async function getService(name) {
31
32
  catch (err) {
32
33
  throw new error_1.FirebaseError(`Failed to fetch Run service ${name}`, {
33
34
  original: err,
35
+ status: (_b = (_a = err === null || err === void 0 ? void 0 : err.context) === null || _a === void 0 ? void 0 : _a.response) === null || _b === void 0 ? void 0 : _b.statusCode,
34
36
  });
35
37
  }
36
38
  }
@@ -71,6 +73,7 @@ function serviceIsResolved(service) {
71
73
  }
72
74
  exports.serviceIsResolved = serviceIsResolved;
73
75
  async function replaceService(name, service) {
76
+ var _a, _b;
74
77
  try {
75
78
  const response = await client.put(name, service);
76
79
  return response.body;
@@ -78,11 +81,13 @@ async function replaceService(name, service) {
78
81
  catch (err) {
79
82
  throw new error_1.FirebaseError(`Failed to replace Run service ${name}`, {
80
83
  original: err,
84
+ status: (_b = (_a = err === null || err === void 0 ? void 0 : err.context) === null || _a === void 0 ? void 0 : _a.response) === null || _b === void 0 ? void 0 : _b.statusCode,
81
85
  });
82
86
  }
83
87
  }
84
88
  exports.replaceService = replaceService;
85
89
  async function setIamPolicy(name, policy, httpClient = client) {
90
+ var _a, _b;
86
91
  try {
87
92
  await httpClient.post(`${name}:setIamPolicy`, {
88
93
  policy,
@@ -92,6 +97,7 @@ async function setIamPolicy(name, policy, httpClient = client) {
92
97
  catch (err) {
93
98
  throw new error_1.FirebaseError(`Failed to set the IAM Policy on the Service ${name}`, {
94
99
  original: err,
100
+ status: (_b = (_a = err === null || err === void 0 ? void 0 : err.context) === null || _a === void 0 ? void 0 : _a.response) === null || _b === void 0 ? void 0 : _b.statusCode,
95
101
  });
96
102
  }
97
103
  }
@@ -24,7 +24,7 @@ let YML_FULL_PATH_PULL_REQUEST;
24
24
  let YML_FULL_PATH_MERGE;
25
25
  const YML_PULL_REQUEST_FILENAME = "firebase-hosting-pull-request.yml";
26
26
  const YML_MERGE_FILENAME = "firebase-hosting-merge.yml";
27
- const CHECKOUT_GITHUB_ACTION_NAME = "actions/checkout@v2";
27
+ const CHECKOUT_GITHUB_ACTION_NAME = "actions/checkout@v3";
28
28
  const HOSTING_GITHUB_ACTION_NAME = "FirebaseExtended/action-hosting-deploy@v0";
29
29
  const githubApiClient = new apiv2_1.Client({ urlPrefix: api_1.githubApiOrigin, auth: false });
30
30
  async function initGitHub(setup) {
@@ -145,9 +145,7 @@ class RulesDeploy {
145
145
  if (resourceName === RulesetServiceType.FIREBASE_STORAGE && !subResourceName) {
146
146
  throw new error_1.FirebaseError(`Cannot release resource type "${resourceName}"`);
147
147
  }
148
- await gcp.rules.updateOrCreateRelease(this.options.project, this.rulesetNames[filename], resourceName === RulesetServiceType.FIREBASE_STORAGE
149
- ? `${resourceName}/${subResourceName}`
150
- : resourceName);
148
+ await gcp.rules.updateOrCreateRelease(this.options.project, this.rulesetNames[filename], subResourceName ? `${resourceName}/${subResourceName}` : resourceName);
151
149
  utils.logLabeledSuccess(RulesetType[this.type], `released rules ${(0, colorette_1.bold)(filename)} to ${(0, colorette_1.bold)(resourceName)}`);
152
150
  }
153
151
  async compileRuleset(filename, files) {
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "firebase-tools",
3
- "version": "11.24.0",
3
+ "version": "11.25.0",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "firebase-tools",
9
- "version": "11.24.0",
9
+ "version": "11.25.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@google-cloud/pubsub": "^3.0.1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "firebase-tools",
3
- "version": "11.24.0",
3
+ "version": "11.25.0",
4
4
  "description": "Command-Line Interface for Firebase",
5
5
  "main": "./lib/index.js",
6
6
  "bin": {
@@ -426,42 +426,150 @@
426
426
  "$ref": "#/definitions/ExtensionsConfig"
427
427
  },
428
428
  "firestore": {
429
- "additionalProperties": false,
430
- "properties": {
431
- "indexes": {
432
- "type": "string"
433
- },
434
- "postdeploy": {
435
- "anyOf": [
436
- {
437
- "items": {
438
- "type": "string"
439
- },
440
- "type": "array"
429
+ "anyOf": [
430
+ {
431
+ "additionalProperties": false,
432
+ "properties": {
433
+ "database": {
434
+ "type": "string"
441
435
  },
442
- {
436
+ "indexes": {
443
437
  "type": "string"
444
- }
445
- ]
446
- },
447
- "predeploy": {
448
- "anyOf": [
449
- {
450
- "items": {
451
- "type": "string"
452
- },
453
- "type": "array"
454
438
  },
455
- {
439
+ "postdeploy": {
440
+ "anyOf": [
441
+ {
442
+ "items": {
443
+ "type": "string"
444
+ },
445
+ "type": "array"
446
+ },
447
+ {
448
+ "type": "string"
449
+ }
450
+ ]
451
+ },
452
+ "predeploy": {
453
+ "anyOf": [
454
+ {
455
+ "items": {
456
+ "type": "string"
457
+ },
458
+ "type": "array"
459
+ },
460
+ {
461
+ "type": "string"
462
+ }
463
+ ]
464
+ },
465
+ "rules": {
456
466
  "type": "string"
457
467
  }
458
- ]
468
+ },
469
+ "type": "object"
459
470
  },
460
- "rules": {
461
- "type": "string"
471
+ {
472
+ "items": {
473
+ "anyOf": [
474
+ {
475
+ "additionalProperties": false,
476
+ "properties": {
477
+ "database": {
478
+ "type": "string"
479
+ },
480
+ "indexes": {
481
+ "type": "string"
482
+ },
483
+ "postdeploy": {
484
+ "anyOf": [
485
+ {
486
+ "items": {
487
+ "type": "string"
488
+ },
489
+ "type": "array"
490
+ },
491
+ {
492
+ "type": "string"
493
+ }
494
+ ]
495
+ },
496
+ "predeploy": {
497
+ "anyOf": [
498
+ {
499
+ "items": {
500
+ "type": "string"
501
+ },
502
+ "type": "array"
503
+ },
504
+ {
505
+ "type": "string"
506
+ }
507
+ ]
508
+ },
509
+ "rules": {
510
+ "type": "string"
511
+ },
512
+ "target": {
513
+ "type": "string"
514
+ }
515
+ },
516
+ "required": [
517
+ "target"
518
+ ],
519
+ "type": "object"
520
+ },
521
+ {
522
+ "additionalProperties": false,
523
+ "properties": {
524
+ "database": {
525
+ "type": "string"
526
+ },
527
+ "indexes": {
528
+ "type": "string"
529
+ },
530
+ "postdeploy": {
531
+ "anyOf": [
532
+ {
533
+ "items": {
534
+ "type": "string"
535
+ },
536
+ "type": "array"
537
+ },
538
+ {
539
+ "type": "string"
540
+ }
541
+ ]
542
+ },
543
+ "predeploy": {
544
+ "anyOf": [
545
+ {
546
+ "items": {
547
+ "type": "string"
548
+ },
549
+ "type": "array"
550
+ },
551
+ {
552
+ "type": "string"
553
+ }
554
+ ]
555
+ },
556
+ "rules": {
557
+ "type": "string"
558
+ },
559
+ "target": {
560
+ "type": "string"
561
+ }
562
+ },
563
+ "required": [
564
+ "database"
565
+ ],
566
+ "type": "object"
567
+ }
568
+ ]
569
+ },
570
+ "type": "array"
462
571
  }
463
- },
464
- "type": "object"
572
+ ]
465
573
  },
466
574
  "functions": {
467
575
  "anyOf": [
@@ -0,0 +1,2 @@
1
+ ## Version 0.0.1
2
+ - Initial Version
@@ -2,12 +2,12 @@
2
2
  # To get started, simply uncomment the below code or create your own.
3
3
  # Deploy with `firebase deploy`
4
4
 
5
- from firebase_functions import https
5
+ from firebase_functions import https_fn
6
6
  from firebase_admin import initialize_app
7
7
 
8
8
  # initialize_app()
9
9
  #
10
10
  #
11
- # @https.on_request()
12
- # def on_request_example(req: https.Request) -> https.Response:
13
- # return https.Response("Hello world!")
11
+ # @https_fn.on_request()
12
+ # def on_request_example(req: https_fn.Request) -> https_fn.Response:
13
+ # return https_fn.Response("Hello world!")
@@ -27,6 +27,6 @@ module.exports = {
27
27
  rules: {
28
28
  "quotes": ["error", "double"],
29
29
  "import/no-unresolved": 0,
30
- "indent": ["error", 2]
30
+ "indent": ["error", 2],
31
31
  },
32
32
  };