@tailor-platform/sdk 1.74.0 → 1.75.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/application-BJKNlv8c.mjs +3 -0
  3. package/dist/{application-DwmoI6ZQ.mjs → application-DYshsH-K.mjs} +61 -11
  4. package/dist/application-DYshsH-K.mjs.map +1 -0
  5. package/dist/brand-Eo4pLXPJ.mjs.map +1 -1
  6. package/dist/cli/commands/deploy/workflow-execution-policy.d.mts +1 -0
  7. package/dist/cli/commands/tailordb/migrate/snapshot.d.mts +1 -16
  8. package/dist/cli/index.mjs +23 -34
  9. package/dist/cli/index.mjs.map +1 -1
  10. package/dist/cli/lib.d.mts +2 -2
  11. package/dist/cli/lib.mjs +3 -3
  12. package/dist/cli/lib.mjs.map +1 -1
  13. package/dist/completion/zsh-worker.zsh +9 -9
  14. package/dist/configure/config/types.d.mts +3 -1
  15. package/dist/configure/index.d.mts +3 -1
  16. package/dist/configure/index.mjs +113 -5
  17. package/dist/configure/index.mjs.map +1 -1
  18. package/dist/configure/services/index.d.mts +3 -1
  19. package/dist/configure/services/tailordb/schema.d.mts +5 -19
  20. package/dist/configure/services/workflow/execution-policy.d.mts +71 -0
  21. package/dist/configure/services/workflow/execution-policy.types.d.mts +104 -0
  22. package/dist/configure/services/workflow/index.d.mts +3 -1
  23. package/dist/configure/services/workflow/job.d.mts +7 -3
  24. package/dist/configure/types/field-runtime.d.mts +17 -0
  25. package/dist/configure/types/type.d.mts +1 -18
  26. package/dist/field-runtime-9bfXBAOK.mjs +183 -0
  27. package/dist/field-runtime-9bfXBAOK.mjs.map +1 -0
  28. package/dist/{globals-B8XX5TRB.mjs → globals-CcU1ONiK.mjs} +2 -2
  29. package/dist/globals-CcU1ONiK.mjs.map +1 -0
  30. package/dist/{job-CtU73PGa.mjs → job-D-PbD1P3.mjs} +5 -3
  31. package/dist/job-D-PbD1P3.mjs.map +1 -0
  32. package/dist/plugin/builtin/seed/index.mjs +1 -1
  33. package/dist/{registry-BozuxbPp.mjs → registry-NfSW0BRo.mjs} +4 -3
  34. package/dist/registry-NfSW0BRo.mjs.map +1 -0
  35. package/dist/runtime/globals.d.mts +1 -1
  36. package/dist/runtime/index.d.mts +1 -1
  37. package/dist/runtime/workflow.d.mts +22 -3
  38. package/dist/{runtime-Zkg3SUwi.mjs → runtime-CJ5usBOu.mjs} +456 -397
  39. package/dist/runtime-CJ5usBOu.mjs.map +1 -0
  40. package/dist/{schema-DAdZSFOd.mjs → schema-Dl_y0m9e.mjs} +8 -167
  41. package/dist/schema-Dl_y0m9e.mjs.map +1 -0
  42. package/dist/secretmanager-Bd45j7an.mjs +98 -0
  43. package/dist/secretmanager-Bd45j7an.mjs.map +1 -0
  44. package/dist/{seed-DoMTMLcm.mjs → seed-fm0LeYP2.mjs} +14 -3
  45. package/dist/seed-fm0LeYP2.mjs.map +1 -0
  46. package/dist/{service_pb-CIrhGwHk.mjs → service_pb-4unFyubn.mjs} +16 -6
  47. package/dist/{service_pb-CIrhGwHk.mjs.map → service_pb-4unFyubn.mjs.map} +1 -1
  48. package/dist/{service_pb-DjwIn4jO.mjs → service_pb-D-PXRoMg.mjs} +1 -1
  49. package/dist/tailor-proto/src/tailor/v1/service_pb.d.mts +1 -1
  50. package/dist/tailor-proto/src/tailor/v1/workflow_pb.d.mts +29 -9
  51. package/dist/tailor-proto/src/tailor/v1/workflow_resource_pb.d.mts +35 -1
  52. package/dist/types-BwzB2okW.mjs +199 -0
  53. package/dist/types-BwzB2okW.mjs.map +1 -0
  54. package/dist/types-KlawuVKa.mjs +4 -0
  55. package/dist/utils/test/index.mjs +1 -1
  56. package/dist/utils/test/index.mjs.map +1 -1
  57. package/dist/vitest/environment.mjs +1 -1
  58. package/dist/vitest/index.d.mts +8 -1
  59. package/dist/vitest/index.mjs +779 -1
  60. package/dist/vitest/index.mjs.map +1 -1
  61. package/dist/vitest/mock.d.mts +8 -363
  62. package/dist/vitest/mocks/aigateway.d.mts +30 -0
  63. package/dist/vitest/mocks/authconnection.d.mts +28 -0
  64. package/dist/vitest/mocks/file.d.mts +41 -0
  65. package/dist/vitest/mocks/iconv.d.mts +27 -0
  66. package/dist/vitest/mocks/idp.d.mts +44 -0
  67. package/dist/vitest/mocks/secretmanager.d.mts +33 -0
  68. package/dist/vitest/mocks/tailordb.d.mts +71 -0
  69. package/dist/vitest/mocks/workflow.d.mts +117 -0
  70. package/dist/vitest/setup.mjs +2 -2
  71. package/dist/workflow-DSwnYPPP.mjs.map +1 -1
  72. package/docs/configuration.md +24 -0
  73. package/docs/services/workflow.md +78 -0
  74. package/package.json +8 -8
  75. package/dist/application-BndtMTFY.mjs +0 -3
  76. package/dist/application-DwmoI6ZQ.mjs.map +0 -1
  77. package/dist/field-DOsJCPFa.mjs +0 -22
  78. package/dist/field-DOsJCPFa.mjs.map +0 -1
  79. package/dist/globals-B8XX5TRB.mjs.map +0 -1
  80. package/dist/job-CtU73PGa.mjs.map +0 -1
  81. package/dist/mock-Ce1GCi4-.mjs +0 -871
  82. package/dist/mock-Ce1GCi4-.mjs.map +0 -1
  83. package/dist/registry-BozuxbPp.mjs.map +0 -1
  84. package/dist/runtime-Zkg3SUwi.mjs.map +0 -1
  85. package/dist/schema-DAdZSFOd.mjs.map +0 -1
  86. package/dist/seed-DoMTMLcm.mjs.map +0 -1
  87. package/dist/types-qhFZ8y9B.mjs +0 -4
  88. package/dist/types-ywCGpzDZ.mjs +0 -360
  89. package/dist/types-ywCGpzDZ.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"brand-Eo4pLXPJ.mjs","names":[],"sources":["../src/utils/brand.ts"],"sourcesContent":["// Symbol.for ensures the same symbol is returned across different ESM module instances,\n// avoiding identity mismatches when multiple copies of the SDK are loaded.\nexport const SDK_BRAND: unique symbol = Symbol.for(\"tailor-platform/sdk\");\n\nexport type SdkBrandKind =\n | \"tailordb-type\"\n | \"resolver\"\n | \"executor\"\n | \"workflow\"\n | \"workflow-job\"\n | \"wait-point\"\n | \"http-adapter\";\n\n/**\n * Adds a non-enumerable SDK brand symbol to the given object (in-place).\n * The brand stores the kind so service loaders can distinguish between\n * different SDK object types (e.g. a type loader skips executors).\n * @param value - The object to brand\n * @param kind - The kind of SDK object\n * @returns The same object with the brand applied\n */\nexport function brandValue<T extends object>(value: T, kind: SdkBrandKind): T {\n Object.defineProperty(value, SDK_BRAND, {\n value: kind,\n enumerable: false,\n configurable: false,\n writable: false,\n });\n return value;\n}\n\n/**\n * Checks whether the given value has been branded by the SDK.\n * When kind is specified, only returns true if the brand matches that kind.\n * Accepts a single kind or an array of kinds for multi-kind matching.\n * @param value - The value to check\n * @param kind - Optional kind or kinds to match against\n * @returns True if the value has the SDK brand symbol (and matches kind if specified)\n */\nexport function isSdkBranded(\n value: unknown,\n kind?: SdkBrandKind | readonly SdkBrandKind[],\n): boolean {\n if (value === null || typeof value !== \"object\" || !(SDK_BRAND in value)) return false;\n const stored = (value as Record<symbol, unknown>)[SDK_BRAND];\n // No kind filter → any brand matches. Legacy `true` brand → matches any kind.\n return (\n kind === undefined ||\n stored === true ||\n (Array.isArray(kind) ? kind.includes(stored as SdkBrandKind) : stored === kind)\n );\n}\n"],"mappings":";AAEA,MAAa,YAA2B,OAAO,IAAI,qBAAqB;;;;;;;;;AAmBxE,SAAgB,WAA6B,OAAU,MAAuB;CAC5E,OAAO,eAAe,OAAO,WAAW;EACtC,OAAO;EACP,YAAY;EACZ,cAAc;EACd,UAAU;CACZ,CAAC;CACD,OAAO;AACT;;;;;;;;;AAUA,SAAgB,aACd,OACA,MACS;CACT,IAAI,UAAU,QAAQ,OAAO,UAAU,YAAY,EAAE,aAAa,QAAQ,OAAO;CACjF,MAAM,SAAU,MAAkC;CAElD,OACE,SAAS,UACT,WAAW,SACV,MAAM,QAAQ,IAAI,IAAI,KAAK,SAAS,MAAsB,IAAI,WAAW;AAE9E"}
