@tailor-platform/sdk 1.84.0 → 1.85.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/dist/application-C-zsrNjn.mjs +3 -0
  3. package/dist/{application-CnCljDwk.mjs → application-m5tYtz0-.mjs} +235 -62
  4. package/dist/application-m5tYtz0-.mjs.map +1 -0
  5. package/dist/cli/commands/deploy/tailordb/index.d.mts +1 -0
  6. package/dist/cli/commands/generate/seed/bundler.d.mts +2 -1
  7. package/dist/cli/commands/tailordb/migrate/schema-checks.d.mts +5 -0
  8. package/dist/cli/index.mjs +229 -22
  9. package/dist/cli/index.mjs.map +1 -1
  10. package/dist/cli/lib.mjs +92 -36
  11. package/dist/cli/lib.mjs.map +1 -1
  12. package/dist/completion/zsh-worker.zsh +52 -2
  13. package/dist/node-builtins-CmaL2Cbq.mjs +36 -0
  14. package/dist/node-builtins-CmaL2Cbq.mjs.map +1 -0
  15. package/dist/plugin/builtin/seed/index.mjs +1 -1
  16. package/dist/{register-typescript-runtime-BCvWR3HC.mjs → register-typescript-runtime-nG-n9lPw.mjs} +336 -268
  17. package/dist/register-typescript-runtime-nG-n9lPw.mjs.map +1 -0
  18. package/dist/rolldown-runtime-DXywRVcq.mjs +0 -1
  19. package/dist/{seed-DFFigL8V.mjs → seed-6eTFj-3Q.mjs} +158 -41
  20. package/dist/seed-6eTFj-3Q.mjs.map +1 -0
  21. package/dist/vitest/index.mjs +3 -35
  22. package/dist/vitest/index.mjs.map +1 -1
  23. package/docs/cli/tailordb.md +29 -7
  24. package/docs/cli-reference.md +16 -15
  25. package/docs/generator/builtin.md +7 -0
  26. package/docs/services/tailordb-migration.md +11 -2
  27. package/package.json +7 -8
  28. package/dist/application-5FOWIxFQ.mjs +0 -3
  29. package/dist/application-CnCljDwk.mjs.map +0 -1
  30. package/dist/register-typescript-runtime-BCvWR3HC.mjs.map +0 -1
  31. package/dist/seed-DFFigL8V.mjs.map +0 -1
@@ -95,13 +95,14 @@ tailor-sdk tailordb migration <command>
95
95
 
96
96
  **Commands**
97
97
 
