@tailor-platform/sdk 1.73.3 → 1.74.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/dist/{application-DgTCDMZY.mjs → application-BsH6tkZC.mjs} +96 -17
  3. package/dist/application-BsH6tkZC.mjs.map +1 -0
  4. package/dist/application-CSUhZMb5.mjs +3 -0
  5. package/dist/cli/commands/deploy/apply-phases.d.mts +1 -0
  6. package/dist/cli/commands/executor/trigger.d.mts +1 -1
  7. package/dist/cli/commands/tailordb/migrate/snapshot.d.mts +1 -16
  8. package/dist/cli/index.mjs +121 -43
  9. package/dist/cli/index.mjs.map +1 -1
  10. package/dist/cli/lib.d.mts +4 -4
  11. package/dist/cli/lib.mjs +3 -3
  12. package/dist/cli/lib.mjs.map +1 -1
  13. package/dist/cli/shared/client.d.mts +1 -1
  14. package/dist/completion/zsh-worker.zsh +28 -3
  15. package/dist/configure/index.mjs +2 -2
  16. package/dist/configure/services/tailordb/schema.d.mts +5 -19
  17. package/dist/configure/types/field-runtime.d.mts +17 -0
  18. package/dist/configure/types/type.d.mts +1 -18
  19. package/dist/field-runtime-9bfXBAOK.mjs +183 -0
  20. package/dist/field-runtime-9bfXBAOK.mjs.map +1 -0
  21. package/dist/plugin/builtin/seed/index.mjs +1 -1
  22. package/dist/{repl-editor-BmQOyZJd.mjs → repl-editor-BCozyiNq.mjs} +3 -2
  23. package/dist/{repl-editor-BmQOyZJd.mjs.map → repl-editor-BCozyiNq.mjs.map} +1 -1
  24. package/dist/{runtime-SxHHEzVb.mjs → runtime-DV1EnfMs.mjs} +2130 -1538
  25. package/dist/runtime-DV1EnfMs.mjs.map +1 -0
  26. package/dist/{schema-DAdZSFOd.mjs → schema-Dl_y0m9e.mjs} +8 -167
  27. package/dist/schema-Dl_y0m9e.mjs.map +1 -0
  28. package/dist/secretmanager-Bd45j7an.mjs +98 -0
  29. package/dist/secretmanager-Bd45j7an.mjs.map +1 -0
  30. package/dist/{seed-DoMTMLcm.mjs → seed-fm0LeYP2.mjs} +14 -3
  31. package/dist/seed-fm0LeYP2.mjs.map +1 -0
  32. package/dist/{service-DiEtAsvc.mjs → service-BCRJ-3NV.mjs} +18 -1
  33. package/dist/{service-DiEtAsvc.mjs.map → service-BCRJ-3NV.mjs.map} +1 -1
  34. package/dist/service-CPMlIg3X.mjs +3 -0
  35. package/dist/tailor-proto/src/tailor/v1/aigateway_pb.d.mts +2 -2
  36. package/dist/tailor-proto/src/tailor/v1/aigateway_resource_pb.d.mts +1 -1
  37. package/dist/tailor-proto/src/tailor/v1/application_pb.d.mts +1 -1
  38. package/dist/tailor-proto/src/tailor/v1/application_resource_pb.d.mts +1 -1
  39. package/dist/tailor-proto/src/tailor/v1/auth_pb.d.mts +1 -1
  40. package/dist/tailor-proto/src/tailor/v1/auth_resource_pb.d.mts +1 -1
  41. package/dist/tailor-proto/src/tailor/v1/events_pb.d.mts +1 -1
  42. package/dist/tailor-proto/src/tailor/v1/events_resource_pb.d.mts +1 -1
  43. package/dist/tailor-proto/src/tailor/v1/executor_pb.d.mts +1 -1
  44. package/dist/tailor-proto/src/tailor/v1/executor_resource_pb.d.mts +1 -1
  45. package/dist/tailor-proto/src/tailor/v1/function_pb.d.mts +1 -1
  46. package/dist/tailor-proto/src/tailor/v1/function_registry_pb.d.mts +1 -1
  47. package/dist/tailor-proto/src/tailor/v1/function_resource_pb.d.mts +1 -1
  48. package/dist/tailor-proto/src/tailor/v1/http_adapter_resource_pb.d.mts +1 -1
  49. package/dist/tailor-proto/src/tailor/v1/idp_pb.d.mts +1 -1
  50. package/dist/tailor-proto/src/tailor/v1/idp_resource_pb.d.mts +1 -1
  51. package/dist/tailor-proto/src/tailor/v1/metadata_pb.d.mts +1 -1
  52. package/dist/tailor-proto/src/tailor/v1/metadata_resource_pb.d.mts +1 -1
  53. package/dist/tailor-proto/src/tailor/v1/meter_pb.d.mts +1 -1
  54. package/dist/tailor-proto/src/tailor/v1/pipeline_pb.d.mts +1 -1
  55. package/dist/tailor-proto/src/tailor/v1/pipeline_resource_pb.d.mts +1 -1
  56. package/dist/tailor-proto/src/tailor/v1/resource_pb.d.mts +1 -1
  57. package/dist/tailor-proto/src/tailor/v1/secret_manager_pb.d.mts +1 -1
  58. package/dist/tailor-proto/src/tailor/v1/secret_manager_resource_pb.d.mts +1 -1
  59. package/dist/tailor-proto/src/tailor/v1/service_pb.d.mts +2 -2
  60. package/dist/tailor-proto/src/tailor/v1/stateflow_pb.d.mts +1 -1
  61. package/dist/tailor-proto/src/tailor/v1/stateflow_resource_pb.d.mts +1 -1
  62. package/dist/tailor-proto/src/tailor/v1/staticwebsite_pb.d.mts +1 -1
  63. package/dist/tailor-proto/src/tailor/v1/staticwebsite_resource_pb.d.mts +1 -1
  64. package/dist/tailor-proto/src/tailor/v1/tailordb_pb.d.mts +1 -1
  65. package/dist/tailor-proto/src/tailor/v1/tailordb_resource_pb.d.mts +1 -1
  66. package/dist/tailor-proto/src/tailor/v1/telemetryrouter_pb.d.mts +1 -1
  67. package/dist/tailor-proto/src/tailor/v1/telemetryrouter_resource_pb.d.mts +1 -1
  68. package/dist/tailor-proto/src/tailor/v1/workflow_pb.d.mts +1 -1
  69. package/dist/tailor-proto/src/tailor/v1/workflow_resource_pb.d.mts +1 -1
  70. package/dist/tailor-proto/src/tailor/v1/workspace_pb.d.mts +2 -2
  71. package/dist/tailor-proto/src/tailor/v1/workspace_resource_pb.d.mts +1 -1
  72. package/dist/types-BwzB2okW.mjs +199 -0
  73. package/dist/types-BwzB2okW.mjs.map +1 -0
  74. package/dist/types-KlawuVKa.mjs +4 -0
  75. package/dist/vitest/index.d.mts +8 -1
  76. package/dist/vitest/index.mjs +778 -2
  77. package/dist/vitest/index.mjs.map +1 -1
  78. package/dist/vitest/mock.d.mts +8 -363
  79. package/dist/vitest/mocks/aigateway.d.mts +30 -0
  80. package/dist/vitest/mocks/authconnection.d.mts +28 -0
  81. package/dist/vitest/mocks/file.d.mts +41 -0
  82. package/dist/vitest/mocks/iconv.d.mts +27 -0
  83. package/dist/vitest/mocks/idp.d.mts +44 -0
  84. package/dist/vitest/mocks/secretmanager.d.mts +33 -0
  85. package/dist/vitest/mocks/tailordb.d.mts +71 -0
  86. package/dist/vitest/mocks/workflow.d.mts +115 -0
  87. package/dist/vitest/setup.mjs +1 -1
  88. package/docs/cli/application.md +21 -11
  89. package/docs/cli/setup.md +25 -0
  90. package/docs/cli-reference.md +1 -0
  91. package/package.json +15 -15
  92. package/dist/application-BAo_zFA4.mjs +0 -3
  93. package/dist/application-DgTCDMZY.mjs.map +0 -1
  94. package/dist/field-DOsJCPFa.mjs +0 -22
  95. package/dist/field-DOsJCPFa.mjs.map +0 -1
  96. package/dist/mock-Ce1GCi4-.mjs +0 -871
  97. package/dist/mock-Ce1GCi4-.mjs.map +0 -1
  98. package/dist/runtime-SxHHEzVb.mjs.map +0 -1
  99. package/dist/schema-DAdZSFOd.mjs.map +0 -1
  100. package/dist/seed-DoMTMLcm.mjs.map +0 -1
  101. package/dist/service-BXmdFwSH.mjs +0 -3
  102. package/dist/types-qhFZ8y9B.mjs +0 -4
  103. package/dist/types-ywCGpzDZ.mjs +0 -360
  104. package/dist/types-ywCGpzDZ.mjs.map +0 -1
