firebase-tools 10.1.3 → 10.1.4
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.
|
@@ -14,10 +14,10 @@ function createCloudEndpoints(emulator) {
|
|
|
14
14
|
storageLayer.createBucket(req.params[0]);
|
|
15
15
|
next();
|
|
16
16
|
});
|
|
17
|
-
gcloudStorageAPI.get("/b", (req, res) => {
|
|
17
|
+
gcloudStorageAPI.get("/b", async (req, res) => {
|
|
18
18
|
res.json({
|
|
19
19
|
kind: "storage#buckets",
|
|
20
|
-
items: storageLayer.listBuckets(),
|
|
20
|
+
items: await storageLayer.listBuckets(),
|
|
21
21
|
});
|
|
22
22
|
});
|
|
23
23
|
gcloudStorageAPI.get(["/b/:bucketId/o/:objectId", "/download/storage/v1/b/:bucketId/o/:objectId"], (req, res) => {
|
|
@@ -19,6 +19,7 @@ const fse = require("fs-extra");
|
|
|
19
19
|
const rimraf = require("rimraf");
|
|
20
20
|
const cloudFunctions_1 = require("./cloudFunctions");
|
|
21
21
|
const logger_1 = require("../../logger");
|
|
22
|
+
const adminSdkConfig_1 = require("../adminSdkConfig");
|
|
22
23
|
class StoredFile {
|
|
23
24
|
constructor(metadata, path) {
|
|
24
25
|
this.metadata = metadata;
|
|
@@ -108,9 +109,13 @@ class StorageLayer {
|
|
|
108
109
|
this._buckets.set(id, new metadata_1.CloudStorageBucketMetadata(id));
|
|
109
110
|
}
|
|
110
111
|
}
|
|
111
|
-
listBuckets() {
|
|
112
|
+
async listBuckets() {
|
|
112
113
|
if (this._buckets.size == 0) {
|
|
113
|
-
this.
|
|
114
|
+
let adminSdkConfig = await (0, adminSdkConfig_1.getProjectAdminSdkConfigOrCached)(this._projectId);
|
|
115
|
+
if (!adminSdkConfig) {
|
|
116
|
+
adminSdkConfig = (0, adminSdkConfig_1.constructDefaultAdminSdkConfig)(this._projectId);
|
|
117
|
+
}
|
|
118
|
+
this.createBucket(adminSdkConfig.storageBucket);
|
|
114
119
|
}
|
|
115
120
|
return [...this._buckets.values()];
|
|
116
121
|
}
|
|
@@ -355,7 +360,7 @@ class StorageLayer {
|
|
|
355
360
|
const bucketsList = {
|
|
356
361
|
buckets: [],
|
|
357
362
|
};
|
|
358
|
-
for (const b of this.listBuckets()) {
|
|
363
|
+
for (const b of await this.listBuckets()) {
|
|
359
364
|
bucketsList.buckets.push({ id: b.id });
|
|
360
365
|
}
|
|
361
366
|
const bucketsFilePath = path.join(storageExportPath, "buckets.json");
|
package/lib/gcp/storage.js
CHANGED
|
@@ -6,10 +6,10 @@ const api_1 = require("../api");
|
|
|
6
6
|
const apiv2_1 = require("../apiv2");
|
|
7
7
|
const logger_1 = require("../logger");
|
|
8
8
|
const error_1 = require("../error");
|
|
9
|
-
const storageAPIClient = new apiv2_1.Client({ urlPrefix: api_1.storageOrigin, apiVersion: "v1" });
|
|
10
9
|
async function getDefaultBucket(projectId) {
|
|
11
10
|
try {
|
|
12
|
-
const
|
|
11
|
+
const appengineClient = new apiv2_1.Client({ urlPrefix: api_1.appengineOrigin, apiVersion: "v1" });
|
|
12
|
+
const resp = await appengineClient.get(`/apps/${projectId}`);
|
|
13
13
|
if (resp.body.defaultBucket === "undefined") {
|
|
14
14
|
logger_1.logger.debug("Default storage bucket is undefined.");
|
|
15
15
|
throw new error_1.FirebaseError("Your project is being set up. Please wait a minute before deploying again.");
|
|
@@ -42,6 +42,7 @@ async function uploadObject(source, bucketName) {
|
|
|
42
42
|
if (path.extname(source.file) !== ".zip") {
|
|
43
43
|
throw new error_1.FirebaseError(`Expected a file name ending in .zip, got ${source.file}`);
|
|
44
44
|
}
|
|
45
|
+
const storageAPIClient = new apiv2_1.Client({ urlPrefix: api_1.storageOrigin, apiVersion: "v1" });
|
|
45
46
|
const location = `/${bucketName}/${path.basename(source.file)}`;
|
|
46
47
|
const res = await storageAPIClient.request({
|
|
47
48
|
method: "PUT",
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "firebase-tools",
|
|
3
|
-
"version": "10.1.
|
|
3
|
+
"version": "10.1.4",
|
|
4
4
|
"lockfileVersion": 2,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "firebase-tools",
|
|
9
|
-
"version": "10.1.
|
|
9
|
+
"version": "10.1.4",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@google-cloud/pubsub": "^2.18.4",
|
|
@@ -116,7 +116,6 @@
|
|
|
116
116
|
"@types/triple-beam": "^1.3.0",
|
|
117
117
|
"@types/unzipper": "^0.10.0",
|
|
118
118
|
"@types/uuid": "^8.3.1",
|
|
119
|
-
"@types/winston": "^2.4.4",
|
|
120
119
|
"@types/ws": "^7.2.3",
|
|
121
120
|
"@typescript-eslint/eslint-plugin": "^5.9.0",
|
|
122
121
|
"@typescript-eslint/parser": "^5.9.0",
|
|
@@ -2359,16 +2358,6 @@
|
|
|
2359
2358
|
"integrity": "sha512-Y2mHTRAbqfFkpjldbkHGY8JIzRN6XqYRliG8/24FcHm2D2PwW24fl5xMRTVGdrb7iMrwCaIEbLWerGIkXuFWVg==",
|
|
2360
2359
|
"dev": true
|
|
2361
2360
|
},
|
|
2362
|
-
"node_modules/@types/winston": {
|
|
2363
|
-
"version": "2.4.4",
|
|
2364
|
-
"resolved": "https://registry.npmjs.org/@types/winston/-/winston-2.4.4.tgz",
|
|
2365
|
-
"integrity": "sha512-BVGCztsypW8EYwJ+Hq+QNYiT/MUyCif0ouBH+flrY66O5W+KIXAMML6E/0fJpm7VjIzgangahl5S03bJJQGrZw==",
|
|
2366
|
-
"deprecated": "This is a stub types definition. winston provides its own type definitions, so you do not need this installed.",
|
|
2367
|
-
"dev": true,
|
|
2368
|
-
"dependencies": {
|
|
2369
|
-
"winston": "*"
|
|
2370
|
-
}
|
|
2371
|
-
},
|
|
2372
2361
|
"node_modules/@types/ws": {
|
|
2373
2362
|
"version": "7.2.3",
|
|
2374
2363
|
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-7.2.3.tgz",
|
|
@@ -15436,15 +15425,6 @@
|
|
|
15436
15425
|
"integrity": "sha512-Y2mHTRAbqfFkpjldbkHGY8JIzRN6XqYRliG8/24FcHm2D2PwW24fl5xMRTVGdrb7iMrwCaIEbLWerGIkXuFWVg==",
|
|
15437
15426
|
"dev": true
|
|
15438
15427
|
},
|
|
15439
|
-
"@types/winston": {
|
|
15440
|
-
"version": "2.4.4",
|
|
15441
|
-
"resolved": "https://registry.npmjs.org/@types/winston/-/winston-2.4.4.tgz",
|
|
15442
|
-
"integrity": "sha512-BVGCztsypW8EYwJ+Hq+QNYiT/MUyCif0ouBH+flrY66O5W+KIXAMML6E/0fJpm7VjIzgangahl5S03bJJQGrZw==",
|
|
15443
|
-
"dev": true,
|
|
15444
|
-
"requires": {
|
|
15445
|
-
"winston": "*"
|
|
15446
|
-
}
|
|
15447
|
-
},
|
|
15448
15428
|
"@types/ws": {
|
|
15449
15429
|
"version": "7.2.3",
|
|
15450
15430
|
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-7.2.3.tgz",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "firebase-tools",
|
|
3
|
-
"version": "10.1.
|
|
3
|
+
"version": "10.1.4",
|
|
4
4
|
"description": "Command-Line Interface for Firebase",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"test:extensions-emulator": "./scripts/extensions-emulator-tests/run.sh",
|
|
31
31
|
"test:hosting": "./scripts/hosting-tests/run.sh",
|
|
32
32
|
"test:triggers-end-to-end": "./scripts/triggers-end-to-end-tests/run.sh",
|
|
33
|
+
"test:storage-deploy": "./scripts/storage-deploy-tests/run.sh",
|
|
33
34
|
"test:storage-emulator-integration": "./scripts/storage-emulator-integration/run.sh"
|
|
34
35
|
},
|
|
35
36
|
"files": [
|
|
@@ -188,7 +189,6 @@
|
|
|
188
189
|
"@types/triple-beam": "^1.3.0",
|
|
189
190
|
"@types/unzipper": "^0.10.0",
|
|
190
191
|
"@types/uuid": "^8.3.1",
|
|
191
|
-
"@types/winston": "^2.4.4",
|
|
192
192
|
"@types/ws": "^7.2.3",
|
|
193
193
|
"@typescript-eslint/eslint-plugin": "^5.9.0",
|
|
194
194
|
"@typescript-eslint/parser": "^5.9.0",
|