1
+ {"version":3,"file":"brand-Eo4pLXPJ.mjs","names":[],"sources":["../src/utils/brand.ts"],"sourcesContent":["// Symbol.for ensures the same symbol is returned across different ESM module instances,\n// avoiding identity mismatches when multiple copies of the SDK are loaded.\nexport const SDK_BRAND: unique symbol = Symbol.for(\"tailor-platform/sdk\");\n\nexport type SdkBrandKind =\n | \"tailordb-type\"\n | \"resolver\"\n | \"executor\"\n | \"workflow\"\n | \"workflow-job\"\n | \"wait-point\"\n | \"execution-policy\"\n | \"http-adapter\";\n\n/**\n * Adds a non-enumerable SDK brand symbol to the given object (in-place).\n * The brand stores the kind so service loaders can distinguish between\n * different SDK object types (e.g. a type loader skips executors).\n * @param value - The object to brand\n * @param kind - The kind of SDK object\n * @returns The same object with the brand applied\n */\nexport function brandValue<T extends object>(value: T, kind: SdkBrandKind): T {\n Object.defineProperty(value, SDK_BRAND, {\n value: kind,\n enumerable: false,\n configurable: false,\n writable: false,\n });\n return value;\n}\n\n/**\n * Checks whether the given value has been branded by the SDK.\n * When kind is specified, only returns true if the brand matches that kind.\n * Accepts a single kind or an array of kinds for multi-kind matching.\n * @param value - The value to check\n * @param kind - Optional kind or kinds to match against\n * @returns True if the value has the SDK brand symbol (and matches kind if specified)\n */\nexport function isSdkBranded(\n value: unknown,\n kind?: SdkBrandKind | readonly SdkBrandKind[],\n): boolean {\n if (value === null || typeof value !== \"object\" || !(SDK_BRAND in value)) return false;\n const stored = (value as Record<symbol, unknown>)[SDK_BRAND];\n // No kind filter → any brand matches. Legacy `true` brand → matches any kind.\n return (\n kind === undefined ||\n stored === true ||\n (Array.isArray(kind) ? kind.includes(stored as SdkBrandKind) : stored === kind)\n );\n}\n"],"mappings":";AAEA,MAAa,YAA2B,OAAO,IAAI,qBAAqB;;;;;;;;;AAoBxE,SAAgB,WAA6B,OAAU,MAAuB;CAC5E,OAAO,eAAe,OAAO,WAAW;EACtC,OAAO;EACP,YAAY;EACZ,cAAc;EACd,UAAU;CACZ,CAAC;CACD,OAAO;AACT;;;;;;;;;AAUA,SAAgB,aACd,OACA,MACS;CACT,IAAI,UAAU,QAAQ,OAAO,UAAU,YAAY,EAAE,aAAa,QAAQ,OAAO;CACjF,MAAM,SAAU,MAAkC;CAElD,OACE,SAAS,UACT,WAAW,SACV,MAAM,QAAQ,IAAI,IAAI,KAAK,SAAS,MAAsB,IAAI,WAAW;AAE9E"}
@@ -21,21 +21,6 @@ declare const DB_TYPES_FILE_NAME = "db.ts";
21
21
  * Migration file type
