@tailor-platform/sdk 2.1.0 → 2.3.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 (98) hide show
  1. package/CHANGELOG.md +199 -0
  2. package/{dist/cli/index.mjs → bin/tailor.mjs} +1 -1
  3. package/dist/application-BZfk4HKm.mjs +3 -0
  4. package/dist/{application-D77KJFKD.mjs → application-F-nl107y.mjs} +121 -27
  5. package/dist/application-F-nl107y.mjs.map +1 -0
  6. package/dist/cli/commands/deploy/tailordb/index.d.mts +2 -1
  7. package/dist/cli/commands/deploy/types.d.mts +2 -1
  8. package/dist/cli/commands/tailordb/migrate/diff-calculator.d.mts +52 -22
  9. package/dist/cli/commands/tailordb/migrate/file-state.d.mts +1 -0
  10. package/dist/cli/commands/tailordb/migrate/generate.d.mts +6 -0
  11. package/dist/cli/commands/tailordb/migrate/rename-detection.d.mts +22 -0
  12. package/dist/cli/commands/tailordb/migrate/schema-checks.d.mts +2 -2
  13. package/dist/cli/commands/tailordb/migrate/snapshot-types.d.mts +9 -2
  14. package/dist/cli/commands/tailordb/migrate/snapshot.d.mts +30 -9
  15. package/dist/cli/lib.d.mts +4 -4
  16. package/dist/cli/lib.mjs +3 -482
  17. package/dist/cli/lib.mjs.map +1 -1
  18. package/dist/cli/main.mjs +1151 -208
  19. package/dist/cli/main.mjs.map +1 -1
  20. package/dist/cli/ts-hook.mjs +52 -7
  21. package/dist/completion/zsh-worker.zsh +167 -4
  22. package/dist/configure/index.d.mts +3 -3
  23. package/dist/configure/index.mjs +90 -23
  24. package/dist/configure/index.mjs.map +1 -1
  25. package/dist/configure/services/index.d.mts +3 -2
  26. package/dist/configure/services/tailordb/index.d.mts +2 -1
  27. package/dist/configure/services/tailordb/schema.d.mts +46 -46
  28. package/dist/configure/services/tailordb/types.d.mts +30 -4
  29. package/dist/configure/services/workflow/index.d.mts +2 -2
  30. package/dist/configure/services/workflow/wait-point.d.mts +72 -13
  31. package/dist/{crashreport-B5LqCTfF.mjs → crashreport-CIIfLnoO.mjs} +2 -2
  32. package/dist/{crashreport-B5LqCTfF.mjs.map → crashreport-CIIfLnoO.mjs.map} +1 -1
  33. package/dist/{crashreport-eI7ty7ok.mjs → crashreport-CINZ5dVN.mjs} +1 -1
  34. package/dist/errors-BVb6vYGy.mjs +89 -0
  35. package/dist/errors-BVb6vYGy.mjs.map +1 -0
  36. package/dist/kysely/index.d.mts +53 -5
  37. package/dist/kysely/index.mjs +7 -2
  38. package/dist/kysely/index.mjs.map +1 -1
  39. package/dist/{logger-CXQq9YIp.mjs → logger-DSdExfor.mjs} +83 -42
  40. package/dist/logger-DSdExfor.mjs.map +1 -0
  41. package/dist/plugin/builtin/seed/index.mjs +1 -1
  42. package/dist/{register-ts-hook-BU18uU44.mjs → register-ts-hook-ClI226n2.mjs} +3541 -703
  43. package/dist/register-ts-hook-ClI226n2.mjs.map +1 -0
  44. package/dist/schema--xYWRGfe.mjs.map +1 -1
  45. package/dist/seed/index.d.mts +52 -3
  46. package/dist/seed/index.mjs +200 -44
  47. package/dist/seed/index.mjs.map +1 -1
  48. package/dist/{seed-B-yckgQY.mjs → seed-xqM9WIHP.mjs} +8 -8
  49. package/dist/seed-xqM9WIHP.mjs.map +1 -0
  50. package/dist/{service-k1xy_A5G.mjs → service-C_WpbKHu.mjs} +39 -5
  51. package/dist/service-C_WpbKHu.mjs.map +1 -0
  52. package/dist/service-D1RCdzIL.mjs +3 -0
  53. package/dist/{service-B5WynBHQ.mjs → service-hZskxZmg.mjs} +3 -3
  54. package/dist/{service-B5WynBHQ.mjs.map → service-hZskxZmg.mjs.map} +1 -1
  55. package/dist/{service_pb-D5--My_M.mjs → service_pb-BEWj1pOV.mjs} +2 -2
  56. package/dist/{service_pb-D5--My_M.mjs.map → service_pb-BEWj1pOV.mjs.map} +1 -1
  57. package/dist/{service_pb-i8CmnQP4.mjs → service_pb-BjlhvK9E.mjs} +1 -1
  58. package/dist/utils/test/index.d.mts +6 -3
  59. package/dist/utils/test/index.mjs +25 -13
  60. package/dist/utils/test/index.mjs.map +1 -1
  61. package/dist/vitest/index.d.mts +2 -1
  62. package/dist/vitest/index.mjs +167 -3
  63. package/dist/vitest/index.mjs.map +1 -1
  64. package/dist/vitest/mocks/workflow.d.mts +13 -1
  65. package/dist/vitest/pglite-kysely.d.mts +43 -0
  66. package/dist/wait-point-invoker-__oE88_P.mjs +148 -0
  67. package/dist/wait-point-invoker-__oE88_P.mjs.map +1 -0
  68. package/dist/wait-point-registry-TL99zotw.mjs +47 -0
  69. package/dist/wait-point-registry-TL99zotw.mjs.map +1 -0
  70. package/dist/{workspace_resource_pb-DXnO2AT-.mjs → workspace_resource_pb-HNIL_Vfj.mjs} +10 -2
  71. package/dist/{workspace_resource_pb-DXnO2AT-.mjs.map → workspace_resource_pb-HNIL_Vfj.mjs.map} +1 -1
  72. package/docs/cli/setup.md +14 -1
  73. package/docs/cli/tailordb.md +96 -28
  74. package/docs/cli-reference.md +15 -12
  75. package/docs/configuration.md +1 -1
  76. package/docs/github-actions.md +73 -28
  77. package/docs/migration/v2.md +55 -1
  78. package/docs/plugin/custom.md +48 -48
  79. package/docs/plugin/index.md +24 -24
  80. package/docs/services/auth.md +10 -10
  81. package/docs/services/executor.md +1 -1
  82. package/docs/services/resolver.md +2 -2
  83. package/docs/services/tailordb-migration.md +485 -84
  84. package/docs/services/tailordb.md +28 -28
  85. package/docs/services/workflow.md +52 -2
  86. package/docs/testing.md +14 -0
  87. package/package.json +12 -7
  88. package/dist/application-Af1zIqSI.mjs +0 -3
  89. package/dist/application-D77KJFKD.mjs.map +0 -1
  90. package/dist/errors-D7583Zz7.mjs +0 -58
  91. package/dist/errors-D7583Zz7.mjs.map +0 -1
  92. package/dist/logger-CXQq9YIp.mjs.map +0 -1
  93. package/dist/register-ts-hook-BU18uU44.mjs.map +0 -1
  94. package/dist/seed-B-yckgQY.mjs.map +0 -1
  95. package/dist/service-M7OYziQP.mjs +0 -3
  96. package/dist/service-k1xy_A5G.mjs.map +0 -1
  97. package/dist/test-env-key-D7UkZp99.mjs +0 -75
  98. package/dist/test-env-key-D7UkZp99.mjs.map +0 -1
