firebase-tools-with-isolate 13.6.4 → 13.9.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/README.md +4 -6
- package/lib/api.js +18 -8
- package/lib/apiv2.js +19 -13
- package/lib/apphosting/app.js +69 -0
- package/lib/apphosting/config.js +97 -0
- package/lib/{init/features/apphosting → apphosting}/constants.js +2 -2
- package/lib/apphosting/githubConnections.js +263 -0
- package/lib/apphosting/index.js +319 -0
- package/lib/{init/features/apphosting → apphosting}/repo.js +12 -12
- package/lib/apphosting/secrets/dialogs.js +170 -0
- package/lib/apphosting/secrets/index.js +103 -0
- package/lib/checkValidTargetFilters.js +8 -1
- package/lib/commands/apphosting-backends-create.js +9 -4
- package/lib/commands/apphosting-backends-delete.js +27 -30
- package/lib/commands/apphosting-backends-get.js +8 -8
- package/lib/commands/apphosting-backends-list.js +6 -7
- package/lib/commands/apphosting-secrets-access.js +24 -0
- package/lib/commands/apphosting-secrets-describe.js +29 -0
- package/lib/commands/apphosting-secrets-grantaccess.js +49 -0
- package/lib/commands/apphosting-secrets-set.js +56 -0
- package/lib/commands/dataconnect-sdk-generate.js +37 -0
- package/lib/commands/dataconnect-services-list.js +80 -0
- package/lib/commands/dataconnect-sql-diff.js +25 -0
- package/lib/commands/dataconnect-sql-migrate.js +45 -0
- package/lib/commands/deploy.js +27 -1
- package/lib/commands/firestore-databases-create.js +1 -0
- package/lib/commands/firestore-databases-restore.js +1 -0
- package/lib/commands/functions-secrets-access.js +2 -2
- package/lib/commands/functions-secrets-describe.js +14 -0
- package/lib/commands/functions-secrets-destroy.js +2 -2
- package/lib/commands/functions-secrets-get.js +3 -17
- package/lib/commands/functions-secrets-prune.js +2 -1
- package/lib/commands/functions-secrets-set.js +3 -19
- package/lib/commands/index.js +25 -6
- package/lib/commands/init.js +10 -3
- package/lib/commands/setup-emulators-dataconnect.js +12 -0
- package/lib/config.js +1 -0
- package/lib/dataconnect/build.js +22 -0
- package/lib/dataconnect/checkIam.js +30 -0
- package/lib/dataconnect/client.js +112 -0
- package/lib/dataconnect/dataplaneClient.js +16 -0
- package/lib/dataconnect/ensureApis.js +12 -0
- package/lib/dataconnect/errors.js +29 -0
- package/lib/dataconnect/fileUtils.js +92 -0
- package/lib/dataconnect/filters.js +45 -0
- package/lib/dataconnect/freeTrial.js +22 -0
- package/lib/dataconnect/graphqlError.js +12 -0
- package/lib/dataconnect/load.js +40 -0
- package/lib/dataconnect/names.js +46 -0
- package/lib/dataconnect/prompts.js +20 -0
- package/lib/dataconnect/provisionCloudSql.js +74 -0
- package/lib/dataconnect/schemaMigration.js +246 -0
- package/lib/dataconnect/types.js +22 -0
- package/lib/deploy/dataconnect/deploy.js +75 -0
- package/lib/deploy/dataconnect/index.js +9 -0
- package/lib/deploy/dataconnect/prepare.js +33 -0
- package/lib/deploy/dataconnect/release.js +65 -0
- package/lib/deploy/firestore/prepare.js +4 -2
- package/lib/deploy/functions/checkIam.js +6 -39
- package/lib/deploy/functions/containerCleaner.js +1 -15
- package/lib/deploy/functions/deploy.js +2 -2
- package/lib/deploy/functions/params.js +2 -2
- package/lib/deploy/functions/prepare.js +13 -3
- package/lib/deploy/functions/pricing.js +2 -2
- package/lib/deploy/functions/prompts.js +39 -7
- package/lib/deploy/functions/release/fabricator.js +12 -7
- package/lib/deploy/functions/release/index.js +17 -2
- package/lib/deploy/functions/release/planner.js +11 -3
- package/lib/deploy/functions/runtimes/discovery/index.js +3 -3
- package/lib/deploy/functions/runtimes/index.js +6 -43
- package/lib/deploy/functions/runtimes/node/index.js +3 -2
- package/lib/deploy/functions/runtimes/node/parseRuntimeAndValidateSDK.js +15 -34
- package/lib/deploy/functions/runtimes/python/index.js +10 -7
- package/lib/deploy/functions/runtimes/supported/index.js +80 -0
- package/lib/deploy/functions/runtimes/supported/types.js +74 -0
- package/lib/deploy/functions/services/index.js +4 -0
- package/lib/deploy/index.js +2 -0
- package/lib/downloadUtils.js +3 -2
- package/lib/emulator/constants.js +3 -0
- package/lib/emulator/controller.js +44 -13
- package/lib/emulator/dataconnectEmulator.js +95 -0
- package/lib/emulator/download.js +1 -1
- package/lib/emulator/downloadableEmulators.js +57 -8
- package/lib/emulator/functionsEmulator.js +2 -2
- package/lib/emulator/hub.js +5 -0
- package/lib/emulator/portUtils.js +3 -3
- package/lib/emulator/registry.js +6 -1
- package/lib/emulator/types.js +3 -0
- package/lib/experiments.js +31 -6
- package/lib/extensions/emulator/specHelper.js +9 -42
- package/lib/extensions/extensionsApi.js +2 -2
- package/lib/extensions/localHelper.js +3 -3
- package/lib/firestore/pretty-print.js +5 -0
- package/lib/frameworks/astro/index.js +1 -1
- package/lib/frameworks/flutter/index.js +2 -2
- package/lib/frameworks/next/constants.js +2 -1
- package/lib/frameworks/next/index.js +27 -15
- package/lib/frameworks/next/utils.js +33 -3
- package/lib/functional.js +2 -2
- package/lib/functions/events/v2.js +7 -1
- package/lib/functions/python.js +4 -3
- package/lib/functions/secrets.js +40 -22
- package/lib/gcp/apphosting.js +25 -3
- package/lib/gcp/cloudbuild.js +7 -3
- package/lib/gcp/cloudfunctions.js +5 -5
- package/lib/gcp/cloudfunctionsv2.js +3 -3
- package/lib/gcp/cloudscheduler.js +2 -2
- package/lib/gcp/cloudsql/cloudsqladmin.js +174 -0
- package/lib/gcp/cloudsql/connect.js +144 -0
- package/lib/gcp/cloudsql/fbToolsAuthClient.js +44 -0
- package/lib/gcp/computeEngine.js +7 -0
- package/lib/gcp/devConnect.js +25 -12
- package/lib/gcp/firedata.js +27 -0
- package/lib/gcp/iam.js +41 -1
- package/lib/gcp/secretManager.js +55 -7
- package/lib/gcp/serviceusage.js +24 -5
- package/lib/hosting/interactive.js +4 -0
- package/lib/init/features/dataconnect/index.js +166 -0
- package/lib/init/features/emulators.js +13 -1
- package/lib/init/features/functions/index.js +19 -3
- package/lib/init/features/functions/npm-dependencies.js +12 -23
- package/lib/init/features/functions/python.js +4 -3
- package/lib/init/features/genkit.js +53 -0
- package/lib/init/features/hosting/github.js +4 -5
- package/lib/init/features/index.js +6 -2
- package/lib/init/index.js +2 -0
- package/lib/init/spawn.js +23 -0
- package/lib/logger.js +22 -2
- package/lib/operation-poller.js +8 -2
- package/lib/rc.js +9 -1
- package/lib/requireAuth.js +1 -8
- package/lib/requireTosAcceptance.js +22 -0
- package/lib/utils.js +76 -8
- package/package.json +11 -5
- package/schema/connector-yaml.json +54 -0
- package/schema/dataconnect-yaml.json +72 -0
- package/schema/firebase-config.json +115 -2
- package/templates/extensions/javascript/package.lint.json +2 -2
- package/templates/extensions/javascript/package.nolint.json +2 -2
- package/templates/extensions/typescript/package.lint.json +2 -2
- package/templates/extensions/typescript/package.nolint.json +2 -2
- package/templates/init/dataconnect/connector.yaml +2 -0
- package/templates/init/dataconnect/dataconnect.yaml +10 -0
- package/templates/init/dataconnect/mutations.gql +30 -0
- package/templates/init/dataconnect/queries.gql +51 -0
- package/templates/init/dataconnect/schema.gql +28 -0
- package/templates/init/functions/javascript/_gitignore +2 -1
- package/templates/init/functions/javascript/package.lint.json +2 -2
- package/templates/init/functions/javascript/package.nolint.json +2 -2
- package/templates/init/functions/python/_gitignore +1 -0
- package/templates/init/functions/typescript/_eslintrc +1 -0
- package/templates/init/functions/typescript/_gitignore +1 -0
- package/templates/init/functions/typescript/package.lint.json +2 -2
- package/templates/init/functions/typescript/package.nolint.json +2 -2
- package/lib/init/features/apphosting/index.js +0 -229
- package/lib/monospace/index.js +0 -82
- /package/lib/{monospace/interfaces.js → gcp/cloudsql/types.js} +0 -0
|
@@ -13,7 +13,7 @@ exports.command = new command_1.Command("functions:secrets:destroy <KEY>[@versio
|
|
|
13
13
|
.description("Destroy a secret. Defaults to destroying the latest version.")
|
|
14
14
|
.withForce("Destroys a secret without confirmation.")
|
|
15
15
|
.before(requireAuth_1.requireAuth)
|
|
16
|
-
.before(
|
|
16
|
+
.before(secretManager_1.ensureApi)
|
|
17
17
|
.action(async (key, options) => {
|
|
18
18
|
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
19
19
|
const projectNumber = await (0, projectUtils_1.needProjectNumber)(options);
|
|
@@ -54,7 +54,7 @@ exports.command = new command_1.Command("functions:secrets:destroy <KEY>[@versio
|
|
|
54
54
|
await (0, secretManager_1.destroySecretVersion)(projectId, name, version);
|
|
55
55
|
(0, utils_1.logBullet)(`Destroyed secret version ${name}@${sv.versionId}`);
|
|
56
56
|
const secret = await (0, secretManager_1.getSecret)(projectId, name);
|
|
57
|
-
if (
|
|
57
|
+
if ((0, secretManager_1.isFunctionsManaged)(secret)) {
|
|
58
58
|
const versions = await (0, secretManager_1.listSecretVersions)(projectId, name);
|
|
59
59
|
if (versions.filter((v) => v.state === "ENABLED").length === 0) {
|
|
60
60
|
(0, utils_1.logBullet)(`No active secret versions left. Destroying secret ${name}`);
|
|
@@ -1,28 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.command = void 0;
|
|
4
|
-
const Table = require("cli-table");
|
|
5
4
|
const requireAuth_1 = require("../requireAuth");
|
|
6
5
|
const command_1 = require("../command");
|
|
7
|
-
const logger_1 = require("../logger");
|
|
8
|
-
const projectUtils_1 = require("../projectUtils");
|
|
9
|
-
const secretManager_1 = require("../gcp/secretManager");
|
|
10
6
|
const requirePermissions_1 = require("../requirePermissions");
|
|
7
|
+
const secretManager = require("../gcp/secretManager");
|
|
11
8
|
const secrets = require("../functions/secrets");
|
|
12
9
|
exports.command = new command_1.Command("functions:secrets:get <KEY>")
|
|
13
10
|
.description("Get metadata for secret and its versions")
|
|
14
11
|
.before(requireAuth_1.requireAuth)
|
|
15
|
-
.before(
|
|
12
|
+
.before(secretManager.ensureApi)
|
|
16
13
|
.before(requirePermissions_1.requirePermissions, ["secretmanager.secrets.get"])
|
|
17
|
-
.action(
|
|
18
|
-
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
19
|
-
const versions = await (0, secretManager_1.listSecretVersions)(projectId, key);
|
|
20
|
-
const table = new Table({
|
|
21
|
-
head: ["Version", "State"],
|
|
22
|
-
style: { head: ["yellow"] },
|
|
23
|
-
});
|
|
24
|
-
for (const version of versions) {
|
|
25
|
-
table.push([version.versionId, version.state]);
|
|
26
|
-
}
|
|
27
|
-
logger_1.logger.info(table.toString());
|
|
28
|
-
});
|
|
14
|
+
.action(secrets.describeSecret);
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.command = void 0;
|
|
4
4
|
const backend = require("../deploy/functions/backend");
|
|
5
5
|
const secrets = require("../functions/secrets");
|
|
6
|
+
const secretManager = require("../gcp/secretManager");
|
|
6
7
|
const command_1 = require("../command");
|
|
7
8
|
const projectUtils_1 = require("../projectUtils");
|
|
8
9
|
const requirePermissions_1 = require("../requirePermissions");
|
|
@@ -15,7 +16,7 @@ exports.command = new command_1.Command("functions:secrets:prune")
|
|
|
15
16
|
.withForce("Destroys unused secrets without prompt")
|
|
16
17
|
.description("Destroys unused secrets")
|
|
17
18
|
.before(requireAuth_1.requireAuth)
|
|
18
|
-
.before(
|
|
19
|
+
.before(secretManager.ensureApi)
|
|
19
20
|
.before(requirePermissions_1.requirePermissions, [
|
|
20
21
|
"cloudfunctions.functions.list",
|
|
21
22
|
"secretmanager.secrets.list",
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.command = void 0;
|
|
4
|
-
const tty = require("tty");
|
|
5
|
-
const fs = require("fs");
|
|
6
4
|
const clc = require("colorette");
|
|
7
5
|
const logger_1 = require("../logger");
|
|
8
6
|
const secrets_1 = require("../functions/secrets");
|
|
@@ -20,7 +18,7 @@ exports.command = new command_1.Command("functions:secrets:set <KEY>")
|
|
|
20
18
|
.description("Create or update a secret for use in Cloud Functions for Firebase.")
|
|
21
19
|
.withForce("Automatically updates functions to use the new secret.")
|
|
22
20
|
.before(requireAuth_1.requireAuth)
|
|
23
|
-
.before(
|
|
21
|
+
.before(secretManager_1.ensureApi)
|
|
24
22
|
.before(requirePermissions_1.requirePermissions, [
|
|
25
23
|
"secretmanager.secrets.create",
|
|
26
24
|
"secretmanager.secrets.get",
|
|
@@ -33,24 +31,10 @@ exports.command = new command_1.Command("functions:secrets:set <KEY>")
|
|
|
33
31
|
const projectNumber = await (0, projectUtils_1.needProjectNumber)(options);
|
|
34
32
|
const key = await (0, secrets_1.ensureValidKey)(unvalidatedKey, options);
|
|
35
33
|
const secret = await (0, secrets_1.ensureSecret)(projectId, key, options);
|
|
36
|
-
|
|
37
|
-
if ((!options.dataFile || options.dataFile === "-") && tty.isatty(0)) {
|
|
38
|
-
secretValue = await (0, prompt_1.promptOnce)({
|
|
39
|
-
name: key,
|
|
40
|
-
type: "password",
|
|
41
|
-
message: `Enter a value for ${key}`,
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
let dataFile = 0;
|
|
46
|
-
if (options.dataFile && options.dataFile !== "-") {
|
|
47
|
-
dataFile = options.dataFile;
|
|
48
|
-
}
|
|
49
|
-
secretValue = fs.readFileSync(dataFile, "utf-8");
|
|
50
|
-
}
|
|
34
|
+
const secretValue = await (0, utils_1.readSecretValue)(`Enter a value for ${key}`, options.dataFile);
|
|
51
35
|
const secretVersion = await (0, secretManager_1.addVersion)(projectId, key, secretValue);
|
|
52
36
|
(0, utils_1.logSuccess)(`Created a new secret version ${(0, secretManager_1.toSecretVersionResourceName)(secretVersion)}`);
|
|
53
|
-
if (!
|
|
37
|
+
if (!(0, secretManager_1.isFunctionsManaged)(secret)) {
|
|
54
38
|
(0, utils_1.logBullet)("Please deploy your functions for the change to take effect by running:\n\t" +
|
|
55
39
|
clc.bold("firebase deploy --only functions"));
|
|
56
40
|
return;
|
package/lib/commands/index.js
CHANGED
|
@@ -129,6 +129,7 @@ function load(client) {
|
|
|
129
129
|
client.functions.secrets.access = loadCommand("functions-secrets-access");
|
|
130
130
|
client.functions.secrets.destroy = loadCommand("functions-secrets-destroy");
|
|
131
131
|
client.functions.secrets.get = loadCommand("functions-secrets-get");
|
|
132
|
+
client.functions.secrets.describe = loadCommand("functions-secrets-describe");
|
|
132
133
|
client.functions.secrets.prune = loadCommand("functions-secrets-prune");
|
|
133
134
|
client.functions.secrets.set = loadCommand("functions-secrets-set");
|
|
134
135
|
client.help = loadCommand("help");
|
|
@@ -161,12 +162,19 @@ function load(client) {
|
|
|
161
162
|
client.apphosting.backends.create = loadCommand("apphosting-backends-create");
|
|
162
163
|
client.apphosting.backends.get = loadCommand("apphosting-backends-get");
|
|
163
164
|
client.apphosting.backends.delete = loadCommand("apphosting-backends-delete");
|
|
164
|
-
client.apphosting.
|
|
165
|
-
client.apphosting.
|
|
166
|
-
client.apphosting.
|
|
167
|
-
client.apphosting.
|
|
168
|
-
client.apphosting.
|
|
169
|
-
|
|
165
|
+
client.apphosting.secrets = {};
|
|
166
|
+
client.apphosting.secrets.set = loadCommand("apphosting-secrets-set");
|
|
167
|
+
client.apphosting.secrets.grantaccess = loadCommand("apphosting-secrets-grantaccess");
|
|
168
|
+
client.apphosting.secrets.describe = loadCommand("apphosting-secrets-describe");
|
|
169
|
+
client.apphosting.secrets.access = loadCommand("apphosting-secrets-access");
|
|
170
|
+
if (experiments.isEnabled("internaltesting")) {
|
|
171
|
+
client.apphosting.builds = {};
|
|
172
|
+
client.apphosting.builds.get = loadCommand("apphosting-builds-get");
|
|
173
|
+
client.apphosting.builds.create = loadCommand("apphosting-builds-create");
|
|
174
|
+
client.apphosting.rollouts = {};
|
|
175
|
+
client.apphosting.rollouts.create = loadCommand("apphosting-rollouts-create");
|
|
176
|
+
client.apphosting.rollouts.list = loadCommand("apphosting-rollouts-list");
|
|
177
|
+
}
|
|
170
178
|
}
|
|
171
179
|
client.login = loadCommand("login");
|
|
172
180
|
client.login.add = loadCommand("login-add");
|
|
@@ -192,6 +200,17 @@ function load(client) {
|
|
|
192
200
|
client.setup.emulators.pubsub = loadCommand("setup-emulators-pubsub");
|
|
193
201
|
client.setup.emulators.storage = loadCommand("setup-emulators-storage");
|
|
194
202
|
client.setup.emulators.ui = loadCommand("setup-emulators-ui");
|
|
203
|
+
if (experiments.isEnabled("dataconnect")) {
|
|
204
|
+
client.dataconnect = {};
|
|
205
|
+
client.setup.emulators.dataconnect = loadCommand("setup-emulators-dataconnect");
|
|
206
|
+
client.dataconnect.services = {};
|
|
207
|
+
client.dataconnect.services.list = loadCommand("dataconnect-services-list");
|
|
208
|
+
client.dataconnect.sql = {};
|
|
209
|
+
client.dataconnect.sql.diff = loadCommand("dataconnect-sql-diff");
|
|
210
|
+
client.dataconnect.sql.migrate = loadCommand("dataconnect-sql-migrate");
|
|
211
|
+
client.dataconnect.sdk = {};
|
|
212
|
+
client.dataconnect.sdk.generate = loadCommand("dataconnect-sdk-generate");
|
|
213
|
+
}
|
|
195
214
|
client.target = loadCommand("target");
|
|
196
215
|
client.target.apply = loadCommand("target-apply");
|
|
197
216
|
client.target.clear = loadCommand("target-clear");
|
package/lib/commands/init.js
CHANGED
|
@@ -69,10 +69,17 @@ const choices = [
|
|
|
69
69
|
checked: false,
|
|
70
70
|
},
|
|
71
71
|
];
|
|
72
|
-
if ((0, experiments_1.isEnabled)("
|
|
72
|
+
if ((0, experiments_1.isEnabled)("genkit")) {
|
|
73
73
|
choices.push({
|
|
74
|
-
value: "
|
|
75
|
-
name: "
|
|
74
|
+
value: "genkit",
|
|
75
|
+
name: "Genkit: Setup a new Genkit project with Firebase",
|
|
76
|
+
checked: false,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
if ((0, experiments_1.isEnabled)("dataconnect")) {
|
|
80
|
+
choices.push({
|
|
81
|
+
value: "dataconnect",
|
|
82
|
+
name: "Data Connect: Set up a Firebase Data Connect service.",
|
|
76
83
|
checked: false,
|
|
77
84
|
});
|
|
78
85
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
4
|
+
const command_1 = require("../command");
|
|
5
|
+
const download_1 = require("../emulator/download");
|
|
6
|
+
const types_1 = require("../emulator/types");
|
|
7
|
+
const NAME = types_1.Emulators.DATACONNECT;
|
|
8
|
+
exports.command = new command_1.Command(`setup:emulators:${NAME}`)
|
|
9
|
+
.description(`downloads the ${NAME} emulator`)
|
|
10
|
+
.action(() => {
|
|
11
|
+
return (0, download_1.downloadEmulator)(NAME);
|
|
12
|
+
});
|
package/lib/config.js
CHANGED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.build = void 0;
|
|
4
|
+
const dataconnectEmulator_1 = require("../emulator/dataconnectEmulator");
|
|
5
|
+
const error_1 = require("../error");
|
|
6
|
+
const graphqlError_1 = require("./graphqlError");
|
|
7
|
+
async function build(options, configDir) {
|
|
8
|
+
const projectId = options.project ?? "demo-test";
|
|
9
|
+
const args = {
|
|
10
|
+
projectId,
|
|
11
|
+
configDir,
|
|
12
|
+
auto_download: true,
|
|
13
|
+
rc: options.rc,
|
|
14
|
+
};
|
|
15
|
+
const dataconnectEmulator = new dataconnectEmulator_1.DataConnectEmulator(args);
|
|
16
|
+
const buildResult = await dataconnectEmulator.build();
|
|
17
|
+
if (buildResult?.errors?.length) {
|
|
18
|
+
throw new error_1.FirebaseError(`There are errors in your schema and connector files:\n${buildResult.errors.map(graphqlError_1.prettify).join("\n")}`);
|
|
19
|
+
}
|
|
20
|
+
return buildResult?.metadata ?? {};
|
|
21
|
+
}
|
|
22
|
+
exports.build = build;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.grantRolesToCloudSqlServiceAccount = void 0;
|
|
4
|
+
const iam = require("../gcp/iam");
|
|
5
|
+
const resourceManager_1 = require("../gcp/resourceManager");
|
|
6
|
+
const cloudSqlAdmin = require("../gcp/cloudsql/cloudsqladmin");
|
|
7
|
+
const error_1 = require("../error");
|
|
8
|
+
async function grantRolesToCloudSqlServiceAccount(projectId, instanceId, roles) {
|
|
9
|
+
const instance = await cloudSqlAdmin.getInstance(projectId, instanceId);
|
|
10
|
+
const saEmail = instance.serviceAccountEmailAddress;
|
|
11
|
+
const policy = await (0, resourceManager_1.getIamPolicy)(projectId);
|
|
12
|
+
const requiredBindings = roles.map((r) => {
|
|
13
|
+
const binding = {
|
|
14
|
+
role: r,
|
|
15
|
+
members: [`serviceAccount:${saEmail}`],
|
|
16
|
+
};
|
|
17
|
+
return binding;
|
|
18
|
+
});
|
|
19
|
+
const updated = iam.mergeBindings(policy, requiredBindings);
|
|
20
|
+
if (updated) {
|
|
21
|
+
try {
|
|
22
|
+
await (0, resourceManager_1.setIamPolicy)(projectId, policy, "bindings");
|
|
23
|
+
}
|
|
24
|
+
catch (err) {
|
|
25
|
+
iam.printManualIamConfig(requiredBindings, projectId, "dataconnect");
|
|
26
|
+
throw new error_1.FirebaseError("Unable to make required IAM policy changes.");
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.grantRolesToCloudSqlServiceAccount = grantRolesToCloudSqlServiceAccount;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.upsertConnector = exports.listConnectors = exports.deleteConnector = exports.getConnector = exports.upsertSchema = exports.getSchema = exports.deleteService = exports.createService = exports.listServices = exports.listAllServices = exports.listLocations = void 0;
|
|
4
|
+
const api_1 = require("../api");
|
|
5
|
+
const apiv2_1 = require("../apiv2");
|
|
6
|
+
const operationPoller = require("../operation-poller");
|
|
7
|
+
const types = require("./types");
|
|
8
|
+
const logger_1 = require("../logger");
|
|
9
|
+
const DATACONNECT_API_VERSION = "v1alpha";
|
|
10
|
+
const dataconnectClient = () => new apiv2_1.Client({
|
|
11
|
+
urlPrefix: (0, api_1.dataconnectOrigin)(),
|
|
12
|
+
apiVersion: DATACONNECT_API_VERSION,
|
|
13
|
+
auth: true,
|
|
14
|
+
});
|
|
15
|
+
async function listLocations(projectId) {
|
|
16
|
+
const res = await dataconnectClient().get(`/projects/${projectId}/locations`);
|
|
17
|
+
return res.body?.locations?.map((l) => l.locationId) ?? [];
|
|
18
|
+
}
|
|
19
|
+
exports.listLocations = listLocations;
|
|
20
|
+
async function listAllServices(projectId) {
|
|
21
|
+
const locations = await listLocations(projectId);
|
|
22
|
+
let services = [];
|
|
23
|
+
await Promise.all(locations.map(async (l) => {
|
|
24
|
+
try {
|
|
25
|
+
const locationServices = await listServices(projectId, l);
|
|
26
|
+
services = services.concat(locationServices);
|
|
27
|
+
}
|
|
28
|
+
catch (err) {
|
|
29
|
+
logger_1.logger.debug(`Unable to listServices in ${l}: ${err}`);
|
|
30
|
+
}
|
|
31
|
+
}));
|
|
32
|
+
return services;
|
|
33
|
+
}
|
|
34
|
+
exports.listAllServices = listAllServices;
|
|
35
|
+
async function listServices(projectId, locationId) {
|
|
36
|
+
const res = await dataconnectClient().get(`/projects/${projectId}/locations/${locationId}/services`);
|
|
37
|
+
return res.body.services ?? [];
|
|
38
|
+
}
|
|
39
|
+
exports.listServices = listServices;
|
|
40
|
+
async function createService(projectId, locationId, serviceId) {
|
|
41
|
+
const op = await dataconnectClient().post(`/projects/${projectId}/locations/${locationId}/services`, {
|
|
42
|
+
name: `projects/${projectId}/locations/${locationId}/services/${serviceId}`,
|
|
43
|
+
}, {
|
|
44
|
+
queryParams: {
|
|
45
|
+
service_id: serviceId,
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
const pollRes = await operationPoller.pollOperation({
|
|
49
|
+
apiOrigin: (0, api_1.dataconnectOrigin)(),
|
|
50
|
+
apiVersion: DATACONNECT_API_VERSION,
|
|
51
|
+
operationResourceName: op.body.name,
|
|
52
|
+
});
|
|
53
|
+
return pollRes;
|
|
54
|
+
}
|
|
55
|
+
exports.createService = createService;
|
|
56
|
+
async function deleteService(projectId, locationId, serviceId) {
|
|
57
|
+
const op = await dataconnectClient().delete(`projects/${projectId}/locations/${locationId}/services/${serviceId}?force=true`);
|
|
58
|
+
const pollRes = await operationPoller.pollOperation({
|
|
59
|
+
apiOrigin: (0, api_1.dataconnectOrigin)(),
|
|
60
|
+
apiVersion: DATACONNECT_API_VERSION,
|
|
61
|
+
operationResourceName: op.body.name,
|
|
62
|
+
});
|
|
63
|
+
return pollRes;
|
|
64
|
+
}
|
|
65
|
+
exports.deleteService = deleteService;
|
|
66
|
+
async function getSchema(serviceName) {
|
|
67
|
+
const res = await dataconnectClient().get(`${serviceName}/schemas/${types.SCHEMA_ID}`);
|
|
68
|
+
return res.body;
|
|
69
|
+
}
|
|
70
|
+
exports.getSchema = getSchema;
|
|
71
|
+
async function upsertSchema(schema, validateOnly = false) {
|
|
72
|
+
const op = await dataconnectClient().patch(`${schema.name}`, schema, {
|
|
73
|
+
queryParams: {
|
|
74
|
+
allowMissing: "true",
|
|
75
|
+
validateOnly: validateOnly ? "true" : "false",
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
if (validateOnly) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
return operationPoller.pollOperation({
|
|
82
|
+
apiOrigin: (0, api_1.dataconnectOrigin)(),
|
|
83
|
+
apiVersion: DATACONNECT_API_VERSION,
|
|
84
|
+
operationResourceName: op.body.name,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
exports.upsertSchema = upsertSchema;
|
|
88
|
+
async function getConnector(name) {
|
|
89
|
+
const res = await dataconnectClient().get(name);
|
|
90
|
+
return res.body;
|
|
91
|
+
}
|
|
92
|
+
exports.getConnector = getConnector;
|
|
93
|
+
async function deleteConnector(name) {
|
|
94
|
+
const res = await dataconnectClient().delete(name);
|
|
95
|
+
return res.body;
|
|
96
|
+
}
|
|
97
|
+
exports.deleteConnector = deleteConnector;
|
|
98
|
+
async function listConnectors(serviceName) {
|
|
99
|
+
const res = await dataconnectClient().get(`${serviceName}/connectors`);
|
|
100
|
+
return res.body?.connectors || [];
|
|
101
|
+
}
|
|
102
|
+
exports.listConnectors = listConnectors;
|
|
103
|
+
async function upsertConnector(connector) {
|
|
104
|
+
const op = await dataconnectClient().patch(`${connector.name}?allow_missing=true`, connector);
|
|
105
|
+
const pollRes = await operationPoller.pollOperation({
|
|
106
|
+
apiOrigin: (0, api_1.dataconnectOrigin)(),
|
|
107
|
+
apiVersion: DATACONNECT_API_VERSION,
|
|
108
|
+
operationResourceName: op.body.name,
|
|
109
|
+
});
|
|
110
|
+
return pollRes;
|
|
111
|
+
}
|
|
112
|
+
exports.upsertConnector = upsertConnector;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.executeGraphQL = void 0;
|
|
4
|
+
const api_1 = require("../api");
|
|
5
|
+
const apiv2_1 = require("../apiv2");
|
|
6
|
+
const DATACONNECT_API_VERSION = "v1alpha";
|
|
7
|
+
const dataconnectDataplaneClient = () => new apiv2_1.Client({
|
|
8
|
+
urlPrefix: (0, api_1.dataconnectOrigin)(),
|
|
9
|
+
apiVersion: DATACONNECT_API_VERSION,
|
|
10
|
+
auth: true,
|
|
11
|
+
});
|
|
12
|
+
async function executeGraphQL(servicePath, body) {
|
|
13
|
+
const res = await dataconnectDataplaneClient().post(`${servicePath}:executeGraphql`, body, { resolveOnHTTPError: true });
|
|
14
|
+
return res;
|
|
15
|
+
}
|
|
16
|
+
exports.executeGraphQL = executeGraphQL;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ensureApis = void 0;
|
|
4
|
+
const api = require("../api");
|
|
5
|
+
const ensureApiEnabled_1 = require("../ensureApiEnabled");
|
|
6
|
+
async function ensureApis(projectId) {
|
|
7
|
+
const prefix = "dataconnect";
|
|
8
|
+
await (0, ensureApiEnabled_1.ensure)(projectId, api.dataconnectOrigin(), prefix);
|
|
9
|
+
await (0, ensureApiEnabled_1.ensure)(projectId, api.cloudSQLAdminOrigin(), prefix);
|
|
10
|
+
await (0, ensureApiEnabled_1.ensure)(projectId, api.computeOrigin(), prefix);
|
|
11
|
+
}
|
|
12
|
+
exports.ensureApis = ensureApis;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getInvalidConnectors = exports.getIncompatibleSchemaError = void 0;
|
|
4
|
+
const INCOMPATIBLE_SCHEMA_ERROR_TYPESTRING = "IncompatibleSqlSchemaError";
|
|
5
|
+
const PRECONDITION_ERROR_TYPESTRING = "type.googleapis.com/google.rpc.PreconditionFailure";
|
|
6
|
+
const INCOMPATIBLE_CONNECTOR_TYPE = "INCOMPATIBLE_CONNECTOR";
|
|
7
|
+
function getIncompatibleSchemaError(err) {
|
|
8
|
+
const original = err.context?.body?.error || err.orignal;
|
|
9
|
+
if (!original) {
|
|
10
|
+
throw err;
|
|
11
|
+
}
|
|
12
|
+
const details = original.details;
|
|
13
|
+
const incompatibles = details.filter((d) => d["@type"]?.includes(INCOMPATIBLE_SCHEMA_ERROR_TYPESTRING));
|
|
14
|
+
return incompatibles[0];
|
|
15
|
+
}
|
|
16
|
+
exports.getIncompatibleSchemaError = getIncompatibleSchemaError;
|
|
17
|
+
function getInvalidConnectors(err) {
|
|
18
|
+
const invalidConns = [];
|
|
19
|
+
const original = err.context?.body?.error || err?.orignal;
|
|
20
|
+
const details = original?.details;
|
|
21
|
+
const preconditionErrs = details?.filter((d) => d["@type"]?.includes(PRECONDITION_ERROR_TYPESTRING));
|
|
22
|
+
for (const preconditionErr of preconditionErrs) {
|
|
23
|
+
const incompatibleConnViolation = preconditionErr?.violations?.filter((v) => v.type === INCOMPATIBLE_CONNECTOR_TYPE);
|
|
24
|
+
const newConns = incompatibleConnViolation?.map((i) => i.subject) ?? [];
|
|
25
|
+
invalidConns.push(...newConns);
|
|
26
|
+
}
|
|
27
|
+
return invalidConns;
|
|
28
|
+
}
|
|
29
|
+
exports.getInvalidConnectors = getInvalidConnectors;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pickService = exports.readGQLFiles = exports.readConnectorYaml = exports.readDataConnectYaml = exports.readFirebaseJson = void 0;
|
|
4
|
+
const fs = require("fs-extra");
|
|
5
|
+
const path = require("path");
|
|
6
|
+
const error_1 = require("../error");
|
|
7
|
+
const utils_1 = require("../utils");
|
|
8
|
+
const load_1 = require("./load");
|
|
9
|
+
function readFirebaseJson(config) {
|
|
10
|
+
if (!config.has("dataconnect")) {
|
|
11
|
+
return [];
|
|
12
|
+
}
|
|
13
|
+
const validator = (cfg) => {
|
|
14
|
+
if (!cfg["source"] && !cfg["location"]) {
|
|
15
|
+
throw new error_1.FirebaseError("Invalid firebase.json: DataConnect requires `source` and `location`");
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
source: cfg["source"],
|
|
19
|
+
location: cfg["location"],
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
const configs = config.get("dataconnect");
|
|
23
|
+
if (typeof configs === "object" && !Array.isArray(configs)) {
|
|
24
|
+
return [validator(configs)];
|
|
25
|
+
}
|
|
26
|
+
else if (Array.isArray(configs)) {
|
|
27
|
+
return configs.map(validator);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
throw new error_1.FirebaseError("Invalid firebase.json: dataconnect should be of the form { source: string, location: string }");
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.readFirebaseJson = readFirebaseJson;
|
|
34
|
+
async function readDataConnectYaml(sourceDirectory) {
|
|
35
|
+
const file = await (0, utils_1.readFileFromDirectory)(sourceDirectory, "dataconnect.yaml");
|
|
36
|
+
const dataconnectYaml = await (0, utils_1.wrappedSafeLoad)(file.source);
|
|
37
|
+
return validateDataConnectYaml(dataconnectYaml);
|
|
38
|
+
}
|
|
39
|
+
exports.readDataConnectYaml = readDataConnectYaml;
|
|
40
|
+
function validateDataConnectYaml(unvalidated) {
|
|
41
|
+
return unvalidated;
|
|
42
|
+
}
|
|
43
|
+
async function readConnectorYaml(sourceDirectory) {
|
|
44
|
+
const file = await (0, utils_1.readFileFromDirectory)(sourceDirectory, "connector.yaml");
|
|
45
|
+
const connectorYaml = await (0, utils_1.wrappedSafeLoad)(file.source);
|
|
46
|
+
return validateConnectorYaml(connectorYaml);
|
|
47
|
+
}
|
|
48
|
+
exports.readConnectorYaml = readConnectorYaml;
|
|
49
|
+
function validateConnectorYaml(unvalidated) {
|
|
50
|
+
return unvalidated;
|
|
51
|
+
}
|
|
52
|
+
async function readGQLFiles(sourceDir) {
|
|
53
|
+
const files = await fs.readdir(sourceDir);
|
|
54
|
+
return files
|
|
55
|
+
.filter((f) => f.endsWith(".gql") || f.endsWith(".graphql"))
|
|
56
|
+
.map((f) => toFile(sourceDir, f));
|
|
57
|
+
}
|
|
58
|
+
exports.readGQLFiles = readGQLFiles;
|
|
59
|
+
function toFile(sourceDir, relPath) {
|
|
60
|
+
const fullPath = path.join(sourceDir, relPath);
|
|
61
|
+
if (!fs.existsSync(fullPath)) {
|
|
62
|
+
throw new error_1.FirebaseError(`file ${fullPath} not found`);
|
|
63
|
+
}
|
|
64
|
+
const content = fs.readFileSync(fullPath).toString();
|
|
65
|
+
return {
|
|
66
|
+
path: relPath,
|
|
67
|
+
content,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
async function pickService(projectId, config, serviceId) {
|
|
71
|
+
const serviceCfgs = readFirebaseJson(config);
|
|
72
|
+
let serviceInfo;
|
|
73
|
+
if (serviceCfgs.length === 0) {
|
|
74
|
+
throw new error_1.FirebaseError("No Data Connect services found in firebase.json.");
|
|
75
|
+
}
|
|
76
|
+
else if (serviceCfgs.length === 1) {
|
|
77
|
+
serviceInfo = await (0, load_1.load)(projectId, serviceCfgs[0].location, serviceCfgs[0].source);
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
if (!serviceId) {
|
|
81
|
+
throw new error_1.FirebaseError("Multiple Data Connect services found in firebase.json. Please specify a service ID to use.");
|
|
82
|
+
}
|
|
83
|
+
const infos = await Promise.all(serviceCfgs.map((c) => (0, load_1.load)(projectId, c.location, c.source)));
|
|
84
|
+
const maybe = infos.find((i) => i.dataConnectYaml.serviceId === serviceId);
|
|
85
|
+
if (!maybe) {
|
|
86
|
+
throw new error_1.FirebaseError(`No service named ${serviceId} declared in firebase.json.`);
|
|
87
|
+
}
|
|
88
|
+
serviceInfo = maybe;
|
|
89
|
+
}
|
|
90
|
+
return serviceInfo;
|
|
91
|
+
}
|
|
92
|
+
exports.pickService = pickService;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getResourceFilters = void 0;
|
|
4
|
+
const error_1 = require("../error");
|
|
5
|
+
function getResourceFilters(options) {
|
|
6
|
+
if (!options.only) {
|
|
7
|
+
return undefined;
|
|
8
|
+
}
|
|
9
|
+
const selectors = options.only.split(",");
|
|
10
|
+
const filters = [];
|
|
11
|
+
for (let selector of selectors) {
|
|
12
|
+
if (selector.startsWith("dataconnect:")) {
|
|
13
|
+
selector = selector.replace("dataconnect:", "");
|
|
14
|
+
if (selector.length > 0) {
|
|
15
|
+
filters.push(parseSelector(selector));
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
if (filters.length === 0) {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
return filters;
|
|
23
|
+
}
|
|
24
|
+
exports.getResourceFilters = getResourceFilters;
|
|
25
|
+
function parseSelector(selector) {
|
|
26
|
+
const parts = selector.split(":");
|
|
27
|
+
const filter = {
|
|
28
|
+
serviceId: parts[0],
|
|
29
|
+
};
|
|
30
|
+
if (parts.length === 2) {
|
|
31
|
+
if (parts[1] === "schema") {
|
|
32
|
+
filter.schemaOnly = true;
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
filter.connectorId = parts[1];
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
else if (parts.length === 1) {
|
|
39
|
+
filter.fullService = true;
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
throw new error_1.FirebaseError(`Invalid '--only' filter dataconnect:${selector}`);
|
|
43
|
+
}
|
|
44
|
+
return filter;
|
|
45
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.printFreeTrialUnavailable = exports.checkForFreeTrialInstance = exports.freeTrialTermsLink = void 0;
|
|
4
|
+
const cloudsqladmin_1 = require("../gcp/cloudsql/cloudsqladmin");
|
|
5
|
+
const utils = require("../utils");
|
|
6
|
+
function freeTrialTermsLink() {
|
|
7
|
+
return "https://firebase.google.com/pricing";
|
|
8
|
+
}
|
|
9
|
+
exports.freeTrialTermsLink = freeTrialTermsLink;
|
|
10
|
+
async function checkForFreeTrialInstance(projectId) {
|
|
11
|
+
const instances = await (0, cloudsqladmin_1.listInstances)(projectId);
|
|
12
|
+
return instances.find((i) => i.settings.userLabels?.["firebase-data-connect"] === "ft")?.name;
|
|
13
|
+
}
|
|
14
|
+
exports.checkForFreeTrialInstance = checkForFreeTrialInstance;
|
|
15
|
+
function printFreeTrialUnavailable(projectId, instanceId) {
|
|
16
|
+
const message = `Project '${projectId}' already has a CloudSQL instance '${instanceId}' on the Firebase Data Connect free trial. ` +
|
|
17
|
+
"The free trial only includes one CloudSQL instance. " +
|
|
18
|
+
`Consider using a separate database on ${instanceId}, or creating a new CloudSQL instance at ` +
|
|
19
|
+
"https://console.cloud.google.com/sql/instances";
|
|
20
|
+
utils.logLabeledError("dataconnect", message);
|
|
21
|
+
}
|
|
22
|
+
exports.printFreeTrialUnavailable = printFreeTrialUnavailable;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.prettify = void 0;
|
|
4
|
+
function prettify(err) {
|
|
5
|
+
const message = err.message;
|
|
6
|
+
let header = err.extensions.file ?? "";
|
|
7
|
+
if (err.locations) {
|
|
8
|
+
header += `:${err.locations[0].line}`;
|
|
9
|
+
}
|
|
10
|
+
return header.length ? `${header}: ${message}` : message;
|
|
11
|
+
}
|
|
12
|
+
exports.prettify = prettify;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.load = void 0;
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const fileUtils = require("./fileUtils");
|
|
6
|
+
const types_1 = require("./types");
|
|
7
|
+
async function load(projectId, locationId, sourceDirectory) {
|
|
8
|
+
const dataConnectYaml = await fileUtils.readDataConnectYaml(sourceDirectory);
|
|
9
|
+
const serviceName = `projects/${projectId}/locations/${locationId}/services/${dataConnectYaml.serviceId}`;
|
|
10
|
+
const schemaDir = path.join(sourceDirectory, dataConnectYaml.schema.source);
|
|
11
|
+
const schemaGQLs = await fileUtils.readGQLFiles(schemaDir);
|
|
12
|
+
const connectorInfo = await Promise.all(dataConnectYaml.connectorDirs.map(async (dir) => {
|
|
13
|
+
const connectorDir = path.join(sourceDirectory, dir);
|
|
14
|
+
const connectorYaml = await fileUtils.readConnectorYaml(connectorDir);
|
|
15
|
+
const connectorGqls = await fileUtils.readGQLFiles(connectorDir);
|
|
16
|
+
return {
|
|
17
|
+
connectorYaml,
|
|
18
|
+
connector: {
|
|
19
|
+
name: `${serviceName}/connectors/${connectorYaml.connectorId}`,
|
|
20
|
+
source: {
|
|
21
|
+
files: connectorGqls,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
}));
|
|
26
|
+
return {
|
|
27
|
+
serviceName,
|
|
28
|
+
sourceDirectory,
|
|
29
|
+
schema: {
|
|
30
|
+
name: `${serviceName}/schemas/${types_1.SCHEMA_ID}`,
|
|
31
|
+
primaryDatasource: (0, types_1.toDatasource)(projectId, locationId, dataConnectYaml.schema.datasource),
|
|
32
|
+
source: {
|
|
33
|
+
files: schemaGQLs,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
dataConnectYaml,
|
|
37
|
+
connectorInfo,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
exports.load = load;
|