@tailor-platform/sdk 2.5.0 → 2.7.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 (104) hide show
  1. package/CHANGELOG.md +77 -0
  2. package/bin/tailor.mjs +3 -2
  3. package/dist/application-D5lh2-_W.mjs +194 -0
  4. package/dist/application-D5lh2-_W.mjs.map +1 -0
  5. package/dist/application-o09L68wE.mjs +1 -0
  6. package/dist/cli/commands/api/index.d.mts +1 -1
  7. package/dist/cli/commands/deploy/config-id-injector.d.mts +16 -0
  8. package/dist/cli/commands/executor/trigger.d.mts +1 -1
  9. package/dist/cli/commands/workflow/start.d.mts +1 -1
  10. package/dist/cli/commands/workspace/create.d.mts +1 -1
  11. package/dist/cli/commands/workspace/list.d.mts +1 -1
  12. package/dist/cli/lib.d.mts +10 -1
  13. package/dist/cli/lib.mjs +1 -1
  14. package/dist/cli/lib.mjs.map +1 -1
  15. package/dist/cli/main.d.mts +2 -0
  16. package/dist/cli/main.mjs +42 -1137
  17. package/dist/cli/main.mjs.map +1 -1
  18. package/dist/cli/shared/args.d.mts +71 -1
  19. package/dist/cli/shared/beta.d.mts +8 -0
  20. package/dist/cli/shared/client.d.mts +11 -1
  21. package/dist/cli/shared/command.d.mts +11 -0
  22. package/dist/cli/shared/config.d.mts +13 -0
  23. package/dist/cli/shared/context.d.mts +1 -1
  24. package/dist/cli/shared/logger.d.mts +64 -0
  25. package/dist/cli/shared/prompt.d.mts +53 -0
  26. package/dist/cli/shared/script-executor.d.mts +2 -2
  27. package/dist/cli/shared/workspace-name.d.mts +10 -1
  28. package/dist/completion/zsh-worker.zsh +10 -206
  29. package/dist/configure/index.mjs +1 -1
  30. package/dist/configure/index.mjs.map +1 -1
  31. package/dist/configure/services/tailordb/schema.d.mts +18 -0
  32. package/dist/configure/services/tailordb/types.d.mts +1 -1
  33. package/dist/{crashreport-B-_HTKLr.mjs → crashreport-BN28xp5B.mjs} +2 -2
  34. package/dist/{crashreport-B-_HTKLr.mjs.map → crashreport-BN28xp5B.mjs.map} +1 -1
  35. package/dist/crashreport-By23O2k-.mjs +1 -0
  36. package/dist/errors-BlX4gUw5.mjs +4 -0
  37. package/dist/errors-BlX4gUw5.mjs.map +1 -0
  38. package/dist/es-builtins-BHCXINQp.mjs +2 -0
  39. package/dist/es-builtins-BHCXINQp.mjs.map +1 -0
  40. package/dist/field-column-type-QMtF6lUp.mjs +2 -0
  41. package/dist/field-column-type-QMtF6lUp.mjs.map +1 -0
  42. package/dist/{kysely-type-BTi3BMtL.mjs → kysely-type-CmvAz1Xj.mjs} +4 -4
  43. package/dist/kysely-type-CmvAz1Xj.mjs.map +1 -0
  44. package/dist/{logger-BcGy-u7G.mjs → logger-CCjs1DuH.mjs} +4 -4
  45. package/dist/logger-CCjs1DuH.mjs.map +1 -0
  46. package/dist/node-builtins-TQHhwNzG.mjs +2 -0
  47. package/dist/node-builtins-TQHhwNzG.mjs.map +1 -0
  48. package/dist/plugin/builtin/kysely-type/index.mjs +1 -1
  49. package/dist/register-ts-hook-CL3Z3VP0.mjs +642 -0
  50. package/dist/register-ts-hook-CL3Z3VP0.mjs.map +1 -0
  51. package/dist/schema-AYG4OhXY.mjs +2 -0
  52. package/dist/{schema-Ze_dI5VX.mjs.map → schema-AYG4OhXY.mjs.map} +1 -1
  53. package/dist/service-COC9whur.mjs +1 -0
  54. package/dist/{service-DlgaUO4V.mjs → service-CqbQXFDp.mjs} +2 -2
  55. package/dist/{service-DlgaUO4V.mjs.map → service-CqbQXFDp.mjs.map} +1 -1
  56. package/dist/{service-BVe9u2Rt.mjs → service-DDon86tM.mjs} +4 -4
  57. package/dist/service-DDon86tM.mjs.map +1 -0
  58. package/dist/service_pb-BNxUPfP3.mjs +2 -0
  59. package/dist/service_pb-BNxUPfP3.mjs.map +1 -0
  60. package/dist/service_pb-D-xFu9Ub.mjs +1 -0
  61. package/dist/shared/src/color.d.mts +5 -0
  62. package/dist/tailor-proto/src/tailor/v1/application_pb.d.mts +12 -0
  63. package/dist/tailor-proto/src/tailor/v1/function_resource_pb.d.mts +18 -1
  64. package/dist/tailor-proto/src/tailor/v1/metadata_pb.d.mts +130 -1
  65. package/dist/tailor-proto/src/tailor/v1/service_pb.d.mts +43 -4
  66. package/dist/tailor-proto/src/tailor/v1/workflow_pb.d.mts +9 -0
  67. package/dist/tailor-proto/src/tailor/v1/workspace_pb.d.mts +1 -1
  68. package/dist/vitest/environment.mjs +1 -1
  69. package/dist/vitest/environment.mjs.map +1 -1
  70. package/dist/vitest/index.mjs +1 -1
  71. package/dist/wait-point-registry-B-ESkTZX.mjs +2 -0
  72. package/dist/wait-point-registry-B-ESkTZX.mjs.map +1 -0
  73. package/dist/workspace_resource_pb-B7S-zx4Z.mjs +2 -0
  74. package/dist/workspace_resource_pb-B7S-zx4Z.mjs.map +1 -0
  75. package/docs/cli-reference.md +0 -16
  76. package/docs/github-actions.md +16 -3
  77. package/docs/migration/v2.md +5 -1
  78. package/docs/migration/v3.md +39 -0
  79. package/docs/services/tailordb-migration.md +12 -0
  80. package/docs/services/tailordb.md +11 -9
  81. package/package.json +13 -14
  82. package/dist/application-DFOUovmN.mjs +0 -1
  83. package/dist/application-D_4vg1KR.mjs +0 -192
  84. package/dist/application-D_4vg1KR.mjs.map +0 -1
  85. package/dist/crashreport-BmsRIdpy.mjs +0 -1
  86. package/dist/errors-DSEXKRVD.mjs +0 -2
  87. package/dist/errors-DSEXKRVD.mjs.map +0 -1
  88. package/dist/kysely-type-BTi3BMtL.mjs.map +0 -1
  89. package/dist/logger-BcGy-u7G.mjs.map +0 -1
  90. package/dist/node-builtins-oBl7EbyV.mjs +0 -2
  91. package/dist/node-builtins-oBl7EbyV.mjs.map +0 -1
  92. package/dist/register-ts-hook-Drnaproy.mjs +0 -640
  93. package/dist/register-ts-hook-Drnaproy.mjs.map +0 -1
  94. package/dist/schema-Ze_dI5VX.mjs +0 -2
  95. package/dist/service-BVe9u2Rt.mjs.map +0 -1
  96. package/dist/service-CpZELSBa.mjs +0 -1
  97. package/dist/service_pb-DGKCLuAs.mjs +0 -2
  98. package/dist/service_pb-DGKCLuAs.mjs.map +0 -1
  99. package/dist/service_pb-_aeFE-Nv.mjs +0 -1
  100. package/dist/wait-point-registry-BrkwfyjS.mjs +0 -2
  101. package/dist/wait-point-registry-BrkwfyjS.mjs.map +0 -1
  102. package/dist/workspace_resource_pb--GeYQPXu.mjs +0 -2
  103. package/dist/workspace_resource_pb--GeYQPXu.mjs.map +0 -1
  104. package/docs/cli/setup.md +0 -210
