@tailor-platform/sdk 1.69.0 → 1.70.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 (58) hide show
  1. package/CHANGELOG.md +73 -0
  2. package/dist/{application-Cr-limKC.mjs → application-DmjIKQ-a.mjs} +319 -79
  3. package/dist/application-DmjIKQ-a.mjs.map +1 -0
  4. package/dist/application-a_ApFuPh.mjs +4 -0
  5. package/dist/cli/erd-viewer-assets/app.js +279 -36
  6. package/dist/cli/erd-viewer-assets/index.html +4 -0
  7. package/dist/cli/erd-viewer-assets/styles.css +252 -5
  8. package/dist/cli/index.mjs +642 -91
  9. package/dist/cli/index.mjs.map +1 -1
  10. package/dist/cli/lib.d.mts +87 -13
  11. package/dist/cli/lib.mjs +2 -2
  12. package/dist/cli/lib.mjs.map +1 -1
  13. package/dist/completion/zsh-worker.zsh +159 -6
  14. package/dist/configure/index.d.mts +5 -5
  15. package/dist/configure/index.mjs +8 -6
  16. package/dist/configure/index.mjs.map +1 -1
  17. package/dist/{index-B7VbJm0_.d.mts → index-BAEaAqmz.d.mts} +90 -40
  18. package/dist/{index-CklcVeMG.d.mts → index-C-vsbx27.d.mts} +2 -2
  19. package/dist/{index-hXoO-AOC.d.mts → index-CKI0eZP6.d.mts} +2 -2
  20. package/dist/{index-DYhnxXYR.d.mts → index-CrqOgUF2.d.mts} +2 -2
  21. package/dist/{index-DlDRSzFZ.d.mts → index-DESLU9kI.d.mts} +2 -2
  22. package/dist/plugin/builtin/enum-constants/index.d.mts +1 -1
  23. package/dist/plugin/builtin/file-utils/index.d.mts +1 -1
  24. package/dist/plugin/builtin/kysely-type/index.d.mts +1 -1
  25. package/dist/plugin/builtin/seed/index.d.mts +1 -1
  26. package/dist/plugin/index.d.mts +1 -1
  27. package/dist/{runtime-jowoN6qC.mjs → runtime-BpHVwifd.mjs} +525 -311
  28. package/dist/runtime-BpHVwifd.mjs.map +1 -0
  29. package/dist/{schema-1msIhXwA.mjs → schema-C4fkpWV_.mjs} +9 -15
  30. package/dist/schema-C4fkpWV_.mjs.map +1 -0
  31. package/dist/{service_pb-DGSmn-aF.mjs → service_pb-BJ9GsAnW.mjs} +1 -1
  32. package/dist/{service_pb-DSNjrcbW.mjs → service_pb-BsBR6yW5.mjs} +22 -7
  33. package/dist/service_pb-BsBR6yW5.mjs.map +1 -0
  34. package/dist/{types-2Be3wSMc.mjs → types-32lUMToj.mjs} +1 -1
  35. package/dist/{types-CmzfQP_m.mjs → types-D4QMmNWh.mjs} +1 -12
  36. package/dist/types-D4QMmNWh.mjs.map +1 -0
  37. package/dist/{types-Bzr0RQME.d.mts → types-Dynq4AJv.d.mts} +2 -2
  38. package/dist/{types-DZrtN6-H.d.mts → types-rj8YJcEe.d.mts} +5 -2
  39. package/dist/utils/test/index.d.mts +2 -2
  40. package/dist/{workflow.generated-Br9bmLdX.d.mts → workflow.generated-DJULCuRr.d.mts} +177 -172
  41. package/docs/cli/application.md +37 -2
  42. package/docs/cli/setup.md +1 -0
  43. package/docs/cli/tailordb.md +24 -0
  44. package/docs/cli/user.md +11 -1
  45. package/docs/cli/workspace.md +13 -7
  46. package/docs/cli-reference.md +6 -0
  47. package/docs/github-actions.md +27 -0
  48. package/docs/multi-environment.md +22 -0
  49. package/docs/services/aigateway.md +4 -2
  50. package/docs/services/auth.md +4 -14
  51. package/docs/services/http-adapter.md +16 -1
  52. package/package.json +11 -11
  53. package/dist/application-Br48NXBD.mjs +0 -4
  54. package/dist/application-Cr-limKC.mjs.map +0 -1
  55. package/dist/runtime-jowoN6qC.mjs.map +0 -1
  56. package/dist/schema-1msIhXwA.mjs.map +0 -1
  57. package/dist/service_pb-DSNjrcbW.mjs.map +0 -1
  58. package/dist/types-CmzfQP_m.mjs.map +0 -1
@@ -1,9 +1,9 @@
1
1
 
2
- import { t as db } from "./schema-1msIhXwA.mjs";
3
- import { $ as CreateUserProfileConfigRequestSchema, A as UpdatePipelineServiceRequestSchema, At as PageDirection, B as UpdateExecutorExecutorRequestSchema, Ct as GetApplicationSchemaHealthResponse_ApplicationSchemaHealthStatus, D as CreatePipelineResolverRequestSchema, Dt as ConditionSchema, E as UpdateSecretManagerSecretRequestSchema, Et as Subgraph_ServiceType, F as IdPPermissionOperator, G as CreateAuthHookRequestSchema, H as ExecutorTargetType, I as IdPPermissionPermit, J as CreateAuthOAuth2ClientRequestSchema, K as CreateAuthIDPConfigRequestSchema, L as FunctionExecution_Status, M as CreateIdPServiceRequestSchema, N as UpdateIdPServiceRequestSchema, O as CreatePipelineServiceRequestSchema, Ot as Condition_Operator, P as IdPLang, Q as CreateTenantConfigRequestSchema, S as UpdateStaticWebsiteRequestSchema, St as CreateApplicationRequestSchema, T as CreateSecretManagerVaultRequestSchema, Tt as ApplicationSchemaUpdateAttemptStatus, U as ExecutorTriggerType, V as ExecutorJobStatus, W as CreateAuthConnectionRequestSchema, X as CreateAuthSCIMResourceRequestSchema, Y as CreateAuthSCIMConfigRequestSchema, Z as CreateAuthServiceRequestSchema, _ as TailorDBType_Permission_Operator, _t as AuthSCIMAttribute_Uniqueness, a as WorkspacePlatformUserRole, at as UpdateAuthSCIMResourceRequestSchema, b as AddCustomDomainRequestSchema, bt as TenantProviderConfig_TenantProviderType, c as UpdateWorkflowRequestSchema, ct as UpdateUserProfileConfigRequestSchema, d as CreateTailorDBServiceRequestSchema, dt as AuthIDPConfig_AuthType, et as UpdateAuthHookRequestSchema, f as CreateTailorDBTypeRequestSchema, ft as AuthInvokerSchema, g as TailorDBGQLPermission_Permit, gt as AuthSCIMAttribute_Type, h as TailorDBGQLPermission_Operator, ht as AuthSCIMAttribute_Mutability, it as UpdateAuthSCIMConfigRequestSchema, j as PipelineResolver_OperationType, k as UpdatePipelineResolverRequestSchema, kt as FilterSchema, l as WorkflowExecution_Status, lt as AuthConnection_Type, m as TailorDBGQLPermission_Action, mt as AuthOAuth2Client_GrantType, nt as UpdateAuthMachineUserRequestSchema, o as CreateWorkflowJobFunctionRequestSchema, ot as UpdateAuthServiceRequestSchema, p as UpdateTailorDBTypeRequestSchema, pt as AuthOAuth2Client_ClientType, q as CreateAuthMachineUserRequestSchema, rt as UpdateAuthOAuth2ClientRequestSchema, s as CreateWorkflowRequestSchema, st as UpdateTenantConfigRequestSchema, t as OperatorService, tt as UpdateAuthIDPConfigRequestSchema, u as WorkflowJobExecution_Status, ut as AuthHookPoint, v as TailorDBType_Permission_Permit, vt as AuthSCIMConfig_AuthorizationType, w as CreateSecretManagerSecretRequestSchema, wt as UpdateApplicationRequestSchema, x as CreateStaticWebsiteRequestSchema, xt as UserProfileProviderConfig_UserProfileProviderType, y as TailorDBType_PermitAction, z as CreateExecutorExecutorRequestSchema } from "./service_pb-DSNjrcbW.mjs";
2
+ import { t as db } from "./schema-C4fkpWV_.mjs";
3
+ import { $ as CreateUserProfileConfigRequestSchema, A as UpdatePipelineServiceRequestSchema, At as Condition_Operator, B as UpdateExecutorExecutorRequestSchema, Ct as UserProfileProviderConfig_UserProfileProviderType, D as CreatePipelineResolverRequestSchema, Dt as ApplicationSchemaUpdateAttemptStatus, E as UpdateSecretManagerSecretRequestSchema, Et as UpdateApplicationRequestSchema, F as IdPPermissionOperator, G as CreateAuthHookRequestSchema, H as ExecutorTargetType, I as IdPPermissionPermit, J as CreateAuthOAuth2ClientRequestSchema, K as CreateAuthIDPConfigRequestSchema, L as FunctionExecution_Status, M as CreateIdPServiceRequestSchema, Mt as PageDirection, N as UpdateIdPServiceRequestSchema, O as CreatePipelineServiceRequestSchema, Ot as Subgraph_ServiceType, P as IdPLang, Q as CreateTenantConfigRequestSchema, S as UpdateStaticWebsiteRequestSchema, St as TenantProviderConfig_TenantProviderType, T as CreateSecretManagerVaultRequestSchema, Tt as GetApplicationSchemaHealthResponse_ApplicationSchemaHealthStatus, U as ExecutorTriggerType, V as ExecutorJobStatus, W as CreateAuthConnectionRequestSchema, X as CreateAuthSCIMResourceRequestSchema, Y as CreateAuthSCIMConfigRequestSchema, Z as CreateAuthServiceRequestSchema, _ as TailorDBType_Permission_Operator, _t as AuthSCIMAttribute_Mutability, a as WorkspacePlatformUserRole, at as UpdateAuthSCIMConfigRequestSchema, b as AddCustomDomainRequestSchema, bt as AuthSCIMConfig_AuthorizationType, c as UpdateWorkflowRequestSchema, ct as UpdateTenantConfigRequestSchema, d as CreateTailorDBServiceRequestSchema, dt as AuthConnection_Type, et as UpdateAuthConnectionRequestSchema, f as CreateTailorDBTypeRequestSchema, ft as AuthHookPoint, g as TailorDBGQLPermission_Permit, gt as AuthOAuth2Client_GrantType, h as TailorDBGQLPermission_Operator, ht as AuthOAuth2Client_ClientType, it as UpdateAuthOAuth2ClientRequestSchema, j as PipelineResolver_OperationType, jt as FilterSchema, k as UpdatePipelineResolverRequestSchema, kt as ConditionSchema, l as WorkflowExecution_Status, lt as UpdateUserProfileConfigRequestSchema, m as TailorDBGQLPermission_Action, mt as AuthInvokerSchema, nt as UpdateAuthIDPConfigRequestSchema, o as CreateWorkflowJobFunctionRequestSchema, ot as UpdateAuthSCIMResourceRequestSchema, p as UpdateTailorDBTypeRequestSchema, pt as AuthIDPConfig_AuthType, q as CreateAuthMachineUserRequestSchema, rt as UpdateAuthMachineUserRequestSchema, s as CreateWorkflowRequestSchema, st as UpdateAuthServiceRequestSchema, t as OperatorService, tt as UpdateAuthHookRequestSchema, u as WorkflowJobExecution_Status, ut as AuthConnection_Status, v as TailorDBType_Permission_Permit, vt as AuthSCIMAttribute_Type, w as CreateSecretManagerSecretRequestSchema, wt as CreateApplicationRequestSchema, x as CreateStaticWebsiteRequestSchema, y as TailorDBType_PermitAction, yt as AuthSCIMAttribute_Uniqueness, z as CreateExecutorExecutorRequestSchema } from "./service_pb-BsBR6yW5.mjs";
4
4
  import { t as assertDefined } from "./assert-CKfwrmCV.mjs";
5
5
  import { a as parseBoolean, i as symbols, n as logger, r as styles, t as CIPromptError } from "./logger-DKF-JsAK.mjs";