@@ -0,0 +1,3 @@
1
+ import { n as generatePluginFilesIfNeeded, r as loadApplication, t as defineApplication } from "./application-BsH6tkZC.mjs";
2
+
3
+ export { defineApplication, generatePluginFilesIfNeeded };
@@ -0,0 +1 @@
1
+ export { };
@@ -1,6 +1,6 @@
1
1
  import { IncomingWebhookTrigger, ScheduleTriggerInput } from "../../../types/executor.generated.mjs";
2
- import { JsonObject } from "@bufbuild/protobuf";
3
2
  import { z } from "zod";
3
+ import { JsonObject } from "@bufbuild/protobuf";
4
4
 
5
5
  //#region src/cli/commands/executor/trigger.d.ts
6
6
  type ManualTrigger = IncomingWebhookTrigger | ScheduleTriggerInput;
@@ -21,21 +21,6 @@ declare const DB_TYPES_FILE_NAME = "db.ts";
21
21
  * Migration file type
22
22
  */
23
23
  type MigrationFileType = "schema" | "diff" | "migrate" | "db";
24
- /**
25
- * Information about a migration
26
- */
27
- interface MigrationInfo {
28
- /** Migration number (e.g., 1, 2, 3) */
29
- number: number;
30
- /** Migration number as 4-digit string (e.g., "0001", "0002") */
31
- numberStr: string;
32
- /** Migration file type */
33
- type: MigrationFileType;
34
- /** Path to migration file */
35
- path: string;
36
- /** Parsed content (schema snapshot or diff) */
37
- content: SchemaSnapshot | MigrationDiff;
38
- }
39
24
  /**
40
25
  * Get migration directory path for a given number
41
26
  * @param {string} migrationsDir - Base migrations directory path
@@ -110,4 +95,4 @@ declare function compareSnapshots(previous: SchemaSnapshot, current: SchemaSnaps
110
95
  */
