firebase-tools 15.29.0 → 15.30.1

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 (38) hide show
  1. package/lib/commands/ext-export.js +28 -2
  2. package/lib/commands/ext-migrate.js +73 -4
  3. package/lib/commands/ext-uninstall.js +36 -23
  4. package/lib/commands/functions-kits-install.js +4 -1
  5. package/lib/commands/functions-kits-uninstall.js +25 -16
  6. package/lib/deploy/functions/build.js +9 -7
  7. package/lib/deploy/functions/delete.js +47 -22
  8. package/lib/deploy/functions/ensure.js +42 -2
  9. package/lib/deploy/functions/functionsDeployHelper.js +7 -0
  10. package/lib/deploy/functions/params.js +2 -1
  11. package/lib/deploy/functions/prepare.js +3 -4
  12. package/lib/deploy/functions/release/executor.js +14 -8
  13. package/lib/deploy/functions/release/fabricator.js +42 -20
  14. package/lib/deploy/functions/release/planner.js +2 -4
  15. package/lib/deploy/functions/release/sourceTokenScraper.js +16 -2
  16. package/lib/emulator/downloadableEmulatorInfo.json +31 -31
  17. package/lib/emulator/tasksEmulator.js +2 -2
  18. package/lib/extensions/export.js +64 -2
  19. package/lib/extensions/extensionsHelper.js +1 -2
  20. package/lib/extensions/manifest.js +5 -4
  21. package/lib/extensions/migrate.js +71 -2
  22. package/lib/functions/env.js +21 -4
  23. package/lib/functions/kits/install.js +27 -10
  24. package/lib/gcp/iam.js +8 -17
  25. package/lib/gcp/resourceManager.js +31 -22
  26. package/lib/gcp/run.js +2 -2
  27. package/lib/mcp/onemcp/index.js +19 -0
  28. package/lib/mcp/onemcp/onemcp_server.js +12 -7
  29. package/lib/mcp/tools/dataconnect/execute.js +33 -19
  30. package/lib/mcp/tools/dataconnect/index.js +1 -1
  31. package/lib/throttler/throttler.js +2 -11
  32. package/lib/tsconfig.compile.tsbuildinfo +1 -1
  33. package/lib/tsconfig.publish.tsbuildinfo +1 -1
  34. package/lib/utils.js +26 -0
  35. package/package.json +1 -1
  36. package/templates/init/functions/typescript/index-kit-migration.ts +1 -0
  37. package/templates/init/functions/typescript/index-kit.ts +1 -0
  38. package/templates/init/functions/typescript/tsconfig.json +2 -1
@@ -235,7 +235,8 @@ async function promptKitId(packageName, existingKitIds, nonInteractive, customKi
235
235
  }
236
236
  return kitId;
237
237
  }