6
- import { A as loadMachineUserName, F as writePlatformConfig, G as resolveStaticWebsiteUrls, K as byName, L as fetchAll, M as readPlatformConfig, O as loadAccessToken, R as fetchMachineUserToken, S as getDistDir, T as loadConfig, U as initOperatorClient, W as platformBaseUrl, b as hasGenerationHooks, d as assertUniqueLocalTailorDBTypeNames, f as assertUniqueTailorDBTypeNamesWithExternal, h as platformBundleDefinePlugin, j as loadWorkspaceId, k as loadConfigPath, l as buildExecutorArgsExpr, m as stringifyFunction, n as generatePluginFilesIfNeeded, p as TailorDBTypeSchema, r as loadApplication, s as HTTP_METHODS, t as defineApplication, u as buildResolverOperationHookExpr, w as hashFile, x as createBundleCache, y as getPluginGenerationDependencies, z as fetchPaged } from "./application-Cr-limKC.mjs";
6
+ import { $ as initOperatorClient, A as loadAccessToken, G as fetchMachineUserToken, I as loadWorkspaceId, K as fetchPaged, L as platformConfigFromProfile, N as loadMachineUserName, P as loadPlatformClientConfig, R as readPlatformConfig, S as getDistDir, T as loadConfig, V as writePlatformConfig, W as fetchAll, X as getOAuth2ClientId, Y as getConsoleBaseUrl, Z as getPlatformBaseUrl, b as hasGenerationHooks, d as assertUniqueLocalTailorDBTypeNames, et as isDefaultPlatform, f as assertUniqueTailorDBTypeNamesWithExternal, h as platformBundleDefinePlugin, j as loadConfigPath, k as hasUserTokenEntry, l as buildExecutorArgsExpr, m as stringifyFunction, n as generatePluginFilesIfNeeded, nt as byName, p as TailorDBTypeSchema, r as loadApplication, s as HTTP_METHODS, t as defineApplication, tt as resolveStaticWebsiteUrls, u as buildResolverOperationHookExpr, w as hashFile, x as createBundleCache, y as getPluginGenerationDependencies } from "./application-DmjIKQ-a.mjs";
7
7
  import { o as loadFilesWithIgnores, t as createExecutorService } from "./service-B2Jd9CxS.mjs";
8
8
  import { t as multiline } from "./multiline-Cf9ODpr1.mjs";
9
9
  import { t as readPackageJson } from "./package-json-DcQApfPQ.mjs";