111
96
  declare function compareLocalTypesWithSnapshot(snapshot: SchemaSnapshot, localTypes: Record<string, TailorDBSnapshotType>, namespace: string): MigrationDiff;
112
97
  //#endregion
113
- export { DB_TYPES_FILE_NAME, DIFF_FILE_NAME, INITIAL_SCHEMA_NUMBER, MIGRATE_FILE_NAME, MigrationFileType, MigrationInfo, type NormalizedSchemaSnapshot, SCHEMA_FILE_NAME, type SchemaSnapshot, type SnapshotFieldConfig, type TailorDBSnapshotType, compareLocalTypesWithSnapshot, compareSnapshots, createSnapshotFromLocalTypes, getLatestMigrationNumber, getMigrationDirPath, getMigrationFilePath, getMigrationFiles, getNextMigrationNumber, reconstructSnapshotFromMigrations };
98
+ export { DB_TYPES_FILE_NAME, DIFF_FILE_NAME, INITIAL_SCHEMA_NUMBER, MIGRATE_FILE_NAME, MigrationFileType, type NormalizedSchemaSnapshot, SCHEMA_FILE_NAME, type SchemaSnapshot, type SnapshotFieldConfig, type TailorDBSnapshotType, compareLocalTypesWithSnapshot, compareSnapshots, createSnapshotFromLocalTypes, getLatestMigrationNumber, getMigrationDirPath, getMigrationFilePath, getMigrationFiles, getNextMigrationNumber, reconstructSnapshotFromMigrations };
@@ -2,11 +2,11 @@
2
2
  import { C as CustomDomainStatus, R as FunctionExecution_Type, mt as AuthInvokerSchema, xt as PATScope } from "../service_pb-CIrhGwHk.mjs";
3
3
  import { t as assertDefined } from "../assert-DBxo8jPo.mjs";
4
4
  import { n as logger, r as styles } from "../logger-BEiZZ3qT.mjs";