@@ -3,8 +3,9 @@ import "../../../services/application.mjs";
3
3
  import "../../../../tailor-proto/src/tailor/v1/tailordb_pb.mjs";
4
4
  import "../../../shared/client.mjs";
5
5
  import "../label.mjs";
6
+ import "../../tailordb/migrate/snapshot.mjs";
6
7
  import "../types.mjs";
7
8
  import "../../tailordb/migrate/config.mjs";
8
- import "../../tailordb/migrate/snapshot.mjs";
9
9
  import "../../tailordb/migrate/schema-checks.mjs";
10
+ import "../../tailordb/migrate/file-state.mjs";
10
11
  import { MessageInitShape } from "@bufbuild/protobuf";
@@ -1,4 +1,5 @@
1
1
  import "../../shared/config-loader.mjs";
2
2
  import "../../services/application.mjs";
3
3
  import "../../shared/client.mjs";
4
- import "./label.mjs";
4
+ import "./label.mjs";
5
+ import "../tailordb/migrate/snapshot.mjs";
@@ -4,7 +4,7 @@ import { SnapshotFieldConfig, SnapshotGqlPermission, SnapshotIndexConfig, Snapsh
4
4
  * Properties shared by all diff change variants
5
5
  */
6
6
  interface DiffChangeBase {
7
- typeName: string;
7
+ tableName: string;
8
8
  reason?: string;
9
9
  }
10
10
  /**
@@ -29,29 +29,40 @@ interface SnapshotPermissionState {
29
29
  recordPermission?: SnapshotRecordPermission;
30
30
  gqlPermission?: SnapshotGqlPermission;
31
31
  }
32
- /** A new type was added to the schema. */
33
- interface TypeAddedChange extends DiffChangeBase {
34
- kind: "type_added";
32
+ /** A new table was added to the schema. */
33
+ interface TableAddedChange extends DiffChangeBase {
34
+ kind: "table_added";
35
35
  after: TailorDBSnapshotType;
36
36
  }
37
- /** An existing type was removed from the schema. */
38
- interface TypeRemovedChange extends DiffChangeBase {
39
- kind: "type_removed";
37
+ /** An existing table was removed from the schema. */
38
+ interface TableRemovedChange extends DiffChangeBase {
39
+ kind: "table_removed";
40
40
  before: TailorDBSnapshotType;
41
41
  }
42
42
  /**
43
- * Legacy type-level settings change. Kept for backward compatibility with
43
+ * A table was renamed. Recorded when the user confirms that a removed + added
44
+ * table pair is a rename (interactively or via `--rename`).
45
+ * `tableName` is the new name; `previousTableName` is the old name.
46
+ */
47
+ interface TableRenamedChange extends DiffChangeBase {
48
+ kind: "table_renamed";
49
+ previousTableName: string;
50
+ before: TailorDBSnapshotType;
51
+ after: TailorDBSnapshotType;
52
+ }
53
+ /**
54
+ * Legacy table-level settings change. Kept for backward compatibility with
44
55
  * diff.json files written by older SDK versions; `before`/`after` may be
45
56
  * absent in those files, hence optional.
46
57
  */
47
- interface TypeModifiedChange extends DiffChangeBase {
48
- kind: "type_modified";
58
+ interface TableModifiedChange extends DiffChangeBase {
59
+ kind: "table_modified";
49
60
  before?: TypeSettingsPatch;
50
61
  after?: TypeSettingsPatch;
51
62
  }
52
- /** Type-level settings or metadata changed. */
53
- interface TypeSettingsModifiedChange extends DiffChangeBase {
54
- kind: "type_settings_modified";
63
+ /** Table-level settings or metadata changed. */
64
+ interface TableSettingsModifiedChange extends DiffChangeBase {
65
+ kind: "table_settings_modified";
55
66
  before: SnapshotTypeSettingsState;
56
67
  after: SnapshotTypeSettingsState;
57
68
  }
@@ -74,6 +85,25 @@ interface FieldModifiedChange extends DiffChangeBase {
74
85
  before: SnapshotFieldConfig;
75
86
  after: SnapshotFieldConfig;
76
87
  }
88
+ /**
89
+ * A field was renamed within a type. Recorded when the user confirms that a
90
+ * removed + added field pair is a rename (interactively or via `--rename`).
91
+ * `fieldName` is the new name; `previousFieldName` is the old name.
92
+ */
93
+ interface FieldRenamedChange extends DiffChangeBase {
94
+ kind: "field_renamed";
95
+ fieldName: string;
96
+ previousFieldName: string;
97
+ before: SnapshotFieldConfig;
98
+ after: SnapshotFieldConfig;
99
+ }
100
+ /** A field type changed and must remain on the previous type until Post-phase. */
101
+ interface FieldTypeModifiedChange extends DiffChangeBase {
102
+ kind: "field_type_modified";
103
+ fieldName: string;
104
+ before: SnapshotFieldConfig;
105
+ after: SnapshotFieldConfig;
106
+ }
77
107
  /** An index was added to a type. */
78
108
  interface IndexAddedChange extends DiffChangeBase {
79
109
  kind: "index_added";
@@ -156,9 +186,9 @@ interface TypeScriptsState {
156
186
  };
157
187
  typeValidateExpr?: string;
158
188
  }
159
- /** Type-level hook/validate scripts changed. */
160
- interface TypeScriptsModifiedChange extends DiffChangeBase {
161
- kind: "type_scripts_modified";
189
+ /** Table-level hook/validate scripts changed. */
190
+ interface TableScriptsModifiedChange extends DiffChangeBase {
191
+ kind: "table_scripts_modified";
162
192
  before: TypeScriptsState;
163
193
  after: TypeScriptsState;
164
194
  }
@@ -166,7 +196,7 @@ interface TypeScriptsModifiedChange extends DiffChangeBase {
166
196
  * Single change in migration diff, discriminated by `kind` so that
167
197
  * `before`/`after` are typed per change kind.
168
198
  */
169
- type DiffChange = TypeAddedChange | TypeRemovedChange | TypeModifiedChange | TypeSettingsModifiedChange | FieldAddedChange | FieldRemovedChange | FieldModifiedChange | IndexAddedChange | IndexRemovedChange | IndexModifiedChange | FileAddedChange | FileRemovedChange | FileModifiedChange | RelationshipAddedChange | RelationshipRemovedChange | RelationshipModifiedChange | PermissionModifiedChange | TypeScriptsModifiedChange;
199
+ type DiffChange = TableAddedChange | TableRemovedChange | TableRenamedChange | TableModifiedChange | TableSettingsModifiedChange | FieldAddedChange | FieldRemovedChange | FieldModifiedChange | FieldRenamedChange | FieldTypeModifiedChange | IndexAddedChange | IndexRemovedChange | IndexModifiedChange | FileAddedChange | FileRemovedChange | FileModifiedChange | RelationshipAddedChange | RelationshipRemovedChange | RelationshipModifiedChange | PermissionModifiedChange | TableScriptsModifiedChange;
170
200
  /**
171
201
  * Migration diff - changes between two schema versions
172
202
  * Stored as XXXX/diff.json (e.g., 0001/diff.json)
@@ -188,11 +218,11 @@ interface MigrationDiff {
188
218
  warnings: WarningChangeInfo[];
189
219
  /** Whether a migration script is required to handle data migration */
190
220
  requiresMigrationScript: boolean;
191
- /** Explicit acknowledgment that this migration needs no script despite breaking changes */
221
+ /** Explicit acknowledgment that this migration needs no script despite breaking changes or data-loss warnings */
192
222
  scriptSkipped?: ScriptSkippedInfo;
193
223
  }
194
224
  /**
195
- * Acknowledgment that a migration requiring a script intentionally has none.
225
+ * Acknowledgment that a migration requiring or recommending a script intentionally has none.
196
226
  * Recorded by `tailordb migration script <n> --no-script --reason "..."`.
197
227
  */
198
228
  interface ScriptSkippedInfo {
@@ -203,7 +233,7 @@ interface ScriptSkippedInfo {
203
233
  * Breaking change information in migration diff
204
234
  */
205
235
  interface BreakingChangeInfo {
206
- typeName: string;
236
+ tableName: string;
207
237
  fieldName?: string;
208
238
  reason: string;
209
239
  /** If true, this change is not supported and migration generation will fail */
@@ -220,7 +250,7 @@ interface BreakingChangeInfo {
220
250
  * preserve or transform data before the change applies.
221
251
  */
222
252
  interface WarningChangeInfo {
223
- typeName: string;
253
+ tableName: string;
224
254
  fieldName?: string;
225
255
  reason: string;
226
256
  }
@@ -243,4 +273,4 @@ declare function formatMigrationDiff(diff: MigrationDiff): string;
243
273
  */
244
274
  declare function formatDiffSummary(diff: MigrationDiff): string;
245
275
  //#endregion
246
- export { BreakingChangeInfo, DiffChange, FieldAddedChange, FieldModifiedChange, FieldRemovedChange, FileAddedChange, FileModifiedChange, FileRemovedChange, IndexAddedChange, IndexModifiedChange, IndexRemovedChange, MigrationDiff, PermissionModifiedChange, RelationshipAddedChange, RelationshipModifiedChange, RelationshipRemovedChange, ScriptSkippedInfo, SnapshotPermissionState, SnapshotTypeSettingsState, TypeAddedChange, TypeModifiedChange, TypeRemovedChange, TypeScriptsModifiedChange, TypeScriptsState, TypeSettingsModifiedChange, TypeSettingsPatch, WarningChangeInfo, formatDiffSummary, formatMigrationDiff, hasChanges };
276
+ export { BreakingChangeInfo, DiffChange, FieldAddedChange, FieldModifiedChange, FieldRemovedChange, FieldRenamedChange, FieldTypeModifiedChange, FileAddedChange, FileModifiedChange, FileRemovedChange, IndexAddedChange, IndexModifiedChange, IndexRemovedChange, MigrationDiff, PermissionModifiedChange, RelationshipAddedChange, RelationshipModifiedChange, RelationshipRemovedChange, ScriptSkippedInfo, SnapshotPermissionState, SnapshotTypeSettingsState, TableAddedChange, TableModifiedChange, TableRemovedChange, TableRenamedChange, TableScriptsModifiedChange, TableSettingsModifiedChange, TypeScriptsState, TypeSettingsPatch, WarningChangeInfo, formatDiffSummary, formatMigrationDiff, hasChanges };
@@ -0,0 +1 @@
1
+ import "./config.mjs";
@@ -5,6 +5,12 @@ interface GenerateOptions {
5
5
  name?: string;
6
6
  yes?: boolean;
7
7
  init?: boolean;
8
+ /** `--rename Type.old:new` / `--rename OldType:NewType` values confirming renames non-interactively. */
9
+ renames?: string[];
10
+ /** `--drop Type.field` / `--drop Type` values confirming removals non-interactively. */
11
+ drops?: string[];
12
+ /** `--expand-contract Type.field` values approving a field type conversion. */
13
+ expandContracts?: string[];
8
14
  }
9
15
  /**
10
16
  * Generate migration files for TailorDB schema changes
@@ -0,0 +1,22 @@
1
+ //#region src/cli/commands/tailordb/migrate/rename-detection.d.ts
2
+ /**
3
+ * A confirmed field rename to record in the migration diff.
4
+ */
5
+ interface FieldRenameSpec {
6
+ tableName: string;
7
+ /** Field name before the rename. */
8
+ previousFieldName: string;
9
+ /** Field name after the rename. */
10
+ fieldName: string;
11
+ }
12
+ /**
13
+ * A confirmed type rename to record in the migration diff.
14
+ */
15
+ interface TypeRenameSpec {
16
+ /** Type name before the rename. */
17
+ previousTableName: string;
18
+ /** Type name after the rename. */
19
+ tableName: string;
20
+ }
21
+ //#endregion
22
+ export { FieldRenameSpec, TypeRenameSpec };
@@ -1,5 +1,5 @@
1
1
  import "../../../services/tailordb/service.mjs";
2
2
  import "../../../shared/config-loader.mjs";
3
3
  import "../../../shared/client.mjs";
4
- import "./config.mjs";
5
- import "./snapshot.mjs";
4
+ import "./snapshot.mjs";
5
+ import "./config.mjs";
@@ -182,6 +182,12 @@ interface TailorDBSnapshotType {
182
182
  };
183
183
  typeValidateExpr?: string;
184
184
  }
185
+ /** Identifies the history transition created by a full rebaseline. */
186
+ interface RebaselineMarker {
187
+ historyId: string;
188
+ replacedHistoryId: string | null;
189
+ replacedLatestMigration: number;
190
+ }
185
191
  /**
186
192
  * Schema snapshot - full schema state at a point in time.
187
193
  * Stored as XXXX/schema.json. Defined here (leaf module) so that
@@ -192,7 +198,8 @@ interface SchemaSnapshot {
192
198
  version: number;
193
199
  namespace: string;
194
200
  createdAt: string;
195
- types: Record<string, TailorDBSnapshotType>;
201
+ tables: Record<string, TailorDBSnapshotType>;
202
+ rebaseline?: RebaselineMarker;
196
203
  }
197
204
  declare const normalizedSchemaSnapshotBrand: unique symbol;
198
205
  /**
@@ -205,4 +212,4 @@ type NormalizedSchemaSnapshot = SchemaSnapshot & {
205
212
  readonly [normalizedSchemaSnapshotBrand]: true;
206
213
  };
207
214
  //#endregion
208
- export { NormalizedSchemaSnapshot, SchemaSnapshot, SnapshotActionPermission, SnapshotEnumValue, SnapshotFieldConfig, SnapshotFieldRefOperand, SnapshotGqlAction, SnapshotGqlPermission, SnapshotGqlPermissionPolicy, SnapshotHook, SnapshotIndexConfig, SnapshotPermissionCondition, SnapshotPermissionOperand, SnapshotPermissionOperator, SnapshotRecordPermission, SnapshotRelationship, SnapshotSerial, SnapshotValidation, SnapshotValueOperand, TailorDBSnapshotType };
215
+ export { NormalizedSchemaSnapshot, RebaselineMarker, SchemaSnapshot, SnapshotActionPermission, SnapshotEnumValue, SnapshotFieldConfig, SnapshotFieldRefOperand, SnapshotGqlAction, SnapshotGqlPermission, SnapshotGqlPermissionPolicy, SnapshotHook, SnapshotIndexConfig, SnapshotPermissionCondition, SnapshotPermissionOperand, SnapshotPermissionOperator, SnapshotRecordPermission, SnapshotRelationship, SnapshotSerial, SnapshotValidation, SnapshotValueOperand, TailorDBSnapshotType };
@@ -1,7 +1,8 @@
1
1
  import { TailorDBType } from "../../../../parser/service/tailordb/types.mjs";
2
2
  import "../../../../tailor-proto/src/tailor/v1/tailordb_resource_pb.mjs";
3
- import { NormalizedSchemaSnapshot, SchemaSnapshot, SnapshotActionPermission, SnapshotEnumValue, SnapshotFieldConfig, SnapshotGqlPermission, SnapshotGqlPermissionPolicy, SnapshotIndexConfig, SnapshotPermissionCondition, SnapshotPermissionOperand, SnapshotRecordPermission, SnapshotRelationship, TailorDBSnapshotType } from "./snapshot-types.mjs";
3
+ import { NormalizedSchemaSnapshot, RebaselineMarker, SchemaSnapshot, SnapshotActionPermission, SnapshotEnumValue, SnapshotFieldConfig, SnapshotGqlPermission, SnapshotGqlPermissionPolicy, SnapshotIndexConfig, SnapshotPermissionCondition, SnapshotPermissionOperand, SnapshotRecordPermission, SnapshotRelationship, TailorDBSnapshotType } from "./snapshot-types.mjs";
4
4
  import { MigrationDiff } from "./diff-calculator.mjs";
5
+ import { FieldRenameSpec, TypeRenameSpec } from "./rename-detection.mjs";
5
6
  //#region src/cli/commands/tailordb/migrate/snapshot.d.ts
6
7
  /**
7
8
  * Initial schema migration number (0000)
@@ -15,12 +16,14 @@ declare const SCHEMA_FILE_NAME = "schema.json";
15
16
  declare const DIFF_FILE_NAME = "diff.json";
16
17
  /** File name for migration script. */
17
18
  declare const MIGRATE_FILE_NAME = "migrate.ts";
19
+ /** File name for migration script unit test. */
20
+ declare const MIGRATE_TEST_FILE_NAME = "migrate.test.ts";
18
21
  /** File name for generated DB type definitions. */
19
22
  declare const DB_TYPES_FILE_NAME = "db.ts";
20
23
  /**
21
24
  * Migration file type
22
25
  */
23
- type MigrationFileType = "schema" | "diff" | "migrate" | "db";
26
+ type MigrationFileType = "schema" | "diff" | "migrate" | "test" | "db";
24
27
  /**
25
28
  * Get migration directory path for a given number
26
29
  * @param {string} migrationsDir - Base migrations directory path
@@ -76,17 +79,35 @@ declare function reconstructSnapshotFromMigrations(migrationsDir: string, maxVer
76
79
  */
77
80
  declare function getLatestMigrationNumber(migrationsDir: string): number;
78
81
  /**
79
- * Compare two snapshots and generate a diff
80
- * @param {SchemaSnapshot} previous - Previous schema snapshot
81
- * @param {SchemaSnapshot} current - Current schema snapshot
82
+ * Options for {@link compareSnapshots}.
83
+ */
84
+ interface CompareSnapshotsOptions {
85
+ /**
86
+ * Confirmed field renames. Each spec replaces the corresponding
87
+ * `field_removed` + `field_added` pair with a single breaking
88
+ * `field_renamed` change. Specs are validated against both snapshots.
89
+ */
90
+ fieldRenames?: readonly FieldRenameSpec[];
91
+ /**
92
+ * Confirmed type renames. Each spec replaces the corresponding
93
+ * `table_removed` + `table_added` pair with a single breaking
94
+ * `table_renamed` change. Specs are validated against both snapshots.
95
+ */
96
+ typeRenames?: readonly TypeRenameSpec[];
97
+ }
98
+ /**
99
+ * Compare two normalized snapshots and generate a diff
100
+ * @param {NormalizedSchemaSnapshot} previous - Previous normalized snapshot
101
+ * @param {NormalizedSchemaSnapshot} current - Current normalized snapshot
102
+ * @param {CompareSnapshotsOptions} [options] - Comparison options
82
103
  * @returns {MigrationDiff} Migration diff between snapshots
83
104
  */
84
- declare function compareSnapshots(previous: SchemaSnapshot, current: SchemaSnapshot): MigrationDiff;
105
+ declare function compareSnapshots(previous: NormalizedSchemaSnapshot, current: NormalizedSchemaSnapshot, options?: CompareSnapshotsOptions): MigrationDiff;
85
106
  /**
86
107
  * Compare a snapshot against canonical TailorDBSnapshotType-shaped local types.
87
108
  * Callers are expected to pre-convert TailorDBService.types to TailorDBSnapshotType via
88
- * `createSnapshotType`. As a safety net, `compareSnapshots` re-runs idempotent
89
- * normalization on both sides, so a caller that forgets will still get correct
109
+ * `createSnapshotType`. As a safety net, both sides are re-run through idempotent
110
+ * normalization here, so a caller that forgets will still get correct
90
111
  * comparisons (no silent false drift).
91
112
  * @param {SchemaSnapshot} snapshot - Schema snapshot to compare against
92
113
  * @param {Record<string, TailorDBSnapshotType>} localTypes - Local snapshot-shaped types
@@ -95,4 +116,4 @@ declare function compareSnapshots(previous: SchemaSnapshot, current: SchemaSnaps
95
116
  */
96
117
  declare function compareLocalTypesWithSnapshot(snapshot: SchemaSnapshot, localTypes: Record<string, TailorDBSnapshotType>, namespace: string): MigrationDiff;
97
118
  //#endregion
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 };
119
+ export { CompareSnapshotsOptions, DB_TYPES_FILE_NAME, DIFF_FILE_NAME, INITIAL_SCHEMA_NUMBER, MIGRATE_FILE_NAME, MIGRATE_TEST_FILE_NAME, MigrationFileType, type NormalizedSchemaSnapshot, SCHEMA_FILE_NAME, type SchemaSnapshot, type SnapshotFieldConfig, type TailorDBSnapshotType, compareLocalTypesWithSnapshot, compareSnapshots, createSnapshotFromLocalTypes, getLatestMigrationNumber, getMigrationDirPath, getMigrationFilePath, getMigrationFiles, getNextMigrationNumber, reconstructSnapshotFromMigrations };
@@ -7,12 +7,12 @@ import { GeneratorResult, Plugin, TailorDBNamespaceData } from "../plugin/types.
7
7
  import { LoadedConfig, loadConfig } from "./shared/config-loader.mjs";
8
8
  import { AuthInvoker } from "../tailor-proto/src/tailor/v1/auth_resource_pb.mjs";
9
9
  import { OperatorClient, initOperatorClient } from "./shared/client.mjs";
10
- import "./commands/deploy/function-registry.mjs";
11
- import { NamespaceWithMigrations, getNamespacesWithMigrations } from "./commands/tailordb/migrate/config.mjs";
12
10
  import { NormalizedSchemaSnapshot, SchemaSnapshot, SnapshotFieldConfig, TailorDBSnapshotType } from "./commands/tailordb/migrate/snapshot-types.mjs";
13
11
  import { BreakingChangeInfo, MigrationDiff, formatDiffSummary, formatMigrationDiff, hasChanges } from "./commands/tailordb/migrate/diff-calculator.mjs";
14
12
  import { MIGRATION_LABEL_KEY } from "./commands/tailordb/migrate/types.mjs";
15
- import { DB_TYPES_FILE_NAME, DIFF_FILE_NAME, INITIAL_SCHEMA_NUMBER, MIGRATE_FILE_NAME, SCHEMA_FILE_NAME, compareLocalTypesWithSnapshot, compareSnapshots, createSnapshotFromLocalTypes, getLatestMigrationNumber, getMigrationDirPath, getMigrationFilePath, getMigrationFiles, getNextMigrationNumber, reconstructSnapshotFromMigrations } from "./commands/tailordb/migrate/snapshot.mjs";
13
+ import { DB_TYPES_FILE_NAME, DIFF_FILE_NAME, INITIAL_SCHEMA_NUMBER, MIGRATE_FILE_NAME, MIGRATE_TEST_FILE_NAME, SCHEMA_FILE_NAME, compareLocalTypesWithSnapshot, compareSnapshots, createSnapshotFromLocalTypes, getLatestMigrationNumber, getMigrationDirPath, getMigrationFilePath, getMigrationFiles, getNextMigrationNumber, reconstructSnapshotFromMigrations } from "./commands/tailordb/migrate/snapshot.mjs";
14
+ import "./commands/deploy/function-registry.mjs";
15
+ import { NamespaceWithMigrations, getNamespacesWithMigrations } from "./commands/tailordb/migrate/config.mjs";
16
16
  import { DeployOptions, deploy } from "./commands/deploy/deploy.mjs";
17
17
  import { GenerateOptions } from "./commands/generate/options.mjs";
18
18
  import { generate } from "./commands/generate/service.mjs";
@@ -83,4 +83,4 @@ import { SeedBundleResult, bundleSeedScript } from "./commands/generate/seed/bun
83
83
  import { MigrationBundleResult, bundleMigrationScript } from "./commands/tailordb/migrate/bundler.mjs";
84
84
  import { ExecutionWaitResult, ScriptExecutionOptions, ScriptExecutionResult, ScriptInvoker, executeScript, waitForExecution } from "./shared/script-executor.mjs";
85
85
  import { MachineUserName } from "@tailor-platform/sdk";
86
- export { type AIGatewayInfo, type ApiCallOptions, type ApiCallResult, type AppHealthInfo, type AppInfo, type ApplicationInfo, type DeployOptions as ApplyOptions, type AuthInvoker, type BreakingChangeInfo, type BundledScripts, type ChunkSeedDataOptions, type CreateFolderOptions, type CreateWorkspaceOptions, DB_TYPES_FILE_NAME, DIFF_FILE_NAME, type DeleteFolderOptions, type DeleteWorkspaceOptions, type DeployOptions, type ErrorToJsonOptions, type ExecutionWaitResult, type Executor, type ExecutorInfo, type ExecutorJobAttemptInfo, type ExecutorJobDetailInfo, type ExecutorJobInfo, type ExecutorJobListInfo, type ExecutorListInfo, type FolderInfo, type FolderListInfo, type FunctionRegistryInfo, type GenerateOptions, type GeneratorResult, type HealthOptions as GetAppHealthOptions, type GetExecutorJobTypedOptions, type GetExecutorTypedOptions, type GetFolderOptions, type GetFunctionRegistryOptions, type GetMachineUserTokenOptions, type GetOAuth2ClientOptions, type GetOrganizationOptions, type GetWorkflowExecutionOptions, type GetWorkflowExecutionResult, type GetWorkflowTypedOptions, type GetWorkspaceOptions, INITIAL_SCHEMA_NUMBER, type InviteUserOptions, type ListAppsOptions, type ListExecutorJobsTypedOptions, type ListExecutorsOptions, type ListFoldersOptions, type ListFunctionRegistriesOptions, type ListMachineUsersOptions, type ListOAuth2ClientsOptions, type ListOrganizationsOptions, type ListUsersOptions, type ListWebhookExecutorsOptions, type ListWorkflowExecutionsTypedOptions, type ListWorkflowsOptions, type ListWorkspacesOptions, type LoadSeedContextOptions, type LoadTailorDBNamespacesOptions, type LoadedConfig, type LoadedTailorDBNamespaces, MIGRATE_FILE_NAME, MIGRATION_LABEL_KEY, type MachineUserInfo, type MachineUserName, type MachineUserTokenInfo, type GenerateOptions$1 as MigrateGenerateOptions, type MigrationBundleResult, type MigrationDiff, type NamespaceWithMigrations, type NormalizedSchemaSnapshot, type OAuth2ClientCredentials, type OAuth2ClientInfo, type OperatorClient, type OperatorFieldConfig, type OrganizationInfo, type OrganizationTreeOptions, type ParsedField, type Plugin, type PluginAttachment, type PluginGeneratedTypeSource, type RemoveOptions, type RemoveUserOptions, type Resolver, type RestoreWorkspaceOptions, type ResumeWorkflowOptions, type ResumeWorkflowResultWithWait, SCHEMA_FILE_NAME, type SchemaSnapshot, type ScriptExecutionOptions, type ScriptExecutionResult, type ScriptInvoker, type SeedBundleResult, type SeedChunk, type SeedContext, type SeedData, type SeedIdpUserContext, type SeedNamespaceConfig, type ShowInfo, type ShowOptions, type SnapshotFieldConfig, type StartWorkflowResultWithWait, type StartWorkflowTypedOptions, type DeployResult as StaticWebsiteDeployResult, type TailorDBNamespaceData, type TailorDBNamespaceSelector, type TailorDBSnapshotType, type TailorDBType, type TriggerExecutorResult, type TriggerExecutorTypedOptions, type TruncateOptions, type TypeSourceInfoEntry, type UpdateFolderOptions, type UpdateOrganizationOptions, type UpdateUserOptions, type UserInfo, type UserOrganizationInfo, type WaitOptions, type WaitWorkflowExecutionOptions, type WatchExecutorJobResult, type WatchExecutorJobTypedOptions, type WebhookExecutorInfo, type WorkflowExecutionInfo, type WorkflowExecutionWaitInfo, type WorkflowInfo, type WorkflowJobExecutionInfo, type WorkflowListInfo, type WorkflowWaitOutput, type WorkflowWaitResult, type WorkspaceDetails, type WorkspaceInfo, apiCall, deploy as apply, assertWritable, bundleMigrationScript, bundleSeedScript, chunkSeedData, compareLocalTypesWithSnapshot, compareSnapshots, createFolder, createSnapshotFromLocalTypes, createWorkspace, deleteFolder, deleteWorkspace, deploy, deployStaticWebsite, errorToJson, executeScript, formatDiffSummary, formatMigrationDiff, generate, generateUserTypes, getAppHealth, getExecutor, getExecutorJob, getExecutorWaitFailureMessage, getFolder, getFunctionRegistry, getLatestMigrationNumber, getMachineUserToken, getMigrationDirPath, getMigrationFilePath, getMigrationFiles, getNamespacesWithMigrations, getNextMigrationNumber, getOAuth2Client, getOrganization, getWorkflow, getWorkflowExecution, getWorkspace, hasChanges, initOperatorClient, inviteUser, isPluginGeneratedType, listApps, listExecutorJobs, listExecutors, listFolders, listFunctionRegistries, listMachineUsers, listOAuth2Clients, listOrganizations, listUsers, listWebhookExecutors, listWorkflowExecutions, listWorkflows, listWorkspaces, loadAccessToken, loadConfig, loadSeedContext, loadTailorDBNamespaces, loadWorkspaceId, generate$1 as migrateGenerate, organizationTree, query, reconstructSnapshotFromMigrations, remove, removeUser, restoreWorkspace, resumeWorkflow, serializeError, show, startWorkflow, triggerExecutor, truncate, updateFolder, updateOrganization, updateUser, waitForExecution, waitWorkflowExecution, watchExecutorJob };
86
+ export { type AIGatewayInfo, type ApiCallOptions, type ApiCallResult, type AppHealthInfo, type AppInfo, type ApplicationInfo, type DeployOptions as ApplyOptions, type AuthInvoker, type BreakingChangeInfo, type BundledScripts, type ChunkSeedDataOptions, type CreateFolderOptions, type CreateWorkspaceOptions, DB_TYPES_FILE_NAME, DIFF_FILE_NAME, type DeleteFolderOptions, type DeleteWorkspaceOptions, type DeployOptions, type ErrorToJsonOptions, type ExecutionWaitResult, type Executor, type ExecutorInfo, type ExecutorJobAttemptInfo, type ExecutorJobDetailInfo, type ExecutorJobInfo, type ExecutorJobListInfo, type ExecutorListInfo, type FolderInfo, type FolderListInfo, type FunctionRegistryInfo, type GenerateOptions, type GeneratorResult, type HealthOptions as GetAppHealthOptions, type GetExecutorJobTypedOptions, type GetExecutorTypedOptions, type GetFolderOptions, type GetFunctionRegistryOptions, type GetMachineUserTokenOptions, type GetOAuth2ClientOptions, type GetOrganizationOptions, type GetWorkflowExecutionOptions, type GetWorkflowExecutionResult, type GetWorkflowTypedOptions, type GetWorkspaceOptions, INITIAL_SCHEMA_NUMBER, type InviteUserOptions, type ListAppsOptions, type ListExecutorJobsTypedOptions, type ListExecutorsOptions, type ListFoldersOptions, type ListFunctionRegistriesOptions, type ListMachineUsersOptions, type ListOAuth2ClientsOptions, type ListOrganizationsOptions, type ListUsersOptions, type ListWebhookExecutorsOptions, type ListWorkflowExecutionsTypedOptions, type ListWorkflowsOptions, type ListWorkspacesOptions, type LoadSeedContextOptions, type LoadTailorDBNamespacesOptions, type LoadedConfig, type LoadedTailorDBNamespaces, MIGRATE_FILE_NAME, MIGRATE_TEST_FILE_NAME, MIGRATION_LABEL_KEY, type MachineUserInfo, type MachineUserName, type MachineUserTokenInfo, type GenerateOptions$1 as MigrateGenerateOptions, type MigrationBundleResult, type MigrationDiff, type NamespaceWithMigrations, type NormalizedSchemaSnapshot, type OAuth2ClientCredentials, type OAuth2ClientInfo, type OperatorClient, type OperatorFieldConfig, type OrganizationInfo, type OrganizationTreeOptions, type ParsedField, type Plugin, type PluginAttachment, type PluginGeneratedTypeSource, type RemoveOptions, type RemoveUserOptions, type Resolver, type RestoreWorkspaceOptions, type ResumeWorkflowOptions, type ResumeWorkflowResultWithWait, SCHEMA_FILE_NAME, type SchemaSnapshot, type ScriptExecutionOptions, type ScriptExecutionResult, type ScriptInvoker, type SeedBundleResult, type SeedChunk, type SeedContext, type SeedData, type SeedIdpUserContext, type SeedNamespaceConfig, type ShowInfo, type ShowOptions, type SnapshotFieldConfig, type StartWorkflowResultWithWait, type StartWorkflowTypedOptions, type DeployResult as StaticWebsiteDeployResult, type TailorDBNamespaceData, type TailorDBNamespaceSelector, type TailorDBSnapshotType, type TailorDBType, type TriggerExecutorResult, type TriggerExecutorTypedOptions, type TruncateOptions, type TypeSourceInfoEntry, type UpdateFolderOptions, type UpdateOrganizationOptions, type UpdateUserOptions, type UserInfo, type UserOrganizationInfo, type WaitOptions, type WaitWorkflowExecutionOptions, type WatchExecutorJobResult, type WatchExecutorJobTypedOptions, type WebhookExecutorInfo, type WorkflowExecutionInfo, type WorkflowExecutionWaitInfo, type WorkflowInfo, type WorkflowJobExecutionInfo, type WorkflowListInfo, type WorkflowWaitOutput, type WorkflowWaitResult, type WorkspaceDetails, type WorkspaceInfo, apiCall, deploy as apply, assertWritable, bundleMigrationScript, bundleSeedScript, chunkSeedData, compareLocalTypesWithSnapshot, compareSnapshots, createFolder, createSnapshotFromLocalTypes, createWorkspace, deleteFolder, deleteWorkspace, deploy, deployStaticWebsite, errorToJson, executeScript, formatDiffSummary, formatMigrationDiff, generate, generateUserTypes, getAppHealth, getExecutor, getExecutorJob, getExecutorWaitFailureMessage, getFolder, getFunctionRegistry, getLatestMigrationNumber, getMachineUserToken, getMigrationDirPath, getMigrationFilePath, getMigrationFiles, getNamespacesWithMigrations, getNextMigrationNumber, getOAuth2Client, getOrganization, getWorkflow, getWorkflowExecution, getWorkspace, hasChanges, initOperatorClient, inviteUser, isPluginGeneratedType, listApps, listExecutorJobs, listExecutors, listFolders, listFunctionRegistries, listMachineUsers, listOAuth2Clients, listOrganizations, listUsers, listWebhookExecutors, listWorkflowExecutions, listWorkflows, listWorkspaces, loadAccessToken, loadConfig, loadSeedContext, loadTailorDBNamespaces, loadWorkspaceId, generate$1 as migrateGenerate, organizationTree, query, reconstructSnapshotFromMigrations, remove, removeUser, restoreWorkspace, resumeWorkflow, serializeError, show, startWorkflow, triggerExecutor, truncate, updateFolder, updateOrganization, updateUser, waitForExecution, waitWorkflowExecution, watchExecutorJob };