@@ -310,6 +310,10 @@ async function assertWritable(opts) {
310
310
 
311
311
  //#endregion
312
312
  //#region src/cli/commands/api/api-call.ts
313
+ function hasEnvAccessToken() {
314
+ const envToken = process.env.TAILOR_PLATFORM_TOKEN ?? process.env.TAILOR_TOKEN;
315
+ return Boolean(envToken);
316
+ }
313
317
  /**
314
318
  * Call Tailor Platform API endpoints directly.
315
319
  * If the endpoint doesn't contain "/", it defaults to `tailor.v1.OperatorService/{endpoint}`.
@@ -318,10 +322,16 @@ async function assertWritable(opts) {
318
322
  */
319
323
  async function apiCall(options) {
320
324
  const accessToken = await loadAccessToken({ profile: options.profile });
325
+ let platformConfig;
326
+ try {
327
+ platformConfig = await loadPlatformClientConfig({ profile: options.profile });
328
+ } catch (error) {
329
+ if (!hasEnvAccessToken()) throw error;
330
+ }
321
331
  let endpointPath;
322
332
  if (options.endpoint.includes("/")) endpointPath = options.endpoint;
323
333
  else endpointPath = `tailor.v1.OperatorService/${options.endpoint}`;
324
- const url = new URL(endpointPath, platformBaseUrl);
334
+ const url = new URL(endpointPath, getPlatformBaseUrl(platformConfig));
325
335
  const response = await fetch(url.toString(), {
326
336
  method: "POST",
327
337
  headers: {
@@ -1594,7 +1604,7 @@ function copyMetadataToExtendedType(original, extended) {
1594
1604
  /**
1595
1605
  * Create a new ChangeSet for tracking resource changes.
1596
1606
  * @param title - Title for the change set
1597
- * @returns Empty ChangeSet instance with isEmpty() and print() methods
1607
+ * @returns Empty ChangeSet instance with isEmpty() and lines() methods
1598
1608
  */
1599
1609
  function createChangeSet(title) {
1600
1610
  const creates = [];
@@ -1611,17 +1621,16 @@ function createChangeSet(title) {
1611
1621
  replaces,
1612
1622
  unchanged,
1613
1623
  isEmpty,
1614
- print: () => {
1615
- if (isEmpty()) return;
1616
- logger.log(styles.bold(`${title}:`));
1617
- const printItem = (symbol, item) => {
1618
- logger.log(` ${symbol} ${item.name}`);
1619
- for (const detail of item.details ?? []) logger.log(` ${detail}`);
1620
- };
1621
- creates.forEach((item) => printItem(symbols.create, item));
1622
- deletes.forEach((item) => printItem(symbols.delete, item));
1623
- updates.forEach((item) => printItem(symbols.update, item));
1624
- replaces.forEach((item) => printItem(symbols.replace, item));
1624
+ lines: () => {
1625
+ if (isEmpty()) return [];
1626
+ const itemLines = (symbol) => (item) => [` ${symbol} ${item.name}`, ...(item.details ?? []).map((d) => ` ${d}`)];
1627
+ return [
1628
+ styles.bold(`${title}:`),
1629
+ ...creates.flatMap(itemLines(symbols.create)),
1630
+ ...deletes.flatMap(itemLines(symbols.delete)),
1631
+ ...updates.flatMap(itemLines(symbols.update)),
1632
+ ...replaces.flatMap(itemLines(symbols.replace))
1633
+ ];
1625
1634
  }
1626
1635
  };
1627
1636
  }
@@ -1635,15 +1644,13 @@ function summarizeChangeSets(changeSets) {
1635
1644
  create: 0,
1636
1645
  update: 0,
1637
1646
  delete: 0,
1638
- replace: 0,
1639
- unchanged: 0
1647
+ replace: 0
1640
1648
  };
1641
1649
  for (const changeSet of changeSets) {
1642
1650
  summary.create += changeSet.creates.length;
1643
1651
  summary.update += changeSet.updates.length;
1644
1652
  summary.delete += changeSet.deletes.length;
1645
1653
  summary.replace += changeSet.replaces.length;
1646
- summary.unchanged += changeSet.unchanged.length;
1647
1654
  }
1648
1655
  return summary;
1649
1656
  }
@@ -2353,21 +2360,28 @@ function buildConnectionRequest(workspaceId, name, config) {
2353
2360
  }
2354
2361
  };
2355
2362
  }
2356
- function hashConnectionConfig(config) {
2357
- return hashValue(JSON.stringify({
2358
- type: config.type,
2359
- providerUrl: config.providerUrl,
2360
- issuerUrl: config.issuerUrl,
2361
- clientId: config.clientId,
2362
- clientSecret: config.clientSecret,
2363
- authUrl: config.authUrl ?? "",
2364
- tokenUrl: config.tokenUrl ?? ""
2365
- }));
2366
- }
2367
- function hasNonSecretFieldChanged(existing, desired) {
2368
- if (existing.config.case !== "oauth2") return true;
2369
- const oauth2 = existing.config.value;
2370
- return oauth2.providerUrl !== desired.providerUrl || oauth2.issuerUrl !== desired.issuerUrl || oauth2.clientId !== desired.clientId || oauth2.authUrl !== (desired.authUrl ?? "") || oauth2.tokenUrl !== (desired.tokenUrl ?? "");
2363
+ function buildUpdateMask(existing, desired, secretChanged) {
2364
+ if (existing.config.case !== "oauth2") {
2365
+ const paths = [
2366
+ "type",
2367
+ "oauth2.provider_url",
2368
+ "oauth2.issuer_url",
2369
+ "oauth2.client_id",
2370
+ "oauth2.auth_url",
2371
+ "oauth2.token_url"
2372
+ ];
2373
+ if (desired.clientSecret) paths.push("oauth2.client_secret");
2374
+ return { paths };
2375
+ }
2376
+ const paths = [];
2377
+ const v = existing.config.value;
2378
+ if (v.providerUrl !== desired.providerUrl) paths.push("oauth2.provider_url");
2379
+ if (v.issuerUrl !== desired.issuerUrl) paths.push("oauth2.issuer_url");
2380
+ if (v.clientId !== desired.clientId) paths.push("oauth2.client_id");
2381
+ if (v.authUrl !== (desired.authUrl ?? "")) paths.push("oauth2.auth_url");
2382
+ if (v.tokenUrl !== (desired.tokenUrl ?? "")) paths.push("oauth2.token_url");
2383
+ if (secretChanged && desired.clientSecret) paths.push("oauth2.client_secret");
2384
+ return { paths };
2371
2385
  }
2372
2386
  /**
2373
2387
  * Plan auth connection changes based on current and desired state.
@@ -2425,15 +2439,14 @@ async function planAuthConnections(client, workspaceId, appName, appId, auths) {
2425
2439
  resourceType: "Auth connection",
2426
2440
  resourceName: name
2427
2441
  });
2428
- const currentHash = hashConnectionConfig(config);
2429
- const storedHash = state.connections?.[name];
2430
- if (hasNonSecretFieldChanged(existing.resource, config) || currentHash !== storedHash) changeSet.replaces.push({
2442
+ const secretChanged = hashValue(config.clientSecret) !== state.connections?.[name];
2443
+ const updateMask = buildUpdateMask(existing.resource, config, secretChanged);
2444
+ if (updateMask.paths.length > 0) changeSet.replaces.push({
2431
2445
  name,
2432
- deleteRequest: {
2433
- workspaceId,
2434
- connectionName: name
2446
+ updateRequest: {
2447
+ ...buildConnectionRequest(workspaceId, name, config),
2448
+ updateMask
2435
2449
  },
2436
- createRequest: buildConnectionRequest(workspaceId, name, config),
2437
2450
  metaRequest
2438
2451
  });
2439
2452
  else if (!existing.label) changeSet.updates.push({
@@ -2470,21 +2483,6 @@ async function planAuthConnections(client, workspaceId, appName, appId, auths) {
2470
2483
  resourceOwners
2471
2484
  };
2472
2485
  }
2473
- function extractOAuth2Config(connection) {
2474
- if (!connection) return void 0;
2475
- const config = connection.config;
2476
- if (!config || config.case !== "oauth2") return void 0;
2477
- const v = config.value;
2478
- return {
2479
- type: "oauth2",
2480
- providerUrl: v.providerUrl ?? "",
2481
- issuerUrl: v.issuerUrl ?? "",
2482
- clientId: v.clientId ?? "",
2483
- clientSecret: v.clientSecret ?? "",
2484
- authUrl: v.authUrl || void 0,
2485
- tokenUrl: v.tokenUrl || void 0
2486
- };
2487
- }
2488
2486
  /**
2489
2487
  * Apply auth connection changes for the given phase.
2490
2488
  * @param client - Operator client instance
@@ -2497,10 +2495,10 @@ async function applyAuthConnections(client, result, phase) {
2497
2495
  await Promise.all(changeSet.creates.map(async (create) => {
2498
2496
  await client.createAuthConnection(create.request);
2499
2497
  await client.setMetadata(create.metaRequest);
2498
+ logger.info(`Connection "${create.name}" was created. Authorize it with:\n tailor-sdk authconnection authorize --name ${create.name}\nOr via the Console: tailor-sdk authconnection open`);
2500
2499
  }));
2501
2500
  for (const replace of changeSet.replaces) {
2502
- await client.deleteAuthConnection(replace.deleteRequest);
2503
- await client.createAuthConnection(replace.createRequest);
2501
+ if ((await client.updateAuthConnection(replace.updateRequest)).connection?.status === AuthConnection_Status.UNAUTHORIZED) logger.warn(`Connection "${replace.name}" requires re-authorization. Authorize with:\n tailor-sdk authconnection authorize --name ${replace.name}\nOr via the Console: tailor-sdk authconnection open`);
2504
2502
  await client.setMetadata(replace.metaRequest);
2505
2503
  }
2506
2504
  await Promise.all(changeSet.updates.map(async (update) => {
@@ -2509,12 +2507,12 @@ async function applyAuthConnections(client, result, phase) {
2509
2507
  const state = loadSecretsState();
2510
2508
  if (!state.connections) state.connections = {};
2511
2509
  for (const create of changeSet.creates) {
2512
- const oauth2 = extractOAuth2Config(create.request.connection);
2513
- if (oauth2) state.connections[create.name] = hashConnectionConfig(oauth2);
2510
+ const conn = create.request.connection;
2511
+ if (conn?.config?.case === "oauth2") state.connections[create.name] = hashValue(conn.config.value.clientSecret ?? "");
2514
2512
  }
2515
2513
  for (const replace of changeSet.replaces) {
2516
- const oauth2 = extractOAuth2Config(replace.createRequest.connection);
2517
- if (oauth2) state.connections[replace.name] = hashConnectionConfig(oauth2);
2514
+ const conn = replace.updateRequest.connection;
2515
+ if (conn?.config?.case === "oauth2" && replace.updateRequest.updateMask?.paths?.includes("oauth2.client_secret")) state.connections[replace.name] = hashValue(conn.config.value.clientSecret ?? "");
2518
2516
  }
2519
2517
  saveSecretsState(state);
2520
2518
  } else {
@@ -3047,18 +3045,19 @@ function extractServiceActions(changeSet) {
3047
3045
  ];
3048
3046
  }
3049
3047
  /**
3050
- * Print a titled section of grouped display entries, nesting by namespace.
3048
+ * Build display lines for a titled section of grouped entries, nesting by namespace.
3051
3049
  * Service-level changes are shown as the namespace header symbol.
3052
3050
  * Services without child entries are shown as flat entries.
3053
3051
  * @param title - Section title
3054
- * @param entries - Entries to print (should NOT include service entries)
3052
+ * @param entries - Entries to render (should NOT include service entries)
3055
3053
  * @param serviceActions - Optional service-level actions to merge into namespace headers
3054
+ * @returns Lines ready for output; empty array when there is nothing to show
3056
3055
  */
3057
- function printGroupedDisplaySection(title, entries, serviceActions) {
3056
+ function buildGroupedDisplayLines(title, entries, serviceActions) {
3058
3057
  const serviceMap = /* @__PURE__ */ new Map();
3059
3058
  if (serviceActions) for (const sa of serviceActions) serviceMap.set(sa.name, sa.action);
3060
- if (entries.length === 0 && serviceMap.size === 0) return;
3061
- logger.log(styles.bold(`${title}:`));
3059
+ if (entries.length === 0 && serviceMap.size === 0) return [];
3060
+ const out = [styles.bold(`${title}:`)];
3062
3061
  const namespaceOrder = [];
3063
3062
  const byNamespace = /* @__PURE__ */ new Map();
3064
3063
  for (const entry of entries) {
@@ -3075,12 +3074,13 @@ function printGroupedDisplaySection(title, entries, serviceActions) {
3075
3074
  if (ns) {
3076
3075
  const svcAction = serviceMap.get(ns);
3077
3076
  const prefix = svcAction ? `${ACTION_SYMBOLS[svcAction]} ` : "";
3078
- logger.log(` ${prefix}${styles.bold(`${ns}:`)}`);
3077
+ out.push(` ${prefix}${styles.bold(`${ns}:`)}`);
3079
3078
  printedServices.add(ns);
3080
- for (const entry of group) logger.log(` ${formatGroupedDisplayLine(entry)}`);
3081
- } else for (const entry of group) logger.log(` ${formatGroupedDisplayLine(entry)}`);
3079
+ for (const entry of group) out.push(` ${formatGroupedDisplayLine(entry)}`);
3080
+ } else for (const entry of group) out.push(` ${formatGroupedDisplayLine(entry)}`);
3082
3081
  }
3083
- for (const [name, action] of serviceMap) if (!printedServices.has(name)) logger.log(` ${ACTION_SYMBOLS[action]} ${name}`);
3082
+ for (const [name, action] of serviceMap) if (!printedServices.has(name)) out.push(` ${ACTION_SYMBOLS[action]} ${name}`);
3083
+ return out;
3084
3084
  }
3085
3085
 
3086
3086
  //#endregion
@@ -6554,6 +6554,23 @@ function parseMigrationNumberArg(numberStr) {
6554
6554
  * All object schemas use `z.looseObject` so that unknown keys written
6555
6555
  * by newer CLI versions survive a load → save round-trip.
6556
6556
  */
6557
+ function snapshotRecordSchema(valueSchema) {
6558
+ return z.custom((value) => typeof value === "object" && value !== null && !Array.isArray(value), { message: "Expected record" }).transform((value, ctx) => {
6559
+ const record = Object.create(null);
6560
+ for (const key of Object.keys(value)) {
6561
+ const result = valueSchema.safeParse(value[key]);
6562
+ if (!result.success) {
6563
+ for (const issue of result.error.issues) ctx.addIssue({
6564
+ ...issue,
6565
+ path: [key, ...issue.path]
6566
+ });
6567
+ continue;
6568
+ }
6569
+ record[key] = result.data;
6570
+ }
6571
+ return record;
6572
+ });
6573
+ }
6557
6574
  const snapshotHookSchema = z.looseObject({ expr: z.string() });
6558
6575
  const snapshotValidationSchema = z.looseObject({
6559
6576
  script: z.looseObject({ expr: z.string() }).optional(),
@@ -6587,7 +6604,7 @@ const snapshotFieldConfigSchema = z.looseObject({
6587
6604
  validate: z.array(snapshotValidationSchema).optional(),
6588
6605
  serial: snapshotSerialSchema.optional(),
6589
6606
  scale: z.number().optional(),
6590
- fields: z.lazy(() => z.record(z.string(), snapshotFieldConfigSchema)).optional()
6607
+ fields: z.lazy(() => snapshotRecordSchema(snapshotFieldConfigSchema)).optional()
6591
6608
  });
6592
6609
  const snapshotIndexConfigSchema = z.looseObject({
6593
6610
  fields: z.array(z.string()),
@@ -6658,7 +6675,7 @@ const tailorDBSnapshotTypeSchema = z.looseObject({
6658
6675
  name: z.string(),
6659
6676
  pluralForm: z.string().optional(),
6660
6677
  description: z.string().optional(),
6661
- fields: z.record(z.string(), snapshotFieldConfigSchema),
6678
+ fields: snapshotRecordSchema(snapshotFieldConfigSchema),
6662
6679
  settings: z.looseObject({
6663
6680
  aggregation: z.boolean().optional(),
6664
6681
  bulkUpsert: z.boolean().optional(),
@@ -6670,10 +6687,10 @@ const tailorDBSnapshotTypeSchema = z.looseObject({
6670
6687
  }).optional(),
6671
6688
  publishEvents: z.boolean().optional()
6672
6689
  }).optional(),
6673
- indexes: z.record(z.string(), snapshotIndexConfigSchema).optional(),
6674
- files: z.record(z.string(), z.string()).optional(),
6675
- forwardRelationships: z.record(z.string(), snapshotRelationshipSchema).optional(),
6676
- backwardRelationships: z.record(z.string(), snapshotRelationshipSchema).optional(),
6690
+ indexes: snapshotRecordSchema(snapshotIndexConfigSchema).optional(),
6691
+ files: snapshotRecordSchema(z.string()).optional(),
6692
+ forwardRelationships: snapshotRecordSchema(snapshotRelationshipSchema).optional(),
6693
+ backwardRelationships: snapshotRecordSchema(snapshotRelationshipSchema).optional(),
6677
6694
  permissions: z.looseObject({
6678
6695
  record: snapshotRecordPermissionSchema.optional(),
6679
6696
  gql: snapshotGqlPermissionSchema.optional()
@@ -6683,11 +6700,11 @@ const schemaSnapshotSchema = z.looseObject({
6683
6700
  version: z.number(),
6684
6701
  namespace: z.string(),
6685
6702
  createdAt: z.string(),
6686
- types: z.record(z.string(), tailorDBSnapshotTypeSchema)
6703
+ types: snapshotRecordSchema(tailorDBSnapshotTypeSchema)
6687
6704
  });
6688
6705
  const typeSettingsPatchSchema = z.looseObject({
6689
- indexes: z.record(z.string(), snapshotIndexConfigSchema).optional(),
6690
- files: z.record(z.string(), z.string()).optional()
6706
+ indexes: snapshotRecordSchema(snapshotIndexConfigSchema).optional(),
6707
+ files: snapshotRecordSchema(z.string()).optional()
6691
6708
  });
6692
6709
  const snapshotPermissionStateSchema = z.looseObject({
6693
6710
  recordPermission: snapshotRecordPermissionSchema.optional(),
@@ -6893,16 +6910,26 @@ const MIGRATION_NUMBER_PATTERN = /^\d{4}$/;
6893
6910
  * Must stay in sync with the platform's default decimal scale.
6894
6911
  */
6895
6912
  const DEFAULT_DECIMAL_SCALE = 6;
6913
+ function createSnapshotRecord() {
6914
+ return Object.create(null);
6915
+ }
6916
+ function copySnapshotRecord(record) {
6917
+ const copy = createSnapshotRecord();
6918
+ for (const [key, value] of Object.entries(record ?? {})) copy[key] = value;
6919
+ return copy;
6920
+ }
6896
6921
  /**
6897
6922
  * Normalize a snapshot field in place so the snapshot becomes the canonical
6898
6923
  * form for comparison. Currently fills in the platform default decimal scale
6899
6924
  * when omitted, which avoids false drift between local schemas (where scale
6900
6925
  * may be omitted) and the platform (which always materializes a scale).
6901
6926
  * @param {SnapshotFieldConfig} field - Field configuration to normalize
6927
+ * @returns The same field object after normalization
6902
6928
  */
6903
6929
  function normalizeSnapshotField(field) {
6904
6930
  if (field.type === "decimal" && field.scale === void 0) field.scale = 6;
6905
6931
  if (field.fields) for (const nested of Object.values(field.fields)) normalizeSnapshotField(nested);
6932
+ return field;
6906
6933
  }
6907
6934
  /**
6908
6935
  * Normalize a snapshot type in place to the canonical comparison shape.
@@ -6913,10 +6940,21 @@ function normalizeSnapshotField(field) {
6913
6940
  *
6914
6941
  * Idempotent — safe to call multiple times on the same input.
6915
6942
  * @param {TailorDBSnapshotType} type - Snapshot type to normalize
6943
+ * @returns The same snapshot type object after normalization
6916
6944
  */
6917
6945
  function normalizeSnapshotType(type) {
6918
6946
  if (!type.pluralForm) type.pluralForm = inflection.pluralize(type.name);
6919
6947
  for (const field of Object.values(type.fields)) normalizeSnapshotField(field);
6948
+ return type;
6949
+ }
6950
+ /**
6951
+ * Normalize a schema snapshot in place to the canonical comparison shape.
6952
+ * @param {SchemaSnapshot} snapshot - Schema snapshot to normalize
6953
+ * @returns The same schema snapshot object branded as normalized
6954
+ */
6955
+ function normalizeSchemaSnapshot(snapshot) {
6956
+ for (const type of Object.values(snapshot.types)) normalizeSnapshotType(type);
6957
+ return snapshot;
6920
6958
  }
6921
6959
  /**
6922
6960
  * Validate that a migration number follows the expected format (4-digit number)
@@ -7054,7 +7092,7 @@ function createSnapshotFieldConfigFromOperatorConfig(fieldConfig) {
7054
7092
  * @returns {TailorDBSnapshotType} Snapshot type configuration
7055
7093
  */
7056
7094
  function createSnapshotType(type) {
7057
- const fields = {};
7095
+ const fields = createSnapshotRecord();
7058
7096
  for (const [fieldName, field] of Object.entries(type.fields)) fields[fieldName] = createSnapshotFieldConfig(field);
7059
7097
  const snapshotType = {
7060
7098
  name: type.name,
@@ -7118,7 +7156,7 @@ function createSnapshotType(type) {
7118
7156
  ...policy.description && { description: policy.description }
7119
7157
  }));
7120
7158
  }
7121
- return snapshotType;
7159
+ return normalizeSnapshotType(snapshotType);
7122
7160
  }
7123
7161
  /**
7124
7162
  * Convert an action permission to snapshot format
@@ -7136,22 +7174,22 @@ function convertActionPermission(permission) {
7136
7174
  * Create a schema snapshot from local type definitions
7137
7175
  * @param {Record<string, TailorDBType>} types - Local type definitions
7138
7176
  * @param {string} namespace - Namespace for the snapshot
7139
- * @returns {SchemaSnapshot} Schema snapshot
7177
+ * @returns {NormalizedSchemaSnapshot} Normalized schema snapshot
7140
7178
  */
7141
7179
  function createSnapshotFromLocalTypes(types, namespace) {
7142
- const snapshotTypes = {};
7180
+ const snapshotTypes = createSnapshotRecord();
7143
7181
  for (const [typeName, type] of Object.entries(types)) snapshotTypes[typeName] = createSnapshotType(type);
7144
- return {
7182
+ return normalizeSchemaSnapshot({
7145
7183
  version: 1,
7146
7184
  namespace,
7147
7185
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
7148
7186
  types: snapshotTypes
7149
- };
7187
+ });
7150
7188
  }
7151
7189
  /**
7152
7190
  * Load a schema snapshot from a file
7153
7191
  * @param {string} filePath - Path to the snapshot file
7154
- * @returns {SchemaSnapshot} Loaded schema snapshot
7192
+ * @returns {NormalizedSchemaSnapshot} Loaded normalized schema snapshot
7155
7193
  */
7156
7194
  function loadSnapshot(filePath) {
7157
7195
  const content = fs$1.readFileSync(filePath, "utf-8");
@@ -7164,8 +7202,7 @@ function loadSnapshot(filePath) {
7164
7202
  const result = schemaSnapshotSchema.safeParse(raw);
7165
7203
  if (!result.success) throw new Error(`Invalid schema snapshot at ${filePath}: ${z.prettifyError(result.error)}`, { cause: result.error });
7166
7204
  const snapshot = result.data;
7167
- for (const type of Object.values(snapshot.types)) normalizeSnapshotType(type);
7168
- return snapshot;
7205
+ return normalizeSchemaSnapshot(snapshot);
7169
7206
  }
7170
7207
  /**
7171
7208
  * Load a migration diff from a file
@@ -7234,10 +7271,10 @@ function getNextMigrationNumber(migrationsDir) {
7234
7271
  * Apply a diff to a snapshot to get the resulting snapshot
7235
7272
  * @param {SchemaSnapshot} snapshot - Base snapshot to apply diff to
7236
7273
  * @param {MigrationDiff} diff - Diff to apply
7237
- * @returns {SchemaSnapshot} Resulting snapshot after applying diff
7274
+ * @returns {NormalizedSchemaSnapshot} Normalized snapshot after applying diff
7238
7275
  */
7239
7276
  function applyDiffToSnapshot(snapshot, diff) {
7240
- const types = { ...snapshot.types };
7277
+ const types = copySnapshotRecord(snapshot.types);
7241
7278
  for (const change of diff.changes) switch (change.kind) {
7242
7279
  case "type_added":
7243
7280
  types[change.typeName] = change.after;
@@ -7260,19 +7297,21 @@ function applyDiffToSnapshot(snapshot, diff) {
7260
7297
  case "field_added":
7261
7298
  case "field_modified": {
7262
7299
  const existing = types[change.typeName];
7263
- if (existing) types[change.typeName] = {
7264
- ...existing,
7265
- fields: {
7266
- ...existing.fields,
7267
- [change.fieldName]: change.after
7268
- }
7269
- };
7300
+ if (existing) {
7301
+ const fields = copySnapshotRecord(existing.fields);
7302
+ fields[change.fieldName] = change.after;
7303
+ types[change.typeName] = {
7304
+ ...existing,
7305
+ fields
7306
+ };
7307
+ }
7270
7308
  break;
7271
7309
  }
7272
7310
  case "field_removed": {
7273
7311
  const existing = types[change.typeName];
7274
7312
  if (existing) {
7275
- const { [change.fieldName]: _, ...remainingFields } = existing.fields;
7313
+ const remainingFields = copySnapshotRecord(existing.fields);
7314
+ delete remainingFields[change.fieldName];
7276
7315
  types[change.typeName] = {
7277
7316
  ...existing,
7278
7317
  fields: remainingFields
@@ -7283,19 +7322,21 @@ function applyDiffToSnapshot(snapshot, diff) {
7283
7322
  case "index_added":
7284
7323
  case "index_modified": {
7285
7324
  const existing = types[change.typeName];
7286
- if (existing) types[change.typeName] = {
7287
- ...existing,
7288
- indexes: {
7289
- ...existing.indexes,
7290
- [change.indexName]: change.after
7291
- }
7292
- };
7325
+ if (existing) {
7326
+ const indexes = copySnapshotRecord(existing.indexes);
7327
+ indexes[change.indexName] = change.after;
7328
+ types[change.typeName] = {
7329
+ ...existing,
7330
+ indexes
7331
+ };
7332
+ }
7293
7333
  break;
7294
7334
  }
7295
7335
  case "index_removed": {
7296
7336
  const existing = types[change.typeName];
7297
7337
  if (existing && existing.indexes) {
7298
- const { [change.indexName]: _, ...remainingIndexes } = existing.indexes;
7338
+ const remainingIndexes = copySnapshotRecord(existing.indexes);
7339
+ delete remainingIndexes[change.indexName];
7299
7340
  types[change.typeName] = {
7300
7341
  ...existing,
7301
7342
  indexes: Object.keys(remainingIndexes).length > 0 ? remainingIndexes : void 0
@@ -7306,19 +7347,21 @@ function applyDiffToSnapshot(snapshot, diff) {
7306
7347
  case "file_added":
7307
7348
  case "file_modified": {
7308
7349
  const existing = types[change.typeName];
7309
- if (existing) types[change.typeName] = {
7310
- ...existing,
7311
- files: {
7312
- ...existing.files,
7313
- [change.fieldName]: change.after
7314
- }
7315
- };
7350
+ if (existing) {
7351
+ const files = copySnapshotRecord(existing.files);
7352
+ files[change.fieldName] = change.after;
7353
+ types[change.typeName] = {
7354
+ ...existing,
7355
+ files
7356
+ };
7357
+ }
7316
7358
  break;
7317
7359
  }
7318
7360
  case "file_removed": {
7319
7361
  const existing = types[change.typeName];
7320
7362
  if (existing && existing.files) {
7321
- const { [change.fieldName]: _, ...remainingFiles } = existing.files;
7363
+ const remainingFiles = copySnapshotRecord(existing.files);
7364
+ delete remainingFiles[change.fieldName];
7322
7365
  types[change.typeName] = {
7323
7366
  ...existing,
7324
7367
  files: Object.keys(remainingFiles).length > 0 ? remainingFiles : void 0
@@ -7331,20 +7374,21 @@ function applyDiffToSnapshot(snapshot, diff) {
7331
7374
  const existing = types[change.typeName];
7332
7375
  if (existing) {
7333
7376
  const rel = change.after;
7334
- if ((change.relationshipType ?? (existing.forwardRelationships?.[change.relationshipName] ? "forward" : existing.backwardRelationships?.[change.relationshipName] ? "backward" : "forward")) === "forward") types[change.typeName] = {
7335
- ...existing,
7336
- forwardRelationships: {
7337
- ...existing.forwardRelationships,
7338
- [change.relationshipName]: rel
7339
- }
7340
- };
7341
- else types[change.typeName] = {
7342
- ...existing,
7343
- backwardRelationships: {
7344
- ...existing.backwardRelationships,
7345
- [change.relationshipName]: rel
7346
- }
7347
- };
7377
+ if ((change.relationshipType ?? (existing.forwardRelationships?.[change.relationshipName] ? "forward" : existing.backwardRelationships?.[change.relationshipName] ? "backward" : "forward")) === "forward") {
7378
+ const forwardRelationships = copySnapshotRecord(existing.forwardRelationships);
7379
+ forwardRelationships[change.relationshipName] = rel;
7380
+ types[change.typeName] = {
7381
+ ...existing,
7382
+ forwardRelationships
7383
+ };
7384
+ } else {
7385
+ const backwardRelationships = copySnapshotRecord(existing.backwardRelationships);
7386
+ backwardRelationships[change.relationshipName] = rel;
7387
+ types[change.typeName] = {
7388
+ ...existing,
7389
+ backwardRelationships
7390
+ };
7391
+ }
7348
7392
  }
7349
7393
  break;
7350
7394
  }
@@ -7353,13 +7397,15 @@ function applyDiffToSnapshot(snapshot, diff) {
7353
7397
  if (type) {
7354
7398
  const targetType = change.relationshipType ?? (type.forwardRelationships?.[change.relationshipName] ? "forward" : type.backwardRelationships?.[change.relationshipName] ? "backward" : null);
7355
7399
  if (targetType === "forward" && type.forwardRelationships?.[change.relationshipName]) {
7356
- const { [change.relationshipName]: _, ...remaining } = type.forwardRelationships;
7400
+ const remaining = copySnapshotRecord(type.forwardRelationships);
7401
+ delete remaining[change.relationshipName];
7357
7402
  types[change.typeName] = {
7358
7403
  ...type,
7359
7404
  forwardRelationships: Object.keys(remaining).length > 0 ? remaining : void 0
7360
7405
  };
7361
7406
  } else if (targetType === "backward" && type.backwardRelationships?.[change.relationshipName]) {
7362
- const { [change.relationshipName]: _, ...remaining } = type.backwardRelationships;
7407
+ const remaining = copySnapshotRecord(type.backwardRelationships);
7408
+ delete remaining[change.relationshipName];
7363
7409
  types[change.typeName] = {
7364
7410
  ...type,
7365
7411
  backwardRelationships: Object.keys(remaining).length > 0 ? remaining : void 0
@@ -7383,18 +7429,18 @@ function applyDiffToSnapshot(snapshot, diff) {
7383
7429
  break;
7384
7430
  }
7385
7431
  }
7386
- return {
7432
+ return normalizeSchemaSnapshot({
7387
7433
  ...snapshot,
7388
7434
  types,
7389
7435
  createdAt: diff.createdAt
7390
- };
7436
+ });
7391
7437
  }
7392
7438
  /**
7393
7439
  * Reconstruct the latest schema snapshot from all migration files
7394
7440
  * Returns null if no migrations exist
7395
7441
  * @param {string} migrationsDir - Migrations directory path
7396
7442
  * @param {number} [maxVersion] - Optional maximum migration version to apply
7397
- * @returns {SchemaSnapshot | null} Reconstructed snapshot or null if no migrations exist
7443
+ * @returns {NormalizedSchemaSnapshot | null} Reconstructed normalized snapshot or null if no migrations exist
7398
7444
  */
7399
7445
  function reconstructSnapshotFromMigrations(migrationsDir, maxVersion) {
7400
7446
  const files = getMigrationFiles(migrationsDir);
@@ -7757,8 +7803,9 @@ function comparePermissions(ctx, typeName, oldRecordPerm, newRecordPerm, oldGqlP
7757
7803
  * @returns {MigrationDiff} Migration diff between snapshots
7758
7804
  */
7759
7805
  function compareSnapshots(previous, current) {
7760
- for (const type of Object.values(previous.types)) normalizeSnapshotType(type);
7761
- for (const type of Object.values(current.types)) normalizeSnapshotType(type);
7806
+ return compareNormalizedSnapshots(normalizeSchemaSnapshot(previous), normalizeSchemaSnapshot(current));
7807
+ }
7808
+ function compareNormalizedSnapshots(previous, current) {
7762
7809
  const ctx = {
7763
7810
  changes: [],
7764
7811
  breakingChanges: [],
@@ -7893,7 +7940,7 @@ function assertValidMigrationFiles(migrationsDir, namespace) {
7893
7940
  * @returns {Record<string, SnapshotFieldConfig>} Converted field configs
7894
7941
  */
7895
7942
  function convertRemoteFieldsToSnapshot(remoteType) {
7896
- const fields = {};
7943
+ const fields = createSnapshotRecord();
7897
7944
  const remoteFields = remoteType.schema?.fields ?? {};
7898
7945
  for (const [fieldName, remoteField] of Object.entries(remoteFields)) {
7899
7946
  const config = {
@@ -7929,11 +7976,35 @@ function convertRemoteFieldsToSnapshot(remoteType) {
7929
7976
  ...remoteField.serial.format && { format: remoteField.serial.format }
7930
7977
  };
7931
7978
  if (remoteField.scale !== void 0) config.scale = remoteField.scale;
7932
- normalizeSnapshotField(config);
7933
7979
  fields[fieldName] = config;
7934
7980
  }
7935
7981
  return fields;
7936
7982
  }
7983
+ function convertRemoteTypeToSnapshot(remoteType) {
7984
+ const snapshotType = {
7985
+ name: remoteType.name,
7986
+ pluralForm: remoteType.schema?.settings?.pluralForm || inflection.pluralize(remoteType.name),
7987
+ fields: convertRemoteFieldsToSnapshot(remoteType)
7988
+ };
7989
+ if (remoteType.schema?.description) snapshotType.description = remoteType.schema.description;
7990
+ return snapshotType;
7991
+ }
7992
+ /**
7993
+ * Convert remote TailorDB types into the normalized snapshot shape used by drift checks.
7994
+ * @param {ProtoTailorDBType[]} remoteTypes - Remote TailorDB types from the API
7995
+ * @param {string} namespace - Namespace for the reconstructed snapshot
7996
+ * @returns {NormalizedSchemaSnapshot} Normalized snapshot-shaped remote state
7997
+ */
7998
+ function createSnapshotFromRemoteTypes(remoteTypes, namespace) {
7999
+ const types = createSnapshotRecord();
8000
+ for (const remoteType of remoteTypes) types[remoteType.name] = convertRemoteTypeToSnapshot(remoteType);
8001
+ return normalizeSchemaSnapshot({
8002
+ version: 1,
8003
+ namespace,
8004
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
8005
+ types
8006
+ });
8007
+ }
7937
8008
  /**
7938
8009
  * Compare a single field between remote and snapshot
7939
8010
  * @param {string} typeName - Name of the type
@@ -7994,12 +8065,13 @@ const SYSTEM_FIELDS = /* @__PURE__ */ new Set(["id"]);
7994
8065
  * @returns {SchemaDrift[]} List of drifts detected
7995
8066
  */
7996
8067
  function compareRemoteWithSnapshot(remoteTypes, snapshot) {
7997
- for (const type of Object.values(snapshot.types)) normalizeSnapshotType(type);
8068
+ return compareNormalizedRemoteWithSnapshot(createSnapshotFromRemoteTypes(remoteTypes, snapshot.namespace), normalizeSchemaSnapshot(snapshot));
8069
+ }
8070
+ function compareNormalizedRemoteWithSnapshot(remoteSnapshot, snapshot) {
7998
8071
  const drifts = [];
7999
- const remoteTypeMap = /* @__PURE__ */ new Map();
8000
- for (const remoteType of remoteTypes) remoteTypeMap.set(remoteType.name, remoteType);
8072
+ const remoteTypeMap = new Map(Object.entries(remoteSnapshot.types));
8001
8073
  const snapshotTypeNames = new Set(Object.keys(snapshot.types));
8002
- const remoteTypeNames = new Set(remoteTypeMap.keys());
8074
+ const remoteTypeNames = new Set(Object.keys(remoteSnapshot.types));
8003
8075
  for (const typeName of snapshotTypeNames) if (!remoteTypeNames.has(typeName)) drifts.push({
8004
8076
  typeName,
8005
8077
  kind: "type_missing_remote",
@@ -8014,7 +8086,7 @@ function compareRemoteWithSnapshot(remoteTypes, snapshot) {
8014
8086
  if (!remoteTypeNames.has(typeName)) continue;
8015
8087
  const remoteType = assertDefined(remoteTypeMap.get(typeName), `type "${typeName}" missing from remoteTypeMap`);
8016
8088
  const snapshotType = assertDefined(snapshot.types[typeName], `type "${typeName}" missing from snapshot`);
8017
- const remoteFields = convertRemoteFieldsToSnapshot(remoteType);
8089
+ const remoteFields = remoteType.fields;
8018
8090
  const snapshotFields = snapshotType.fields;
8019
8091
  const remoteFieldNames = new Set(Object.keys(remoteFields).filter((f) => !SYSTEM_FIELDS.has(f)));
8020
8092
  const snapshotFieldNames = new Set(Object.keys(snapshotFields).filter((f) => !SYSTEM_FIELDS.has(f)));
@@ -9370,7 +9442,8 @@ async function applyTailorDB(client, result, phase = "create-update") {
9370
9442
  await client.setMetadata(create.metaRequest);
9371
9443
  }), ...changeSet.service.updates.map((update) => client.setMetadata(update.metaRequest))]);
9372
9444
  try {
9373
- await Promise.all([...changeSet.type.creates.map((create) => client.createTailorDBType(create.request)), ...changeSet.type.updates.map((update) => client.updateTailorDBType(update.request))]);
9445
+ for (const create of changeSet.type.creates) await client.createTailorDBType(create.request);
9446
+ for (const update of changeSet.type.updates) await client.updateTailorDBType(update.request);
9374
9447
  } catch (error) {
9375
9448
  handleOptionalToRequiredError(error, ["Run 'tailor-sdk tailordb migration generate' to create migration files.", "Migration scripts allow you to handle existing data before applying the schema change."]);
9376
9449
  }
@@ -9495,53 +9568,45 @@ async function executeSingleMigrationPrePhase(client, changeSet, migration, tail
9495
9568
  const preMigrationChanges = buildPreMigrationChangesMap([migration]);
9496
9569
  const affectedTypes = getAffectedTypeNames(migration);
9497
9570
  const createdBeforeMigration = new Set(processedTypes.created);
9498
- await awaitAllSettledOrThrow([
9499
- ...changeSet.type.creates.filter((create) => {
9500
- const typeName = create.request.tailordbType?.name;
9501
- return typeName && affectedTypes.has(typeName) && !createdBeforeMigration.has(typeName);
9502
- }).map((create) => {
9503
- const typeName = create.request.tailordbType?.name;
9504
- const snapshotType = typeName ? buildSnapshotTypeManifest(migration, typeName, tailorDBInputs, executorUsedTypes) : void 0;
9505
- if (!snapshotType) return void 0;
9506
- if (typeName) processedTypes.created.add(typeName);
9507
- const clonedRequest = structuredClone(create.request);
9508
- clonedRequest.tailordbType = snapshotType;
9509
- const typeChanges = typeName ? preMigrationChanges.get(typeName) : void 0;
9510
- if (typeChanges && typeChanges.size > 0 && clonedRequest.tailordbType.schema?.fields) applyPreMigrationFieldAdjustments(clonedRequest.tailordbType.schema.fields, typeChanges);
9511
- return client.createTailorDBType(clonedRequest);
9512
- }),
9513
- ...changeSet.type.creates.filter((create) => {
9514
- const typeName = create.request.tailordbType?.name;
9515
- return typeName && affectedTypes.has(typeName) && createdBeforeMigration.has(typeName);
9516
- }).map((create) => {
9517
- const typeName = create.request.tailordbType?.name;
9518
- const snapshotType = typeName ? buildSnapshotTypeManifest(migration, typeName, tailorDBInputs, executorUsedTypes) : void 0;
9519
- if (!snapshotType) return void 0;
9520
- if (typeName) processedTypes.updated.add(typeName);
9521
- const clonedTypeRequest = structuredClone(snapshotType);
9522
- const typeChanges = typeName ? preMigrationChanges.get(typeName) : void 0;
9523
- if (typeChanges && typeChanges.size > 0 && clonedTypeRequest.schema?.fields) applyPreMigrationFieldAdjustments(clonedTypeRequest.schema.fields, typeChanges);
9524
- return client.updateTailorDBType({
9525
- workspaceId: create.request.workspaceId,
9526
- namespaceName: create.request.namespaceName,
9527
- tailordbType: clonedTypeRequest
9528
- });
9529
- }),
9530
- ...changeSet.type.updates.filter((update) => {
9531
- const typeName = update.request.tailordbType?.name;
9532
- return typeName && affectedTypes.has(typeName);
9533
- }).map((update) => {
9534
- const typeName = update.request.tailordbType?.name;
9535
- const snapshotType = typeName ? buildSnapshotTypeManifest(migration, typeName, tailorDBInputs, executorUsedTypes) : void 0;
9536
- if (!snapshotType) return void 0;
9537
- if (typeName) processedTypes.updated.add(typeName);
9538
- const clonedRequest = structuredClone(update.request);
9539
- clonedRequest.tailordbType = snapshotType;
9540
- const typeChanges = typeName ? preMigrationChanges.get(typeName) : void 0;
9541
- if (typeChanges && typeChanges.size > 0 && clonedRequest.tailordbType.schema?.fields) applyPreMigrationFieldAdjustments(clonedRequest.tailordbType.schema.fields, typeChanges);
9542
- return client.updateTailorDBType(clonedRequest);
9543
- })
9544
- ]);
9571
+ for (const create of changeSet.type.creates) {
9572
+ const typeName = create.request.tailordbType?.name;
9573
+ if (!typeName || !affectedTypes.has(typeName) || createdBeforeMigration.has(typeName)) continue;
9574
+ const snapshotType = buildSnapshotTypeManifest(migration, typeName, tailorDBInputs, executorUsedTypes);
9575
+ if (!snapshotType) continue;
9576
+ const clonedRequest = structuredClone(create.request);
9577
+ clonedRequest.tailordbType = snapshotType;
9578
+ const typeChanges = preMigrationChanges.get(typeName);
9579
+ if (typeChanges && typeChanges.size > 0 && clonedRequest.tailordbType.schema?.fields) applyPreMigrationFieldAdjustments(clonedRequest.tailordbType.schema.fields, typeChanges);
9580
+ processedTypes.created.add(typeName);
9581
+ await client.createTailorDBType(clonedRequest);
9582
+ }
9583
+ for (const create of changeSet.type.creates) {
9584
+ const typeName = create.request.tailordbType?.name;
9585
+ if (!typeName || !affectedTypes.has(typeName) || !createdBeforeMigration.has(typeName)) continue;
9586
+ const snapshotType = buildSnapshotTypeManifest(migration, typeName, tailorDBInputs, executorUsedTypes);
9587
+ if (!snapshotType) continue;
9588
+ const clonedTypeRequest = structuredClone(snapshotType);
9589
+ const typeChanges = preMigrationChanges.get(typeName);
9590
+ if (typeChanges && typeChanges.size > 0 && clonedTypeRequest.schema?.fields) applyPreMigrationFieldAdjustments(clonedTypeRequest.schema.fields, typeChanges);
9591
+ processedTypes.updated.add(typeName);
9592
+ await client.updateTailorDBType({
9593
+ workspaceId: create.request.workspaceId,
9594
+ namespaceName: create.request.namespaceName,
9595
+ tailordbType: clonedTypeRequest
9596
+ });
9597
+ }
9598
+ for (const update of changeSet.type.updates) {
9599
+ const typeName = update.request.tailordbType?.name;
9600
+ if (!typeName || !affectedTypes.has(typeName)) continue;
9601
+ const snapshotType = buildSnapshotTypeManifest(migration, typeName, tailorDBInputs, executorUsedTypes);
9602
+ if (!snapshotType) continue;
9603
+ const clonedRequest = structuredClone(update.request);
9604
+ clonedRequest.tailordbType = snapshotType;
9605
+ const typeChanges = preMigrationChanges.get(typeName);
9606
+ if (typeChanges && typeChanges.size > 0 && clonedRequest.tailordbType.schema?.fields) applyPreMigrationFieldAdjustments(clonedRequest.tailordbType.schema.fields, typeChanges);
9607
+ processedTypes.updated.add(typeName);
9608
+ await client.updateTailorDBType(clonedRequest);
9609
+ }
9545
9610
  if (!processedTypes.gqlPermissionsProcessed.has(migration.namespace)) {
9546
9611
  const gqlPermissionCreatesForNamespace = changeSet.gqlPermission.creates.filter((create) => create.request.namespaceName === migration.namespace);
9547
9612
  const gqlPermissionUpdatesForNamespace = changeSet.gqlPermission.updates.filter((update) => update.request.namespaceName === migration.namespace);
@@ -9550,11 +9615,11 @@ async function executeSingleMigrationPrePhase(client, changeSet, migration, tail
9550
9615
  const typeName = create.request.tailordbType?.name;
9551
9616
  return create.request.namespaceName === migration.namespace && typeName && gqlPermissionTypeNames.has(typeName) && !processedTypes.created.has(typeName);
9552
9617
  });
9553
- if (missingTypeCreates.length > 0) await awaitAllSettledOrThrow(missingTypeCreates.map((create) => {
9618
+ if (missingTypeCreates.length > 0) for (const create of missingTypeCreates) {
9554
9619
  const typeName = create.request.tailordbType?.name;
9555
9620
  if (typeName) processedTypes.created.add(typeName);
9556
- return client.createTailorDBType(create.request);
9557
- }));
9621
+ await client.createTailorDBType(create.request);
9622
+ }
9558
9623
  processedTypes.gqlPermissionsProcessed.add(migration.namespace);
9559
9624
  await awaitAllSettledOrThrow([...gqlPermissionCreatesForNamespace.map((create) => client.createTailorDBGQLPermission(create.request)), ...gqlPermissionUpdatesForNamespace.map((update) => client.updateTailorDBGQLPermission(update.request))]);
9560
9625
  }
@@ -9584,31 +9649,28 @@ async function executeSingleMigrationPostPhase(client, changeSet, migration, tai
9584
9649
  const affectedTypes = getAffectedTypeNames(migration);
9585
9650
  const deletedTypeNames = getDeletedTypeNames(migration);
9586
9651
  try {
9587
- await Promise.all([...changeSet.type.creates.filter((create) => {
9588
- const typeName = create.request.tailordbType?.name;
9589
- return typeName && affectedTypes.has(typeName) && preMigrationChanges.has(typeName);
9590
- }).map((create) => {
9652
+ for (const create of changeSet.type.creates) {
9591
9653
  const typeName = create.request.tailordbType?.name;
9592
- const snapshotType = typeName ? buildSnapshotTypeManifest(migration, typeName, tailorDBInputs, executorUsedTypes) : void 0;
9593
- if (!snapshotType) return void 0;
9594
- return client.updateTailorDBType({
9654
+ if (!typeName || !affectedTypes.has(typeName) || !preMigrationChanges.has(typeName)) continue;
9655
+ const snapshotType = buildSnapshotTypeManifest(migration, typeName, tailorDBInputs, executorUsedTypes);
9656
+ if (!snapshotType) continue;
9657
+ await client.updateTailorDBType({
9595
9658
  workspaceId: create.request.workspaceId,
9596
9659
  namespaceName: create.request.namespaceName,
9597
9660
  tailordbType: snapshotType
9598
9661
  });
9599
- }), ...changeSet.type.updates.filter((update) => {
9600
- const typeName = update.request.tailordbType?.name;
9601
- return typeName && affectedTypes.has(typeName) && preMigrationChanges.has(typeName);
9602
- }).map((update) => {
9662
+ }
9663
+ for (const update of changeSet.type.updates) {
9603
9664
  const typeName = update.request.tailordbType?.name;
9604
- const snapshotType = typeName ? buildSnapshotTypeManifest(migration, typeName, tailorDBInputs, executorUsedTypes) : void 0;
9605
- if (!snapshotType) return void 0;
9606
- return client.updateTailorDBType({
9665
+ if (!typeName || !affectedTypes.has(typeName) || !preMigrationChanges.has(typeName)) continue;
9666
+ const snapshotType = buildSnapshotTypeManifest(migration, typeName, tailorDBInputs, executorUsedTypes);
9667
+ if (!snapshotType) continue;
9668
+ await client.updateTailorDBType({
9607
9669
  workspaceId: update.request.workspaceId,
9608
9670
  namespaceName: update.request.namespaceName,
9609
9671
  tailordbType: snapshotType
9610
9672
  });
9611
- })]);
9673
+ }
9612
9674
  } catch (error) {
9613
9675
  handleOptionalToRequiredError(error, ["This error occurred during post-migration phase. Please check your migration script.", "Ensure all existing records have values for fields being changed to required."]);
9614
9676
  }
@@ -10265,11 +10327,11 @@ async function registerJobFunctions(client, changeSet, appName, appId, unchanged
10265
10327
  const allUsedJobNames = /* @__PURE__ */ new Set();
10266
10328
  unchangedWorkflowJobNames.forEach((jobName) => allUsedJobNames.add(jobName));
10267
10329
  for (const item of [...changeSet.creates, ...changeSet.updates]) for (const jobName of item.usedJobNames) allUsedJobNames.add(jobName);
10268
- const existingJobFunctions = await fetchAll(async (pageToken, maxPageSize) => {
10330
+ const existingJobFunctions = await fetchAll(async (pageToken, _maxPageSize) => {
10269
10331
  const response = await client.listWorkflowJobFunctions({
10270
10332
  workspaceId,
10271
10333
  pageToken,
10272
- pageSize: maxPageSize
10334
+ pageSize: 100
10273
10335
  });
10274
10336
  return [response.jobFunctions.map((j) => j.name), response.nextPageToken];
10275
10337
  });
@@ -10450,11 +10512,11 @@ async function planWorkflow(client, workspaceId, appName, appId, workflows, main
10450
10512
  }
10451
10513
  async function planWorkflowJobFunctionDeletes(params) {
10452
10514
  const { client, workspaceId, appName, appId, retainedWorkflowJobNames } = params;
10453
- const existingJobFunctions = await fetchAll(async (pageToken, maxPageSize) => {
10515
+ const existingJobFunctions = await fetchAll(async (pageToken, _maxPageSize) => {
10454
10516
  const response = await client.listWorkflowJobFunctions({
10455
10517
  workspaceId,
10456
10518
  pageToken,
10457
- pageSize: maxPageSize
10519
+ pageSize: 100
10458
10520
  });
10459
10521
  return [response.jobFunctions.map((jobFunction) => jobFunction.name), response.nextPageToken];
10460
10522
  });
@@ -10610,6 +10672,17 @@ async function validatePlan(input) {
10610
10672
  violations
10611
10673
  });
10612
10674
  }
10675
+ function inPlaceReplaces(schema, kind, items) {
10676
+ validateItems({
10677
+ validator,
10678
+ schema,
10679
+ kind,
10680
+ action: "replace",
10681
+ items,
10682
+ requestKey: "updateRequest",
10683
+ violations
10684
+ });
10685
+ }
10613
10686
  creates(CreateTailorDBServiceRequestSchema, "TailorDB service", tailorDB.changeSet.service.creates);
10614
10687
  creates(CreateTailorDBTypeRequestSchema, "TailorDB type", tailorDB.changeSet.type.creates);
10615
10688
  updates(UpdateTailorDBTypeRequestSchema, "TailorDB type", tailorDB.changeSet.type.updates);
@@ -10733,7 +10806,7 @@ async function validatePlan(input) {
10733
10806
  }
10734
10807
  })));
10735
10808
  creates(CreateAuthConnectionRequestSchema, "Auth connection", auth.changeSet.connection.creates);
10736
- replaces(CreateAuthConnectionRequestSchema, "Auth connection", auth.changeSet.connection.replaces);
10809
+ inPlaceReplaces(UpdateAuthConnectionRequestSchema, "Auth connection", auth.changeSet.connection.replaces);
10737
10810
  if (violations.length === 0) return;
10738
10811
  const resourceNames = new Set(violations.map((v) => `${v.kind}:${v.name}`));
10739
10812
  logger.error(`Pre-flight validation found ${violations.length} violation(s) across ${resourceNames.size} resource(s):`);
@@ -10825,7 +10898,15 @@ function computeRenamedAppDeletions(params) {
10825
10898
  const { conflicts, resourceOwners, targetAppName } = params;
10826
10899
  return [...new Set(conflicts.map((c) => c.currentOwner))].filter((owner) => !resourceOwners.has(owner) && owner !== targetAppName);
10827
10900
  }
10828
- function printPlanResults(results) {
10901
+ /**
10902
+ * Format and output the plan results, then return a summary of change counts.
10903
+ * In JSON dry-run mode a JSON payload is written to stdout. In all other modes
10904
+ * the human-readable diff goes to stdout (dry-run) or stderr (apply).
10905
+ * @param results - Planned results across all services
10906
+ * @param opts - Output options (dry-run mode flag)
10907
+ * @returns Aggregated plan summary counts
10908
+ */
10909
+ function printPlanResults(results, opts) {
10829
10910
  const executorEntries = formatExecutorChangeEntries(results.executor.changeSet, buildPlannedExecutorsByName(results.executor.changeSet), results.functionRegistry.executorFunctionChanges);
10830
10911
  const resolverEntries = formatResolverChangeEntries(results.pipeline.changeSet.resolver, results.functionRegistry.resolverFunctionChanges);
10831
10912
  const workflowEntries = formatWorkflowChangeEntries(results.workflow.changeSet, results.functionRegistry.workflowJobChanges);
@@ -10850,41 +10931,142 @@ function printPlanResults(results) {
10850
10931
  ...formatChangeSetEntries(results.auth.changeSet.connection, ["connection"], namespaceOf)
10851
10932
  ];
10852
10933
  const { otherChanges: otherFunctionRegistryChanges } = splitFunctionRegistryChanges(results.functionRegistry.changeSet);
10853
- printGroupedDisplaySection(results.functionRegistry.changeSet.title, formatChangeSetEntries(otherFunctionRegistryChanges));
10854
10934
  const tailorDBServiceActions = extractServiceActions(results.tailorDB.changeSet.service);
10855
10935
  const pipelineServiceActions = extractServiceActions(results.pipeline.changeSet.service);
10856
10936
  const idpServiceActions = extractServiceActions(results.idp.changeSet.service);
10857
10937
  const authServiceActions = extractServiceActions(results.auth.changeSet.service);
10858
- results.staticWebsite.changeSet.print();
10859
- results.staticWebsite.customDomainChangeSet.print();
10860
- results.aiGateway.changeSet.print();
10861
- results.app.print();
10862
- printGroupedDisplaySection("TailorDB", tailorDBEntries, tailorDBServiceActions);
10863
- printGroupedDisplaySection("Resolver", pipelineEntries, pipelineServiceActions);
10864
- printGroupedDisplaySection("Executor", executorEntries);
10865
- printGroupedDisplaySection("Workflow", workflowEntries);
10866
- printGroupedDisplaySection("IdP", idpEntries, idpServiceActions);
10867
- printGroupedDisplaySection("Auth", authEntries, authServiceActions);
10868
- results.secretManager.vaultChangeSet.print();
10869
- results.secretManager.secretChangeSet.print();
10870
- if (results.secretManager.skippedSecrets.length > 0) {
10871
- logger.log(styles.bold("Secret Manager secrets (skipped - no value provided):"));
10872
- for (const name of results.secretManager.skippedSecrets) logger.log(` ${styles.dim("○")} ${name}`);
10873
- }
10874
- const summary = summarizePlanResults(results, [
10938
+ const allDisplayEntries = [
10875
10939
  ...tailorDBEntries,
10876
10940
  ...pipelineEntries,
10877
10941
  ...executorEntries,
10878
10942
  ...workflowEntries,
10879
10943
  ...idpEntries,
10880
10944
  ...authEntries
10881
- ], [
10945
+ ];
10946
+ const summary = summarizePlanResults(results, allDisplayEntries, [
10882
10947
  ...tailorDBServiceActions,
10883
10948
  ...pipelineServiceActions,
10884
10949
  ...idpServiceActions,
10885
10950
  ...authServiceActions
10886
10951
  ]);
10887
- logger.log(formatPlanSummary(summary));
10952
+ const allUnmanaged = [
10953
+ ...results.functionRegistry.unmanaged,
10954
+ ...results.tailorDB.unmanaged,
10955
+ ...results.staticWebsite.unmanaged,
10956
+ ...results.aiGateway.unmanaged,
10957
+ ...results.idp.unmanaged,
10958
+ ...results.auth.unmanaged,
10959
+ ...results.pipeline.unmanaged,
10960
+ ...results.executor.unmanaged,
10961
+ ...results.workflow.unmanaged,
10962
+ ...results.secretManager.unmanaged
10963
+ ];
10964
+ const allConflicts = [
10965
+ ...results.functionRegistry.conflicts,
10966
+ ...results.tailorDB.conflicts,
10967
+ ...results.staticWebsite.conflicts,
10968
+ ...results.aiGateway.conflicts,
10969
+ ...results.idp.conflicts,
10970
+ ...results.auth.conflicts,
10971
+ ...results.pipeline.conflicts,
10972
+ ...results.executor.conflicts,
10973
+ ...results.workflow.conflicts,
10974
+ ...results.secretManager.conflicts
10975
+ ];
10976
+ if (logger.jsonMode && opts?.dryRun) {
10977
+ const changes = [
10978
+ ...allDisplayEntries,
10979
+ ...tailorDBServiceActions.map(({ action, name }) => ({
10980
+ action,
10981
+ name,
10982
+ labels: ["tailorDB"],
10983
+ namespace: void 0
10984
+ })),
10985
+ ...pipelineServiceActions.map(({ action, name }) => ({
10986
+ action,
10987
+ name,
10988
+ labels: ["pipeline"],
10989
+ namespace: void 0
10990
+ })),
10991
+ ...idpServiceActions.map(({ action, name }) => ({
10992
+ action,
10993
+ name,
10994
+ labels: ["idp"],
10995
+ namespace: void 0
10996
+ })),
10997
+ ...authServiceActions.map(({ action, name }) => ({
10998
+ action,
10999
+ name,
11000
+ labels: ["auth"],
11001
+ namespace: void 0
11002
+ })),
11003
+ ...formatChangeSetEntries(otherFunctionRegistryChanges),
11004
+ ...formatChangeSetEntries(results.staticWebsite.changeSet, ["staticWebsite"]),
11005
+ ...formatChangeSetEntries(results.staticWebsite.customDomainChangeSet, ["customDomain"]),
11006
+ ...formatChangeSetEntries(results.aiGateway.changeSet, ["aiGateway"]),
11007
+ ...formatChangeSetEntries(results.app, ["application"]),
11008
+ ...formatChangeSetEntries(results.secretManager.vaultChangeSet, ["vault"]),
11009
+ ...formatChangeSetEntries(results.secretManager.secretChangeSet, ["secret"])
11010
+ ].map(({ action, name, labels, namespace }) => ({
11011
+ action,
11012
+ name,
11013
+ labels,
11014
+ namespace
11015
+ }));
11016
+ const warnings = [...allUnmanaged.map(({ resourceType, resourceName }) => ({
11017
+ type: "unmanaged",
11018
+ resourceType,
11019
+ name: resourceName
11020
+ })), ...results.secretManager.skippedSecrets.map((name) => ({
11021
+ type: "skippedSecret",
11022
+ resourceType: "secret",
11023
+ name
11024
+ }))];
11025
+ const conflicts = allConflicts.map(({ resourceType, resourceName, currentOwner }) => ({
11026
+ resourceType,
11027
+ name: resourceName,
11028
+ currentOwner
11029
+ }));
11030
+ logger.out({
11031
+ summary,
11032
+ changes,
11033
+ warnings,
11034
+ conflicts
11035
+ });
11036
+ return summary;
11037
+ }
11038
+ const allLines = [
11039
+ ...buildGroupedDisplayLines(results.functionRegistry.changeSet.title, formatChangeSetEntries(otherFunctionRegistryChanges)),
11040
+ ...results.staticWebsite.changeSet.lines(),
11041
+ ...results.staticWebsite.customDomainChangeSet.lines(),
11042
+ ...results.aiGateway.changeSet.lines(),
11043
+ ...results.app.lines(),
11044
+ ...buildGroupedDisplayLines("TailorDB", tailorDBEntries, tailorDBServiceActions),
11045
+ ...buildGroupedDisplayLines("Resolver", pipelineEntries, pipelineServiceActions),
11046
+ ...buildGroupedDisplayLines("Executor", executorEntries),
11047
+ ...buildGroupedDisplayLines("Workflow", workflowEntries),
11048
+ ...buildGroupedDisplayLines("IdP", idpEntries, idpServiceActions),
11049
+ ...buildGroupedDisplayLines("Auth", authEntries, authServiceActions),
11050
+ ...results.secretManager.vaultChangeSet.lines(),
11051
+ ...results.secretManager.secretChangeSet.lines()
11052
+ ];
11053
+ if (allUnmanaged.length > 0) {
11054
+ allLines.push(styles.bold("Unmanaged resources (not in config):"));
11055
+ for (const { resourceType, resourceName } of allUnmanaged) allLines.push(` ${styles.warning("⚠")} ${styles.bold(resourceType)} "${resourceName}"`);
11056
+ }
11057
+ if (results.secretManager.skippedSecrets.length > 0) {
11058
+ allLines.push(styles.bold("Secret Manager secrets (skipped - no value provided):"));
11059
+ for (const name of results.secretManager.skippedSecrets) allLines.push(` ${styles.dim("○")} ${name}`);
11060
+ }
11061
+ if (allConflicts.length > 0) {
11062
+ allLines.push(styles.bold("Owner conflicts (will require confirmation on apply):"));
11063
+ for (const { resourceType, resourceName, currentOwner } of allConflicts) allLines.push(` ${styles.warning("!")} ${styles.bold(resourceType)} "${resourceName}" — owned by "${currentOwner}"`);
11064
+ }
11065
+ allLines.push(formatPlanSummary(summary));
11066
+ const output = allLines.join("\n");
11067
+ if (opts?.dryRun) logger.out(output);
11068
+ else logger.log(output);
11069
+ return summary;
10888
11070
  }
10889
11071
  /**
10890
11072
  * Summarize plan counts from display entries, service actions, and non-grouped changesets.
@@ -10898,8 +11080,7 @@ function summarizePlanResults(results, displayEntries, serviceActions) {
10898
11080
  create: 0,
10899
11081
  update: 0,
10900
11082
  delete: 0,
10901
- replace: 0,
10902
- unchanged: 0
11083
+ replace: 0
10903
11084
  };
10904
11085
  for (const entry of displayEntries) summary[entry.action] += 1;
10905
11086
  for (const sa of serviceActions) summary[sa.action] += 1;
@@ -11137,7 +11318,7 @@ async function deploy(options) {
11137
11318
  }
11138
11319
  });
11139
11320
  });
11140
- printPlanResults({
11321
+ const planSummary = printPlanResults({
11141
11322
  functionRegistry,
11142
11323
  tailorDB,
11143
11324
  staticWebsite,
@@ -11149,7 +11330,7 @@ async function deploy(options) {
11149
11330
  executor,
11150
11331
  workflow,
11151
11332
  secretManager
11152
- });
11333
+ }, { dryRun: options?.dryRun });
11153
11334
  if (options?.noValidate) logger.warn("Client-side validation skipped (--no-validate).");
11154
11335
  else await validatePlan({
11155
11336
  functionRegistry,
@@ -11202,7 +11383,11 @@ async function deploy(options) {
11202
11383
  await applyTailorDB(client, tailorDB, "delete-services");
11203
11384
  });
11204
11385
  await withSpan("apply.cleanup", () => applyFunctionRegistry(client, workspaceId, functionRegistry, "delete"));
11205
- logger.success("Successfully applied changes.");
11386
+ if (logger.jsonMode) logger.out({
11387
+ summary: planSummary,
11388
+ status: "applied"
11389
+ });
11390
+ else logger.success("Successfully applied changes.");
11206
11391
  });
11207
11392
  }
11208
11393
 
@@ -15161,31 +15346,34 @@ async function execRemove(client, workspaceId, application, config, confirm) {
15161
15346
  const workflow = await planWorkflow(client, workspaceId, application.name, application.id, {}, {});
15162
15347
  const functionRegistry = await planFunctionRegistry(client, workspaceId, application.name, application.id, []);
15163
15348
  const secretManager = await planSecretManager(ctx);
15164
- functionRegistry.changeSet.print();
15165
- staticWebsite.changeSet.print();
15166
- aiGateway.changeSet.print();
15167
- app.print();
15168
- tailorDB.changeSet.service.print();
15169
- tailorDB.changeSet.type.print();
15170
- tailorDB.changeSet.gqlPermission.print();
15171
- pipeline.changeSet.service.print();
15172
- pipeline.changeSet.resolver.print();
15173
- executor.changeSet.print();
15174
- workflow.changeSet.print();
15175
- idp.changeSet.service.print();
15176
- idp.changeSet.client.print();
15177
- auth.changeSet.service.print();
15178
- auth.changeSet.idpConfig.print();
15179
- auth.changeSet.userProfileConfig.print();
15180
- auth.changeSet.tenantConfig.print();
15181
- auth.changeSet.machineUser.print();
15182
- auth.changeSet.oauth2Client.print();
15183
- auth.changeSet.authHook.print();
15184
- auth.changeSet.scim.print();
15185
- auth.changeSet.scimResource.print();
15186
- auth.changeSet.connection.print();
15187
- secretManager.vaultChangeSet.print();
15188
- secretManager.secretChangeSet.print();
15349
+ const removeLines = [
15350
+ ...functionRegistry.changeSet.lines(),
15351
+ ...staticWebsite.changeSet.lines(),
15352
+ ...aiGateway.changeSet.lines(),
15353
+ ...app.lines(),
15354
+ ...tailorDB.changeSet.service.lines(),
15355
+ ...tailorDB.changeSet.type.lines(),
15356
+ ...tailorDB.changeSet.gqlPermission.lines(),
15357
+ ...pipeline.changeSet.service.lines(),
15358
+ ...pipeline.changeSet.resolver.lines(),
15359
+ ...executor.changeSet.lines(),
15360
+ ...workflow.changeSet.lines(),
15361
+ ...idp.changeSet.service.lines(),
15362
+ ...idp.changeSet.client.lines(),
15363
+ ...auth.changeSet.service.lines(),
15364
+ ...auth.changeSet.idpConfig.lines(),
15365
+ ...auth.changeSet.userProfileConfig.lines(),
15366
+ ...auth.changeSet.tenantConfig.lines(),
15367
+ ...auth.changeSet.machineUser.lines(),
15368
+ ...auth.changeSet.oauth2Client.lines(),
15369
+ ...auth.changeSet.authHook.lines(),
15370
+ ...auth.changeSet.scim.lines(),
15371
+ ...auth.changeSet.scimResource.lines(),
15372
+ ...auth.changeSet.connection.lines(),
15373
+ ...secretManager.vaultChangeSet.lines(),
15374
+ ...secretManager.secretChangeSet.lines()
15375
+ ];
15376
+ if (removeLines.length > 0) logger.log(removeLines.join("\n"));
15189
15377
  if (tailorDB.changeSet.service.deletes.length === 0 && staticWebsite.changeSet.deletes.length === 0 && aiGateway.changeSet.deletes.length === 0 && idp.changeSet.service.deletes.length === 0 && auth.changeSet.service.deletes.length === 0 && pipeline.changeSet.service.deletes.length === 0 && app.deletes.length === 0 && executor.changeSet.deletes.length === 0 && workflow.changeSet.deletes.length === 0 && functionRegistry.changeSet.deletes.length === 0 && secretManager.vaultChangeSet.deletes.length === 0 && secretManager.secretChangeSet.deletes.length === 0) return;
15190
15378
  if (confirm) await confirm();
15191
15379
  await applyWorkflow(client, workflow, "delete");
@@ -15255,6 +15443,36 @@ function logBetaWarning(featureName) {
15255
15443
  logger.newline();
15256
15444
  }
15257
15445
 
15446
+ //#endregion
15447
+ //#region src/cli/shared/config.ts
15448
+ /**
15449
+ * Extracts every namespace key declared under `config.db`, including those
15450
+ * declared with `{ external: true }`.
15451
+ * @param config - Loaded application configuration.
15452
+ * @returns Namespace names in insertion order.
15453
+ */
15454
+ function extractAllNamespaces(config) {
15455
+ const namespaces = /* @__PURE__ */ new Set();
15456
+ if (config.db) for (const namespaceName of Object.keys(config.db)) namespaces.add(namespaceName);
15457
+ return Array.from(namespaces);
15458
+ }
15459
+ /**
15460
+ * Extracts namespace keys under `config.db` that this app owns
15461
+ * (i.e. not declared with `{ external: true }`). Use this for destructive
15462
+ * operations like `tailordb truncate --all` to avoid touching namespaces
15463
+ * owned by other apps.
15464
+ * @param config - Loaded application configuration.
15465
+ * @returns Owned namespace names in insertion order.
15466
+ */
15467
+ function extractOwnedNamespaces(config) {
15468
+ const namespaces = /* @__PURE__ */ new Set();
15469
+ if (config.db) for (const [namespaceName, nsConfig] of Object.entries(config.db)) {
15470
+ if ("external" in nsConfig) continue;
15471
+ namespaces.add(namespaceName);
15472
+ }
15473
+ return Array.from(namespaces);
15474
+ }
15475
+
15258
15476
  //#endregion
15259
15477
  //#region src/cli/commands/workspace/transform.ts
15260
15478
  const workspaceInfo = (workspace, folderName) => {
@@ -15978,7 +16196,7 @@ async function generate(options) {
15978
16196
  if (options.init) await handleInitOption(namespacesWithMigrations, options.yes);
15979
16197
  let pluginManager;
15980
16198
  if (plugins.length > 0) pluginManager = new PluginManager(plugins);
15981
- const { defineApplication } = await import("./application-Br48NXBD.mjs");
16199
+ const { defineApplication } = await import("./application-a_ApFuPh.mjs");
15982
16200
  const application = defineApplication({
15983
16201
  config,
15984
16202
  pluginManager
@@ -16122,36 +16340,6 @@ const generateCommand = defineAppCommand({
16122
16340
  }
16123
16341
  });
16124
16342
 
16125
- //#endregion
16126
- //#region src/cli/shared/config.ts
16127
- /**
16128
- * Extracts every namespace key declared under `config.db`, including those
16129
- * declared with `{ external: true }`.
16130
- * @param config - Loaded application configuration.
16131
- * @returns Namespace names in insertion order.
16132
- */
16133
- function extractAllNamespaces(config) {
16134
- const namespaces = /* @__PURE__ */ new Set();
16135
- if (config.db) for (const namespaceName of Object.keys(config.db)) namespaces.add(namespaceName);
16136
- return Array.from(namespaces);
16137
- }
16138
- /**
16139
- * Extracts namespace keys under `config.db` that this app owns
16140
- * (i.e. not declared with `{ external: true }`). Use this for destructive
16141
- * operations like `tailordb truncate --all` to avoid touching namespaces
16142
- * owned by other apps.
16143
- * @param config - Loaded application configuration.
16144
- * @returns Owned namespace names in insertion order.
16145
- */
16146
- function extractOwnedNamespaces(config) {
16147
- const namespaces = /* @__PURE__ */ new Set();
16148
- if (config.db) for (const [namespaceName, nsConfig] of Object.entries(config.db)) {
16149
- if ("external" in nsConfig) continue;
16150
- namespaces.add(namespaceName);
16151
- }
16152
- return Array.from(namespaces);
16153
- }
16154
-
16155
16343
  //#endregion
16156
16344
  //#region src/cli/shared/tailordb-namespace.ts
16157
16345
  /**
@@ -16742,6 +16930,15 @@ const validateRegion = async (region, client) => {
16742
16930
  const availableRegions = await client.listAvailableWorkspaceRegions({});
16743
16931
  if (!availableRegions.regions.includes(region)) throw new Error(`Region must be one of: ${availableRegions.regions.join(", ")}.`);
16744
16932
  };
16933
+ function profilePlatformSettings(platformConfig) {
16934
+ const hasOAuth2ClientId = platformConfig?.oauth2ClientId || process.env.TAILOR_PLATFORM_OAUTH2_CLIENT_ID;
16935
+ const hasConsoleUrl = platformConfig?.consoleUrl || process.env.TAILOR_PLATFORM_CONSOLE_URL;
16936
+ return {
16937
+ ...isDefaultPlatform(platformConfig) ? {} : { platform_url: getPlatformBaseUrl(platformConfig) },
16938
+ ...hasOAuth2ClientId ? { oauth2_client_id: getOAuth2ClientId(platformConfig) } : {},
16939
+ ...hasConsoleUrl ? { console_url: getConsoleBaseUrl(platformConfig) } : {}
16940
+ };
16941
+ }
16745
16942
  /**
16746
16943
  * Create a new workspace with the given options.
16747
16944
  * @param options - Workspace creation options
@@ -16796,6 +16993,23 @@ const createCommand = defineAppCommand({
16796
16993
  }).strict(),
16797
16994
  run: async (args) => {
16798
16995
  await assertWritable();
16996
+ const profileName = args["profile-name"];
16997
+ let profileSetup;
16998
+ if (profileName) {
16999
+ const config = await readPlatformConfig();
17000
+ if (config.profiles[profileName]) throw new Error(`Profile "${profileName}" already exists.`);
17001
+ const activeProfileName = process.env.TAILOR_PLATFORM_PROFILE;
17002
+ const activeProfileEntry = activeProfileName ? config.profiles[activeProfileName] : void 0;
17003
+ const platformConfig = activeProfileEntry ? platformConfigFromProfile(activeProfileEntry) : void 0;
17004
+ const profileUser = args["profile-user"] || activeProfileEntry?.user || config.current_user;
17005
+ if (!profileUser) throw new Error("Current user not found. Please login or specify --profile-user to create a profile.");
17006
+ if (!hasUserTokenEntry(config, profileUser, platformConfig)) throw new Error(`User "${profileUser}" not found.\nPlease verify your user name and login using 'tailor-sdk login' command.`);
17007
+ profileSetup = {
17008
+ name: profileName,
17009
+ user: profileUser,
17010
+ platformSettings: profilePlatformSettings(platformConfig)
17011
+ };
17012
+ }
16799
17013
  const workspace = await createWorkspace({
16800
17014
  name: args.name,
16801
17015
  region: args.region,
@@ -16804,26 +17018,26 @@ const createCommand = defineAppCommand({
16804
17018
  folderId: args["folder-id"]
16805
17019
  });
16806
17020
  let profileInfo;
16807
- const profileName = args["profile-name"];
16808
- if (profileName) {
17021
+ if (profileSetup) {
16809
17022
  const config = await readPlatformConfig();
16810
- if (config.profiles[profileName]) throw new Error(`Profile "${profileName}" already exists.`);
16811
- const profileUser = args["profile-user"] || config.current_user;
16812
- if (!profileUser) throw new Error("Current user not found. Please login or specify --profile-user to create a profile.");
16813
- if (!config.users[profileUser]) throw new Error(`User "${profileUser}" not found.\nPlease verify your user name and login using 'tailor-sdk login' command.`);
16814
- config.profiles[profileName] = {
16815
- user: profileUser,
17023
+ const platformSettings = profileSetup.platformSettings;
17024
+ config.profiles[profileSetup.name] = {
17025
+ user: profileSetup.user,
16816
17026
  workspace_id: workspace.id,
16817
- ...args.permission === "read" ? { readonly: true } : {}
17027
+ ...args.permission === "read" ? { readonly: true } : {},
17028
+ ...platformSettings
16818
17029
  };
16819
17030
  writePlatformConfig(config);
16820
17031
  profileInfo = {
16821
- name: profileName,
16822
- user: profileUser,
17032
+ name: profileSetup.name,
17033
+ user: profileSetup.user,
16823
17034
  workspaceId: workspace.id,
16824
- permission: args.permission
17035
+ permission: args.permission,
17036
+ ...platformSettings.platform_url ? { platformUrl: platformSettings.platform_url } : {},
17037
+ ...platformSettings.oauth2_client_id ? { oauth2ClientId: platformSettings.oauth2_client_id } : {},
17038
+ ...platformSettings.console_url ? { consoleUrl: platformSettings.console_url } : {}
16825
17039
  };
16826
- if (!args.json) logger.success(`Profile "${profileName}" created successfully.`);
17040
+ if (!args.json) logger.success(`Profile "${profileSetup.name}" created successfully.`);
16827
17041
  }
16828
17042
  if (!args.json) logger.success(`Workspace "${workspaceDisplayName(workspace)}" created successfully.`);
16829
17043
  if (args.json && profileInfo) {
@@ -18246,5 +18460,5 @@ function isDeno() {
18246
18460
  }
18247
18461
 
18248
18462
  //#endregion
18249
- export { updateCommand$2 as $, protoGqlPermission as $t, listCommand$3 as A, apiCall as An, jobsCommand as At, show as B, toPageDirection as Bn, functionExecutionStatusToString as Bt, listCommand$2 as C, ensureConfigId as Cn, webhookCommand as Ct, waitWorkflowExecution as D, generateUserTypes as Dn, listExecutors as Dt, waitCommand as E, PluginManager as En, listCommand$9 as Et, generateCommand as F, confirmationArgs as Fn, getCommand$5 as Ft, updateCommand$1 as G, executeScript as Gt, logBetaWarning as H, getCommand$6 as Ht, generateMigrationScript as I, deploymentArgs as In, getWorkflow as It, treeCommand as J, MIGRATION_LABEL_KEY as Jt, updateOrganization as K, waitForExecution as Kt, writeDbTypesFile as L, isVerbose as Ln, executionsCommand as Lt, truncate as M, defineAppCommand as Mn, watchExecutorJob as Mt, truncateCommand as N, commonArgs as Nn, startCommand as Nt, resumeCommand as O, prompt as On, getExecutorJob as Ot, generate as P, configArg as Pn, startWorkflow as Pt, getOrganization as Q, generateAllTypeManifestsFromSnapshot as Qt, getConfiguredEditorCommand as R, pagedLogArgs as Rn, getWorkflowExecution as Rt, listApps as S, getNamespacesWithMigrations as Sn, listWebhookExecutors as St, healthCommand as T, sdkNameLabelKey as Tn, triggerExecutor as Tt, remove as U, getExecutor as Ut, showCommand as V, workspaceArgs as Vn, formatKeyValueTable as Vt, removeCommand$1 as W, deploy as Wt, listOrganizations as X, parseMigrationLabelNumber as Xt, listCommand$4 as Y, handleOptionalToRequiredError as Yt, getCommand$1 as Z, compareSnapshotWithRemote as Zt, getWorkspace as _, formatMigrationNumber as _n, generate$1 as _t, updateUser as a, assertValidMigrationFiles as an, deleteCommand$1 as at, createCommand as b, formatMigrationDiff as bn, getCommand$4 as bt, listCommand as c, createSnapshotFromLocalTypes as cn, createFolder as ct, inviteUser as d, getMigrationFilePath as dn, getCommand$3 as dt, DB_TYPES_FILE_NAME as en, updateFolder as et, restoreCommand as f, getMigrationFiles as fn, getOAuth2Client as ft, getCommand as g, reconstructSnapshotFromMigrations as gn, listMachineUsers as gt, listWorkspaces as h, loadDiff as hn, listCommand$7 as ht, updateCommand as i, SCHEMA_FILE_NAME as in, getFolder as it, listWorkflows as j, assertWritable as jn, listExecutorJobs as jt, resumeWorkflow as k, apiCommand as kn, getExecutorWaitFailureMessage as kt, listUsers as l, getLatestMigrationNumber as ln, listCommand$6 as lt, listCommand$1 as m, isValidMigrationNumber as mn, tokenCommand as mt, query as n, INITIAL_SCHEMA_NUMBER as nn, listFolders as nt, removeCommand as o, compareLocalTypesWithSnapshot as on, deleteFolder as ot, restoreWorkspace as p, getNextMigrationNumber as pn, getMachineUserToken as pt, organizationTree as q, bundleMigrationScript as qt, queryCommand as r, MIGRATE_FILE_NAME as rn, getCommand$2 as rt, removeUser as s, compareSnapshots as sn, createCommand$1 as st, isNativeTypeScriptRuntime as t, DIFF_FILE_NAME as tn, listCommand$5 as tt, inviteCommand as u, getMigrationDirPath as un, listOAuth2Clients as ut, deleteCommand as v, parseMigrationNumberArg as vn, listCommand$8 as vt, getAppHealth as w, resourceTrn as wn, triggerCommand as wt, createWorkspace as x, hasChanges as xn, getFunctionRegistry as xt, deleteWorkspace as y, formatDiffSummary as yn, listFunctionRegistries as yt, openInConfiguredEditor as z, paginationArgs as zn, listWorkflowExecutions as zt };
18250
- //# sourceMappingURL=runtime-jowoN6qC.mjs.map
18463
+ export { getOrganization as $, generateAllTypeManifestsFromSnapshot as $t, listCommand$3 as A, apiCommand as An, getExecutorWaitFailureMessage as At, show as B, paginationArgs as Bn, listWorkflowExecutions as Bt, listCommand$2 as C, getNamespacesWithMigrations as Cn, listWebhookExecutors as Ct, waitWorkflowExecution as D, PluginManager as Dn, listCommand$9 as Dt, waitCommand as E, sdkNameLabelKey as En, triggerExecutor as Et, generateCommand as F, configArg as Fn, startWorkflow as Ft, removeCommand$1 as G, deploy as Gt, extractOwnedNamespaces as H, workspaceArgs as Hn, formatKeyValueTable as Ht, generateMigrationScript as I, confirmationArgs as In, getCommand$5 as It, organizationTree as J, bundleMigrationScript as Jt, updateCommand$1 as K, executeScript as Kt, writeDbTypesFile as L, deploymentArgs as Ln, getWorkflow as Lt, truncate as M, assertWritable as Mn, listExecutorJobs as Mt, truncateCommand as N, defineAppCommand as Nn, watchExecutorJob as Nt, resumeCommand as O, generateUserTypes as On, listExecutors as Ot, generate as P, commonArgs as Pn, startCommand as Pt, getCommand$1 as Q, compareSnapshotWithRemote as Qt, getConfiguredEditorCommand as R, isVerbose as Rn, executionsCommand as Rt, listApps as S, hasChanges as Sn, getFunctionRegistry as St, healthCommand as T, resourceTrn as Tn, triggerCommand as Tt, logBetaWarning as U, getCommand$6 as Ut, showCommand as V, toPageDirection as Vn, functionExecutionStatusToString as Vt, remove as W, getExecutor as Wt, listCommand$4 as X, handleOptionalToRequiredError as Xt, treeCommand as Y, MIGRATION_LABEL_KEY as Yt, listOrganizations as Z, parseMigrationLabelNumber as Zt, getWorkspace as _, reconstructSnapshotFromMigrations as _n, listMachineUsers as _t, updateUser as a, SCHEMA_FILE_NAME as an, getFolder as at, createCommand as b, formatDiffSummary as bn, listFunctionRegistries as bt, listCommand as c, compareSnapshots as cn, createCommand$1 as ct, inviteUser as d, getMigrationDirPath as dn, listOAuth2Clients as dt, protoGqlPermission as en, updateCommand$2 as et, restoreCommand as f, getMigrationFilePath as fn, getCommand$3 as ft, getCommand as g, loadDiff as gn, listCommand$7 as gt, listWorkspaces as h, isValidMigrationNumber as hn, tokenCommand as ht, updateCommand as i, MIGRATE_FILE_NAME as in, getCommand$2 as it, listWorkflows as j, apiCall as jn, jobsCommand as jt, resumeWorkflow as k, prompt as kn, getExecutorJob as kt, listUsers as l, createSnapshotFromLocalTypes as ln, createFolder as lt, listCommand$1 as m, getNextMigrationNumber as mn, getMachineUserToken as mt, query as n, DIFF_FILE_NAME as nn, listCommand$5 as nt, removeCommand as o, assertValidMigrationFiles as on, deleteCommand$1 as ot, restoreWorkspace as p, getMigrationFiles as pn, getOAuth2Client as pt, updateOrganization as q, waitForExecution as qt, queryCommand as r, INITIAL_SCHEMA_NUMBER as rn, listFolders as rt, removeUser as s, compareLocalTypesWithSnapshot as sn, deleteFolder as st, isNativeTypeScriptRuntime as t, DB_TYPES_FILE_NAME as tn, updateFolder as tt, inviteCommand as u, getLatestMigrationNumber as un, listCommand$6 as ut, deleteCommand as v, formatMigrationNumber as vn, generate$1 as vt, getAppHealth as w, ensureConfigId as wn, webhookCommand as wt, createWorkspace as x, formatMigrationDiff as xn, getCommand$4 as xt, deleteWorkspace as y, parseMigrationNumberArg as yn, listCommand$8 as yt, openInConfiguredEditor as z, pagedLogArgs as zn, getWorkflowExecution as zt };
18464
+ //# sourceMappingURL=runtime-BpHVwifd.mjs.map