5
- import { $t as generateAllTypeManifestsFromSnapshot, A as listCommand$12, An as apiCommand, Bn as paginationArgs, C as listCommand$13, Cn as getNamespacesWithMigrations, Dn as PluginManager, Dt as listCommand$6, E as waitCommand, En as sdkNameLabelKey, F as generateCommand$1, Fn as configArg, G as removeCommand$1, Gt as deploy, H as extractOwnedNamespaces, Hn as workspaceArgs, Ht as formatKeyValueTable, I as generateMigrationScript, In as confirmationArgs, It as getCommand$6, K as updateCommand$3, Kt as executeScript, L as writeDbTypesFile, Ln as deploymentArgs, Mn as assertWritable, N as truncateCommand, Nn as defineAppCommand, O as resumeCommand, On as generateUserTypes, Pn as commonArgs, Pt as startCommand, Q as getCommand$5, Qt as compareSnapshotWithRemote, R as getConfiguredEditorCommand, Rn as isVerbose, Rt as executionsCommand, Sn as hasChanges, T as healthCommand, Tn as resourceTrn, Tt as triggerCommand, U as logBetaWarning, Ut as getCommand$1, V as showCommand, Vn as toPageDirection, Vt as functionExecutionStatusToString, X as listCommand$11, Xt as handleOptionalToRequiredError, Y as treeCommand, Yt as MIGRATION_LABEL_KEY, Zt as parseMigrationLabelNumber, _n as reconstructSnapshotFromMigrations, b as createCommand$4, c as listCommand$14, ct as createCommand$3, en as protoGqlPermission, et as updateCommand$2, f as restoreCommand, fn as getMigrationFilePath, ft as getCommand$3, g as getCommand$7, gn as loadDiff, gt as listCommand$8, hn as isValidMigrationNumber, ht as tokenCommand, i as updateCommand$4, it as getCommand$4, jt as jobsCommand, kn as prompt, ln as createSnapshotFromLocalTypes, m as listCommand$15, nt as listCommand$10, o as removeCommand, on as assertValidMigrationFiles, ot as deleteCommand$3, pn as getMigrationFiles, r as queryCommand, rn as INITIAL_SCHEMA_NUMBER, sn as compareLocalTypesWithSnapshot, t as isNativeTypeScriptRuntime, u as inviteCommand, un as getLatestMigrationNumber, ut as listCommand$9, v as deleteCommand$4, vn as formatMigrationNumber, vt as generate, wn as ensureConfigId, wt as webhookCommand, xn as formatMigrationDiff, xt as getCommand$2, yn as parseMigrationNumberArg, yt as listCommand$7, z as openInConfiguredEditor, zn as pagedLogArgs } from "../runtime-SxHHEzVb.mjs";
6
- import { $ as initOperatorClient, A as loadAccessToken, B as saveUserTokens, C as hashContent$1, D as fetchLatestToken, E as deleteUserTokens, F as loadStoredUserTokens, H as closeConnectionPool, I as loadWorkspaceId, J as fetchUserInfo, K as fetchPaged, L as platformConfigFromProfile, M as loadConsoleBaseUrl, N as loadMachineUserName, O as hasAnyUserTokenEntry, Q as initOAuth2Client, R as readPlatformConfig, S as getDistDir, T as loadConfig, U as defaultPlatformBaseUrl, V as writePlatformConfig, W as fetchAll, _ as createLogLevelTreeshakeOptions, a as WorkflowJobSchema, c as INVOKER_EXPR, et as isDefaultPlatform, g as composeFunctionTreeshakeOptions, h as platformBundleDefinePlugin, i as resolveInlineSourcemap, k as hasUserTokenEntry, o as ResolverSchema, q as fetchPlatformMachineUserToken, t as defineApplication, v as resolveBundleLogLevel, z as resolveUserTokenKey } from "../application-DgTCDMZY.mjs";
7
- import { n as ExecutorSchema } from "../service-DiEtAsvc.mjs";
5
+ import { $t as compareSnapshotWithRemote, A as listCommand$12, An as apiCommand, Bn as pagedLogArgs, C as listCommand$13, Cn as hasChanges, Dn as PluginManager, Dt as listCommand$6, E as waitCommand, En as sdkNameLabelKey, F as generateCommand$1, Fn as configArg, G as removeCommand$1, Gt as deploy, H as extractOwnedNamespaces, Hn as toPageDirection, Ht as formatKeyValueTable, I as generateMigrationScript, In as confirmationArgs, It as getCommand$6, K as updateCommand$3, Kt as ensureConfigId, L as writeDbTypesFile, Ln as deploymentArgs, Mn as assertWritable, N as truncateCommand, Nn as defineAppCommand, O as resumeCommand, On as generateUserTypes, Pn as commonArgs, Pt as startCommand, Q as getCommand$5, Qt as parseMigrationLabelNumber, R as getConfiguredEditorCommand, Rn as isVerbose, Rt as executionsCommand, Sn as formatMigrationDiff, T as healthCommand, Tn as resourceTrn, Tt as triggerCommand, U as logBetaWarning, Un as workspaceArgs, Ut as getCommand$1, V as showCommand, Vn as paginationArgs, Vt as functionExecutionStatusToString, X as listCommand$11, Xt as MIGRATION_LABEL_KEY, Y as treeCommand, Zt as handleOptionalToRequiredError, _n as loadDiff, b as createCommand$4, bn as parseMigrationNumberArg, c as listCommand$14, cn as compareLocalTypesWithSnapshot, ct as createCommand$3, dn as getLatestMigrationNumber, en as generateAllTypeManifestsFromSnapshot, et as updateCommand$2, f as restoreCommand, ft as getCommand$3, g as getCommand$7, gn as isValidMigrationNumber, gt as listCommand$8, ht as tokenCommand, i as updateCommand$4, in as INITIAL_SCHEMA_NUMBER, it as getCommand$4, jt as jobsCommand, kn as prompt, m as listCommand$15, mn as getMigrationFiles, nt as listCommand$10, o as removeCommand, ot as deleteCommand$4, pn as getMigrationFilePath, qt as executeScript, r as queryCommand, sn as assertValidMigrationFiles, t as isNativeTypeScriptRuntime, tn as protoGqlPermission, u as inviteCommand, un as createSnapshotFromLocalTypes, ut as listCommand$9, v as deleteCommand$5, vn as reconstructSnapshotFromMigrations, vt as generate, wn as getNamespacesWithMigrations, wt as webhookCommand, xt as getCommand$2, yn as formatMigrationNumber, yt as listCommand$7, z as openInConfiguredEditor, zn as multiConfigArg } from "../runtime-DV1EnfMs.mjs";
6
+ import { $ as getOrNull, A as hasUserTokenEntry, B as resolveUserTokenKey, C as getDistDir, D as deleteUserTokens, E as loadConfig, G as fetchAll, H as writePlatformConfig, I as loadStoredUserTokens, J as fetchPaged, K as fetchAllTolerant, L as loadWorkspaceId, N as loadConsoleBaseUrl, O as fetchLatestToken, P as loadMachineUserName, R as platformConfigFromProfile, U as closeConnectionPool, V as saveUserTokens, W as defaultPlatformBaseUrl, X as fetchUserInfo, Y as fetchPlatformMachineUserToken, _ as composeFunctionTreeshakeOptions, a as resolveInlineSourcemap, g as platformBundleDefinePlugin, j as loadAccessToken, k as hasAnyUserTokenEntry, l as INVOKER_EXPR, nt as initOperatorClient, o as WorkflowJobSchema, rt as isDefaultPlatform, s as ResolverSchema, t as defineApplication, tt as initOAuth2Client, v as createLogLevelTreeshakeOptions, w as hashContent$1, y as resolveBundleLogLevel, z as readPlatformConfig } from "../application-BsH6tkZC.mjs";
7
+ import { n as ExecutorSchema } from "../service-BCRJ-3NV.mjs";
8
8
  import { t as multiline } from "../multiline-sfHpTZZK.mjs";