@@ -386,22 +386,6 @@ Commands for managing crash reports.
386
386
  | [crashreport list](./cli/crashreport.md#crashreport-list) | List local crash report files. |
387
387
  | [crashreport send](./cli/crashreport.md#crashreport-send) | Submit a crash report to help improve the SDK. |
388
388
 
389
- ### [Setup Commands](./cli/setup.md)
390
-
391
- Commands for setting up project infrastructure.
392
-
393
- | Command | Description |
394
- | --------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
395
- | [setup](./cli/setup.md#setup) | Set up repository automation for your project. (beta) |
396
- | [setup action](./cli/setup.md#setup-action) | Generate a per-app composite action for use with setup coordinate (monorepo multi-app deploys). |
397
- | [setup branch](./cli/setup.md#setup-branch) | Generate a branch-target deploy workflow (push to branch triggers deploy). |
398
- | [setup check](./cli/setup.md#setup-check) | Audit generated workflows for drift against the current config/repo (read-only). |
399
- | [setup coordinate](./cli/setup.md#setup-coordinate) | Generate a coordinator workflow that orchestrates multiple --action-generated composite actions. |
400
- | [setup delete](./cli/setup.md#setup-delete) | Delete managed workflow/action file(s) and their .github/tailor.lock entries. |
401
- | [setup deps](./cli/setup.md#setup-deps) | Generate a dependency update config for Tailor dependency and workflow updates. |
402
- | [setup preview](./cli/setup.md#setup-preview) | Generate a preview workflow (PR open/sync triggers deploy to a per-PR workspace). |
403
- | [setup tag](./cli/setup.md#setup-tag) | Generate a tag-target deploy workflow (tag push triggers deploy). |
404
-
405
389
  ### [Upgrade Commands](./cli/upgrade.md)
406
390
 
407
391
  Commands for upgrading SDK versions with automated code migration.
@@ -7,6 +7,18 @@ application, including deploy workflows and Renovate configuration.
7
7
  > workflow, and the `.github/tailor.lock` schema may change before general
8
8
  > availability.
9
9
 
10
+ ## Installation
11
+
12
+ The `setup` commands are provided by the `@tailor-platform/sdk-plugin-setup` CLI
13
+ plugin. Install it next to the SDK:
14
+
15
+ ```bash
16
+ npm install -D @tailor-platform/sdk-plugin-setup
17
+ ```
18
+
19
+ The Tailor CLI discovers the plugin automatically from `node_modules/.bin` (or
20
+ your `PATH`). Run `tailor plugin list` to confirm it resolves.
21
+
10
22
  ## Quick start
11
23
 
12
24
  Run the command from the root of your SDK project (where `tailor.config.ts`
@@ -383,9 +395,10 @@ standard root, `.github`, `.gitlab`, and `.renovaterc` locations, including the
383
395
  deprecated `package.json` configuration. When that configuration already extends
384
396
  the preset, the command reports that Renovate is set up and changes nothing.
385
397
 
386
- Configuration written in JSON5 or JSONC with comments or trailing commas —
387
- cannot be edited without losing those comments, so the command leaves it
388
- unchanged and asks you to add the preset to its `extends` array yourself.
398
+ JSONC and JSON5 configurations are updated in place while preserving their
399
+ comments and formatting. Configurations that Renovate itself cannot load such
400
+ as invalid syntax, or duplicate keys outside JSON5 are left unchanged and
401
+ reported for manual inspection.
389
402
 
390
403
  `renovate.json` is yours to edit — it is not tracked in `.github/tailor.lock`.
391
404
  Add your own rules freely; re-running `tailor setup deps` does not overwrite
@@ -661,7 +661,7 @@ After:
661
661
  ```ts
662
662
  ownerId: db.uuid().relation({
663
663
  type: "n-1",
664
- toward: { type: user, as: "user" },
664
+ toward: { table: user, as: "user" },
665
665
  }),
666
666
  ```
667
667
 
@@ -1669,6 +1669,10 @@ The CLI stores human users by their stable subject ID instead of email (email is
1669
1669
 
1670
1670
  `tailor function logs` maps stack traces against the function bundle only when the execution recorded a `contentHash`. Executions without one now show raw stack traces instead of mapped frames. No source change is required.
1671
1671
 
1672
+ ### `db.fields.timestamps()`: `updatedAt` becomes required
1673
+
1674
+ The `updatedAt` field from `db.fields.timestamps()` changes from optional to required (non-null): it defaults to the current time and keeps refreshing automatically on every update, though a value you provide explicitly is still respected. Applying this change to a table that already has rows with `updatedAt: null` makes `deploy` fail with `field "updatedAt" cannot be updated from non-required to required when records with null values exist`. Backfill those rows first, e.g. `UPDATE <table> SET "updatedAt" = "createdAt" WHERE "updatedAt" IS NULL` for each affected table — see [TailorDB migrations](../services/tailordb-migration.md#performance-and-large-tables) for splitting a large backfill across primary-key ranges if a single `UPDATE` times out.
1675
+
1672
1676
  ### Node.js minimum version raised to 22.15.0
1673
1677
 
1674
1678
  v2 requires Node.js **22.15.0** or later. This is the first version that includes `module.registerHooks()`, which the SDK uses to register its TypeScript loader hook synchronously in the main thread. The actual floor is now **22.18.0**: Node 22.15.0–22.17.x has a bug that crashes `tailor seed validate` when requiring `node:`-scheme-only builtins such as `node:sqlite`, fixed upstream by [nodejs/node#58612](https://github.com/nodejs/node/pull/58612) in 22.18.0. No source change is required; ensure your environment runs Node.js 22.18.0+.
@@ -121,3 +121,42 @@ that merely mentions the option unchanged unless it documents a command to type.
121
121
  ```
122
122
 
123
123
  </details>
124
+
125
+ ## relation() toward.type → toward.table
126
+
127
+ **Migration:** Partially automatic
128
+
129
+ Rename the `.relation()` option `toward.type` to `toward.table`, matching the `db.type()` → `db.table()` rename. The relation's own `type` (its cardinality, e.g. `"n-1"`) is unchanged — only the target-table reference nested under `toward` moves.
130
+
131
+ Before:
132
+
133
+ ```ts
134
+ customerId: db.uuid().relation({
135
+ type: "n-1",
136
+ toward: { type: customer },
137
+ }),
138
+ ```
139
+
140
+ After:
141
+
142
+ ```ts
143
+ customerId: db.uuid().relation({
144
+ type: "n-1",
145
+ toward: { table: customer },
146
+ }),
147
+ ```
148
+
149
+ <details>
150
+ <summary>Prompt for an AI agent (to finish the cases the codemod could not migrate)</summary>
151
+
152
+ ```text
153
+ In Tailor SDK v3, `.relation()`'s `toward.type` option is renamed to
154
+ `toward.table` (it names a target table, not a TypeScript/GraphQL type).
155
+ Rename any remaining `toward.type` the codemod did not rewrite (e.g. a
156
+ `toward` object reached through a shared variable, spread, or computed
157
+ key) to `toward.table`. Do not touch the relation's own outer `type`
158
+ property, which is the relation's cardinality (e.g. "n-1", "1-1",
159
+ "keyOnly") and keeps its name.
160
+ ```
161
+
162
+ </details>
@@ -757,6 +757,18 @@ The migration script runs in a single transaction. For tables with many rows:
757
757
  - Long-running transactions can hit platform timeouts and hold locks. For very large backfills, consider splitting the work across multiple migrations, each operating on a subset.
758
758
  - Add `LIMIT` and resumability (idempotent `where` clauses) so a re-run after a transient failure converges.
759
759
 
760
+ ### Migrations that take longer than a minute
761
+
762
+ Migration scripts run as workflow jobs, so they are not bound by the 60-second
763
+ limit that applies to synchronous script execution. `tailor deploy` waits for
764
+ the migration and reports its logs as usual. Execution time is still bounded —
765
+ a workflow job has its own, far longer, execution-time limit.
766
+
767
+ The script still runs in a single transaction, so the guidance above about
768
+ locks and transaction size continues to apply — prefer splitting a very large
769
+ backfill across several migrations over holding one transaction open for a
770
+ long time.
771
+
760
772
  ## Testing Migrations Locally
761
773
 
762
774
  ### Unit-testing migrate.ts
@@ -69,8 +69,8 @@ db.table("User", "User in the system", {
69
69
  | `db.float()` | Float | number |
70
70
  | [`db.decimal()`](#decimal-fields) | Decimal | string |
71
71
  | `db.bool()` | Boolean | boolean |
72
- | `db.date()` | Date | string |
73
- | `db.datetime()` | DateTime | string \| Date |
72
+ | `db.date()` | Date | Date \| string |
73
+ | `db.datetime()` | DateTime | Date \| string |
74
74
  | `db.time()` | Time | string |
75
75
  | `db.uuid()` | UUID | string |
76
76
  | [`db.enum()`](#enum-fields) | Enum | string |
@@ -182,18 +182,20 @@ const user = db.table("User", {
182
182
  name: db.string(),
183
183
  roleId: db.uuid().relation({
184
184
  type: "n-1",
185
- toward: { type: role },
185
+ toward: { table: role },
186
186
  }),
187
187
  });
188
188
  ```
189
189
 
190
+ `toward.type` is a deprecated alias for `toward.table` and will be removed in v3; `tailor upgrade` offers a codemod to rewrite it.
191
+
190
192
  For one-to-one relations, use `type: "1-1"`:
191
193
 
192
194
  ```typescript
193
195
  const userProfile = db.table("UserProfile", {
194
196
  userId: db.uuid().relation({
195
197
  type: "1-1",
196
- toward: { type: user },
198
+ toward: { table: user },
197
199
  }),
198
200
  bio: db.string(),
199
201
  });
@@ -205,7 +207,7 @@ For foreign key constraint without creating a relation, use `type: "keyOnly"`:
205
207
  const user = db.table("User", {
206
208
  roleId: db.uuid().relation({
207
209
  type: "keyOnly",
208
- toward: { type: role },
210
+ toward: { table: role },
209
211
  }),
210
212
  });
211
213
  ```
@@ -220,7 +222,7 @@ const user = db.table("User", {
220
222
  const userProfile = db.table("UserProfile", {
221
223
  userEmail: db.string().relation({
222
224
  type: "1-1",
223
- toward: { type: user, key: "email", as: "user" },
225
+ toward: { table: user, key: "email", as: "user" },
224
226
  }),
225
227
  });
226
228
  ```
@@ -234,7 +236,7 @@ Customize relation names using `toward.as` / `backward` options:
234
236
  const userProfile = db.table("UserProfile", {
235
237
  userId: db.uuid().relation({
236
238
  type: "1-1",
237
- toward: { type: user, as: "base" },
239
+ toward: { table: user, as: "base" },
238
240
  backward: "profile",
239
241
  }),
240
242
  });
@@ -266,12 +268,12 @@ removed. This lets multiple fields point to the same target table with distinct
266
268
  const post = db.table("Post", {
267
269
  authorID: db.uuid().relation({
268
270
  type: "n-1",
269
- toward: { type: user },
271
+ toward: { table: user },
270
272
  backward: "authoredPosts",
271
273
  }),
272
274
  reviewerID: db.uuid().relation({
273
275
  type: "n-1",
274
- toward: { type: user },
276
+ toward: { table: user },
275
277
  backward: "reviewedPosts",
276
278
  }),
277
279
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tailor-platform/sdk",
3
- "version": "2.5.0",
3
+ "version": "2.7.0",
4
4
  "description": "Tailor Platform SDK - The SDK to work with Tailor Platform",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -149,14 +149,14 @@
149
149
  }
150
150
  },
151
151
  "dependencies": {
152
- "@0no-co/graphql.web": "1.3.3",
152
+ "@0no-co/graphql.web": "1.3.4",
153
153
  "@badgateway/oauth2-client": "3.3.1",
154
154
  "@bufbuild/protobuf": "2.14.0",
155
155
  "@bufbuild/protovalidate": "1.2.0",
156
156
  "@connectrpc/connect": "2.1.2",
157
157
  "@connectrpc/connect-node": "2.1.2",
158
- "@inquirer/core": "11.2.1",
159
- "@inquirer/prompts": "8.5.2",
158
+ "@inquirer/core": "12.0.0",
159
+ "@inquirer/prompts": "8.6.0",
160
160
  "@jridgewell/trace-mapping": "0.3.31",
161
161
  "@napi-rs/keyring": "1.3.0",
162
162
  "@opentelemetry/api": "1.9.1",
@@ -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.144.0",
167
+ "@oxc-project/types": "0.146.0",
168
168
  "@secretlint/core": "13.0.4",
169
169
  "@secretlint/secretlint-rule-preset-recommend": "13.0.4",
170
170
  "@standard-schema/spec": "1.1.0",
@@ -178,20 +178,20 @@
178
178
  "es-toolkit": "1.51.0",
179
179
  "find-up-simple": "1.0.1",
180
180
  "get-east-asian-width": "1.6.0",
181
- "get-tsconfig": "4.14.2",
181
+ "get-tsconfig": "4.14.3",
182
182
  "globals": "17.11.0",
183
183
  "graphql": "17.0.2",
184
184
  "inflection": "3.0.2",
185
185
  "kysely": "0.29.5",
186
186
  "mime-types": "3.0.2",
187
187
  "open": "11.0.1",
188
- "oxc-parser": "0.144.0",
188
+ "oxc-parser": "0.146.0",
189
189
  "p-limit": "7.3.1",
190
190
  "pathe": "2.0.3",
191
191
  "pgsql-ast-parser": "12.0.2",
192
192
  "pkg-types": "2.3.1",
193
- "politty": "0.11.6",
194
- "rolldown": "1.2.4",
193
+ "politty": "0.11.9",
194
+ "rolldown": "1.2.5",
195
195
  "semver": "7.8.5",
196
196
  "sql-highlight": "6.1.0",
197
197
  "std-env": "4.2.0",
@@ -206,15 +206,15 @@
206
206
  "@types/node": "24.13.3",
207
207
  "@types/semver": "7.8.0",
208
208
  "@typescript/native-preview": "7.0.0-dev.20260707.2",
209
- "@vitest/coverage-v8": "4.1.10",
209
+ "@vitest/coverage-v8": "4.1.11",
210
210
  "eslint-plugin-zod": "4.9.1",
211
- "oxfmt": "0.63.0",
212
- "oxlint": "1.78.0",
211
+ "oxfmt": "0.64.0",
212
+ "oxlint": "1.79.0",
213
213
  "oxlint-tsgolint": "7.0.2001",
214
214
  "sonda": "0.14.0",
215
215
  "tsdown": "0.22.14",
216
216
  "typescript": "6.0.3",
217
- "vitest": "4.1.10",
217
+ "vitest": "4.1.11",
218
218
  "zinfer": "0.2.8",
219
219
  "@tailor-platform/shared": "^0.0.0",
220
220
  "@tailor-platform/tailor-proto": "^0.0.1"
@@ -256,7 +256,6 @@
256
256
  "typecheck:go": "tsgo --tsBuildInfoFile ./.tsgo.tsbuildinfo",
257
257
  "perf:typecheck": "bash scripts/perf/exec.sh",
258
258
  "perf:runtime": "bash scripts/perf/runtime-perf.sh",
259
- "prepublish": "pnpm run build",
260
259
  "postinstall": "node postinstall.mjs",
261
260
  "measure:bundle": "node ../../scripts/measure-bundle-size-sonda.js",
262
261
  "knip": "knip",
@@ -1 +0,0 @@
1
- import{n as e,t}from"./application-D_4vg1KR.mjs";export{t as defineApplication,e as generatePluginFilesIfNeeded};