@tailor-platform/sdk 1.62.0 → 1.65.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 (42) hide show
  1. package/CHANGELOG.md +69 -0
  2. package/dist/{actor-J2gJ0eK5.d.mts → actor-D_2aJjYO.d.mts} +2 -2
  3. package/dist/{application-BezXGbrU.mjs → application-76hhIhnJ.mjs} +42 -5
  4. package/dist/application-76hhIhnJ.mjs.map +1 -0
  5. package/dist/application-av2raLs6.mjs +4 -0
  6. package/dist/cli/index.mjs +505 -121
  7. package/dist/cli/index.mjs.map +1 -1
  8. package/dist/cli/lib.d.mts +24 -31
  9. package/dist/cli/lib.mjs +2 -2
  10. package/dist/configure/index.d.mts +5 -5
  11. package/dist/configure/index.mjs.map +1 -1
  12. package/dist/{index-CfRFkXIO.d.mts → index-Bhjep8cS.d.mts} +2 -2
  13. package/dist/{index-DUupuPhZ.d.mts → index-CZ2r3qiO.d.mts} +2 -2
  14. package/dist/{index-CPRnOjjt.d.mts → index-Db2RvnEH.d.mts} +2 -2
  15. package/dist/{index-CLxubakC.d.mts → index-DcXIjt9F.d.mts} +5 -5
  16. package/dist/{index-CQZVJ5SX.d.mts → index-QpC0TNbH.d.mts} +2 -2
  17. package/dist/plugin/builtin/enum-constants/index.d.mts +1 -1
  18. package/dist/plugin/builtin/file-utils/index.d.mts +1 -1
  19. package/dist/plugin/builtin/kysely-type/index.d.mts +1 -1
  20. package/dist/plugin/builtin/seed/index.d.mts +1 -1
  21. package/dist/plugin/index.d.mts +2 -2
  22. package/dist/{plugin-C_FyVSdl.d.mts → plugin-DylAsA4Z.d.mts} +2 -2
  23. package/dist/{runtime-C6o4hiYq.mjs → runtime-C7qTBDD2.mjs} +565 -99
  24. package/dist/runtime-C7qTBDD2.mjs.map +1 -0
  25. package/dist/{tailordb-BlBGmQK-.d.mts → tailordb-C-ar4XCX.d.mts} +4 -4
  26. package/dist/utils/test/index.d.mts +3 -3
  27. package/dist/{workflow.generated-Bf1tWylx.d.mts → workflow.generated-CCDsY0ce.d.mts} +42 -6
  28. package/docs/cli/auth.md +4 -4
  29. package/docs/cli/function.md +8 -8
  30. package/docs/cli/query.md +1 -1
  31. package/docs/cli/setup.md +18 -12
  32. package/docs/cli/workflow.md +10 -10
  33. package/docs/cli/workspace.md +14 -10
  34. package/docs/cli-reference.md +4 -4
  35. package/docs/github-actions.md +337 -0
  36. package/docs/services/auth.md +19 -0
  37. package/docs/services/idp.md +96 -0
  38. package/docs/services/tailordb-migration.md +17 -6
  39. package/package.json +12 -12
  40. package/dist/application-BezXGbrU.mjs.map +0 -1
  41. package/dist/application-DSXntqnV.mjs +0 -4
  42. package/dist/runtime-C6o4hiYq.mjs.map +0 -1
@@ -3,7 +3,7 @@ import { t as db } from "./schema-1msIhXwA.mjs";
3
3
  import { $ as CreateExecutorExecutorRequestSchema, A as TailorDBGQLPermission_Permit, At as AuthSCIMAttribute_Type, B as UpdateSecretManagerSecretRequestSchema, Bt as Subgraph_ServiceType, C as WorkflowExecution_Status, Ct as AuthConnection_Type, D as UpdateTailorDBTypeRequestSchema, Dt as AuthOAuth2Client_ClientType, E as CreateTailorDBTypeRequestSchema, Et as AuthInvokerSchema, F as CreateStaticWebsiteRequestSchema, Ft as UserProfileProviderConfig_UserProfileProviderType, G as PipelineResolver_OperationType, H as CreatePipelineServiceRequestSchema, Ht as Condition_Operator, I as UpdateStaticWebsiteRequestSchema, It as CreateApplicationRequestSchema, J as IdPLang, K as CreateIdPServiceRequestSchema, Lt as GetApplicationSchemaHealthResponse_ApplicationSchemaHealthStatus, M as TailorDBType_Permission_Permit, Mt as AuthSCIMConfig_AuthorizationType, N as TailorDBType_PermitAction, O as TailorDBGQLPermission_Action, Ot as AuthOAuth2Client_GrantType, P as AddCustomDomainRequestSchema, Pt as TenantProviderConfig_TenantProviderType, R as CreateSecretManagerSecretRequestSchema, Rt as UpdateApplicationRequestSchema, S as UpdateWorkflowRequestSchema, St as UpdateUserProfileConfigRequestSchema, T as CreateTailorDBServiceRequestSchema, Tt as AuthIDPConfig_AuthType, U as UpdatePipelineResolverRequestSchema, Ut as FilterSchema, V as CreatePipelineResolverRequestSchema, Vt as ConditionSchema, W as UpdatePipelineServiceRequestSchema, Wt as PageDirection, X as IdPPermissionPermit, Y as IdPPermissionOperator, Z as FunctionExecution_Status, _ as userAgent, _t as UpdateAuthOAuth2ClientRequestSchema, a as fetchAll, at as CreateAuthHookRequestSchema, b as CreateWorkflowJobFunctionRequestSchema, bt as UpdateAuthServiceRequestSchema, ct as CreateAuthOAuth2ClientRequestSchema, dt as CreateAuthServiceRequestSchema, et as UpdateExecutorExecutorRequestSchema, f as initOperatorClient, ft as CreateTenantConfigRequestSchema, gt as UpdateAuthMachineUserRequestSchema, h as resolveStaticWebsiteUrls, ht as UpdateAuthIDPConfigRequestSchema, it as CreateAuthConnectionRequestSchema, j as TailorDBType_Permission_Operator, jt as AuthSCIMAttribute_Uniqueness, k as TailorDBGQLPermission_Operator, kt as AuthSCIMAttribute_Mutability, lt as CreateAuthSCIMConfigRequestSchema, m as platformBaseUrl, mt as UpdateAuthHookRequestSchema, nt as ExecutorTargetType, o as fetchMachineUserToken, ot as CreateAuthIDPConfigRequestSchema, pt as CreateUserProfileConfigRequestSchema, q as UpdateIdPServiceRequestSchema, rt as ExecutorTriggerType, s as fetchPaged, st as CreateAuthMachineUserRequestSchema, tt as ExecutorJobStatus, ut as CreateAuthSCIMResourceRequestSchema, v as OperatorService, vt as UpdateAuthSCIMConfigRequestSchema, w as WorkflowJobExecution_Status, wt as AuthHookPoint, x as CreateWorkflowRequestSchema, xt as UpdateTenantConfigRequestSchema, y as WorkspacePlatformUserRole, yt as UpdateAuthSCIMResourceRequestSchema, z as CreateSecretManagerVaultRequestSchema, zt as ApplicationSchemaUpdateAttemptStatus } from "./client-CobIRHl-.mjs";
4
4
  import { t as assertDefined } from "./assert-CKfwrmCV.mjs";
5
5
  import { a as parseBoolean, i as symbols, n as logger, r as styles, t as CIPromptError } from "./logger-DpJyJvNz.mjs";
6
- import { C as loadConfig, D as loadConfigPath, E as loadAccessToken, M as writePlatformConfig, O as loadWorkspaceId, S as hashFile, b as getDistDir, d as assertUniqueLocalTailorDBTypeNames, f as assertUniqueTailorDBTypeNamesWithExternal, h as platformBundleDefinePlugin, k as readPlatformConfig, l as buildExecutorArgsExpr, m as stringifyFunction, n as generatePluginFilesIfNeeded, p as TailorDBTypeSchema, r as loadApplication, s as HTTP_METHODS, t as defineApplication, u as buildResolverOperationHookExpr, y as createBundleCache } from "./application-BezXGbrU.mjs";
6
+ import { A as readPlatformConfig, C as loadConfig, D as loadConfigPath, E as loadAccessToken, N as writePlatformConfig, O as loadMachineUserName, S as hashFile, b as getDistDir, d as assertUniqueLocalTailorDBTypeNames, f as assertUniqueTailorDBTypeNamesWithExternal, h as platformBundleDefinePlugin, k as loadWorkspaceId, l as buildExecutorArgsExpr, m as stringifyFunction, n as generatePluginFilesIfNeeded, p as TailorDBTypeSchema, r as loadApplication, s as HTTP_METHODS, t as defineApplication, u as buildResolverOperationHookExpr, y as createBundleCache } from "./application-76hhIhnJ.mjs";
7
7
  import { o as loadFilesWithIgnores, t as createExecutorService } from "./service-wI3Hvrgx.mjs";
8
8
  import { t as multiline } from "./multiline-Cf9ODpr1.mjs";
9
9
  import { t as readPackageJson } from "./package-json-DcQApfPQ.mjs";