238
- async function promptSecurityConfirmation(rawPkgName, packageName, nonInteractive) {
238
+ async function promptSecurityConfirmation(options) {
239
+ const { rawPkgName, packageName, nonInteractive, force } = options;
239
240
  const isThirdParty = isThirdPartyPackage(packageName);
240
241
  if (isThirdParty) {
241
242
  (0, utils_1.logLabeledWarning)("functions", `Package ${clc.bold(packageName)} is a third-party kit (outside the @firebase-function-kits scope).`);
@@ -259,6 +260,7 @@ async function promptSecurityConfirmation(rawPkgName, packageName, nonInteractiv
259
260
  message: confirmMessage,
260
261
  default: false,
261
262
  nonInteractive,
263
+ force,
262
264
  });
263
265
  if (!confirmInstallation) {
264
266
  throw new error_1.FirebaseError("Installation cancelled.");
@@ -589,7 +591,8 @@ async function discoverKitBuild(options, absSourcePath) {
589
591
  runtime: supported.latest("nodejs"),
590
592
  };
591
593
  const runtimeDelegate = await runtimes.getRuntimeDelegate(delegateContext);
592
- return runtimeDelegate.discoverBuild({}, {});
594
+ const firebaseEnvs = functionsEnv.loadFirebaseEnvs({ projectId }, projectId, options.instanceId);
595
+ return runtimeDelegate.discoverBuild({}, firebaseEnvs);
593
596
  }
594
597
  async function promptAndWriteKitParams(options) {
595
598
  if (!options.params || options.params.length === 0) {
@@ -616,7 +619,14 @@ async function promptAndWriteKitParams(options) {
616
619
  logger_1.logger.debug(`Could not fetch Firebase config for project ${options.projectId}: ${(0, error_1.getErrMsg)(err)}`);
617
620
  }
618
621
  const typedUserEnvs = build.envWithTypes(options.params, userEnvs);
619
- const { paramValues: resolvedEnvs, secretRefs: resolvedSecretRefs } = await params.resolveParams(options.params, firebaseConfig, typedUserEnvs, options.instanceId, options.nonInteractive, options.force);
622
+ const { paramValues: resolvedEnvs, secretRefs: resolvedSecretRefs } = await params.resolveParams({
623
+ params: options.params,
624
+ firebaseConfig: firebaseConfig,
625
+ userEnvs: typedUserEnvs,
626
+ codebase: options.instanceId,
627
+ nonInteractive: options.nonInteractive,
628
+ force: options.force,
629
+ });
620
630
  functionsEnv.writeResolvedParams(resolvedEnvs, userEnvs, userEnvOpt);
621
631
  if (experiments.isEnabled("secretEnvParams")) {
622
632
  functionsEnv.writeResolvedSecretRefs(resolvedSecretRefs, secretRefs, userEnvOpt);
@@ -685,7 +695,9 @@ async function addKitInstanceOrConfigureProject(options, existingKit, existingFu
685
695
  const unconfiguredInstances = getUnconfiguredInstancesForProject(options.config, existingKit, projectId, projectAlias);
686
696
  const isConfiguredForProject = Object.keys(existingKit.instances || {}).length > 0 && unconfiguredInstances.length === 0;
687
697
  let action;
688
- if (options.instanceId && existingKit.instances && options.instanceId in existingKit.instances) {
698
+ if (options.instanceId &&
699
+ existingKit.instances &&
700
+ Object.prototype.hasOwnProperty.call(existingKit.instances, options.instanceId)) {
689
701
  if (!unconfiguredInstances.includes(options.instanceId)) {
690
702
  throw new error_1.FirebaseError(`Instance '${options.instanceId}' is already configured for this project.`);
691
703
  }
@@ -722,7 +734,7 @@ async function addKitInstanceOrConfigureProject(options, existingKit, existingFu
722
734
  let absConfigDirPath;
723
735
  if (action === "addInstance") {
724
736
  resultAction = "addedInstance";
725
- instanceId = await promptKitInstanceId(existingKit.kit, existingFunctionsInfo.existingInstanceIds, existingFunctionsInfo.existingCodebases, options.nonInteractive, options.instanceId);
737
+ instanceId = await promptKitInstanceId(options.defaultInstanceId ?? existingKit.kit, existingFunctionsInfo.existingInstanceIds, existingFunctionsInfo.existingCodebases, options.nonInteractive, options.instanceId);
726
738
  const result = await addInstanceToKit({
727
739
  config: options.config,
728
740
  kitId: existingKit.kit,
@@ -739,7 +751,7 @@ async function addKitInstanceOrConfigureProject(options, existingKit, existingFu
739
751
  existingKit,
740
752
  unconfiguredInstanceIds: unconfiguredInstances,
741
753
  });
742
- configDirPath = existingKit.instances[instanceId];
754
+ configDirPath = existingKit.instances?.[instanceId];
743
755
  if (!configDirPath) {
744
756
  throw new error_1.FirebaseError(`Configuration directory for instance '${instanceId}' not found in kit '${existingKit.kit}'.`);
745
757
  }
@@ -767,7 +779,7 @@ async function addKitInstanceOrConfigureProject(options, existingKit, existingFu
767
779
  const shouldConfigure = options.configure !== false;
768
780
  if (shouldConfigure) {
769
781
  try {
770
- discoveredBuild = await discoverKitBuild(options, absSourcePath);
782
+ discoveredBuild = await discoverKitBuild({ ...options, instanceId }, absSourcePath);
771
783
  }
772
784
  catch (err) {
773
785
  logger_1.logger.debug(`Could not discover kit build for params prompting: ${(0, error_1.getErrMsg)(err)}`);
@@ -838,7 +850,12 @@ async function resolvePackageSource(options) {
838
850
  }
839
851
  validateNpmPackageName(rawPkgName);
840
852
  const { packageName } = parseNpmPackageSpecifier(rawPkgName);
841
- const isThirdParty = await promptSecurityConfirmation(rawPkgName, packageName, options.nonInteractive);
853
+ const isThirdParty = await promptSecurityConfirmation({
854
+ rawPkgName,
855
+ packageName,
856
+ nonInteractive: options.nonInteractive,
857
+ force: options.force,
858
+ });
842
859
  return {
843
860
  defaultKitName: packageName,
844
861
  sourcePackageName: packageName,
@@ -889,7 +906,7 @@ async function installKitOrInstance(options) {
889
906
  ? await resolveDirectorySource(options)
890
907
  : await resolvePackageSource(options);
891
908
  const kitId = await promptKitId(source.defaultKitName, existingFunctionsInfo.existingKitIds, options.nonInteractive, options.kitId);
892
- const instanceId = await promptKitInstanceId(kitId, existingFunctionsInfo.existingInstanceIds, existingFunctionsInfo.existingCodebases, options.nonInteractive, options.instanceId);
909
+ const instanceId = await promptKitInstanceId(options.defaultInstanceId ?? kitId, existingFunctionsInfo.existingInstanceIds, existingFunctionsInfo.existingCodebases, options.nonInteractive, options.instanceId);
893
910
  const { sourcePath, configDirPath, absSourcePath, absConfigDirPath } = await source.setup(kitId, instanceId);
894
911
  if (options.seedEnv?.envs && Object.keys(options.seedEnv.envs).length > 0) {
895
912
  (0, env_2.seedKitInstanceEnv)({
@@ -913,7 +930,7 @@ async function installKitOrInstance(options) {
913
930
  const shouldConfigure = options.configure !== false;
914
931
  if (shouldConfigure) {
915
932
  try {
916
- discoveredBuild = await discoverKitBuild(options, absSourcePath);
933
+ discoveredBuild = await discoverKitBuild({ ...options, instanceId }, absSourcePath);
917
934
  }
918
935
  catch (err) {
919
936
  logger_1.logger.debug(`Could not discover kit build for params prompting: ${(0, error_1.getErrMsg)(err)}`);
package/lib/gcp/iam.js CHANGED
@@ -155,23 +155,14 @@ async function generateManagedServiceAccountName(projectId, prefix) {
155
155
  }
156
156
  throw new error_1.FirebaseError("Failed to generate a unique service account name after 10 attempts.");
157
157
  }
158
- function computeRolesEtag(roles, existingSalt) {
158
+ function computeRolesEtag(roles) {
159
+ const ALPHA_CHARS = "abcdefghijklmnopqrstuvwxyz";
159
160
  const BASE38_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_";
160
- let salt = existingSalt;
161
- if (!salt) {
162
- salt = String.fromCharCode(97 + Math.floor(Math.random() * 26));
163
- for (let i = 0; i < 9; i++) {
164
- salt += BASE38_CHARS[Math.floor(Math.random() * 38)];
165
- }
166
- }
167
- const sorted = Array.from(roles).sort();
168
- const hashBuffer = crypto
169
- .createHash("sha256")
170
- .update(salt + sorted.join(","))
171
- .digest();
172
- let hashStr = "";
173
- for (const byte of hashBuffer) {
174
- hashStr += BASE38_CHARS[byte % 38];
161
+ const sorted = Array.from(new Set(roles)).sort();
162
+ const hashBuffer = crypto.createHash("sha256").update(sorted.join(",")).digest();
163
+ let hashStr = ALPHA_CHARS[hashBuffer[0] % ALPHA_CHARS.length];
164
+ for (let i = 1; i < hashBuffer.length; i++) {
165
+ hashStr += BASE38_CHARS[hashBuffer[i] % BASE38_CHARS.length];
175
166
  }
176
- return `${salt}-${hashStr.substring(0, 52)}`;
167
+ return hashStr;
177
168
  }
@@ -7,9 +7,10 @@ exports.addServiceAccountToRoles = addServiceAccountToRoles;
7
7
  exports.serviceAccountHasRoles = serviceAccountHasRoles;
8
8
  exports.removeServiceAccountRoles = removeServiceAccountRoles;
9
9
  exports.getServiceAccountRoles = getServiceAccountRoles;
10
- const lodash_1 = require("lodash");
11
10
  const api_1 = require("../api");
12
11
  const apiv2_1 = require("../apiv2");
12
+ const error_1 = require("../error");
13
+ const utils = require("../utils");
13
14
  const iam_1 = require("./iam");
14
15
  const API_VERSION = "v1";
15
16
  const apiClient = new apiv2_1.Client({ urlPrefix: (0, api_1.resourceManagerOrigin)(), apiVersion: API_VERSION });
@@ -32,30 +33,38 @@ async function setIamPolicy(projectIdOrNumber, newPolicy, updateMask = "") {
32
33
  });
33
34
  return response.body;
34
35
  }
36
+ function isRetryableIamError(err) {
37
+ const status = (0, error_1.getErrStatus)(err);
38
+ if (status === 409) {
39
+ return true;
40
+ }
41
+ const msg = (0, error_1.getErrMsg)(err).toLowerCase();
42
+ const hasSa = msg.includes("service account") || msg.includes("serviceaccount");
43
+ if (status === 400 && hasSa && msg.includes("does not exist")) {
44
+ return true;
45
+ }
46
+ return false;
47
+ }
35
48
  async function addServiceAccountToRoles(projectId, serviceAccountName, roles, skipAccountLookup = false) {
36
- const [{ name: fullServiceAccountName }, projectPolicy] = await Promise.all([
37
- skipAccountLookup
38
- ? Promise.resolve({ name: serviceAccountName })
39
- : (0, iam_1.getServiceAccount)(projectId, serviceAccountName),
40
- getIamPolicy(projectId),
41
- ]);
42
- projectPolicy.bindings = projectPolicy.bindings || [];
49
+ const { name: fullServiceAccountName } = skipAccountLookup
50
+ ? { name: serviceAccountName }
51
+ : await (0, iam_1.getServiceAccount)(projectId, serviceAccountName);
43
52
  const newMemberName = `serviceAccount:${fullServiceAccountName.split("/").pop()}`;
44
- roles.forEach((roleName) => {
45
- let bindingIndex = (0, lodash_1.findIndex)(projectPolicy.bindings, (binding) => binding.role === roleName);
46
- if (bindingIndex === -1) {
47
- bindingIndex =
48
- projectPolicy.bindings.push({
49
- role: roleName,
50
- members: [],
51
- }) - 1;
52
- }
53
- const binding = projectPolicy.bindings[bindingIndex];
54
- if (!binding.members.includes(newMemberName)) {
55
- binding.members.push(newMemberName);
56
- }
53
+ return await utils.retryWithBackoff(async () => {
54
+ const projectPolicy = await getIamPolicy(projectId);
55
+ projectPolicy.bindings = projectPolicy.bindings || [];
56
+ const requiredBindings = roles.map((role) => ({
57
+ role,
58
+ members: [newMemberName],
59
+ }));
60
+ (0, iam_1.mergeBindings)(projectPolicy, requiredBindings);
61
+ return await setIamPolicy(projectId, projectPolicy, "bindings");
62
+ }, {
63
+ retries: 6,
64
+ delay: 1000,
65
+ maxDelay: 5000,
66
+ retryPredicate: isRetryableIamError,
57
67
  });
58
- return setIamPolicy(projectId, projectPolicy, "bindings");
59
68
  }
60
69
  async function serviceAccountHasRoles(projectId, serviceAccountName, roles, skipAccountLookup = false) {
61
70
  const [{ name: fullServiceAccountName }, projectPolicy] = await Promise.all([
package/lib/gcp/run.js CHANGED
@@ -15,7 +15,7 @@ const apiv2_1 = require("../apiv2");
15
15
  const error_1 = require("../error");
16
16
  const api_1 = require("../api");
17
17
  const proto = require("./proto");
18
- const throttler_1 = require("../throttler/throttler");
18
+ const utils_1 = require("../utils");
19
19
  const logger_1 = require("../logger");
20
20
  const cloudlogging_1 = require("./cloudlogging");
21
21
  const API_VERSION = "v1";
@@ -49,7 +49,7 @@ async function updateService(name, service) {
49
49
  service = await exports.replaceService(name, service);
50
50
  let retry = 0;
51
51
  while (!exports.serviceIsResolved(service)) {
52
- await (0, throttler_1.backoff)(retry, 2, 30);
52
+ await (0, utils_1.backoff)(retry, 2, 30);
53
53
  retry = retry + 1;
54
54
  service = await exports.getService(name);
55
55
  }
@@ -1,9 +1,28 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ONEMCP_SERVERS = void 0;
4
+ exports.dataConnectLocationHeaderInjector = dataConnectLocationHeaderInjector;
4
5
  const api_1 = require("../../api");
5
6
  const onemcp_server_1 = require("./onemcp_server");
7
+ function dataConnectLocationHeaderInjector(headers, _toolName, args) {
8
+ if (typeof args?.location === "string" && args.location && !headers["Mcp-Param-Region"]) {
9
+ return { "Mcp-Param-Region": args.location };
10
+ }
11
+ }
6
12
  exports.ONEMCP_SERVERS = {
13
+ dataconnect: new onemcp_server_1.OneMcpServer("dataconnect", (0, api_1.dataconnectOrigin)(), {
14
+ requiresAuth: true,
15
+ }, {
16
+ allowedTools: [
17
+ "execute_graphql",
18
+ "execute_graphql_read",
19
+ "generate_schema",
20
+ "generate_query",
21
+ "generate_query_from_schema",
22
+ "list_locations",
23
+ ],
24
+ headerOverride: dataConnectLocationHeaderInjector,
25
+ }),
7
26
  developerknowledge: new onemcp_server_1.OneMcpServer("developerknowledge", (0, api_1.developerKnowledgeOrigin)(), {
8
27
  requiresAuth: true,
9
28
  }, {
@@ -88,6 +88,17 @@ class OneMcpServer {
88
88
  await (0, ensureApiEnabled_1.ensure)(ctx.projectId, this.serverUrl, this.feature, true);
89
89
  }
90
90
  try {
91
+ const baseHeaders = {
92
+ "MCP-Protocol-Version": types_js_1.LATEST_PROTOCOL_VERSION,
93
+ "Mcp-Method": "tools/call",
94
+ "Mcp-Name": toolName,
95
+ ...(ctx.projectId ? { "x-goog-user-project": ctx.projectId } : {}),
96
+ ...paramHeaders,
97
+ };
98
+ const headers = {
99
+ ...baseHeaders,
100
+ ...(this.options.headerOverride?.(baseHeaders, toolName, args) ?? {}),
101
+ };
91
102
  const res = await this.callClient.post("/mcp", {
92
103
  method: "tools/call",
93
104
  params: {
@@ -97,13 +108,7 @@ class OneMcpServer {
97
108
  jsonrpc: "2.0",
98
109
  id: 1,
99
110
  }, {
100
- headers: {
101
- "MCP-Protocol-Version": types_js_1.LATEST_PROTOCOL_VERSION,
102
- "Mcp-Method": "tools/call",
103
- "Mcp-Name": toolName,
104
- ...(ctx.projectId ? { "x-goog-user-project": ctx.projectId } : {}),
105
- ...paramHeaders,
106
- },
111
+ headers,
107
112
  });
108
113
  return types_js_1.CallToolResultSchema.parse(res.body.result);
109
114
  }
@@ -1,19 +1,43 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.execute = void 0;
3
+ exports.execute_in_emulator = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const tool_1 = require("../../tool");
6
6
  const dataplane = require("../../../dataconnect/dataplaneClient");
7
7
  const load_1 = require("../../../dataconnect/load");
8
8
  const converter_1 = require("../../util/dataconnect/converter");
9
9
  const emulator_1 = require("../../util/dataconnect/emulator");
10
- exports.execute = (0, tool_1.tool)("dataconnect", {
11
- name: "execute",
12
- description: "Use this to execute a GraphQL operation against a SQL Connect service or its emulator.",
10
+ exports.execute_in_emulator = (0, tool_1.tool)("dataconnect", {
11
+ name: "execute_in_emulator",
12
+ description: `Executes a GraphQL operation against a local Firebase SQL Connect Service instance emulator.
13
+
14
+ Grants access to run queries and mutations on the local emulator.
15
+
16
+ **Prerequisites:**
17
+ * The Firebase local emulators must be running (run \`firebase emulators:start\` in your project directory).
18
+ * A \`firebase.json\` file configured with a \`dataconnect\` service.
19
+ * A \`dataconnect.yaml\` configuration file inside the service's source directory.
20
+ * A defined SQL Connect schema (configured via the schema/schemas fields in \`dataconnect.yaml\`).
21
+ * Note: These files are ideally generated using the \`firebase_init\` MCP tool, or must follow the standard structure described in the \`firebase-data-connect-basics\` skill.
22
+
23
+ **When to use it:**
24
+ * Use this tool to execute local GraphQL queries or mutations for development and testing.
25
+
26
+ **How to use it:**
27
+ * Call \`execute_in_emulator\` with the GraphQL \`query\` string.
28
+ * Optionally provide \`service_id\`, \`location_id\`, \`variables_json\`, and \`auth_token_json\`.
29
+
30
+ **JSON Example:**
31
+ \`\`\`json
32
+ {
33
+ "query": "query GetUser($id: UUID!) { user(id: $id) { name } }",
34
+ "variables_json": "{\\"id\\": \\"123e4567-e89b-12d3-a456-426614174000\\"}"
35
+ }
36
+ \`\`\`
37
+ `,
13
38
  humanReadableDescription: "Execute a GraphQL query or mutation against a Firebase SQL Connect service or emulator.",
14
39
  inputSchema: zod_1.z.object({
15
40
  query: zod_1.z.string().describe(`A Firebase SQL Connect GraphQL query or mutation to execute.
16
- You can use the \`dataconnect_generate_operation\` tool to generate a query.
17
41
  Example SQL Connect schema and example queries can be found in files ending in \`.graphql\` or \`.gql\`.
18
42
  `),
19
43
  service_id: zod_1.z
@@ -34,27 +58,17 @@ Example SQL Connect schema and example queries can be found in files ending in \
34
58
  .describe("Firebase Auth Token JWT to use in this query. MUST be a valid stringified JSON object." +
35
59
  'Importantly, when executing queries with `@auth(level: USER)` or `auth.uid`, a valid Firebase Auth Token JWT with "sub" field is required. ' +
36
60
  '"auth.uid" expression in the query evaluates to the value of "sub" field in Firebase Auth token.'),
37
- use_emulator: zod_1.z
38
- .boolean()
39
- .default(false)
40
- .describe("If true, target the DataConnect emulator. Run `firebase emulators:start` to start it"),
41
61
  }),
42
62
  annotations: {
43
- title: "Execute Firebase SQL Connect Query",
63
+ title: "Execute Firebase SQL Connect Query in Emulator",
44
64
  },
45
65
  _meta: {
46
66
  requiresProject: true,
47
- requiresAuth: true,
67
+ requiresAuth: false,
48
68
  },
49
- }, async ({ query, service_id, location_id, variables_json: unparsedVariables, use_emulator, auth_token_json: unparsedAuthToken, }, { projectId, config, host }) => {
69
+ }, async ({ query, service_id, location_id, variables_json: unparsedVariables, auth_token_json: unparsedAuthToken, }, { projectId, config, host }) => {
50
70
  const serviceInfo = await (0, load_1.pickOneService)(projectId, config, service_id || undefined, location_id || undefined);
51
- let apiClient;
52
- if (use_emulator) {
53
- apiClient = await (0, emulator_1.getDataConnectEmulatorClient)(host);
54
- }
55
- else {
56
- apiClient = dataplane.dataconnectDataplaneClient();
57
- }
71
+ const apiClient = await (0, emulator_1.getDataConnectEmulatorClient)(host);
58
72
  let executeGraphQL = dataplane.executeGraphQL;
59
73
  if (query.startsWith("query")) {
60
74
  executeGraphQL = dataplane.executeGraphQLRead;
@@ -4,4 +4,4 @@ exports.dataconnectTools = void 0;
4
4
  const list_services_1 = require("./list_services");
5
5
  const compile_1 = require("./compile");
6
6
  const execute_1 = require("./execute");
7
- exports.dataconnectTools = [compile_1.compile, list_services_1.list_services, execute_1.execute];
7
+ exports.dataconnectTools = [compile_1.compile, list_services_1.list_services, execute_1.execute_in_emulator];
@@ -1,19 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Throttler = void 0;
4
- exports.backoff = backoff;
5
- exports.timeToWait = timeToWait;
6
4
  const logger_1 = require("../logger");
5
+ const utils_1 = require("../utils");
7
6
  const retries_exhausted_error_1 = require("./errors/retries-exhausted-error");
8
7
  const timeout_error_1 = require("./errors/timeout-error");
9
- function backoff(retryNumber, delay, maxDelay) {
10
- return new Promise((resolve) => {
11
- setTimeout(resolve, timeToWait(retryNumber, delay, maxDelay));
12
- });
13
- }
14
- function timeToWait(retryNumber, delay, maxDelay) {
15
- return Math.min(delay * Math.pow(2, retryNumber), maxDelay);
16
- }
17
8
  function DEFAULT_HANDLER(task) {
18
9
  return task();
19
10
  }
@@ -184,7 +175,7 @@ class Throttler {
184
175
  if (taskData.retryCount === this.retries) {
185
176
  throw new retries_exhausted_error_1.default(this.taskName(cursorIndex), this.retries, err);
186
177
  }
187
- await backoff(taskData.retryCount + 1, this.backoff, this.maxBackoff);
178
+ await (0, utils_1.backoff)(taskData.retryCount + 1, this.backoff, this.maxBackoff);
188
179
  if (taskData.isTimedOut) {
189
180
  throw new timeout_error_1.default(this.taskName(cursorIndex), taskData.timeoutMillis);
190
181
  }