@tailor-platform/sdk 1.26.0 → 1.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/application-CBJFUKrU.mjs +4701 -0
  3. package/dist/application-CBJFUKrU.mjs.map +1 -0
  4. package/dist/application-WyZetOky.mjs +11 -0
  5. package/dist/cli/index.mjs +240 -33
  6. package/dist/cli/index.mjs.map +1 -1
  7. package/dist/cli/lib.d.mts +6 -6
  8. package/dist/cli/lib.mjs +10 -8
  9. package/dist/cli/lib.mjs.map +1 -1
  10. package/dist/client-C2_wgujH.mjs +6 -0
  11. package/dist/{application-D9xahQRQ.mjs → client-bTbnbQbB.mjs} +8 -4877
  12. package/dist/{application-D9xahQRQ.mjs.map → client-bTbnbQbB.mjs.map} +1 -1
  13. package/dist/configure/index.d.mts +4 -4
  14. package/dist/crash-report-Cot_9Esm.mjs +6 -0
  15. package/dist/crash-report-Ju8cQF-l.mjs +414 -0
  16. package/dist/crash-report-Ju8cQF-l.mjs.map +1 -0
  17. package/dist/{enum-constants-6uK0VI_s.mjs → enum-constants-D1nfn0qD.mjs} +1 -1
  18. package/dist/{enum-constants-6uK0VI_s.mjs.map → enum-constants-D1nfn0qD.mjs.map} +1 -1
  19. package/dist/{env-CSsVESbH.d.mts → env-BuMbIknz.d.mts} +2 -2
  20. package/dist/{file-utils-2T9w20FP.mjs → file-utils-Bctuzn3x.mjs} +1 -1
  21. package/dist/{file-utils-2T9w20FP.mjs.map → file-utils-Bctuzn3x.mjs.map} +1 -1
  22. package/dist/{index-DgRShBpu.d.mts → index-B0Lrzywd.d.mts} +2 -2
  23. package/dist/{index-BtYPY8ya.d.mts → index-CbnLNm14.d.mts} +2 -2
  24. package/dist/{index-DkJbItB-.d.mts → index-CyapgSFI.d.mts} +2 -2
  25. package/dist/{index-BKy-OC5C.d.mts → index-D1AM_02Y.d.mts} +2 -2
  26. package/dist/{index-BJg0DTbR.d.mts → index-cD9sQLTh.d.mts} +15 -15
  27. package/dist/{interceptor-BPiIBTk_.mjs → interceptor-B0d_GrI5.mjs} +1 -1
  28. package/dist/{interceptor-BPiIBTk_.mjs.map → interceptor-B0d_GrI5.mjs.map} +1 -1
  29. package/dist/{kysely-type-cMNbsQ6k.mjs → kysely-type-B_IecdK9.mjs} +1 -1
  30. package/dist/{kysely-type-cMNbsQ6k.mjs.map → kysely-type-B_IecdK9.mjs.map} +1 -1
  31. package/dist/logger-CqezTedh.mjs +181 -0
  32. package/dist/logger-CqezTedh.mjs.map +1 -0
  33. package/dist/{package-json-CVUv8Y9T.mjs → package-json-D3x2nBPB.mjs} +1 -1
  34. package/dist/{package-json-CVUv8Y9T.mjs.map → package-json-D3x2nBPB.mjs.map} +1 -1
  35. package/dist/package-json-DHfTiUCS.mjs +4 -0
  36. package/dist/plugin/builtin/enum-constants/index.d.mts +1 -1
  37. package/dist/plugin/builtin/enum-constants/index.mjs +1 -1
  38. package/dist/plugin/builtin/file-utils/index.d.mts +1 -1
  39. package/dist/plugin/builtin/file-utils/index.mjs +1 -1
  40. package/dist/plugin/builtin/kysely-type/index.d.mts +1 -1
  41. package/dist/plugin/builtin/kysely-type/index.mjs +1 -1
  42. package/dist/plugin/builtin/seed/index.d.mts +1 -1
  43. package/dist/plugin/builtin/seed/index.mjs +1 -1
  44. package/dist/plugin/index.d.mts +2 -2
  45. package/dist/{plugin-B1hNwcCC.d.mts → plugin-D3a0-qe0.d.mts} +6 -2
  46. package/dist/{query-B8ml6ClT.mjs → query-WYq8RvYp.mjs} +10 -7
  47. package/dist/query-WYq8RvYp.mjs.map +1 -0
  48. package/dist/{seed-CCVRLibh.mjs → seed-CWkIDWMb.mjs} +1 -1
  49. package/dist/{seed-CCVRLibh.mjs.map → seed-CWkIDWMb.mjs.map} +1 -1
  50. package/dist/{telemetry-DDQZRqHK.mjs → telemetry-BevrwWwF.mjs} +1 -1
  51. package/dist/{telemetry-0w8OupuQ.mjs → telemetry-VvNfsyEE.mjs} +2 -2
  52. package/dist/{telemetry-0w8OupuQ.mjs.map → telemetry-VvNfsyEE.mjs.map} +1 -1
  53. package/dist/utils/test/index.d.mts +2 -2
  54. package/dist/{workflow.generated-Bm4b8hEk.d.mts → workflow.generated-BsgIlrH-.d.mts} +2 -2
  55. package/docs/cli/crash-report.md +107 -0
  56. package/docs/cli/secret.md +16 -14
  57. package/docs/cli-reference.md +11 -0
  58. package/docs/configuration.md +19 -0
  59. package/docs/services/resolver.md +32 -0
  60. package/docs/services/secret.md +81 -0
  61. package/package.json +1 -1
  62. package/dist/application-CxH6Yp54.mjs +0 -9
  63. package/dist/package-json-Bj76LPsV.mjs +0 -4
  64. package/dist/query-B8ml6ClT.mjs.map +0 -1
