firebase-tools 10.0.1 → 10.1.3

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 (254) hide show
  1. package/lib/accountExporter.js +9 -8
  2. package/lib/accountImporter.js +10 -8
  3. package/lib/api.js +1 -0
  4. package/lib/apiv2.js +91 -48
  5. package/lib/appdistribution/client.js +1 -1
  6. package/lib/appdistribution/options-parser-util.js +1 -1
  7. package/lib/archiveDirectory.js +63 -73
  8. package/lib/auth.js +2 -2
  9. package/lib/bin/firebase.js +1 -1
  10. package/lib/command.js +26 -26
  11. package/lib/commands/appdistribution-distribute.js +4 -4
  12. package/lib/commands/appdistribution-testers-add.js +2 -2
  13. package/lib/commands/appdistribution-testers-remove.js +2 -2
  14. package/lib/commands/apps-android-sha-create.js +2 -2
  15. package/lib/commands/apps-android-sha-delete.js +2 -2
  16. package/lib/commands/apps-android-sha-list.js +2 -2
  17. package/lib/commands/apps-create.js +9 -9
  18. package/lib/commands/apps-list.js +3 -3
  19. package/lib/commands/apps-sdkconfig.js +8 -8
  20. package/lib/commands/auth-export.js +26 -25
  21. package/lib/commands/auth-import.js +88 -78
  22. package/lib/commands/database-get.js +1 -1
  23. package/lib/commands/database-instances-create.js +4 -4
  24. package/lib/commands/database-instances-list.js +4 -4
  25. package/lib/commands/database-profile.js +1 -1
  26. package/lib/commands/database-push.js +1 -1
  27. package/lib/commands/database-remove.js +2 -2
  28. package/lib/commands/database-set.js +2 -2
  29. package/lib/commands/database-settings-get.js +1 -1
  30. package/lib/commands/database-settings-set.js +1 -1
  31. package/lib/commands/database-update.js +2 -2
  32. package/lib/commands/ext-configure.js +3 -3
  33. package/lib/commands/ext-dev-deprecate.js +4 -4
  34. package/lib/commands/ext-dev-extension-delete.js +3 -3
  35. package/lib/commands/ext-dev-init.js +4 -4
  36. package/lib/commands/ext-dev-list.js +1 -1
  37. package/lib/commands/ext-dev-publish.js +4 -4
  38. package/lib/commands/ext-dev-register.js +6 -6
  39. package/lib/commands/ext-dev-undeprecate.js +4 -4
  40. package/lib/commands/ext-dev-unpublish.js +3 -3
  41. package/lib/commands/ext-dev-usage.js +140 -0
  42. package/lib/commands/ext-export.js +8 -8
  43. package/lib/commands/ext-info.js +5 -5
  44. package/lib/commands/ext-install.js +27 -23
  45. package/lib/commands/ext-list.js +2 -2
  46. package/lib/commands/ext-sources-create.js +2 -2
  47. package/lib/commands/ext-uninstall.js +4 -4
  48. package/lib/commands/ext-update.js +18 -18
  49. package/lib/commands/ext.js +3 -3
  50. package/lib/commands/firestore-delete.js +1 -1
  51. package/lib/commands/functions-config-clone.js +22 -23
  52. package/lib/commands/functions-config-export.js +11 -11
  53. package/lib/commands/functions-config-get.js +22 -22
  54. package/lib/commands/functions-config-set.js +24 -22
  55. package/lib/commands/functions-config-unset.js +20 -22
  56. package/lib/commands/functions-delete.js +3 -3
  57. package/lib/commands/functions-deletegcfartifacts.js +4 -4
  58. package/lib/commands/functions-list.js +1 -1
  59. package/lib/commands/functions-log.js +1 -1
  60. package/lib/commands/help.js +12 -12
  61. package/lib/commands/hosting-channel-create.js +13 -13
  62. package/lib/commands/hosting-channel-delete.js +10 -10
  63. package/lib/commands/hosting-channel-deploy.js +18 -18
  64. package/lib/commands/hosting-channel-list.js +5 -5
  65. package/lib/commands/hosting-channel-open.js +9 -9
  66. package/lib/commands/hosting-clone.js +16 -16
  67. package/lib/commands/hosting-disable.js +1 -1
  68. package/lib/commands/hosting-sites-create.js +7 -7
  69. package/lib/commands/hosting-sites-delete.js +7 -7
  70. package/lib/commands/hosting-sites-get.js +2 -2
  71. package/lib/commands/hosting-sites-list.js +3 -3
  72. package/lib/commands/index.js +1 -0
  73. package/lib/commands/login-ci.js +10 -10
  74. package/lib/commands/login.js +2 -2
  75. package/lib/commands/logout.js +1 -1
  76. package/lib/commands/open.js +1 -1
  77. package/lib/commands/projects-addfirebase.js +2 -2
  78. package/lib/commands/projects-create.js +2 -2
  79. package/lib/commands/projects-list.js +1 -1
  80. package/lib/commands/remoteconfig-get.js +3 -3
  81. package/lib/commands/remoteconfig-rollback.js +3 -3
  82. package/lib/commands/remoteconfig-versions-list.js +7 -2
  83. package/lib/commands/setup-emulators-database.js +8 -7
  84. package/lib/commands/setup-emulators-firestore.js +8 -7
  85. package/lib/commands/setup-emulators-pubsub.js +5 -4
  86. package/lib/commands/setup-emulators-storage.js +4 -3
  87. package/lib/commands/setup-emulators-ui.js +8 -7
  88. package/lib/commands/target-apply.js +17 -16
  89. package/lib/commands/target-clear.js +11 -10
  90. package/lib/commands/target-remove.js +10 -9
  91. package/lib/commands/target.js +20 -20
  92. package/lib/config.js +6 -6
  93. package/lib/database/api.js +2 -2
  94. package/lib/database/metadata.js +16 -24
  95. package/lib/defaultCredentials.js +3 -3
  96. package/lib/deploy/extensions/deploy.js +4 -4
  97. package/lib/deploy/extensions/deploymentSummary.js +5 -4
  98. package/lib/deploy/extensions/index.js +1 -0
  99. package/lib/deploy/extensions/params.js +1 -1
  100. package/lib/deploy/extensions/planner.js +3 -3
  101. package/lib/deploy/extensions/prepare.js +9 -9
  102. package/lib/deploy/extensions/release.js +1 -1
  103. package/lib/deploy/extensions/secrets.js +7 -7
  104. package/lib/deploy/extensions/validate.js +2 -2
  105. package/lib/deploy/functions/backend.js +9 -5
  106. package/lib/deploy/functions/checkIam.js +7 -7
  107. package/lib/deploy/functions/containerCleaner.js +3 -3
  108. package/lib/deploy/functions/deploy.js +4 -4
  109. package/lib/deploy/functions/ensureCloudBuildEnabled.js +3 -3
  110. package/lib/deploy/functions/index.js +1 -0
  111. package/lib/deploy/functions/prepare.js +29 -23
  112. package/lib/deploy/functions/prompts.js +5 -5
  113. package/lib/deploy/functions/release/executor.js +4 -1
  114. package/lib/deploy/functions/release/fabricator.js +9 -6
  115. package/lib/deploy/functions/release/index.js +2 -2
  116. package/lib/deploy/functions/release/planner.js +6 -6
  117. package/lib/deploy/functions/release/reporter.js +8 -4
  118. package/lib/deploy/functions/runtimes/discovery/index.js +2 -2
  119. package/lib/deploy/functions/runtimes/discovery/v1alpha1.js +14 -14
  120. package/lib/deploy/functions/runtimes/golang/index.js +11 -14
  121. package/lib/deploy/functions/runtimes/index.js +6 -10
  122. package/lib/deploy/functions/runtimes/node/index.js +6 -10
  123. package/lib/deploy/functions/runtimes/node/parseTriggers.js +3 -3
  124. package/lib/deploy/functions/runtimes/node/validate.js +2 -1
  125. package/lib/deploy/functions/services/storage.js +1 -1
  126. package/lib/deploy/functions/triggerRegionHelper.js +1 -1
  127. package/lib/deploy/functions/validate.js +32 -4
  128. package/lib/deploy/hosting/convertConfig.js +45 -24
  129. package/lib/deploy/hosting/deploy.js +7 -7
  130. package/lib/deploy/hosting/prepare.js +1 -1
  131. package/lib/deploy/hosting/uploader.js +1 -1
  132. package/lib/deploy/hosting/validate.js +3 -3
  133. package/lib/deploy/remoteconfig/prepare.js +3 -3
  134. package/lib/deploy/remoteconfig/release.js +3 -3
  135. package/lib/deploy/storage/deploy.js +1 -1
  136. package/lib/deploy/storage/release.js +2 -2
  137. package/lib/detectProjectRoot.js +5 -5
  138. package/lib/emulator/auth/apiSpec.js +13 -7
  139. package/lib/emulator/auth/handlers.js +3 -3
  140. package/lib/emulator/auth/index.js +1 -1
  141. package/lib/emulator/auth/operations.js +256 -248
  142. package/lib/emulator/auth/server.js +11 -8
  143. package/lib/emulator/auth/state.js +12 -12
  144. package/lib/emulator/commandUtils.js +5 -5
  145. package/lib/emulator/controller.js +16 -11
  146. package/lib/emulator/downloadableEmulators.js +5 -4
  147. package/lib/emulator/emulatorLogger.js +1 -1
  148. package/lib/emulator/functionsEmulator.js +110 -75
  149. package/lib/emulator/functionsEmulatorRuntime.js +36 -21
  150. package/lib/emulator/functionsEmulatorShell.js +3 -2
  151. package/lib/emulator/functionsRuntimeWorker.js +1 -1
  152. package/lib/emulator/hubExport.js +2 -2
  153. package/lib/emulator/storage/apis/firebase.js +2 -2
  154. package/lib/emulator/storage/apis/gcloud.js +2 -2
  155. package/lib/emulator/storage/cloudFunctions.js +1 -1
  156. package/lib/emulator/storage/files.js +14 -14
  157. package/lib/emulator/storage/index.js +2 -2
  158. package/lib/emulator/storage/metadata.js +7 -6
  159. package/lib/emulator/storage/rules/runtime.js +10 -9
  160. package/lib/emulator/storage/server.js +2 -2
  161. package/lib/ensureApiEnabled.js +7 -7
  162. package/lib/error.js +3 -3
  163. package/lib/extensions/askUserForConsent.js +3 -4
  164. package/lib/extensions/askUserForParam.js +11 -11
  165. package/lib/extensions/billingMigrationHelper.js +2 -2
  166. package/lib/extensions/changelog.js +4 -4
  167. package/lib/extensions/displayExtensionInfo.js +6 -6
  168. package/lib/extensions/emulator/optionsHelper.js +1 -1
  169. package/lib/extensions/emulator/specHelper.js +1 -1
  170. package/lib/extensions/emulator/triggerHelper.js +1 -1
  171. package/lib/extensions/export.js +6 -6
  172. package/lib/extensions/extensionsApi.js +68 -110
  173. package/lib/extensions/extensionsHelper.js +56 -43
  174. package/lib/extensions/listExtensions.js +1 -1
  175. package/lib/extensions/localHelper.js +1 -1
  176. package/lib/extensions/metricsTypeDef.js +2 -0
  177. package/lib/extensions/metricsUtils.js +98 -0
  178. package/lib/extensions/paramHelper.js +6 -6
  179. package/lib/extensions/provisioningHelper.js +13 -14
  180. package/lib/extensions/resolveSource.js +6 -6
  181. package/lib/extensions/secretsUtils.js +3 -3
  182. package/lib/extensions/updateHelper.js +10 -10
  183. package/lib/extensions/utils.js +1 -1
  184. package/lib/extensions/warnings.js +11 -10
  185. package/lib/fetchWebSetup.js +2 -2
  186. package/lib/filterTargets.js +2 -2
  187. package/lib/firestore/indexes.js +2 -2
  188. package/lib/fsAsync.js +3 -3
  189. package/lib/fsutils.js +2 -2
  190. package/lib/functional.js +2 -1
  191. package/lib/functions/env.js +1 -1
  192. package/lib/functions/runtimeConfigExport.js +4 -4
  193. package/lib/functionsConfig.js +7 -8
  194. package/lib/functionsShellCommandAction.js +4 -3
  195. package/lib/gcp/cloudbilling.js +8 -19
  196. package/lib/gcp/cloudfunctions.js +22 -46
  197. package/lib/gcp/cloudlogging.js +8 -11
  198. package/lib/gcp/cloudmonitoring.js +77 -0
  199. package/lib/gcp/cloudscheduler.js +8 -19
  200. package/lib/gcp/firedata.js +5 -4
  201. package/lib/gcp/firestore.js +5 -5
  202. package/lib/gcp/iam.js +19 -34
  203. package/lib/gcp/resourceManager.js +10 -15
  204. package/lib/gcp/rules.js +18 -41
  205. package/lib/gcp/runtimeconfig.js +31 -53
  206. package/lib/gcp/secretManager.js +24 -45
  207. package/lib/gcp/storage.js +24 -29
  208. package/lib/getDefaultDatabaseInstance.js +1 -1
  209. package/lib/getDefaultHostingSite.js +1 -1
  210. package/lib/getProjectNumber.js +2 -2
  211. package/lib/handlePreviewToggles.js +5 -5
  212. package/lib/hosting/api.js +6 -6
  213. package/lib/hosting/cloudRunProxy.js +6 -6
  214. package/lib/hosting/functionsProxy.js +3 -3
  215. package/lib/hosting/implicitInit.js +2 -2
  216. package/lib/hosting/normalizedHostingConfigs.js +3 -3
  217. package/lib/hosting/proxy.js +2 -2
  218. package/lib/init/features/account.js +7 -7
  219. package/lib/init/features/database.js +9 -9
  220. package/lib/init/features/emulators.js +8 -8
  221. package/lib/init/features/firestore/index.js +3 -3
  222. package/lib/init/features/firestore/indexes.js +2 -2
  223. package/lib/init/features/firestore/rules.js +2 -2
  224. package/lib/init/features/functions/golang.js +4 -4
  225. package/lib/init/features/functions/index.js +4 -4
  226. package/lib/init/features/hosting/github.js +31 -31
  227. package/lib/init/features/project.js +8 -8
  228. package/lib/init/features/remoteconfig.js +2 -2
  229. package/lib/init/features/storage.js +2 -2
  230. package/lib/listFiles.js +1 -1
  231. package/lib/management/apps.js +3 -3
  232. package/lib/management/projects.js +6 -6
  233. package/lib/previews.js +2 -2
  234. package/lib/profiler.js +1 -1
  235. package/lib/projectPath.js +1 -1
  236. package/lib/projectUtils.js +2 -2
  237. package/lib/prompt.js +0 -1
  238. package/lib/rc.js +1 -1
  239. package/lib/remoteconfig/get.js +14 -8
  240. package/lib/remoteconfig/rollback.js +13 -6
  241. package/lib/remoteconfig/versionslist.js +13 -7
  242. package/lib/requireAuth.js +2 -2
  243. package/lib/requireDatabaseInstance.js +1 -1
  244. package/lib/requireHostingSite.js +1 -1
  245. package/lib/requirePermissions.js +4 -4
  246. package/lib/rulesDeploy.js +2 -2
  247. package/lib/serve/functions.js +14 -7
  248. package/lib/serve/hosting.js +7 -7
  249. package/lib/utils.js +3 -2
  250. package/npm-shrinkwrap.json +24090 -0
  251. package/package.json +36 -31
  252. package/schema/firebase-config.json +387 -12
  253. package/lib/commands/functions-config-legacy.js +0 -45
  254. package/lib/prepareFirebaseRules.js +0 -58
