@tailor-platform/sdk 1.25.1 → 1.25.3

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 +36 -0
  2. package/dist/{application-iRp2OYMz.mjs → application-91Th6tm6.mjs} +127 -128
  3. package/dist/application-91Th6tm6.mjs.map +1 -0
  4. package/dist/application-DegTCDd8.mjs +9 -0
  5. package/dist/{brand-BOaOlsiP.mjs → brand-GZnI4eYb.mjs} +1 -1
  6. package/dist/{brand-BOaOlsiP.mjs.map → brand-GZnI4eYb.mjs.map} +1 -1
  7. package/dist/chunk-Cz-A8uMR.mjs +3 -0
  8. package/dist/cli/index.d.mts +2 -3
  9. package/dist/cli/index.mjs +172 -216
  10. package/dist/cli/index.mjs.map +1 -1
  11. package/dist/cli/lib.d.mts +706 -1108
  12. package/dist/cli/lib.mjs +28 -16
  13. package/dist/cli/lib.mjs.map +1 -1
  14. package/dist/cli/skills.mjs +2 -1
  15. package/dist/cli/skills.mjs.map +1 -1
  16. package/dist/configure/index.d.mts +5 -5
  17. package/dist/configure/index.mjs +4 -3
  18. package/dist/configure/index.mjs.map +1 -1
  19. package/dist/{enum-constants-BxdLbhsW.mjs → enum-constants-6uK0VI_s.mjs} +1 -1
  20. package/dist/{enum-constants-BxdLbhsW.mjs.map → enum-constants-6uK0VI_s.mjs.map} +1 -1
  21. package/dist/{env-jndw86T4.d.mts → env-uBeVwE9B.d.mts} +4 -7
  22. package/dist/{file-utils-C2r3AVbI.mjs → file-utils-2T9w20FP.mjs} +1 -1
  23. package/dist/{file-utils-C2r3AVbI.mjs.map → file-utils-2T9w20FP.mjs.map} +1 -1
  24. package/dist/{index-Do7zo7z-.d.mts → index-BD-K97-C.d.mts} +2 -2
  25. package/dist/{index-BuWllBxZ.d.mts → index-Bu12qy3m.d.mts} +25 -22
  26. package/dist/{index-VZq4IAEK.d.mts → index-CT53egux.d.mts} +2 -2
  27. package/dist/{index-DZRZdh71.d.mts → index-D1J5SfyK.d.mts} +2 -2
  28. package/dist/{index-DoxGF8-i.d.mts → index-cZilKprY.d.mts} +2 -2
  29. package/dist/{interceptor-DVy32eIG.mjs → interceptor-BPiIBTk_.mjs} +2 -1
  30. package/dist/{interceptor-DVy32eIG.mjs.map → interceptor-BPiIBTk_.mjs.map} +1 -1
  31. package/dist/{job-BQDunsd7.mjs → job-DdfW7vH3.mjs} +3 -3
  32. package/dist/{job-BQDunsd7.mjs.map → job-DdfW7vH3.mjs.map} +1 -1
  33. package/dist/kysely/index.d.mts +3 -4
  34. package/dist/kysely/index.mjs +1 -0
  35. package/dist/kysely/index.mjs.map +1 -1
  36. package/dist/{kysely-type-DzLBuVp6.mjs → kysely-type-cMNbsQ6k.mjs} +1 -1
  37. package/dist/{kysely-type-DzLBuVp6.mjs.map → kysely-type-cMNbsQ6k.mjs.map} +1 -1
  38. package/dist/package-json-Bj76LPsV.mjs +4 -0
  39. package/dist/{package-json-DnbGCOkg.mjs → package-json-CVUv8Y9T.mjs} +1 -1
  40. package/dist/{package-json-DnbGCOkg.mjs.map → package-json-CVUv8Y9T.mjs.map} +1 -1
  41. package/dist/plugin/builtin/enum-constants/index.d.mts +1 -2
  42. package/dist/plugin/builtin/enum-constants/index.mjs +2 -1
  43. package/dist/plugin/builtin/file-utils/index.d.mts +1 -2
  44. package/dist/plugin/builtin/file-utils/index.mjs +2 -1
  45. package/dist/plugin/builtin/kysely-type/index.d.mts +1 -2
  46. package/dist/plugin/builtin/kysely-type/index.mjs +2 -1
  47. package/dist/plugin/builtin/seed/index.d.mts +1 -2
  48. package/dist/plugin/builtin/seed/index.mjs +2 -1
  49. package/dist/plugin/index.d.mts +2 -3
  50. package/dist/plugin/index.mjs +5 -4
  51. package/dist/plugin/index.mjs.map +1 -1
  52. package/dist/{plugin-3sT6Tcq0.d.mts → plugin-zY5wvV82.d.mts} +117 -225
  53. package/dist/{query-D3UyoG68.mjs → query-BpppEOzu.mjs} +502 -541
  54. package/dist/query-BpppEOzu.mjs.map +1 -0
  55. package/dist/{schema-Fbfeq9gi.mjs → schema-BePzTFBV.mjs} +9 -9
  56. package/dist/schema-BePzTFBV.mjs.map +1 -0
  57. package/dist/seed/index.d.mts +1 -4
  58. package/dist/seed/index.mjs +1 -0
  59. package/dist/seed/index.mjs.map +1 -1
  60. package/dist/{seed-DkKAheSe.mjs → seed-CCVRLibh.mjs} +24 -10
  61. package/dist/seed-CCVRLibh.mjs.map +1 -0
  62. package/dist/{telemetry-d_lgTL33.mjs → telemetry-0w8OupuQ.mjs} +2 -2
  63. package/dist/{telemetry-d_lgTL33.mjs.map → telemetry-0w8OupuQ.mjs.map} +1 -1
  64. package/dist/telemetry-DDQZRqHK.mjs +4 -0
  65. package/dist/utils/test/index.d.mts +2 -3
  66. package/dist/utils/test/index.mjs +3 -2
  67. package/dist/utils/test/index.mjs.map +1 -1
  68. package/dist/{app-config-QzNOFnEy.d.mts → workflow.generated-v1LXRuB6.d.mts} +19 -22
  69. package/docs/cli/application.md +73 -33
  70. package/docs/cli/auth.md +56 -24
  71. package/docs/cli/completion.md +6 -0
  72. package/docs/cli/executor.md +73 -36
  73. package/docs/cli/function.md +30 -14
  74. package/docs/cli/secret.md +93 -41
  75. package/docs/cli/staticwebsite.md +38 -17
  76. package/docs/cli/tailordb.md +106 -48
  77. package/docs/cli/user.md +74 -10
  78. package/docs/cli/workflow.md +70 -39
  79. package/docs/cli/workspace.md +166 -60
  80. package/docs/cli-reference.md +22 -12
  81. package/docs/services/workflow.md +26 -0
  82. package/package.json +7 -6
  83. package/dist/application-B4ORumjE.mjs +0 -8
  84. package/dist/application-iRp2OYMz.mjs.map +0 -1
  85. package/dist/package-json-BKA36WTo.mjs +0 -3
  86. package/dist/query-D3UyoG68.mjs.map +0 -1
  87. package/dist/schema-Fbfeq9gi.mjs.map +0 -1
  88. package/dist/seed-DkKAheSe.mjs.map +0 -1
  89. package/dist/telemetry-J6dpByo2.mjs +0 -3
@@ -1,8 +1,8 @@
1
- import { t as db } from "./schema-Fbfeq9gi.mjs";
2
- import { $ as AuthSCIMAttribute_Mutability, A as platformBaseUrl, B as TailorDBType_Permission_Permit, C as readPlatformConfig, E as fetchMachineUserToken, F as WorkflowJobExecution_Status, H as PipelineResolver_OperationType, I as TailorDBGQLPermission_Action, J as ExecutorTriggerType, K as ExecutorJobStatus, L as TailorDBGQLPermission_Operator, M as userAgent, N as WorkspacePlatformUserRole, P as WorkflowExecution_Status, Q as AuthOAuth2Client_GrantType, R as TailorDBGQLPermission_Permit, S as loadWorkspaceId, T as fetchAll, U as IdPLang, V as TailorDBType_PermitAction, W as FunctionExecution_Status, X as AuthInvokerSchema, Y as AuthIDPConfig_AuthType, Z as AuthOAuth2Client_ClientType, _ as hashFile, a as loadConfig, at as UserProfileProviderConfig_UserProfileProviderType, b as loadFolderId, ct as Condition_Operator, d as TailorDBTypeSchema, dt as ApplicationSchemaUpdateAttemptStatus, et as AuthSCIMAttribute_Type, f as stringifyFunction, ft as Subgraph_ServiceType, g as getDistDir, h as createBundleCache, ht as symbols, it as TenantProviderConfig_TenantProviderType, j as resolveStaticWebsiteUrls, k as initOperatorClient, l as OAuth2ClientSchema, lt as FilterSchema, m as loadFilesWithIgnores, mt as styles, n as generatePluginFilesIfNeeded, nt as AuthSCIMConfig_AuthorizationType, ot as GetApplicationSchemaHealthResponse_ApplicationSchemaHealthStatus, p as tailorUserMap, pt as logger, q as ExecutorTargetType, r as loadApplication, s as createExecutorService, st as ConditionSchema, t as defineApplication, tt as AuthSCIMAttribute_Uniqueness, ut as PageDirection, w as writePlatformConfig, x as loadOrganizationId, y as loadAccessToken, z as TailorDBType_Permission_Operator } from "./application-iRp2OYMz.mjs";
3
- import { t as readPackageJson } from "./package-json-DnbGCOkg.mjs";
4
- import { r as withSpan } from "./telemetry-d_lgTL33.mjs";
5
- import { arg, defineCommand, runCommand } from "politty";
1
+ import { t as db } from "./schema-BePzTFBV.mjs";
2
+ import { $ as AuthSCIMAttribute_Uniqueness, A as userAgent, B as PipelineResolver_OperationType, C as fetchAll, D as initOperatorClient, F as TailorDBGQLPermission_Operator, G as ExecutorTargetType, H as FunctionExecution_Status, I as TailorDBGQLPermission_Permit, J as AuthInvokerSchema, K as ExecutorTriggerType, L as TailorDBType_Permission_Operator, M as WorkflowExecution_Status, N as WorkflowJobExecution_Status, O as platformBaseUrl, P as TailorDBGQLPermission_Action, Q as AuthSCIMAttribute_Type, R as TailorDBType_Permission_Permit, S as writePlatformConfig, V as IdPLang, W as ExecutorJobStatus, X as AuthOAuth2Client_GrantType, Y as AuthOAuth2Client_ClientType, Z as AuthSCIMAttribute_Mutability, _ as hashFile, a as loadConfig, at as ConditionSchema, b as loadWorkspaceId, ct as PageDirection, d as TailorDBTypeSchema, dt as CIPromptError, et as AuthSCIMConfig_AuthorizationType, f as stringifyFunction, ft as logger, g as getDistDir, h as createBundleCache, it as GetApplicationSchemaHealthResponse_ApplicationSchemaHealthStatus, j as WorkspacePlatformUserRole, k as resolveStaticWebsiteUrls, l as OAuth2ClientSchema, lt as ApplicationSchemaUpdateAttemptStatus, m as loadFilesWithIgnores, mt as symbols, n as generatePluginFilesIfNeeded, nt as TenantProviderConfig_TenantProviderType, ot as Condition_Operator, p as tailorUserMap, pt as styles, q as AuthIDPConfig_AuthType, r as loadApplication, rt as UserProfileProviderConfig_UserProfileProviderType, s as createExecutorService, st as FilterSchema, t as defineApplication, ut as Subgraph_ServiceType, w as fetchMachineUserToken, x as readPlatformConfig, y as loadAccessToken, z as TailorDBType_PermitAction } from "./application-91Th6tm6.mjs";
3
+ import { t as readPackageJson } from "./package-json-CVUv8Y9T.mjs";
4
+ import { r as withSpan } from "./telemetry-0w8OupuQ.mjs";
5
+ import { arg, createDefineCommand, defineCommand, runCommand } from "politty";
6
6
  import { z } from "zod";
7
7
  import * as fs$1 from "node:fs";
8
8
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
@@ -25,6 +25,9 @@ import * as rolldown from "rolldown";
25
25
  import * as fs from "node:fs/promises";
26
26
  import { glob } from "node:fs/promises";
27
27
  import { create, fromJson, toJson } from "@bufbuild/protobuf";
28
+ import { ExitPromptError } from "@inquirer/core";
29
+ import { confirm, input } from "@inquirer/prompts";
30
+ import { isCI } from "std-env";
28
31
  import ora from "ora";
29
32
  import { setTimeout as setTimeout$1 } from "timers/promises";
30
33
  import { spawn } from "node:child_process";
@@ -34,44 +37,6 @@ import { createInterface } from "node:readline/promises";
34
37
  import { astVisitor, parse, toSql } from "pgsql-ast-parser";
35
38
  import { parse as parse$1 } from "@0no-co/graphql.web";
36
39
 
37
- //#region src/cli/shared/errors.ts
38
- /**
39
- * Format CLI error for output
40
- * @param error - CLIError instance to format
41
- * @returns Formatted error message
42
- */
43
- function formatError(error) {
44
- const parts = [chalk.red(`Error${error.code ? ` [${error.code}]` : ""}: ${error.message}`)];
45
- if (error.details) parts.push(`\n ${chalk.gray("Details:")} ${error.details}`);
46
- if (error.suggestion) parts.push(`\n ${chalk.cyan("Suggestion:")} ${error.suggestion}`);
47
- if (error.command) parts.push(`\n ${chalk.gray("Help:")} Run \`tailor-sdk ${error.command} --help\` for usage information.`);
48
- return parts.join("");
49
- }
50
- /**
51
- * Create a CLI error with formatted output
52
- * @param options - Options to construct a CLIError
53
- * @returns Constructed CLIError instance
54
- */
55
- function createCLIError(options) {
56
- const error = new Error(options.message);
57
- error.name = "CLIError";
58
- error.code = options.code;
59
- error.details = options.details;
60
- error.suggestion = options.suggestion;
61
- error.command = options.command;
62
- error.format = () => formatError(error);
63
- return error;
64
- }
65
- /**
66
- * Type guard to check if an error is a CLIError
67
- * @param error - Error to check
68
- * @returns True if the error is a CLIError
69
- */
70
- function isCLIError(error) {
71
- return error instanceof Error && error.name === "CLIError";
72
- }
73
-
74
- //#endregion
75
40
  //#region src/cli/shared/args.ts
76
41
  const unitToMs = {
77
42
  ms: 1,
@@ -151,9 +116,24 @@ const commonArgs = {
151
116
  completion: {
152
117
  type: "file",
153
118
  matcher: [".env.*", ".env"]
119
+ },
120
+ effect: (_value, { args }) => {
121
+ loadEnvFiles(args["env-file"], args["env-file-if-exists"]);
154
122
  }
155
123
  }),
156
- verbose: arg(z.boolean().default(false), { description: "Enable verbose logging" })
124
+ verbose: arg(z.boolean().default(false), {
125
+ description: "Enable verbose logging",
126
+ effect: (value) => {
127
+ verboseMode = value;
128
+ }
129
+ }),
130
+ json: arg(z.boolean().default(false), {
131
+ alias: "j",
132
+ description: "Output as JSON",
133
+ effect: (value) => {
134
+ logger.jsonMode = value;
135
+ }
136
+ })
157
137
  };
158
138
  /**
159
139
  * Arguments for commands that require workspace context
@@ -162,11 +142,13 @@ const workspaceArgs = {
162
142
  "workspace-id": arg(z.string().optional(), {
163
143
  alias: "w",
164
144
  description: "Workspace ID",
145
+ env: "TAILOR_PLATFORM_WORKSPACE_ID",
165
146
  completion: { type: "none" }
166
147
  }),
167
148
  profile: arg(z.string().optional(), {
168
149
  alias: "p",
169
150
  description: "Workspace profile",
151
+ env: "TAILOR_PLATFORM_PROFILE",
170
152
  completion: { type: "none" }
171
153
  })
172
154
  };
@@ -176,6 +158,7 @@ const workspaceArgs = {
176
158
  const configArg = { config: arg(z.string().default("tailor.config.ts"), {
177
159
  alias: "c",
178
160
  description: "Path to SDK config file",
161
+ env: "TAILOR_PLATFORM_SDK_CONFIG_PATH",
179
162
  completion: {
180
163
  type: "file",
181
164
  extensions: ["ts"]
@@ -195,44 +178,24 @@ const confirmationArgs = { yes: arg(z.boolean().default(false), {
195
178
  alias: "y",
196
179
  description: "Skip confirmation prompts"
197
180
  }) };
181
+ let verboseMode = false;
198
182
  /**
199
- * Arguments for JSON output
183
+ * Returns whether verbose mode is enabled.
184
+ * Used by the global cleanup handler which doesn't have access to parsed args.
185
+ * @returns Whether verbose mode is enabled
200
186
  */
201
- const jsonArgs = { json: arg(z.boolean().default(false), {
202
- alias: "j",
203
- description: "Output as JSON"
204
- }) };
187
+ function isVerbose() {
188
+ return verboseMode;
189
+ }
190
+
191
+ //#endregion
192
+ //#region src/cli/shared/command.ts
205
193
  /**
206
- * Wrapper for command handlers that provides:
207
- * - Environment file loading
208
- * - Error handling with formatted output
209
- * - Exit code management
210
- * @template T
211
- * @param handler - Command handler function
212
- * @returns Wrapped handler
194
+ * defineCommand with global args type (CommonArgsType).
195
+ * Use this for leaf commands with `run` to get type-safe access to global args.
196
+ * Parent commands with only `subCommands` can use `defineCommand` from politty directly.
213
197
  */
214
- const withCommonArgs = (handler) => async (args) => {
215
- try {
216
- if ("json" in args && typeof args.json === "boolean") logger.jsonMode = args.json;
217
- loadEnvFiles(args["env-file"], args["env-file-if-exists"]);
218
- const { initTelemetry } = await import("./telemetry-J6dpByo2.mjs");
219
- await initTelemetry();
220
- await handler(args);
221
- } catch (error) {
222
- if (isCLIError(error)) {
223
- logger.log(error.format());
224
- if (args.verbose && error.stack) logger.debug(`\nStack trace:\n${error.stack}`);
225
- } else if (error instanceof Error) {
226
- logger.error(error.message);
227
- if (args.verbose && error.stack) logger.debug(`\nStack trace:\n${error.stack}`);
228
- } else logger.error(`Unknown error: ${error}`);
229
- process.exit(1);
230
- } finally {
231
- const { shutdownTelemetry } = await import("./telemetry-J6dpByo2.mjs");
232
- await shutdownTelemetry();
233
- }
234
- process.exit(0);
235
- };
198
+ const defineAppCommand = createDefineCommand();
236
199
 
237
200
  //#endregion
238
201
  //#region src/cli/commands/api.ts
@@ -267,12 +230,10 @@ async function apiCall(options) {
267
230
  data
268
231
  };
269
232
  }