@@ -0,0 +1,11 @@
1
+ import "./chunk-Cz-A8uMR.mjs";
2
+ import "./brand-GZnI4eYb.mjs";
3
+ import "./logger-CqezTedh.mjs";
4
+ import "./client-bTbnbQbB.mjs";
5
+ import "./package-json-D3x2nBPB.mjs";
6
+ import { n as generatePluginFilesIfNeeded, r as loadApplication, t as defineApplication } from "./application-CBJFUKrU.mjs";
7
+ import "./seed-CWkIDWMb.mjs";
8
+ import "./file-utils-Bctuzn3x.mjs";
9
+ import "./kysely-type-B_IecdK9.mjs";
10
+
11
+ export { defineApplication };
@@ -2,13 +2,16 @@
2
2
  import "../chunk-Cz-A8uMR.mjs";
3
3
  import "../schema-BePzTFBV.mjs";
4
4
  import "../brand-GZnI4eYb.mjs";
5
- import { C as fetchAll, D as initOperatorClient, E as initOAuth2Client, S as writePlatformConfig, T as fetchUserInfo, U as FunctionExecution_Type, Y as AuthInvokerSchema, a as loadConfig, b as loadWorkspaceId, c as ExecutorSchema, g as getDistDir, i as resolveInlineSourcemap, mt as styles, nt as PATScope, o as WorkflowJobSchema, pt as logger, u as ResolverSchema, v as fetchLatestToken, x as readPlatformConfig, y as loadAccessToken } from "../application-D9xahQRQ.mjs";
6
- import { C as listCommand$9, E as resumeCommand, F as showCommand, Ft as isValidMigrationNumber, G as listCommand$6, Ht as prompt, I as logBetaWarning, It as loadDiff, Jt as commonArgs, Kt as apiCommand, Mt as getMigrationFilePath, N as generateCommand$1, Nt as getMigrationFiles, O as listCommand$8, Q as listCommand$5, Qt as workspaceArgs, R as removeCommand$1, T as healthCommand, Ut as trnPrefix, V as getCommand$2, Vt as getNamespacesWithMigrations, W as tokenCommand, X as triggerCommand, Xt as deploymentArgs, Y as webhookCommand, Yt as confirmationArgs, Zt as isVerbose, b as createCommand$3, c as listCommand$10, ct as executionsCommand, dt as functionExecutionStatusToString, f as restoreCommand, ft as formatKeyValueTable, g as getCommand$4, gt as executeScript, ht as apply, i as updateCommand$2, it as startCommand, j as truncateCommand, kt as formatMigrationNumber, m as listCommand$11, n as queryCommand, o as removeCommand, ot as getCommand$3, pt as getCommand$1, q as generate, qt as defineAppCommand, r as isCLIError, tt as jobsCommand, u as inviteCommand, v as deleteCommand$3, yt as parseMigrationLabelNumber, z as listCommand$7 } from "../query-B8ml6ClT.mjs";
7
- import { t as readPackageJson } from "../package-json-CVUv8Y9T.mjs";
8
- import "../seed-CCVRLibh.mjs";
9
- import "../file-utils-2T9w20FP.mjs";
10
- import "../kysely-type-cMNbsQ6k.mjs";
11
- import "../telemetry-0w8OupuQ.mjs";
5
+ import { n as logger, r as styles } from "../logger-CqezTedh.mjs";
6
+ import { $t as workspaceArgs, C as listCommand$10, E as resumeCommand, F as showCommand, Ft as isValidMigrationNumber, G as listCommand$7, Ht as prompt, I as logBetaWarning, It as loadDiff, Jt as defineAppCommand, Mt as getMigrationFilePath, N as generateCommand$1, Nt as getMigrationFiles, O as listCommand$9, Q as listCommand$6, Qt as isVerbose, R as removeCommand$1, T as healthCommand, Ut as sdkNameLabelKey, V as getCommand$2, Vt as getNamespacesWithMigrations, W as tokenCommand, Wt as trnPrefix, X as triggerCommand, Xt as confirmationArgs, Y as webhookCommand, Yt as commonArgs, Zt as deploymentArgs, b as createCommand$3, c as listCommand$11, ct as executionsCommand, dt as functionExecutionStatusToString, f as restoreCommand, ft as formatKeyValueTable, g as getCommand$4, gt as executeScript, ht as apply, i as updateCommand$2, it as startCommand, j as truncateCommand, kt as formatMigrationNumber, m as listCommand$12, n as queryCommand, o as removeCommand, ot as getCommand$3, pt as getCommand$1, q as generate, qt as apiCommand, r as isCLIError, tt as jobsCommand, u as inviteCommand, v as deleteCommand$3, yt as parseMigrationLabelNumber, z as listCommand$8 } from "../query-WYq8RvYp.mjs";
7
+ import { A as AuthInvokerSchema, L as PATScope, d as userAgent, i as fetchUserInfo, n as fetchAll, o as initOAuth2Client, s as initOperatorClient, w as FunctionExecution_Type } from "../client-bTbnbQbB.mjs";
8
+ import { t as readPackageJson } from "../package-json-D3x2nBPB.mjs";
9
+ import { S as writePlatformConfig, a as loadConfig, b as loadWorkspaceId, c as ExecutorSchema, g as getDistDir, i as resolveInlineSourcemap, o as WorkflowJobSchema, u as ResolverSchema, v as fetchLatestToken, x as readPlatformConfig, y as loadAccessToken } from "../application-CBJFUKrU.mjs";
10
+ import "../seed-CWkIDWMb.mjs";
11
+ import "../file-utils-Bctuzn3x.mjs";
12
+ import "../kysely-type-B_IecdK9.mjs";
13
+ import "../telemetry-VvNfsyEE.mjs";
14
+ import { a as JSON_FOOTER_MARKER, i as CRASH_LOG_EXTENSION, o as parseCrashReportConfig, r as sendCrashReport, t as initCrashReporting } from "../crash-report-Ju8cQF-l.mjs";
12
15
  import { createRequire, register } from "node:module";
