firebase-tools 13.11.3 → 13.12.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.
- package/lib/auth.js +14 -15
- package/lib/commands/dataconnect-sdk-generate.js +4 -3
- package/lib/commands/ext-dev-init.js +25 -26
- package/lib/commands/index.js +9 -11
- package/lib/commands/init.js +13 -11
- package/lib/config.js +6 -1
- package/lib/crashlytics/buildToolsJarHelper.js +1 -1
- package/lib/dataconnect/client.js +1 -1
- package/lib/dataconnect/fileUtils.js +8 -6
- package/lib/dataconnect/load.js +4 -3
- package/lib/deploy/dataconnect/prepare.js +1 -1
- package/lib/emulator/controller.js +0 -4
- package/lib/emulator/dataconnectEmulator.js +111 -13
- package/lib/emulator/downloadableEmulators.js +0 -1
- package/lib/emulator/hub.js +1 -1
- package/lib/emulator/portUtils.js +9 -0
- package/lib/emulator/storage/rules/config.js +4 -2
- package/lib/experiments.js +2 -2
- package/lib/hosting/implicitInit.js +2 -2
- package/lib/init/features/dataconnect/index.js +12 -11
- package/lib/init/features/dataconnect/sdk.js +120 -0
- package/lib/init/features/firestore/indexes.js +2 -2
- package/lib/init/features/firestore/rules.js +2 -2
- package/lib/init/features/functions/javascript.js +6 -8
- package/lib/init/features/functions/python.js +4 -6
- package/lib/init/features/functions/typescript.js +8 -10
- package/lib/init/features/hosting/index.js +3 -3
- package/lib/init/features/index.js +3 -1
- package/lib/init/features/storage.js +2 -2
- package/lib/init/index.js +1 -0
- package/lib/listFiles.js +1 -0
- package/lib/management/apps.js +2 -2
- package/lib/templates.js +23 -0
- package/lib/utils.js +2 -2
- package/package.json +1 -1
- package/schema/connector-yaml.json +36 -4
- package/schema/dataconnect-yaml.json +4 -0
- package/schema/firebase-config.json +0 -8
- package/templates/_gitignore +3 -0
- package/templates/init/dataconnect/connector.yaml +11 -0
- package/templates/init/dataconnect/dataconnect.yaml +1 -0
package/lib/init/index.js
CHANGED
|
@@ -11,6 +11,7 @@ const featureFns = new Map([
|
|
|
11
11
|
["database", features.database],
|
|
12
12
|
["firestore", features.firestore],
|
|
13
13
|
["dataconnect", features.dataconnect],
|
|
14
|
+
["dataconnect:sdk", features.dataconnectSdk],
|
|
14
15
|
["functions", features.functions],
|
|
15
16
|
["hosting", features.hosting],
|
|
16
17
|
["storage", features.storage],
|
package/lib/listFiles.js
CHANGED
package/lib/management/apps.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.deleteAppAndroidSha = exports.createAppAndroidSha = exports.listAppAndroidSha = exports.getAppConfig = exports.getAppConfigFile = exports.listFirebaseApps = exports.createWebApp = exports.createAndroidApp = exports.createIosApp = exports.getAppPlatform = exports.ShaCertificateType = exports.AppPlatform = exports.APP_LIST_PAGE_SIZE = void 0;
|
|
4
|
-
const fs = require("fs");
|
|
5
4
|
const apiv2_1 = require("../apiv2");
|
|
6
5
|
const api_1 = require("../api");
|
|
7
6
|
const error_1 = require("../error");
|
|
8
7
|
const logger_1 = require("../logger");
|
|
9
8
|
const operation_poller_1 = require("../operation-poller");
|
|
9
|
+
const templates_1 = require("../templates");
|
|
10
10
|
const TIMEOUT_MILLIS = 30000;
|
|
11
11
|
exports.APP_LIST_PAGE_SIZE = 100;
|
|
12
12
|
const CREATE_APP_API_REQUEST_TIMEOUT_MILLIS = 15000;
|
|
@@ -182,7 +182,7 @@ function getAppConfigResourceString(appId, platform) {
|
|
|
182
182
|
}
|
|
183
183
|
function parseConfigFromResponse(responseBody, platform) {
|
|
184
184
|
if (platform === AppPlatform.WEB) {
|
|
185
|
-
const JS_TEMPLATE =
|
|
185
|
+
const JS_TEMPLATE = (0, templates_1.readTemplateSync)("setup/web.js");
|
|
186
186
|
return {
|
|
187
187
|
fileName: WEB_CONFIG_FILE_NAME,
|
|
188
188
|
fileContents: JS_TEMPLATE.replace("{/*--CONFIG--*/}", JSON.stringify(responseBody, null, 2)),
|
package/lib/templates.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readTemplate = exports.readTemplateSync = exports.absoluteTemplateFilePath = void 0;
|
|
4
|
+
const fs_1 = require("fs");
|
|
5
|
+
const promises_1 = require("fs/promises");
|
|
6
|
+
const path_1 = require("path");
|
|
7
|
+
const utils_1 = require("./utils");
|
|
8
|
+
const TEMPLATE_ENCODING = "utf8";
|
|
9
|
+
function absoluteTemplateFilePath(relPath) {
|
|
10
|
+
if ((0, utils_1.isVSCodeExtension)()) {
|
|
11
|
+
return (0, path_1.resolve)(__dirname, "templates", relPath);
|
|
12
|
+
}
|
|
13
|
+
return (0, path_1.resolve)(__dirname, "../templates", relPath);
|
|
14
|
+
}
|
|
15
|
+
exports.absoluteTemplateFilePath = absoluteTemplateFilePath;
|
|
16
|
+
function readTemplateSync(relPath) {
|
|
17
|
+
return (0, fs_1.readFileSync)(absoluteTemplateFilePath(relPath), TEMPLATE_ENCODING);
|
|
18
|
+
}
|
|
19
|
+
exports.readTemplateSync = readTemplateSync;
|
|
20
|
+
function readTemplate(relPath) {
|
|
21
|
+
return (0, promises_1.readFile)(absoluteTemplateFilePath(relPath), TEMPLATE_ENCODING);
|
|
22
|
+
}
|
|
23
|
+
exports.readTemplate = readTemplate;
|
package/lib/utils.js
CHANGED
|
@@ -23,6 +23,7 @@ const configstore_1 = require("./configstore");
|
|
|
23
23
|
const error_1 = require("./error");
|
|
24
24
|
const logger_1 = require("./logger");
|
|
25
25
|
const prompt_1 = require("./prompt");
|
|
26
|
+
const templates_1 = require("./templates");
|
|
26
27
|
exports.IS_WINDOWS = process.platform === "win32";
|
|
27
28
|
const SUCCESS_CHAR = exports.IS_WINDOWS ? "+" : "✔";
|
|
28
29
|
const WARNING_CHAR = exports.IS_WINDOWS ? "!" : "⚠";
|
|
@@ -504,8 +505,7 @@ async function openInBrowser(url) {
|
|
|
504
505
|
}
|
|
505
506
|
exports.openInBrowser = openInBrowser;
|
|
506
507
|
async function openInBrowserPopup(url, buttonText) {
|
|
507
|
-
const popupPage =
|
|
508
|
-
.readFileSync(path.join(__dirname, "../templates/popup.html"), { encoding: "utf-8" })
|
|
508
|
+
const popupPage = (0, templates_1.readTemplateSync)("popup.html")
|
|
509
509
|
.replace("${url}", url)
|
|
510
510
|
.replace("${buttonText}", buttonText);
|
|
511
511
|
const port = await (0, portfinder_1.getPortPromise)();
|
package/package.json
CHANGED
|
@@ -2,7 +2,39 @@
|
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
3
|
"additionalProperties": false,
|
|
4
4
|
"definitions": {
|
|
5
|
-
"
|
|
5
|
+
"javascriptSdk": {
|
|
6
|
+
"additionalProperties": true,
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"outputDir": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"description": "Path to the directory where generated files should be written to."
|
|
12
|
+
},
|
|
13
|
+
"package": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"description": "The package name to use for the generated code."
|
|
16
|
+
},
|
|
17
|
+
"packageJSONDir": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"description": "The directory containining the package.json to install the generated package in."
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"kotlinSdk": {
|
|
24
|
+
"additionalProperties": true,
|
|
25
|
+
"type": "object",
|
|
26
|
+
"properties": {
|
|
27
|
+
"outputDir": {
|
|
28
|
+
"type": "string",
|
|
29
|
+
"description": "Path to the directory where generated files should be written to."
|
|
30
|
+
},
|
|
31
|
+
"package": {
|
|
32
|
+
"type": "string",
|
|
33
|
+
"description": "The package name to use for the generated code."
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"swiftSdk": {
|
|
6
38
|
"additionalProperties": true,
|
|
7
39
|
"type": "object",
|
|
8
40
|
"properties": {
|
|
@@ -30,21 +62,21 @@
|
|
|
30
62
|
"javascriptSdk": {
|
|
31
63
|
"type": "array",
|
|
32
64
|
"items": {
|
|
33
|
-
"$ref": "#/definitions/
|
|
65
|
+
"$ref": "#/definitions/javascriptSdk"
|
|
34
66
|
},
|
|
35
67
|
"description": "Configuration for a generated Javascript SDK"
|
|
36
68
|
},
|
|
37
69
|
"kotlinSdk": {
|
|
38
70
|
"type": "array",
|
|
39
71
|
"items": {
|
|
40
|
-
"$ref": "#/definitions/
|
|
72
|
+
"$ref": "#/definitions/kotlinSdk"
|
|
41
73
|
},
|
|
42
74
|
"description": "Configuration for a generated Kotlin SDK"
|
|
43
75
|
},
|
|
44
76
|
"swiftSdk": {
|
|
45
77
|
"type": "array",
|
|
46
78
|
"items": {
|
|
47
|
-
"$ref": "#/definitions/
|
|
79
|
+
"$ref": "#/definitions/swiftSdk"
|
|
48
80
|
},
|
|
49
81
|
"description": "Configuration for a generated Swift SDK"
|
|
50
82
|
}
|
|
@@ -58,6 +58,10 @@
|
|
|
58
58
|
"type": "string",
|
|
59
59
|
"description": "The ID of the Firebase Data Connect service."
|
|
60
60
|
},
|
|
61
|
+
"location": {
|
|
62
|
+
"type": "string",
|
|
63
|
+
"description": "The region of the Firebase Data Connect service."
|
|
64
|
+
},
|
|
61
65
|
"connectorDirs": {
|
|
62
66
|
"type": "array",
|
|
63
67
|
"items": {
|
|
@@ -276,9 +276,6 @@
|
|
|
276
276
|
{
|
|
277
277
|
"additionalProperties": false,
|
|
278
278
|
"properties": {
|
|
279
|
-
"location": {
|
|
280
|
-
"type": "string"
|
|
281
|
-
},
|
|
282
279
|
"postdeploy": {
|
|
283
280
|
"anyOf": [
|
|
284
281
|
{
|
|
@@ -310,7 +307,6 @@
|
|
|
310
307
|
}
|
|
311
308
|
},
|
|
312
309
|
"required": [
|
|
313
|
-
"location",
|
|
314
310
|
"source"
|
|
315
311
|
],
|
|
316
312
|
"type": "object"
|
|
@@ -319,9 +315,6 @@
|
|
|
319
315
|
"items": {
|
|
320
316
|
"additionalProperties": false,
|
|
321
317
|
"properties": {
|
|
322
|
-
"location": {
|
|
323
|
-
"type": "string"
|
|
324
|
-
},
|
|
325
318
|
"postdeploy": {
|
|
326
319
|
"anyOf": [
|
|
327
320
|
{
|
|
@@ -353,7 +346,6 @@
|
|
|
353
346
|
}
|
|
354
347
|
},
|
|
355
348
|
"required": [
|
|
356
|
-
"location",
|
|
357
349
|
"source"
|
|
358
350
|
],
|
|
359
351
|
"type": "object"
|
package/templates/_gitignore
CHANGED
|
@@ -1,2 +1,13 @@
|
|
|
1
1
|
connectorId: "__connectorId__"
|
|
2
2
|
authMode: "PUBLIC"
|
|
3
|
+
## ## Here's an example of how to add generated SDKs.
|
|
4
|
+
## ## You'll need to replace the outputDirs with ones pointing to where you want the generated code in your app.
|
|
5
|
+
# generate:
|
|
6
|
+
# javascriptSdk:
|
|
7
|
+
# outputDir: <Path where you want the generated SDK to be written to, relative to this file>
|
|
8
|
+
# package: "@firebasegen/my-connector"
|
|
9
|
+
# packageJSONDir: < Optional. Path to your Javascript app's package.json>
|
|
10
|
+
# swiftSdk:
|
|
11
|
+
# outputDir: <Path where you want the generated SDK to be written to, relative to this file>
|
|
12
|
+
# kotlinSdk:
|
|
13
|
+
# outputDir: <Path where you want the generated SDK to be written to, relative to this file>
|