22
22
  */
23
23
  type MigrationFileType = "schema" | "diff" | "migrate" | "db";
24
- /**
25
- * Information about a migration
26
- */
27
- interface MigrationInfo {
28
- /** Migration number (e.g., 1, 2, 3) */
29
- number: number;
30
- /** Migration number as 4-digit string (e.g., "0001", "0002") */
31
- numberStr: string;
32
- /** Migration file type */
33
- type: MigrationFileType;
34
- /** Path to migration file */
35
- path: string;
36
- /** Parsed content (schema snapshot or diff) */
37
- content: SchemaSnapshot | MigrationDiff;
38
- }
39
24
  /**
40
25
  * Get migration directory path for a given number
41
26
  * @param {string} migrationsDir - Base migrations directory path
@@ -110,4 +95,4 @@ declare function compareSnapshots(previous: SchemaSnapshot, current: SchemaSnaps
110
95
  */
111
96
  declare function compareLocalTypesWithSnapshot(snapshot: SchemaSnapshot, localTypes: Record<string, TailorDBSnapshotType>, namespace: string): MigrationDiff;
112
97
  //#endregion
113
- export { DB_TYPES_FILE_NAME, DIFF_FILE_NAME, INITIAL_SCHEMA_NUMBER, MIGRATE_FILE_NAME, MigrationFileType, MigrationInfo, type NormalizedSchemaSnapshot, SCHEMA_FILE_NAME, type SchemaSnapshot, type SnapshotFieldConfig, type TailorDBSnapshotType, compareLocalTypesWithSnapshot, compareSnapshots, createSnapshotFromLocalTypes, getLatestMigrationNumber, getMigrationDirPath, getMigrationFilePath, getMigrationFiles, getNextMigrationNumber, reconstructSnapshotFromMigrations };
98
+ export { DB_TYPES_FILE_NAME, DIFF_FILE_NAME, INITIAL_SCHEMA_NUMBER, MIGRATE_FILE_NAME, MigrationFileType, type NormalizedSchemaSnapshot, SCHEMA_FILE_NAME, type SchemaSnapshot, type SnapshotFieldConfig, type TailorDBSnapshotType, compareLocalTypesWithSnapshot, compareSnapshots, createSnapshotFromLocalTypes, getLatestMigrationNumber, getMigrationDirPath, getMigrationFilePath, getMigrationFiles, getNextMigrationNumber, reconstructSnapshotFromMigrations };
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
- import { C as CustomDomainStatus, R as FunctionExecution_Type, mt as AuthInvokerSchema, xt as PATScope } from "../service_pb-CIrhGwHk.mjs";
2
+ import { B as FunctionExecution_Type, Ct as PATScope, T as CustomDomainStatus, gt as AuthInvokerSchema } from "../service_pb-4unFyubn.mjs";
3
3
  import { t as assertDefined } from "../assert-DBxo8jPo.mjs";
