@tailor-platform/sdk 2.24.0 → 2.26.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 (58) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/dist/application-ChqHuhZW.mjs +1 -0
  3. package/dist/{application-CfqvzV3I.mjs → application-DS0XKBtK.mjs} +4 -4
  4. package/dist/application-DS0XKBtK.mjs.map +1 -0
  5. package/dist/cli/commands/deploy/deployment-target.d.mts +1 -0
  6. package/dist/cli/commands/machineuser/list.d.mts +1 -0
  7. package/dist/cli/commands/show.d.mts +13 -1
  8. package/dist/cli/commands/tailordb/migrate/bundler.d.mts +4 -1
  9. package/dist/cli/commands/tailordb/migrate/diff-calculator.d.mts +6 -0
  10. package/dist/cli/lib.d.mts +2 -2
  11. package/dist/cli/lib.mjs +1 -1
  12. package/dist/cli/lib.mjs.map +1 -1
  13. package/dist/cli/main.mjs +47 -47
  14. package/dist/cli/main.mjs.map +1 -1
  15. package/dist/completion/zsh-worker.zsh +3 -3
  16. package/dist/configure/index.d.mts +2 -2
  17. package/dist/configure/index.mjs.map +1 -1
  18. package/dist/kysely/index.d.mts +47 -15
  19. package/dist/kysely/index.mjs +1 -1
  20. package/dist/kysely/index.mjs.map +1 -1
  21. package/dist/kysely-type-RDX59E1j.mjs +48 -0
  22. package/dist/kysely-type-RDX59E1j.mjs.map +1 -0
  23. package/dist/plugin/builtin/kysely-type/index.d.mts +11 -0
  24. package/dist/plugin/builtin/kysely-type/index.mjs +1 -1
  25. package/dist/plugin/index.mjs +1 -1
  26. package/dist/plugin/index.mjs.map +1 -1
  27. package/dist/plugin/types.d.mts +97 -0
  28. package/dist/register-ts-hook-BuwkLuxC.mjs +925 -0
  29. package/dist/register-ts-hook-BuwkLuxC.mjs.map +1 -0
  30. package/dist/runtime/index.d.mts +8 -0
  31. package/dist/vitest/index.d.mts +3 -2
  32. package/dist/vitest/index.mjs +1 -1
  33. package/dist/vitest/index.mjs.map +1 -1
  34. package/dist/vitest/mocks/tailordb-pglite.d.mts +1 -0
  35. package/dist/vitest/pglite-kysely.d.mts +14 -1
  36. package/dist/vitest/pglite-temporal.d.mts +9 -0
  37. package/docs/cli/application.md +23 -0
  38. package/docs/cli/secret.md +24 -16
  39. package/docs/cli-reference.md +25 -13
  40. package/docs/github-actions.md +69 -4
  41. package/docs/plugin/custom.md +76 -1
  42. package/docs/plugin/frontend.md +124 -0
  43. package/docs/plugin/index.md +24 -2
  44. package/docs/services/auth.md +2 -0
  45. package/docs/services/resolver.md +1 -1
  46. package/docs/services/secret.md +5 -4
  47. package/docs/services/staticwebsite.md +2 -0
  48. package/docs/services/tailordb-migration.md +5 -3
  49. package/docs/testing.md +2 -1
  50. package/package.json +5 -5
  51. package/dist/application-BDqze-wy.mjs +0 -1
  52. package/dist/application-CfqvzV3I.mjs.map +0 -1
  53. package/dist/kysely-type-C-iyFFH7.mjs +0 -43
  54. package/dist/kysely-type-C-iyFFH7.mjs.map +0 -1
  55. package/dist/register-ts-hook-CVlI9Jzl.mjs +0 -922
  56. package/dist/register-ts-hook-CVlI9Jzl.mjs.map +0 -1
  57. package/dist/tailordb-ddl-DqInYupv.mjs +0 -7
  58. package/dist/tailordb-ddl-DqInYupv.mjs.map +0 -1
@@ -92,7 +92,7 @@ A typical change cycle:
92
92
  DB types: ./migrations/0001/db.ts