270
- const apiCommand = defineCommand({
233
+ const apiCommand = defineAppCommand({
271
234
  name: "api",
272
235
  description: "Call Tailor Platform API endpoints directly.",
273
236
  args: z.object({
274
- ...commonArgs,
275
- ...jsonArgs,
276
237
  ...workspaceArgs,
277
238
  body: arg(z.string().default("{}"), {
278
239
  alias: "b",
@@ -283,7 +244,7 @@ const apiCommand = defineCommand({
283
244
  description: "API endpoint to call (e.g., 'GetApplication' or 'tailor.v1.OperatorService/GetApplication')"
284
245
  })
285
246
  }).strict(),
286
- run: withCommonArgs(async (args) => {
247
+ run: async (args) => {
287
248
  const result = await apiCall({
288
249
  profile: args.profile,
289
250
  endpoint: args.endpoint,
@@ -291,7 +252,7 @@ const apiCommand = defineCommand({
291
252
  });
292
253
  if (args.json) logger.log(JSON.stringify(result.data, null, 2));
293
254
  else logger.log(JSON.stringify(result.data, null, 2));
294
- })
255
+ }
295
256
  });
296
257
 
297
258
  //#endregion
@@ -958,11 +919,11 @@ const sdkNameLabelKey = "sdk-name";
958
919
  * @param existingLabels - Existing labels to preserve (optional)
959
920
  * @returns Metadata request
960
921
  */
961
- async function buildMetaRequest(trn$7, appName, existingLabels) {
922
+ async function buildMetaRequest(trn, appName, existingLabels) {
962
923
  const packageJson = await readPackageJson();
963
924
  const sdkVersion = packageJson.version ? `v${packageJson.version.replace(/\./g, "-")}` : "unknown";
964
925
  return {
965
- trn: trn$7,
926
+ trn,
966
927
  labels: {
967
928
  ...existingLabels ?? {},
968
929
  [sdkNameLabelKey]: appName,
@@ -981,10 +942,10 @@ async function buildMetaRequest(trn$7, appName, existingLabels) {
981
942
  * @returns Promise that resolves when applications are applied
982
943
  */
983
944
  async function applyApplication(client, changeSet, phase = "create-update") {
984
- if (phase === "create-update") await Promise.all([...changeSet.creates.map(async (create$1) => {
985
- create$1.request.cors = await resolveStaticWebsiteUrls(client, create$1.request.workspaceId, create$1.request.cors, "CORS");
986
- await client.createApplication(create$1.request);
987
- await client.setMetadata(create$1.metaRequest);
945
+ if (phase === "create-update") await Promise.all([...changeSet.creates.map(async (create) => {
946
+ create.request.cors = await resolveStaticWebsiteUrls(client, create.request.workspaceId, create.request.cors, "CORS");
947
+ await client.createApplication(create.request);
948
+ await client.setMetadata(create.metaRequest);
988
949
  }), ...changeSet.updates.map(async (update) => {
989
950
  update.request.cors = await resolveStaticWebsiteUrls(client, update.request.workspaceId, update.request.cors, "CORS");
990
951
  await client.updateApplication(update.request);
@@ -1043,13 +1004,13 @@ async function planApplication(context) {
1043
1004
  authNamespace = application.config.auth.name;
1044
1005
  const idpConfigs = await fetchAll(async (pageToken, maxPageSize) => {
1045
1006
  try {
1046
- const { idpConfigs: idpConfigs$1, nextPageToken } = await client.listAuthIDPConfigs({
1007
+ const { idpConfigs, nextPageToken } = await client.listAuthIDPConfigs({
1047
1008
  workspaceId,
1048
1009
  namespaceName: authNamespace,
1049
1010
  pageToken,
1050
1011
  pageSize: maxPageSize
1051
1012
  });
1052
- return [idpConfigs$1, nextPageToken];
1013
+ return [idpConfigs, nextPageToken];
1053
1014
  } catch (error) {
1054
1015
  if (error instanceof ConnectError && error.code === Code.NotFound) return [[], ""];
1055
1016
  throw error;
@@ -1142,23 +1103,23 @@ function idpClientSecretName(namespaceName, clientName) {
1142
1103
  async function applyIdP(client, result, phase = "create-update") {
1143
1104
  const { changeSet } = result;
1144
1105
  if (phase === "create-update") {
1145
- await Promise.all([...changeSet.service.creates.map(async (create$1) => {
1146
- await client.createIdPService(create$1.request);
1147
- await client.setMetadata(create$1.metaRequest);
1106
+ await Promise.all([...changeSet.service.creates.map(async (create) => {
1107
+ await client.createIdPService(create.request);
1108
+ await client.setMetadata(create.metaRequest);
1148
1109
  }), ...changeSet.service.updates.map(async (update) => {
1149
1110
  await client.updateIdPService(update.request);
1150
1111
  await client.setMetadata(update.metaRequest);
1151
1112
  })]);
1152
- await Promise.all([...changeSet.client.creates.map(async (create$1) => {
1153
- const resp = await client.createIdPClient(create$1.request);
1154
- const vaultName = idpClientVaultName(create$1.request.namespaceName, create$1.request.client?.name || "");
1155
- const secretName = idpClientSecretName(create$1.request.namespaceName, create$1.request.client?.name || "");
1113
+ await Promise.all([...changeSet.client.creates.map(async (create) => {
1114
+ const resp = await client.createIdPClient(create.request);
1115
+ const vaultName = idpClientVaultName(create.request.namespaceName, create.request.client?.name || "");
1116
+ const secretName = idpClientSecretName(create.request.namespaceName, create.request.client?.name || "");
1156
1117
  await client.createSecretManagerVault({
1157
- workspaceId: create$1.request.workspaceId,
1118
+ workspaceId: create.request.workspaceId,
1158
1119
  secretmanagerVaultName: vaultName
1159
1120
  });
1160
1121
  await client.createSecretManagerSecret({
1161
- workspaceId: create$1.request.workspaceId,
1122
+ workspaceId: create.request.workspaceId,
1162
1123
  secretmanagerVaultName: vaultName,
1163
1124
  secretmanagerSecretName: secretName,
1164
1125
  secretmanagerSecretValue: resp.client?.clientSecret
@@ -1346,8 +1307,8 @@ async function planClients(client, workspaceId, idps, deletedServices) {
1346
1307
  const namespaceName = idp.name;
1347
1308
  const existingClients = clientsByIdp[i];
1348
1309
  const existingNameMap = /* @__PURE__ */ new Map();
1349
- existingClients.forEach((client$1) => {
1350
- existingNameMap.set(client$1.name, client$1.clientSecret);
1310
+ existingClients.forEach((client) => {
1311
+ existingNameMap.set(client.name, client.clientSecret);
1351
1312
  });
1352
1313
  for (const name of idp.clients) if (existingNameMap.has(name)) {
1353
1314
  changeSet.updates.push({
@@ -1379,13 +1340,13 @@ async function planClients(client, workspaceId, idps, deletedServices) {
1379
1340
  const deletedClientsByService = await Promise.all(deletedServices.map((namespaceName) => fetchClients(namespaceName)));
1380
1341
  for (let i = 0; i < deletedServices.length; i++) {
1381
1342
  const namespaceName = deletedServices[i];
1382
- deletedClientsByService[i].forEach((client$1) => {
1343
+ deletedClientsByService[i].forEach((client) => {
1383
1344
  changeSet.deletes.push({
1384
- name: client$1.name,
1345
+ name: client.name,
1385
1346
  request: {
1386
1347
  workspaceId,
1387
1348
  namespaceName,
1388
- name: client$1.name
1349
+ name: client.name
1389
1350
  }
1390
1351
  });
1391
1352
  });
@@ -1422,26 +1383,26 @@ function convertGqlOperationsToDisable(gqlOperations) {
1422
1383
  async function applyAuth(client, result, phase = "create-update") {
1423
1384
  const { changeSet } = result;
1424
1385
  if (phase === "create-update") {
1425
- await Promise.all([...changeSet.service.creates.map(async (create$1) => {
1426
- await client.createAuthService(create$1.request);
1427
- await client.setMetadata(create$1.metaRequest);
1386
+ await Promise.all([...changeSet.service.creates.map(async (create) => {
1387
+ await client.createAuthService(create.request);
1388
+ await client.setMetadata(create.metaRequest);
1428
1389
  }), ...changeSet.service.updates.map(async (update) => {
1429
1390
  await client.updateAuthService(update.request);
1430
1391
  await client.setMetadata(update.metaRequest);
1431
1392
  })]);
1432
- await Promise.all([...changeSet.idpConfig.creates.map(async (create$1) => {
1433
- if (create$1.idpConfig.kind === "BuiltInIdP") create$1.request.idpConfig.config = await protoBuiltinIdPConfig(client, create$1.request.workspaceId, create$1.idpConfig);
1434
- return client.createAuthIDPConfig(create$1.request);
1393
+ await Promise.all([...changeSet.idpConfig.creates.map(async (create) => {
1394
+ if (create.idpConfig.kind === "BuiltInIdP") create.request.idpConfig.config = await protoBuiltinIdPConfig(client, create.request.workspaceId, create.idpConfig);
1395
+ return client.createAuthIDPConfig(create.request);
1435
1396
  }), ...changeSet.idpConfig.updates.map(async (update) => {
1436
1397
  if (update.idpConfig.kind === "BuiltInIdP") update.request.idpConfig.config = await protoBuiltinIdPConfig(client, update.request.workspaceId, update.idpConfig);
1437
1398
  return client.updateAuthIDPConfig(update.request);
1438
1399
  })]);
1439
- await Promise.all([...changeSet.userProfileConfig.creates.map((create$1) => client.createUserProfileConfig(create$1.request)), ...changeSet.userProfileConfig.updates.map((update) => client.updateUserProfileConfig(update.request))]);
1440
- await Promise.all([...changeSet.tenantConfig.creates.map((create$1) => client.createTenantConfig(create$1.request)), ...changeSet.tenantConfig.updates.map((update) => client.updateTenantConfig(update.request))]);
1441
- await Promise.all([...changeSet.machineUser.creates.map((create$1) => client.createAuthMachineUser(create$1.request)), ...changeSet.machineUser.updates.map((update) => client.updateAuthMachineUser(update.request))]);
1442
- await Promise.all([...changeSet.oauth2Client.creates.map(async (create$1) => {
1443
- create$1.request.oauth2Client.redirectUris = await resolveStaticWebsiteUrls(client, create$1.request.workspaceId, create$1.request.oauth2Client.redirectUris, "OAuth2 redirect URIs");
1444
- return client.createAuthOAuth2Client(create$1.request);
1400
+ await Promise.all([...changeSet.userProfileConfig.creates.map((create) => client.createUserProfileConfig(create.request)), ...changeSet.userProfileConfig.updates.map((update) => client.updateUserProfileConfig(update.request))]);
1401
+ await Promise.all([...changeSet.tenantConfig.creates.map((create) => client.createTenantConfig(create.request)), ...changeSet.tenantConfig.updates.map((update) => client.updateTenantConfig(update.request))]);
1402
+ await Promise.all([...changeSet.machineUser.creates.map((create) => client.createAuthMachineUser(create.request)), ...changeSet.machineUser.updates.map((update) => client.updateAuthMachineUser(update.request))]);
1403
+ await Promise.all([...changeSet.oauth2Client.creates.map(async (create) => {
1404
+ create.request.oauth2Client.redirectUris = await resolveStaticWebsiteUrls(client, create.request.workspaceId, create.request.oauth2Client.redirectUris, "OAuth2 redirect URIs");
1405
+ return client.createAuthOAuth2Client(create.request);
1445
1406
  }), ...changeSet.oauth2Client.updates.map(async (update) => {
1446
1407
  update.request.oauth2Client.redirectUris = await resolveStaticWebsiteUrls(client, update.request.workspaceId, update.request.oauth2Client.redirectUris, "OAuth2 redirect URIs");
1447
1408
  return client.updateAuthOAuth2Client(update.request);
@@ -1451,8 +1412,8 @@ async function applyAuth(client, result, phase = "create-update") {
1451
1412
  replace.createRequest.oauth2Client.redirectUris = await resolveStaticWebsiteUrls(client, replace.createRequest.workspaceId, replace.createRequest.oauth2Client.redirectUris, "OAuth2 redirect URIs");
1452
1413
  await client.createAuthOAuth2Client(replace.createRequest);
1453
1414
  }
1454
- await Promise.all([...changeSet.scim.creates.map((create$1) => client.createAuthSCIMConfig(create$1.request)), ...changeSet.scim.updates.map((update) => client.updateAuthSCIMConfig(update.request))]);
1455
- await Promise.all([...changeSet.scimResource.creates.map((create$1) => client.createAuthSCIMResource(create$1.request)), ...changeSet.scimResource.updates.map((update) => client.updateAuthSCIMResource(update.request))]);
1415
+ await Promise.all([...changeSet.scim.creates.map((create) => client.createAuthSCIMConfig(create.request)), ...changeSet.scim.updates.map((update) => client.updateAuthSCIMConfig(update.request))]);
1416
+ await Promise.all([...changeSet.scimResource.creates.map((create) => client.createAuthSCIMResource(create.request)), ...changeSet.scimResource.updates.map((update) => client.updateAuthSCIMResource(update.request))]);
1456
1417
  } else if (phase === "delete-resources") {
1457
1418
  await Promise.all(changeSet.scimResource.deletes.map((del) => client.deleteAuthSCIMResource(del.request)));
1458
1419
  await Promise.all(changeSet.scim.deletes.map((del) => client.deleteAuthSCIMConfig(del.request)));
@@ -1614,8 +1575,8 @@ async function planIdPConfigs(client, workspaceId, auths, deletedServices) {
1614
1575
  const { parsedConfig: config } = authService;
1615
1576
  const existingIdPConfigs = await fetchIdPConfigs(config.name);
1616
1577
  const existingNameSet = /* @__PURE__ */ new Set();
1617
- existingIdPConfigs.forEach((idpConfig$1) => {
1618
- existingNameSet.add(idpConfig$1.name);
1578
+ existingIdPConfigs.forEach((idpConfig) => {
1579
+ existingNameSet.add(idpConfig.name);
1619
1580
  });
1620
1581
  const idpConfig = config.idProvider;
1621
1582
  if (idpConfig) if (existingNameSet.has(idpConfig.name)) {
@@ -2297,10 +2258,33 @@ function protoSCIMAttribute(attr) {
2297
2258
  multiValued: attr.multiValued,
2298
2259
  uniqueness,
2299
2260
  canonicalValues: attr.canonicalValues ?? void 0,
2300
- subAttributes: attr.subAttributes?.map((attr$1) => protoSCIMAttribute(attr$1))
2261
+ subAttributes: attr.subAttributes?.map((attr) => protoSCIMAttribute(attr))
2301
2262
  };
2302
2263
  }
2303
2264
 
2265
+ //#endregion
2266
+ //#region src/cli/shared/prompt.ts
2267
+ /**
2268
+ * Wraps a prompt function with CI guard and cancellation handling.
2269
+ * @param fn - A prompt function from `@inquirer/prompts`
2270
+ * @returns A wrapped function that throws in CI and exits on cancel
2271
+ */
2272
+ function withGuard(fn) {
2273
+ return async (...args) => {
2274
+ if (isCI) throw new CIPromptError();
2275
+ try {
2276
+ return await fn(...args);
2277
+ } catch (error) {
2278
+ if (error instanceof ExitPromptError) process.exit(130);
2279
+ throw error;
2280
+ }
2281
+ };
2282
+ }
2283
+ const prompt = {
2284
+ confirm: withGuard(confirm),
2285
+ text: withGuard(input)
2286
+ };
2287
+
2304
2288
  //#endregion
2305
2289
  //#region src/cli/commands/apply/confirm.ts
2306
2290
  /**
@@ -2324,9 +2308,9 @@ async function confirmOwnerConflict(conflicts, appName, yes) {
2324
2308
  return;
2325
2309
  }
2326
2310
  const promptMessage = currentOwners.length === 1 ? `Update these resources to be managed by "${appName}"?\n${styles.dim("(Common when renaming your application)")}` : `Update these resources to be managed by "${appName}"?`;
2327
- if (!await logger.prompt(promptMessage, {
2328
- type: "confirm",
2329
- initial: false
2311
+ if (!await prompt.confirm({
2312
+ message: promptMessage,
2313
+ default: false
2330
2314
  })) throw new Error(ml`
2331
2315
  Apply cancelled. Resources remain managed by their current applications.
2332
2316
  To override, run again and confirm, or use --yes flag.
@@ -2352,9 +2336,9 @@ async function confirmUnmanagedResources(resources, appName, yes) {
2352
2336
  logger.success(`Adding to "${appName}" (--yes flag specified)...`, { mode: "plain" });
2353
2337
  return;
2354
2338
  }
2355
- if (!await logger.prompt(`Allow tailor-sdk to manage these resources for "${appName}"?`, {
2356
- type: "confirm",
2357
- initial: false
2339
+ if (!await prompt.confirm({
2340
+ message: `Allow tailor-sdk to manage these resources for "${appName}"?`,
2341
+ default: false
2358
2342
  })) throw new Error(ml`
2359
2343
  Apply cancelled. Resources remain unmanaged.
2360
2344
  To override, run again and confirm, or use --yes flag.
@@ -2377,9 +2361,9 @@ async function confirmImportantResourceDeletion(resources, yes) {
2377
2361
  logger.success("Deleting resources (--yes flag specified)...", { mode: "plain" });
2378
2362
  return;
2379
2363
  }
2380
- if (!await logger.prompt("Are you sure you want to delete these resources?", {
2381
- type: "confirm",
2382
- initial: false
2364
+ if (!await prompt.confirm({
2365
+ message: "Are you sure you want to delete these resources?",
2366
+ default: false
2383
2367
  })) throw new Error(ml`
2384
2368
  Apply cancelled. Resources will not be deleted.
2385
2369
  To override, run again and confirm, or use --yes flag.
@@ -2681,9 +2665,9 @@ async function uploadFunctionScript(client, workspaceId, entry, isCreate) {
2681
2665
  async function applyFunctionRegistry(client, workspaceId, result, phase = "create-update") {
2682
2666
  const { changeSet } = result;
2683
2667
  if (phase === "create-update") {
2684
- for (const create$1 of changeSet.creates) {
2685
- await uploadFunctionScript(client, workspaceId, create$1.entry, true);
2686
- await client.setMetadata(create$1.metaRequest);
2668
+ for (const create of changeSet.creates) {
2669
+ await uploadFunctionScript(client, workspaceId, create.entry, true);
2670
+ await client.setMetadata(create.metaRequest);
2687
2671
  }
2688
2672
  for (const update of changeSet.updates) {
2689
2673
  await uploadFunctionScript(client, workspaceId, update.entry, false);
@@ -2706,9 +2690,9 @@ async function applyFunctionRegistry(client, workspaceId, result, phase = "creat
2706
2690
  */
2707
2691
  async function applyExecutor(client, result, phase = "create-update") {
2708
2692
  const { changeSet } = result;
2709
- if (phase === "create-update") await Promise.all([...changeSet.creates.map(async (create$1) => {
2710
- await client.createExecutorExecutor(create$1.request);
2711
- await client.setMetadata(create$1.metaRequest);
2693
+ if (phase === "create-update") await Promise.all([...changeSet.creates.map(async (create) => {
2694
+ await client.createExecutorExecutor(create.request);
2695
+ await client.setMetadata(create.metaRequest);
2712
2696
  }), ...changeSet.updates.map(async (update) => {
2713
2697
  await client.updateExecutorExecutor(update.request);
2714
2698
  await client.setMetadata(update.metaRequest);
@@ -2731,12 +2715,12 @@ async function planExecutor(context) {
2731
2715
  const resourceOwners = /* @__PURE__ */ new Set();
2732
2716
  const withoutLabel = await fetchAll(async (pageToken, maxPageSize) => {
2733
2717
  try {
2734
- const { executors: executors$1, nextPageToken } = await client.listExecutorExecutors({
2718
+ const { executors, nextPageToken } = await client.listExecutorExecutors({
2735
2719
  workspaceId,
2736
2720
  pageToken,
2737
2721
  pageSize: maxPageSize
2738
2722
  });
2739
- return [executors$1, nextPageToken];
2723
+ return [executors, nextPageToken];
2740
2724
  } catch (error) {
2741
2725
  if (error instanceof ConnectError && error.code === Code.NotFound) return [[], ""];
2742
2726
  throw error;
@@ -3004,14 +2988,14 @@ const SCALAR_TYPE_MAP = {
3004
2988
  async function applyPipeline(client, result, phase = "create-update") {
3005
2989
  const { changeSet } = result;
3006
2990
  if (phase === "create-update") {
3007
- await Promise.all([...changeSet.service.creates.map(async (create$1) => {
3008
- await client.createPipelineService(create$1.request);
3009
- await client.setMetadata(create$1.metaRequest);
2991
+ await Promise.all([...changeSet.service.creates.map(async (create) => {
2992
+ await client.createPipelineService(create.request);
2993
+ await client.setMetadata(create.metaRequest);
3010
2994
  }), ...changeSet.service.updates.map(async (update) => {
3011
2995
  await client.updatePipelineService(update.request);
3012
2996
  await client.setMetadata(update.metaRequest);
3013
2997
  })]);
3014
- await Promise.all([...changeSet.resolver.creates.map((create$1) => client.createPipelineResolver(create$1.request)), ...changeSet.resolver.updates.map((update) => client.updatePipelineResolver(update.request))]);
2998
+ await Promise.all([...changeSet.resolver.creates.map((create) => client.createPipelineResolver(create.request)), ...changeSet.resolver.updates.map((update) => client.updatePipelineResolver(update.request))]);
3015
2999
  } else if (phase === "delete-resources") await Promise.all(changeSet.resolver.deletes.map((del) => client.deletePipelineResolver(del.request)));
3016
3000
  else if (phase === "delete-services") await Promise.all(changeSet.service.deletes.map((del) => client.deletePipelineService(del.request)));
3017
3001
  }
@@ -3400,13 +3384,13 @@ async function planSecretManager(context) {
3400
3384
  if (label === application.name) {
3401
3385
  const secrets = await fetchAll(async (pageToken, maxPageSize) => {
3402
3386
  try {
3403
- const { secrets: secrets$1, nextPageToken } = await client.listSecretManagerSecrets({
3387
+ const { secrets, nextPageToken } = await client.listSecretManagerSecrets({
3404
3388
  workspaceId,
3405
3389
  secretmanagerVaultName: name,
3406
3390
  pageToken,
3407
3391
  pageSize: maxPageSize
3408
3392
  });
3409
- return [secrets$1, nextPageToken];
3393
+ return [secrets, nextPageToken];
3410
3394
  } catch (error) {
3411
3395
  if (error instanceof ConnectError && error.code === Code.NotFound) return [[], ""];
3412
3396
  throw error;
@@ -3448,13 +3432,13 @@ function vaultTrn(workspaceId, name) {
3448
3432
  async function applySecretManager(client, result, phase = "create-update", application) {
3449
3433
  const { vaultChangeSet, secretChangeSet } = result;
3450
3434
  if (phase === "create-update") {
3451
- await Promise.all(vaultChangeSet.creates.map(async (create$1) => {
3435
+ await Promise.all(vaultChangeSet.creates.map(async (create) => {
3452
3436
  await client.createSecretManagerVault({
3453
- workspaceId: create$1.workspaceId,
3454
- secretmanagerVaultName: create$1.name
3437
+ workspaceId: create.workspaceId,
3438
+ secretmanagerVaultName: create.name
3455
3439
  });
3456
3440
  if (application) {
3457
- const metaRequest = await buildMetaRequest(vaultTrn(create$1.workspaceId, create$1.name), application.name);
3441
+ const metaRequest = await buildMetaRequest(vaultTrn(create.workspaceId, create.name), application.name);
3458
3442
  await client.setMetadata(metaRequest);
3459
3443
  }
3460
3444
  }));
@@ -3462,11 +3446,11 @@ async function applySecretManager(client, result, phase = "create-update", appli
3462
3446
  const metaRequest = await buildMetaRequest(vaultTrn(update.workspaceId, update.name), application.name);
3463
3447
  await client.setMetadata(metaRequest);
3464
3448
  }));
3465
- await Promise.all(secretChangeSet.creates.map((create$1) => client.createSecretManagerSecret({
3466
- workspaceId: create$1.workspaceId,
3467
- secretmanagerVaultName: create$1.vaultName,
3468
- secretmanagerSecretName: create$1.secretName,
3469
- secretmanagerSecretValue: create$1.value
3449
+ await Promise.all(secretChangeSet.creates.map((create) => client.createSecretManagerSecret({
3450
+ workspaceId: create.workspaceId,
3451
+ secretmanagerVaultName: create.vaultName,
3452
+ secretmanagerSecretName: create.secretName,
3453
+ secretmanagerSecretValue: create.value
3470
3454
  })));
3471
3455
  await Promise.all(secretChangeSet.updates.map((update) => client.updateSecretManagerSecret({
3472
3456
  workspaceId: update.workspaceId,
@@ -3515,9 +3499,9 @@ async function applySecretManager(client, result, phase = "create-update", appli
3515
3499
  */
3516
3500
  async function applyStaticWebsite(client, result, phase = "create-update") {
3517
3501
  const { changeSet } = result;
3518
- if (phase === "create-update") await Promise.all([...changeSet.creates.map(async (create$1) => {
3519
- await client.createStaticWebsite(create$1.request);
3520
- await client.setMetadata(create$1.metaRequest);
3502
+ if (phase === "create-update") await Promise.all([...changeSet.creates.map(async (create) => {
3503
+ await client.createStaticWebsite(create.request);
3504
+ await client.setMetadata(create.metaRequest);
3521
3505
  }), ...changeSet.updates.map(async (update) => {
3522
3506
  await client.updateStaticWebsite(update.request);
3523
3507
  await client.setMetadata(update.metaRequest);
@@ -3657,10 +3641,6 @@ function getNamespacesWithMigrations(config, configDir) {
3657
3641
  //#endregion
3658
3642
  //#region src/cli/commands/tailordb/migrate/diff-calculator.ts
3659
3643
  /**
3660
- * Current schema snapshot format version
3661
- */
3662
- const SCHEMA_SNAPSHOT_VERSION = 1;
3663
- /**
3664
3644
  * Check if a migration diff has any changes
3665
3645
  * @param {MigrationDiff} diff - Migration diff to check
3666
3646
  * @returns {boolean} True if diff has changes
@@ -4065,7 +4045,7 @@ function createSnapshotFromLocalTypes(types, namespace) {
4065
4045
  const snapshotTypes = {};
4066
4046
  for (const [typeName, type] of Object.entries(types)) snapshotTypes[typeName] = createSnapshotType(type);
4067
4047
  return {
4068
- version: SCHEMA_SNAPSHOT_VERSION,
4048
+ version: 1,
4069
4049
  namespace,
4070
4050
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
4071
4051
  types: snapshotTypes
@@ -4127,7 +4107,7 @@ function getMigrationFiles(migrationsDir) {
4127
4107
  */
4128
4108
  function getNextMigrationNumber(migrationsDir) {
4129
4109
  const files = getMigrationFiles(migrationsDir);
4130
- if (files.length === 0) return INITIAL_SCHEMA_NUMBER;
4110
+ if (files.length === 0) return 0;
4131
4111
  return Math.max(...files.map((f) => f.number)) + 1;
4132
4112
  }
4133
4113
  /**
@@ -4280,8 +4260,8 @@ function applyDiffToSnapshot(snapshot, diff) {
4280
4260
  function reconstructSnapshotFromMigrations(migrationsDir, maxVersion) {
4281
4261
  const files = getMigrationFiles(migrationsDir);
4282
4262
  if (files.length === 0) return null;
4283
- const schemaFile = files.find((f) => f.type === "schema" && f.number === INITIAL_SCHEMA_NUMBER);
4284
- if (!schemaFile) throw new Error(`No initial schema file found in ${migrationsDir}. Expected ${formatMigrationNumber(INITIAL_SCHEMA_NUMBER)}/schema.json`);
4263
+ const schemaFile = files.find((f) => f.type === "schema" && f.number === 0);
4264
+ if (!schemaFile) throw new Error(`No initial schema file found in ${migrationsDir}. Expected ${formatMigrationNumber(0)}/schema.json`);
4285
4265
  let snapshot = loadSnapshot(schemaFile.path);
4286
4266
  for (const file of files) if (file.type === "diff" && file.number > schemaFile.number) {
4287
4267
  if (maxVersion !== void 0 && file.number > maxVersion) continue;
@@ -4650,7 +4630,7 @@ function compareSnapshots(previous, current) {
4650
4630
  comparePermissions(ctx, typeName, prevType.permissions?.record, currType.permissions?.record, prevType.permissions?.gql, currType.permissions?.gql);
4651
4631
  }
4652
4632
  return {
4653
- version: SCHEMA_SNAPSHOT_VERSION,
4633
+ version: 1,
4654
4634
  namespace: current.namespace,
4655
4635
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
4656
4636
  changes: ctx.changes,
@@ -4689,30 +4669,30 @@ function validateMigrationFiles(migrationsDir) {
4689
4669
  const diffFiles = [];
4690
4670
  for (const file of migrationFiles) if (file.type === "schema") schemaFiles.push(file.number);
4691
4671
  else if (file.type === "diff") diffFiles.push(file.number);
4692
- if (!schemaFiles.includes(INITIAL_SCHEMA_NUMBER)) errors.push({
4672
+ if (!schemaFiles.includes(0)) errors.push({
4693
4673
  type: "missing_schema",
4694
- message: `Initial schema snapshot (${formatMigrationNumber(INITIAL_SCHEMA_NUMBER)}/schema.json) is missing`,
4695
- migrationNumber: INITIAL_SCHEMA_NUMBER
4674
+ message: `Initial schema snapshot (${formatMigrationNumber(0)}/schema.json) is missing`,
4675
+ migrationNumber: 0
4696
4676
  });
4697
- for (const num of schemaFiles) if (num !== INITIAL_SCHEMA_NUMBER) errors.push({
4677
+ for (const num of schemaFiles) if (num !== 0) errors.push({
4698
4678
  type: "invalid_schema_number",
4699
- message: `Schema file found at migration ${formatMigrationNumber(num)}, but schema should only exist at ${formatMigrationNumber(INITIAL_SCHEMA_NUMBER)}`,
4679
+ message: `Schema file found at migration ${formatMigrationNumber(num)}, but schema should only exist at ${formatMigrationNumber(0)}`,
4700
4680
  migrationNumber: num
4701
4681
  });
4702
4682
  const allNumbers = [...new Set([...schemaFiles, ...diffFiles])].sort((a, b) => a - b);
4703
4683
  if (allNumbers.length === 0) return errors;
4704
- for (const num of schemaFiles) if (num !== INITIAL_SCHEMA_NUMBER && diffFiles.includes(num)) errors.push({
4684
+ for (const num of schemaFiles) if (num !== 0 && diffFiles.includes(num)) errors.push({
4705
4685
  type: "duplicate",
4706
4686
  message: `Migration ${formatMigrationNumber(num)} has both schema and diff files`,
4707
4687
  migrationNumber: num
4708
4688
  });
4709
4689
  const maxNum = Math.max(...allNumbers);
4710
- for (let i = INITIAL_SCHEMA_NUMBER; i <= maxNum; i++) if (!allNumbers.includes(i)) errors.push({
4690
+ for (let i = 0; i <= maxNum; i++) if (!allNumbers.includes(i)) errors.push({
4711
4691
  type: "gap",
4712
4692
  message: `Migration ${formatMigrationNumber(i)} is missing (gap in sequence)`,
4713
4693
  migrationNumber: i
4714
4694
  });
4715
- for (const num of allNumbers) if (num > INITIAL_SCHEMA_NUMBER && !diffFiles.includes(num)) errors.push({
4695
+ for (const num of allNumbers) if (num > 0 && !diffFiles.includes(num)) errors.push({
4716
4696
  type: "missing_diff",
4717
4697
  message: `Migration ${formatMigrationNumber(num)} is missing diff file`,
4718
4698
  migrationNumber: num
@@ -4961,7 +4941,7 @@ async function bundleMigrationScript(sourceFile, namespace, migrationNumber) {
4961
4941
  format: "esm",
4962
4942
  sourcemap: false,
4963
4943
  minify: false,
4964
- inlineDynamicImports: true,
4944
+ codeSplitting: false,
4965
4945
  globals: { tailordb: "tailordb" }
4966
4946
  },
4967
4947
  external: ["tailordb"],
@@ -4997,7 +4977,7 @@ const MIGRATION_LABEL_KEY = "sdk-migration";
4997
4977
  * @returns {number | null} Parsed number or null if invalid
4998
4978
  */
4999
4979
  function parseMigrationLabelNumber(label) {
5000
- if (!label.startsWith(MIGRATION_LABEL_PREFIX)) return null;
4980
+ if (!label.startsWith("m")) return null;
5001
4981
  const numStr = label.slice(1);
5002
4982
  const num = parseInt(numStr, 10);
5003
4983
  return isNaN(num) ? null : num;
@@ -5039,7 +5019,7 @@ async function waitForExecution$1(client, workspaceId, executionId, pollInterval
5039
5019
  logs: execution.logs,
5040
5020
  result: execution.result
5041
5021
  };
5042
- await new Promise((resolve$1) => setTimeout(resolve$1, pollInterval));
5022
+ await new Promise((resolve) => setTimeout(resolve, pollInterval));
5043
5023
  }
5044
5024
  }
5045
5025
  /**
@@ -5053,12 +5033,12 @@ async function waitForExecution$1(client, workspaceId, executionId, pollInterval
5053
5033
  * @returns {Promise<ScriptExecutionResult>} Execution result
5054
5034
  */
5055
5035
  async function executeScript(options) {
5056
- const { client, workspaceId, name, code, arg: arg$1, invoker, pollInterval } = options;
5036
+ const { client, workspaceId, name, code, arg, invoker, pollInterval } = options;
5057
5037
  const response = await client.testExecScript({
5058
5038
  workspaceId,
5059
5039
  name,
5060
5040
  code,
5061
- arg: arg$1 ?? JSON.stringify({}),
5041
+ arg: arg ?? JSON.stringify({}),
5062
5042
  invoker
5063
5043
  });
5064
5044
  const executionId = response.executionId;
@@ -5092,8 +5072,8 @@ async function executeScript(options) {
5092
5072
  */
5093
5073
  async function getCurrentMigrationNumber(client, workspaceId, namespace) {
5094
5074
  try {
5095
- const trn$7 = `${trnPrefix(workspaceId)}:tailordb:${namespace}`;
5096
- const { metadata } = await client.getMetadata({ trn: trn$7 });
5075
+ const trn = `${trnPrefix(workspaceId)}:tailordb:${namespace}`;
5076
+ const { metadata } = await client.getMetadata({ trn });
5097
5077
  const label = metadata?.labels[MIGRATION_LABEL_KEY];
5098
5078
  if (!label) return 0;
5099
5079
  return parseMigrationLabelNumber(label) ?? 0;
@@ -5171,12 +5151,12 @@ async function executeSingleMigration(options, migration) {
5171
5151
  * @returns {Promise<void>}
5172
5152
  */
5173
5153
  async function updateMigrationLabel(client, workspaceId, namespace, migrationNumber) {
5174
- const trn$7 = `${trnPrefix(workspaceId)}:tailordb:${namespace}`;
5175
- const { metadata } = await client.getMetadata({ trn: trn$7 });
5154
+ const trn = `${trnPrefix(workspaceId)}:tailordb:${namespace}`;
5155
+ const { metadata } = await client.getMetadata({ trn });
5176
5156
  const existingLabels = metadata?.labels ?? {};
5177
5157
  const newLabel = `m${formatMigrationNumber(migrationNumber)}`;
5178
5158
  await client.setMetadata({
5179
- trn: trn$7,
5159
+ trn,
5180
5160
  labels: {
5181
5161
  ...existingLabels,
5182
5162
  [MIGRATION_LABEL_KEY]: newLabel
@@ -5288,8 +5268,8 @@ async function fetchRemoteTypes(client, workspaceId, namespace) {
5288
5268
  */
5289
5269
  async function getRemoteMigrationNumber(client, workspaceId, namespace) {
5290
5270
  try {
5291
- const trn$7 = `${trnPrefix(workspaceId)}:tailordb:${namespace}`;
5292
- const { metadata } = await client.getMetadata({ trn: trn$7 });
5271
+ const trn = `${trnPrefix(workspaceId)}:tailordb:${namespace}`;
5272
+ const { metadata } = await client.getMetadata({ trn });
5293
5273
  const label = metadata?.labels?.["sdk-migration"];
5294
5274
  if (!label) return null;
5295
5275
  const match = label.match(/^m(\d+)$/);
@@ -5467,16 +5447,16 @@ async function applyTailorDB(client, result, phase = "create-update") {
5467
5447
  });
5468
5448
  if (remainingGqlPermissionDeletes.length > 0) await Promise.all(remainingGqlPermissionDeletes.map((del) => client.deleteTailorDBGQLPermission(del.request)));
5469
5449
  } else {
5470
- await Promise.all([...changeSet.service.creates.map(async (create$1) => {
5471
- await client.createTailorDBService(create$1.request);
5472
- await client.setMetadata(create$1.metaRequest);
5450
+ await Promise.all([...changeSet.service.creates.map(async (create) => {
5451
+ await client.createTailorDBService(create.request);
5452
+ await client.setMetadata(create.metaRequest);
5473
5453
  }), ...changeSet.service.updates.map((update) => client.setMetadata(update.metaRequest))]);
5474
5454
  try {
5475
- await Promise.all([...changeSet.type.creates.map((create$1) => client.createTailorDBType(create$1.request)), ...changeSet.type.updates.map((update) => client.updateTailorDBType(update.request))]);
5455
+ await Promise.all([...changeSet.type.creates.map((create) => client.createTailorDBType(create.request)), ...changeSet.type.updates.map((update) => client.updateTailorDBType(update.request))]);
5476
5456
  } catch (error) {
5477
5457
  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."]);
5478
5458
  }
5479
- await Promise.all([...changeSet.gqlPermission.creates.map((create$1) => client.createTailorDBGQLPermission(create$1.request)), ...changeSet.gqlPermission.updates.map((update) => client.updateTailorDBGQLPermission(update.request))]);
5459
+ await Promise.all([...changeSet.gqlPermission.creates.map((create) => client.createTailorDBGQLPermission(create.request)), ...changeSet.gqlPermission.updates.map((update) => client.updateTailorDBGQLPermission(update.request))]);
5480
5460
  await Promise.all(changeSet.gqlPermission.deletes.map((del) => client.deleteTailorDBGQLPermission(del.request)));
5481
5461
  await Promise.all(changeSet.type.deletes.map((del) => client.deleteTailorDBType(del.request)));
5482
5462
  }
@@ -5568,9 +5548,9 @@ function getDeletedTypeNames(migration) {
5568
5548
  * @returns {Promise<void>} Promise that resolves when services are created
5569
5549
  */
5570
5550
  async function executeServicesCreation(client, changeSet) {
5571
- await Promise.all([...changeSet.service.creates.map(async (create$1) => {
5572
- await client.createTailorDBService(create$1.request);
5573
- await client.setMetadata(create$1.metaRequest);
5551
+ await Promise.all([...changeSet.service.creates.map(async (create) => {
5552
+ await client.createTailorDBService(create.request);
5553
+ await client.setMetadata(create.metaRequest);
5574
5554
  }), ...changeSet.service.updates.map((update) => client.setMetadata(update.metaRequest))]);
5575
5555
  }
5576
5556
  /**
@@ -5598,35 +5578,35 @@ async function executeSingleMigrationPrePhase(client, changeSet, migration) {
5598
5578
  const affectedTypes = getAffectedTypeNames(migration);
5599
5579
  const createdBeforeMigration = new Set(processedTypes.created);
5600
5580
  await Promise.all([
5601
- ...changeSet.type.creates.filter((create$1) => {
5602
- const typeName = create$1.request.tailordbType?.name;
5581
+ ...changeSet.type.creates.filter((create) => {
5582
+ const typeName = create.request.tailordbType?.name;
5603
5583
  return typeName && affectedTypes.has(typeName) && !createdBeforeMigration.has(typeName);
5604
- }).map((create$1) => {
5605
- const typeName = create$1.request.tailordbType?.name;
5584
+ }).map((create) => {
5585
+ const typeName = create.request.tailordbType?.name;
5606
5586
  if (typeName) processedTypes.created.add(typeName);
5607
5587
  const typeChanges = typeName ? breakingChanges.get(typeName) : void 0;
5608
- if (!typeChanges || typeChanges.size === 0) return client.createTailorDBType(create$1.request);
5609
- const clonedRequest = structuredClone(create$1.request);
5588
+ if (!typeChanges || typeChanges.size === 0) return client.createTailorDBType(create.request);
5589
+ const clonedRequest = structuredClone(create.request);
5610
5590
  if (clonedRequest.tailordbType?.schema?.fields) applyPreMigrationFieldAdjustments(clonedRequest.tailordbType.schema.fields, typeChanges);
5611
5591
  return client.createTailorDBType(clonedRequest);
5612
5592
  }),
5613
- ...changeSet.type.creates.filter((create$1) => {
5614
- const typeName = create$1.request.tailordbType?.name;
5593
+ ...changeSet.type.creates.filter((create) => {
5594
+ const typeName = create.request.tailordbType?.name;
5615
5595
  return typeName && affectedTypes.has(typeName) && createdBeforeMigration.has(typeName);
5616
- }).map((create$1) => {
5617
- const typeName = create$1.request.tailordbType?.name;
5596
+ }).map((create) => {
5597
+ const typeName = create.request.tailordbType?.name;
5618
5598
  if (typeName) processedTypes.updated.add(typeName);
5619
5599
  const typeChanges = typeName ? breakingChanges.get(typeName) : void 0;
5620
5600
  if (!typeChanges || typeChanges.size === 0) return client.updateTailorDBType({
5621
- workspaceId: create$1.request.workspaceId,
5622
- namespaceName: create$1.request.namespaceName,
5623
- tailordbType: create$1.request.tailordbType
5601
+ workspaceId: create.request.workspaceId,
5602
+ namespaceName: create.request.namespaceName,
5603
+ tailordbType: create.request.tailordbType
5624
5604
  });
5625
- const clonedRequest = structuredClone(create$1.request);
5605
+ const clonedRequest = structuredClone(create.request);
5626
5606
  if (clonedRequest.tailordbType?.schema?.fields) applyPreMigrationFieldAdjustments(clonedRequest.tailordbType.schema.fields, typeChanges);
5627
5607
  return client.updateTailorDBType({
5628
- workspaceId: create$1.request.workspaceId,
5629
- namespaceName: create$1.request.namespaceName,
5608
+ workspaceId: create.request.workspaceId,
5609
+ namespaceName: create.request.namespaceName,
5630
5610
  tailordbType: clonedRequest.tailordbType
5631
5611
  });
5632
5612
  }),
@@ -5644,20 +5624,20 @@ async function executeSingleMigrationPrePhase(client, changeSet, migration) {
5644
5624
  })
5645
5625
  ]);
5646
5626
  if (!processedTypes.gqlPermissionsProcessed.has(migration.namespace)) {
5647
- const gqlPermissionCreatesForNamespace = changeSet.gqlPermission.creates.filter((create$1) => create$1.request.namespaceName === migration.namespace);
5627
+ const gqlPermissionCreatesForNamespace = changeSet.gqlPermission.creates.filter((create) => create.request.namespaceName === migration.namespace);
5648
5628
  const gqlPermissionUpdatesForNamespace = changeSet.gqlPermission.updates.filter((update) => update.request.namespaceName === migration.namespace);
5649
- const gqlPermissionTypeNames = new Set(gqlPermissionCreatesForNamespace.map((create$1) => create$1.name));
5650
- const missingTypeCreates = changeSet.type.creates.filter((create$1) => {
5651
- const typeName = create$1.request.tailordbType?.name;
5652
- return create$1.request.namespaceName === migration.namespace && typeName && gqlPermissionTypeNames.has(typeName) && !processedTypes.created.has(typeName);
5629
+ const gqlPermissionTypeNames = new Set(gqlPermissionCreatesForNamespace.map((create) => create.name));
5630
+ const missingTypeCreates = changeSet.type.creates.filter((create) => {
5631
+ const typeName = create.request.tailordbType?.name;
5632
+ return create.request.namespaceName === migration.namespace && typeName && gqlPermissionTypeNames.has(typeName) && !processedTypes.created.has(typeName);
5653
5633
  });
5654
- if (missingTypeCreates.length > 0) await Promise.all(missingTypeCreates.map((create$1) => {
5655
- const typeName = create$1.request.tailordbType?.name;
5634
+ if (missingTypeCreates.length > 0) await Promise.all(missingTypeCreates.map((create) => {
5635
+ const typeName = create.request.tailordbType?.name;
5656
5636
  if (typeName) processedTypes.created.add(typeName);
5657
- return client.createTailorDBType(create$1.request);
5637
+ return client.createTailorDBType(create.request);
5658
5638
  }));
5659
5639
  processedTypes.gqlPermissionsProcessed.add(migration.namespace);
5660
- await Promise.all([...gqlPermissionCreatesForNamespace.map((create$1) => client.createTailorDBGQLPermission(create$1.request)), ...gqlPermissionUpdatesForNamespace.map((update) => client.updateTailorDBGQLPermission(update.request))]);
5640
+ await Promise.all([...gqlPermissionCreatesForNamespace.map((create) => client.createTailorDBGQLPermission(create.request)), ...gqlPermissionUpdatesForNamespace.map((update) => client.updateTailorDBGQLPermission(update.request))]);
5661
5641
  }
5662
5642
  }
5663
5643
  /**
@@ -5683,13 +5663,13 @@ async function executeSingleMigrationPostPhase(client, changeSet, migration) {
5683
5663
  const affectedTypes = getAffectedTypeNames(migration);
5684
5664
  const deletedTypeNames = getDeletedTypeNames(migration);
5685
5665
  try {
5686
- await Promise.all([...changeSet.type.creates.filter((create$1) => {
5687
- const typeName = create$1.request.tailordbType?.name;
5666
+ await Promise.all([...changeSet.type.creates.filter((create) => {
5667
+ const typeName = create.request.tailordbType?.name;
5688
5668
  return typeName && affectedTypes.has(typeName) && breakingChanges.has(typeName);
5689
- }).map((create$1) => client.updateTailorDBType({
5690
- workspaceId: create$1.request.workspaceId,
5691
- namespaceName: create$1.request.namespaceName,
5692
- tailordbType: create$1.request.tailordbType
5669
+ }).map((create) => client.updateTailorDBType({
5670
+ workspaceId: create.request.workspaceId,
5671
+ namespaceName: create.request.namespaceName,
5672
+ tailordbType: create.request.tailordbType
5693
5673
  })), ...changeSet.type.updates.filter((update) => {
5694
5674
  const typeName = update.request.tailordbType?.name;
5695
5675
  return typeName && affectedTypes.has(typeName) && breakingChanges.has(typeName);
@@ -6383,22 +6363,24 @@ async function applyWorkflow(client, result, phase = "create-update") {
6383
6363
  const { changeSet, appName } = result;
6384
6364
  if (phase === "create-update") {
6385
6365
  const jobFunctionVersions = await registerJobFunctions(client, changeSet, appName);
6386
- await Promise.all([...changeSet.creates.map(async (create$1) => {
6387
- const filteredVersions = filterJobFunctionVersions(jobFunctionVersions, create$1.usedJobNames);
6366
+ await Promise.all([...changeSet.creates.map(async (create) => {
6367
+ const filteredVersions = filterJobFunctionVersions(jobFunctionVersions, create.usedJobNames);
6388
6368
  await client.createWorkflow({
6389
- workspaceId: create$1.workspaceId,
6390
- workflowName: create$1.workflow.name,
6391
- mainJobFunctionName: create$1.workflow.mainJob.name,
6392
- jobFunctions: filteredVersions
6369
+ workspaceId: create.workspaceId,
6370
+ workflowName: create.workflow.name,
6371
+ mainJobFunctionName: create.workflow.mainJob.name,
6372
+ jobFunctions: filteredVersions,
6373
+ ...create.workflow.retryPolicy && { retryPolicy: toRetryPolicy(create.workflow.retryPolicy) }
6393
6374
  });
6394
- await client.setMetadata(create$1.metaRequest);
6375
+ await client.setMetadata(create.metaRequest);
6395
6376
  }), ...changeSet.updates.map(async (update) => {
6396
6377
  const filteredVersions = filterJobFunctionVersions(jobFunctionVersions, update.usedJobNames);
6397
6378
  await client.updateWorkflow({
6398
6379
  workspaceId: update.workspaceId,
6399
6380
  workflowName: update.workflow.name,
6400
6381
  mainJobFunctionName: update.workflow.mainJob.name,
6401
- jobFunctions: filteredVersions
6382
+ jobFunctions: filteredVersions,
6383
+ ...update.workflow.retryPolicy && { retryPolicy: toRetryPolicy(update.workflow.retryPolicy) }
6402
6384
  });
6403
6385
  await client.setMetadata(update.metaRequest);
6404
6386
  })]);
@@ -6464,13 +6446,30 @@ async function registerJobFunctions(client, changeSet, appName) {
6464
6446
  const unusedJobFunctions = existingJobFunctions.filter((jobName) => !allUsedJobNames.has(jobName));
6465
6447
  await Promise.all(unusedJobFunctions.map(async (jobName) => {
6466
6448
  const { metadata } = await client.getMetadata({ trn: jobFunctionTrn(workspaceId, jobName) });
6467
- if (metadata?.labels?.[sdkNameLabelKey] === appName) await client.setMetadata({
6449
+ if (metadata?.labels?.["sdk-name"] === appName) await client.setMetadata({
6468
6450
  trn: jobFunctionTrn(workspaceId, jobName),
6469
6451
  labels: { [sdkNameLabelKey]: "" }
6470
6452
  });
6471
6453
  }));
6472
6454
  return jobFunctionVersions;
6473
6455
  }
6456
+ function parseDurationToProto(duration) {
6457
+ const ms = parseDuration(duration);
6458
+ const seconds = Math.floor(ms / 1e3);
6459
+ const nanos = ms % 1e3 * 1e6;
6460
+ return {
6461
+ seconds: BigInt(seconds),
6462
+ nanos
6463
+ };
6464
+ }
6465
+ function toRetryPolicy(policy) {
6466
+ return {
6467
+ maxRetries: policy.maxRetries,
6468
+ initialBackoff: parseDurationToProto(policy.initialBackoff),
6469
+ maxBackoff: parseDurationToProto(policy.maxBackoff),
6470
+ backoffMultiplier: policy.backoffMultiplier
6471
+ };
6472
+ }
6474
6473
  function workflowTrn(workspaceId, name) {
6475
6474
  return `trn:v1:workspace:${workspaceId}:workflow:${name}`;
6476
6475
  }
@@ -6571,9 +6570,9 @@ async function apply(options) {
6571
6570
  return withSpan("apply", async (rootSpan) => {
6572
6571
  rootSpan.setAttribute("apply.dry_run", options?.dryRun ?? false);
6573
6572
  const { config, application, workflowBuildResult, buildOnly } = await withSpan("build", async () => {
6574
- const { config: config$1, plugins } = await withSpan("build.loadConfig", () => loadConfig(options?.configPath));
6575
- const dryRun$1 = options?.dryRun ?? false;
6576
- const buildOnly$1 = options?.buildOnly ?? process.env.TAILOR_PLATFORM_SDK_BUILD_ONLY === "true";
6573
+ const { config, plugins } = await withSpan("build.loadConfig", () => loadConfig(options?.configPath));
6574
+ const dryRun = options?.dryRun ?? false;
6575
+ const buildOnly = options?.buildOnly ?? process.env.TAILOR_PLATFORM_SDK_BUILD_ONLY === "true";
6577
6576
  const noCache = options?.noCache ?? false;
6578
6577
  const packageJson = await readPackageJson();
6579
6578
  const cacheDir = path.resolve(getDistDir(), "cache");
@@ -6584,7 +6583,7 @@ async function apply(options) {
6584
6583
  });
6585
6584
  logger.info("Bundle cache cleaned");
6586
6585
  }
6587
- const configDir = path.dirname(config$1.path);
6586
+ const configDir = path.dirname(config.path);
6588
6587
  const lockfilePath = findUpSync("pnpm-lock.yaml", { cwd: configDir }) ?? findUpSync("package-lock.json", { cwd: configDir }) ?? findUpSync("yarn.lock", { cwd: configDir }) ?? findUpSync("bun.lock", { cwd: configDir });
6589
6588
  const cacheManager = createCacheManager({
6590
6589
  enabled: !noCache,
@@ -6595,29 +6594,29 @@ async function apply(options) {
6595
6594
  let pluginManager;
6596
6595
  if (plugins.length > 0) pluginManager = new PluginManager(plugins);
6597
6596
  await withSpan("build.generateUserTypes", () => generateUserTypes({
6598
- config: config$1,
6599
- configPath: config$1.path
6597
+ config,
6598
+ configPath: config.path
6600
6599
  }));
6601
- let application$1;
6602
- let workflowBuildResult$1;
6600
+ let application;
6601
+ let workflowBuildResult;
6603
6602
  try {
6604
6603
  const result = await withSpan("build.loadApplication", () => loadApplication({
6605
- config: config$1,
6604
+ config,
6606
6605
  pluginManager,
6607
6606
  bundleCache: cacheManager.bundleCache
6608
6607
  }));
6609
- application$1 = result.application;
6610
- workflowBuildResult$1 = result.workflowBuildResult;
6608
+ application = result.application;
6609
+ workflowBuildResult = result.workflowBuildResult;
6611
6610
  } finally {
6612
6611
  cacheManager.finalize();
6613
6612
  }
6614
6613
  return {
6615
- config: config$1,
6614
+ config,
6616
6615
  plugins,
6617
- application: application$1,
6618
- workflowBuildResult: workflowBuildResult$1,
6619
- dryRun: dryRun$1,
6620
- buildOnly: buildOnly$1
6616
+ application,
6617
+ workflowBuildResult,
6618
+ dryRun,
6619
+ buildOnly
6621
6620
  };
6622
6621
  });
6623
6622
  if (buildOnly) return;
@@ -6644,7 +6643,7 @@ async function apply(options) {
6644
6643
  config,
6645
6644
  noSchemaCheck: options?.noSchemaCheck
6646
6645
  };
6647
- const [functionRegistry$1, tailorDB$1, staticWebsite$1, idp$1, auth$1, pipeline$1, app$1, executor$1, workflow$1, secretManager$1] = await Promise.all([
6646
+ const [functionRegistry, tailorDB, staticWebsite, idp, auth, pipeline, app, executor, workflow, secretManager] = await Promise.all([
6648
6647
  withSpan("plan.functionRegistry", () => planFunctionRegistry(client, workspaceId, application.name, functionEntries)),
6649
6648
  withSpan("plan.tailorDB", () => planTailorDB(ctx)),
6650
6649
  withSpan("plan.staticWebsite", () => planStaticWebsite(ctx)),
@@ -6657,16 +6656,16 @@ async function apply(options) {
6657
6656
  withSpan("plan.secretManager", () => planSecretManager(ctx))
6658
6657
  ]);
6659
6658
  return {
6660
- functionRegistry: functionRegistry$1,
6661
- tailorDB: tailorDB$1,
6662
- staticWebsite: staticWebsite$1,
6663
- idp: idp$1,
6664
- auth: auth$1,
6665
- pipeline: pipeline$1,
6666
- app: app$1,
6667
- executor: executor$1,
6668
- workflow: workflow$1,
6669
- secretManager: secretManager$1
6659
+ functionRegistry,
6660
+ tailorDB,
6661
+ staticWebsite,
6662
+ idp,
6663
+ auth,
6664
+ pipeline,
6665
+ app,
6666
+ executor,
6667
+ workflow,
6668
+ secretManager
6670
6669
  };
6671
6670
  });
6672
6671
  await withSpan("confirm", async () => {
@@ -7075,16 +7074,14 @@ async function getExecutor(options) {
7075
7074
  throw error;
7076
7075
  }
7077
7076
  }
7078
- const getCommand$3 = defineCommand({
7077
+ const getCommand$3 = defineAppCommand({
7079
7078
  name: "get",
7080
7079
  description: "Get executor details",
7081
7080
  args: z.object({
7082
- ...commonArgs,
7083
- ...jsonArgs,
7084
7081
  ...workspaceArgs,
7085
7082
  ...nameArgs$1
7086
7083
  }).strict(),
7087
- run: withCommonArgs(async (args) => {
7084
+ run: async (args) => {
7088
7085
  const executor = await getExecutor({
7089
7086
  name: args.name,
7090
7087
  workspaceId: args["workspace-id"],
@@ -7094,7 +7091,7 @@ const getCommand$3 = defineCommand({
7094
7091
  triggerConfig: null,
7095
7092
  targetConfig: null
7096
7093
  } });
7097
- })
7094
+ }
7098
7095
  });
7099
7096
 
7100
7097
  //#endregion
@@ -7286,7 +7283,7 @@ function toWorkflowExecutionInfo(execution) {
7286
7283
  //#endregion
7287
7284
  //#region src/cli/commands/workflow/executions.ts
7288
7285
  function sleep$1(ms) {
7289
- return new Promise((resolve$1) => setTimeout(resolve$1, ms));
7286
+ return new Promise((resolve) => setTimeout(resolve, ms));
7290
7287
  }
7291
7288
  function formatTime$2(date) {
7292
7289
  return date.toLocaleTimeString("en-US", { hour12: false });
@@ -7323,14 +7320,6 @@ async function listWorkflowExecutions(options) {
7323
7320
  profile: options?.profile
7324
7321
  });
7325
7322
  const filters = [];
7326
- if (workflowName) filters.push(create(FilterSchema, { condition: create(ConditionSchema, {
7327
- field: "workflow_name",
7328
- operator: Condition_Operator.EQ,
7329
- value: { kind: {
7330
- case: "stringValue",
7331
- value: workflowName
7332
- } }
7333
- }) }));
7334
7323
  if (options?.status) {
7335
7324
  const statusValue = parseStatus(options.status);
7336
7325
  filters.push(create(FilterSchema, { condition: create(ConditionSchema, {
@@ -7346,6 +7335,7 @@ async function listWorkflowExecutions(options) {
7346
7335
  return (await fetchAll(async (pageToken, maxPageSize) => {
7347
7336
  const { executions, nextPageToken } = await client.listWorkflowExecutions({
7348
7337
  workspaceId,
7338
+ workflowName: workflowName ?? "",
7349
7339
  pageToken,
7350
7340
  pageSize: maxPageSize,
7351
7341
  pageDirection: PageDirection.DESC,
@@ -7480,18 +7470,16 @@ function printExecutionWithLogs(execution) {
7480
7470
  }
7481
7471
  }
7482
7472
  }
7483
- const executionsCommand = defineCommand({
7473
+ const executionsCommand = defineAppCommand({
7484
7474
  name: "executions",
7485
7475
  description: "List or get workflow executions.",
7486
7476
  args: z.object({
7487
- ...commonArgs,
7488
- ...jsonArgs,
7489
7477
  ...workspaceArgs,
7490
7478
  executionId: arg(z.string().optional(), {
7491
7479
  positional: true,
7492
7480
  description: "Execution ID (if provided, shows details)"
7493
7481
  }),
7494
- "workflow-name": arg(z.string().optional(), {
7482
+ "workflow-name": arg(z.string().regex(/^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$/, "Must be 3-63 lowercase alphanumeric characters or hyphens, starting and ending with alphanumeric").optional(), {
7495
7483
  alias: "n",
7496
7484
  description: "Filter by workflow name (list mode only)"
7497
7485
  }),
@@ -7502,7 +7490,7 @@ const executionsCommand = defineCommand({
7502
7490
  ...waitArgs,
7503
7491
  logs: arg(z.boolean().default(false), { description: "Display job execution logs (detail mode only)" })
7504
7492
  }).strict(),
7505
- run: withCommonArgs(async (args) => {
7493
+ run: async (args) => {
7506
7494
  if (args.executionId) {
7507
7495
  const interval = parseDuration(args.interval);
7508
7496
  const { execution, wait } = await getWorkflowExecution({
@@ -7525,7 +7513,7 @@ const executionsCommand = defineCommand({
7525
7513
  });
7526
7514
  logger.out(executions);
7527
7515
  }
7528
- })
7516
+ }
7529
7517
  });
7530
7518
 
7531
7519
  //#endregion
@@ -7562,29 +7550,27 @@ async function getWorkflow(options) {
7562
7550
  throw error;
7563
7551
  }
7564
7552
  }
7565
- const getCommand$2 = defineCommand({
7553
+ const getCommand$2 = defineAppCommand({
7566
7554
  name: "get",
7567
7555
  description: "Get workflow details.",
7568
7556
  args: z.object({
7569
- ...commonArgs,
7570
- ...jsonArgs,
7571
7557
  ...workspaceArgs,
7572
7558
  ...nameArgs
7573
7559
  }).strict(),
7574
- run: withCommonArgs(async (args) => {
7560
+ run: async (args) => {
7575
7561
  const workflow = await getWorkflow({
7576
7562
  name: args.name,
7577
7563
  workspaceId: args["workspace-id"],
7578
7564
  profile: args.profile
7579
7565
  });
7580
7566
  logger.out(workflow);
7581
- })
7567
+ }
7582
7568
  });
7583
7569
 
7584
7570
  //#endregion
7585
7571
  //#region src/cli/commands/workflow/start.ts
7586
7572
  function sleep(ms) {
7587
- return new Promise((resolve$1) => setTimeout(resolve$1, ms));
7573
+ return new Promise((resolve) => setTimeout(resolve, ms));
7588
7574
  }
7589
7575
  function formatTime$1(date) {
7590
7576
  return date.toLocaleTimeString("en-US", { hour12: false });
@@ -7672,12 +7658,12 @@ async function startWorkflowCore(options) {
7672
7658
  try {
7673
7659
  const workflow = await resolveWorkflow(client, workspaceId, workflowName);
7674
7660
  const authInvoker = create(AuthInvokerSchema, options.authInvoker);
7675
- const arg$1 = options.arg === void 0 ? void 0 : typeof options.arg === "string" ? options.arg : JSON.stringify(options.arg);
7661
+ const arg = options.arg === void 0 ? void 0 : typeof options.arg === "string" ? options.arg : JSON.stringify(options.arg);
7676
7662
  const { executionId } = await client.testStartWorkflow({
7677
7663
  workspaceId,
7678
7664
  workflowId: workflow.id,
7679
7665
  authInvoker,
7680
- arg: arg$1
7666
+ arg
7681
7667
  });
7682
7668
  return {
7683
7669
  executionId,
@@ -7739,12 +7725,10 @@ async function startWorkflow(options) {
7739
7725
  interval: options.interval
7740
7726
  });
7741
7727
  }
7742
- const startCommand = defineCommand({
7728
+ const startCommand = defineAppCommand({
7743
7729
  name: "start",
7744
7730
  description: "Start a workflow execution.",
7745
7731
  args: z.object({
7746
- ...commonArgs,
7747
- ...jsonArgs,
7748
7732
  ...deploymentArgs,
7749
7733
  ...nameArgs,
7750
7734
  machineuser: arg(z.string(), {
@@ -7757,7 +7741,7 @@ const startCommand = defineCommand({
7757
7741
  }),
7758
7742
  ...waitArgs
7759
7743
  }).strict(),
7760
- run: withCommonArgs(async (args) => {
7744
+ run: async (args) => {
7761
7745
  const { executionId, wait } = await startWorkflowByName({
7762
7746
  name: args.name,
7763
7747
  machineUser: args.machineuser,
@@ -7780,7 +7764,7 @@ const startCommand = defineCommand({
7780
7764
  printExecutionWithLogs(execution);
7781
7765
  } else logger.out(result);
7782
7766
  } else logger.out({ executionId });
7783
- })
7767
+ }
7784
7768
  });
7785
7769
 
7786
7770
  //#endregion
@@ -7845,14 +7829,14 @@ async function getExecutorJob(options) {
7845
7829
  const jobInfo = toExecutorJobInfo(job);
7846
7830
  if (options.attempts) {
7847
7831
  const attempts = await fetchAll(async (pageToken, maxPageSize) => {
7848
- const { attempts: attempts$1, nextPageToken } = await client.listExecutorJobAttempts({
7832
+ const { attempts, nextPageToken } = await client.listExecutorJobAttempts({
7849
7833
  workspaceId,
7850
7834
  jobId: options.jobId,
7851
7835
  pageToken,
7852
7836
  pageSize: maxPageSize,
7853
7837
  pageDirection: PageDirection.DESC
7854
7838
  });
7855
- return [attempts$1, nextPageToken];
7839
+ return [attempts, nextPageToken];
7856
7840
  });
7857
7841
  return {
7858
7842
  ...jobInfo,
@@ -7936,10 +7920,10 @@ async function watchExecutorJob(options) {
7936
7920
  profile: options.profile,
7937
7921
  logs: true
7938
7922
  });
7939
- if (execWithLogs.jobDetails) workflowJobLogs = execWithLogs.jobDetails.filter((job$1) => job$1.logs || job$1.result).map((job$1) => ({
7940
- jobName: job$1.stackedJobName || job$1.id,
7941
- logs: job$1.logs,
7942
- result: job$1.result
7923
+ if (execWithLogs.jobDetails) workflowJobLogs = execWithLogs.jobDetails.filter((job) => job.logs || job.result).map((job) => ({
7924
+ jobName: job.stackedJobName || job.id,
7925
+ logs: job.logs,
7926
+ result: job.result
7943
7927
  }));
7944
7928
  }
7945
7929
  return {
@@ -8027,7 +8011,7 @@ function printJobWithAttempts(job) {
8027
8011
  }
8028
8012
  }
8029
8013
  }
8030
- const jobsCommand = defineCommand({
8014
+ const jobsCommand = defineAppCommand({
8031
8015
  name: "jobs",
8032
8016
  description: "List or get executor jobs.",
8033
8017
  examples: [
@@ -8061,8 +8045,6 @@ const jobsCommand = defineCommand({
8061
8045
  }
8062
8046
  ],
8063
8047
  args: z.object({
8064
- ...commonArgs,
8065
- ...jsonArgs,
8066
8048
  ...workspaceArgs,
8067
8049
  executorName: arg(z.string(), {
8068
8050
  positional: true,
@@ -8091,7 +8073,7 @@ const jobsCommand = defineCommand({
8091
8073
  }),
8092
8074
  limit: arg(positiveIntArg.optional(), { description: "Maximum number of jobs to list (default: 50, max: 1000) (list mode only)" })
8093
8075
  }).strict(),
8094
- run: withCommonArgs(async (args) => {
8076
+ run: async (args) => {
8095
8077
  if (args.jobId) {
8096
8078
  if (args.wait) {
8097
8079
  const result = await watchExecutorJob({
@@ -8159,7 +8141,7 @@ const jobsCommand = defineCommand({
8159
8141
  });
8160
8142
  logger.out(jobs);
8161
8143
  }
8162
- })
8144
+ }
8163
8145
  });
8164
8146
 
8165
8147
  //#endregion
@@ -8187,15 +8169,11 @@ async function listExecutors(options) {
8187
8169
  return [executors, nextPageToken];
8188
8170
  })).map((e) => toExecutorListInfo(e));
8189
8171
  }
8190
- const listCommand$6 = defineCommand({
8172
+ const listCommand$6 = defineAppCommand({
8191
8173
  name: "list",
8192
8174
  description: "List all executors",
8193
- args: z.object({
8194
- ...commonArgs,
8195
- ...jsonArgs,
8196
- ...workspaceArgs
8197
- }).strict(),
8198
- run: withCommonArgs(async (args) => {
8175
+ args: z.object({ ...workspaceArgs }).strict(),
8176
+ run: async (args) => {
8199
8177
  const executors = await listExecutors({
8200
8178
  workspaceId: args["workspace-id"],
8201
8179
  profile: args.profile
@@ -8208,7 +8186,7 @@ const listCommand$6 = defineCommand({
8208
8186
  if (!args.json) {
8209
8187
  if (executors.some((e) => e.triggerType === "webhook")) logger.info("To see webhook URLs, run: tailor-sdk executor webhook list");
8210
8188
  }
8211
- })
8189
+ }
8212
8190
  });
8213
8191
 
8214
8192
  //#endregion
@@ -8271,7 +8249,7 @@ async function triggerExecutor(options) {
8271
8249
  profile: options.profile
8272
8250
  });
8273
8251
  }
8274
- const triggerCommand = defineCommand({
8252
+ const triggerCommand = defineAppCommand({
8275
8253
  name: "trigger",
8276
8254
  description: "Trigger an executor manually.",
8277
8255
  notes: `Only executors with \`INCOMING_WEBHOOK\` or \`SCHEDULE\` trigger types can be triggered manually.
@@ -8311,8 +8289,6 @@ The \`--logs\` option displays logs from the downstream execution when available
8311
8289
  }
8312
8290
  ],
8313
8291
  args: z.object({
8314
- ...commonArgs,
8315
- ...jsonArgs,
8316
8292
  ...workspaceArgs,
8317
8293
  executorName: arg(z.string(), {
8318
8294
  positional: true,
@@ -8340,7 +8316,7 @@ The \`--logs\` option displays logs from the downstream execution when available
8340
8316
  description: "Display function execution logs after completion (requires --wait)"
8341
8317
  })
8342
8318
  }).strict(),
8343
- run: withCommonArgs(async (args) => {
8319
+ run: async (args) => {
8344
8320
  const client = await initOperatorClient(await loadAccessToken({
8345
8321
  useProfile: true,
8346
8322
  profile: args.profile
@@ -8421,7 +8397,7 @@ The \`--logs\` option displays logs from the downstream execution when available
8421
8397
  }
8422
8398
  } else logger.out(watchResult);
8423
8399
  }
8424
- })
8400
+ }
8425
8401
  });
8426
8402
 
8427
8403
  //#endregion
@@ -8462,15 +8438,11 @@ async function listWebhookExecutors(options) {
8462
8438
  disabled: e.disabled
8463
8439
  }));
8464
8440
  }
8465
- const listWebhookCommand = defineCommand({
8441
+ const listWebhookCommand = defineAppCommand({
8466
8442
  name: "list",
8467
8443
  description: "List executors with incoming webhook triggers",
8468
- args: z.object({
8469
- ...commonArgs,
8470
- ...jsonArgs,
8471
- ...workspaceArgs
8472
- }).strict(),
8473
- run: withCommonArgs(async (args) => {
8444
+ args: z.object({ ...workspaceArgs }).strict(),
8445
+ run: async (args) => {
8474
8446
  const executors = await listWebhookExecutors({
8475
8447
  workspaceId: args["workspace-id"],
8476
8448
  profile: args.profile
@@ -8481,7 +8453,7 @@ const listWebhookCommand = defineCommand({
8481
8453
  }
8482
8454
  logger.out(executors, { display: { disabled: (v) => v ? styles.warning("true") : styles.dim("false") } });
8483
8455
  if (!args.json) logger.info("To test a webhook, run: tailor-sdk executor trigger <name> -d '{\"key\":\"value\"}'");
8484
- })
8456
+ }
8485
8457
  });
8486
8458
  const webhookCommand = defineCommand({
8487
8459
  name: "webhook",
@@ -8959,10 +8931,10 @@ function createGenerationManager(params) {
8959
8931
  const results = generatorResults[gen.id];
8960
8932
  results.resolverResults[namespace] = {};
8961
8933
  if (!gen.processResolver) return;
8962
- const processResolver$1 = gen.processResolver;
8934
+ const processResolver = gen.processResolver;
8963
8935
  await Promise.allSettled(Object.entries(resolvers).map(async ([resolverName, resolver]) => {
8964
8936
  try {
8965
- results.resolverResults[namespace][resolverName] = await processResolver$1({
8937
+ results.resolverResults[namespace][resolverName] = await processResolver({
8966
8938
  resolver,
8967
8939
  namespace
8968
8940
  });
@@ -9093,7 +9065,7 @@ function createGenerationManager(params) {
9093
9065
  * @param hookName - Name of the hook to call
9094
9066
  * @param watch - Whether running in watch mode (suppresses throws)
9095
9067
  */
9096
- async function runPluginHook(hookName, watch$1) {
9068
+ async function runPluginHook(hookName, watch) {
9097
9069
  const plugins = generationPlugins.filter((p) => p[hookName] != null);
9098
9070
  if (plugins.length === 0) return;
9099
9071
  const results = await Promise.allSettled(plugins.map(async (plugin) => {
@@ -9102,10 +9074,10 @@ function createGenerationManager(params) {
9102
9074
  } catch (error) {
9103
9075
  logger.error(`Error processing plugin ${styles.bold(plugin.id)} (${hookName})`);
9104
9076
  logger.error(String(error));
9105
- if (!watch$1) throw error;
9077
+ if (!watch) throw error;
9106
9078
  }
9107
9079
  }));
9108
- if (!watch$1) {
9080
+ if (!watch) {
9109
9081
  const failures = results.filter((r) => r.status === "rejected");
9110
9082
  if (failures.length > 0) throw new AggregateError(failures.map((f) => f.reason));
9111
9083
  }
@@ -9118,11 +9090,11 @@ function createGenerationManager(params) {
9118
9090
  async function writeGeneratedFiles(sourceId, result) {
9119
9091
  await Promise.all(result.files.map(async (file) => {
9120
9092
  fs$1.mkdirSync(path.dirname(file.path), { recursive: true });
9121
- return new Promise((resolve$1, reject) => {
9093
+ return new Promise((resolve, reject) => {
9122
9094
  if (file.skipIfExists && fs$1.existsSync(file.path)) {
9123
9095
  const relativePath = path.relative(process.cwd(), file.path);
9124
9096
  logger.debug(`${sourceId} | skip existing: ${relativePath}`);
9125
- return resolve$1();
9097
+ return resolve();
9126
9098
  }
9127
9099
  fs$1.writeFile(file.path, file.content, (err) => {
9128
9100
  if (err) {
@@ -9135,13 +9107,13 @@ function createGenerationManager(params) {
9135
9107
  logger.log(`${sourceId} | generate: ${styles.success(relativePath)}`);
9136
9108
  if (file.executable) fs$1.chmod(file.path, 493, (chmodErr) => {
9137
9109
  if (chmodErr) {
9138
- const relativePath$1 = path.relative(process.cwd(), file.path);
9139
- logger.error(`Error setting executable permission on ${styles.bold(relativePath$1)}`);
9110
+ const relativePath = path.relative(process.cwd(), file.path);
9111
+ logger.error(`Error setting executable permission on ${styles.bold(relativePath)}`);
9140
9112
  logger.error(String(chmodErr));
9141
9113
  reject(chmodErr);
9142
- } else resolve$1();
9114
+ } else resolve();
9143
9115
  });
9144
- else resolve$1();
9116
+ else resolve();
9145
9117
  }
9146
9118
  });
9147
9119
  });
@@ -9160,7 +9132,7 @@ function createGenerationManager(params) {
9160
9132
  if (hasDependency(gen, "executor")) await processExecutors(gen);
9161
9133
  await aggregate(gen);
9162
9134
  }
9163
- async function runGenerators(gens, watch$1) {
9135
+ async function runGenerators(gens, watch) {
9164
9136
  const results = await Promise.allSettled(gens.map(async (gen) => {
9165
9137
  await withSpan(`generate.generator.${gen.id}`, async () => {
9166
9138
  try {
@@ -9168,11 +9140,11 @@ function createGenerationManager(params) {
9168
9140
  } catch (error) {
9169
9141
  logger.error(`Error processing generator ${styles.bold(gen.id)}`);
9170
9142
  logger.error(String(error));
9171
- if (!watch$1) throw error;
9143
+ if (!watch) throw error;
9172
9144
  }
9173
9145
  });
9174
9146
  }));
9175
- if (!watch$1) {
9147
+ if (!watch) {
9176
9148
  const failures = results.filter((r) => r.status === "rejected");
9177
9149
  if (failures.length > 0) throw new AggregateError(failures.map((f) => f.reason));
9178
9150
  }
@@ -9212,36 +9184,36 @@ function createGenerationManager(params) {
9212
9184
  processResolverNamespace,
9213
9185
  processExecutors,
9214
9186
  aggregate,
9215
- async generate(watch$1) {
9187
+ async generate(watch) {
9216
9188
  logger.newline();
9217
9189
  logger.log(`Generation for application: ${styles.highlight(application.config.name)}`);
9218
9190
  const app = application;
9219
9191
  await withSpan("generate.loadTailorDBTypes", async (span) => {
9220
9192
  span.setAttribute("generate.namespace_count", app.tailorDBServices.length);
9221
- for (const db$1 of app.tailorDBServices) {
9222
- const namespace = db$1.namespace;
9193
+ for (const db of app.tailorDBServices) {
9194
+ const namespace = db.namespace;
9223
9195
  await withSpan(`generate.loadTypes.${namespace}`, async () => {
9224
9196
  try {
9225
- await db$1.loadTypes();
9226
- await db$1.processNamespacePlugins();
9197
+ await db.loadTypes();
9198
+ await db.processNamespacePlugins();
9227
9199
  services.tailordb[namespace] = {
9228
- types: db$1.types,
9229
- sourceInfo: db$1.typeSourceInfo,
9230
- pluginAttachments: db$1.pluginAttachments
9200
+ types: db.types,
9201
+ sourceInfo: db.typeSourceInfo,
9202
+ pluginAttachments: db.pluginAttachments
9231
9203
  };
9232
9204
  } catch (error) {
9233
9205
  logger.error(`Error loading types for TailorDB service ${styles.bold(namespace)}`);
9234
9206
  logger.error(String(error));
9235
- if (!watch$1) throw error;
9207
+ if (!watch) throw error;
9236
9208
  }
9237
9209
  });
9238
9210
  }
9239
9211
  });
9240
9212
  const { pluginExecutorFiles, executorService } = await withSpan("generate.pluginFiles", async () => {
9241
- const pluginExecutorFiles$1 = generatePluginFilesIfNeeded(pluginManager, app.tailorDBServices, config.path);
9213
+ const pluginExecutorFiles = generatePluginFilesIfNeeded(pluginManager, app.tailorDBServices, config.path);
9242
9214
  return {
9243
- pluginExecutorFiles: pluginExecutorFiles$1,
9244
- executorService: app.executorService ?? (pluginExecutorFiles$1.length > 0 ? createExecutorService({ config: { files: [] } }) : void 0)
9215
+ pluginExecutorFiles,
9216
+ executorService: app.executorService ?? (pluginExecutorFiles.length > 0 ? createExecutorService({ config: { files: [] } }) : void 0)
9245
9217
  };
9246
9218
  });
9247
9219
  if (app.authService) await withSpan("generate.resolveAuthNamespaces", async () => app.authService.resolveNamespaces());
@@ -9250,7 +9222,7 @@ function createGenerationManager(params) {
9250
9222
  const hasOnTailorDBReady = generationPlugins.some((p) => p.onTailorDBReady != null);
9251
9223
  if (readyAfterTailorDB.length > 0 || hasOnTailorDBReady) {
9252
9224
  await withSpan("generate.onTailorDBReady", async () => {
9253
- await Promise.all([runGenerators(readyAfterTailorDB, watch$1), runPluginHook("onTailorDBReady", watch$1)]);
9225
+ await Promise.all([runGenerators(readyAfterTailorDB, watch), runPluginHook("onTailorDBReady", watch)]);
9254
9226
  });
9255
9227
  logger.newline();
9256
9228
  }
@@ -9267,7 +9239,7 @@ function createGenerationManager(params) {
9267
9239
  } catch (error) {
9268
9240
  logger.error(`Error loading resolvers for Resolver service ${styles.bold(namespace)}`);
9269
9241
  logger.error(String(error));
9270
- if (!watch$1) throw error;
9242
+ if (!watch) throw error;
9271
9243
  }
9272
9244
  });
9273
9245
  }
@@ -9276,7 +9248,7 @@ function createGenerationManager(params) {
9276
9248
  const hasOnResolverReady = generationPlugins.some((p) => p.onResolverReady != null);
9277
9249
  if (readyAfterResolvers.length > 0 || hasOnResolverReady) {
9278
9250
  await withSpan("generate.onResolversReady", async () => {
9279
- await Promise.all([runGenerators(readyAfterResolvers, watch$1), runPluginHook("onResolverReady", watch$1)]);
9251
+ await Promise.all([runGenerators(readyAfterResolvers, watch), runPluginHook("onResolverReady", watch)]);
9280
9252
  });
9281
9253
  logger.newline();
9282
9254
  }
@@ -9294,7 +9266,7 @@ function createGenerationManager(params) {
9294
9266
  const hasOnExecutorReady = generationPlugins.some((p) => p.onExecutorReady != null);
9295
9267
  if (readyAfterExecutors.length > 0 || hasOnExecutorReady) {
9296
9268
  await withSpan("generate.onExecutorsReady", async () => {
9297
- await Promise.all([runGenerators(readyAfterExecutors, watch$1), runPluginHook("onExecutorReady", watch$1)]);
9269
+ await Promise.all([runGenerators(readyAfterExecutors, watch), runPluginHook("onExecutorReady", watch)]);
9298
9270
  });
9299
9271
  logger.newline();
9300
9272
  }
@@ -9306,9 +9278,9 @@ function createGenerationManager(params) {
9306
9278
  });
9307
9279
  await watcher.addWatchGroup("Config", [config.path]);
9308
9280
  const app = application;
9309
- for (const db$1 of app.tailorDBServices) {
9310
- const dbNamespace = db$1.namespace;
9311
- await watcher?.addWatchGroup(`TailorDB/${dbNamespace}`, db$1.config.files);
9281
+ for (const db of app.tailorDBServices) {
9282
+ const dbNamespace = db.namespace;
9283
+ await watcher?.addWatchGroup(`TailorDB/${dbNamespace}`, db.config.files);
9312
9284
  }
9313
9285
  for (const resolverService of app.resolverServices) {
9314
9286
  const resolverNamespace = resolverService.namespace;
@@ -9326,8 +9298,8 @@ function createGenerationManager(params) {
9326
9298
  async function generate$1(options) {
9327
9299
  return withSpan("generate", async (rootSpan) => {
9328
9300
  const { config, generators, plugins } = await withSpan("generate.loadConfig", async () => loadConfig(options?.configPath));
9329
- const watch$1 = options?.watch ?? false;
9330
- rootSpan.setAttribute("generate.watch", watch$1);
9301
+ const watch = options?.watch ?? false;
9302
+ rootSpan.setAttribute("generate.watch", watch);
9331
9303
  rootSpan.setAttribute("generate.generators.count", generators.length);
9332
9304
  await withSpan("generate.generateUserTypes", async () => generateUserTypes({
9333
9305
  config,
@@ -9346,8 +9318,8 @@ async function generate$1(options) {
9346
9318
  generators,
9347
9319
  pluginManager
9348
9320
  });
9349
- await manager.generate(watch$1);
9350
- if (watch$1) await manager.watch();
9321
+ await manager.generate(watch);
9322
+ if (watch) await manager.watch();
9351
9323
  });
9352
9324
  }
9353
9325
 
@@ -9398,15 +9370,11 @@ async function listMachineUsers(options) {
9398
9370
  return [machineUsers, nextPageToken];
9399
9371
  })).map(machineUserInfo);
9400
9372
  }
9401
- const listCommand$5 = defineCommand({
9373
+ const listCommand$5 = defineAppCommand({
9402
9374
  name: "list",
9403
9375
  description: "List all machine users in the application.",
9404
- args: z.object({
9405
- ...commonArgs,
9406
- ...jsonArgs,
9407
- ...deploymentArgs
9408
- }).strict(),
9409
- run: withCommonArgs(async (args) => {
9376
+ args: z.object({ ...deploymentArgs }).strict(),
9377
+ run: async (args) => {
9410
9378
  const machineUsers = await listMachineUsers({
9411
9379
  workspaceId: args["workspace-id"],
9412
9380
  profile: args.profile,
@@ -9416,7 +9384,7 @@ const listCommand$5 = defineCommand({
9416
9384
  createdAt: null,
9417
9385
  updatedAt: null
9418
9386
  } });
9419
- })
9387
+ }
9420
9388
  });
9421
9389
 
9422
9390
  //#endregion
@@ -9456,19 +9424,17 @@ async function getMachineUserToken(options) {
9456
9424
  expiresAt: expiresAt.toISOString()
9457
9425
  };
9458
9426
  }
9459
- const tokenCommand = defineCommand({
9427
+ const tokenCommand = defineAppCommand({
9460
9428
  name: "token",
9461
9429
  description: "Get an access token for a machine user.",
9462
9430
  args: z.object({
9463
- ...commonArgs,
9464
- ...jsonArgs,
9465
9431
  ...deploymentArgs,
9466
9432
  name: arg(z.string(), {
9467
9433
  positional: true,
9468
9434
  description: "Machine user name"
9469
9435
  })
9470
9436
  }).strict(),
9471
- run: withCommonArgs(async (args) => {
9437
+ run: async (args) => {
9472
9438
  const token = await getMachineUserToken({
9473
9439
  name: args.name,
9474
9440
  workspaceId: args["workspace-id"],
@@ -9481,7 +9447,7 @@ const tokenCommand = defineCommand({
9481
9447
  expires_at: token.expiresAt
9482
9448
  };
9483
9449
  logger.out(tokenInfo);
9484
- })
9450
+ }
9485
9451
  });
9486
9452
 
9487
9453
  //#endregion
@@ -9559,19 +9525,17 @@ async function getOAuth2Client(options) {
9559
9525
  throw error;
9560
9526
  }
9561
9527
  }
9562
- const getCommand$1 = defineCommand({
9528
+ const getCommand$1 = defineAppCommand({
9563
9529
  name: "get",
9564
9530
  description: "Get OAuth2 client credentials (including client secret).",
9565
9531
  args: z.object({
9566
- ...commonArgs,
9567
- ...jsonArgs,
9568
9532
  ...deploymentArgs,
9569
9533
  name: arg(z.string(), {
9570
9534
  positional: true,
9571
9535
  description: "OAuth2 client name"
9572
9536
  })
9573
9537
  }).strict(),
9574
- run: withCommonArgs(async (args) => {
9538
+ run: async (args) => {
9575
9539
  const credentials = await getOAuth2Client({
9576
9540
  name: args.name,
9577
9541
  workspaceId: args["workspace-id"],
@@ -9579,7 +9543,7 @@ const getCommand$1 = defineCommand({
9579
9543
  configPath: args.config
9580
9544
  });
9581
9545
  logger.out(credentials);
9582
- })
9546
+ }
9583
9547
  });
9584
9548
 
9585
9549
  //#endregion
@@ -9614,22 +9578,18 @@ async function listOAuth2Clients(options) {
9614
9578
  return [oauth2Clients, nextPageToken];
9615
9579
  })).map(toOAuth2ClientInfo);
9616
9580
  }
9617
- const listCommand$4 = defineCommand({
9581
+ const listCommand$4 = defineAppCommand({
9618
9582
  name: "list",
9619
9583
  description: "List all OAuth2 clients in the application.",
9620
- args: z.object({
9621
- ...commonArgs,
9622
- ...jsonArgs,
9623
- ...deploymentArgs
9624
- }).strict(),
9625
- run: withCommonArgs(async (args) => {
9584
+ args: z.object({ ...deploymentArgs }).strict(),
9585
+ run: async (args) => {
9626
9586
  const oauth2Clients = await listOAuth2Clients({
9627
9587
  workspaceId: args["workspace-id"],
9628
9588
  profile: args.profile,
9629
9589
  configPath: args.config
9630
9590
  });
9631
9591
  logger.out(oauth2Clients);
9632
- })
9592
+ }
9633
9593
  });
9634
9594
 
9635
9595
  //#endregion
@@ -9695,15 +9655,14 @@ async function remove(options) {
9695
9655
  const { client, workspaceId, application, config } = await loadOptions$10(options);
9696
9656
  await execRemove(client, workspaceId, application, config);
9697
9657
  }
9698
- const removeCommand$1 = defineCommand({
9658
+ const removeCommand$1 = defineAppCommand({
9699
9659
  name: "remove",
9700
9660
  description: "Remove all resources managed by the application from the workspace.",
9701
9661
  args: z.object({
9702
- ...commonArgs,
9703
9662
  ...deploymentArgs,
9704
9663
  ...confirmationArgs
9705
9664
  }).strict(),
9706
- run: withCommonArgs(async (args) => {
9665
+ run: async (args) => {
9707
9666
  const { client, workspaceId, application, config } = await loadOptions$10({
9708
9667
  workspaceId: args["workspace-id"],
9709
9668
  profile: args.profile,
@@ -9713,9 +9672,9 @@ const removeCommand$1 = defineCommand({
9713
9672
  logger.newline();
9714
9673
  await execRemove(client, workspaceId, application, config, async () => {
9715
9674
  if (!args.yes) {
9716
- if (!await logger.prompt("Are you sure you want to remove all resources?", {
9717
- type: "confirm",
9718
- initial: false
9675
+ if (!await prompt.confirm({
9676
+ message: "Are you sure you want to remove all resources?",
9677
+ default: false
9719
9678
  })) throw new Error(ml`
9720
9679
  Remove cancelled. No resources were deleted.
9721
9680
  To override, run again and confirm, or use --yes flag.
@@ -9723,7 +9682,7 @@ const removeCommand$1 = defineCommand({
9723
9682
  } else logger.success("Removing all resources (--yes flag specified)...");
9724
9683
  });
9725
9684
  logger.success(`Successfully removed all resources managed by "${application.name}".`);
9726
- })
9685
+ }
9727
9686
  });
9728
9687
 
9729
9688
  //#endregion
@@ -9760,31 +9719,27 @@ async function show(options) {
9760
9719
  workspaceId,
9761
9720
  applicationName: config.name
9762
9721
  })]);
9763
- const { name, ...appInfo$1 } = applicationInfo(resp.application);
9722
+ const { name, ...appInfo } = applicationInfo(resp.application);
9764
9723
  return {
9765
9724
  name,
9766
9725
  workspaceId,
9767
9726
  workspaceName: workspaceResp.workspace?.name ?? "",
9768
9727
  workspaceRegion: workspaceResp.workspace?.region ?? "",
9769
- ...appInfo$1
9728
+ ...appInfo
9770
9729
  };
9771
9730
  }
9772
- const showCommand = defineCommand({
9731
+ const showCommand = defineAppCommand({
9773
9732
  name: "show",
9774
9733
  description: "Show information about the deployed application.",
9775
- args: z.object({
9776
- ...commonArgs,
9777
- ...jsonArgs,
9778
- ...deploymentArgs
9779
- }).strict(),
9780
- run: withCommonArgs(async (args) => {
9781
- const appInfo$1 = await show({
9734
+ args: z.object({ ...deploymentArgs }).strict(),
9735
+ run: async (args) => {
9736
+ const appInfo = await show({
9782
9737
  workspaceId: args["workspace-id"],
9783
9738
  profile: args.profile,
9784
9739
  configPath: args.config
9785
9740
  });
9786
- logger.out(appInfo$1);
9787
- })
9741
+ logger.out(appInfo);
9742
+ }
9788
9743
  });
9789
9744
 
9790
9745
  //#endregion
@@ -9835,7 +9790,7 @@ function parseEditorCommand(editor) {
9835
9790
  */
9836
9791
  async function openInEditor(filePath, editor = getEditorCommand()) {
9837
9792
  const { command, args } = parseEditorCommand(editor);
9838
- await new Promise((resolve$1, reject) => {
9793
+ await new Promise((resolve, reject) => {
9839
9794
  const child = spawn(command, [...args, filePath], {
9840
9795
  stdio: "inherit",
9841
9796
  detached: false
@@ -9843,7 +9798,7 @@ async function openInEditor(filePath, editor = getEditorCommand()) {
9843
9798
  child.once("error", (error) => reject(error));
9844
9799
  child.once("close", (code) => {
9845
9800
  if (code == null || code === 0) {
9846
- resolve$1();
9801
+ resolve();
9847
9802
  return;
9848
9803
  }
9849
9804
  reject(/* @__PURE__ */ new Error(`Editor exited with code ${code}.`));
@@ -10331,9 +10286,9 @@ async function handleInitOption(namespaces, skipConfirmation) {
10331
10286
  for (const { namespace, migrationsDir } of existingDirs) logger.log(` - ${namespace}: ${migrationsDir}`);
10332
10287
  logger.newline();
10333
10288
  if (!skipConfirmation) {
10334
- if (!await logger.prompt("Are you sure you want to delete these directories and start fresh?", {
10335
- type: "confirm",
10336
- initial: false
10289
+ if (!await prompt.confirm({
10290
+ message: "Are you sure you want to delete these directories and start fresh?",
10291
+ default: false
10337
10292
  })) {
10338
10293
  logger.info("Operation cancelled.");
10339
10294
  process.exit(0);
@@ -10371,8 +10326,8 @@ async function generate(options) {
10371
10326
  if (options.init) await handleInitOption(namespacesWithMigrations, options.yes);
10372
10327
  let pluginManager;
10373
10328
  if (plugins.length > 0) pluginManager = new PluginManager(plugins);
10374
- const { defineApplication: defineApplication$1 } = await import("./application-B4ORumjE.mjs");
10375
- const application = defineApplication$1({
10329
+ const { defineApplication } = await import("./application-DegTCDd8.mjs");
10330
+ const application = defineApplication({
10376
10331
  config,
10377
10332
  pluginManager
10378
10333
  });
@@ -10403,7 +10358,7 @@ async function generate(options) {
10403
10358
  * @returns {Promise<void>} Promise that resolves when snapshot is generated
10404
10359
  */
10405
10360
  async function generateInitialSnapshot(snapshot, migrationsDir) {
10406
- const result = await generateSchemaFile(snapshot, migrationsDir, INITIAL_SCHEMA_NUMBER);
10361
+ const result = await generateSchemaFile(snapshot, migrationsDir, 0);
10407
10362
  logger.success(`Generated initial schema snapshot`);
10408
10363
  logger.info(` File: ${result.filePath}`);
10409
10364
  logger.info(` Types: ${Object.keys(snapshot.types).length}`);
@@ -10450,11 +10405,10 @@ async function generateDiffFromSnapshot(previousSnapshot, currentSnapshot, migra
10450
10405
  logger.newline();
10451
10406
  logger.warn(formatBreakingChanges(diff.breakingChanges));
10452
10407
  if (!options.yes) {
10453
- if (await logger.prompt("Continue generating migration?", {
10454
- type: "confirm",
10455
- initial: true,
10456
- cancel: "symbol"
10457
- }) !== true) {
10408
+ if (!await prompt.confirm({
10409
+ message: "Continue generating migration?",
10410
+ default: true
10411
+ })) {
10458
10412
  logger.info("Migration generation cancelled.");
10459
10413
  return;
10460
10414
  }
@@ -10489,11 +10443,10 @@ async function generateDiffFromSnapshot(previousSnapshot, currentSnapshot, migra
10489
10443
  /**
10490
10444
  * CLI command definition for generate
10491
10445
  */
10492
- const generateCommand = defineCommand({
10446
+ const generateCommand = defineAppCommand({
10493
10447
  name: "generate",
10494
10448
  description: "Generate migration files by detecting schema differences between current local types and the previous migration snapshot.",
10495
10449
  args: z.object({
10496
- ...commonArgs,
10497
10450
  ...confirmationArgs,
10498
10451
  ...configArg,
10499
10452
  name: arg(z.string().optional(), {
@@ -10502,14 +10455,14 @@ const generateCommand = defineCommand({
10502
10455
  }),
10503
10456
  init: arg(z.boolean().default(false), { description: "Delete existing migrations and start fresh" })
10504
10457
  }).strict(),
10505
- run: withCommonArgs(async (args) => {
10458
+ run: async (args) => {
10506
10459
  await generate({
10507
10460
  configPath: args.config,
10508
10461
  name: args.name,
10509
10462
  yes: args.yes,
10510
10463
  init: args.init
10511
10464
  });
10512
- })
10465
+ }
10513
10466
  });
10514
10467
 
10515
10468
  //#endregion
@@ -10625,9 +10578,9 @@ async function $truncate(options) {
10625
10578
  }
10626
10579
  if (!options?.yes) {
10627
10580
  const namespaceList = namespaces.join(", ");
10628
- if (!await logger.prompt(`This will truncate ALL tables in the following namespaces: ${namespaceList}. Continue? (yes/no)`, {
10629
- type: "confirm",
10630
- initial: false
10581
+ if (!await prompt.confirm({
10582
+ message: `This will truncate ALL tables in the following namespaces: ${namespaceList}. Continue?`,
10583
+ default: false
10631
10584
  })) {
10632
10585
  logger.info("Truncate cancelled.");
10633
10586
  return;
@@ -10641,9 +10594,9 @@ async function $truncate(options) {
10641
10594
  const namespace = options.namespace;
10642
10595
  if (!namespaces.includes(namespace)) throw new Error(`Namespace "${namespace}" not found in config. Available namespaces: ${namespaces.join(", ")}`);
10643
10596
  if (!options.yes) {
10644
- if (!await logger.prompt(`This will truncate ALL tables in namespace "${namespace}". Continue? (yes/no)`, {
10645
- type: "confirm",
10646
- initial: false
10597
+ if (!await prompt.confirm({
10598
+ message: `This will truncate ALL tables in namespace "${namespace}". Continue?`,
10599
+ default: false
10647
10600
  })) {
10648
10601
  logger.info("Truncate cancelled.");
10649
10602
  return;
@@ -10664,9 +10617,9 @@ async function $truncate(options) {
10664
10617
  if (notFoundTypes.length > 0) throw new Error(`The following types were not found in any namespace: ${notFoundTypes.join(", ")}`);
10665
10618
  if (!options.yes) {
10666
10619
  const typeList = typeNames.join(", ");
10667
- if (!await logger.prompt(`This will truncate the following types: ${typeList}. Continue? (yes/no)`, {
10668
- type: "confirm",
10669
- initial: false
10620
+ if (!await prompt.confirm({
10621
+ message: `This will truncate the following types: ${typeList}. Continue?`,
10622
+ default: false
10670
10623
  })) {
10671
10624
  logger.info("Truncate cancelled.");
10672
10625
  return;
@@ -10683,11 +10636,10 @@ async function $truncate(options) {
10683
10636
  }
10684
10637
  }
10685
10638
  }
10686
- const truncateCommand = defineCommand({
10639
+ const truncateCommand = defineAppCommand({
10687
10640
  name: "truncate",
10688
10641
  description: "Truncate (delete all records from) TailorDB tables.",
10689
10642
  args: z.object({
10690
- ...commonArgs,
10691
10643
  ...deploymentArgs,
10692
10644
  ...confirmationArgs,
10693
10645
  types: arg(z.string().array().optional(), {
@@ -10703,7 +10655,7 @@ const truncateCommand = defineCommand({
10703
10655
  description: "Truncate all tables in specified namespace"
10704
10656
  })
10705
10657
  }).strict(),
10706
- run: withCommonArgs(async (args) => {
10658
+ run: async (args) => {
10707
10659
  const types = args.types && args.types.length > 0 ? args.types : void 0;
10708
10660
  await $truncate({
10709
10661
  workspaceId: args["workspace-id"],
@@ -10714,7 +10666,7 @@ const truncateCommand = defineCommand({
10714
10666
  types,
10715
10667
  yes: args.yes
10716
10668
  });
10717
- })
10669
+ }
10718
10670
  });
10719
10671
 
10720
10672
  //#endregion
@@ -10742,15 +10694,11 @@ async function listWorkflows(options) {
10742
10694
  return [workflows, nextPageToken];
10743
10695
  })).map(toWorkflowListInfo);
10744
10696
  }
10745
- const listCommand$3 = defineCommand({
10697
+ const listCommand$3 = defineAppCommand({
10746
10698
  name: "list",
10747
10699
  description: "List all workflows in the workspace.",
10748
- args: z.object({
10749
- ...commonArgs,
10750
- ...jsonArgs,
10751
- ...workspaceArgs
10752
- }).strict(),
10753
- run: withCommonArgs(async (args) => {
10700
+ args: z.object({ ...workspaceArgs }).strict(),
10701
+ run: async (args) => {
10754
10702
  const workflows = await listWorkflows({
10755
10703
  workspaceId: args["workspace-id"],
10756
10704
  profile: args.profile
@@ -10760,7 +10708,7 @@ const listCommand$3 = defineCommand({
10760
10708
  return;
10761
10709
  }
10762
10710
  logger.out(workflows);
10763
- })
10711
+ }
10764
10712
  });
10765
10713
 
10766
10714
  //#endregion
@@ -10802,12 +10750,10 @@ async function resumeWorkflow(options) {
10802
10750
  throw error;
10803
10751
  }
10804
10752
  }
10805
- const resumeCommand = defineCommand({
10753
+ const resumeCommand = defineAppCommand({
10806
10754
  name: "resume",
10807
10755
  description: "Resume a failed or pending workflow execution.",
10808
10756
  args: z.object({
10809
- ...commonArgs,
10810
- ...jsonArgs,
10811
10757
  ...workspaceArgs,
10812
10758
  executionId: arg(z.string(), {
10813
10759
  positional: true,
@@ -10815,7 +10761,7 @@ const resumeCommand = defineCommand({
10815
10761
  }),
10816
10762
  ...waitArgs
10817
10763
  }).strict(),
10818
- run: withCommonArgs(async (args) => {
10764
+ run: async (args) => {
10819
10765
  const { executionId, wait } = await resumeWorkflow({
10820
10766
  executionId: args.executionId,
10821
10767
  workspaceId: args["workspace-id"],
@@ -10835,7 +10781,7 @@ const resumeCommand = defineCommand({
10835
10781
  printExecutionWithLogs(execution);
10836
10782
  } else logger.out(result);
10837
10783
  } else logger.out({ executionId });
10838
- })
10784
+ }
10839
10785
  });
10840
10786
 
10841
10787
  //#endregion
@@ -10906,19 +10852,17 @@ async function getAppHealth(options) {
10906
10852
  applicationName: name
10907
10853
  }));
10908
10854
  }
10909
- const healthCommand = defineCommand({
10855
+ const healthCommand = defineAppCommand({
10910
10856
  name: "health",
10911
10857
  description: "Check application schema health",
10912
10858
  args: z.object({
10913
- ...commonArgs,
10914
- ...jsonArgs,
10915
10859
  ...workspaceArgs,
10916
10860
  name: arg(z.string(), {
10917
10861
  description: "Application name",
10918
10862
  alias: "n"
10919
10863
  })
10920
10864
  }).strict(),
10921
- run: withCommonArgs(async (args) => {
10865
+ run: async (args) => {
10922
10866
  const health = await getAppHealth({
10923
10867
  workspaceId: args["workspace-id"],
10924
10868
  profile: args.profile,
@@ -10930,7 +10874,7 @@ const healthCommand = defineCommand({
10930
10874
  lastAttemptAt: humanizeRelativeTime(health.lastAttemptAt)
10931
10875
  };
10932
10876
  logger.out(formattedHealth);
10933
- })
10877
+ }
10934
10878
  });
10935
10879
 
10936
10880
  //#endregion
@@ -10979,19 +10923,17 @@ async function listApps(options) {
10979
10923
  }
10980
10924
  return results;
10981
10925
  }
10982
- const listCommand$2 = defineCommand({
10926
+ const listCommand$2 = defineAppCommand({
10983
10927
  name: "list",
10984
10928
  description: "List applications in a workspace",
10985
10929
  args: z.object({
10986
- ...commonArgs,
10987
- ...jsonArgs,
10988
10930
  ...workspaceArgs,
10989
10931
  limit: arg(positiveIntArg.optional(), {
10990
10932
  alias: "l",
10991
10933
  description: "Maximum number of applications to list"
10992
10934
  })
10993
10935
  }).strict(),
10994
- run: withCommonArgs(async (args) => {
10936
+ run: async (args) => {
10995
10937
  const apps = await listApps({
10996
10938
  workspaceId: args["workspace-id"],
10997
10939
  profile: args.profile,
@@ -11002,7 +10944,7 @@ const listCommand$2 = defineCommand({
11002
10944
  createdAt: humanizeRelativeTime(createdAt)
11003
10945
  }));
11004
10946
  logger.out(formattedApps);
11005
- })
10947
+ }
11006
10948
  });
11007
10949
 
11008
10950
  //#endregion
@@ -11054,22 +10996,18 @@ async function createWorkspace(options) {
11054
10996
  const validated = result.data;
11055
10997
  const client = await initOperatorClient(await loadAccessToken());
11056
10998
  await validateRegion(validated.region, client);
11057
- const organizationId = loadOrganizationId(validated.organizationId);
11058
- const folderId = loadFolderId(validated.folderId);
11059
10999
  return workspaceInfo((await client.createWorkspace({
11060
11000
  workspaceName: validated.name,
11061
11001
  workspaceRegion: validated.region,
11062
11002
  deleteProtection: validated.deleteProtection ?? false,
11063
- organizationId,
11064
- folderId
11003
+ organizationId: validated.organizationId,
11004
+ folderId: validated.folderId
11065
11005
  })).workspace);
11066
11006
  }
11067
- const createCommand = defineCommand({
11007
+ const createCommand = defineAppCommand({
11068
11008
  name: "create",
11069
11009
  description: "Create a new Tailor Platform workspace.",
11070
11010
  args: z.object({
11071
- ...commonArgs,
11072
- ...jsonArgs,
11073
11011
  name: arg(z.string(), {
11074
11012
  alias: "n",
11075
11013
  description: "Workspace name"
@@ -11084,11 +11022,13 @@ const createCommand = defineCommand({
11084
11022
  }),
11085
11023
  "organization-id": arg(z.string().optional(), {
11086
11024
  alias: "o",
11087
- description: "Organization ID to workspace associate with"
11025
+ description: "Organization ID to workspace associate with",
11026
+ env: "TAILOR_PLATFORM_ORGANIZATION_ID"
11088
11027
  }),
11089
11028
  "folder-id": arg(z.string().optional(), {
11090
11029
  alias: "f",
11091
- description: "Folder ID to workspace associate with"
11030
+ description: "Folder ID to workspace associate with",
11031
+ env: "TAILOR_PLATFORM_FOLDER_ID"
11092
11032
  }),
11093
11033
  "profile-name": arg(z.string().optional(), {
11094
11034
  alias: "p",
@@ -11096,7 +11036,7 @@ const createCommand = defineCommand({
11096
11036
  }),
11097
11037
  "profile-user": arg(z.string().optional(), { description: "User email for the profile (defaults to current user)" })
11098
11038
  }).strict(),
11099
- run: withCommonArgs(async (args) => {
11039
+ run: async (args) => {
11100
11040
  const workspace = await createWorkspace({
11101
11041
  name: args.name,
11102
11042
  region: args.region,
@@ -11137,7 +11077,7 @@ const createCommand = defineCommand({
11137
11077
  logger.out("Profile:");
11138
11078
  logger.out(profileInfo);
11139
11079
  }
11140
- })
11080
+ }
11141
11081
  });
11142
11082
 
11143
11083
  //#endregion
@@ -11160,18 +11100,17 @@ async function deleteWorkspace(options) {
11160
11100
  const { client, workspaceId } = await loadOptions$7(options);
11161
11101
  await client.deleteWorkspace({ workspaceId });
11162
11102
  }
11163
- const deleteCommand = defineCommand({
11103
+ const deleteCommand = defineAppCommand({
11164
11104
  name: "delete",
11165
11105
  description: "Delete a Tailor Platform workspace.",
11166
11106
  args: z.object({
11167
- ...commonArgs,
11168
11107
  "workspace-id": arg(z.string(), {
11169
11108
  alias: "w",
11170
11109
  description: "Workspace ID"
11171
11110
  }),
11172
11111
  ...confirmationArgs
11173
11112
  }).strict(),
11174
- run: withCommonArgs(async (args) => {
11113
+ run: async (args) => {
11175
11114
  const { client, workspaceId } = await loadOptions$7({ workspaceId: args["workspace-id"] });
11176
11115
  let workspace;
11177
11116
  try {
@@ -11180,7 +11119,7 @@ const deleteCommand = defineCommand({
11180
11119
  throw new Error(`Workspace "${workspaceId}" not found.`);
11181
11120
  }
11182
11121
  if (!args.yes) {
11183
- if (await logger.prompt(`Enter the workspace name to confirm deletion (${workspace.workspace?.name}):`, { type: "text" }) !== workspace.workspace?.name) {
11122
+ if (await prompt.text({ message: `Enter the workspace name to confirm deletion (${workspace.workspace?.name}):` }) !== workspace.workspace?.name) {
11184
11123
  logger.info("Workspace deletion cancelled.");
11185
11124
  return;
11186
11125
  }
@@ -11194,7 +11133,7 @@ const deleteCommand = defineCommand({
11194
11133
  }
11195
11134
  if (profilesToDelete.length > 0) logger.success(`Workspace "${args["workspace-id"]}" and ${profilesToDelete.length} associated profile(s) deleted successfully.`);
11196
11135
  else logger.success(`Workspace "${args["workspace-id"]}" deleted successfully.`);
11197
- })
11136
+ }
11198
11137
  });
11199
11138
 
11200
11139
  //#endregion
@@ -11225,15 +11164,11 @@ async function getWorkspace(options) {
11225
11164
  if (!response.workspace) throw new Error(`Workspace "${workspaceId}" not found.`);
11226
11165
  return workspaceDetails(response.workspace);
11227
11166
  }
11228
- const getCommand = defineCommand({
11167
+ const getCommand = defineAppCommand({
11229
11168
  name: "get",
11230
11169
  description: "Show detailed information about a workspace",
11231
- args: z.object({
11232
- ...commonArgs,
11233
- ...jsonArgs,
11234
- ...workspaceArgs
11235
- }).strict(),
11236
- run: withCommonArgs(async (args) => {
11170
+ args: z.object({ ...workspaceArgs }).strict(),
11171
+ run: async (args) => {
11237
11172
  const workspace = await getWorkspace({
11238
11173
  workspaceId: args["workspace-id"],
11239
11174
  profile: args.profile
@@ -11244,7 +11179,7 @@ const getCommand = defineCommand({
11244
11179
  updatedAt: humanizeRelativeTime(workspace.updatedAt)
11245
11180
  };
11246
11181
  logger.out(formattedWorkspace);
11247
- })
11182
+ }
11248
11183
  });
11249
11184
 
11250
11185
  //#endregion
@@ -11276,21 +11211,17 @@ async function listWorkspaces(options) {
11276
11211
  }
11277
11212
  return results;
11278
11213
  }
11279
- const listCommand$1 = defineCommand({
11214
+ const listCommand$1 = defineAppCommand({
11280
11215
  name: "list",
11281
11216
  description: "List all Tailor Platform workspaces.",
11282
- args: z.object({
11283
- ...commonArgs,
11284
- ...jsonArgs,
11285
- limit: arg(positiveIntArg.optional(), {
11286
- alias: "l",
11287
- description: "Maximum number of workspaces to list"
11288
- })
11289
- }).strict(),
11290
- run: withCommonArgs(async (args) => {
11217
+ args: z.object({ limit: arg(positiveIntArg.optional(), {
11218
+ alias: "l",
11219
+ description: "Maximum number of workspaces to list"
11220
+ }) }).strict(),
11221
+ run: async (args) => {
11291
11222
  const workspaces = await listWorkspaces({ limit: args.limit });
11292
11223
  logger.out(workspaces, { display: { updatedAt: null } });
11293
- })
11224
+ }
11294
11225
  });
11295
11226
 
11296
11227
  //#endregion
@@ -11313,28 +11244,27 @@ async function restoreWorkspace(options) {
11313
11244
  const { client, workspaceId } = await loadOptions$5(options);
11314
11245
  await client.restoreWorkspace({ workspaceId });
11315
11246
  }
11316
- const restoreCommand = defineCommand({
11247
+ const restoreCommand = defineAppCommand({
11317
11248
  name: "restore",
11318
11249
  description: "Restore a deleted workspace",
11319
11250
  args: z.object({
11320
- ...commonArgs,
11321
11251
  "workspace-id": arg(z.string(), {
11322
11252
  alias: "w",
11323
11253
  description: "Workspace ID"
11324
11254
  }),
11325
11255
  ...confirmationArgs
11326
11256
  }).strict(),
11327
- run: withCommonArgs(async (args) => {
11257
+ run: async (args) => {
11328
11258
  const { client, workspaceId } = await loadOptions$5({ workspaceId: args["workspace-id"] });
11329
11259
  if (!args.yes) {
11330
- if (await logger.prompt(`Are you sure you want to restore workspace "${workspaceId}"? (yes/no):`, { type: "text" }) !== "yes") {
11260
+ if (await prompt.text({ message: `Are you sure you want to restore workspace "${workspaceId}"? (yes/no):` }) !== "yes") {
11331
11261
  logger.info("Workspace restoration cancelled.");
11332
11262
  return;
11333
11263
  }
11334
11264
  }
11335
11265
  await client.restoreWorkspace({ workspaceId });
11336
11266
  logger.success(`Workspace "${workspaceId}" restored successfully.`);
11337
- })
11267
+ }
11338
11268
  });
11339
11269
 
11340
11270
  //#endregion
@@ -11402,11 +11332,10 @@ async function inviteUser(options) {
11402
11332
  role
11403
11333
  });
11404
11334
  }
11405
- const inviteCommand = defineCommand({
11335
+ const inviteCommand = defineAppCommand({
11406
11336
  name: "invite",
11407
11337
  description: "Invite a user to a workspace",
11408
11338
  args: z.object({
11409
- ...commonArgs,
11410
11339
  ...workspaceArgs,
11411
11340
  email: arg(z.email(), { description: "Email address of the user to invite" }),
11412
11341
  role: arg(z.enum(validRoles), {
@@ -11414,7 +11343,7 @@ const inviteCommand = defineCommand({
11414
11343
  alias: "r"
11415
11344
  })
11416
11345
  }).strict(),
11417
- run: withCommonArgs(async (args) => {
11346
+ run: async (args) => {
11418
11347
  await inviteUser({
11419
11348
  workspaceId: args["workspace-id"],
11420
11349
  profile: args.profile,
@@ -11422,7 +11351,7 @@ const inviteCommand = defineCommand({
11422
11351
  role: args.role
11423
11352
  });
11424
11353
  logger.success(`User "${args.email}" invited successfully with role "${args.role}".`);
11425
- })
11354
+ }
11426
11355
  });
11427
11356
 
11428
11357
  //#endregion
@@ -11471,26 +11400,24 @@ async function listUsers(options) {
11471
11400
  }
11472
11401
  return results;
11473
11402
  }
11474
- const listCommand = defineCommand({
11403
+ const listCommand = defineAppCommand({
11475
11404
  name: "list",
11476
11405
  description: "List users in a workspace",
11477
11406
  args: z.object({
11478
- ...commonArgs,
11479
- ...jsonArgs,
11480
11407
  ...workspaceArgs,
11481
11408
  limit: arg(positiveIntArg.optional(), {
11482
11409
  alias: "l",
11483
11410
  description: "Maximum number of users to list"
11484
11411
  })
11485
11412
  }).strict(),
11486
- run: withCommonArgs(async (args) => {
11413
+ run: async (args) => {
11487
11414
  const users = await listUsers({
11488
11415
  workspaceId: args["workspace-id"],
11489
11416
  profile: args.profile,
11490
11417
  limit: args.limit
11491
11418
  });
11492
11419
  logger.out(users);
11493
- })
11420
+ }
11494
11421
  });
11495
11422
 
11496
11423
  //#endregion
@@ -11524,18 +11451,17 @@ async function removeUser(options) {
11524
11451
  email
11525
11452
  });
11526
11453
  }
11527
- const removeCommand = defineCommand({
11454
+ const removeCommand = defineAppCommand({
11528
11455
  name: "remove",
11529
11456
  description: "Remove a user from a workspace",
11530
11457
  args: z.object({
11531
- ...commonArgs,
11532
11458
  ...workspaceArgs,
11533
11459
  email: arg(z.email(), { description: "Email address of the user to remove" }),
11534
11460
  ...confirmationArgs
11535
11461
  }).strict(),
11536
- run: withCommonArgs(async (args) => {
11462
+ run: async (args) => {
11537
11463
  if (!args.yes) {
11538
- if (await logger.prompt(`Are you sure you want to remove user "${args.email}" from the workspace? (yes/no):`, { type: "text" }) !== "yes") {
11464
+ if (await prompt.text({ message: `Are you sure you want to remove user "${args.email}" from the workspace? (yes/no):` }) !== "yes") {
11539
11465
  logger.info("User removal cancelled.");
11540
11466
  return;
11541
11467
  }
@@ -11546,7 +11472,7 @@ const removeCommand = defineCommand({
11546
11472
  email: args.email
11547
11473
  });
11548
11474
  logger.success(`User "${args.email}" removed from workspace.`);
11549
- })
11475
+ }
11550
11476
  });
11551
11477
 
11552
11478
  //#endregion
@@ -11583,11 +11509,10 @@ async function updateUser(options) {
11583
11509
  role
11584
11510
  });
11585
11511
  }
11586
- const updateCommand = defineCommand({
11512
+ const updateCommand = defineAppCommand({
11587
11513
  name: "update",
11588
11514
  description: "Update a user's role in a workspace",
11589
11515
  args: z.object({
11590
- ...commonArgs,
11591
11516
  ...workspaceArgs,
11592
11517
  email: arg(z.email(), { description: "Email address of the user to update" }),
11593
11518
  role: arg(z.enum(validRoles), {
@@ -11595,7 +11520,7 @@ const updateCommand = defineCommand({
11595
11520
  alias: "r"
11596
11521
  })
11597
11522
  }).strict(),
11598
- run: withCommonArgs(async (args) => {
11523
+ run: async (args) => {
11599
11524
  await updateUser({
11600
11525
  workspaceId: args["workspace-id"],
11601
11526
  profile: args.profile,
@@ -11603,7 +11528,7 @@ const updateCommand = defineCommand({
11603
11528
  role: args.role
11604
11529
  });
11605
11530
  logger.success(`User "${args.email}" updated to role "${args.role}".`);
11606
- })
11531
+ }
11607
11532
  });
11608
11533
 
11609
11534
  //#endregion
@@ -11702,7 +11627,7 @@ async function bundleQueryScript(engine) {
11702
11627
  format: "esm",
11703
11628
  sourcemap: false,
11704
11629
  minify: false,
11705
- inlineDynamicImports: true,
11630
+ codeSplitting: false,
11706
11631
  globals: { tailordb: "tailordb" }
11707
11632
  },
11708
11633
  external: engine === "sql" ? ["tailordb"] : [],
@@ -11718,6 +11643,44 @@ async function bundleQueryScript(engine) {
11718
11643
  return fs$1.readFileSync(outputPath, "utf-8");
11719
11644
  }
11720
11645
 
11646
+ //#endregion
11647
+ //#region src/cli/shared/errors.ts
11648
+ /**
11649
+ * Format CLI error for output
11650
+ * @param error - CLIError instance to format
11651
+ * @returns Formatted error message
11652
+ */
11653
+ function formatError(error) {
11654
+ const parts = [chalk.red(`Error${error.code ? ` [${error.code}]` : ""}: ${error.message}`)];
11655
+ if (error.details) parts.push(`\n ${chalk.gray("Details:")} ${error.details}`);
11656
+ if (error.suggestion) parts.push(`\n ${chalk.cyan("Suggestion:")} ${error.suggestion}`);
11657
+ if (error.command) parts.push(`\n ${chalk.gray("Help:")} Run \`tailor-sdk ${error.command} --help\` for usage information.`);
11658
+ return parts.join("");
11659
+ }
11660
+ /**
11661
+ * Create a CLI error with formatted output
11662
+ * @param options - Options to construct a CLIError
11663
+ * @returns Constructed CLIError instance
11664
+ */
11665
+ function createCLIError(options) {
11666
+ const error = new Error(options.message);
11667
+ error.name = "CLIError";
11668
+ error.code = options.code;
11669
+ error.details = options.details;
11670
+ error.suggestion = options.suggestion;
11671
+ error.command = options.command;
11672
+ error.format = () => formatError(error);
11673
+ return error;
11674
+ }
11675
+ /**
11676
+ * Type guard to check if an error is a CLIError
11677
+ * @param error - Error to check
11678
+ * @returns True if the error is a CLIError
11679
+ */
11680
+ function isCLIError(error) {
11681
+ return error instanceof Error && error.name === "CLIError";
11682
+ }
11683
+
11721
11684
  //#endregion
11722
11685
  //#region src/cli/query/errors.ts
11723
11686
  function toErrorMessage(error) {
@@ -11871,10 +11834,10 @@ function isSqlInputComplete(input) {
11871
11834
  * @param query - SQL query
11872
11835
  * @returns Type names referenced by query
11873
11836
  */
11874
- function extractTypeNamesFromSql(query$1) {
11837
+ function extractTypeNamesFromSql(query) {
11875
11838
  let statements;
11876
11839
  try {
11877
- statements = parse(query$1);
11840
+ statements = parse(query);
11878
11841
  } catch (error) {
11879
11842
  const message = error instanceof Error ? error.message : String(error);
11880
11843
  throw new Error(`SQL parse error: ${message}\nIf your table name is a reserved keyword (e.g. User), wrap it in double quotes: SELECT * FROM "User"`);
@@ -11909,9 +11872,9 @@ function collectAliasMap(fromClauses) {
11909
11872
  * @param query - SQL query
11910
11873
  * @returns Column slots if wildcards are present, null otherwise
11911
11874
  */
11912
- function extractColumnTemplate(query$1) {
11875
+ function extractColumnTemplate(query) {
11913
11876
  try {
11914
- const statements = parse(query$1);
11877
+ const statements = parse(query);
11915
11878
  for (const statement of statements) {
11916
11879
  if (statement.type !== "select" || !statement.columns) continue;
11917
11880
  const aliasMap = collectAliasMap(statement.from ?? []);
@@ -11981,10 +11944,10 @@ const queryBaseOptionsSchema = z.object({
11981
11944
  machineUser: z.string()
11982
11945
  });
11983
11946
  const queryOptionsSchema = queryBaseOptionsSchema.extend({ query: z.string() });
11984
- async function getNamespaceFromSqlQuery(workspaceId, query$1, client, namespaces) {
11947
+ async function getNamespaceFromSqlQuery(workspaceId, query, client, namespaces) {
11985
11948
  if (namespaces.length === 0) throw new Error("No namespaces found in configuration.");
11986
11949
  if (namespaces.length === 1) return namespaces[0];
11987
- const typeNames = extractTypeNamesFromSql(query$1);
11950
+ const typeNames = extractTypeNamesFromSql(query);
11988
11951
  if (typeNames.length === 0) throw new Error(`Could not infer namespace from query. Detected namespaces: ${namespaces.join(", ")}.`);
11989
11952
  const typeNamespaceMap = await resolveTypeNamespaces({
11990
11953
  workspaceId,
@@ -12278,9 +12241,9 @@ async function runRepl(options) {
12278
12241
  if (statement.length === 0) continue;
12279
12242
  try {
12280
12243
  if (options.engine === "sql") {
12281
- const result$1 = await execute(statement);
12282
- if (result$1.engine !== "sql") throw new Error(`Expected sql engine result but got: ${result$1.engine}`);
12283
- printSqlResult(result$1, { json: options.json });
12244
+ const result = await execute(statement);
12245
+ if (result.engine !== "sql") throw new Error(`Expected sql engine result but got: ${result.engine}`);
12246
+ printSqlResult(result, { json: options.json });
12284
12247
  continue;
12285
12248
  }
12286
12249
  const result = await execute(statement);
@@ -12346,9 +12309,9 @@ async function queryGql(options) {
12346
12309
  if (result.engine !== "gql") throw new Error(`Expected gql engine result but got: ${result.engine}`);
12347
12310
  return result;
12348
12311
  }
12349
- async function reorderSqlColumns(result, config, namespace, sqlQuery$1) {
12312
+ async function reorderSqlColumns(result, config, namespace, sqlQuery) {
12350
12313
  if (!isSQLExecutionResult(result.result) || result.result.rows.length === 0) return result;
12351
- const template = extractColumnTemplate(sqlQuery$1);
12314
+ const template = extractColumnTemplate(sqlQuery);
12352
12315
  if (!template) return result;
12353
12316
  try {
12354
12317
  const expectedOrder = buildExpectedColumnOrder(template, await loadTypeFieldOrder(config, namespace));
@@ -12391,12 +12354,10 @@ function reorderRowByTemplate(row, expectedOrder) {
12391
12354
  for (const key of rowKeys) ordered[key] = row[key];
12392
12355
  return ordered;
12393
12356
  }
12394
- const queryCommand = defineCommand({
12357
+ const queryCommand = defineAppCommand({
12395
12358
  name: "query",
12396
12359
  description: "Run SQL/GraphQL query.",
12397
12360
  args: z.object({
12398
- ...commonArgs,
12399
- ...jsonArgs,
12400
12361
  ...deploymentArgs,
12401
12362
  engine: arg(queryEngineSchema, { description: "Query engine (sql or gql)" }),
12402
12363
  query: arg(z.string().optional(), {
@@ -12429,7 +12390,7 @@ const queryCommand = defineCommand({
12429
12390
  message: "Pass only one of --edit, -q/--query, or -f/--file."
12430
12391
  });
12431
12392
  }).strict(),
12432
- run: withCommonArgs(async (args) => {
12393
+ run: async (args) => {
12433
12394
  const mode = await resolveQueryCommandInput({
12434
12395
  query: args.query,
12435
12396
  file: args.file,
@@ -12466,7 +12427,7 @@ const queryCommand = defineCommand({
12466
12427
  ...sharedOptions,
12467
12428
  query: directQuery
12468
12429
  }), { json: args.json });
12469
- })
12430
+ }
12470
12431
  });
12471
12432
  function isSQLExecutionResult(value) {
12472
12433
  if (!value || typeof value !== "object") return false;
@@ -12495,13 +12456,13 @@ function printSingleSqlResult(execResult, options = {}) {
12495
12456
  logger.out(execResult.rows, { showNull: true });
12496
12457
  logger.out(`rows: ${execResult.rowCount}`);
12497
12458
  }
12498
- function splitSqlStatements(query$1) {
12459
+ function splitSqlStatements(query) {
12499
12460
  try {
12500
- const statements = parse(query$1);
12461
+ const statements = parse(query);
12501
12462
  if (statements.length === 0) return [];
12502
12463
  return statements.map((s) => toSql.statement(s));
12503
12464
  } catch {
12504
- const trimmed = query$1.trim();
12465
+ const trimmed = query.trim();
12505
12466
  return trimmed.length > 0 ? [trimmed] : [];
12506
12467
  }
12507
12468
  }
@@ -12544,5 +12505,5 @@ function printGqlResult(result, options = {}) {
12544
12505
  }
12545
12506
 
12546
12507
  //#endregion
12547
- export { getExecutorJob as $, truncateCommand as A, getMigrationDirPath as At, getCommand$1 as B, getNamespacesWithMigrations as Bt, getAppHealth as C, MIGRATE_FILE_NAME as Ct, listCommand$3 as D, createSnapshotFromLocalTypes as Dt, resumeWorkflow as E, compareSnapshots as Et, showCommand as F, loadDiff as Ft, listMachineUsers as G, commonArgs as Gt, getMachineUserToken as H, generateUserTypes as Ht, remove as I, reconstructSnapshotFromMigrations as It, webhookCommand as J, jsonArgs as Jt, generate$1 as K, confirmationArgs as Kt, removeCommand$1 as L, formatDiffSummary as Lt, generateCommand as M, getMigrationFiles as Mt, logBetaWarning as N, getNextMigrationNumber as Nt, listWorkflows as O, formatMigrationNumber as Ot, show as P, isValidMigrationNumber as Pt, listExecutors as Q, listCommand$4 as R, formatMigrationDiff as Rt, listCommand$2 as S, INITIAL_SCHEMA_NUMBER as St, resumeCommand as T, compareLocalTypesWithSnapshot as Tt, tokenCommand as U, apiCall as Ut, getOAuth2Client as V, trnPrefix as Vt, listCommand$5 as W, apiCommand as Wt, triggerExecutor as X, workspaceArgs as Xt, triggerCommand as Y, withCommonArgs as Yt, listCommand$6 as Z, deleteCommand as _, MIGRATION_LABEL_KEY as _t, removeCommand as a, getCommand$2 as at, createWorkspace as b, DB_TYPES_FILE_NAME as bt, listUsers as c, getWorkflowExecution as ct, restoreCommand as d, formatKeyValueTable as dt, jobsCommand as et, restoreWorkspace as f, getCommand$3 as ft, getWorkspace as g, waitForExecution$1 as gt, getCommand as h, executeScript as ht, updateUser as i, startWorkflow as it, generate as j, getMigrationFilePath as jt, truncate as k, getLatestMigrationNumber as kt, inviteCommand as l, listWorkflowExecutions as lt, listWorkspaces as m, apply as mt, queryCommand as n, watchExecutorJob as nt, removeUser as o, getWorkflow as ot, listCommand$1 as p, getExecutor as pt, listWebhookExecutors as q, deploymentArgs as qt, updateCommand as r, startCommand as rt, listCommand as s, executionsCommand as st, query as t, listExecutorJobs as tt, inviteUser as u, functionExecutionStatusToString as ut, deleteWorkspace as v, parseMigrationLabelNumber as vt, healthCommand as w, SCHEMA_FILE_NAME as wt, listApps as x, DIFF_FILE_NAME as xt, createCommand as y, bundleMigrationScript as yt, listOAuth2Clients as z, hasChanges as zt };
12548
- //# sourceMappingURL=query-D3UyoG68.mjs.map
12508
+ export { listExecutors as $, truncate as A, getLatestMigrationNumber as At, listOAuth2Clients as B, hasChanges as Bt, listCommand$2 as C, INITIAL_SCHEMA_NUMBER as Ct, resumeWorkflow as D, compareSnapshots as Dt, resumeCommand as E, compareLocalTypesWithSnapshot as Et, show as F, isValidMigrationNumber as Ft, listCommand$5 as G, apiCall as Gt, getOAuth2Client as H, prompt as Ht, showCommand as I, loadDiff as It, listWebhookExecutors as J, commonArgs as Jt, listMachineUsers as K, apiCommand as Kt, remove as L, reconstructSnapshotFromMigrations as Lt, generate as M, getMigrationFilePath as Mt, generateCommand as N, getMigrationFiles as Nt, listCommand$3 as O, createSnapshotFromLocalTypes as Ot, logBetaWarning as P, getNextMigrationNumber as Pt, listCommand$6 as Q, workspaceArgs as Qt, removeCommand$1 as R, formatDiffSummary as Rt, listApps as S, DIFF_FILE_NAME as St, healthCommand as T, SCHEMA_FILE_NAME as Tt, getMachineUserToken as U, trnPrefix as Ut, getCommand$1 as V, getNamespacesWithMigrations as Vt, tokenCommand as W, generateUserTypes as Wt, triggerCommand as X, deploymentArgs as Xt, webhookCommand as Y, confirmationArgs as Yt, triggerExecutor as Z, isVerbose as Zt, getWorkspace as _, waitForExecution$1 as _t, updateUser as a, startWorkflow as at, createCommand as b, bundleMigrationScript as bt, listCommand as c, executionsCommand as ct, inviteUser as d, functionExecutionStatusToString as dt, getExecutorJob as et, restoreCommand as f, formatKeyValueTable as ft, getCommand as g, executeScript as gt, listWorkspaces as h, apply as ht, updateCommand as i, startCommand as it, truncateCommand as j, getMigrationDirPath as jt, listWorkflows as k, formatMigrationNumber as kt, listUsers as l, getWorkflowExecution as lt, listCommand$1 as m, getExecutor as mt, queryCommand as n, listExecutorJobs as nt, removeCommand as o, getCommand$2 as ot, restoreWorkspace as p, getCommand$3 as pt, generate$1 as q, defineAppCommand as qt, isCLIError as r, watchExecutorJob as rt, removeUser as s, getWorkflow as st, query as t, jobsCommand as tt, inviteCommand as u, listWorkflowExecutions as ut, deleteCommand as v, MIGRATION_LABEL_KEY as vt, getAppHealth as w, MIGRATE_FILE_NAME as wt, createWorkspace as x, DB_TYPES_FILE_NAME as xt, deleteWorkspace as y, parseMigrationLabelNumber as yt, listCommand$4 as z, formatMigrationDiff as zt };
12509
+ //# sourceMappingURL=query-BpppEOzu.mjs.map