@@ -3003,7 +3003,7 @@ function parseIdPPermission(rawPermission) {
3003
3003
  function findOmittedPermitRules(permission) {
3004
3004
  if (!permission) return [];
3005
3005
  const locations = [];
3006
- for (const action of Object.keys(permission)) permission[action]?.forEach((rule, index) => {
3006
+ for (const action of Object.keys(permission)) permission[action].forEach((rule, index) => {
3007
3007
  if (isObjectFormat(rule) && rule.permit === void 0) locations.push(`${String(action)}[${index}]`);
3008
3008
  });
3009
3009
  return locations;
@@ -4677,6 +4677,72 @@ async function ensureConfigId(configPath) {
4677
4677
  injected: true
4678
4678
  };
4679
4679
  }
4680
+ /**
4681
+ * Read the resolved `defineConfig({...})` `id` from a config file without
4682
+ * mutating it. Returns null when the file has no inline `defineConfig()` call
4683
+ * (wrapper/re-export config), and `{ id: null }` when the call exists but has
4684
+ * no usable `id` property.
4685
+ * @param configPath - Absolute path to the config file
4686
+ * @returns The existing id (or null when absent), or null for wrapper configs
4687
+ */
4688
+ async function readConfigId(configPath) {
4689
+ const { program } = parseSync(configPath, await fs$1.promises.readFile(configPath, "utf-8"));
4690
+ const calls = [];
4691
+ findDefineConfigCalls(program, calls);
4692
+ if (calls.length === 0) return null;
4693
+ if (calls.length > 1) throw new Error(`Multiple defineConfig() calls found in ${configPath}. Only one is supported.`);
4694
+ const { configObj } = assertDefined(calls[0], "defineConfig call site missing");
4695
+ if (!configObj) throw new Error(`defineConfig() argument must be an inline object literal in ${configPath} so the SDK can manage the 'id' field.`);
4696
+ const idProp = findIdProperty(configObj);
4697
+ if (!idProp || idProp.value.type !== "Literal") return { id: null };
4698
+ const value = idProp.value.value;
4699
+ return { id: typeof value === "string" && value !== "" ? value : null };
4700
+ }
4701
+ /**
4702
+ * Read-only CI check: the config must already carry a valid app id.
4703
+ * Wrapper/re-export configs (no inline defineConfig call) are exempt,
4704
+ * mirroring the local behavior where {@link ensureConfigId} no-ops.
4705
+ * @param configPath - Absolute path to the config file
4706
+ */
4707
+ async function assertConfigIdInCI(configPath) {
4708
+ const result = await readConfigId(configPath);
4709
+ if (result === null) return;
4710
+ if (!result.id) throw new Error("tailor.config.ts is missing an 'id'. CI does not auto-generate one (each run would be treated as a separate app and break resource ownership). Run 'tailor-sdk setup github' or 'tailor-sdk apply' locally and commit the injected id.");
4711
+ if (!uuidRegex.test(result.id)) throw new Error(`'id' in ${configPath} must be a UUID. To use this config for a separate app, delete it.`);
4712
+ }
4713
+ /**
4714
+ * Ensure the config has an app id for a deploy run.
4715
+ *
4716
+ * Locally, the id is auto-injected when missing (via {@link ensureConfigId}).
4717
+ * In CI, the id is never auto-injected — a missing id is a hard error, because
4718
+ * generating one per run would create a fresh app each time and break resource
4719
+ * ownership. CI dry-runs (plan) perform the same check read-only, so a
4720
+ * forgotten id fails at PR time instead of at deploy. Ephemeral pipelines that
4721
+ * intentionally deploy a fresh app per run (such as e2e harnesses) can opt
4722
+ * back into injection with `TAILOR_PLATFORM_SDK_ALLOW_CI_ID_INJECTION=true`.
4723
+ * Local dry-run and build-only flows skip both injection and the check (no
4724
+ * on-disk side effects are expected, and build-only never talks to the
4725
+ * platform).
4726
+ * @param obj - Inputs
4727
+ * @param obj.configPath - Absolute path to the config file
4728
+ * @param obj.dryRun - Whether this is a dry-run
4729
+ * @param obj.buildOnly - Whether this is a build-only run
4730
+ */
4731
+ async function ensureConfigIdForDeploy(obj) {
4732
+ const { configPath, dryRun, buildOnly } = obj;
4733
+ if (buildOnly) return;
4734
+ const allowCIInjection = parseBoolean(process.env.TAILOR_PLATFORM_SDK_ALLOW_CI_ID_INJECTION) === true;
4735
+ const strictCI = isCI && !allowCIInjection;
4736
+ if (dryRun) {
4737
+ if (strictCI) await assertConfigIdInCI(configPath);
4738
+ return;
4739
+ }
4740
+ if (strictCI) {
4741
+ await assertConfigIdInCI(configPath);
4742
+ return;
4743
+ }
4744
+ await ensureConfigId(configPath);
4745
+ }
4680
4746
  const idComment = "// SDK-managed app id — do not edit, except when copying this config to a separate app.";
4681
4747
  function insertIdProperty(source, configObj, id) {
4682
4748
  const idLiteral = `id: ${JSON.stringify(id)}`;
@@ -4684,6 +4750,7 @@ function insertIdProperty(source, configObj, id) {
4684
4750
  const firstProp = assertDefined(configObj.properties[0], "first property missing");
4685
4751
  const lineStart = source.lastIndexOf("\n", firstProp.start - 1) + 1;
4686
4752
  const indent = source.slice(lineStart, firstProp.start);
4753
+ if (!/^[\t ]*$/.test(indent)) return source.slice(0, firstProp.start) + `${idLiteral}, ` + source.slice(firstProp.start);
4687
4754
  const insertion = `${idComment}\n${indent}${idLiteral},\n${indent}`;
4688
4755
  return source.slice(0, firstProp.start) + insertion + source.slice(firstProp.start);
4689
4756
  }
@@ -6344,6 +6411,317 @@ function parseMigrationNumberArg(numberStr) {
6344
6411
  throw new Error(`Invalid migration number format: ${numberStr}. Expected 4-digit format (e.g., 0001) or integer 0-9999 (e.g., 1).`);
6345
6412
  }
6346
6413
 
6414
+ //#endregion
6415
+ //#region src/cli/commands/tailordb/migrate/snapshot-schema.ts
6416
+ /**
6417
+ * Zod schemas for TailorDB migration snapshot and diff files.
6418
+ *
6419
+ * Each schema mirrors the corresponding hand-written interface from
6420
+ * snapshot-types.ts / diff-calculator.ts. Schemas are cast to
6421
+ * `z.ZodType<T>` to keep them aligned with the interfaces at compile time.
6422
+ *
6423
+ * All object schemas use `z.looseObject` so that unknown keys written
6424
+ * by newer CLI versions survive a load → save round-trip.
6425
+ */
6426
+ const snapshotHookSchema = z.looseObject({ expr: z.string() });
6427
+ const snapshotValidationSchema = z.looseObject({
6428
+ script: z.looseObject({ expr: z.string() }).optional(),
6429
+ errorMessage: z.string()
6430
+ });
6431
+ const snapshotSerialSchema = z.looseObject({
6432
+ start: z.number(),
6433
+ maxValue: z.number().optional(),
6434
+ format: z.string().optional()
6435
+ });
6436
+ const snapshotEnumValueSchema = z.looseObject({
6437
+ value: z.string(),
6438
+ description: z.string().optional()
6439
+ });
6440
+ const snapshotFieldConfigSchema = z.looseObject({
6441
+ type: z.string(),
6442
+ required: z.boolean().default(true),
6443
+ array: z.boolean().optional(),
6444
+ index: z.boolean().optional(),
6445
+ unique: z.boolean().optional(),
6446
+ allowedValues: z.array(snapshotEnumValueSchema).optional(),
6447
+ foreignKey: z.boolean().optional(),
6448
+ foreignKeyType: z.string().optional(),
6449
+ foreignKeyField: z.string().optional(),
6450
+ description: z.string().optional(),
6451
+ vector: z.boolean().optional(),
6452
+ hooks: z.looseObject({
6453
+ create: snapshotHookSchema.optional(),
6454
+ update: snapshotHookSchema.optional()
6455
+ }).optional(),
6456
+ validate: z.array(snapshotValidationSchema).optional(),
6457
+ serial: snapshotSerialSchema.optional(),
6458
+ scale: z.number().optional(),
6459
+ fields: z.lazy(() => z.record(z.string(), snapshotFieldConfigSchema)).optional()
6460
+ });
6461
+ const snapshotIndexConfigSchema = z.looseObject({
6462
+ fields: z.array(z.string()),
6463
+ unique: z.boolean().optional()
6464
+ });
6465
+ const snapshotRelationshipSchema = z.looseObject({
6466
+ targetType: z.string(),
6467
+ targetField: z.string(),
6468
+ sourceField: z.string(),
6469
+ isArray: z.boolean(),
6470
+ description: z.string()
6471
+ });
6472
+ const FIELD_REF_KEYS = [
6473
+ "user",
6474
+ "record",
6475
+ "newRecord",
6476
+ "oldRecord"
6477
+ ];
6478
+ const snapshotPermissionOperandSchema = z.unknown().refine((v) => {
6479
+ if (typeof v !== "object" || v === null || Array.isArray(v)) return true;
6480
+ const keys = Object.keys(v);
6481
+ return FIELD_REF_KEYS.filter((k) => keys.includes(k)).length < 2;
6482
+ }, "Ambiguous field-ref operand: contains more than one of user/record/newRecord/oldRecord");
6483
+ const snapshotGqlPermissionOperandSchema = z.unknown().refine((v) => {
6484
+ if (typeof v !== "object" || v === null || Array.isArray(v)) return true;
6485
+ const keys = Object.keys(v);
6486
+ return FIELD_REF_KEYS.filter((k) => keys.includes(k)).length < 2;
6487
+ }, "Ambiguous field-ref operand: contains more than one of user/record/newRecord/oldRecord").refine((v) => {
6488
+ if (typeof v !== "object" || v === null || Array.isArray(v)) return true;
6489
+ const keys = Object.keys(v);
6490
+ return ![
6491
+ "record",
6492
+ "newRecord",
6493
+ "oldRecord"
6494
+ ].some((k) => keys.includes(k));
6495
+ }, "GQL permissions only support { user } field references");
6496
+ const snapshotPermissionOperatorSchema = z.string();
6497
+ const snapshotPermissionConditionSchema = z.tuple([
6498
+ snapshotPermissionOperandSchema,
6499
+ snapshotPermissionOperatorSchema,
6500
+ snapshotPermissionOperandSchema
6501
+ ]).rest(z.unknown());
6502
+ const snapshotGqlPermissionConditionSchema = z.tuple([
6503
+ snapshotGqlPermissionOperandSchema,
6504
+ snapshotPermissionOperatorSchema,
6505
+ snapshotGqlPermissionOperandSchema
6506
+ ]).rest(z.unknown());
6507
+ const snapshotActionPermissionSchema = z.looseObject({
6508
+ conditions: z.array(snapshotPermissionConditionSchema),
6509
+ description: z.string().optional(),
6510
+ permit: z.enum(["allow", "deny"])
6511
+ });
6512
+ const snapshotRecordPermissionSchema = z.looseObject({
6513
+ create: z.array(snapshotActionPermissionSchema).default([]),
6514
+ read: z.array(snapshotActionPermissionSchema).default([]),
6515
+ update: z.array(snapshotActionPermissionSchema).default([]),
6516
+ delete: z.array(snapshotActionPermissionSchema).default([])
6517
+ });
6518
+ const snapshotGqlActionSchema = z.string();
6519
+ const snapshotGqlPermissionPolicySchema = z.looseObject({
6520
+ conditions: z.array(snapshotGqlPermissionConditionSchema),
6521
+ actions: z.array(snapshotGqlActionSchema),
6522
+ permit: z.enum(["allow", "deny"]),
6523
+ description: z.string().optional()
6524
+ });
6525
+ const snapshotGqlPermissionSchema = z.array(snapshotGqlPermissionPolicySchema);
6526
+ const tailorDBSnapshotTypeSchema = z.looseObject({
6527
+ name: z.string(),
6528
+ pluralForm: z.string().optional(),
6529
+ description: z.string().optional(),
6530
+ fields: z.record(z.string(), snapshotFieldConfigSchema),
6531
+ settings: z.looseObject({
6532
+ aggregation: z.boolean().optional(),
6533
+ bulkUpsert: z.boolean().optional(),
6534
+ gqlOperations: z.looseObject({
6535
+ create: z.boolean().optional(),
6536
+ update: z.boolean().optional(),
6537
+ delete: z.boolean().optional(),
6538
+ read: z.boolean().optional()
6539
+ }).optional(),
6540
+ publishEvents: z.boolean().optional()
6541
+ }).optional(),
6542
+ indexes: z.record(z.string(), snapshotIndexConfigSchema).optional(),
6543
+ files: z.record(z.string(), z.string()).optional(),
6544
+ forwardRelationships: z.record(z.string(), snapshotRelationshipSchema).optional(),
6545
+ backwardRelationships: z.record(z.string(), snapshotRelationshipSchema).optional(),
6546
+ permissions: z.looseObject({
6547
+ record: snapshotRecordPermissionSchema.optional(),
6548
+ gql: snapshotGqlPermissionSchema.optional()
6549
+ }).optional()
6550
+ });
6551
+ const schemaSnapshotSchema = z.looseObject({
6552
+ version: z.number(),
6553
+ namespace: z.string(),
6554
+ createdAt: z.string(),
6555
+ types: z.record(z.string(), tailorDBSnapshotTypeSchema)
6556
+ });
6557
+ const typeSettingsPatchSchema = z.looseObject({
6558
+ indexes: z.record(z.string(), snapshotIndexConfigSchema).optional(),
6559
+ files: z.record(z.string(), z.string()).optional()
6560
+ });
6561
+ const snapshotPermissionStateSchema = z.looseObject({
6562
+ recordPermission: snapshotRecordPermissionSchema.optional(),
6563
+ gqlPermission: snapshotGqlPermissionSchema.optional()
6564
+ });
6565
+ const typeAddedChangeSchema = z.looseObject({
6566
+ kind: z.literal("type_added"),
6567
+ typeName: z.string(),
6568
+ reason: z.string().optional(),
6569
+ after: tailorDBSnapshotTypeSchema
6570
+ });
6571
+ const typeRemovedChangeSchema = z.looseObject({
6572
+ kind: z.literal("type_removed"),
6573
+ typeName: z.string(),
6574
+ reason: z.string().optional(),
6575
+ before: tailorDBSnapshotTypeSchema
6576
+ });
6577
+ const typeModifiedChangeSchema = z.looseObject({
6578
+ kind: z.literal("type_modified"),
6579
+ typeName: z.string(),
6580
+ reason: z.string().optional(),
6581
+ before: typeSettingsPatchSchema.optional(),
6582
+ after: typeSettingsPatchSchema.optional()
6583
+ });
6584
+ const fieldAddedChangeSchema = z.looseObject({
6585
+ kind: z.literal("field_added"),
6586
+ typeName: z.string(),
6587
+ reason: z.string().optional(),
6588
+ fieldName: z.string(),
6589
+ after: snapshotFieldConfigSchema
6590
+ });
6591
+ const fieldRemovedChangeSchema = z.looseObject({
6592
+ kind: z.literal("field_removed"),
6593
+ typeName: z.string(),
6594
+ reason: z.string().optional(),
6595
+ fieldName: z.string(),
6596
+ before: snapshotFieldConfigSchema
6597
+ });
6598
+ const fieldModifiedChangeSchema = z.looseObject({
6599
+ kind: z.literal("field_modified"),
6600
+ typeName: z.string(),
6601
+ reason: z.string().optional(),
6602
+ fieldName: z.string(),
6603
+ before: snapshotFieldConfigSchema,
6604
+ after: snapshotFieldConfigSchema
6605
+ });
6606
+ const indexAddedChangeSchema = z.looseObject({
6607
+ kind: z.literal("index_added"),
6608
+ typeName: z.string(),
6609
+ reason: z.string().optional(),
6610
+ indexName: z.string(),
6611
+ after: snapshotIndexConfigSchema
6612
+ });
6613
+ const indexRemovedChangeSchema = z.looseObject({
6614
+ kind: z.literal("index_removed"),
6615
+ typeName: z.string(),
6616
+ reason: z.string().optional(),
6617
+ indexName: z.string(),
6618
+ before: snapshotIndexConfigSchema
6619
+ });
6620
+ const indexModifiedChangeSchema = z.looseObject({
6621
+ kind: z.literal("index_modified"),
6622
+ typeName: z.string(),
6623
+ reason: z.string().optional(),
6624
+ indexName: z.string(),
6625
+ before: snapshotIndexConfigSchema,
6626
+ after: snapshotIndexConfigSchema
6627
+ });
6628
+ const fileAddedChangeSchema = z.looseObject({
6629
+ kind: z.literal("file_added"),
6630
+ typeName: z.string(),
6631
+ reason: z.string().optional(),
6632
+ fieldName: z.string(),
6633
+ after: z.string()
6634
+ });
6635
+ const fileRemovedChangeSchema = z.looseObject({
6636
+ kind: z.literal("file_removed"),
6637
+ typeName: z.string(),
6638
+ reason: z.string().optional(),
6639
+ fieldName: z.string(),
6640
+ before: z.string()
6641
+ });
6642
+ const fileModifiedChangeSchema = z.looseObject({
6643
+ kind: z.literal("file_modified"),
6644
+ typeName: z.string(),
6645
+ reason: z.string().optional(),
6646
+ fieldName: z.string(),
6647
+ before: z.string(),
6648
+ after: z.string()
6649
+ });
6650
+ const relationshipAddedChangeSchema = z.looseObject({
6651
+ kind: z.literal("relationship_added"),
6652
+ typeName: z.string(),
6653
+ reason: z.string().optional(),
6654
+ relationshipName: z.string(),
6655
+ relationshipType: z.enum(["forward", "backward"]).optional(),
6656
+ after: snapshotRelationshipSchema
6657
+ });
6658
+ const relationshipRemovedChangeSchema = z.looseObject({
6659
+ kind: z.literal("relationship_removed"),
6660
+ typeName: z.string(),
6661
+ reason: z.string().optional(),
6662
+ relationshipName: z.string(),
6663
+ relationshipType: z.enum(["forward", "backward"]).optional(),
6664
+ before: snapshotRelationshipSchema
6665
+ });
6666
+ const relationshipModifiedChangeSchema = z.looseObject({
6667
+ kind: z.literal("relationship_modified"),
6668
+ typeName: z.string(),
6669
+ reason: z.string().optional(),
6670
+ relationshipName: z.string(),
6671
+ relationshipType: z.enum(["forward", "backward"]).optional(),
6672
+ before: snapshotRelationshipSchema,
6673
+ after: snapshotRelationshipSchema
6674
+ });
6675
+ const permissionModifiedChangeSchema = z.looseObject({
6676
+ kind: z.literal("permission_modified"),
6677
+ typeName: z.string(),
6678
+ reason: z.string().optional(),
6679
+ before: snapshotPermissionStateSchema.optional(),
6680
+ after: snapshotPermissionStateSchema.optional()
6681
+ });
6682
+ const diffChangeSchema = z.discriminatedUnion("kind", [
6683
+ typeAddedChangeSchema,
6684
+ typeRemovedChangeSchema,
6685
+ typeModifiedChangeSchema,
6686
+ fieldAddedChangeSchema,
6687
+ fieldRemovedChangeSchema,
6688
+ fieldModifiedChangeSchema,
6689
+ indexAddedChangeSchema,
6690
+ indexRemovedChangeSchema,
6691
+ indexModifiedChangeSchema,
6692
+ fileAddedChangeSchema,
6693
+ fileRemovedChangeSchema,
6694
+ fileModifiedChangeSchema,
6695
+ relationshipAddedChangeSchema,
6696
+ relationshipRemovedChangeSchema,
6697
+ relationshipModifiedChangeSchema,
6698
+ permissionModifiedChangeSchema
6699
+ ]);
6700
+ const breakingChangeInfoSchema = z.looseObject({
6701
+ typeName: z.string(),
6702
+ fieldName: z.string().optional(),
6703
+ reason: z.string(),
6704
+ unsupported: z.boolean().optional(),
6705
+ showThreeStepHint: z.boolean().optional()
6706
+ });
6707
+ const warningChangeInfoSchema = z.looseObject({
6708
+ typeName: z.string(),
6709
+ fieldName: z.string().optional(),
6710
+ reason: z.string()
6711
+ });
6712
+ const migrationDiffSchema = z.looseObject({
6713
+ version: z.number(),
6714
+ namespace: z.string(),
6715
+ createdAt: z.string(),
6716
+ description: z.string().optional(),
6717
+ changes: z.array(diffChangeSchema),
6718
+ hasBreakingChanges: z.boolean(),
6719
+ breakingChanges: z.array(breakingChangeInfoSchema),
6720
+ hasWarnings: z.boolean().optional(),
6721
+ warnings: z.array(warningChangeInfoSchema).optional(),
6722
+ requiresMigrationScript: z.boolean()
6723
+ });
6724
+
6347
6725
  //#endregion
6348
6726
  //#region src/cli/commands/tailordb/migrate/snapshot-types.ts
6349
6727
  /**
@@ -6553,21 +6931,19 @@ function createSnapshotType(type) {
6553
6931
  fields
6554
6932
  };
6555
6933
  if (type.description) snapshotType.description = type.description;
6556
- if (type.settings) {
6557
- snapshotType.settings = {};
6558
- if (type.settings.aggregation !== void 0) snapshotType.settings.aggregation = type.settings.aggregation;
6559
- if (type.settings.bulkUpsert !== void 0) snapshotType.settings.bulkUpsert = type.settings.bulkUpsert;
6560
- if (type.settings.gqlOperations) {
6561
- const ops = type.settings.gqlOperations;
6562
- snapshotType.settings.gqlOperations = {
6563
- ...ops.create !== void 0 && { create: ops.create },
6564
- ...ops.update !== void 0 && { update: ops.update },
6565
- ...ops.delete !== void 0 && { delete: ops.delete },
6566
- ...ops.read !== void 0 && { read: ops.read }
6567
- };
6568
- }
6569
- if (type.settings.publishEvents !== void 0) snapshotType.settings.publishEvents = type.settings.publishEvents;
6934
+ snapshotType.settings = {};
6935
+ if (type.settings.aggregation !== void 0) snapshotType.settings.aggregation = type.settings.aggregation;
6936
+ if (type.settings.bulkUpsert !== void 0) snapshotType.settings.bulkUpsert = type.settings.bulkUpsert;
6937
+ if (type.settings.gqlOperations) {
6938
+ const ops = type.settings.gqlOperations;
6939
+ snapshotType.settings.gqlOperations = {
6940
+ ...ops.create !== void 0 && { create: ops.create },
6941
+ ...ops.update !== void 0 && { update: ops.update },
6942
+ ...ops.delete !== void 0 && { delete: ops.delete },
6943
+ ...ops.read !== void 0 && { read: ops.read }
6944
+ };
6570
6945
  }
6946
+ if (type.settings.publishEvents !== void 0) snapshotType.settings.publishEvents = type.settings.publishEvents;
6571
6947
  if (type.indexes && Object.keys(type.indexes).length > 0) {
6572
6948
  snapshotType.indexes = {};
6573
6949
  for (const [indexName, indexConfig] of Object.entries(type.indexes)) snapshotType.indexes[indexName] = {
@@ -6648,7 +7024,15 @@ function createSnapshotFromLocalTypes(types, namespace) {
6648
7024
  */
6649
7025
  function loadSnapshot(filePath) {
6650
7026
  const content = fs$1.readFileSync(filePath, "utf-8");
6651
- const snapshot = JSON.parse(content);
7027
+ let raw;
7028
+ try {
7029
+ raw = JSON.parse(content);
7030
+ } catch (error) {
7031
+ throw new Error(`Invalid schema snapshot at ${filePath}: ${String(error)}`, { cause: error });
7032
+ }
7033
+ const result = schemaSnapshotSchema.safeParse(raw);
7034
+ if (!result.success) throw new Error(`Invalid schema snapshot at ${filePath}: ${z.prettifyError(result.error)}`, { cause: result.error });
7035
+ const snapshot = result.data;
6652
7036
  for (const type of Object.values(snapshot.types)) normalizeSnapshotType(type);
6653
7037
  return snapshot;
6654
7038
  }
@@ -6659,7 +7043,15 @@ function loadSnapshot(filePath) {
6659
7043
  */
6660
7044
  function loadDiff(filePath) {
6661
7045
  const content = fs$1.readFileSync(filePath, "utf-8");
6662
- const parsed = JSON.parse(content);
7046
+ let raw;
7047
+ try {
7048
+ raw = JSON.parse(content);
7049
+ } catch (error) {
7050
+ throw new Error(`Invalid migration diff at ${filePath}: ${String(error)}`, { cause: error });
7051
+ }
7052
+ const result = migrationDiffSchema.safeParse(raw);
7053
+ if (!result.success) throw new Error(`Invalid migration diff at ${filePath}: ${z.prettifyError(result.error)}`, { cause: result.error });
7054
+ const parsed = result.data;
6663
7055
  const warnings = parsed.warnings ?? [];
6664
7056
  return {
6665
7057
  ...parsed,
@@ -6737,7 +7129,7 @@ function applyDiffToSnapshot(snapshot, diff) {
6737
7129
  case "field_added":
6738
7130
  case "field_modified": {
6739
7131
  const existing = types[change.typeName];
6740
- if (existing && change.fieldName) types[change.typeName] = {
7132
+ if (existing) types[change.typeName] = {
6741
7133
  ...existing,
6742
7134
  fields: {
6743
7135
  ...existing.fields,
@@ -6748,7 +7140,7 @@ function applyDiffToSnapshot(snapshot, diff) {
6748
7140
  }
6749
7141
  case "field_removed": {
6750
7142
  const existing = types[change.typeName];
6751
- if (existing && change.fieldName) {
7143
+ if (existing) {
6752
7144
  const { [change.fieldName]: _, ...remainingFields } = existing.fields;
6753
7145
  types[change.typeName] = {
6754
7146
  ...existing,
@@ -6760,7 +7152,7 @@ function applyDiffToSnapshot(snapshot, diff) {
6760
7152
  case "index_added":
6761
7153
  case "index_modified": {
6762
7154
  const existing = types[change.typeName];
6763
- if (existing && change.indexName) types[change.typeName] = {
7155
+ if (existing) types[change.typeName] = {
6764
7156
  ...existing,
6765
7157
  indexes: {
6766
7158
  ...existing.indexes,
@@ -6771,7 +7163,7 @@ function applyDiffToSnapshot(snapshot, diff) {
6771
7163
  }
6772
7164
  case "index_removed": {
6773
7165
  const existing = types[change.typeName];
6774
- if (existing && change.indexName && existing.indexes) {
7166
+ if (existing && existing.indexes) {
6775
7167
  const { [change.indexName]: _, ...remainingIndexes } = existing.indexes;
6776
7168
  types[change.typeName] = {
6777
7169
  ...existing,
@@ -6783,7 +7175,7 @@ function applyDiffToSnapshot(snapshot, diff) {
6783
7175
  case "file_added":
6784
7176
  case "file_modified": {
6785
7177
  const existing = types[change.typeName];
6786
- if (existing && change.fieldName) types[change.typeName] = {
7178
+ if (existing) types[change.typeName] = {
6787
7179
  ...existing,
6788
7180
  files: {
6789
7181
  ...existing.files,
@@ -6794,7 +7186,7 @@ function applyDiffToSnapshot(snapshot, diff) {
6794
7186
  }
6795
7187
  case "file_removed": {
6796
7188
  const existing = types[change.typeName];
6797
- if (existing && change.fieldName && existing.files) {
7189
+ if (existing && existing.files) {
6798
7190
  const { [change.fieldName]: _, ...remainingFiles } = existing.files;
6799
7191
  types[change.typeName] = {
6800
7192
  ...existing,
@@ -6806,7 +7198,7 @@ function applyDiffToSnapshot(snapshot, diff) {
6806
7198
  case "relationship_added":
6807
7199
  case "relationship_modified": {
6808
7200
  const existing = types[change.typeName];
6809
- if (existing && change.relationshipName) {
7201
+ if (existing) {
6810
7202
  const rel = change.after;
6811
7203
  if ((change.relationshipType ?? (existing.forwardRelationships?.[change.relationshipName] ? "forward" : existing.backwardRelationships?.[change.relationshipName] ? "backward" : "forward")) === "forward") types[change.typeName] = {
6812
7204
  ...existing,
@@ -6827,7 +7219,7 @@ function applyDiffToSnapshot(snapshot, diff) {
6827
7219
  }
6828
7220
  case "relationship_removed": {
6829
7221
  const type = types[change.typeName];
6830
- if (type && change.relationshipName) {
7222
+ if (type) {
6831
7223
  const targetType = change.relationshipType ?? (type.forwardRelationships?.[change.relationshipName] ? "forward" : type.backwardRelationships?.[change.relationshipName] ? "backward" : null);
6832
7224
  if (targetType === "forward" && type.forwardRelationships?.[change.relationshipName]) {
6833
7225
  const { [change.relationshipName]: _, ...remaining } = type.forwardRelationships;
@@ -6937,7 +7329,7 @@ function areFieldsDifferent(oldField, newField) {
6937
7329
  for (let i = 0; i < oldValidate.length; i++) {
6938
7330
  const oldV = assertDefined(oldValidate[i], `oldValidate missing index ${i}`);
6939
7331
  const newV = assertDefined(newValidate[i], `newValidate missing index ${i}`);
6940
- if (oldV.script.expr !== newV.script.expr) return true;
7332
+ if ((oldV.script?.expr ?? "") !== (newV.script?.expr ?? "")) return true;
6941
7333
  if (oldV.errorMessage !== newV.errorMessage) return true;
6942
7334
  }
6943
7335
  const oldSerial = oldField.serial;
@@ -7385,7 +7777,7 @@ function convertRemoteFieldsToSnapshot(remoteType) {
7385
7777
  if (remoteField.foreignKeyType) config.foreignKeyType = remoteField.foreignKeyType;
7386
7778
  if (remoteField.foreignKeyField) config.foreignKeyField = remoteField.foreignKeyField;
7387
7779
  }
7388
- if (remoteField.allowedValues && remoteField.allowedValues.length > 0) config.allowedValues = remoteField.allowedValues.map((v) => ({
7780
+ if (remoteField.allowedValues.length > 0) config.allowedValues = remoteField.allowedValues.map((v) => ({
7389
7781
  value: v.value,
7390
7782
  ...v.description && { description: v.description }
7391
7783
  }));
@@ -7396,7 +7788,7 @@ function convertRemoteFieldsToSnapshot(remoteType) {
7396
7788
  if (remoteField.hooks.create?.expr) config.hooks.create = { expr: remoteField.hooks.create.expr };
7397
7789
  if (remoteField.hooks.update?.expr) config.hooks.update = { expr: remoteField.hooks.update.expr };
7398
7790
  }
7399
- if (remoteField.validate && remoteField.validate.length > 0) config.validate = remoteField.validate.map((v) => ({
7791
+ if (remoteField.validate.length > 0) config.validate = remoteField.validate.map((v) => ({
7400
7792
  script: { expr: v.script?.expr ?? "" },
7401
7793
  errorMessage: v.errorMessage ?? ""
7402
7794
  }));
@@ -7620,7 +8012,7 @@ function convertFieldConfigToProto(config) {
7620
8012
  foreignKey: config.foreignKey ?? false,
7621
8013
  foreignKeyType: config.foreignKeyType,
7622
8014
  foreignKeyField: config.foreignKeyField,
7623
- required: config.required ?? true,
8015
+ required: config.required,
7624
8016
  vector: config.vector ?? false,
7625
8017
  ...toProtoSnapshotFieldHooks(config),
7626
8018
  ...config.serial && { serial: {
@@ -7637,7 +8029,7 @@ function toProtoSnapshotFieldValidate(config) {
7637
8029
  return (config.validate ?? []).map((val) => ({
7638
8030
  action: TailorDBType_PermitAction.DENY,
7639
8031
  errorMessage: val.errorMessage || "",
7640
- ...val.script && { script: { expr: val.script.expr ? `!${val.script.expr}` : "" } }
8032
+ script: { expr: val.script && val.script.expr ? `!${val.script.expr}` : "" }
7641
8033
  }));
7642
8034
  }
7643
8035
  function toProtoSnapshotFieldHooks(config) {
@@ -7661,7 +8053,7 @@ function processNestedFieldsFromSnapshot(fields) {
7661
8053
  allowedValues: fieldConfig.allowedValues?.map((v) => ({ ...v })) ?? [],
7662
8054
  description: fieldConfig.description || "",
7663
8055
  validate: toProtoSnapshotFieldValidate(fieldConfig),
7664
- required: fieldConfig.required ?? true,
8056
+ required: fieldConfig.required,
7665
8057
  array: fieldConfig.array ?? false,
7666
8058
  index: false,
7667
8059
  unique: false,
@@ -7676,7 +8068,7 @@ function processNestedFieldsFromSnapshot(fields) {
7676
8068
  allowedValues: fieldConfig.type === "enum" ? fieldConfig.allowedValues?.map((v) => ({ ...v })) ?? [] : [],
7677
8069
  description: fieldConfig.description || "",
7678
8070
  validate: toProtoSnapshotFieldValidate(fieldConfig),
7679
- required: fieldConfig.required ?? true,
8071
+ required: fieldConfig.required,
7680
8072
  array: fieldConfig.array ?? false,
7681
8073
  index: false,
7682
8074
  unique: false,
@@ -8037,19 +8429,19 @@ function buildPreMigrationChangesMap(pendingMigrations) {
8037
8429
  function applyPreMigrationFieldAdjustments(fields, typeChanges) {
8038
8430
  for (const [fieldName, change] of typeChanges) {
8039
8431
  if (change.kind === "field_removed") {
8040
- if (change.before) fields[fieldName] = convertFieldConfigToProto(change.before);
8432
+ fields[fieldName] = convertFieldConfigToProto(change.before);
8041
8433
  continue;
8042
8434
  }
8043
8435
  const field = fields[fieldName];
8044
8436
  if (!field) continue;
8045
8437
  if (change.kind === "field_added") {
8046
- if (change.after?.required) field.required = false;
8438
+ if (change.after.required) field.required = false;
8047
8439
  continue;
8048
8440
  }
8049
8441
  const { before, after } = change;
8050
- if (!before?.required && after?.required) field.required = false;
8051
- if (!(before?.unique ?? false) && (after?.unique ?? false)) field.unique = false;
8052
- if (before?.allowedValues && after?.allowedValues) {
8442
+ if (!before.required && after.required) field.required = false;
8443
+ if (!(before.unique ?? false) && (after.unique ?? false)) field.unique = false;
8444
+ if (before.allowedValues && after.allowedValues) {
8053
8445
  const afterValues = new Set(after.allowedValues.map((v) => v.value));
8054
8446
  if (before.allowedValues.filter((v) => !afterValues.has(v.value)).length > 0) {
8055
8447
  const valueMap = /* @__PURE__ */ new Map();
@@ -8818,8 +9210,17 @@ async function applyTailorDB(client, result, phase = "create-update") {
8818
9210
  logger.newline();
8819
9211
  }
8820
9212
  for (const migration of pendingMigrations) {
8821
- await executeSingleMigrationPrePhase(client, changeSet, migration, migrationContext.tailorDBInputs, migrationContext.executorUsedTypes);
8822
- if (migration.hasScript && migrationCtx) await executeMigrations(migrationCtx, [migration]);
9213
+ try {
9214
+ await executeSingleMigrationPrePhase(client, changeSet, migration, migrationContext.tailorDBInputs, migrationContext.executorUsedTypes);
9215
+ if (migration.hasScript && migrationCtx) await executeMigrations(migrationCtx, [migration]);
9216
+ } catch (error) {
9217
+ try {
9218
+ await rollbackSingleMigrationPrePhase(client, changeSet, migration, migrationContext.workspaceId, migrationContext.tailorDBInputs, migrationContext.executorUsedTypes);
9219
+ } catch (rollbackError) {
9220
+ logger.warn(`Failed to roll back migration ${migration.namespace}/${formatMigrationNumber(migration.number)}: ${rollbackError instanceof Error ? rollbackError.message : String(rollbackError)}`);
9221
+ }
9222
+ throw error;
9223
+ }
8823
9224
  await executeSingleMigrationPostPhase(client, changeSet, migration, migrationContext.tailorDBInputs, migrationContext.executorUsedTypes);
8824
9225
  await updateMigrationLabel(client, migrationContext.workspaceId, migration.namespace, migration.number);
8825
9226
  }
@@ -8940,6 +9341,17 @@ function buildSnapshotTypeManifest(migration, typeName, tailorDBInputs, executor
8940
9341
  });
8941
9342
  }
8942
9343
  /**
9344
+ * Await every promise to settle, then throw the first rejection. Unlike
9345
+ * `Promise.all`, this never leaves sibling operations in flight after a failure,
9346
+ * so a following rollback cannot race with still-pending DDL.
9347
+ * @param promises - Promises (or already-resolved values) to await
9348
+ * @returns {Promise<void>} Resolves once all settle; rejects with the first failure
9349
+ */
9350
+ async function awaitAllSettledOrThrow(promises) {
9351
+ const rejected = (await Promise.allSettled(promises)).find((r) => r.status === "rejected");
9352
+ if (rejected) throw rejected.reason;
9353
+ }
9354
+ /**
8943
9355
  * Execute pre-migration phase for a single migration
8944
9356
  * @param {OperatorClient} client - Operator client instance
8945
9357
  * @param {TailorDBChangeSet} changeSet - TailorDB change set
@@ -8952,7 +9364,7 @@ async function executeSingleMigrationPrePhase(client, changeSet, migration, tail
8952
9364
  const preMigrationChanges = buildPreMigrationChangesMap([migration]);
8953
9365
  const affectedTypes = getAffectedTypeNames(migration);
8954
9366
  const createdBeforeMigration = new Set(processedTypes.created);
8955
- await Promise.all([
9367
+ await awaitAllSettledOrThrow([
8956
9368
  ...changeSet.type.creates.filter((create) => {
8957
9369
  const typeName = create.request.tailordbType?.name;
8958
9370
  return typeName && affectedTypes.has(typeName) && !createdBeforeMigration.has(typeName);
@@ -9007,13 +9419,13 @@ async function executeSingleMigrationPrePhase(client, changeSet, migration, tail
9007
9419
  const typeName = create.request.tailordbType?.name;
9008
9420
  return create.request.namespaceName === migration.namespace && typeName && gqlPermissionTypeNames.has(typeName) && !processedTypes.created.has(typeName);
9009
9421
  });
9010
- if (missingTypeCreates.length > 0) await Promise.all(missingTypeCreates.map((create) => {
9422
+ if (missingTypeCreates.length > 0) await awaitAllSettledOrThrow(missingTypeCreates.map((create) => {
9011
9423
  const typeName = create.request.tailordbType?.name;
9012
9424
  if (typeName) processedTypes.created.add(typeName);
9013
9425
  return client.createTailorDBType(create.request);
9014
9426
  }));
9015
9427
  processedTypes.gqlPermissionsProcessed.add(migration.namespace);
9016
- await Promise.all([...gqlPermissionCreatesForNamespace.map((create) => client.createTailorDBGQLPermission(create.request)), ...gqlPermissionUpdatesForNamespace.map((update) => client.updateTailorDBGQLPermission(update.request))]);
9428
+ await awaitAllSettledOrThrow([...gqlPermissionCreatesForNamespace.map((create) => client.createTailorDBGQLPermission(create.request)), ...gqlPermissionUpdatesForNamespace.map((update) => client.updateTailorDBGQLPermission(update.request))]);
9017
9429
  }
9018
9430
  }
9019
9431
  /**
@@ -9094,6 +9506,67 @@ async function executeSingleMigrationPostPhase(client, changeSet, migration, tai
9094
9506
  }
9095
9507
  }
9096
9508
  /**
9509
+ * Revert a single migration's Pre-phase DDL to the prior checkpoint's schema.
9510
+ * @param client - Operator client instance
9511
+ * @param changeSet - TailorDB change set
9512
+ * @param migration - The migration whose Pre-phase DDL must be reverted
9513
+ * @param workspaceId - Workspace ID
9514
+ * @param tailorDBInputs - Deploy inputs, used to resolve namespace gqlOperations for the snapshot
9515
+ * @param executorUsedTypes - Types used by executors (drives publishRecordEvents default)
9516
+ * @returns {Promise<void>} Promise that resolves when rollback attempts complete
9517
+ */
9518
+ async function rollbackSingleMigrationPrePhase(client, changeSet, migration, workspaceId, tailorDBInputs, executorUsedTypes) {
9519
+ if (migration.number <= 0) return;
9520
+ const namespaceTypes = getAffectedTypeNames(migration);
9521
+ for (const create of changeSet.type.creates) {
9522
+ const name = create.request.tailordbType?.name;
9523
+ if (create.request.namespaceName === migration.namespace && name) namespaceTypes.add(name);
9524
+ }
9525
+ for (const update of changeSet.type.updates) {
9526
+ const name = update.request.tailordbType?.name;
9527
+ if (update.request.namespaceName === migration.namespace && name) namespaceTypes.add(name);
9528
+ }
9529
+ const applied = new Set([...processedTypes.created, ...processedTypes.updated]);
9530
+ const rollbackTypes = new Set([...namespaceTypes].filter((name) => applied.has(name)));
9531
+ if (rollbackTypes.size === 0) return;
9532
+ const priorSnapshot = reconstructSnapshotFromMigrations(migration.migrationsDir, migration.number - 1);
9533
+ if (!priorSnapshot) {
9534
+ logger.warn(`Cannot roll back migration ${migration.namespace}/${formatMigrationNumber(migration.number)}: prior snapshot (migration ${formatMigrationNumber(migration.number - 1)}) could not be reconstructed. Leaving schema as-is; manual repair may be required.`);
9535
+ return;
9536
+ }
9537
+ const input = tailorDBInputs.find((i) => i.namespace === migration.namespace);
9538
+ logger.warn(`Migration ${migration.namespace}/${formatMigrationNumber(migration.number)} failed; rolling back its pre-migration schema changes.`);
9539
+ for (const typeName of rollbackTypes) {
9540
+ const priorType = priorSnapshot.types[typeName];
9541
+ try {
9542
+ if (priorType) {
9543
+ const manifest = generateTailorDBTypeManifestFromSnapshot(priorType, {
9544
+ publishRecordEvents: executorUsedTypes.has(priorType.name),
9545
+ namespaceGqlOperations: input?.config.gqlOperations
9546
+ });
9547
+ await client.updateTailorDBType({
9548
+ workspaceId,
9549
+ namespaceName: migration.namespace,
9550
+ tailordbType: manifest
9551
+ });
9552
+ } else {
9553
+ await client.deleteTailorDBGQLPermission({
9554
+ workspaceId,
9555
+ namespaceName: migration.namespace,
9556
+ typeName
9557
+ }).catch(() => void 0);
9558
+ await client.deleteTailorDBType({
9559
+ workspaceId,
9560
+ namespaceName: migration.namespace,
9561
+ tailordbTypeName: typeName
9562
+ });
9563
+ }
9564
+ } catch (rollbackError) {
9565
+ logger.warn(`Failed to roll back type '${typeName}' in namespace '${migration.namespace}': ${rollbackError instanceof Error ? rollbackError.message : String(rollbackError)}`);
9566
+ }
9567
+ }
9568
+ }
9569
+ /**
9097
9570
  * Convert a runtime TailorDBService to the snapshot-shaped deploy input.
9098
9571
  * @param service - Loaded TailorDB service (after `loadTypes()`)
9099
9572
  * @returns The canonical snapshot-shaped deploy input for downstream plan/apply phases.
@@ -9512,17 +9985,7 @@ async function checkMigrationDiffs(typesByNamespace, namespacesWithMigrations) {
9512
9985
  for (const { namespace, migrationsDir } of namespacesWithMigrations) {
9513
9986
  const localTypes = typesByNamespace.get(namespace);
9514
9987
  if (!localTypes) continue;
9515
- let previousSnapshot;
9516
- try {
9517
- previousSnapshot = reconstructSnapshotFromMigrations(migrationsDir);
9518
- } catch {
9519
- results.push({
9520
- namespace,
9521
- migrationsDir,
9522
- hasDiff: false
9523
- });
9524
- continue;
9525
- }
9988
+ const previousSnapshot = reconstructSnapshotFromMigrations(migrationsDir);
9526
9989
  if (!previousSnapshot) {
9527
9990
  results.push({
9528
9991
  namespace,
@@ -9610,7 +10073,7 @@ async function applyWorkflow(client, result, phase = "create-update") {
9610
10073
  workflowId: del.workflowId
9611
10074
  })
9612
10075
  })));
9613
- await deleteAllSettled((result.jobFunctionDeletes ?? collectDeletableJobFunctions(changeSet.deletes)).map((del) => ({
10076
+ await deleteAllSettled(result.jobFunctionDeletes.map((del) => ({
9614
10077
  resourceType: "workflow job function",
9615
10078
  resourceName: del.jobFunctionName,
9616
10079
  run: () => client.deleteWorkflowJobFunction({
@@ -9637,20 +10100,6 @@ async function deleteAllSettled(operations) {
9637
10100
  const firstError = errors[0];
9638
10101
  if (firstError) throw firstError;
9639
10102
  }
9640
- function collectDeletableJobFunctions(deletes) {
9641
- const seen = /* @__PURE__ */ new Set();
9642
- const jobFunctions = [];
9643
- for (const del of deletes) for (const jobFunctionName of del.deletableJobNames) {
9644
- const key = `${del.workspaceId}\0${jobFunctionName}`;
9645
- if (seen.has(key)) continue;
9646
- seen.add(key);
9647
- jobFunctions.push({
9648
- workspaceId: del.workspaceId,
9649
- jobFunctionName
9650
- });
9651
- }
9652
- return jobFunctions;
9653
- }
9654
10103
  /**
9655
10104
  * Filter job function versions to only include those used by a workflow
9656
10105
  * @param allVersions - Map of job function names to versions
@@ -10195,7 +10644,7 @@ async function shouldForceApplyAll(client, workspaceId, application, functionEnt
10195
10644
  });
10196
10645
  for (const trn of candidateTrns) try {
10197
10646
  const { metadata } = await client.getMetadata({ trn });
10198
- if (metadata?.labels?.["sdk-name"] !== application.name) continue;
10647
+ if (metadata?.labels["sdk-name"] !== application.name) continue;
10199
10648
  if (!hasMatchingSdkVersion(metadata.labels, desiredLabels)) return true;
10200
10649
  } catch (error) {
10201
10650
  if (error instanceof ConnectError && error.code === Code.NotFound) continue;
@@ -10322,9 +10771,13 @@ async function deploy(options) {
10322
10771
  const buildOnly = options?.buildOnly ?? parseBoolean(process.env.TAILOR_PLATFORM_SDK_BUILD_ONLY) === true;
10323
10772
  const { config, plugins } = await withSpan("build.loadConfig", async () => {
10324
10773
  const foundPath = loadConfigPath(options?.configPath);
10325
- if (foundPath && !dryRun && !buildOnly) {
10774
+ if (foundPath) {
10326
10775
  const resolvedPath = path.resolve(process.cwd(), foundPath);
10327
- if (fs$1.existsSync(resolvedPath)) await ensureConfigId(resolvedPath);
10776
+ if (fs$1.existsSync(resolvedPath)) await ensureConfigIdForDeploy({
10777
+ configPath: resolvedPath,
10778
+ dryRun,
10779
+ buildOnly
10780
+ });
10328
10781
  }
10329
10782
  return loadConfig(options?.configPath);
10330
10783
  });
@@ -10732,7 +11185,7 @@ function formatSubjectEvent(subject, eventTypes) {
10732
11185
  }
10733
11186
  function formatTypedEventTrigger(config) {
10734
11187
  const typedConfig = config.typedConfig;
10735
- if (!typedConfig || typedConfig.case === void 0) return null;
11188
+ if (typedConfig.case === void 0) return null;
10736
11189
  switch (typedConfig.case) {
10737
11190
  case "tailordb": return formatSubjectEvent(typedConfig.value.typeName, typedConfig.value.eventTypes);
10738
11191
  case "pipeline": return formatSubjectEvent(typedConfig.value.resolverName, typedConfig.value.eventTypes);
@@ -10804,7 +11257,7 @@ function formatTriggerConfig(executor) {
10804
11257
  }
10805
11258
  function formatEventTriggerConfig(config) {
10806
11259
  const typedConfig = config.typedConfig;
10807
- if (!typedConfig || typedConfig.case === void 0) return {
11260
+ if (typedConfig.case === void 0) return {
10808
11261
  eventType: config.eventType,
10809
11262
  condition: config.condition?.expr || ""
10810
11263
  };
@@ -11516,6 +11969,11 @@ async function startWorkflowCore(options) {
11516
11969
  }
11517
11970
  }
11518
11971
  async function startWorkflowByName(options) {
11972
+ const machineUser = await loadMachineUserName({
11973
+ machineUser: options.machineUser,
11974
+ profile: options.profile
11975
+ });
11976
+ if (!machineUser) throw new Error("Machine user is required. Specify --machine-user, set TAILOR_PLATFORM_MACHINE_USER_NAME, or set a profile default with 'tailor-sdk profile update <profile> --machine-user <name>'.");
11519
11977
  const client = await initOperatorClient(await loadAccessToken({ profile: options.profile }));
11520
11978
  const workspaceId = await loadWorkspaceId({
11521
11979
  workspaceId: options.workspaceId,
@@ -11533,7 +11991,7 @@ async function startWorkflowByName(options) {
11533
11991
  workflowName: options.name,
11534
11992
  authInvoker: {
11535
11993
  namespace: application.authNamespace,
11536
- machineUserName: options.machineUser
11994
+ machineUserName: machineUser
11537
11995
  },
11538
11996
  arg: options.arg,
11539
11997
  interval: options.interval
@@ -11559,10 +12017,10 @@ const startCommand = defineAppCommand({
11559
12017
  args: z.object({
11560
12018
  ...deploymentArgs,
11561
12019
  ...nameArgs,
11562
- "machine-user": arg(z.string(), {
12020
+ "machine-user": arg(z.string().optional(), {
11563
12021
  alias: "m",
11564
12022
  hiddenAlias: "machineuser",
11565
- description: "Machine user name",
12023
+ description: "Machine user name. Falls back to the active profile's default machine user.",
11566
12024
  env: "TAILOR_PLATFORM_MACHINE_USER_NAME"
11567
12025
  }),
11568
12026
  arg: arg(z.string().optional(), {
@@ -13387,6 +13845,11 @@ const listCommand$7 = defineAppCommand({
13387
13845
  * @returns Machine user token info
13388
13846
  */
13389
13847
  async function getMachineUserToken(options) {
13848
+ const name = await loadMachineUserName({
13849
+ machineUser: options.name,
13850
+ profile: options.profile
13851
+ });
13852
+ if (!name) throw new Error("Machine user is required. Provide the NAME positional argument, set TAILOR_PLATFORM_MACHINE_USER_NAME, or set a profile default with 'tailor-sdk profile update <profile> --machine-user <name>'.");
13390
13853
  const client = await initOperatorClient(await loadAccessToken({ profile: options.profile }));
13391
13854
  const workspaceId = await loadWorkspaceId({
13392
13855
  workspaceId: options.workspaceId,
@@ -13401,9 +13864,9 @@ async function getMachineUserToken(options) {
13401
13864
  const { machineUser } = await client.getAuthMachineUser({
13402
13865
  workspaceId,
13403
13866
  authNamespace: application.authNamespace,
13404
- name: options.name
13867
+ name
13405
13868
  });
13406
- if (!machineUser) throw new Error(`Machine user ${options.name} not found.`);
13869
+ if (!machineUser) throw new Error(`Machine user ${name} not found.`);
13407
13870
  const resp = await fetchMachineUserToken(application.url, machineUser.clientId, machineUser.clientSecret);
13408
13871
  const expiresAt = /* @__PURE__ */ new Date();
13409
13872
  expiresAt.setSeconds(expiresAt.getSeconds() + resp.expires_in);
@@ -13418,9 +13881,10 @@ const tokenCommand = defineAppCommand({
13418
13881
  description: "Get an access token for a machine user.",
13419
13882
  args: z.object({
13420
13883
  ...deploymentArgs,
13421
- name: arg(z.string(), {
13884
+ name: arg(z.string().optional(), {
13422
13885
  positional: true,
13423
- description: "Machine user name"
13886
+ description: "Machine user name. Falls back to the active profile's default machine user.",
13887
+ env: "TAILOR_PLATFORM_MACHINE_USER_NAME"
13424
13888
  })
13425
13889
  }).strict(),
13426
13890
  run: async (args) => {
@@ -14415,13 +14879,13 @@ function extractBreakingChangeFields(diff) {
14415
14879
  const optionalToRequired = /* @__PURE__ */ new Map();
14416
14880
  const addedRequiredFields = /* @__PURE__ */ new Map();
14417
14881
  const enumValueChanges = /* @__PURE__ */ new Map();
14418
- for (const change of diff.changes) if (change.kind === "field_modified" && change.fieldName) {
14882
+ for (const change of diff.changes) if (change.kind === "field_modified") {
14419
14883
  const { before, after } = change;
14420
- if (before && after && !before.required && after.required) {
14884
+ if (!before.required && after.required) {
14421
14885
  if (!optionalToRequired.has(change.typeName)) optionalToRequired.set(change.typeName, /* @__PURE__ */ new Set());
14422
14886
  assertDefined(optionalToRequired.get(change.typeName), "optionalToRequired entry missing").add(change.fieldName);
14423
14887
  }
14424
- if (before && after && before.type === "enum" && after.type === "enum" && before.allowedValues && after.allowedValues) {
14888
+ if (before.type === "enum" && after.type === "enum" && before.allowedValues && after.allowedValues) {
14425
14889
  const beforeValues = before.allowedValues.map((v) => v.value);
14426
14890
  const afterValues = after.allowedValues.map((v) => v.value);
14427
14891
  const beforeSet = new Set(beforeValues);
@@ -14434,9 +14898,9 @@ function extractBreakingChangeFields(diff) {
14434
14898
  });
14435
14899
  }
14436
14900
  }
14437
- } else if (change.kind === "field_added" && change.fieldName) {
14901
+ } else if (change.kind === "field_added") {
14438
14902
  const { after } = change;
14439
- if (after && after.required) {
14903
+ if (after.required) {
14440
14904
  if (!addedRequiredFields.has(change.typeName)) addedRequiredFields.set(change.typeName, /* @__PURE__ */ new Map());
14441
14905
  assertDefined(addedRequiredFields.get(change.typeName), "addedRequiredFields entry missing").set(change.fieldName, after);
14442
14906
  }
@@ -14920,7 +15384,7 @@ async function generate(options) {
14920
15384
  if (options.init) await handleInitOption(namespacesWithMigrations, options.yes);
14921
15385
  let pluginManager;
14922
15386
  if (plugins.length > 0) pluginManager = new PluginManager(plugins);
14923
- const { defineApplication } = await import("./application-DSXntqnV.mjs");
15387
+ const { defineApplication } = await import("./application-av2raLs6.mjs");
14924
15388
  const application = defineApplication({
14925
15389
  config,
14926
15390
  pluginManager
@@ -14937,10 +15401,7 @@ async function generate(options) {
14937
15401
  await tailordbService.processNamespacePlugins();
14938
15402
  const localTypesObj = tailordbService.types;
14939
15403
  const currentSnapshot = createSnapshotFromLocalTypes(localTypesObj, namespace);
14940
- let previousSnapshot = null;
14941
- try {
14942
- previousSnapshot = reconstructSnapshotFromMigrations(migrationsDir);
14943
- } catch {}
15404
+ const previousSnapshot = reconstructSnapshotFromMigrations(migrationsDir);
14944
15405
  if (!previousSnapshot) await generateInitialSnapshot(currentSnapshot, migrationsDir);
14945
15406
  else await generateDiffFromSnapshot(previousSnapshot, currentSnapshot, migrationsDir, options);
14946
15407
  }
@@ -16506,7 +16967,7 @@ const queryBaseOptionsSchema = z.object({
16506
16967
  profile: z.string().optional(),
16507
16968
  configPath: z.string().optional(),
16508
16969
  engine: queryEngineSchema,
16509
- machineUser: z.string()
16970
+ machineUser: z.string().optional()
16510
16971
  });
16511
16972
  const queryOptionsSchema = queryBaseOptionsSchema.extend({ query: z.string() });
16512
16973
  async function getNamespaceFromSqlQuery(workspaceId, query, client, namespaces) {
@@ -16529,6 +16990,11 @@ async function getNamespaceFromSqlQuery(workspaceId, query, client, namespaces)
16529
16990
  async function loadOptions(options) {
16530
16991
  const result = queryBaseOptionsSchema.safeParse(options);
16531
16992
  if (!result.success) throw new Error(assertDefined(result.error.issues[0], "validation error missing issues").message);
16993
+ const machineUser = await loadMachineUserName({
16994
+ machineUser: result.data.machineUser,
16995
+ profile: result.data.profile
16996
+ });
16997
+ if (!machineUser) throw new Error("Machine user is required. Specify --machine-user, set TAILOR_PLATFORM_MACHINE_USER_NAME, or set a profile default with 'tailor-sdk profile update <profile> --machine-user <name>'.");
16532
16998
  const client = await initOperatorClient(await loadAccessToken({ profile: result.data.profile }));
16533
16999
  const workspaceId = await loadWorkspaceId({
16534
17000
  workspaceId: result.data.workspaceId,
@@ -16544,9 +17010,9 @@ async function loadOptions(options) {
16544
17010
  const { machineUser: machineUserResource } = await client.getAuthMachineUser({
16545
17011
  workspaceId,
16546
17012
  authNamespace: application.authNamespace,
16547
- name: result.data.machineUser
17013
+ name: machineUser
16548
17014
  });
16549
- if (!machineUserResource) throw new Error(`Machine user ${result.data.machineUser} not found.`);
17015
+ if (!machineUserResource) throw new Error(`Machine user ${machineUser} not found.`);
16550
17016
  return {
16551
17017
  engine: result.data.engine,
16552
17018
  client,
@@ -16696,7 +17162,7 @@ async function prepareQueryExecutor(options) {
16696
17162
  error,
16697
17163
  engine,
16698
17164
  namespace,
16699
- machineUser: options.machineUser
17165
+ machineUser: machineUserResource.name
16700
17166
  });
16701
17167
  }
16702
17168
  };
@@ -16910,10 +17376,10 @@ const queryCommand = defineAppCommand({
16910
17376
  description: "Read query string from file; omit to start REPL mode"
16911
17377
  }),
16912
17378
  edit: arg(z.boolean().default(false), { description: "Open a temporary file in your editor; omit to start REPL mode" }),
16913
- "machine-user": arg(z.string(), {
17379
+ "machine-user": arg(z.string().optional(), {
16914
17380
  alias: "m",
16915
17381
  hiddenAlias: "machineuser",
16916
- description: "Machine user name for query execution",
17382
+ description: "Machine user name for query execution. Falls back to the active profile's default machine user.",
16917
17383
  env: "TAILOR_PLATFORM_MACHINE_USER_NAME"
16918
17384
  }),
16919
17385
  "newline-on-enter": arg(z.boolean().optional(), { description: "REPL: when true, Enter inserts a newline and Shift+Enter submits. Use --no-newline-on-enter to swap." })
@@ -17078,5 +17544,5 @@ function isDeno() {
17078
17544
  }
17079
17545
 
17080
17546
  //#endregion
17081
- export { listCommand$5 as $, INITIAL_SCHEMA_NUMBER as $t, truncate as A, configArg as An, startCommand as At, logBetaWarning as B, getExecutor as Bt, listCommand$2 as C, generateUserTypes as Cn, triggerExecutor as Ct, resumeWorkflow as D, assertWritable as Dn, jobsCommand as Dt, resumeCommand as E, apiCall as En, getExecutorJob as Et, writeDbTypesFile as F, paginationArgs as Fn, getWorkflowExecution as Ft, organizationTree as G, MIGRATION_LABEL_KEY as Gt, removeCommand$1 as H, executeScript as Ht, getConfiguredEditorCommand as I, toPageDirection as In, listWorkflowExecutions as It, listOrganizations as J, compareSnapshotWithRemote as Jt, treeCommand as K, handleOptionalToRequiredError as Kt, openInConfiguredEditor as L, workspaceArgs as Ln, functionExecutionStatusToString as Lt, generate as M, deploymentArgs as Mn, getCommand$5 as Mt, generateCommand as N, isVerbose as Nn, getWorkflow as Nt, listCommand$3 as O, defineAppCommand as On, listExecutorJobs as Ot, generateMigrationScript as P, pagedLogArgs as Pn, executionsCommand as Pt, updateFolder as Q, DIFF_FILE_NAME as Qt, show as R, formatKeyValueTable as Rt, listApps as S, PluginManager as Sn, triggerCommand as St, healthCommand as T, apiCommand as Tn, listExecutors as Tt, updateCommand$1 as U, waitForExecution$1 as Ut, remove as V, deploy as Vt, updateOrganization as W, bundleMigrationScript as Wt, getOrganization as X, protoGqlPermission as Xt, getCommand$1 as Y, generateAllTypeManifestsFromSnapshot as Yt, updateCommand$2 as Z, DB_TYPES_FILE_NAME as Zt, getWorkspace as _, formatMigrationDiff as _n, listFunctionRegistries as _t, updateUser as a, createSnapshotFromLocalTypes as an, createCommand$1 as at, createCommand as b, resourceTrn as bn, listWebhookExecutors as bt, listCommand as c, getMigrationFilePath as cn, listOAuth2Clients as ct, inviteUser as d, isValidMigrationNumber as dn, getMachineUserToken as dt, MIGRATE_FILE_NAME as en, listFolders as et, restoreCommand as f, loadDiff as fn, tokenCommand as ft, getCommand as g, formatDiffSummary as gn, listCommand$8 as gt, listWorkspaces as h, parseMigrationNumberArg as hn, generate$1 as ht, updateCommand as i, compareSnapshots as in, deleteFolder as it, truncateCommand as j, confirmationArgs as jn, startWorkflow as jt, listWorkflows as k, commonArgs as kn, watchExecutorJob as kt, listUsers as l, getMigrationFiles as ln, getCommand$3 as lt, listCommand$1 as m, formatMigrationNumber as mn, listMachineUsers as mt, query as n, assertValidMigrationFiles as nn, getFolder as nt, removeCommand as o, getLatestMigrationNumber as on, createFolder as ot, restoreWorkspace as p, reconstructSnapshotFromMigrations as pn, listCommand$7 as pt, listCommand$4 as q, parseMigrationLabelNumber as qt, queryCommand as r, compareLocalTypesWithSnapshot as rn, deleteCommand$1 as rt, removeUser as s, getMigrationDirPath as sn, listCommand$6 as st, isNativeTypeScriptRuntime as t, SCHEMA_FILE_NAME as tn, getCommand$2 as tt, inviteCommand as u, getNextMigrationNumber as un, getOAuth2Client as ut, deleteCommand as v, hasChanges as vn, getCommand$4 as vt, getAppHealth as w, prompt as wn, listCommand$9 as wt, createWorkspace as x, sdkNameLabelKey as xn, webhookCommand as xt, deleteWorkspace as y, getNamespacesWithMigrations as yn, getFunctionRegistry as yt, showCommand as z, getCommand$6 as zt };
17082
- //# sourceMappingURL=runtime-C6o4hiYq.mjs.map
17547
+ export { listCommand$5 as $, INITIAL_SCHEMA_NUMBER as $t, truncate as A, commonArgs as An, startCommand as At, logBetaWarning as B, getExecutor as Bt, listCommand$2 as C, PluginManager as Cn, triggerExecutor as Ct, resumeWorkflow as D, apiCall as Dn, jobsCommand as Dt, resumeCommand as E, apiCommand as En, getExecutorJob as Et, writeDbTypesFile as F, pagedLogArgs as Fn, getWorkflowExecution as Ft, organizationTree as G, MIGRATION_LABEL_KEY as Gt, removeCommand$1 as H, executeScript as Ht, getConfiguredEditorCommand as I, paginationArgs as In, listWorkflowExecutions as It, listOrganizations as J, compareSnapshotWithRemote as Jt, treeCommand as K, handleOptionalToRequiredError as Kt, openInConfiguredEditor as L, toPageDirection as Ln, functionExecutionStatusToString as Lt, generate as M, confirmationArgs as Mn, getCommand$5 as Mt, generateCommand as N, deploymentArgs as Nn, getWorkflow as Nt, listCommand$3 as O, assertWritable as On, listExecutorJobs as Ot, generateMigrationScript as P, isVerbose as Pn, executionsCommand as Pt, updateFolder as Q, DIFF_FILE_NAME as Qt, show as R, workspaceArgs as Rn, formatKeyValueTable as Rt, listApps as S, sdkNameLabelKey as Sn, triggerCommand as St, healthCommand as T, prompt as Tn, listExecutors as Tt, updateCommand$1 as U, waitForExecution$1 as Ut, remove as V, deploy as Vt, updateOrganization as W, bundleMigrationScript as Wt, getOrganization as X, protoGqlPermission as Xt, getCommand$1 as Y, generateAllTypeManifestsFromSnapshot as Yt, updateCommand$2 as Z, DB_TYPES_FILE_NAME as Zt, getWorkspace as _, formatMigrationDiff as _n, listFunctionRegistries as _t, updateUser as a, createSnapshotFromLocalTypes as an, createCommand$1 as at, createCommand as b, ensureConfigId as bn, listWebhookExecutors as bt, listCommand as c, getMigrationFilePath as cn, listOAuth2Clients as ct, inviteUser as d, isValidMigrationNumber as dn, getMachineUserToken as dt, MIGRATE_FILE_NAME as en, listFolders as et, restoreCommand as f, loadDiff as fn, tokenCommand as ft, getCommand as g, formatDiffSummary as gn, listCommand$8 as gt, listWorkspaces as h, parseMigrationNumberArg as hn, generate$1 as ht, updateCommand as i, compareSnapshots as in, deleteFolder as it, truncateCommand as j, configArg as jn, startWorkflow as jt, listWorkflows as k, defineAppCommand as kn, watchExecutorJob as kt, listUsers as l, getMigrationFiles as ln, getCommand$3 as lt, listCommand$1 as m, formatMigrationNumber as mn, listMachineUsers as mt, query as n, assertValidMigrationFiles as nn, getFolder as nt, removeCommand as o, getLatestMigrationNumber as on, createFolder as ot, restoreWorkspace as p, reconstructSnapshotFromMigrations as pn, listCommand$7 as pt, listCommand$4 as q, parseMigrationLabelNumber as qt, queryCommand as r, compareLocalTypesWithSnapshot as rn, deleteCommand$1 as rt, removeUser as s, getMigrationDirPath as sn, listCommand$6 as st, isNativeTypeScriptRuntime as t, SCHEMA_FILE_NAME as tn, getCommand$2 as tt, inviteCommand as u, getNextMigrationNumber as un, getOAuth2Client as ut, deleteCommand as v, hasChanges as vn, getCommand$4 as vt, getAppHealth as w, generateUserTypes as wn, listCommand$9 as wt, createWorkspace as x, resourceTrn as xn, webhookCommand as xt, deleteWorkspace as y, getNamespacesWithMigrations as yn, getFunctionRegistry as yt, showCommand as z, getCommand$6 as zt };
17548
+ //# sourceMappingURL=runtime-C7qTBDD2.mjs.map