98
- | Command | Description |
99
- | ------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
100
- | [`tailordb migration generate`](#tailordb-migration-generate) | Generate migration files by detecting schema differences between current local types and the previous migration snapshot. |
101
- | [`tailordb migration script`](#tailordb-migration-script) | Add a migration script (migrate.ts) template to an existing migration directory, or record with --no-script that a migration intentionally has none. |
102
- | [`tailordb migration set`](#tailordb-migration-set) | Set migration checkpoint to a specific number. |
103
- | [`tailordb migration status`](#tailordb-migration-status) | Show the current migration status for TailorDB namespaces, including applied and pending migrations. |
104
- | [`tailordb migration sync`](#tailordb-migration-sync) | Sync remote TailorDB schema to a specific migration snapshot (recovery from --no-schema-check drift). |
98
+ | Command | Description |
99
+ | ------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
100
+ | [`tailordb migration generate`](#tailordb-migration-generate) | Generate migration files by detecting schema differences between current local types and the previous migration snapshot. |
101
+ | [`tailordb migration script`](#tailordb-migration-script) | Add a migration script (migrate.ts) template to an existing migration directory, or record with --no-script that a migration intentionally has none. |
102
+ | [`tailordb migration set`](#tailordb-migration-set) | Set migration checkpoint to a specific number. |
103
+ | [`tailordb migration status`](#tailordb-migration-status) | Show the current migration status for TailorDB namespaces, including applied and pending migrations. |
104
+ | [`tailordb migration sync`](#tailordb-migration-sync) | Sync remote TailorDB schema to a specific migration snapshot (recovery from --no-schema-check drift). |
105
+ | [`tailordb migration validate`](#tailordb-migration-validate) | Validate the full migration history and detect schema drift (local types vs. migration snapshot, remote schema vs. migration checkpoint) without deploying. This includes the migration and schema-drift checks used by 'deploy' and exits with a non-zero code when issues are found. |
105
106
 
106
107
  See [Global Options](../cli-reference.md#global-options) for options available to all commands.
107
108
 
@@ -230,6 +231,27 @@ tailor-sdk tailordb migration sync [options] <number>
230
231
 
231
232
  See [Global Options](../cli-reference.md#global-options) for options available to all commands.
232
233
 
234
+ #### tailordb migration validate
235
+
236
+ Validate the full migration history and detect schema drift (local types vs. migration snapshot, remote schema vs. migration checkpoint) without deploying. This includes the migration and schema-drift checks used by 'deploy' and exits with a non-zero code when issues are found.
237
+
238
+ **Usage**
239
+
240
+ ```
241
+ tailor-sdk tailordb migration validate [options]
242
+ ```
243
+
244
+ **Options**
245
+
246
+ | Option | Alias | Description | Required | Default | Env |
247
+ | ------------------------------- | ----- | --------------------------------------------------------------------- | -------- | -------------------- | --------------------------------- |
248
+ | `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID | No | - | `TAILOR_PLATFORM_WORKSPACE_ID` |
249
+ | `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
250
+ | `--config <CONFIG>` | `-c` | Path to SDK config file | No | `"tailor.config.ts"` | `TAILOR_PLATFORM_SDK_CONFIG_PATH` |
251
+ | `--namespace <NAMESPACE>` | `-n` | Target TailorDB namespace (validates all namespaces if not specified) | No | - | - |
252
+
253
+ See [Global Options](../cli-reference.md#global-options) for options available to all commands.
254
+
233
255
  **See also:** For migration concepts, configuration, workflow, and troubleshooting, see the [TailorDB Migrations guide](../services/tailordb-migration.md).
234
256
 
235
257
  ### tailordb erd
@@ -128,21 +128,22 @@ Commands for managing Tailor Platform applications (work with `tailor.config.ts`
128
128
 
129
129
  Commands for managing TailorDB tables, data, and schema migrations.
130
130
 
131
- | Command | Description |
132
- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
133
- | [tailordb](./cli/tailordb.md#tailordb) | Manage TailorDB tables and data. |
134
- | [tailordb truncate](./cli/tailordb.md#tailordb-truncate) | Truncate (delete all records from) TailorDB tables. |
135
- | [tailordb migration](./cli/tailordb.md#tailordb-migration) | Manage TailorDB schema migrations. |
136
- | [tailordb migration generate](./cli/tailordb.md#tailordb-migration-generate) | Generate migration files by detecting schema differences between current local types and the previous migration snapshot. |
137
- | [tailordb migration script](./cli/tailordb.md#tailordb-migration-script) | Add a migration script (migrate.ts) template to an existing migration directory, or record with --no-script that a migration intentionally has none. |
138
- | [tailordb migration set](./cli/tailordb.md#tailordb-migration-set) | Set migration checkpoint to a specific number. |
139
- | [tailordb migration status](./cli/tailordb.md#tailordb-migration-status) | Show the current migration status for TailorDB namespaces, including applied and pending migrations. |
140
- | [tailordb migration sync](./cli/tailordb.md#tailordb-migration-sync) | Sync remote TailorDB schema to a specific migration snapshot (recovery from --no-schema-check drift). |
141
- | [tailordb erd](./cli/tailordb.md#tailordb-erd) | Generate TailorDB ERD viewer artifacts from local TailorDB schema. (beta) |
142
- | [tailordb erd export](./cli/tailordb.md#tailordb-erd-export) | Export TailorDB ERD static viewer from local TailorDB schema. |
143
- | [tailordb erd diff](./cli/tailordb.md#tailordb-erd-diff) | Render TailorDB ERD schema diff HTML from exported ERD viewers. |
144
- | [tailordb erd serve](./cli/tailordb.md#tailordb-erd-serve) | Generate and serve TailorDB ERD locally with watch reload. (beta) |
145
- | [tailordb erd deploy](./cli/tailordb.md#tailordb-erd-deploy) | Deploy ERD static website for TailorDB namespace(s). |
131
+ | Command | Description |
132
+ | ---------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
133
+ | [tailordb](./cli/tailordb.md#tailordb) | Manage TailorDB tables and data. |
134
+ | [tailordb truncate](./cli/tailordb.md#tailordb-truncate) | Truncate (delete all records from) TailorDB tables. |
135
+ | [tailordb migration](./cli/tailordb.md#tailordb-migration) | Manage TailorDB schema migrations. |
136
+ | [tailordb migration generate](./cli/tailordb.md#tailordb-migration-generate) | Generate migration files by detecting schema differences between current local types and the previous migration snapshot. |
137
+ | [tailordb migration script](./cli/tailordb.md#tailordb-migration-script) | Add a migration script (migrate.ts) template to an existing migration directory, or record with --no-script that a migration intentionally has none. |
138
+ | [tailordb migration set](./cli/tailordb.md#tailordb-migration-set) | Set migration checkpoint to a specific number. |
139
+ | [tailordb migration status](./cli/tailordb.md#tailordb-migration-status) | Show the current migration status for TailorDB namespaces, including applied and pending migrations. |
140
+ | [tailordb migration sync](./cli/tailordb.md#tailordb-migration-sync) | Sync remote TailorDB schema to a specific migration snapshot (recovery from --no-schema-check drift). |
141
+ | [tailordb migration validate](./cli/tailordb.md#tailordb-migration-validate) | Validate the full migration history and detect schema drift (local types vs. migration snapshot, remote schema vs. migration checkpoint) without deploying. This includes the migration and schema-drift checks used by 'deploy' and exits with a non-zero code when issues are found. |
142
+ | [tailordb erd](./cli/tailordb.md#tailordb-erd) | Generate TailorDB ERD viewer artifacts from local TailorDB schema. (beta) |
143
+ | [tailordb erd export](./cli/tailordb.md#tailordb-erd-export) | Export TailorDB ERD static viewer from local TailorDB schema. |
144
+ | [tailordb erd diff](./cli/tailordb.md#tailordb-erd-diff) | Render TailorDB ERD schema diff HTML from exported ERD viewers. |
145
+ | [tailordb erd serve](./cli/tailordb.md#tailordb-erd-serve) | Generate and serve TailorDB ERD locally with watch reload. (beta) |
146
+ | [tailordb erd deploy](./cli/tailordb.md#tailordb-erd-deploy) | Deploy ERD static website for TailorDB namespace(s). |
146
147
 
147
148
  ### [Query Commands](./cli/query.md)
148
149
 
@@ -248,10 +248,17 @@ node seed/exec.mjs -m admin
248
248
 
249
249
  # With other options
250
250
  node seed/exec.mjs -m admin --truncate --yes
251
+
252
+ # Update rows that already exist instead of failing on duplicate ids
253
+ node seed/exec.mjs --upsert
251
254
  ```
252
255
 
253
256
  The `--machine-user` option is required at runtime if `machineUserName` is not configured in the generator options.
254
257
 
258
+ Without `--upsert`, a row whose id already exists fails the whole batch for that type, so nothing is written. With `--upsert`, every TailorDB row must include an `id`; rows with new ids are inserted and rows with existing ids are updated. Optional fields absent from an existing row keep their stored values, while required fields must still be present. Built-In IdP users are looked up by name, so new users are created and existing users are updated.
259
+
260
+ The machine user selected for `--upsert` needs read permission for every seeded TailorDB type. Existing ids are detected with a read query, so a row hidden by read permissions is treated as new and its insert fails as a duplicate.
261
+
255
262
  The generated files are compatible with gql-ingest for bulk data import.
256
263
 
257
264
  The `exec.mjs` is fully regenerated on every `sdk generate` and starts with an `@generated` header — do not hand-edit it. Its `--truncate` path reuses the `tailordb truncate` command, so namespaces declared with `{ external: true }` are skipped automatically and a shell app cannot wipe a sibling app's data via `seed:reset`.
@@ -290,7 +290,15 @@ Namespace: tailordb
290
290
 
291
291
  The error also points you at `migration status`, `migration generate`, `migration sync`, and `migration set` — see [Remote schema drift detected](#remote-schema-drift-detected) for which one applies.
292
292
 
293
- To bypass both checks (not recommended outside of recovery scenarios):
293
+ To run the same checks without deploying — plus migration file integrity (numbering, parseable contents, and a `migrate.ts` or a recorded `--no-script` acknowledgment for every migration that requires a script):
294
+
295
+ ```bash
296
+ tailor-sdk tailordb migration validate
297
+ ```
298
+
299
+ It reports issues per namespace, exits with a non-zero code when any check fails, and supports `--json` for machine-readable output.
300
+
301
+ To bypass both checks during deploy (not recommended outside of recovery scenarios):
294
302
 
295
303
  ```bash
296
304
  tailor-sdk deploy --no-schema-check
@@ -355,7 +363,8 @@ Migration numbers are assigned sequentially, so two developers branching off the
355
363
  ### CI / CD
356
364
 
357
365
  - For non-interactive environments, pass `--yes` to `migration generate` and `--yes` to `apply`. `apply` runs migrations automatically when the `migrations/` directory is configured.
358
- - Run `tailor-sdk tailordb migration status` in CI to detect "developer forgot to commit a migration" situations early. The exit code is non-zero only on errors, so check the output.
366
+ - Run `tailor-sdk tailordb migration validate` in CI to catch uncommitted migrations, broken migration files, and remote schema drift before deploying. It exits with a non-zero code when validation fails and supports `--json`.
367
+ - `tailor-sdk tailordb migration status` shows applied and pending migrations for a human-readable comparison. Its exit code is non-zero only on errors, so check the output.
359
368
  - Avoid running migrations in parallel against the same workspace — there is no locking. Serialize deploys per environment.
360
369
 
361
370
  ### Resetting a deployed project
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tailor-platform/sdk",
3
- "version": "1.84.0",
3
+ "version": "1.85.1",
4
4
  "description": "Tailor Platform SDK - The SDK to work with Tailor Platform",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -149,7 +149,7 @@
149
149
  }
150
150
  },
151
151
  "dependencies": {
152
- "@0no-co/graphql.web": "1.3.2",
152
+ "@0no-co/graphql.web": "1.3.3",
153
153
  "@badgateway/oauth2-client": "3.3.1",
154
154
  "@bufbuild/protobuf": "2.13.0",
155
155
  "@bufbuild/protovalidate": "1.2.0",
@@ -164,7 +164,7 @@
164
164
  "@opentelemetry/resources": "2.10.0",
165
165
  "@opentelemetry/sdk-trace-node": "2.10.0",
166
166
  "@opentelemetry/semantic-conventions": "1.43.0",
167
- "@oxc-project/types": "0.141.0",
167
+ "@oxc-project/types": "0.142.0",
168
168
  "@standard-schema/spec": "1.1.0",
169
169
  "@tailor-platform/function-kysely-tailordb": "0.1.3",
170
170
  "@toiroakr/lines-db": "0.10.1",
@@ -178,14 +178,14 @@
178
178
  "find-up-simple": "1.0.1",
179
179
  "get-east-asian-width": "1.6.0",
180
180
  "get-tsconfig": "4.14.0",
181
- "globals": "17.7.0",
181
+ "globals": "17.8.0",
182
182
  "graphql": "17.0.2",
183
183
  "inflection": "3.0.2",
184
184
  "kysely": "0.29.4",
185
185
  "madge": "8.0.0",
186
186
  "mime-types": "3.0.2",
187
187
  "open": "11.0.0",
188
- "oxc-parser": "0.141.0",
188
+ "oxc-parser": "0.142.0",
189
189
  "p-limit": "7.3.1",
190
190
  "pathe": "2.0.3",
191
191
  "pgsql-ast-parser": "12.0.2",
@@ -198,7 +198,6 @@
198
198
  "ts-cron-validator": "1.1.5",
199
199
  "tsx": "4.23.1",
200
200
  "type-fest": "5.8.0",
201
- "undici": "8.9.0",
202
201
  "xdg-basedir": "5.1.0",
203
202
  "zod": "4.4.3"
204
203
  },
@@ -210,8 +209,8 @@
210
209
  "@types/semver": "7.7.1",
211
210
  "@typescript/native-preview": "7.0.0-dev.20260707.2",
212
211
  "@vitest/coverage-v8": "4.1.10",
213
- "oxfmt": "0.60.0",
214
- "oxlint": "1.75.0",
212
+ "oxfmt": "0.61.0",
213
+ "oxlint": "1.76.0",
215
214
  "oxlint-tsgolint": "7.0.2001",
216
215
  "sonda": "0.14.0",
217
216
  "tsdown": "0.22.14",
@@ -1,3 +0,0 @@
1
- import { n as generatePluginFilesIfNeeded, r as loadApplication, t as defineApplication } from "./application-CnCljDwk.mjs";
2
-
3
- export { defineApplication, generatePluginFilesIfNeeded };