firebase-tools 10.0.0 → 10.1.2
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/lib/accountExporter.js +9 -8
- package/lib/accountImporter.js +10 -8
- package/lib/api.js +1 -0
- package/lib/apiv2.js +2 -2
- package/lib/appdistribution/client.js +1 -1
- package/lib/appdistribution/options-parser-util.js +1 -1
- package/lib/auth.js +2 -2
- package/lib/bin/firebase.js +1 -1
- package/lib/command.js +26 -26
- package/lib/commands/appdistribution-distribute.js +4 -4
- package/lib/commands/appdistribution-testers-add.js +2 -2
- package/lib/commands/appdistribution-testers-remove.js +2 -2
- package/lib/commands/apps-android-sha-create.js +2 -2
- package/lib/commands/apps-android-sha-delete.js +2 -2
- package/lib/commands/apps-android-sha-list.js +2 -2
- package/lib/commands/apps-create.js +9 -9
- package/lib/commands/apps-list.js +3 -3
- package/lib/commands/apps-sdkconfig.js +8 -8
- package/lib/commands/auth-export.js +26 -25
- package/lib/commands/auth-import.js +88 -78
- package/lib/commands/database-get.js +1 -1
- package/lib/commands/database-instances-create.js +4 -4
- package/lib/commands/database-instances-list.js +4 -4
- package/lib/commands/database-profile.js +1 -1
- package/lib/commands/database-push.js +1 -1
- package/lib/commands/database-remove.js +2 -2
- package/lib/commands/database-set.js +2 -2
- package/lib/commands/database-settings-get.js +1 -1
- package/lib/commands/database-settings-set.js +1 -1
- package/lib/commands/database-update.js +2 -2
- package/lib/commands/ext-configure.js +3 -3
- package/lib/commands/ext-dev-deprecate.js +4 -4
- package/lib/commands/ext-dev-extension-delete.js +3 -3
- package/lib/commands/ext-dev-init.js +4 -4
- package/lib/commands/ext-dev-list.js +1 -1
- package/lib/commands/ext-dev-publish.js +4 -4
- package/lib/commands/ext-dev-register.js +6 -6
- package/lib/commands/ext-dev-undeprecate.js +4 -4
- package/lib/commands/ext-dev-unpublish.js +3 -3
- package/lib/commands/ext-dev-usage.js +145 -0
- package/lib/commands/ext-export.js +8 -8
- package/lib/commands/ext-info.js +5 -5
- package/lib/commands/ext-install.js +27 -23
- package/lib/commands/ext-list.js +2 -2
- package/lib/commands/ext-sources-create.js +2 -2
- package/lib/commands/ext-uninstall.js +4 -4
- package/lib/commands/ext-update.js +18 -18
- package/lib/commands/ext.js +3 -3
- package/lib/commands/firestore-delete.js +1 -1
- package/lib/commands/functions-config-clone.js +22 -23
- package/lib/commands/functions-config-export.js +11 -11
- package/lib/commands/functions-config-get.js +22 -22
- package/lib/commands/functions-config-set.js +24 -22
- package/lib/commands/functions-config-unset.js +20 -22
- package/lib/commands/functions-delete.js +3 -3
- package/lib/commands/functions-deletegcfartifacts.js +4 -4
- package/lib/commands/functions-list.js +1 -1
- package/lib/commands/functions-log.js +1 -1
- package/lib/commands/help.js +12 -12
- package/lib/commands/hosting-channel-create.js +13 -13
- package/lib/commands/hosting-channel-delete.js +10 -10
- package/lib/commands/hosting-channel-deploy.js +18 -18
- package/lib/commands/hosting-channel-list.js +5 -5
- package/lib/commands/hosting-channel-open.js +9 -9
- package/lib/commands/hosting-clone.js +16 -16
- package/lib/commands/hosting-disable.js +1 -1
- package/lib/commands/hosting-sites-create.js +7 -7
- package/lib/commands/hosting-sites-delete.js +7 -7
- package/lib/commands/hosting-sites-get.js +2 -2
- package/lib/commands/hosting-sites-list.js +3 -3
- package/lib/commands/index.js +1 -0
- package/lib/commands/login-ci.js +10 -10
- package/lib/commands/login.js +2 -2
- package/lib/commands/logout.js +1 -1
- package/lib/commands/open.js +1 -1
- package/lib/commands/projects-addfirebase.js +2 -2
- package/lib/commands/projects-create.js +2 -2
- package/lib/commands/projects-list.js +1 -1
- package/lib/commands/remoteconfig-get.js +3 -3
- package/lib/commands/remoteconfig-rollback.js +3 -3
- package/lib/commands/remoteconfig-versions-list.js +7 -2
- package/lib/commands/setup-emulators-database.js +8 -7
- package/lib/commands/setup-emulators-firestore.js +8 -7
- package/lib/commands/setup-emulators-pubsub.js +5 -4
- package/lib/commands/setup-emulators-storage.js +4 -3
- package/lib/commands/setup-emulators-ui.js +8 -7
- package/lib/commands/target-apply.js +17 -16
- package/lib/commands/target-clear.js +11 -10
- package/lib/commands/target-remove.js +10 -9
- package/lib/commands/target.js +20 -20
- package/lib/config.js +6 -6
- package/lib/database/api.js +2 -2
- package/lib/defaultCredentials.js +3 -3
- package/lib/deploy/extensions/deploy.js +4 -4
- package/lib/deploy/extensions/deploymentSummary.js +5 -4
- package/lib/deploy/extensions/index.js +1 -0
- package/lib/deploy/extensions/params.js +1 -1
- package/lib/deploy/extensions/planner.js +3 -3
- package/lib/deploy/extensions/prepare.js +9 -9
- package/lib/deploy/extensions/release.js +1 -1
- package/lib/deploy/extensions/secrets.js +7 -7
- package/lib/deploy/extensions/validate.js +2 -2
- package/lib/deploy/functions/backend.js +6 -4
- package/lib/deploy/functions/checkIam.js +7 -7
- package/lib/deploy/functions/containerCleaner.js +3 -3
- package/lib/deploy/functions/deploy.js +4 -4
- package/lib/deploy/functions/ensureCloudBuildEnabled.js +3 -3
- package/lib/deploy/functions/index.js +1 -0
- package/lib/deploy/functions/prepare.js +27 -21
- package/lib/deploy/functions/prompts.js +5 -5
- package/lib/deploy/functions/release/executor.js +4 -1
- package/lib/deploy/functions/release/fabricator.js +5 -5
- package/lib/deploy/functions/release/index.js +2 -2
- package/lib/deploy/functions/release/planner.js +6 -6
- package/lib/deploy/functions/release/reporter.js +8 -4
- package/lib/deploy/functions/runtimes/discovery/index.js +2 -2
- package/lib/deploy/functions/runtimes/discovery/v1alpha1.js +14 -14
- package/lib/deploy/functions/runtimes/golang/index.js +11 -14
- package/lib/deploy/functions/runtimes/index.js +6 -10
- package/lib/deploy/functions/runtimes/node/index.js +6 -10
- package/lib/deploy/functions/runtimes/node/parseTriggers.js +3 -3
- package/lib/deploy/functions/runtimes/node/validate.js +2 -1
- package/lib/deploy/functions/services/storage.js +1 -1
- package/lib/deploy/functions/triggerRegionHelper.js +1 -1
- package/lib/deploy/functions/validate.js +4 -3
- package/lib/deploy/hosting/deploy.js +7 -7
- package/lib/deploy/hosting/uploader.js +1 -1
- package/lib/deploy/hosting/validate.js +3 -3
- package/lib/deploy/remoteconfig/prepare.js +3 -3
- package/lib/deploy/remoteconfig/release.js +3 -3
- package/lib/deploy/storage/deploy.js +1 -1
- package/lib/deploy/storage/release.js +2 -2
- package/lib/detectProjectRoot.js +5 -5
- package/lib/emulator/auth/apiSpec.js +13 -7
- package/lib/emulator/auth/handlers.js +3 -3
- package/lib/emulator/auth/index.js +1 -1
- package/lib/emulator/auth/operations.js +256 -248
- package/lib/emulator/auth/server.js +11 -8
- package/lib/emulator/auth/state.js +12 -12
- package/lib/emulator/commandUtils.js +5 -5
- package/lib/emulator/controller.js +16 -11
- package/lib/emulator/downloadableEmulators.js +10 -9
- package/lib/emulator/emulatorLogger.js +1 -1
- package/lib/emulator/functionsEmulator.js +107 -74
- package/lib/emulator/functionsEmulatorRuntime.js +36 -21
- package/lib/emulator/functionsEmulatorShell.js +3 -2
- package/lib/emulator/functionsRuntimeWorker.js +1 -1
- package/lib/emulator/hubExport.js +2 -2
- package/lib/emulator/storage/apis/firebase.js +2 -2
- package/lib/emulator/storage/apis/gcloud.js +2 -2
- package/lib/emulator/storage/cloudFunctions.js +1 -1
- package/lib/emulator/storage/files.js +14 -14
- package/lib/emulator/storage/index.js +2 -2
- package/lib/emulator/storage/metadata.js +7 -6
- package/lib/emulator/storage/rules/runtime.js +10 -9
- package/lib/emulator/storage/server.js +2 -2
- package/lib/ensureApiEnabled.js +7 -7
- package/lib/error.js +3 -3
- package/lib/extensions/askUserForConsent.js +3 -4
- package/lib/extensions/askUserForParam.js +11 -11
- package/lib/extensions/billingMigrationHelper.js +2 -2
- package/lib/extensions/changelog.js +4 -4
- package/lib/extensions/displayExtensionInfo.js +6 -6
- package/lib/extensions/emulator/optionsHelper.js +1 -1
- package/lib/extensions/emulator/specHelper.js +1 -1
- package/lib/extensions/emulator/triggerHelper.js +1 -1
- package/lib/extensions/export.js +6 -6
- package/lib/extensions/extensionsApi.js +69 -110
- package/lib/extensions/extensionsHelper.js +56 -43
- package/lib/extensions/listExtensions.js +1 -1
- package/lib/extensions/localHelper.js +1 -1
- package/lib/extensions/metricsTypeDef.js +2 -0
- package/lib/extensions/metricsUtils.js +98 -0
- package/lib/extensions/paramHelper.js +6 -6
- package/lib/extensions/provisioningHelper.js +13 -14
- package/lib/extensions/resolveSource.js +6 -6
- package/lib/extensions/secretsUtils.js +3 -3
- package/lib/extensions/updateHelper.js +10 -10
- package/lib/extensions/utils.js +1 -1
- package/lib/extensions/warnings.js +11 -10
- package/lib/fetchWebSetup.js +2 -2
- package/lib/filterTargets.js +2 -2
- package/lib/firestore/indexes.js +2 -2
- package/lib/fsAsync.js +3 -3
- package/lib/fsutils.js +2 -2
- package/lib/functional.js +2 -1
- package/lib/functions/env.js +1 -1
- package/lib/functions/runtimeConfigExport.js +4 -4
- package/lib/functionsConfig.js +7 -8
- package/lib/functionsShellCommandAction.js +4 -3
- package/lib/gcp/cloudmonitoring.js +74 -0
- package/lib/gcp/cloudscheduler.js +1 -1
- package/lib/gcp/iam.js +2 -2
- package/lib/gcp/resourceManager.js +2 -2
- package/lib/gcp/rules.js +18 -41
- package/lib/gcp/secretManager.js +3 -2
- package/lib/getDefaultDatabaseInstance.js +1 -1
- package/lib/getDefaultHostingSite.js +1 -1
- package/lib/getProjectNumber.js +2 -2
- package/lib/handlePreviewToggles.js +5 -5
- package/lib/hosting/api.js +6 -6
- package/lib/hosting/cloudRunProxy.js +6 -6
- package/lib/hosting/functionsProxy.js +3 -3
- package/lib/hosting/implicitInit.js +2 -2
- package/lib/hosting/normalizedHostingConfigs.js +3 -3
- package/lib/hosting/proxy.js +2 -2
- package/lib/init/features/account.js +7 -7
- package/lib/init/features/database.js +9 -9
- package/lib/init/features/emulators.js +8 -8
- package/lib/init/features/firestore/index.js +3 -3
- package/lib/init/features/firestore/indexes.js +2 -2
- package/lib/init/features/firestore/rules.js +2 -2
- package/lib/init/features/functions/golang.js +4 -4
- package/lib/init/features/functions/index.js +4 -4
- package/lib/init/features/hosting/github.js +31 -31
- package/lib/init/features/project.js +8 -8
- package/lib/init/features/remoteconfig.js +2 -2
- package/lib/init/features/storage.js +2 -2
- package/lib/listFiles.js +1 -1
- package/lib/management/apps.js +3 -3
- package/lib/management/projects.js +6 -6
- package/lib/previews.js +2 -2
- package/lib/profiler.js +1 -1
- package/lib/projectPath.js +1 -1
- package/lib/projectUtils.js +2 -2
- package/lib/prompt.js +0 -1
- package/lib/rc.js +1 -1
- package/lib/remoteconfig/get.js +14 -8
- package/lib/remoteconfig/rollback.js +13 -6
- package/lib/remoteconfig/versionslist.js +13 -7
- package/lib/requireAuth.js +2 -2
- package/lib/requireDatabaseInstance.js +1 -1
- package/lib/requireHostingSite.js +1 -1
- package/lib/requirePermissions.js +4 -4
- package/lib/rulesDeploy.js +2 -2
- package/lib/serve/functions.js +14 -7
- package/lib/serve/hosting.js +7 -7
- package/lib/utils.js +3 -2
- package/npm-shrinkwrap.json +24095 -0
- package/package.json +33 -30
- package/templates/init/hosting/index.html +1 -1
- package/CHANGELOG.md +0 -5
- package/lib/commands/functions-config-legacy.js +0 -45
- package/lib/prepareFirebaseRules.js +0 -58
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "firebase-tools",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.1.2",
|
|
4
4
|
"description": "Command-Line Interface for Firebase",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -84,9 +84,7 @@
|
|
|
84
84
|
]
|
|
85
85
|
},
|
|
86
86
|
"dependencies": {
|
|
87
|
-
"@google-cloud/pubsub": "^2.
|
|
88
|
-
"@types/archiver": "^5.1.0",
|
|
89
|
-
"JSONStream": "^1.2.1",
|
|
87
|
+
"@google-cloud/pubsub": "^2.18.4",
|
|
90
88
|
"abort-controller": "^3.0.0",
|
|
91
89
|
"ajv": "^6.12.6",
|
|
92
90
|
"archiver": "^5.0.0",
|
|
@@ -100,37 +98,39 @@
|
|
|
100
98
|
"cors": "^2.8.5",
|
|
101
99
|
"cross-env": "^5.1.3",
|
|
102
100
|
"cross-spawn": "^7.0.1",
|
|
103
|
-
"csv-
|
|
101
|
+
"csv-parse": "^5.0.4",
|
|
104
102
|
"dotenv": "^6.1.0",
|
|
105
|
-
"exegesis": "^
|
|
106
|
-
"exegesis-express": "^
|
|
103
|
+
"exegesis": "^4.1.0",
|
|
104
|
+
"exegesis-express": "^4.0.0",
|
|
107
105
|
"exit-code": "^1.0.2",
|
|
108
106
|
"express": "^4.16.4",
|
|
109
107
|
"filesize": "^6.1.0",
|
|
110
108
|
"fs-extra": "^5.0.0",
|
|
111
109
|
"glob": "^7.1.2",
|
|
112
|
-
"google-auth-library": "^
|
|
113
|
-
"inquirer": "
|
|
110
|
+
"google-auth-library": "^7.11.0",
|
|
111
|
+
"inquirer": "^8.2.0",
|
|
114
112
|
"js-yaml": "^3.13.1",
|
|
115
113
|
"jsonwebtoken": "^8.5.1",
|
|
116
114
|
"leven": "^3.1.0",
|
|
117
115
|
"lodash": "^4.17.21",
|
|
118
|
-
"marked": "^0.
|
|
116
|
+
"marked": "^4.0.10",
|
|
119
117
|
"marked-terminal": "^3.3.0",
|
|
120
118
|
"mime": "^2.5.2",
|
|
121
119
|
"minimatch": "^3.0.4",
|
|
122
120
|
"morgan": "^1.10.0",
|
|
123
121
|
"node-fetch": "^2.6.1",
|
|
124
122
|
"open": "^6.3.0",
|
|
125
|
-
"ora": "^
|
|
123
|
+
"ora": "^5.4.1",
|
|
126
124
|
"portfinder": "^1.0.23",
|
|
127
125
|
"progress": "^2.0.3",
|
|
128
126
|
"proxy-agent": "^5.0.0",
|
|
129
127
|
"request": "^2.87.0",
|
|
130
128
|
"rimraf": "^3.0.0",
|
|
131
129
|
"semver": "^5.7.1",
|
|
130
|
+
"stream-chain": "^2.2.4",
|
|
131
|
+
"stream-json": "^1.7.3",
|
|
132
132
|
"superstatic": "^7.1.0",
|
|
133
|
-
"tar": "^
|
|
133
|
+
"tar": "^6.1.11",
|
|
134
134
|
"tcp-port-used": "^1.0.1",
|
|
135
135
|
"tmp": "0.0.33",
|
|
136
136
|
"triple-beam": "^1.3.0",
|
|
@@ -146,9 +146,10 @@
|
|
|
146
146
|
"devDependencies": {
|
|
147
147
|
"@google/events": "^5.1.1",
|
|
148
148
|
"@manifoldco/swagger-to-ts": "^2.0.0",
|
|
149
|
+
"@types/archiver": "^5.1.0",
|
|
149
150
|
"@types/body-parser": "^1.17.0",
|
|
150
|
-
"@types/chai": "^4.
|
|
151
|
-
"@types/chai-as-promised": "^7.1.
|
|
151
|
+
"@types/chai": "^4.3.0",
|
|
152
|
+
"@types/chai-as-promised": "^7.1.4",
|
|
152
153
|
"@types/cjson": "^0.5.0",
|
|
153
154
|
"@types/cli-color": "^0.3.29",
|
|
154
155
|
"@types/cli-table": "^0.3.0",
|
|
@@ -160,14 +161,15 @@
|
|
|
160
161
|
"@types/express-serve-static-core": "^4.17.8",
|
|
161
162
|
"@types/fs-extra": "^5.0.5",
|
|
162
163
|
"@types/glob": "^7.1.1",
|
|
163
|
-
"@types/inquirer": "^
|
|
164
|
+
"@types/inquirer": "^8.1.3",
|
|
164
165
|
"@types/js-yaml": "^3.12.2",
|
|
165
166
|
"@types/jsonwebtoken": "^8.3.8",
|
|
166
167
|
"@types/lodash": "^4.14.149",
|
|
167
|
-
"@types/marked": "^0.
|
|
168
|
-
"@types/
|
|
168
|
+
"@types/marked": "^4.0.1",
|
|
169
|
+
"@types/marked-terminal": "^3.1.3",
|
|
170
|
+
"@types/mocha": "^9.0.0",
|
|
169
171
|
"@types/multer": "^1.4.3",
|
|
170
|
-
"@types/node": "^
|
|
172
|
+
"@types/node": "^12.20.39",
|
|
171
173
|
"@types/node-fetch": "^2.5.7",
|
|
172
174
|
"@types/progress": "^2.0.3",
|
|
173
175
|
"@types/puppeteer": "^5.4.2",
|
|
@@ -176,8 +178,9 @@
|
|
|
176
178
|
"@types/semver": "^6.0.0",
|
|
177
179
|
"@types/sinon": "^9.0.10",
|
|
178
180
|
"@types/sinon-chai": "^3.2.2",
|
|
181
|
+
"@types/stream-json": "^1.7.2",
|
|
179
182
|
"@types/supertest": "^2.0.6",
|
|
180
|
-
"@types/tar": "^
|
|
183
|
+
"@types/tar": "^6.1.1",
|
|
181
184
|
"@types/tcp-port-used": "^1.0.0",
|
|
182
185
|
"@types/tmp": "^0.1.0",
|
|
183
186
|
"@types/triple-beam": "^1.3.0",
|
|
@@ -185,24 +188,24 @@
|
|
|
185
188
|
"@types/uuid": "^8.3.1",
|
|
186
189
|
"@types/winston": "^2.4.4",
|
|
187
190
|
"@types/ws": "^7.2.3",
|
|
188
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
189
|
-
"@typescript-eslint/parser": "^
|
|
190
|
-
"chai": "^4.
|
|
191
|
+
"@typescript-eslint/eslint-plugin": "^5.9.0",
|
|
192
|
+
"@typescript-eslint/parser": "^5.9.0",
|
|
193
|
+
"chai": "^4.3.4",
|
|
191
194
|
"chai-as-promised": "^7.1.1",
|
|
192
|
-
"eslint": "^
|
|
195
|
+
"eslint": "^8.6.0",
|
|
193
196
|
"eslint-config-google": "^0.14.0",
|
|
194
|
-
"eslint-config-prettier": "^
|
|
195
|
-
"eslint-plugin-jsdoc": "^
|
|
196
|
-
"eslint-plugin-prettier": "^
|
|
197
|
+
"eslint-config-prettier": "^8.3.0",
|
|
198
|
+
"eslint-plugin-jsdoc": "^37.5.1",
|
|
199
|
+
"eslint-plugin-prettier": "^4.0.0",
|
|
197
200
|
"firebase": "^7.24.0",
|
|
198
201
|
"firebase-admin": "^9.4.2",
|
|
199
202
|
"firebase-functions": "^3.15.0",
|
|
200
203
|
"google-discovery-to-swagger": "^2.1.0",
|
|
201
|
-
"mocha": "^
|
|
204
|
+
"mocha": "^9.1.3",
|
|
202
205
|
"nock": "^13.0.5",
|
|
203
206
|
"nyc": "^15.1.0",
|
|
204
207
|
"openapi-merge": "^1.0.23",
|
|
205
|
-
"prettier": "^2.
|
|
208
|
+
"prettier": "^2.5.1",
|
|
206
209
|
"proxy": "^1.0.2",
|
|
207
210
|
"puppeteer": "^9.0.0",
|
|
208
211
|
"sinon": "^9.2.3",
|
|
@@ -210,8 +213,8 @@
|
|
|
210
213
|
"source-map-support": "^0.5.9",
|
|
211
214
|
"supertest": "^3.3.0",
|
|
212
215
|
"swagger2openapi": "^6.0.3",
|
|
213
|
-
"ts-node": "^
|
|
214
|
-
"typescript": "^
|
|
216
|
+
"ts-node": "^10.4.0",
|
|
217
|
+
"typescript": "^4.5.4",
|
|
215
218
|
"typescript-json-schema": "^0.50.1"
|
|
216
219
|
}
|
|
217
220
|
}
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
'performance',
|
|
80
80
|
].filter(feature => typeof app[feature] === 'function');
|
|
81
81
|
loadEl.textContent = `Firebase SDK loaded with ${features.join(', ')}`;
|
|
82
|
-
} catch (e) {
|
|
82
|
+
} catch (e: any) {
|
|
83
83
|
console.error(e);
|
|
84
84
|
loadEl.textContent = 'Error loading the Firebase SDK, check the console.';
|
|
85
85
|
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
- **BREAKING** Drops support for running the CLI on Node 10.
|
|
2
|
-
- **BREAKING** Replaces all usages of `-y`, `--yes`, or `--confirm` with `-f` and `--force`.
|
|
3
|
-
- **BREAKING** Function deploys upload source to the deployed region instead of us-central1.
|
|
4
|
-
- Requires firebase-functions >= 3.13.1 in Functions emulator to include bug fixes (#3851).
|
|
5
|
-
- Updates default functions runtime to Node.js 16.
|
|
@@ -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;
|