4
4
  import { n as logger, r as styles } from "../logger-BEiZZ3qT.mjs";
5
- import { $t as compareSnapshotWithRemote, A as listCommand$12, An as apiCommand, Bn as pagedLogArgs, C as listCommand$13, Cn as hasChanges, Dn as PluginManager, Dt as listCommand$6, E as waitCommand, En as sdkNameLabelKey, F as generateCommand$1, Fn as configArg, G as removeCommand$1, Gt as deploy, H as extractOwnedNamespaces, Hn as toPageDirection, Ht as formatKeyValueTable, I as generateMigrationScript, In as confirmationArgs, It as getCommand$6, K as updateCommand$3, Kt as ensureConfigId, L as writeDbTypesFile, Ln as deploymentArgs, Mn as assertWritable, N as truncateCommand, Nn as defineAppCommand, O as resumeCommand, On as generateUserTypes, Pn as commonArgs, Pt as startCommand, Q as getCommand$5, Qt as parseMigrationLabelNumber, R as getConfiguredEditorCommand, Rn as isVerbose, Rt as executionsCommand, Sn as formatMigrationDiff, T as healthCommand, Tn as resourceTrn, Tt as triggerCommand, U as logBetaWarning, Un as workspaceArgs, Ut as getCommand$1, V as showCommand, Vn as paginationArgs, Vt as functionExecutionStatusToString, X as listCommand$11, Xt as MIGRATION_LABEL_KEY, Y as treeCommand, Zt as handleOptionalToRequiredError, _n as loadDiff, b as createCommand$4, bn as parseMigrationNumberArg, c as listCommand$14, cn as compareLocalTypesWithSnapshot, ct as createCommand$3, dn as getLatestMigrationNumber, en as generateAllTypeManifestsFromSnapshot, et as updateCommand$2, f as restoreCommand, ft as getCommand$3, g as getCommand$7, gn as isValidMigrationNumber, gt as listCommand$8, ht as tokenCommand, i as updateCommand$4, in as INITIAL_SCHEMA_NUMBER, it as getCommand$4, jt as jobsCommand, kn as prompt, m as listCommand$15, mn as getMigrationFiles, nt as listCommand$10, o as removeCommand, ot as deleteCommand$4, pn as getMigrationFilePath, qt as executeScript, r as queryCommand, sn as assertValidMigrationFiles, t as isNativeTypeScriptRuntime, tn as protoGqlPermission, u as inviteCommand, un as createSnapshotFromLocalTypes, ut as listCommand$9, v as deleteCommand$5, vn as reconstructSnapshotFromMigrations, vt as generate, wn as getNamespacesWithMigrations, wt as webhookCommand, xt as getCommand$2, yn as formatMigrationNumber, yt as listCommand$7, z as openInConfiguredEditor, zn as multiConfigArg } from "../runtime-Zkg3SUwi.mjs";
6
- import { $ as initOAuth2Client, A as hasUserTokenEntry, B as resolveUserTokenKey, C as getDistDir, D as deleteUserTokens, E as loadConfig, G as fetchAll, H as writePlatformConfig, I as loadStoredUserTokens, J as fetchPlatformMachineUserToken, L as loadWorkspaceId, N as loadConsoleBaseUrl, O as fetchLatestToken, P as loadMachineUserName, R as platformConfigFromProfile, U as closeConnectionPool, V as saveUserTokens, W as defaultPlatformBaseUrl, Y as fetchUserInfo, _ as composeFunctionTreeshakeOptions, a as resolveInlineSourcemap, et as initOperatorClient, g as platformBundleDefinePlugin, j as loadAccessToken, k as hasAnyUserTokenEntry, l as INVOKER_EXPR, o as WorkflowJobSchema, q as fetchPaged, s as ResolverSchema, t as defineApplication, tt as isDefaultPlatform, v as createLogLevelTreeshakeOptions, w as hashContent$1, y as resolveBundleLogLevel, z as readPlatformConfig } from "../application-DwmoI6ZQ.mjs";
5
+ import { $t as compareSnapshotWithRemote, A as listCommand$12, An as apiCommand, Bn as pagedLogArgs, C as listCommand$13, Cn as hasChanges, Dn as PluginManager, Dt as listCommand$6, E as waitCommand, En as sdkNameLabelKey, F as generateCommand$1, Fn as configArg, G as removeCommand$1, Gt as deploy, H as extractOwnedNamespaces, Hn as toPageDirection, Ht as formatKeyValueTable, I as generateMigrationScript, In as confirmationArgs, It as getCommand$6, K as updateCommand$3, Kt as ensureConfigId, L as writeDbTypesFile, Ln as deploymentArgs, Mn as assertWritable, N as truncateCommand, Nn as defineAppCommand, O as resumeCommand, On as generateUserTypes, Pn as commonArgs, Pt as startCommand, Q as getCommand$5, Qt as parseMigrationLabelNumber, R as getConfiguredEditorCommand, Rn as isVerbose, Rt as executionsCommand, Sn as formatMigrationDiff, T as healthCommand, Tn as resourceTrn, Tt as triggerCommand, U as logBetaWarning, Un as workspaceArgs, Ut as getCommand$1, V as showCommand, Vn as paginationArgs, Vt as functionExecutionStatusToString, X as listCommand$11, Xt as MIGRATION_LABEL_KEY, Y as treeCommand, Zt as handleOptionalToRequiredError, _n as loadDiff, b as createCommand$4, bn as parseMigrationNumberArg, c as listCommand$14, cn as compareLocalTypesWithSnapshot, ct as createCommand$3, dn as getLatestMigrationNumber, en as generateAllTypeManifestsFromSnapshot, et as updateCommand$2, f as restoreCommand, ft as getCommand$3, g as getCommand$7, gn as isValidMigrationNumber, gt as listCommand$8, ht as tokenCommand, i as updateCommand$4, in as INITIAL_SCHEMA_NUMBER, it as getCommand$4, jt as jobsCommand, kn as prompt, m as listCommand$15, mn as getMigrationFiles, nt as listCommand$10, o as removeCommand, ot as deleteCommand$4, pn as getMigrationFilePath, qt as executeScript, r as queryCommand, sn as assertValidMigrationFiles, t as isNativeTypeScriptRuntime, tn as protoGqlPermission, u as inviteCommand, un as createSnapshotFromLocalTypes, ut as listCommand$9, v as deleteCommand$5, vn as reconstructSnapshotFromMigrations, vt as generate, wn as getNamespacesWithMigrations, wt as webhookCommand, xt as getCommand$2, yn as formatMigrationNumber, yt as listCommand$7, z as openInConfiguredEditor, zn as multiConfigArg } from "../runtime-CJ5usBOu.mjs";
6
+ import { A as hasAnyUserTokenEntry, B as readPlatformConfig, D as loadConfig, F as loadMachineUserName, G as defaultPlatformBaseUrl, H as saveUserTokens, K as fetchAll, L as loadStoredUserTokens, M as loadAccessToken, O as deleteUserTokens, P as loadConsoleBaseUrl, R as loadWorkspaceId, T as hashContent$1, U as writePlatformConfig, V as resolveUserTokenKey, W as closeConnectionPool, X as fetchPlatformMachineUserToken, Y as fetchPaged, Z as fetchUserInfo, _ as platformBundleDefinePlugin, a as resolveInlineSourcemap, b as resolveBundleLogLevel, c as ResolverSchema, et as getOrNull, it as isDefaultPlatform, j as hasUserTokenEntry, k as fetchLatestToken, nt as initOAuth2Client, q as fetchAllTolerant, rt as initOperatorClient, s as WorkflowJobSchema, t as defineApplication, u as INVOKER_EXPR, v as composeFunctionTreeshakeOptions, w as getDistDir, y as createLogLevelTreeshakeOptions, z as platformConfigFromProfile } from "../application-DYshsH-K.mjs";
7
7
  import { n as ExecutorSchema } from "../service-BCRJ-3NV.mjs";