13
16
  import { arg, defineCommand, runCommand, runMain } from "politty";
14
17
  import { withCompletionCommand } from "politty/completion";
@@ -48,7 +51,7 @@ const applyCommand = defineAppCommand({
48
51
  "clean-cache": arg(z.boolean().optional(), { description: "Clean the bundle cache before building" })
49
52
  }).strict(),
50
53
  run: async (args) => {
51
- const { initTelemetry } = await import("../telemetry-DDQZRqHK.mjs");
54
+ const { initTelemetry } = await import("../telemetry-BevrwWwF.mjs");
52
55
  await initTelemetry();
53
56
  await apply({
54
57
  workspaceId: args["workspace-id"],
@@ -63,20 +66,118 @@ const applyCommand = defineAppCommand({
63
66
  }
64
67
  });
65
68
 
69
+ //#endregion
70
+ //#region src/cli/commands/crash-report/list.ts
71
+ const listCommand$5 = defineAppCommand({
72
+ name: "list",
73
+ description: "List local crash report files.",
74
+ args: z.object({}).strict(),
75
+ run: async () => {
76
+ const config = parseCrashReportConfig();
77
+ if (!config.localDir) {
78
+ logger.info("Crash report directory not available.");
79
+ return;
80
+ }
81
+ let entries;
82
+ try {
83
+ entries = fs$1.readdirSync(config.localDir);
84
+ } catch {
85
+ logger.info("No crash reports found.");
86
+ return;
87
+ }
88
+ const files = entries.filter((f) => f.endsWith(CRASH_LOG_EXTENSION)).sort().reverse();
89
+ if (files.length === 0) {
90
+ logger.info("No crash reports found.");
91
+ return;
92
+ }
93
+ logger.info(`${files.length} crash report(s) in ${config.localDir}:`);
94
+ for (const file of files) logger.log(` ${file}`);
95
+ }
96
+ });
97
+
98
+ //#endregion
99
+ //#region src/cli/commands/crash-report/send.ts
100
+ const sendCommand = defineAppCommand({
101
+ name: "send",
102
+ description: "Submit a crash report to help improve the SDK.",
103
+ args: z.object({ file: arg(z.string(), {
104
+ description: "Path to the crash report file",
105
+ required: true,
106
+ completion: {
107
+ type: "file",
108
+ extensions: ["log"]
109
+ }
110
+ }) }).strict(),
111
+ run: async (args) => {
112
+ let content;
113
+ try {
114
+ content = fs$1.readFileSync(args.file, "utf-8");
115
+ } catch {
116
+ logger.error(`Crash report file not found: ${args.file}`);
117
+ process.exit(1);
118
+ }
119
+ const report = parseCrashLogFile(content);
120
+ if (!report) {
121
+ logger.error("Failed to parse crash report file. The file may be corrupted.");
122
+ process.exit(1);
123
+ }
124
+ const ua = await userAgent();
125
+ logger.info("Sending crash report...");
126
+ if (await sendCrashReport(report, ua)) logger.success("Crash report submitted successfully. Thank you!");
127
+ else {
128
+ logger.error("Failed to submit crash report. The server may be unavailable.");
129
+ process.exit(1);
130
+ }
131
+ }
132
+ });
133
+ /**
134
+ * Parse a crash log file back into a CrashReport object.
135
+ * Reads the embedded JSON footer appended by formatCrashReport.
136
+ * @param content - File content
137
+ * @returns Parsed report or undefined if parsing fails
138
+ */
139
+ function parseCrashLogFile(content) {
140
+ try {
141
+ const normalized = content.replace(/\r\n/g, "\n");
142
+ const marker = `\n${JSON_FOOTER_MARKER}\n`;
143
+ const lastIdx = normalized.lastIndexOf(marker);
144
+ if (lastIdx === -1) return void 0;
145
+ const jsonLine = normalized.slice(lastIdx + marker.length).split("\n")[0];
146
+ if (!jsonLine) return void 0;
147
+ return JSON.parse(jsonLine);
148
+ } catch {
149
+ return;
150
+ }
151
+ }
152
+
153
+ //#endregion
154
+ //#region src/cli/commands/crash-report/index.ts
155
+ const crashReportCommand = defineCommand({
156
+ name: "crash-report",
157
+ description: "Manage crash reports.",
158
+ subCommands: {
159
+ send: sendCommand,
160
+ list: listCommand$5
161
+ },
162
+ async run() {
163
+ await runCommand(listCommand$5, []);
164
+ }
165
+ });
166
+
66
167
  //#endregion
67
168
  //#region src/cli/commands/executor/index.ts
68
169
  const executorCommand = defineCommand({
69
170
  name: "executor",
70
171
  description: "Manage executors",
71
172
  subCommands: {
72
- list: listCommand$5,
173
+ list: listCommand$6,
73
174
  get: getCommand$1,
74
175
  jobs: jobsCommand,
75
176
  trigger: triggerCommand,
76
177
  webhook: webhookCommand
77
178
  },
78
179
  async run() {
79
- await runCommand(listCommand$5, []);
180
+ await runCommand(listCommand$6, []);
80
181
  }
81
182
  });
82
183
 
@@ -707,7 +808,7 @@ const generateCommand = defineAppCommand({
707
808
  })
708
809
  }).strict(),