@@ -384,6 +384,38 @@
384
384
  "headers": {
385
385
  "items": {
386
386
  "anyOf": [
387
+ {
388
+ "additionalProperties": false,
389
+ "properties": {
390
+ "glob": {
391
+ "type": "string"
392
+ },
393
+ "headers": {
394
+ "items": {
395
+ "additionalProperties": false,
396
+ "properties": {
397
+ "key": {
398
+ "type": "string"
399
+ },
400
+ "value": {
401
+ "type": "string"
402
+ }
403
+ },
404
+ "required": [
405
+ "key",
406
+ "value"
407
+ ],
408
+ "type": "object"
409
+ },
410
+ "type": "array"
411
+ }
412
+ },
413
+ "required": [
414
+ "glob",
415
+ "headers"
416
+ ],
417
+ "type": "object"
418
+ },
387
419
  {
388
420
  "additionalProperties": false,
389
421
  "properties": {
@@ -502,6 +534,25 @@
502
534
  "redirects": {
503
535
  "items": {
504
536
  "anyOf": [
537
+ {
538
+ "additionalProperties": false,
539
+ "properties": {
540
+ "destination": {
541
+ "type": "string"
542
+ },
543
+ "glob": {
544
+ "type": "string"
545
+ },
546
+ "type": {
547
+ "type": "number"
548
+ }
549
+ },
550
+ "required": [
551
+ "destination",
552
+ "glob"
553
+ ],
554
+ "type": "object"
555
+ },
505
556
  {
506
557
  "additionalProperties": false,
507
558
  "properties": {
@@ -517,8 +568,7 @@
517
568
  },
518
569
  "required": [
519
570
  "destination",
520
- "source",
521
- "type"
571
+ "source"
522
572
  ],
523
573
  "type": "object"
524
574
  },
@@ -537,8 +587,7 @@
537
587
  },
538
588
  "required": [
539
589
  "destination",
540
- "regex",
541
- "type"
590
+ "regex"
542
591
  ],
543
592
  "type": "object"
544
593
  }
@@ -549,6 +598,82 @@
549
598
  "rewrites": {
550
599
  "items": {
551
600
  "anyOf": [
601
+ {
602
+ "additionalProperties": false,
603
+ "properties": {
604
+ "destination": {
605
+ "type": "string"
606
+ },
607
+ "glob": {
608
+ "type": "string"
609
+ }
610
+ },
611
+ "required": [
612
+ "destination",
613
+ "glob"
614
+ ],
615
+ "type": "object"
616
+ },
617
+ {
618
+ "additionalProperties": false,
619
+ "properties": {
620
+ "function": {
621
+ "type": "string"
622
+ },
623
+ "glob": {
624
+ "type": "string"
625
+ }
626
+ },
627
+ "required": [
628
+ "function",
629
+ "glob"
630
+ ],
631
+ "type": "object"
632
+ },
633
+ {
634
+ "additionalProperties": false,
635
+ "properties": {
636
+ "glob": {
637
+ "type": "string"
638
+ },
639
+ "run": {
640
+ "additionalProperties": false,
641
+ "properties": {
642
+ "region": {
643
+ "type": "string"
644
+ },
645
+ "serviceId": {
646
+ "type": "string"
647
+ }
648
+ },
649
+ "required": [
650
+ "serviceId"
651
+ ],
652
+ "type": "object"
653
+ }
654
+ },
655
+ "required": [
656
+ "glob",
657
+ "run"
658
+ ],
659
+ "type": "object"
660
+ },
661
+ {
662
+ "additionalProperties": false,
663
+ "properties": {
664
+ "dynamicLinks": {
665
+ "type": "boolean"
666
+ },
667
+ "glob": {
668
+ "type": "string"
669
+ }
670
+ },
671
+ "required": [
672
+ "dynamicLinks",
673
+ "glob"
674
+ ],
675
+ "type": "object"
676
+ },
552
677
  {
553
678
  "additionalProperties": false,
554
679
  "properties": {
@@ -732,6 +857,38 @@
732
857
  "headers": {
733
858
  "items": {
734
859
  "anyOf": [
860
+ {
861
+ "additionalProperties": false,
862
+ "properties": {
863
+ "glob": {
864
+ "type": "string"
865
+ },
866
+ "headers": {
867
+ "items": {
868
+ "additionalProperties": false,
869
+ "properties": {
870
+ "key": {
871
+ "type": "string"
872
+ },
873
+ "value": {
874
+ "type": "string"
875
+ }
876
+ },
877
+ "required": [
878
+ "key",
879
+ "value"
880
+ ],
881
+ "type": "object"
882
+ },
883
+ "type": "array"
884
+ }
885
+ },
886
+ "required": [
887
+ "glob",
888
+ "headers"
889
+ ],
890
+ "type": "object"
891
+ },
735
892
  {
736
893
  "additionalProperties": false,
737
894
  "properties": {
@@ -850,6 +1007,25 @@
850
1007
  "redirects": {
851
1008
  "items": {
852
1009
  "anyOf": [
1010
+ {
1011
+ "additionalProperties": false,
1012
+ "properties": {
1013
+ "destination": {
1014
+ "type": "string"
1015
+ },
1016
+ "glob": {
1017
+ "type": "string"
1018
+ },
1019
+ "type": {
1020
+ "type": "number"
1021
+ }
1022
+ },
1023
+ "required": [
1024
+ "destination",
1025
+ "glob"
1026
+ ],
1027
+ "type": "object"
1028
+ },
853
1029
  {
854
1030
  "additionalProperties": false,
855
1031
  "properties": {
@@ -865,8 +1041,7 @@
865
1041
  },
866
1042
  "required": [
867
1043
  "destination",
868
- "source",
869
- "type"
1044
+ "source"
870
1045
  ],
871
1046
  "type": "object"
872
1047
  },
@@ -885,8 +1060,7 @@
885
1060
  },
886
1061
  "required": [
887
1062
  "destination",
888
- "regex",
889
- "type"
1063
+ "regex"
890
1064
  ],
891
1065
  "type": "object"
892
1066
  }
@@ -897,6 +1071,82 @@
897
1071
  "rewrites": {
898
1072
  "items": {
899
1073
  "anyOf": [
1074
+ {
1075
+ "additionalProperties": false,
1076
+ "properties": {
1077
+ "destination": {
1078
+ "type": "string"
1079
+ },
1080
+ "glob": {
1081
+ "type": "string"
1082
+ }
1083
+ },
1084
+ "required": [
1085
+ "destination",
1086
+ "glob"
1087
+ ],
1088
+ "type": "object"
1089
+ },
1090
+ {
1091
+ "additionalProperties": false,
1092
+ "properties": {
1093
+ "function": {
1094
+ "type": "string"
1095
+ },
1096
+ "glob": {
1097
+ "type": "string"
1098
+ }
1099
+ },
1100
+ "required": [
1101
+ "function",
1102
+ "glob"
1103
+ ],
1104
+ "type": "object"
1105
+ },
1106
+ {
1107
+ "additionalProperties": false,
1108
+ "properties": {
1109
+ "glob": {
1110
+ "type": "string"
1111
+ },
1112
+ "run": {
1113
+ "additionalProperties": false,
1114
+ "properties": {
1115
+ "region": {
1116
+ "type": "string"
1117
+ },
1118
+ "serviceId": {
1119
+ "type": "string"
1120
+ }
1121
+ },
1122
+ "required": [
1123
+ "serviceId"
1124
+ ],
1125
+ "type": "object"
1126
+ }
1127
+ },
1128
+ "required": [
1129
+ "glob",
1130
+ "run"
1131
+ ],
1132
+ "type": "object"
1133
+ },
1134
+ {
1135
+ "additionalProperties": false,
1136
+ "properties": {
1137
+ "dynamicLinks": {
1138
+ "type": "boolean"
1139
+ },
1140
+ "glob": {
1141
+ "type": "string"
1142
+ }
1143
+ },
1144
+ "required": [
1145
+ "dynamicLinks",
1146
+ "glob"
1147
+ ],
1148
+ "type": "object"
1149
+ },
900
1150
  {
901
1151
  "additionalProperties": false,
902
1152
  "properties": {
@@ -1080,6 +1330,38 @@
1080
1330
  "headers": {
1081
1331
  "items": {
1082
1332
  "anyOf": [
1333
+ {
1334
+ "additionalProperties": false,
1335
+ "properties": {
1336
+ "glob": {
1337
+ "type": "string"
1338
+ },
1339
+ "headers": {
1340
+ "items": {
1341
+ "additionalProperties": false,
1342
+ "properties": {
1343
+ "key": {
1344
+ "type": "string"
1345
+ },
1346
+ "value": {
1347
+ "type": "string"
1348
+ }
1349
+ },
1350
+ "required": [
1351
+ "key",
1352
+ "value"
1353
+ ],
1354
+ "type": "object"
1355
+ },
1356
+ "type": "array"
1357
+ }
1358
+ },
1359
+ "required": [
1360
+ "glob",
1361
+ "headers"
1362
+ ],
1363
+ "type": "object"
1364
+ },
1083
1365
  {
1084
1366
  "additionalProperties": false,
1085
1367
  "properties": {
@@ -1198,6 +1480,25 @@
1198
1480
  "redirects": {
1199
1481
  "items": {
1200
1482
  "anyOf": [
1483
+ {
1484
+ "additionalProperties": false,
1485
+ "properties": {
1486
+ "destination": {
1487
+ "type": "string"
1488
+ },
1489
+ "glob": {
1490
+ "type": "string"
1491
+ },
1492
+ "type": {
1493
+ "type": "number"
1494
+ }
1495
+ },
1496
+ "required": [
1497
+ "destination",
1498
+ "glob"
1499
+ ],
1500
+ "type": "object"
1501
+ },
1201
1502
  {
1202
1503
  "additionalProperties": false,
1203
1504
  "properties": {
@@ -1213,8 +1514,7 @@
1213
1514
  },
1214
1515
  "required": [
1215
1516
  "destination",
1216
- "source",
1217
- "type"
1517
+ "source"
1218
1518
  ],
1219
1519
  "type": "object"
1220
1520
  },
@@ -1233,8 +1533,7 @@
1233
1533
  },
1234
1534
  "required": [
1235
1535
  "destination",
1236
- "regex",
1237
- "type"
1536
+ "regex"
1238
1537
  ],
1239
1538
  "type": "object"
1240
1539
  }
@@ -1245,6 +1544,82 @@
1245
1544
  "rewrites": {
1246
1545
  "items": {
1247
1546
  "anyOf": [
1547
+ {
1548
+ "additionalProperties": false,
1549
+ "properties": {
1550
+ "destination": {
1551
+ "type": "string"
1552
+ },
1553
+ "glob": {
1554
+ "type": "string"
1555
+ }
1556
+ },
1557
+ "required": [
1558
+ "destination",
1559
+ "glob"
1560
+ ],
1561
+ "type": "object"
1562
+ },
1563
+ {
1564
+ "additionalProperties": false,
1565
+ "properties": {
1566
+ "function": {
1567
+ "type": "string"
1568
+ },
1569
+ "glob": {
1570
+ "type": "string"
1571
+ }
1572
+ },
1573
+ "required": [
1574
+ "function",
1575
+ "glob"
1576
+ ],
1577
+ "type": "object"
1578
+ },
1579
+ {
1580
+ "additionalProperties": false,
1581
+ "properties": {
1582
+ "glob": {
1583
+ "type": "string"
1584
+ },
1585
+ "run": {
1586
+ "additionalProperties": false,
1587
+ "properties": {
1588
+ "region": {
1589
+ "type": "string"
1590
+ },
1591
+ "serviceId": {
1592
+ "type": "string"
1593
+ }
1594
+ },
1595
+ "required": [
1596
+ "serviceId"
1597
+ ],
1598
+ "type": "object"
1599
+ }
1600
+ },
1601
+ "required": [
1602
+ "glob",
1603
+ "run"
1604
+ ],
1605
+ "type": "object"
1606
+ },
1607
+ {
1608
+ "additionalProperties": false,
1609
+ "properties": {
1610
+ "dynamicLinks": {
1611
+ "type": "boolean"
1612
+ },
1613
+ "glob": {
1614
+ "type": "string"
1615
+ }
1616
+ },
1617
+ "required": [
1618
+ "dynamicLinks",
1619
+ "glob"
1620
+ ],
1621
+ "type": "object"
1622
+ },
1248
1623
  {
1249
1624
  "additionalProperties": false,
1250
1625
  "properties": {
@@ -1,45 +0,0 @@
1
- "use strict";
2
- var _ = require("lodash");
3
- var { Command } = require("../command");
4
- var needProjectId = require("../projectUtils").needProjectId;
5
- var { requirePermissions } = require("../requirePermissions");
6
- var runtimeconfig = require("../gcp/runtimeconfig");
7
- var functionsConfig = require("../functionsConfig");
8
- const { logger } = require("../logger");
9
- module.exports = new Command("functions:config:legacy")
10
- .description("get legacy functions config variables")
11
- .before(requirePermissions, [
12
- "runtimeconfig.configs.list",
13
- "runtimeconfig.configs.get",
14
- "runtimeconfig.variables.list",
15
- "runtimeconfig.variables.get",
16
- ])
17
- .action(function (options) {
18
- var projectId = needProjectId(options);
19
- var metaPath = "projects/" + projectId + "/configs/firebase/variables/meta";
20
- return runtimeconfig.variables
21
- .get(metaPath)
22
- .then(function (result) {
23
- var metaVal = JSON.parse(result.text);
24
- if (!_.has(metaVal, "version")) {
25
- logger.info("You do not have any legacy config variables.");
26
- return null;
27
- }
28
- var latestVarPath = functionsConfig.idsToVarName(projectId, "firebase", metaVal.version);
29
- return runtimeconfig.variables.get(latestVarPath);
30
- })
31
- .then(function (latest) {
32
- if (latest !== null) {
33
- var latestVal = JSON.parse(latest.text);
34
- logger.info(JSON.stringify(latestVal, null, 2));
35
- return latestVal;
36
- }
37
- })
38
- .catch(function (err) {
39
- if (_.get(err, "context.response.statusCode") === 404) {
40
- logger.info("You do not have any legacy config variables.");
41
- return null;
42
- }
43
- return Promise.reject(err);
44
- });
45
- });
@@ -1,58 +0,0 @@
1
- "use strict";
2
- var clc = require("cli-color");
3
- var fs = require("fs");
4
- var api = require("./api");
5
- var utils = require("./utils");
6
- var prepareFirebaseRules = function (component, options, payload) {
7
- var rulesFileName = component + ".rules";
8
- var rulesPath = options.config.get(rulesFileName);
9
- if (rulesPath) {
10
- rulesPath = options.config.path(rulesPath);
11
- var src = fs.readFileSync(rulesPath, "utf8");
12
- utils.logBullet(clc.bold.cyan(component + ":") + " checking rules for compilation errors...");
13
- return api
14
- .request("POST", "/v1/projects/" + encodeURIComponent(options.project) + ":test", {
15
- origin: api.rulesOrigin,
16
- data: {
17
- source: {
18
- files: [
19
- {
20
- content: src,
21
- name: rulesFileName,
22
- },
23
- ],
24
- },
25
- },
26
- auth: true,
27
- })
28
- .then(function (response) {
29
- if (response.body && response.body.issues && response.body.issues.length > 0) {
30
- var add = response.body.issues.length === 1 ? "" : "s";
31
- var message = "Compilation error" +
32
- add +
33
- " in " +
34
- clc.bold(options.config.get(rulesFileName)) +
35
- ":\n";
36
- response.body.issues.forEach(function (issue) {
37
- message +=
38
- "\n[" +
39
- issue.severity.substring(0, 1) +
40
- "] " +
41
- issue.sourcePosition.line +
42
- ":" +
43
- issue.sourcePosition.column +
44
- " - " +
45
- issue.description;
46
- });
47
- return utils.reject(message, { exit: 1 });
48
- }
49
- utils.logSuccess(clc.bold.green(component + ":") + " rules file compiled successfully");
50
- payload[component] = {
51
- rules: [{ name: options.config.get(rulesFileName), content: src }],
52
- };
53
- return Promise.resolve();
54
- });
55
- }
56
- return Promise.resolve();
57
- };
58
- module.exports = prepareFirebaseRules;