@tailor-platform/sdk 2.4.0 → 2.6.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.
- package/CHANGELOG.md +131 -0
- package/bin/tailor.mjs +3 -2
- package/dist/aigateway-DsWDjzk4.mjs +2 -0
- package/dist/{aigateway-DR4Kwuik.mjs.map → aigateway-DsWDjzk4.mjs.map} +1 -1
- package/dist/application-CNeOcaLc.mjs +1 -0
- package/dist/application-CmXOqTaK.mjs +192 -0
- package/dist/application-CmXOqTaK.mjs.map +1 -0
- package/dist/assert-WeXvmG4j.mjs +2 -0
- package/dist/{assert-DBxo8jPo.mjs.map → assert-WeXvmG4j.mjs.map} +1 -1
- package/dist/authconnection-CynFBIv8.mjs +2 -0
- package/dist/{authconnection-CZvi9ANm.mjs.map → authconnection-CynFBIv8.mjs.map} +1 -1
- package/dist/brand-C8nMKhJC.mjs +2 -0
- package/dist/{brand-Eo4pLXPJ.mjs.map → brand-C8nMKhJC.mjs.map} +1 -1
- package/dist/cli/commands/api/index.d.mts +1 -1
- package/dist/cli/commands/deploy/deploy.d.mts +2 -2
- package/dist/cli/commands/deploy/deployment-target.d.mts +2 -0
- package/dist/cli/commands/deploy/event-subscriptions.d.mts +3 -0
- package/dist/cli/commands/deploy/tailordb/apply.d.mts +3 -0
- package/dist/cli/commands/deploy/tailordb/index.d.mts +3 -10
- package/dist/cli/commands/deploy/tailordb/migration-validation.d.mts +5 -0
- package/dist/cli/commands/deploy/tailordb/plan.d.mts +8 -0
- package/dist/cli/commands/executor/jobs.d.mts +1 -1
- package/dist/cli/commands/executor/trigger.d.mts +1 -1
- package/dist/cli/commands/generate/seed/bundler.d.mts +2 -2
- package/dist/cli/commands/show.d.mts +1 -1
- package/dist/cli/commands/tailordb/migrate/diff-calculator.d.mts +11 -11
- package/dist/cli/commands/tailordb/migrate/generate.d.mts +4 -0
- package/dist/cli/commands/tailordb/migrate/rename-detection.d.mts +1 -1
- package/dist/cli/commands/tailordb/migrate/snapshot-comparison.d.mts +43 -0
- package/dist/cli/commands/tailordb/migrate/snapshot-files.d.mts +62 -0
- package/dist/cli/commands/tailordb/migrate/snapshot-local.d.mts +12 -0
- package/dist/cli/commands/tailordb/migrate/snapshot-migrations.d.mts +12 -0
- package/dist/cli/commands/tailordb/migrate/snapshot-remote.d.mts +1 -0
- package/dist/cli/commands/tailordb/migrate/snapshot-types.d.mts +3 -1
- package/dist/cli/commands/tailordb/migrate/snapshot.d.mts +5 -117
- package/dist/cli/commands/workflow/start.d.mts +1 -1
- package/dist/cli/commands/workspace/list.d.mts +1 -1
- package/dist/cli/lib.d.mts +12 -4
- package/dist/cli/lib.mjs +1 -9
- package/dist/cli/lib.mjs.map +1 -1
- package/dist/cli/main.d.mts +2 -0
- package/dist/cli/main.mjs +1170 -7754
- package/dist/cli/main.mjs.map +1 -1
- package/dist/cli/shared/args.d.mts +65 -1
- package/dist/cli/shared/command.d.mts +11 -0
- package/dist/cli/shared/context.d.mts +1 -1
- package/dist/cli/shared/logger.d.mts +64 -0
- package/dist/cli/shared/script-executor.d.mts +1 -1
- package/dist/cli/shared/seed-chunker.d.mts +5 -5
- package/dist/completion/zsh-worker.zsh +82 -9
- package/dist/configure/config/index.d.mts +1 -1
- package/dist/configure/config/types.d.mts +2 -2
- package/dist/configure/index.d.mts +48 -12
- package/dist/configure/index.mjs +1 -1267
- package/dist/configure/index.mjs.map +1 -1
- package/dist/configure/services/auth/types.d.mts +1 -1
- package/dist/configure/services/idp/types.d.mts +1 -1
- package/dist/configure/services/tailordb/schema.d.mts +22 -8
- package/dist/configure/services/tailordb/types.d.mts +2 -2
- package/dist/configure/services/workflow/execution-policy.d.mts +3 -3
- package/dist/configure/services/workflow/job.d.mts +12 -2
- package/dist/configure/types/field.types.d.mts +1 -1
- package/dist/configure/types/permission-operand.types.d.mts +1 -1
- package/dist/context-D0QjfxzD.mjs +2 -0
- package/dist/{context-DYQVYWqZ.mjs.map → context-D0QjfxzD.mjs.map} +1 -1
- package/dist/crashreport-BN28xp5B.mjs +42 -0
- package/dist/{crashreport-Q0pDAlrj.mjs.map → crashreport-BN28xp5B.mjs.map} +1 -1
- package/dist/crashreport-By23O2k-.mjs +1 -0
- package/dist/errors-DLsQ_-ol.mjs +2 -0
- package/dist/errors-DLsQ_-ol.mjs.map +1 -0
- package/dist/es-builtins-n3wBv4Sv.mjs +2 -0
- package/dist/es-builtins-n3wBv4Sv.mjs.map +1 -0
- package/dist/file-COPYfju_.mjs +2 -0
- package/dist/file-COPYfju_.mjs.map +1 -0
- package/dist/globals-CMHSnj4w.mjs +2 -0
- package/dist/{globals-B2nlxBrz.mjs.map → globals-CMHSnj4w.mjs.map} +1 -1
- package/dist/iconv-DlFMt2gW.mjs +2 -0
- package/dist/{iconv-QWaZh0TT.mjs.map → iconv-DlFMt2gW.mjs.map} +1 -1
- package/dist/idp-G_ojPBB5.mjs +2 -0
- package/dist/{idp-RA_swu-h.mjs.map → idp-G_ojPBB5.mjs.map} +1 -1
- package/dist/interceptor-DQg3cR_9.mjs +2 -0
- package/dist/{interceptor-e33JtsC-.mjs.map → interceptor-DQg3cR_9.mjs.map} +1 -1
- package/dist/kysely/index.mjs +1 -32
- package/dist/kysely/index.mjs.map +1 -1
- package/dist/kysely-type-BTi3BMtL.mjs +43 -0
- package/dist/kysely-type-BTi3BMtL.mjs.map +1 -0
- package/dist/logger-CCjs1DuH.mjs +9 -0
- package/dist/logger-CCjs1DuH.mjs.map +1 -0
- package/dist/logger-DP2BjQ93.mjs +2 -0
- package/dist/{logger-BtX0suGY.mjs.map → logger-DP2BjQ93.mjs.map} +1 -1
- package/dist/multiline-EyzjEwn9.mjs +3 -0
- package/dist/{multiline-sfHpTZZK.mjs.map → multiline-EyzjEwn9.mjs.map} +1 -1
- package/dist/node-builtins-oBl7EbyV.mjs +2 -0
- package/dist/{node-builtins-CmaL2Cbq.mjs.map → node-builtins-oBl7EbyV.mjs.map} +1 -1
- package/dist/package-json-C690ceex.mjs +2 -0
- package/dist/{package-json-8b0O9TlX.mjs.map → package-json-C690ceex.mjs.map} +1 -1
- package/dist/package-json-CmqhDJ__.mjs +1 -0
- package/dist/parser/service/tailordb/type-source.d.mts +5 -5
- package/dist/parser/service/tailordb/types.d.mts +4 -4
- package/dist/platform-serialize-DkiTdHOt.mjs +2 -0
- package/dist/{platform-serialize-RoRtBS0v.mjs.map → platform-serialize-DkiTdHOt.mjs.map} +1 -1
- package/dist/plugin/builtin/enum-constants/index.mjs +5 -114
- package/dist/plugin/builtin/enum-constants/index.mjs.map +1 -1
- package/dist/plugin/builtin/file-utils/index.mjs +22 -104
- package/dist/plugin/builtin/file-utils/index.mjs.map +1 -1
- package/dist/plugin/builtin/kysely-type/index.d.mts +8 -1
- package/dist/plugin/builtin/kysely-type/index.mjs +1 -275
- package/dist/plugin/builtin/seed/index.d.mts +5 -0
- package/dist/plugin/builtin/seed/index.mjs +1 -3
- package/dist/plugin/builtin/seed/seed-type-processor.d.mts +0 -2
- package/dist/plugin/{get-generated-type.d.mts → get-generated-table.d.mts} +5 -5
- package/dist/plugin/index.d.mts +3 -2
- package/dist/plugin/index.mjs +1 -251
- package/dist/plugin/index.mjs.map +1 -1
- package/dist/plugin/types.d.mts +30 -23
- package/dist/plugin/with-context.d.mts +3 -3
- package/dist/register-ts-hook-oDA2JLp2.mjs +640 -0
- package/dist/register-ts-hook-oDA2JLp2.mjs.map +1 -0
- package/dist/registry-HlEaGvl5.mjs +2 -0
- package/dist/{registry-BIGVUrMB.mjs.map → registry-HlEaGvl5.mjs.map} +1 -1
- package/dist/repl-editor-BG1aDOfH.mjs +2 -0
- package/dist/{repl-editor-F9LotMNx.mjs.map → repl-editor-BG1aDOfH.mjs.map} +1 -1
- package/dist/runtime/aigateway.mjs +1 -3
- package/dist/runtime/authconnection.mjs +1 -3
- package/dist/runtime/context.mjs +1 -3
- package/dist/runtime/file.d.mts +21 -21
- package/dist/runtime/file.mjs +1 -3
- package/dist/runtime/globals.mjs +1 -1
- package/dist/runtime/iconv.mjs +1 -3
- package/dist/runtime/idp.mjs +1 -3
- package/dist/runtime/index.mjs +1 -11
- package/dist/runtime/logger.mjs +1 -3
- package/dist/runtime/secretmanager.mjs +1 -3
- package/dist/runtime/types.d.mts +1 -1
- package/dist/runtime/workflow.mjs +1 -3
- package/dist/schema-AYG4OhXY.mjs +2 -0
- package/dist/schema-AYG4OhXY.mjs.map +1 -0
- package/dist/secret-file-C9wp_FCX.mjs +2 -0
- package/dist/{secret-file-C3J4Gy8r.mjs.map → secret-file-C9wp_FCX.mjs.map} +1 -1
- package/dist/secretmanager-5olfnI1b.mjs +2 -0
- package/dist/{secretmanager-IY4UvinW.mjs.map → secretmanager-5olfnI1b.mjs.map} +1 -1
- package/dist/secretmanager-vHQoXdQz.mjs +2 -0
- package/dist/{secretmanager-CYlpffsz.mjs.map → secretmanager-vHQoXdQz.mjs.map} +1 -1
- package/dist/seed/index.mjs +8 -244
- package/dist/seed/index.mjs.map +1 -1
- package/dist/seed-DwqRFdqP.mjs +207 -0
- package/dist/seed-DwqRFdqP.mjs.map +1 -0
- package/dist/service-CLPMoj9n.mjs +2 -0
- package/dist/{service-LTfp03ZZ.mjs.map → service-CLPMoj9n.mjs.map} +1 -1
- package/dist/service-D7iXk0BT.mjs +1 -0
- package/dist/service-YqDsHmlK.mjs +7 -0
- package/dist/service-YqDsHmlK.mjs.map +1 -0
- package/dist/service_pb-DGKCLuAs.mjs +2 -0
- package/dist/{service_pb-BEWj1pOV.mjs.map → service_pb-DGKCLuAs.mjs.map} +1 -1
- package/dist/service_pb-_aeFE-Nv.mjs +1 -0
- package/dist/shared/src/color.d.mts +5 -0
- package/dist/tailor-proto/src/tailor/v1/workspace_pb.d.mts +1 -1
- package/dist/telemetry-Bklv9kQY.mjs +2 -0
- package/dist/{telemetry-BRVdwh14.mjs.map → telemetry-Bklv9kQY.mjs.map} +1 -1
- package/dist/telemetry-DXHP3VVi.mjs +1 -0
- package/dist/type-source--ZNcV8RJ.mjs +2 -0
- package/dist/type-source--ZNcV8RJ.mjs.map +1 -0
- package/dist/types/executor.generated.d.mts +1 -1
- package/dist/user-agent-vdHYF3QL.mjs +2 -0
- package/dist/{user-agent-Bgsszb5I.mjs.map → user-agent-vdHYF3QL.mjs.map} +1 -1
- package/dist/utils/test/index.mjs +1 -109
- package/dist/utils/test/index.mjs.map +1 -1
- package/dist/vitest/environment.mjs +1 -41
- package/dist/vitest/environment.mjs.map +1 -1
- package/dist/vitest/index.mjs +1 -1986
- package/dist/vitest/index.mjs.map +1 -1
- package/dist/vitest/mocks/file.d.mts +8 -8
- package/dist/vitest/setup.mjs +1 -140
- package/dist/vitest/setup.mjs.map +1 -1
- package/dist/wait-point-invoker-eiP-IIux.mjs +2 -0
- package/dist/wait-point-invoker-eiP-IIux.mjs.map +1 -0
- package/dist/wait-point-registry-B-ESkTZX.mjs +2 -0
- package/dist/wait-point-registry-B-ESkTZX.mjs.map +1 -0
- package/dist/workflow-Cs9ISw6j.mjs +2 -0
- package/dist/{workflow-Bamae_Yc.mjs.map → workflow-Cs9ISw6j.mjs.map} +1 -1
- package/dist/workspace_resource_pb--GeYQPXu.mjs +2 -0
- package/dist/{workspace_resource_pb-HNIL_Vfj.mjs.map → workspace_resource_pb--GeYQPXu.mjs.map} +1 -1
- package/docs/cli/function.md +66 -6
- package/docs/cli/setup.md +24 -14
- package/docs/cli/tailordb.md +2 -0
- package/docs/cli-reference.md +9 -8
- package/docs/github-actions.md +14 -12
- package/docs/migration/v2.md +18 -2
- package/docs/migration/v3.md +121 -0
- package/docs/plugin/custom.md +130 -85
- package/docs/plugin/index.md +3 -3
- package/docs/services/tailordb-migration.md +21 -7
- package/docs/services/tailordb.md +9 -7
- package/docs/services/workflow.md +10 -9
- package/package.json +14 -13
- package/postinstall.mjs +1 -1
- package/dist/aigateway-DR4Kwuik.mjs +0 -9
- package/dist/application-C8a0UJ-z.mjs +0 -6071
- package/dist/application-C8a0UJ-z.mjs.map +0 -1
- package/dist/application-D4zOiLLa.mjs +0 -3
- package/dist/assert-DBxo8jPo.mjs +0 -9
- package/dist/authconnection-CZvi9ANm.mjs +0 -9
- package/dist/brand-Eo4pLXPJ.mjs +0 -36
- package/dist/context-DYQVYWqZ.mjs +0 -23
- package/dist/crashreport-Cd4TqfZq.mjs +0 -3
- package/dist/crashreport-Q0pDAlrj.mjs +0 -427
- package/dist/errors-Bxut5_Sy.mjs +0 -89
- package/dist/errors-Bxut5_Sy.mjs.map +0 -1
- package/dist/file-BUcmVIH2.mjs +0 -58
- package/dist/file-BUcmVIH2.mjs.map +0 -1
- package/dist/globals-B2nlxBrz.mjs +0 -126
- package/dist/iconv-QWaZh0TT.mjs +0 -38
- package/dist/idp-RA_swu-h.mjs +0 -82
- package/dist/interceptor-e33JtsC-.mjs +0 -33
- package/dist/logger-BtX0suGY.mjs +0 -48
- package/dist/logger-D0bEznPv.mjs +0 -362
- package/dist/logger-D0bEznPv.mjs.map +0 -1
- package/dist/multiline-sfHpTZZK.mjs +0 -38
- package/dist/node-builtins-CmaL2Cbq.mjs +0 -36
- package/dist/package-json-8b0O9TlX.mjs +0 -17
- package/dist/package-json-Cv2Z-TqQ.mjs +0 -3
- package/dist/platform-serialize-RoRtBS0v.mjs +0 -46
- package/dist/plugin/builtin/kysely-type/index.mjs.map +0 -1
- package/dist/plugin/builtin/seed/types.d.mts +0 -2
- package/dist/register-ts-hook-Vqjza10T.mjs +0 -25679
- package/dist/register-ts-hook-Vqjza10T.mjs.map +0 -1
- package/dist/registry-BIGVUrMB.mjs +0 -54
- package/dist/repl-editor-F9LotMNx.mjs +0 -252
- package/dist/schema-D4TC4BC3.mjs +0 -640
- package/dist/schema-D4TC4BC3.mjs.map +0 -1
- package/dist/secret-file-C3J4Gy8r.mjs +0 -64
- package/dist/secretmanager-CYlpffsz.mjs +0 -13
- package/dist/secretmanager-IY4UvinW.mjs +0 -131
- package/dist/seed-Cibjmtry.mjs +0 -489
- package/dist/seed-Cibjmtry.mjs.map +0 -1
- package/dist/service-2grcAOCJ.mjs +0 -898
- package/dist/service-2grcAOCJ.mjs.map +0 -1
- package/dist/service-CaBPNDIZ.mjs +0 -3
- package/dist/service-LTfp03ZZ.mjs +0 -133
- package/dist/service_pb-BEWj1pOV.mjs +0 -167
- package/dist/service_pb-BjlhvK9E.mjs +0 -3
- package/dist/telemetry-BRVdwh14.mjs +0 -84
- package/dist/telemetry-CkbkeJxl.mjs +0 -3
- package/dist/type-source-DH_LH20p.mjs +0 -13
- package/dist/type-source-DH_LH20p.mjs.map +0 -1
- package/dist/user-agent-Bgsszb5I.mjs +0 -28
- package/dist/wait-point-invoker-__oE88_P.mjs +0 -148
- package/dist/wait-point-invoker-__oE88_P.mjs.map +0 -1
- package/dist/wait-point-registry-TL99zotw.mjs +0 -47
- package/dist/wait-point-registry-TL99zotw.mjs.map +0 -1
- package/dist/workflow-Bamae_Yc.mjs +0 -34
- package/dist/workspace_resource_pb-HNIL_Vfj.mjs +0 -860
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assert-
|
|
1
|
+
{"version":3,"file":"assert-WeXvmG4j.mjs","names":[],"sources":["../src/utils/assert.ts"],"sourcesContent":["export function assertDefined<T>(value: T, message: string): NonNullable<T> {\n if (value == null) {\n throw new Error(message);\n }\n return value;\n}\n"],"mappings":"AAAA,SAAgB,cAAiB,EAAU,EAAiC,CAC1E,GAAI,GAAS,KACX,MAAU,MAAM,CAAO,EAEzB,OAAO,CACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authconnection-
|
|
1
|
+
{"version":3,"file":"authconnection-CynFBIv8.mjs","names":[],"sources":["../src/runtime/authconnection.ts"],"sourcesContent":["/**\n * Auth connection utilities.\n *\n * Thin typed wrapper around the platform-provided `tailor.authconnection` runtime API.\n * At runtime this delegates to `globalThis.tailor.authconnection`. Use\n * `mockAuthconnection` from `@tailor-platform/sdk/vitest` to mock in unit tests.\n *\n * `connectionName` is narrowed to the connection names defined in `defineAuth()`'s\n * `connections` once `tailor.d.ts` has been generated (via `tailor deploy`/`generate`).\n * @example\n * import { authconnection } from \"@tailor-platform/sdk/runtime\";\n *\n * const token = await authconnection.getConnectionToken(\"my-connection\");\n */\n\nimport type { AuthConnectionTokenResult } from \"#/configure/services/auth/types\";\n// Import from the public entry (not `#/configure/types/connection-name`) so this d.ts\n// references `@tailor-platform/sdk` externally instead of inlining the registry — a single\n// generated `declare module \"@tailor-platform/sdk\"` then narrows this entry too.\nimport type { ConnectionName } from \"@tailor-platform/sdk\";\n\n/**\n * Platform API surface for `tailor.authconnection`. Describes the shape the\n * platform runtime injects on `globalThis.tailor.authconnection`.\n */\nexport interface TailorAuthconnectionAPI {\n /**\n * Returns the access token for the given auth connection.\n * @param connectionName - Auth connection name as defined in tailor.config\n * @returns Token payload\n */\n getConnectionToken(connectionName: ConnectionName): Promise<AuthConnectionTokenResult>;\n}\n\nconst api = (): TailorAuthconnectionAPI =>\n (globalThis as unknown as { tailor: { authconnection: TailorAuthconnectionAPI } }).tailor\n .authconnection;\n\nconst getConnectionToken: TailorAuthconnectionAPI[\"getConnectionToken\"] = (...args) =>\n api().getConnectionToken(...args);\n\n/** Runtime wrapper namespace for `tailor.authconnection`. */\nexport const authconnection = { getConnectionToken } as const satisfies TailorAuthconnectionAPI;\n"],"mappings":"AAkCA,MAAM,QACH,WAAkF,OAChF,eAMQ,EAAiB,CAAE,oBAJ2C,GAAG,IAC5E,IAAI,CAAC,CAAC,mBAAmB,GAAG,CAAI,CAGiB"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=Symbol.for(`tailor-platform/sdk`);function brandValue(t,n){return Object.defineProperty(t,e,{value:n,enumerable:!1,configurable:!1,writable:!1}),t}function isSdkBranded(t,n){if(typeof t!=`object`||!t||!(e in t))return!1;let r=t[e];return n===void 0||r===!0||(Array.isArray(n)?n.includes(r):r===n)}export{isSdkBranded as n,brandValue as t};
|
|
2
|
+
//# sourceMappingURL=brand-C8nMKhJC.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"brand-
|
|
1
|
+
{"version":3,"file":"brand-C8nMKhJC.mjs","names":[],"sources":["../src/utils/brand.ts"],"sourcesContent":["// Symbol.for ensures the same symbol is returned across different ESM module instances,\n// avoiding identity mismatches when multiple copies of the SDK are loaded.\nexport const SDK_BRAND: unique symbol = Symbol.for(\"tailor-platform/sdk\");\n\nexport type SdkBrandKind =\n | \"tailordb-type\"\n | \"resolver\"\n | \"executor\"\n | \"workflow\"\n | \"workflow-job\"\n | \"wait-point\"\n | \"execution-policy\"\n | \"http-adapter\";\n\n/**\n * Adds a non-enumerable SDK brand symbol to the given object (in-place).\n * The brand stores the kind so service loaders can distinguish between\n * different SDK object types (e.g. a type loader skips executors).\n * @param value - The object to brand\n * @param kind - The kind of SDK object\n * @returns The same object with the brand applied\n */\nexport function brandValue<T extends object>(value: T, kind: SdkBrandKind): T {\n Object.defineProperty(value, SDK_BRAND, {\n value: kind,\n enumerable: false,\n configurable: false,\n writable: false,\n });\n return value;\n}\n\n/**\n * Checks whether the given value has been branded by the SDK.\n * When kind is specified, only returns true if the brand matches that kind.\n * Accepts a single kind or an array of kinds for multi-kind matching.\n * @param value - The value to check\n * @param kind - Optional kind or kinds to match against\n * @returns True if the value has the SDK brand symbol (and matches kind if specified)\n */\nexport function isSdkBranded(\n value: unknown,\n kind?: SdkBrandKind | readonly SdkBrandKind[],\n): boolean {\n if (value === null || typeof value !== \"object\" || !(SDK_BRAND in value)) return false;\n const stored = (value as Record<symbol, unknown>)[SDK_BRAND];\n // No kind filter → any brand matches. Legacy `true` brand → matches any kind.\n return (\n kind === undefined ||\n stored === true ||\n (Array.isArray(kind) ? kind.includes(stored) : stored === kind)\n );\n}\n"],"mappings":"AAEA,MAAa,EAA2B,OAAO,IAAI,qBAAqB,EAoBxE,SAAgB,WAA6B,EAAU,EAAuB,CAO5E,OANA,OAAO,eAAe,EAAO,EAAW,CACtC,MAAO,EACP,WAAY,GACZ,aAAc,GACd,SAAU,EACZ,CAAC,EACM,CACT,CAUA,SAAgB,aACd,EACA,EACS,CACT,GAAsB,OAAO,GAAU,WAAnC,GAA+C,EAAE,KAAa,GAAQ,MAAO,GACjF,IAAM,EAAU,EAAkC,GAElD,OACE,IAAS,IAAA,IACT,IAAW,KACV,MAAM,QAAQ,CAAI,EAAI,EAAK,SAAS,CAAM,EAAI,IAAW,EAE9D"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { BundledScripts } from "./function-registry-types.mjs";
|
|
2
|
-
import "../../shared/config-loader.mjs";
|
|
3
2
|
import "../../services/application.mjs";
|
|
4
3
|
import "../../shared/client.mjs";
|
|
5
|
-
import "./label.mjs";
|
|
6
4
|
import "./types.mjs";
|
|
7
5
|
import "./apply-phases.mjs";
|
|
6
|
+
import "./deployment-target.mjs";
|
|
7
|
+
import "./event-subscriptions.mjs";
|
|
8
8
|
//#region src/cli/commands/deploy/deploy.d.ts
|
|
9
9
|
interface DeployOptions {
|
|
10
10
|
workspaceId?: string;
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
import "../../../shared/config-loader.mjs";
|
|
2
|
-
import "../../../services/application.mjs";
|
|
3
|
-
import "../../../../tailor-proto/src/tailor/v1/tailordb_pb.mjs";
|
|
4
|
-
import "../../../shared/client.mjs";
|
|
5
|
-
import "../label.mjs";
|
|
6
|
-
import "../../tailordb/migrate/snapshot.mjs";
|
|
7
|
-
import "../types.mjs";
|
|
8
|
-
import "../../tailordb/migrate/config.mjs";
|
|
9
|
-
import "../../tailordb/migrate/schema-checks.mjs";
|
|
10
1
|
import "../../tailordb/migrate/file-state.mjs";
|
|
11
|
-
import
|
|
2
|
+
import "./plan.mjs";
|
|
3
|
+
import "./apply.mjs";
|
|
4
|
+
import "./migration-validation.mjs";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import "../../../services/application.mjs";
|
|
2
|
+
import "../../../../tailor-proto/src/tailor/v1/tailordb_pb.mjs";
|
|
3
|
+
import "../label.mjs";
|
|
4
|
+
import "../types.mjs";
|
|
5
|
+
import "../../tailordb/migrate/config.mjs";
|
|
6
|
+
import "../../tailordb/migrate/schema-checks.mjs";
|
|
7
|
+
import "../../../lib.mjs";
|
|
8
|
+
import { MessageInitShape } from "@bufbuild/protobuf";
|
|
@@ -82,4 +82,4 @@ declare function watchExecutorJob<E extends ExecutorLike>(options: WatchExecutor
|
|
|
82
82
|
*/
|
|
83
83
|
declare function getExecutorWaitFailureMessage(result: WatchExecutorJobResult): string | undefined;
|
|
84
84
|
//#endregion
|
|
85
|
-
export { ExecutorJobDetailInfo, GetExecutorJobTypedOptions, ListExecutorJobsTypedOptions, WatchExecutorJobResult, WatchExecutorJobTypedOptions,
|
|
85
|
+
export { ExecutorJobDetailInfo, GetExecutorJobTypedOptions, ListExecutorJobsTypedOptions, WatchExecutorJobResult, WatchExecutorJobTypedOptions, getExecutorJob, getExecutorWaitFailureMessage, listExecutorJobs, watchExecutorJob };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IncomingWebhookTrigger, ScheduleTriggerInput } from "../../../types/executor.generated.mjs";
|
|
2
|
-
import { z } from "zod";
|
|
3
2
|
import { JsonObject } from "@bufbuild/protobuf";
|
|
3
|
+
import { z } from "zod";
|
|
4
4
|
//#region src/cli/commands/executor/trigger.d.ts
|
|
5
5
|
type ManualTrigger = IncomingWebhookTrigger | ScheduleTriggerInput;
|
|
6
6
|
type ManualTriggerExecutor<T extends ManualTrigger = ManualTrigger> = T extends ManualTrigger ? {
|
|
@@ -18,10 +18,10 @@ type SeedBundleResult = {
|
|
|
18
18
|
* 3. Reports progress via console.log
|
|
19
19
|
* 4. Exports as main() for TestExecScript
|
|
20
20
|
* @param namespace - TailorDB namespace
|
|
21
|
-
* @param
|
|
21
|
+
* @param tableNames - List of table names to include in the seed
|
|
22
22
|
* @param baseDir - Directory whose dependencies and tsconfig the generated entry uses
|
|
23
23
|
* @returns Bundled seed script result
|
|
24
24
|
*/
|
|
25
|
-
declare function bundleSeedScript(namespace: string,
|
|
25
|
+
declare function bundleSeedScript(namespace: string, tableNames: string[], baseDir?: string): Promise<SeedBundleResult>;
|
|
26
26
|
//#endregion
|
|
27
27
|
export { SeedBundleResult, bundleSeedScript };
|
|
@@ -36,4 +36,4 @@ interface ShowInfo extends ApplicationInfo, WorkspaceInfo {
|
|
|
36
36
|
*/
|
|
37
37
|
declare function show(options?: ShowOptions): Promise<ShowInfo>;
|
|
38
38
|
//#endregion
|
|
39
|
-
export { AIGatewayInfo, ApplicationInfo, ShowInfo, ShowOptions,
|
|
39
|
+
export { AIGatewayInfo, ApplicationInfo, ShowInfo, ShowOptions, show };
|
|
@@ -66,13 +66,13 @@ interface TableSettingsModifiedChange extends DiffChangeBase {
|
|
|
66
66
|
before: SnapshotTypeSettingsState;
|
|
67
67
|
after: SnapshotTypeSettingsState;
|
|
68
68
|
}
|
|
69
|
-
/** A field was added to a
|
|
69
|
+
/** A field was added to a table. */
|
|
70
70
|
interface FieldAddedChange extends DiffChangeBase {
|
|
71
71
|
kind: "field_added";
|
|
72
72
|
fieldName: string;
|
|
73
73
|
after: SnapshotFieldConfig;
|
|
74
74
|
}
|
|
75
|
-
/** A field was removed from a
|
|
75
|
+
/** A field was removed from a table. */
|
|
76
76
|
interface FieldRemovedChange extends DiffChangeBase {
|
|
77
77
|
kind: "field_removed";
|
|
78
78
|
fieldName: string;
|
|
@@ -86,7 +86,7 @@ interface FieldModifiedChange extends DiffChangeBase {
|
|
|
86
86
|
after: SnapshotFieldConfig;
|
|
87
87
|
}
|
|
88
88
|
/**
|
|
89
|
-
* A field was renamed within a
|
|
89
|
+
* A field was renamed within a table. Recorded when the user confirms that a
|
|
90
90
|
* removed + added field pair is a rename (interactively or via `--rename`).
|
|
91
91
|
* `fieldName` is the new name; `previousFieldName` is the old name.
|
|
92
92
|
*/
|
|
@@ -104,13 +104,13 @@ interface FieldTypeModifiedChange extends DiffChangeBase {
|
|
|
104
104
|
before: SnapshotFieldConfig;
|
|
105
105
|
after: SnapshotFieldConfig;
|
|
106
106
|
}
|
|
107
|
-
/** An index was added to a
|
|
107
|
+
/** An index was added to a table. */
|
|
108
108
|
interface IndexAddedChange extends DiffChangeBase {
|
|
109
109
|
kind: "index_added";
|
|
110
110
|
indexName: string;
|
|
111
111
|
after: SnapshotIndexConfig;
|
|
112
112
|
}
|
|
113
|
-
/** An index was removed from a
|
|
113
|
+
/** An index was removed from a table. */
|
|
114
114
|
interface IndexRemovedChange extends DiffChangeBase {
|
|
115
115
|
kind: "index_removed";
|
|
116
116
|
indexName: string;
|
|
@@ -123,13 +123,13 @@ interface IndexModifiedChange extends DiffChangeBase {
|
|
|
123
123
|
before: SnapshotIndexConfig;
|
|
124
124
|
after: SnapshotIndexConfig;
|
|
125
125
|
}
|
|
126
|
-
/** A file field was added to a
|
|
126
|
+
/** A file field was added to a table. `before`/`after` hold the description. */
|
|
127
127
|
interface FileAddedChange extends DiffChangeBase {
|
|
128
128
|
kind: "file_added";
|
|
129
129
|
fieldName: string;
|
|
130
130
|
after: string;
|
|
131
131
|
}
|
|
132
|
-
/** A file field was removed from a
|
|
132
|
+
/** A file field was removed from a table. */
|
|
133
133
|
interface FileRemovedChange extends DiffChangeBase {
|
|
134
134
|
kind: "file_removed";
|
|
135
135
|
fieldName: string;
|
|
@@ -143,7 +143,7 @@ interface FileModifiedChange extends DiffChangeBase {
|
|
|
143
143
|
after: string;
|
|
144
144
|
}
|
|
145
145
|
/**
|
|
146
|
-
* A relationship was added to a
|
|
146
|
+
* A relationship was added to a table. `relationshipType` is optional for
|
|
147
147
|
* backward compatibility: diff.json files written by older SDK versions
|
|
148
148
|
* predate the field.
|
|
149
149
|
*/
|
|
@@ -153,7 +153,7 @@ interface RelationshipAddedChange extends DiffChangeBase {
|
|
|
153
153
|
relationshipType?: "forward" | "backward";
|
|
154
154
|
after: SnapshotRelationship;
|
|
155
155
|
}
|
|
156
|
-
/** A relationship was removed from a
|
|
156
|
+
/** A relationship was removed from a table. */
|
|
157
157
|
interface RelationshipRemovedChange extends DiffChangeBase {
|
|
158
158
|
kind: "relationship_removed";
|
|
159
159
|
relationshipName: string;
|
|
@@ -212,7 +212,7 @@ interface MigrationDiff {
|
|
|
212
212
|
hasBreakingChanges: boolean;
|
|
213
213
|
/** List of breaking changes */
|
|
214
214
|
breakingChanges: BreakingChangeInfo[];
|
|
215
|
-
/** Whether there are non-breaking changes that may cause data loss (e.g. field/
|
|
215
|
+
/** Whether there are non-breaking changes that may cause data loss (e.g. field/table removal) */
|
|
216
216
|
hasWarnings: boolean;
|
|
217
217
|
/** List of non-breaking warnings */
|
|
218
218
|
warnings: WarningChangeInfo[];
|
|
@@ -245,7 +245,7 @@ interface BreakingChangeInfo {
|
|
|
245
245
|
* Warning change information in migration diff.
|
|
246
246
|
*
|
|
247
247
|
* Warnings are non-breaking changes that may still cause data loss
|
|
248
|
-
* (e.g. removing a field or
|
|
248
|
+
* (e.g. removing a field or table). Unlike breaking changes, a migration
|
|
249
249
|
* script is not required, but writing one is recommended if you need to
|
|
250
250
|
* preserve or transform data before the change applies.
|
|
251
251
|
*/
|
|
@@ -5,6 +5,10 @@ interface GenerateOptions {
|
|
|
5
5
|
name?: string;
|
|
6
6
|
yes?: boolean;
|
|
7
7
|
init?: boolean;
|
|
8
|
+
/** Create a migration with no schema changes that exists to run a migration script. */
|
|
9
|
+
dataOnly?: boolean;
|
|
10
|
+
/** Namespace the `--data-only` migration targets. */
|
|
11
|
+
namespace?: string;
|
|
8
12
|
/** `--rename Table.oldField:newField` / `--rename OldTable:NewTable` values confirming renames non-interactively. */
|
|
9
13
|
renames?: string[];
|
|
10
14
|
/** `--drop Table.field` / `--drop Table` values confirming removals non-interactively. */
|
|
@@ -10,7 +10,7 @@ interface FieldRenameSpec {
|
|
|
10
10
|
fieldName: string;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
* A confirmed
|
|
13
|
+
* A confirmed table rename to record in the migration diff.
|
|
14
14
|
*/
|
|
15
15
|
interface TypeRenameSpec {
|
|
16
16
|
/** Type name before the rename. */
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { NormalizedSchemaSnapshot, SchemaSnapshot, TailorDBSnapshotType } from "./snapshot-types.mjs";
|
|
2
|
+
import { MigrationDiff } from "./diff-calculator.mjs";
|
|
3
|
+
import { FieldRenameSpec, TypeRenameSpec } from "./rename-detection.mjs";
|
|
4
|
+
//#region src/cli/commands/tailordb/migrate/snapshot-comparison.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Options for {@link compareSnapshots}.
|
|
7
|
+
*/
|
|
8
|
+
interface CompareSnapshotsOptions {
|
|
9
|
+
/**
|
|
10
|
+
* Confirmed field renames. Each spec replaces the corresponding
|
|
11
|
+
* `field_removed` + `field_added` pair with a single breaking
|
|
12
|
+
* `field_renamed` change. Specs are validated against both snapshots.
|
|
13
|
+
*/
|
|
14
|
+
fieldRenames?: readonly FieldRenameSpec[];
|
|
15
|
+
/**
|
|
16
|
+
* Confirmed table renames. Each spec replaces the corresponding
|
|
17
|
+
* `table_removed` + `table_added` pair with a single breaking
|
|
18
|
+
* `table_renamed` change. Specs are validated against both snapshots.
|
|
19
|
+
*/
|
|
20
|
+
typeRenames?: readonly TypeRenameSpec[];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Compare two normalized snapshots and generate a diff
|
|
24
|
+
* @param {NormalizedSchemaSnapshot} previous - Previous normalized snapshot
|
|
25
|
+
* @param {NormalizedSchemaSnapshot} current - Current normalized snapshot
|
|
26
|
+
* @param {CompareSnapshotsOptions} [options] - Comparison options
|
|
27
|
+
* @returns {MigrationDiff} Migration diff between snapshots
|
|
28
|
+
*/
|
|
29
|
+
declare function compareSnapshots(previous: NormalizedSchemaSnapshot, current: NormalizedSchemaSnapshot, options?: CompareSnapshotsOptions): MigrationDiff;
|
|
30
|
+
/**
|
|
31
|
+
* Compare a snapshot against canonical TailorDBSnapshotType-shaped local tables.
|
|
32
|
+
* Callers are expected to pre-convert TailorDBService.types to TailorDBSnapshotType via
|
|
33
|
+
* `createSnapshotType`. As a safety net, both sides are re-run through idempotent
|
|
34
|
+
* normalization here, so a caller that forgets will still get correct
|
|
35
|
+
* comparisons (no silent false drift).
|
|
36
|
+
* @param {SchemaSnapshot} snapshot - Schema snapshot to compare against
|
|
37
|
+
* @param {Record<string, TailorDBSnapshotType>} localTypes - Local snapshot-shaped tables
|
|
38
|
+
* @param {string} namespace - Namespace for comparison
|
|
39
|
+
* @returns {MigrationDiff} Migration diff
|
|
40
|
+
*/
|
|
41
|
+
declare function compareLocalTypesWithSnapshot(snapshot: SchemaSnapshot, localTypes: Record<string, TailorDBSnapshotType>, namespace: string): MigrationDiff;
|
|
42
|
+
//#endregion
|
|
43
|
+
export { CompareSnapshotsOptions, compareLocalTypesWithSnapshot, compareSnapshots };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
//#region src/cli/commands/tailordb/migrate/snapshot-files.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Initial schema migration number (0000)
|
|
4
|
+
*/
|
|
5
|
+
declare const INITIAL_SCHEMA_NUMBER = 0;
|
|
6
|
+
/**
|
|
7
|
+
* Migration file names (used within migration directories)
|
|
8
|
+
*/
|
|
9
|
+
declare const SCHEMA_FILE_NAME = "schema.json";
|
|
10
|
+
/** File name for migration diff metadata. */
|
|
11
|
+
declare const DIFF_FILE_NAME = "diff.json";
|
|
12
|
+
/** File name for migration script. */
|
|
13
|
+
declare const MIGRATE_FILE_NAME = "migrate.ts";
|
|
14
|
+
/** File name for migration script unit test. */
|
|
15
|
+
declare const MIGRATE_TEST_FILE_NAME = "migrate.test.ts";
|
|
16
|
+
/** File name for generated DB type definitions. */
|
|
17
|
+
declare const DB_TYPES_FILE_NAME = "db.ts";
|
|
18
|
+
/**
|
|
19
|
+
* Migration file type
|
|
20
|
+
*/
|
|
21
|
+
type MigrationFileType = "schema" | "diff" | "migrate" | "test" | "db";
|
|
22
|
+
/**
|
|
23
|
+
* Get migration directory path for a given number
|
|
24
|
+
* @param {string} migrationsDir - Base migrations directory path
|
|
25
|
+
* @param {number} num - Migration number
|
|
26
|
+
* @returns {string} Full directory path for the migration
|
|
27
|
+
*/
|
|
28
|
+
declare function getMigrationDirPath(migrationsDir: string, num: number): string;
|
|
29
|
+
/**
|
|
30
|
+
* Get migration file path for a given number and type
|
|
31
|
+
* @param {string} migrationsDir - Migrations directory path
|
|
32
|
+
* @param {number} num - Migration number
|
|
33
|
+
* @param {MigrationFileType} type - File type
|
|
34
|
+
* @returns {string} Full file path
|
|
35
|
+
*/
|
|
36
|
+
declare function getMigrationFilePath(migrationsDir: string, num: number, type: MigrationFileType): string;
|
|
37
|
+
/**
|
|
38
|
+
* Get all migration directories and their files, sorted by number
|
|
39
|
+
* @param {string} migrationsDir - Migrations directory path
|
|
40
|
+
* @returns {Array<{number: number, type: "schema" | "diff", path: string}>} Migration files sorted by number
|
|
41
|
+
*/
|
|
42
|
+
declare function getMigrationFiles(migrationsDir: string): {
|
|
43
|
+
number: number;
|
|
44
|
+
type: "schema" | "diff";
|
|
45
|
+
path: string;
|
|
46
|
+
}[];
|
|
47
|
+
/**
|
|
48
|
+
* Get the next migration number for a directory
|
|
49
|
+
* Returns INITIAL_SCHEMA_NUMBER (0) if no migrations exist
|
|
50
|
+
* @param {string} migrationsDir - Migrations directory path
|
|
51
|
+
* @returns {number} Next migration number
|
|
52
|
+
*/
|
|
53
|
+
declare function getNextMigrationNumber(migrationsDir: string): number;
|
|
54
|
+
/**
|
|
55
|
+
* Get the latest migration number from a directory
|
|
56
|
+
* Returns 0 if no migrations exist
|
|
57
|
+
* @param {string} migrationsDir - Migrations directory path
|
|
58
|
+
* @returns {number} Latest migration number or 0 if no migrations exist
|
|
59
|
+
*/
|
|
60
|
+
declare function getLatestMigrationNumber(migrationsDir: string): number;
|
|
61
|
+
//#endregion
|
|
62
|
+
export { DB_TYPES_FILE_NAME, DIFF_FILE_NAME, INITIAL_SCHEMA_NUMBER, MIGRATE_FILE_NAME, MIGRATE_TEST_FILE_NAME, MigrationFileType, SCHEMA_FILE_NAME, getLatestMigrationNumber, getMigrationDirPath, getMigrationFilePath, getMigrationFiles, getNextMigrationNumber };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TailorDBType } from "../../../../parser/service/tailordb/types.mjs";
|
|
2
|
+
import { NormalizedSchemaSnapshot } from "./snapshot-types.mjs";
|
|
3
|
+
//#region src/cli/commands/tailordb/migrate/snapshot-local.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Create a schema snapshot from local table definitions
|
|
6
|
+
* @param {Record<string, TailorDBType>} types - Local table definitions
|
|
7
|
+
* @param {string} namespace - Namespace for the snapshot
|
|
8
|
+
* @returns {NormalizedSchemaSnapshot} Normalized schema snapshot
|
|
9
|
+
*/
|
|
10
|
+
declare function createSnapshotFromLocalTypes(types: Record<string, TailorDBType>, namespace: string): NormalizedSchemaSnapshot;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { createSnapshotFromLocalTypes };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { NormalizedSchemaSnapshot } from "./snapshot-types.mjs";
|
|
2
|
+
//#region src/cli/commands/tailordb/migrate/snapshot-migrations.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Reconstruct the latest schema snapshot from all migration files
|
|
5
|
+
* Returns null if no migrations exist
|
|
6
|
+
* @param {string} migrationsDir - Migrations directory path
|
|
7
|
+
* @param {number} [maxVersion] - Optional maximum migration version to apply
|
|
8
|
+
* @returns {NormalizedSchemaSnapshot | null} Reconstructed normalized snapshot or null if no migrations exist
|
|
9
|
+
*/
|
|
10
|
+
declare function reconstructSnapshotFromMigrations(migrationsDir: string, maxVersion?: number): NormalizedSchemaSnapshot | null;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { reconstructSnapshotFromMigrations };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "../../../../tailor-proto/src/tailor/v1/tailordb_resource_pb.mjs";
|
|
@@ -60,6 +60,8 @@ interface SnapshotFieldConfig {
|
|
|
60
60
|
serial?: SnapshotSerial;
|
|
61
61
|
scale?: number;
|
|
62
62
|
default?: unknown;
|
|
63
|
+
/** Recorded on remote-derived snapshots when the platform fills the value on create. */
|
|
64
|
+
optionalOnCreate?: boolean;
|
|
63
65
|
/** Nested fields (recursive) */
|
|
64
66
|
fields?: Record<string, SnapshotFieldConfig>;
|
|
65
67
|
}
|
|
@@ -212,4 +214,4 @@ type NormalizedSchemaSnapshot = SchemaSnapshot & {
|
|
|
212
214
|
readonly [normalizedSchemaSnapshotBrand]: true;
|
|
213
215
|
};
|
|
214
216
|
//#endregion
|
|
215
|
-
export { NormalizedSchemaSnapshot, RebaselineMarker, SchemaSnapshot, SnapshotActionPermission, SnapshotEnumValue, SnapshotFieldConfig, SnapshotFieldRefOperand, SnapshotGqlAction, SnapshotGqlPermission, SnapshotGqlPermissionPolicy, SnapshotHook, SnapshotIndexConfig, SnapshotPermissionCondition, SnapshotPermissionOperand, SnapshotPermissionOperator, SnapshotRecordPermission, SnapshotRelationship, SnapshotSerial, SnapshotValidation,
|
|
217
|
+
export { NormalizedSchemaSnapshot, RebaselineMarker, SchemaSnapshot, SnapshotActionPermission, SnapshotEnumValue, SnapshotFieldConfig, SnapshotFieldRefOperand, SnapshotGqlAction, SnapshotGqlPermission, SnapshotGqlPermissionPolicy, SnapshotHook, SnapshotIndexConfig, SnapshotPermissionCondition, SnapshotPermissionOperand, SnapshotPermissionOperator, SnapshotRecordPermission, SnapshotRelationship, SnapshotSerial, SnapshotValidation, TailorDBSnapshotType };
|
|
@@ -1,119 +1,7 @@
|
|
|
1
|
-
import { TailorDBType } from "../../../../parser/service/tailordb/types.mjs";
|
|
2
|
-
import "../../../../tailor-proto/src/tailor/v1/tailordb_resource_pb.mjs";
|
|
3
1
|
import { NormalizedSchemaSnapshot, RebaselineMarker, SchemaSnapshot, SnapshotActionPermission, SnapshotEnumValue, SnapshotFieldConfig, SnapshotGqlPermission, SnapshotGqlPermissionPolicy, SnapshotIndexConfig, SnapshotPermissionCondition, SnapshotPermissionOperand, SnapshotRecordPermission, SnapshotRelationship, TailorDBSnapshotType } from "./snapshot-types.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
*/
|
|
10
|
-
declare const INITIAL_SCHEMA_NUMBER = 0;
|
|
11
|
-
/**
|
|
12
|
-
* Migration file names (used within migration directories)
|
|
13
|
-
*/
|
|
14
|
-
declare const SCHEMA_FILE_NAME = "schema.json";
|
|
15
|
-
/** File name for migration diff metadata. */
|
|
16
|
-
declare const DIFF_FILE_NAME = "diff.json";
|
|
17
|
-
/** File name for migration script. */
|
|
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";
|
|
21
|
-
/** File name for generated DB type definitions. */
|
|
22
|
-
declare const DB_TYPES_FILE_NAME = "db.ts";
|
|
23
|
-
/**
|
|
24
|
-
* Migration file type
|
|
25
|
-
*/
|
|
26
|
-
type MigrationFileType = "schema" | "diff" | "migrate" | "test" | "db";
|
|
27
|
-
/**
|
|
28
|
-
* Get migration directory path for a given number
|
|
29
|
-
* @param {string} migrationsDir - Base migrations directory path
|
|
30
|
-
* @param {number} num - Migration number
|
|
31
|
-
* @returns {string} Full directory path for the migration
|
|
32
|
-
*/
|
|
33
|
-
declare function getMigrationDirPath(migrationsDir: string, num: number): string;
|
|
34
|
-
/**
|
|
35
|
-
* Get migration file path for a given number and type
|
|
36
|
-
* @param {string} migrationsDir - Migrations directory path
|
|
37
|
-
* @param {number} num - Migration number
|
|
38
|
-
* @param {MigrationFileType} type - File type
|
|
39
|
-
* @returns {string} Full file path
|
|
40
|
-
*/
|
|
41
|
-
declare function getMigrationFilePath(migrationsDir: string, num: number, type: MigrationFileType): string;
|
|
42
|
-
/**
|
|
43
|
-
* Create a schema snapshot from local table definitions
|
|
44
|
-
* @param {Record<string, TailorDBType>} types - Local table definitions
|
|
45
|
-
* @param {string} namespace - Namespace for the snapshot
|
|
46
|
-
* @returns {NormalizedSchemaSnapshot} Normalized schema snapshot
|
|
47
|
-
*/
|
|
48
|
-
declare function createSnapshotFromLocalTypes(types: Record<string, TailorDBType>, namespace: string): NormalizedSchemaSnapshot;
|
|
49
|
-
/**
|
|
50
|
-
* Get all migration directories and their files, sorted by number
|
|
51
|
-
* @param {string} migrationsDir - Migrations directory path
|
|
52
|
-
* @returns {Array<{number: number, type: "schema" | "diff", path: string}>} Migration files sorted by number
|
|
53
|
-
*/
|
|
54
|
-
declare function getMigrationFiles(migrationsDir: string): {
|
|
55
|
-
number: number;
|
|
56
|
-
type: "schema" | "diff";
|
|
57
|
-
path: string;
|
|
58
|
-
}[];
|
|
59
|
-
/**
|
|
60
|
-
* Get the next migration number for a directory
|
|
61
|
-
* Returns INITIAL_SCHEMA_NUMBER (0) if no migrations exist
|
|
62
|
-
* @param {string} migrationsDir - Migrations directory path
|
|
63
|
-
* @returns {number} Next migration number
|
|
64
|
-
*/
|
|
65
|
-
declare function getNextMigrationNumber(migrationsDir: string): number;
|
|
66
|
-
/**
|
|
67
|
-
* Reconstruct the latest schema snapshot from all migration files
|
|
68
|
-
* Returns null if no migrations exist
|
|
69
|
-
* @param {string} migrationsDir - Migrations directory path
|
|
70
|
-
* @param {number} [maxVersion] - Optional maximum migration version to apply
|
|
71
|
-
* @returns {NormalizedSchemaSnapshot | null} Reconstructed normalized snapshot or null if no migrations exist
|
|
72
|
-
*/
|
|
73
|
-
declare function reconstructSnapshotFromMigrations(migrationsDir: string, maxVersion?: number): NormalizedSchemaSnapshot | null;
|
|
74
|
-
/**
|
|
75
|
-
* Get the latest migration number from a directory
|
|
76
|
-
* Returns 0 if no migrations exist
|
|
77
|
-
* @param {string} migrationsDir - Migrations directory path
|
|
78
|
-
* @returns {number} Latest migration number or 0 if no migrations exist
|
|
79
|
-
*/
|
|
80
|
-
declare function getLatestMigrationNumber(migrationsDir: string): number;
|
|
81
|
-
/**
|
|
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 table 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
|
|
103
|
-
* @returns {MigrationDiff} Migration diff between snapshots
|
|
104
|
-
*/
|
|
105
|
-
declare function compareSnapshots(previous: NormalizedSchemaSnapshot, current: NormalizedSchemaSnapshot, options?: CompareSnapshotsOptions): MigrationDiff;
|
|
106
|
-
/**
|
|
107
|
-
* Compare a snapshot against canonical TailorDBSnapshotType-shaped local tables.
|
|
108
|
-
* Callers are expected to pre-convert TailorDBService.types to TailorDBSnapshotType via
|
|
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
|
|
111
|
-
* comparisons (no silent false drift).
|
|
112
|
-
* @param {SchemaSnapshot} snapshot - Schema snapshot to compare against
|
|
113
|
-
* @param {Record<string, TailorDBSnapshotType>} localTypes - Local snapshot-shaped tables
|
|
114
|
-
* @param {string} namespace - Namespace for comparison
|
|
115
|
-
* @returns {MigrationDiff} Migration diff
|
|
116
|
-
*/
|
|
117
|
-
declare function compareLocalTypesWithSnapshot(snapshot: SchemaSnapshot, localTypes: Record<string, TailorDBSnapshotType>, namespace: string): MigrationDiff;
|
|
118
|
-
//#endregion
|
|
2
|
+
import { CompareSnapshotsOptions, compareLocalTypesWithSnapshot, compareSnapshots } from "./snapshot-comparison.mjs";
|
|
3
|
+
import { DB_TYPES_FILE_NAME, DIFF_FILE_NAME, INITIAL_SCHEMA_NUMBER, MIGRATE_FILE_NAME, MIGRATE_TEST_FILE_NAME, MigrationFileType, SCHEMA_FILE_NAME, getLatestMigrationNumber, getMigrationDirPath, getMigrationFilePath, getMigrationFiles, getNextMigrationNumber } from "./snapshot-files.mjs";
|
|
4
|
+
import { reconstructSnapshotFromMigrations } from "./snapshot-migrations.mjs";
|
|
5
|
+
import { createSnapshotFromLocalTypes } from "./snapshot-local.mjs";
|
|
6
|
+
import "./snapshot-remote.mjs";
|
|
119
7
|
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 };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "../../shared/args.mjs";
|
|
2
2
|
import { WorkflowWaitUntil } from "./status.mjs";
|
|
3
3
|
import { WorkflowWaitResult } from "./waiter.mjs";
|
|
4
|
-
import { Jsonifiable } from "type-fest";
|
|
5
4
|
import { z } from "zod";
|
|
5
|
+
import { Jsonifiable } from "type-fest";
|
|
6
6
|
import { MachineUserName } from "@tailor-platform/sdk";
|
|
7
7
|
//#region src/cli/commands/workflow/start.d.ts
|
|
8
8
|
type WorkflowLike = {
|