8
8
  import { t as multiline } from "../multiline-sfHpTZZK.mjs";
9
- import { r as isPluginGeneratedType } from "../seed-DoMTMLcm.mjs";
9
+ import { r as isPluginGeneratedType } from "../seed-fm0LeYP2.mjs";
10
10
  import { t as readPackageJson } from "../package-json-8b0O9TlX.mjs";
11
11
  import { i as userAgent } from "../secret-file-VSVGy1V0.mjs";
12
12
  import { n as isCLIError } from "../errors-Dtf2WPaW.mjs";
@@ -1288,7 +1288,7 @@ async function detectFunctionType(options) {
1288
1288
  const rawInput = module.default.input;
1289
1289
  let inputSchema;
1290
1290
  if (rawInput) {
1291
- const { t } = await import("../types-qhFZ8y9B.mjs");
1291
+ const { t } = await import("../types-KlawuVKa.mjs");
1292
1292
  inputSchema = t.object(rawInput);
1293
1293
  }
1294
1294
  return {
@@ -4852,7 +4852,7 @@ function buildViewerHtml(options) {
4852
4852
  const currentSchemaScript = options.currentSchema === void 0 ? "" : `\n <script type="application/json" id="erd-current-schema">${JSON.stringify(options.currentSchema).replaceAll("<", "\\u003c")}<\/script>`;
4853
4853
  const diffScript = options.diff === void 0 ? "" : `\n <script type="application/json" id="erd-diff">${JSON.stringify(options.diff).replaceAll("<", "\\u003c")}<\/script>`;
4854
4854
  const inlineScript = `<script type="module">\n${appJs.replace(/<\/script/gi, "<\\/script")}\n<\/script>`;
4855
- return html.replace("<title>TailorDB ERD</title>", `<title>${escapeHtml(options.title ?? "TailorDB ERD")}</title>`).replace(STYLES_LINK, `<style>\n${css}\n</style>`).replace(APP_SCRIPT, `${embedScript}${currentSchemaScript}${diffScript}\n ${inlineScript}`);
4855
+ return html.replace("<title>TailorDB ERD</title>", () => `<title>${escapeHtml(options.title ?? "TailorDB ERD")}</title>`).replace(STYLES_LINK, () => `<style>\n${css}\n</style>`).replace(APP_SCRIPT, () => `${embedScript}${currentSchemaScript}${diffScript}\n ${inlineScript}`);
4856
4856
  }
4857
4857
  /**
4858
4858
  * Write the self-contained TailorDB ERD viewer to `<distDir>/index.html`.
@@ -6023,19 +6023,14 @@ const statusCommand = defineAppCommand({
6023
6023
  //#endregion
6024
6024
  //#region src/cli/commands/tailordb/migrate/sync.ts
6025
6025
  async function fetchRemoteGqlPermissions(client, workspaceId, namespace) {
6026
- return fetchAll(async (pageToken, maxPageSize) => {
6027
- try {
6028
- const { permissions, nextPageToken } = await client.listTailorDBGQLPermissions({
6029
- workspaceId,
6030
- namespaceName: namespace,
6031
- pageToken,
6032
- pageSize: maxPageSize
6033
- });
6034
- return [permissions, nextPageToken];
6035
- } catch (error) {
6036
- if (error instanceof ConnectError && error.code === Code.NotFound) return [[], ""];
6037
- throw error;
6038
- }
6026
+ return fetchAllTolerant(async (pageToken, maxPageSize) => {
6027
+ const { permissions, nextPageToken } = await client.listTailorDBGQLPermissions({
6028
+ workspaceId,
6029
+ namespaceName: namespace,
6030
+ pageToken,
6031
+ pageSize: maxPageSize
6032
+ });
6033
+ return [permissions, nextPageToken];
6039
6034
  });
6040
6035
  }
6041
6036
  async function fetchRemoteTypes(client, workspaceId, namespace) {
@@ -6075,7 +6070,7 @@ async function fetchRemoteTypes(client, workspaceId, namespace) {
6075
6070
  async function assertMigrationsReproduceLocalTypes(loaded, target) {
6076
6071
  const { config, plugins } = loaded;
6077
6072
  const pluginManager = plugins.length > 0 ? new PluginManager(plugins) : void 0;
6078
- const { defineApplication, generatePluginFilesIfNeeded } = await import("../application-BndtMTFY.mjs");
6073
+ const { defineApplication, generatePluginFilesIfNeeded } = await import("../application-BJKNlv8c.mjs");
6079
6074
  const application = defineApplication({
6080
6075
  config,
6081
6076
  pluginManager
@@ -6122,21 +6117,15 @@ async function assertMigrationsReproduceLocalTypes(loaded, target) {
6122
6117
  * @returns Existing labels and the parsed current migration number
6123
6118
  */
6124
6119
  async function fetchRemoteMigrationState(client, trn) {
6125
- try {
6120
+ const labels = (await getOrNull(async () => {
6126
6121
  const { metadata } = await client.getMetadata({ trn });
6127
- const labels = metadata?.labels ?? {};
6128
- const label = labels[MIGRATION_LABEL_KEY];
6129
- return {
6130
- labels,
6131
- current: label ? parseMigrationLabelNumber(label) : null
6132
- };
6133
- } catch (error) {
6134
- if (error instanceof ConnectError && error.code === Code.NotFound) return {
6135
- labels: {},
6136
- current: null
6137
- };
6138
- throw error;
6139
- }
6122
+ return metadata;
6123
+ }))?.labels ?? {};
6124
+ const label = labels[MIGRATION_LABEL_KEY];
6125
+ return {
6126
+ labels,
6127
+ current: label ? parseMigrationLabelNumber(label) : null
6128
+ };
6140
6129
  }
6141
6130
  function selectTargetNamespace(namespacesWithMigrations, requested) {
6142
6131
  if (namespacesWithMigrations.length === 0) throw new Error("No TailorDB services with migrations configuration found");