9
- import { r as isPluginGeneratedType } from "../seed-DoMTMLcm.mjs";
9
+ import { r as isPluginGeneratedType } from "../seed-fm0LeYP2.mjs";
10
10
  import { t as readPackageJson } from "../package-json-8b0O9TlX.mjs";
11
11
  import { i as userAgent } from "../secret-file-VSVGy1V0.mjs";
12
12
  import { n as isCLIError } from "../errors-Dtf2WPaW.mjs";
@@ -474,7 +474,8 @@ const deployCommand$1 = defineAppCommand({
474
474
  aliases: ["apply"],
475
475
  description: "Deploy your application by applying the Tailor configuration.",
476
476
  args: z.object({
477
- ...deploymentArgs,
477
+ ...workspaceArgs,
478
+ ...multiConfigArg,
478
479
  ...confirmationArgs,
479
480
  "dry-run": arg(z.boolean().optional(), {
480
481
  alias: "d",
@@ -1287,7 +1288,7 @@ async function detectFunctionType(options) {
1287
1288
  const rawInput = module.default.input;
1288
1289
  let inputSchema;
1289
1290
  if (rawInput) {
1290
- const { t } = await import("../types-qhFZ8y9B.mjs");
1291
+ const { t } = await import("../types-KlawuVKa.mjs");
1291
1292
  inputSchema = t.object(rawInput);
1292
1293
  }
1293
1294
  return {
@@ -2006,7 +2007,7 @@ const folderCommand = defineCommand({
2006
2007
  description: "Manage organization folders.",
2007
2008
  subCommands: {
2008
2009
  create: createCommand$3,
2009
- delete: deleteCommand$3,
2010
+ delete: deleteCommand$4,
2010
2011
  get: getCommand$4,
2011
2012
  list: listCommand$10,
2012
2013
  update: updateCommand$2
@@ -2116,7 +2117,7 @@ const createCommand$2 = defineAppCommand({
2116
2117
 
2117
2118
  //#endregion
2118
2119
  //#region src/cli/commands/profile/delete.ts
2119
- const deleteCommand$2 = defineAppCommand({
2120
+ const deleteCommand$3 = defineAppCommand({
2120
2121
  name: "delete",
2121
2122
  description: "Delete a profile.",
2122
2123
  args: z.object({ name: arg(z.string(), {
@@ -2273,7 +2274,7 @@ const profileCommand = defineCommand({
2273
2274
  description: "Manage workspace profiles (user + workspace combinations).",
2274
2275
  subCommands: {
2275
2276
  create: createCommand$2,
2276
- delete: deleteCommand$2,
2277
+ delete: deleteCommand$3,
2277
2278
  list: listCommand$4,
2278
2279
  update: updateCommand$1
2279
2280
  },
@@ -2601,7 +2602,7 @@ const createCommand$1 = defineAppCommand({
2601
2602
 
2602
2603
  //#endregion
2603
2604
  //#region src/cli/commands/secret/vault/delete.ts
2604
- const deleteCommand$1 = defineAppCommand({
2605
+ const deleteCommand$2 = defineAppCommand({
2605
2606
  name: "delete",
2606
2607
  description: "Delete a Secret Manager vault.",
2607
2608
  args: z.object({
@@ -2697,7 +2698,7 @@ const vaultCommand = defineCommand({
2697
2698
  description: "Manage Secret Manager vaults.",
2698
2699
  subCommands: {
2699
2700
  create: createCommand$1,
2700
- delete: deleteCommand$1,
2701
+ delete: deleteCommand$2,
2701
2702
  list: listCommand$3
2702
2703
  },
2703
2704
  async run() {
@@ -3782,6 +3783,75 @@ async function checkGitHub(options) {
3782
3783
  throw new Error(`Detected ${String(findings.length)} drift finding(s) across ${String(count)} target(s). Re-run \`tailor-sdk setup\` to regenerate, or address each finding above.`);
3783
3784
  }
3784
3785
 
3786
+ //#endregion
3787
+ //#region src/cli/commands/setup/delete.ts
3788
+ function normalizeRelPath(input) {
3789
+ return input.replaceAll("\\", "/").replace(/\/{2,}/g, "/").replace(/^\.\//, "").replace(/\/$/, "");
3790
+ }
3791
+ function targetKey(target) {
3792
+ return `${target.kind}:${target.workspaceName}`;
3793
+ }
3794
+ function resolveMatch(outputDir, targets, input) {
3795
+ const relPath = normalizeRelPath(input);
3796
+ const absPath = resolveWithinRoot(outputDir, relPath);
3797
+ if (absPath === null) throw new Error(`"${input}" must be a path inside the repository.`);
3798
+ const target = targets.find((t) => t.file === relPath);
3799
+ if (!target) throw new Error(`"${relPath}" is not a managed workflow/action file (not recorded in .github/tailor-sdk.lock). Only files generated by \`tailor-sdk setup\` can be deleted with this command.`);
3800
+ return {
3801
+ relPath,
3802
+ absPath,
3803
+ target
3804
+ };
3805
+ }
3806
+ function warnCoordinatorReferences(allTargets, deletedKeys, match) {
3807
+ if (match.target.kind !== "action") return;
3808
+ for (const coordinator of allTargets) if (coordinator.kind === "coordinate" && coordinator.inputs.actionDirs?.includes(match.target.inputs.dir) && !deletedKeys.has(targetKey(coordinator))) logger.warn(`Coordinator "${coordinator.workspaceName}" still references this action's directory (${match.target.inputs.dir}). Re-run \`tailor-sdk setup coordinate\` without --action ${match.target.workspaceName} to remove it there too.`);
3809
+ }
3810
+ /**
3811
+ * Delete managed workflow/action files and their `.github/tailor-sdk.lock` entries.
3812
+ *
3813
+ * Refuses to touch files that are not recorded in the lock, so it never
3814
+ * deletes hand-written workflows or the user-owned tailor-setup action.
3815
+ * @param options - Delete options
3816
+ */
3817
+ async function setupDelete(options) {
3818
+ logBetaWarning("setup");
3819
+ const { outputDir, yes } = options;
3820
+ const lock = readLock(outputDir);
3821
+ if (!lock || lock.targets.length === 0) throw new Error("No managed workflows found (.github/tailor-sdk.lock is missing or empty). Run `tailor-sdk setup branch` (or another setup subcommand) first.");
3822
+ const matches = [...new Set(options.files.map(normalizeRelPath))].map((relPath) => resolveMatch(outputDir, lock.targets, relPath));
3823
+ const deletedKeys = new Set(matches.map((m) => targetKey(m.target)));
3824
+ for (const match of matches) warnCoordinatorReferences(lock.targets, deletedKeys, match);
3825
+ if (!yes) {
3826
+ const list = matches.map((m) => m.relPath).join("\n ");
3827
+ if (!await prompt.confirm({
3828
+ message: `This will delete the following file(s) and their .github/tailor-sdk.lock entries:\n ${list}\nContinue?`,
3829
+ default: false
3830
+ })) {
3831
+ logger.info("Delete cancelled.");
3832
+ return;
3833
+ }
3834
+ }
3835
+ const remaining = [...lock.targets];
3836
+ try {
3837
+ for (const { relPath, absPath, target } of matches) {
3838
+ fs$1.rmSync(absPath, { force: true });
3839
+ if (target.kind === "action") {
3840
+ const dir = path.dirname(absPath);
3841
+ if (fs$1.existsSync(dir) && fs$1.readdirSync(dir).length === 0) fs$1.rmdirSync(dir);
3842
+ }
3843
+ const index = remaining.findIndex((t) => targetKey(t) === targetKey(target));
3844
+ if (index !== -1) remaining.splice(index, 1);
3845
+ logger.success(`Deleted ${styles.path(relPath)} (${target.kind} ${target.workspaceName})`);
3846
+ }
3847
+ } finally {
3848
+ if (remaining.length !== lock.targets.length) writeLock(outputDir, {
3849
+ version: 1,
3850
+ targets: remaining
3851
+ });
3852
+ }
3853
+ }
3854
+
3785
3855
  //#endregion
3786
3856
  //#region src/cli/commands/setup/index.ts
3787
3857
  const checkCommand = defineAppCommand({
@@ -3940,6 +4010,24 @@ const previewCommand = defineAppCommand({
3940
4010
  });
3941
4011
  }
3942
4012
  });
4013
+ const deleteCommand$1 = defineAppCommand({
4014
+ name: "delete",
4015
+ description: "Delete managed workflow/action file(s) and their .github/tailor-sdk.lock entries.",
4016
+ args: z.object({
4017
+ ...confirmationArgs,
4018
+ files: arg(z.string().array().min(1), {
4019
+ positional: true,
4020
+ description: "Workflow/action file(s) to delete, as generated under .github/workflows or .github/actions"
4021
+ })
4022
+ }).strict(),
4023
+ run: async (args) => {
4024
+ await setupDelete({
4025
+ files: args.files,
4026
+ yes: args.yes,
4027
+ outputDir: process.cwd()
4028
+ });
4029
+ }
4030
+ });
3943
4031
  const setupCommand = defineCommand({
3944
4032
  name: "setup",
3945
4033
  description: "Generate CI deploy workflows for your project. (beta)",
@@ -3949,7 +4037,8 @@ const setupCommand = defineCommand({
3949
4037
  preview: previewCommand,
3950
4038
  action: actionCommand,
3951
4039
  coordinate: coordinateCommand,
3952
- check: checkCommand
4040
+ check: checkCommand,
4041
+ delete: deleteCommand$1
3953
4042
  }
3954
4043
  });
3955
4044
 
@@ -4763,7 +4852,7 @@ function buildViewerHtml(options) {
4763
4852
  const currentSchemaScript = options.currentSchema === void 0 ? "" : `\n <script type="application/json" id="erd-current-schema">${JSON.stringify(options.currentSchema).replaceAll("<", "\\u003c")}<\/script>`;
4764
4853
  const diffScript = options.diff === void 0 ? "" : `\n <script type="application/json" id="erd-diff">${JSON.stringify(options.diff).replaceAll("<", "\\u003c")}<\/script>`;
4765
4854
  const inlineScript = `<script type="module">\n${appJs.replace(/<\/script/gi, "<\\/script")}\n<\/script>`;
4766
- return html.replace("<title>TailorDB ERD</title>", `<title>${escapeHtml(options.title ?? "TailorDB ERD")}</title>`).replace(STYLES_LINK, `<style>\n${css}\n</style>`).replace(APP_SCRIPT, `${embedScript}${currentSchemaScript}${diffScript}\n ${inlineScript}`);
4855
+ return html.replace("<title>TailorDB ERD</title>", () => `<title>${escapeHtml(options.title ?? "TailorDB ERD")}</title>`).replace(STYLES_LINK, () => `<style>\n${css}\n</style>`).replace(APP_SCRIPT, () => `${embedScript}${currentSchemaScript}${diffScript}\n ${inlineScript}`);
4767
4856
  }
4768
4857
  /**
4769
4858
  * Write the self-contained TailorDB ERD viewer to `<distDir>/index.html`.
@@ -5934,19 +6023,14 @@ const statusCommand = defineAppCommand({
5934
6023
  //#endregion
5935
6024
  //#region src/cli/commands/tailordb/migrate/sync.ts
5936
6025
  async function fetchRemoteGqlPermissions(client, workspaceId, namespace) {
5937
- return fetchAll(async (pageToken, maxPageSize) => {
5938
- try {
5939
- const { permissions, nextPageToken } = await client.listTailorDBGQLPermissions({
5940
- workspaceId,
5941
- namespaceName: namespace,
5942
- pageToken,
5943
- pageSize: maxPageSize
5944
- });
5945
- return [permissions, nextPageToken];
5946
- } catch (error) {
5947
- if (error instanceof ConnectError && error.code === Code.NotFound) return [[], ""];
5948
- throw error;
5949
- }
6026
+ return fetchAllTolerant(async (pageToken, maxPageSize) => {
6027
+ const { permissions, nextPageToken } = await client.listTailorDBGQLPermissions({
6028
+ workspaceId,
6029
+ namespaceName: namespace,
6030
+ pageToken,
6031
+ pageSize: maxPageSize
6032
+ });
6033
+ return [permissions, nextPageToken];
5950
6034
  });
5951
6035
  }
5952
6036
  async function fetchRemoteTypes(client, workspaceId, namespace) {
@@ -5986,7 +6070,7 @@ async function fetchRemoteTypes(client, workspaceId, namespace) {
5986
6070
  async function assertMigrationsReproduceLocalTypes(loaded, target) {
5987
6071
  const { config, plugins } = loaded;
5988
6072
  const pluginManager = plugins.length > 0 ? new PluginManager(plugins) : void 0;
5989
- const { defineApplication, generatePluginFilesIfNeeded } = await import("../application-BAo_zFA4.mjs");
6073
+ const { defineApplication, generatePluginFilesIfNeeded } = await import("../application-CSUhZMb5.mjs");
5990
6074
  const application = defineApplication({
5991
6075
  config,
5992
6076
  pluginManager
@@ -5998,7 +6082,7 @@ async function assertMigrationsReproduceLocalTypes(loaded, target) {
5998
6082
  await service.processNamespacePlugins();
5999
6083
  }
6000
6084
  const pluginExecutorFiles = generatePluginFilesIfNeeded(pluginManager, application.tailorDBServices, config.path);
6001
- const executorService = application.executorService ?? (pluginExecutorFiles.length > 0 ? (await import("../service-BXmdFwSH.mjs")).createExecutorService({ config: { files: [] } }) : void 0);
6085
+ const executorService = application.executorService ?? (pluginExecutorFiles.length > 0 ? (await import("../service-CPMlIg3X.mjs")).createExecutorService({ config: { files: [] } }) : void 0);
6002
6086
  await executorService?.loadExecutors();
6003
6087
  if (pluginExecutorFiles.length > 0) await executorService?.loadPluginExecutorFiles([...pluginExecutorFiles]);
6004
6088
  const executorUsedTypes = /* @__PURE__ */ new Set();
@@ -6033,21 +6117,15 @@ async function assertMigrationsReproduceLocalTypes(loaded, target) {
6033
6117
  * @returns Existing labels and the parsed current migration number
6034
6118
  */
6035
6119
  async function fetchRemoteMigrationState(client, trn) {
6036
- try {
6120
+ const labels = (await getOrNull(async () => {
6037
6121
  const { metadata } = await client.getMetadata({ trn });
6038
- const labels = metadata?.labels ?? {};
6039
- const label = labels[MIGRATION_LABEL_KEY];
6040
- return {
6041
- labels,
6042
- current: label ? parseMigrationLabelNumber(label) : null
6043
- };
6044
- } catch (error) {
6045
- if (error instanceof ConnectError && error.code === Code.NotFound) return {
6046
- labels: {},
6047
- current: null
6048
- };
6049
- throw error;
6050
- }
6122
+ return metadata;
6123
+ }))?.labels ?? {};
6124
+ const label = labels[MIGRATION_LABEL_KEY];
6125
+ return {
6126
+ labels,
6127
+ current: label ? parseMigrationLabelNumber(label) : null
6128
+ };
6051
6129
  }
6052
6130
  function selectTargetNamespace(namespacesWithMigrations, requested) {
6053
6131
  if (namespacesWithMigrations.length === 0) throw new Error("No TailorDB services with migrations configuration found");
@@ -6668,7 +6746,7 @@ const workspaceCommand = defineCommand({
6668
6746
  subCommands: {
6669
6747
  app: appCommand,
6670
6748
  create: createCommand$4,
6671
- delete: deleteCommand$4,
6749
+ delete: deleteCommand$5,
6672
6750
  get: getCommand$7,
6673
6751
  list: listCommand$15,
6674
6752
  restore: restoreCommand,