709
810
  run: async (args) => {
710
- const { initTelemetry } = await import("../telemetry-DDQZRqHK.mjs");
811
+ const { initTelemetry } = await import("../telemetry-BevrwWwF.mjs");
711
812
  await initTelemetry();
712
813
  await generate({
713
814
  configPath: args.config,
@@ -875,11 +976,11 @@ const machineuserCommand = defineCommand({
875
976
  name: "machineuser",
876
977
  description: "Manage machine users in your Tailor Platform application.",
877
978
  subCommands: {
878
- list: listCommand$6,
979
+ list: listCommand$7,
879
980
  token: tokenCommand
880
981
  },
881
982
  async run() {
882
- await runCommand(listCommand$6, []);
983
+ await runCommand(listCommand$7, []);
883
984
  }
884
985
  });
885
986
 
@@ -890,10 +991,10 @@ const oauth2clientCommand = defineCommand({
890
991
  description: "Manage OAuth2 clients in your Tailor Platform application.",
891
992
  subCommands: {
892
993
  get: getCommand$2,
893
- list: listCommand$7
994
+ list: listCommand$8
894
995
  },
895
996
  async run() {
896
- await runCommand(listCommand$7, []);
997
+ await runCommand(listCommand$8, []);
897
998
  }
898
999
  });
899
1000
 
@@ -1108,6 +1209,57 @@ const secretValueArgs = {
1108
1209
  })
1109
1210
  };
1110
1211
 
1212
+ //#endregion
1213
+ //#region src/cli/commands/secret/check-vault-managed.ts
1214
+ /**
1215
+ * Check if a vault is managed by defineSecretManager() and warn the user.
1216
+ * Returns management status and metadata needed for releasing ownership.
1217
+ * @param params - Check parameters
1218
+ * @returns Management status, TRN, and existing labels
1219
+ */
1220
+ async function checkVaultManaged(params) {
1221
+ const { client, workspaceId, vaultName } = params;
1222
+ const trn = `${trnPrefix(workspaceId)}:vault:${vaultName}`;
1223
+ const notManaged = {
1224
+ isManaged: false,
1225
+ trn,
1226
+ existingLabels: {}
1227
+ };
1228
+ let owner;
1229
+ let allLabels = {};
1230
+ try {
1231
+ const { metadata } = await client.getMetadata({ trn });
1232
+ allLabels = metadata?.labels ?? {};
1233
+ owner = allLabels[sdkNameLabelKey];
1234
+ } catch {
1235
+ return notManaged;
1236
+ }
1237
+ if (!owner) return notManaged;
1238
+ logger.warn(`Vault "${vaultName}" is managed by defineSecretManager() in tailor.config.ts (owner: "${owner}"). Changes made via CLI may conflict with the config on the next apply.`);
1239
+ return {
1240
+ isManaged: true,
1241
+ trn,
1242
+ existingLabels: allLabels
1243
+ };
1244
+ }
1245
+ /**
1246
+ * Release ownership of a managed vault by removing SDK labels from metadata.
1247
+ * Call this after the user has confirmed they want to proceed with a CLI operation on a managed vault.
1248
+ * @param params - Client, TRN, and existing labels from checkVaultManaged result
1249
+ * @param params.client
1250
+ * @param params.trn
1251
+ * @param params.existingLabels
1252
+ */
1253
+ async function releaseVaultOwnership(params) {
1254
+ const { client, trn, existingLabels } = params;
1255
+ const { [sdkNameLabelKey]: _, "sdk-version": __, ...remainingLabels } = existingLabels;
1256
+ await client.setMetadata({
1257
+ trn,
1258
+ labels: remainingLabels
1259
+ });
1260
+ logger.info("Config ownership has been removed from this vault. Remove it from defineSecretManager() in your config to prevent the next apply from re-claiming it.");
1261
+ }
1262
+
1111
1263
  //#endregion
1112
1264
  //#region src/cli/commands/secret/create.ts
1113
1265
  const createSecretCommand = defineAppCommand({
@@ -1115,7 +1267,8 @@ const createSecretCommand = defineAppCommand({
1115
1267
  description: "Create a secret in a vault.",
1116
1268
  args: z.object({
1117
1269
  ...workspaceArgs,
1118
- ...secretValueArgs
1270
+ ...secretValueArgs,
1271
+ ...confirmationArgs
1119
1272
  }).strict(),
1120
1273
  run: async (args) => {
1121
1274
  const client = await initOperatorClient(await loadAccessToken({
@@ -1126,6 +1279,17 @@ const createSecretCommand = defineAppCommand({
1126
1279
  workspaceId: args["workspace-id"],
1127
1280
  profile: args.profile
1128
1281
  });
1282
+ const managed = await checkVaultManaged({
1283
+ client,
1284
+ workspaceId,
1285
+ vaultName: args["vault-name"]
1286
+ });
1287
+ if (managed.isManaged && !args.yes) {
1288
+ if (!await prompt.confirm({
1289
+ message: "Do you want to proceed?",
1290
+ default: false
1291
+ })) return;
1292
+ }
1129
1293
  try {
1130
1294
  await client.createSecretManagerSecret({
1131
1295
  workspaceId,
@@ -1140,6 +1304,10 @@ const createSecretCommand = defineAppCommand({
1140
1304
  }
1141
1305
  throw error;
1142
1306
  }
1307
+ if (managed.isManaged) await releaseVaultOwnership({
1308
+ client,
1309
+ ...managed
1310
+ });
1143
1311
  logger.success(`Secret: ${args.name} created in vault: ${args["vault-name"]}`);
1144
1312
  }
1145
1313
  });
@@ -1163,6 +1331,11 @@ const deleteSecretCommand = defineAppCommand({
1163
1331
  workspaceId: args["workspace-id"],
1164
1332
  profile: args.profile
1165
1333
  });
1334
+ const managed = await checkVaultManaged({
1335
+ client,
1336
+ workspaceId,
1337
+ vaultName: args["vault-name"]
1338
+ });
1166
1339
  if (!args.yes) {
1167
1340
  if (await prompt.text({ message: `Enter the secret name to confirm deletion ("${args.name}"):` }) !== args.name) {
1168
1341
  logger.info("Secret deletion cancelled.");
@@ -1179,6 +1352,10 @@ const deleteSecretCommand = defineAppCommand({
1179
1352
  if (error instanceof ConnectError && error.code === Code.NotFound) throw new Error(`Secret "${args.name}" not found in vault "${args["vault-name"]}".`);
1180
1353
  throw error;
1181
1354
  }
1355
+ if (managed.isManaged) await releaseVaultOwnership({
1356
+ client,
1357
+ ...managed
1358
+ });
1182
1359
  logger.success(`Secret: ${args.name} deleted from vault: ${args["vault-name"]}`);
1183
1360
  }
1184
1361
  });
@@ -1245,7 +1422,8 @@ const updateSecretCommand = defineAppCommand({
1245
1422
  description: "Update a secret in a vault.",
1246
1423
  args: z.object({
1247
1424
  ...workspaceArgs,
1248
- ...secretValueArgs
1425
+ ...secretValueArgs,
1426
+ ...confirmationArgs
1249
1427
  }).strict(),
1250
1428
  run: async (args) => {
1251
1429
  const client = await initOperatorClient(await loadAccessToken({
@@ -1256,6 +1434,17 @@ const updateSecretCommand = defineAppCommand({
1256
1434
  workspaceId: args["workspace-id"],
1257
1435
  profile: args.profile
1258
1436
  });
1437
+ const managed = await checkVaultManaged({
1438
+ client,
1439
+ workspaceId,
1440
+ vaultName: args["vault-name"]
1441
+ });
1442
+ if (managed.isManaged && !args.yes) {
1443
+ if (!await prompt.confirm({
1444
+ message: "Do you want to proceed?",
1445
+ default: false
1446
+ })) return;
1447
+ }
1259
1448
  try {
1260
1449
  await client.updateSecretManagerSecret({
1261
1450
  workspaceId,
@@ -1267,6 +1456,10 @@ const updateSecretCommand = defineAppCommand({
1267
1456
  if (error instanceof ConnectError && error.code === Code.NotFound) throw new Error(`Secret "${args.name}" not found in vault "${args["vault-name"]}".`);
1268
1457
  throw error;
1269
1458
  }
1459
+ if (managed.isManaged) await releaseVaultOwnership({
1460
+ client,
1461
+ ...managed
1462
+ });
1270
1463
  logger.success(`Secret: ${args.name} updated in vault: ${args["vault-name"]}`);
1271
1464
  }
1272
1465
  });
@@ -1328,6 +1521,11 @@ const deleteCommand$1 = defineAppCommand({
1328
1521
  workspaceId: args["workspace-id"],
1329
1522
  profile: args.profile
1330
1523
  });
1524
+ const managed = await checkVaultManaged({
1525
+ client,
1526
+ workspaceId,
1527
+ vaultName: args.name
1528
+ });
1331
1529
  if (!args.yes) {
1332
1530
  if (await prompt.text({ message: `Enter the vault name to confirm deletion ("${args.name}"):` }) !== args.name) {
1333
1531
  logger.info("Vault deletion cancelled.");
@@ -1343,6 +1541,7 @@ const deleteCommand$1 = defineAppCommand({
1343
1541
  if (error instanceof ConnectError && error.code === Code.NotFound) throw new Error(`Vault "${args.name}" not found.`);
1344
1542
  throw error;
1345
1543
  }
1544
+ if (managed.isManaged) logger.info("Remove this vault from defineSecretManager() in your config to prevent the next apply from re-creating it.");
1346
1545
  logger.success(`Vault: ${args.name} deleted`);
1347
1546
  }
1348
1547
  });
@@ -2873,14 +3072,14 @@ const workflowCommand = defineCommand({
2873
3072
  name: "workflow",
2874
3073
  description: "Manage workflows and workflow executions.",
2875
3074
  subCommands: {
2876
- list: listCommand$8,
3075
+ list: listCommand$9,
2877
3076
  get: getCommand$3,
2878
3077
  start: startCommand,
2879
3078
  executions: executionsCommand,
2880
3079
  resume: resumeCommand
2881
3080
  },
2882
3081
  async run() {
2883
- await runCommand(listCommand$8, []);
3082
+ await runCommand(listCommand$9, []);
2884
3083
  }
2885
3084
  });
2886
3085
 
@@ -2891,10 +3090,10 @@ const appCommand = defineCommand({
2891
3090
  description: "Manage workspace applications",
2892
3091
  subCommands: {
2893
3092
  health: healthCommand,
2894
- list: listCommand$9
3093
+ list: listCommand$10
2895
3094
  },
2896
3095
  async run() {
2897
- await runCommand(listCommand$9, []);
3096
+ await runCommand(listCommand$10, []);
2898
3097
  }
2899
3098
  });
2900
3099
 
@@ -2905,12 +3104,12 @@ const userCommand = defineCommand({
2905
3104
  description: "Manage workspace users",
2906
3105
  subCommands: {
2907
3106
  invite: inviteCommand,
2908
- list: listCommand$10,
3107
+ list: listCommand$11,
2909
3108
  remove: removeCommand,
2910
3109
  update: updateCommand$2
2911
3110
  },
2912
3111
  async run() {
2913
- await runCommand(listCommand$10, []);
3112
+ await runCommand(listCommand$11, []);
2914
3113
  }
2915
3114
  });
2916
3115
 
@@ -2924,18 +3123,19 @@ const workspaceCommand = defineCommand({
2924
3123
  create: createCommand$3,
2925
3124
  delete: deleteCommand$3,
2926
3125
  get: getCommand$4,
2927
- list: listCommand$11,
3126
+ list: listCommand$12,
2928
3127
  restore: restoreCommand,
2929
3128
  user: userCommand
2930
3129
  },
2931
3130
  async run() {
2932
- await runCommand(listCommand$11, []);
3131
+ await runCommand(listCommand$12, []);
2933
3132
  }
2934
3133
  });
2935
3134
 
2936
3135
  //#endregion
2937
3136
  //#region src/cli/index.ts
2938
3137
  register("tsx", import.meta.url, { data: {} });
3138
+ initCrashReporting();
2939
3139
  const packageJson = await readPackageJson();
2940
3140
  const cliName = Object.keys(packageJson.bin ?? {})[0] || "tailor-sdk";
2941
3141
  const mainCommand = withCompletionCommand(defineCommand({
@@ -2944,6 +3144,7 @@ const mainCommand = withCompletionCommand(defineCommand({
2944
3144
  subCommands: {
2945
3145
  api: apiCommand,
2946
3146
  apply: applyCommand,
3147
+ "crash-report": crashReportCommand,
2947
3148
  executor: executorCommand,
2948
3149
  function: functionCommand,
2949
3150
  generate: generateCommand,
@@ -2970,14 +3171,20 @@ runMain(mainCommand, {
2970
3171
  version: packageJson.version,
2971
3172
  globalArgs: z.object(commonArgs),
2972
3173
  cleanup: async ({ error }) => {
2973
- if (error) if (isCLIError(error)) {
2974
- logger.log(error.format());
2975
- if (isVerbose() && error.stack) logger.debug(`\nStack trace:\n${error.stack}`);
2976
- } else if (error instanceof Error) {
2977
- logger.error(error.message);
2978
- if (isVerbose() && error.stack) logger.debug(`\nStack trace:\n${error.stack}`);
2979
- } else logger.error(`Unknown error: ${error}`);
2980
- const { shutdownTelemetry } = await import("../telemetry-DDQZRqHK.mjs");
3174
+ if (error) {
3175
+ if (isCLIError(error)) {
3176
+ logger.log(error.format());
3177
+ if (isVerbose() && error.stack) logger.debug(`\nStack trace:\n${error.stack}`);
3178
+ } else if (error instanceof Error) {
3179
+ logger.error(error.message);
3180
+ if (isVerbose() && error.stack) logger.debug(`\nStack trace:\n${error.stack}`);
3181
+ } else logger.error(`Unknown error: ${error}`);
3182
+ if (!isCLIError(error) && (!(error instanceof Error) || error instanceof TypeError || error instanceof RangeError)) {
3183
+ const { reportCrash } = await import("../crash-report-Cot_9Esm.mjs");
3184
+ await reportCrash(error, "handledError");
3185
+ }
3186
+ }
3187
+ const { shutdownTelemetry } = await import("../telemetry-BevrwWwF.mjs");
2981
3188
  await shutdownTelemetry();
2982
3189
  }
2983
3190
  });