93
93
  ```
94
94
 
95
- If `EDITOR` or `VISUAL` is set, `migrate.ts` opens automatically.
95
+ If `EDITOR` or `VISUAL` is set, `migrate.ts` opens automatically unless JSON output is enabled.
96
96
 
97
97
  3. **Edit `migrate.ts`** to populate data for the new required field:
98
98
 
@@ -240,7 +240,7 @@ This writes a numbered migration with an empty `diff.json`, a `migrate.ts` skele
240
240
 
241
241
  The command requires a clean state: if the namespace has schema changes that are not yet in migration files, generate the schema migration first. With multiple namespaces, pass `--namespace` to name the target. `--data-only` cannot be combined with `--init`, `--rename`, `--drop`, or `--expand-contract`.
242
242
 
243
- A data-only migration runs in **every** workspace the history is applied to, including freshly created ones. Write the script so it is safe against tables with no matching rows (a set-based `UPDATE` with a `WHERE` clause is naturally a no-op on an empty table). For a fix that should run in a single environment only, or that is too large for one transaction, run it outside the migration history instead.
243
+ A data-only migration runs in **every** workspace the history is applied to, including freshly created ones. Write the script so it is safe against tables with no matching rows (a set-based `UPDATE` with a `WHERE` clause is naturally a no-op on an empty table). For a fix that should run in a single environment only, or that is too large for one transaction, run it outside the migration history instead, for example as a one-off script scaffolded with [`tailor function script`](../cli/function.md#function-script) and executed against a single workspace with [`tailor function run`](../cli/function.md#function-run).
244
244
 
245
245
  ## Configuration
246
246
 
@@ -282,7 +282,7 @@ export default defineConfig({
282
282
 
283
283
  ### Migration file format compatibility
284
284
 
285
- Migration files are versioned independently of the SDK package. This SDK writes format version `6` and reads versions `1` through `6`. It normalizes supported older formats in memory; it never rewrites applied migration files on disk. Format version `6` records renames of members inside nested fields (`memberRenames`); older SDK versions refuse to read it rather than deploying such a migration without the copy step.
285
+ Migration files are versioned independently of the SDK package. This SDK writes format version `7` and reads versions `1` through `7`. It normalizes supported older formats in memory; it never rewrites applied migration files on disk. Format version `6` records renames of members inside nested fields (`memberRenames`); older SDK versions refuse to read it rather than deploying such a migration without the copy step. Format version `7` records whether a migration's `db.ts` uses Temporal column types (`temporal`); older SDK versions refuse to read it rather than running the script with `Date` values.
286
286
 
287
287
  Supported histories also preserve the behavior of field hooks and validators saved by older SDKs, including access to the record and boolean validators with a separate error message. Legacy update hooks retain existing values for omitted fields; explicitly supplied values, including `null`, take precedence. This applies to both snapshots and diffs, including nested fields. Your existing migration files can remain as generated.
288
288
 
@@ -898,6 +898,8 @@ describe("0005 add required email", () => {
898
898
  ```
899
899
 
900
900
  Pass nested field values as JavaScript objects or arrays of objects, without `JSON.stringify`.
901
+
902
+ When the migration was generated with `kyselyTypePlugin({ temporal: true })`, its `db.ts` types date and datetime fields as `Temporal.PlainDate` and `Temporal.Instant`, and top-level time fields as `Temporal.PlainTime`; nested time fields remain strings. Deploy runs the script with those values. Create the instance with `createKyselyPGlite<Unmigrated<Database>>(pglite, { temporal: true })` so PGlite reads top-level temporal columns back the same way; the scaffold adds the option for such migrations. Run the test in the [`tailor-runtime` Vitest environment](../testing.md#temporal), which provides `Temporal`. A migration generated before `temporal` was enabled still runs with `Date` values on deploy, so its test leaves the option out.
901
903
  Generated migration types use `Record<string, unknown>` for each nested object so scripts can
902
904
  work with both old and new members during a migration; narrow member values before using them.
903
905
 
package/docs/testing.md CHANGED
@@ -211,7 +211,7 @@ What the script cannot reproduce:
211
211
 
212
212
  - Hooks, validations, and permissions do not run. A required field whose value only its own field-level create hook supplies is created nullable, so inserts that omit it succeed; give it a `.default()` if the test reads it back. A field filled by a table-level hook stays `NOT NULL`, as its Kysely type still requires it on insert.
213
213
  - Serial formats are reproduced for a single `%d`, `%x`, or `%X` specifier with an optional zero-padded width; an octal `%o` format fails generation with an error naming the field.
214
- - A datetime inside a nested object reads back as a string from `jsonb`, not a `Date`.
214
+ - A date or datetime inside a nested object reads back as a string from `jsonb`, not a `Date`, or a `Temporal.PlainDate` or `Temporal.Instant` under `kyselyTypePlugin({ temporal: true })`, although the platform returns those types.
215
215
  - On a persistent PGlite (`dataDir`), tables created by an earlier run are kept as they were; drop them or start from an empty directory after changing a table definition.
216
216
 
217
217
  To hand-write DDL instead — for a table not in the schema, or to add a constraint — run your own statements after the script, or without it.
@@ -219,6 +219,7 @@ To hand-write DDL instead — for a table not in the schema, or to add a constra
219
219
  - The PGlite instance is yours: the mock never closes it, so close it in `afterAll`. Reuse one instance across a suite — creating one per test is slow.
220
220
  - Pass the same instance under several namespaces to drive them against one shared database. Two namespaces with a same-named table cannot share one instance, because the second script leaves the first table as it is.
221
221
  - Seed through `getDB` itself. When a column type rejects a value that only the test must stage, use `createKyselyPGlite<Unmigrated<...>>(pglite)` instead — see [Testing Migrations Locally](./services/tailordb-migration.md#testing-migrations-locally). This only affects test setup; it cannot supply a `.serial()` value for an insert issued by the code under test.
222
+ - With `kyselyTypePlugin({ temporal: true })`, the generated `getDB` reads top-level date, datetime, and time columns back from PGlite as `Temporal.PlainDate`, `Temporal.Instant`, and `Temporal.PlainTime`, as it does on the platform. Values inside nested objects stay strings in PGlite (see above); on the platform, nested date/datetime fields are Temporal values while nested time fields remain strings.
222
223
  - Transactions on a shared instance are serialized: while one is open, queries from other `getDB` instances wait. Do not use `test.concurrent` with a shared instance, and do not query the same instance through a second `getDB` from inside a transaction — that waits on itself.
223
224
  - PGlite runs full PostgreSQL while TailorDB supports a subset of it, and TailorDB hooks, validations, and permissions do not run here — a test passing on PGlite can still behave differently on the platform. Keep [`mockTailordb`](#tailordb-mock) or [`createKyselyMock`](#kysely-layer-mock-createkyselymock) tests for query shape and error paths, and E2E tests for platform behavior.
224
225
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tailor-platform/sdk",
3
- "version": "2.24.0",
3
+ "version": "2.26.0",
4
4
  "description": "Tailor Platform SDK - The SDK to work with Tailor Platform",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -164,7 +164,7 @@
164
164
  "@opentelemetry/resources": "2.11.0",
165
165
  "@opentelemetry/sdk-trace-node": "2.11.0",
166
166
  "@opentelemetry/semantic-conventions": "1.43.0",
167
- "@oxc-project/types": "0.151.0",
167
+ "@oxc-project/types": "0.152.0",
168
168
  "@politty/zod": "0.3.0",
169
169
  "@secretlint/core": "13.0.6",
170
170
  "@secretlint/secretlint-rule-preset-recommend": "13.0.6",
@@ -191,7 +191,7 @@
191
191
  "pathe": "2.0.3",
192
192
  "pgsql-ast-parser": "12.0.2",
193
193
  "pkg-types": "2.3.3",
194
- "rolldown": "1.2.11",
194
+ "rolldown": "1.2.12",
195
195
  "semver": "7.8.5",
196
196
  "sql-highlight": "6.1.0",
197
197
  "std-env": "4.2.0",
@@ -213,8 +213,8 @@
213
213
  "@typescript/native-preview": "7.0.0-dev.20260707.2",
214
214
  "@vitest/coverage-v8": "5.0.1",
215
215
  "eslint-plugin-zod": "4.14.2",
216
- "oxfmt": "0.70.0",
217
- "oxlint": "1.85.0",
216
+ "oxfmt": "0.71.0",
217
+ "oxlint": "1.86.0",
218
218
  "oxlint-tsgolint": "7.0.2003",
219
219
  "sonda": "0.14.0",
220
220
  "tsdown": "0.23.0",
@@ -1 +0,0 @@
1
- import{n as e,t}from"./application-CfqvzV3I.mjs";export{t as defineApplication,e as generatePluginFilesIfNeeded};