@tailor-platform/sdk 2.0.1 → 2.2.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 (92) hide show
  1. package/CHANGELOG.md +117 -0
  2. package/{dist/cli/index.mjs → bin/tailor.mjs} +1 -1
  3. package/dist/{application-CM6hKnSK.mjs → application-BpLeawBg.mjs} +126 -28
  4. package/dist/application-BpLeawBg.mjs.map +1 -0
  5. package/dist/application-BxLLiLsr.mjs +3 -0
  6. package/dist/cli/commands/deploy/tailordb/index.d.mts +2 -1
  7. package/dist/cli/commands/deploy/types.d.mts +2 -1
  8. package/dist/cli/commands/tailordb/migrate/diff-calculator.d.mts +11 -4
  9. package/dist/cli/commands/tailordb/migrate/file-state.d.mts +1 -0
  10. package/dist/cli/commands/tailordb/migrate/schema-checks.d.mts +2 -2
  11. package/dist/cli/commands/tailordb/migrate/snapshot-types.d.mts +8 -1
  12. package/dist/cli/commands/tailordb/migrate/snapshot.d.mts +5 -3
  13. package/dist/cli/lib.d.mts +4 -4
  14. package/dist/cli/lib.mjs +3 -482
  15. package/dist/cli/lib.mjs.map +1 -1
  16. package/dist/cli/main.mjs +997 -202
  17. package/dist/cli/main.mjs.map +1 -1
  18. package/dist/completion/zsh-worker.zsh +145 -2
  19. package/dist/configure/config/types.d.mts +12 -1
  20. package/dist/configure/index.d.mts +3 -3
  21. package/dist/configure/services/index.d.mts +3 -2
  22. package/dist/configure/services/resolver/index.d.mts +1 -1
  23. package/dist/configure/services/resolver/resolver.d.mts +1 -1
  24. package/dist/configure/services/tailordb/index.d.mts +2 -1
  25. package/dist/configure/services/tailordb/schema.d.mts +46 -46
  26. package/dist/configure/services/tailordb/types.d.mts +30 -4
  27. package/dist/{crashreport-B5LqCTfF.mjs → crashreport-CIIfLnoO.mjs} +2 -2
  28. package/dist/{crashreport-B5LqCTfF.mjs.map → crashreport-CIIfLnoO.mjs.map} +1 -1
  29. package/dist/{crashreport-eI7ty7ok.mjs → crashreport-CINZ5dVN.mjs} +1 -1
  30. package/dist/errors-CWj21238.mjs +75 -0
  31. package/dist/errors-CWj21238.mjs.map +1 -0
  32. package/dist/{globals-TfAVItuK.mjs → globals-B2nlxBrz.mjs} +2 -10
  33. package/dist/globals-B2nlxBrz.mjs.map +1 -0
  34. package/dist/kysely/index.d.mts +52 -5
  35. package/dist/kysely/index.mjs +7 -2
  36. package/dist/kysely/index.mjs.map +1 -1
  37. package/dist/{logger-CXQq9YIp.mjs → logger-DSdExfor.mjs} +83 -42
  38. package/dist/logger-DSdExfor.mjs.map +1 -0
  39. package/dist/plugin/builtin/seed/index.mjs +1 -1
  40. package/dist/{register-ts-hook-LYV7zH-e.mjs → register-ts-hook-CTth1eqj.mjs} +1587 -272
  41. package/dist/register-ts-hook-CTth1eqj.mjs.map +1 -0
  42. package/dist/runtime/globals.d.mts +0 -7
  43. package/dist/runtime/workflow.d.mts +2 -7
  44. package/dist/schema--xYWRGfe.mjs.map +1 -1
  45. package/dist/seed/index.d.mts +52 -3
  46. package/dist/seed/index.mjs +200 -44
  47. package/dist/seed/index.mjs.map +1 -1
  48. package/dist/{seed-B-yckgQY.mjs → seed-xqM9WIHP.mjs} +8 -8
  49. package/dist/seed-xqM9WIHP.mjs.map +1 -0
  50. package/dist/{service-B5WynBHQ.mjs → service-CCwl3Avt.mjs} +3 -3
  51. package/dist/{service-B5WynBHQ.mjs.map → service-CCwl3Avt.mjs.map} +1 -1
  52. package/dist/service-_XmjSEGr.mjs +3 -0
  53. package/dist/{service-k1xy_A5G.mjs → service-goqlJJgA.mjs} +2 -2
  54. package/dist/{service-k1xy_A5G.mjs.map → service-goqlJJgA.mjs.map} +1 -1
  55. package/dist/{service_pb-D5--My_M.mjs → service_pb-BEWj1pOV.mjs} +2 -2
  56. package/dist/{service_pb-D5--My_M.mjs.map → service_pb-BEWj1pOV.mjs.map} +1 -1
  57. package/dist/{service_pb-i8CmnQP4.mjs → service_pb-BjlhvK9E.mjs} +1 -1
  58. package/dist/utils/test/index.d.mts +9 -3
  59. package/dist/utils/test/index.mjs +49 -25
  60. package/dist/utils/test/index.mjs.map +1 -1
  61. package/dist/vitest/environment.mjs +1 -1
  62. package/dist/vitest/index.d.mts +2 -1
  63. package/dist/vitest/index.mjs +84 -2
  64. package/dist/vitest/index.mjs.map +1 -1
  65. package/dist/vitest/mocks/file.d.mts +1 -1
  66. package/dist/vitest/pglite-kysely.d.mts +43 -0
  67. package/dist/vitest/setup.mjs +1 -1
  68. package/dist/workflow-Bamae_Yc.mjs.map +1 -1
  69. package/dist/{workspace_resource_pb-DXnO2AT-.mjs → workspace_resource_pb-HNIL_Vfj.mjs} +10 -2
  70. package/dist/{workspace_resource_pb-DXnO2AT-.mjs.map → workspace_resource_pb-HNIL_Vfj.mjs.map} +1 -1
  71. package/docs/cli/tailordb.md +87 -22
  72. package/docs/cli-reference.md +13 -11
  73. package/docs/configuration.md +4 -1
  74. package/docs/migration/v2.md +1 -1
  75. package/docs/plugin/custom.md +48 -48
  76. package/docs/plugin/index.md +24 -24
  77. package/docs/services/auth.md +10 -10
  78. package/docs/services/executor.md +1 -1
  79. package/docs/services/resolver.md +34 -2
  80. package/docs/services/tailordb-migration.md +375 -76
  81. package/docs/services/tailordb.md +28 -28
  82. package/docs/testing.md +3 -1
  83. package/package.json +13 -8
  84. package/dist/application-CM6hKnSK.mjs.map +0 -1
  85. package/dist/application-CXNaUNhv.mjs +0 -3
  86. package/dist/errors-D7583Zz7.mjs +0 -58
  87. package/dist/errors-D7583Zz7.mjs.map +0 -1
  88. package/dist/globals-TfAVItuK.mjs.map +0 -1
  89. package/dist/logger-CXQq9YIp.mjs.map +0 -1
  90. package/dist/register-ts-hook-LYV7zH-e.mjs.map +0 -1
  91. package/dist/seed-B-yckgQY.mjs.map +0 -1
  92. package/dist/service-M7OYziQP.mjs +0 -3
@@ -94,14 +94,16 @@ tailor tailordb migration <command>
94
94
 
95
95
  **Commands**
96
96
 
97
- | Command | Description |
98
- | ------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
99
- | [`tailordb migration generate`](#tailordb-migration-generate) | Generate migration files by detecting schema differences between current local types and the previous migration snapshot. |
100
- | [`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. |
101
- | [`tailordb migration set`](#tailordb-migration-set) | Set migration checkpoint to a specific number. |
102
- | [`tailordb migration status`](#tailordb-migration-status) | Show the current migration status for TailorDB namespaces, including applied and pending migrations. |
103
- | [`tailordb migration sync`](#tailordb-migration-sync) | Sync remote TailorDB schema to a specific migration snapshot (recovery from --no-schema-check drift). |
104
- | [`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. |
97
+ | Command | Description |
98
+ | ----------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
99
+ | [`tailordb migration generate`](#tailordb-migration-generate) | Generate migration files by detecting schema differences between current local types and the previous migration snapshot. |
100
+ | [`tailordb migration rebaseline`](#tailordb-migration-rebaseline) | Collapse the full migration history into a new 0000 baseline. |
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 test`](#tailordb-migration-test) | Test pending migrations with seed fixtures or cloned data in a temporary workspace. |
106
+ | [`tailordb migration validate`](#tailordb-migration-validate) | Validate the full migration history, unreviewed generated migration scripts, and 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
107
 
106
108
  See [Global Options](../cli-reference.md#global-options) for options available to all commands.
107
109
 
@@ -126,6 +128,32 @@ tailor tailordb migration generate [options]
126
128
 
127
129
  See [Global Options](../cli-reference.md#global-options) for options available to all commands.
128
130
 
131
+ #### tailordb migration rebaseline
132
+
133
+ Collapse the full migration history into a new 0000 baseline.
134
+
135
+ **Usage**
136
+
137
+ ```
138
+ tailor tailordb migration rebaseline [options]
139
+ ```
140
+
141
+ **Options**
142
+
143
+ | Option | Alias | Description | Required | Default | Env |
144
+ | ------------------------------- | ----- | ----------------------------------------------------------------- | -------- | -------------------- | ------------------------------ |
145
+ | `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID | No | - | `TAILOR_PLATFORM_WORKSPACE_ID` |
146
+ | `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
147
+ | `--config <CONFIG>` | `-c` | Path to Tailor config file | No | `"tailor.config.ts"` | `TAILOR_CONFIG_PATH` |
148
+ | `--yes` | `-y` | Skip confirmation prompts | No | `false` | - |
149
+ | `--namespace <NAMESPACE>` | `-n` | Target TailorDB namespace (required if multiple namespaces exist) | No | - | - |
150
+
151
+ See [Global Options](../cli-reference.md#global-options) for options available to all commands.
152
+
153
+ **Notes**
154
+
155
+ Re-baselining removes migrations after 0000 from the working tree, records a new migration history ID, and resets the connected workspace checkpoint without changing its schema or data. Every environment must already have applied the latest migration before you run this command.
156
+
129
157
  #### tailordb migration script
130
158
 
131
159
  Add a migration script (migrate.ts) template to an existing migration directory, or record with --no-script that a migration intentionally has none.
@@ -144,15 +172,20 @@ tailor tailordb migration script [options] <number>
144
172
 
145
173
  **Options**
146
174
 
147
- | Option | Alias | Description | Required | Default | Env |
148
- | ------------------------- | ----- | -------------------------------------------------------------------------------------------- | -------- | -------------------- | -------------------- |
149
- | `--config <CONFIG>` | `-c` | Path to Tailor config file | No | `"tailor.config.ts"` | `TAILOR_CONFIG_PATH` |
150
- | `--namespace <NAMESPACE>` | `-n` | Target TailorDB namespace (required if multiple namespaces exist) | No | - | - |
151
- | `--no-script` | - | Record that this migration intentionally runs without a migration script (requires --reason) | No | - | - |
152
- | `--reason <REASON>` | - | Reason why no migration script is needed (used with --no-script) | No | - | - |
175
+ | Option | Alias | Description | Required | Default | Env |
176
+ | ------------------------- | ----- | ----------------------------------------------------------------------------------------------------- | -------- | -------------------- | -------------------- |
177
+ | `--config <CONFIG>` | `-c` | Path to Tailor config file | No | `"tailor.config.ts"` | `TAILOR_CONFIG_PATH` |
178
+ | `--namespace <NAMESPACE>` | `-n` | Target TailorDB namespace (required if multiple namespaces exist) | No | - | - |
179
+ | `--no-script` | - | Record that this migration intentionally runs without a migration script (requires --reason) | No | - | - |
180
+ | `--reason <REASON>` | - | Reason why no migration script is needed (used with --no-script) | No | - | - |
181
+ | `--with-test` | - | Also add a migrate.test.ts unit-test scaffold; when migrate.ts already exists, only the test is added | No | - | - |
153
182
 
154
183
  See [Global Options](../cli-reference.md#global-options) for options available to all commands.
155
184
 
185
+ **Notes**
186
+
187
+ When `migrate.ts` already exists, running the command clears a previously recorded `--no-script` acknowledgment.
188
+
156
189
  #### tailordb migration set
157
190
 
158
191
  Set migration checkpoint to a specific number.
@@ -210,7 +243,7 @@ See [Global Options](../cli-reference.md#global-options) for options available t
210
243
 
211
244
  **Notes**
212
245
 
213
- Metadata lookup failures (authentication, permission, or network errors) are reported per namespace and make the command exit non-zero; only a not-yet-deployed namespace is treated as having no applied migrations.
246
+ Every local migration file is checked for a compatible format version, and deployed migration history IDs must match the local baseline. Compatibility errors, history mismatches, and metadata lookup failures are reported per namespace and make the command exit non-zero; only a not-yet-deployed namespace is treated as having no applied migrations.
214
247
 
215
248
  #### tailordb migration sync
216
249
 
@@ -240,9 +273,40 @@ tailor tailordb migration sync [options] <number>
240
273
 
241
274
  See [Global Options](../cli-reference.md#global-options) for options available to all commands.
242
275
 
276
+ #### tailordb migration test
277
+
278
+ Test pending migrations with seed fixtures or cloned data in a temporary workspace.
279
+
280
+ **Usage**
281
+
282
+ ```
283
+ tailor tailordb migration test [options]
284
+ ```
285
+
286
+ **Options**
287
+
288
+ | Option | Alias | Description | Required | Default | Env |
289
+ | --------------------------------------------- | ----- | ---------------------------------------------------------------------- | -------- | -------------------- | ------------------------------ |
290
+ | `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID | No | - | `TAILOR_PLATFORM_WORKSPACE_ID` |
291
+ | `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
292
+ | `--config <CONFIG>` | `-c` | Path to Tailor config file | No | `"tailor.config.ts"` | `TAILOR_CONFIG_PATH` |
293
+ | `--yes` | `-y` | Acknowledge that a designated target workspace may be overwritten | No | `false` | - |
294
+ | `--data <DATA>` | - | Data source for the migration test (seed or clone) | No | `"seed"` | - |
295
+ | `--target-workspace-id <TARGET_WORKSPACE_ID>` | - | Existing throwaway workspace to retain after the test (requires --yes) | No | - | - |
296
+ | `--keep` | - | Keep the automatically created workspace after the test | No | `false` | - |
297
+ | `--assert <ASSERT>` | - | Path to a TypeScript assertion script to run after migrations | No | - | - |
298
+ | `--assert-namespace <ASSERT_NAMESPACE>` | - | TailorDB namespace exposed to the assertion script | No | - | - |
299
+ | `--machine-user <MACHINE_USER>` | - | Machine user for seed and assertion script execution | No | - | - |
300
+
301
+ See [Global Options](../cli-reference.md#global-options) for options available to all commands.
302
+
303
+ **Notes**
304
+
305
+ The source workspace is read-only. Without --target-workspace-id, the command creates a workspace in the source workspace's region and deletes it after success or failure; pass --keep to retain it for inspection. A designated target is retained and requires --yes. Clone mode copies TailorDB records only; it does not copy IdP users or file blobs.
306
+
243
307
  #### tailordb migration validate
244
308
 
245
- 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.
309
+ Validate the full migration history, unreviewed generated migration scripts, and 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.
246
310
 
247
311
  **Usage**
248
312
 
@@ -252,12 +316,13 @@ tailor tailordb migration validate [options]
252
316
 
253
317
  **Options**
254
318
 
255
- | Option | Alias | Description | Required | Default | Env |
256
- | ------------------------------- | ----- | --------------------------------------------------------------------- | -------- | -------------------- | ------------------------------ |
257
- | `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID | No | - | `TAILOR_PLATFORM_WORKSPACE_ID` |
258
- | `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
259
- | `--config <CONFIG>` | `-c` | Path to Tailor config file | No | `"tailor.config.ts"` | `TAILOR_CONFIG_PATH` |
260
- | `--namespace <NAMESPACE>` | `-n` | Target TailorDB namespace (validates all namespaces if not specified) | No | - | - |
319
+ | Option | Alias | Description | Required | Default | Env |
320
+ | ------------------------------- | ----- | -------------------------------------------------------------------------- | -------- | -------------------- | ------------------------------ |
321
+ | `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID | No | - | `TAILOR_PLATFORM_WORKSPACE_ID` |
322
+ | `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
323
+ | `--config <CONFIG>` | `-c` | Path to Tailor config file | No | `"tailor.config.ts"` | `TAILOR_CONFIG_PATH` |
324
+ | `--namespace <NAMESPACE>` | `-n` | Target TailorDB namespace (validates all namespaces if not specified) | No | - | - |
325
+ | `--strict` | - | Also fail when a pending migration can drop data without an acknowledgment | No | `false` | - |
261
326
 
262
327
  See [Global Options](../cli-reference.md#global-options) for options available to all commands.
263
328
 
@@ -200,17 +200,19 @@ Commands for managing Tailor Platform applications (work with `tailor.config.ts`
200
200
 
201
201
  Commands for managing TailorDB tables, data, and schema migrations.
202
202
 
203
- | Command | Description |
204
- | ---------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
205
- | [tailordb](./cli/tailordb.md#tailordb) | Manage TailorDB tables and data. |
206
- | [tailordb truncate](./cli/tailordb.md#tailordb-truncate) | Truncate (delete all records from) TailorDB tables. |
207
- | [tailordb migration](./cli/tailordb.md#tailordb-migration) | Manage TailorDB schema migrations. |
208
- | [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. |
209
- | [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. |
210
- | [tailordb migration set](./cli/tailordb.md#tailordb-migration-set) | Set migration checkpoint to a specific number. |
211
- | [tailordb migration status](./cli/tailordb.md#tailordb-migration-status) | Show the current migration status for TailorDB namespaces, including applied and pending migrations. |
212
- | [tailordb migration sync](./cli/tailordb.md#tailordb-migration-sync) | Sync remote TailorDB schema to a specific migration snapshot (recovery from --no-schema-check drift). |
213
- | [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. |
203
+ | Command | Description |
204
+ | -------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
205
+ | [tailordb](./cli/tailordb.md#tailordb) | Manage TailorDB tables and data. |
206
+ | [tailordb truncate](./cli/tailordb.md#tailordb-truncate) | Truncate (delete all records from) TailorDB tables. |
207
+ | [tailordb migration](./cli/tailordb.md#tailordb-migration) | Manage TailorDB schema migrations. |
208
+ | [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. |
209
+ | [tailordb migration rebaseline](./cli/tailordb.md#tailordb-migration-rebaseline) | Collapse the full migration history into a new 0000 baseline. |
210
+ | [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. |
211
+ | [tailordb migration set](./cli/tailordb.md#tailordb-migration-set) | Set migration checkpoint to a specific number. |
212
+ | [tailordb migration status](./cli/tailordb.md#tailordb-migration-status) | Show the current migration status for TailorDB namespaces, including applied and pending migrations. |
213
+ | [tailordb migration sync](./cli/tailordb.md#tailordb-migration-sync) | Sync remote TailorDB schema to a specific migration snapshot (recovery from --no-schema-check drift). |
214
+ | [tailordb migration test](./cli/tailordb.md#tailordb-migration-test) | Test pending migrations with seed fixtures or cloned data in a temporary workspace. |
215
+ | [tailordb migration validate](./cli/tailordb.md#tailordb-migration-validate) | Validate the full migration history, unreviewed generated migration scripts, and 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. |
214
216
 
215
217
  ### [Query Commands](./cli/query.md)
216
218
 
@@ -69,6 +69,7 @@ export default defineConfig({
69
69
  resolver: {
70
70
  "my-resolver": {
71
71
  files: ["resolver/**/*.ts"],
72
+ defaultPermission: [{ conditions: [[{ user: "_loggedIn" }, "=", true]], permit: true }],
72
73
  },
73
74
  },
74
75
  executor: {
@@ -84,6 +85,8 @@ export default defineConfig({
84
85
 
85
86
  **ignores**: Glob patterns to exclude files. Optional. By default, `**/*.test.ts` and `**/*.spec.ts` are automatically ignored. If you explicitly specify `ignores`, the default patterns will not be applied. Use `ignores: []` to include all files including test files.
86
87
 
88
+ **defaultPermission** (resolver namespaces only): Access requirement applied to every resolver in the namespace that declares no `permission` of its own. Optional, and takes the same values as a resolver's own `permission`. See [Namespace-wide default](./services/resolver.md#namespace-wide-default-defaultpermission).
89
+
87
90
  **Pattern resolution**: `files` and `ignores` patterns are resolved relative to the directory of the `tailor.config.ts` file that declares them, not the directory you run the command from. This matters when deploying [multiple configs](./cli/application.md#deploy) together — each config's patterns only match files under its own directory. If a config's _relative_ patterns match nothing under its own directory, the SDK falls back to resolving them from the directory you ran the command from and logs a warning (this fallback doesn't apply to already-absolute patterns, since their resolution can't change). Update such patterns to be relative to the config's own directory — this fallback will be removed in v2.
88
91
 
89
92
  ### Bundling
@@ -126,7 +129,7 @@ When using external resources:
126
129
  - The resource itself is not deployed by this project
127
130
  - The resource must be deployed and available before referencing it
128
131
  - You can combine external resources with locally-defined resources
129
- - TailorDB type names must remain unique across local and external TailorDB namespaces; `deploy` checks external TailorDB type names before applying changes
132
+ - TailorDB table names must remain unique across local and external TailorDB namespaces; `deploy` checks external TailorDB table names before applying changes
130
133
  - Destructive operations like `tailordb truncate` (and `tailor seed apply --truncate`) automatically exclude external resources to prevent accidental data loss in shared resources
131
134
  - Subscribing an executor to an external resource's events requires the config that owns the resource in the same `deploy`. Publishing is then enabled automatically, and `deploy` records the dependency so a later deploy without that config asks for confirmation instead of silently turning publishing off
132
135
 
@@ -675,7 +675,7 @@ already pass a plain value unchanged.
675
675
 
676
676
  **Migration:** Partially automatic
677
677
 
678
- Rename the `defineIdp` option `publishUserEvents` to `publishEvents`, matching the field name TailorDB types, resolvers, and workflows already use.
678
+ Rename the `defineIdp` option `publishUserEvents` to `publishEvents`, matching the field name that TailorDB tables, resolvers, and workflows already use.
679
679
 
680
680
  Before:
681
681
 
@@ -18,7 +18,7 @@ const myPlugin: Plugin = {
18
18
  export default myPlugin; // Required: must be default export
19
19
  ```
20
20
 
21
- This is required so that other plugins and generation-time hooks can use plugin-generated TailorDB types via `getGeneratedType()`.
21
+ This is required so that other plugins and generation-time hooks can use plugin-generated TailorDB tables via `getGeneratedType()`.
22
22
 
23
23
  ## Plugin Interface
24
24
 
@@ -56,38 +56,38 @@ interface Plugin<TypeConfig = unknown, PluginConfig = unknown> {
56
56
  | `id` | Yes | Unique plugin identifier (e.g., `"@my-company/soft-delete"`) |
57
57
  | `description` | Yes | Human-readable description |
58
58
  | `importPath` | When using definition-time hooks | Path resolvable from `tailor.config.ts` directory. Used for import statements in generated code. |
59
- | `typeConfigRequired` | No | Whether per-type config is required when attaching via `.plugin()`. Default: optional. |
59
+ | `typeConfigRequired` | No | Whether per-table config is required when attaching via `.plugin()`. Default: optional. |
60
60
  | `pluginConfig` | No | Plugin-level config passed via `definePlugins()`. Set via factory function. |
61
61
 
62
62
  ## Hook Reference
63
63
 
64
64
  ### onTypeLoaded
65
65
 
66
- **Trigger**: Called once for each TailorDB type that has `.plugin({ pluginId: config })` attached.
66
+ **Trigger**: Called once for each TailorDB table that has `.plugin({ pluginId: config })` attached.
67
67
 
68
68
  **Context** (`PluginProcessContext`):
69
69
 
70
70
  | Field | Type | Description |
71
71
  | -------------- | ----------------- | ------------------------------------------ |
72
- | `type` | `TailorAnyDBType` | The TailorDB type being processed |
73
- | `typeConfig` | `TypeConfig` | Per-type config from `.plugin()` |
72
+ | `type` | `TailorAnyDBType` | The TailorDB table being processed |
73
+ | `typeConfig` | `TypeConfig` | Per-table config from `.plugin()` |
74
74
  | `pluginConfig` | `PluginConfig` | Plugin-level config from `definePlugins()` |
75
- | `namespace` | `string` | Namespace of the TailorDB type |
75
+ | `namespace` | `string` | Namespace of the TailorDB table |
76
76
 
77
77
  **Returns** (`TypePluginOutput`):
78
78
 
79
- | Field | Type | Description |
80
- | ----------- | ----------------------------------------------- | ----------------------------------------------------- |
81
- | `types` | `Record<string, TailorAnyDBType>` | Additional TailorDB types to generate (keyed by kind) |
82
- | `resolvers` | `PluginGeneratedResolver[]` | Additional resolvers to generate |
83
- | `executors` | `PluginGeneratedExecutor[]` | Additional executors to generate |
84
- | `extends` | `{ fields?: Record<string, TailorAnyDBField> }` | Fields to add to the source type |
79
+ | Field | Type | Description |
80
+ | ----------- | ----------------------------------------------- | ------------------------------------------------------ |
81
+ | `types` | `Record<string, TailorAnyDBType>` | Additional TailorDB tables to generate (keyed by kind) |
82
+ | `resolvers` | `PluginGeneratedResolver[]` | Additional resolvers to generate |
83
+ | `executors` | `PluginGeneratedExecutor[]` | Additional executors to generate |
84
+ | `extends` | `{ fields?: Record<string, TailorAnyDBField> }` | Fields to add to the source table |
85
85
 
86
86
  **Use cases**:
87
87
 
88
- - Generate derived types (e.g., archive tables, history tables) from user-defined types
89
- - Add fields to existing types (e.g., `deletedAt` for soft delete)
90
- - Generate executors triggered by record events on the source type
88
+ - Generate derived tables (e.g., archive tables, history tables) from user-defined tables
89
+ - Add fields to existing tables (e.g., `deletedAt` for soft delete)
90
+ - Generate executors triggered by record events on the source table
91
91
 
92
92
  ```typescript
93
93
  onTypeLoaded(context) {
@@ -102,7 +102,7 @@ onTypeLoaded(context) {
102
102
 
103
103
  ### onNamespaceLoaded
104
104
 
105
- **Trigger**: Called once per namespace for plugins that do not require a source type.
105
+ **Trigger**: Called once per namespace for plugins that do not require a source table.
106
106
 
107
107
  **Context** (`PluginNamespaceProcessContext`):
108
108
 
@@ -113,11 +113,11 @@ onTypeLoaded(context) {
113
113
 
114
114
  **Returns** (`PluginOutput`):
115
115
 
116
- Same as `TypePluginOutput` but without `extends` (namespace plugins cannot extend a source type).
116
+ Same as `TypePluginOutput` but without `extends` (namespace plugins cannot extend a source table).
117
117
 
118
118
  **Use cases**:
119
119
 
120
- - Generate types that don't derive from a specific user type (e.g., audit log, settings table)
120
+ - Generate tables that don't derive from a specific user table (e.g., audit log, settings table)
121
121
 
122
122
  ```typescript
123
123
  onNamespaceLoaded(context) {
@@ -129,26 +129,26 @@ onNamespaceLoaded(context) {
129
129
 
130
130
  ### onTailorDBReady
131
131
 
132
- **Trigger**: Called once after all TailorDB types are loaded and auth is resolved.
132
+ **Trigger**: Called once after all TailorDB tables are loaded and auth is resolved.
133
133
 
134
134
  **Context** (`TailorDBReadyContext`):
135
135
 
136
- | Field | Type | Description |
137
- | -------------- | ------------------------- | -------------------------------------------------------------- |
138
- | `tailordb` | `TailorDBNamespaceData[]` | All namespaces with types, source info, and plugin attachments |
139
- | `auth` | `GeneratorAuthInput?` | Auth configuration (machine users, OAuth2 clients, etc.) |
140
- | `baseDir` | `string` | Output directory for generated files |
141
- | `configPath` | `string` | Path to `tailor.config.ts` |
142
- | `pluginConfig` | `PluginConfig` | Plugin-level config from `definePlugins()` |
136
+ | Field | Type | Description |
137
+ | -------------- | ------------------------- | --------------------------------------------------------------- |
138
+ | `tailordb` | `TailorDBNamespaceData[]` | All namespaces with tables, source info, and plugin attachments |
139
+ | `auth` | `GeneratorAuthInput?` | Auth configuration (machine users, OAuth2 clients, etc.) |
140
+ | `baseDir` | `string` | Output directory for generated files |
141
+ | `configPath` | `string` | Path to `tailor.config.ts` |
142
+ | `pluginConfig` | `PluginConfig` | Plugin-level config from `definePlugins()` |
143
143
 
144
144
  `TailorDBNamespaceData` contains:
145
145
 
146
- | Field | Type | Description |
147
- | ------------------- | ------------------------------------------ | ------------------------------------ |
148
- | `namespace` | `string` | Namespace name |
149
- | `types` | `Record<string, TailorDBType>` | All finalized types in the namespace |
150
- | `sourceInfo` | `ReadonlyMap<string, TypeSourceInfoEntry>` | Source file info for each type |
151
- | `pluginAttachments` | `ReadonlyMap<string, PluginAttachment[]>` | Plugin configs attached to each type |
146
+ | Field | Type | Description |
147
+ | ------------------- | ------------------------------------------ | ------------------------------------- |
148
+ | `namespace` | `string` | Namespace name |
149
+ | `types` | `Record<string, TailorDBType>` | All finalized tables in the namespace |
150
+ | `sourceInfo` | `ReadonlyMap<string, TypeSourceInfoEntry>` | Source file info for each table |
151
+ | `pluginAttachments` | `ReadonlyMap<string, PluginAttachment[]>` | Plugin configs attached to each table |
152
152
 
153
153
  **Returns** (`GeneratorResult`):
154
154
 
@@ -159,9 +159,9 @@ onNamespaceLoaded(context) {
159
159
 
160
160
  **Use cases**:
161
161
 
162
- - Generate type definitions (e.g., Kysely types, enum constants)
163
- - Generate seed data scaffolding from type schemas
164
- - Generate type lists or metadata files
162
+ - Generate table definitions (e.g., Kysely types, enum constants)
163
+ - Generate seed data scaffolding from table schemas
164
+ - Generate table lists or metadata files
165
165
 
166
166
  ```typescript
167
167
  onTailorDBReady(ctx) {
@@ -276,7 +276,7 @@ import type {
276
276
 
277
277
  ## getGeneratedType Helper
278
278
 
279
- The SDK provides an async `getGeneratedType()` helper function to retrieve plugin-generated TailorDB types. This enables plugins and other tools to work with types generated by plugins.
279
+ The SDK provides an async `getGeneratedType()` helper function to retrieve plugin-generated TailorDB tables. This enables plugins and other tools to work with tables generated by plugins.
280
280
 
281
281
  ```typescript
282
282
  import { join } from "node:path";
@@ -285,7 +285,7 @@ import { customer } from "./tailordb/customer";
285
285
 
286
286
  const configPath = join(import.meta.dirname, "./tailor.config.ts");
287
287
 
288
- // Type-attached plugin
288
+ // Table-attached plugin
289
289
  const DeletedCustomer = await getGeneratedType(
290
290
  configPath,
291
291
  "@example/soft-delete",
@@ -301,8 +301,8 @@ const AuditLog = await getGeneratedType(configPath, "@example/audit-log", null,
301
301
 
302
302
  - `configPath`: Path to `tailor.config.ts` (absolute or relative to cwd)
303
303
  - `pluginId`: The plugin's unique identifier (e.g., `"@example/soft-delete"`)
304
- - `sourceType`: The TailorDB type that the plugin is attached to (`null` for namespace plugins)
305
- - `kind`: The generated type kind (e.g., `"archive"`, `"auditLog"`)
304
+ - `sourceType`: The TailorDB table that the plugin is attached to (`null` for namespace plugins)
305
+ - `kind`: The generated table kind (e.g., `"archive"`, `"auditLog"`)
306
306
 
307
307
  **How it works:**
308
308
 
@@ -311,7 +311,7 @@ const AuditLog = await getGeneratedType(configPath, "@example/audit-log", null,
311
311
  3. Auto-resolves the namespace from config
312
312
  4. Calls the plugin's `onTypeLoaded()` or `onNamespaceLoaded()` method
313
313
  5. Caches the result to avoid redundant processing
314
- 6. Returns the generated type matching the specified kind
314
+ 6. Returns the generated table matching the specified kind
315
315
 
316
316
  ## Examples
317
317
 
@@ -341,7 +341,7 @@ function processSoftDelete(
341
341
  const { type, typeConfig, pluginConfig, namespace } = context;
342
342
  const prefix = pluginConfig?.archiveTablePrefix ?? "Deleted_";
343
343
 
344
- // Generate archive type
344
+ // Generate archive table
345
345
  const archiveType = db
346
346
  .table(`${prefix}${type.name}`, {
347
347
  originalId: db.uuid().description("ID of the deleted record"),
@@ -355,7 +355,7 @@ function processSoftDelete(
355
355
  })
356
356
  .description(`Archive for deleted ${type.name} records`);
357
357
 
358
- // Extend source type with deletedAt field
358
+ // Extend source table with deletedAt field
359
359
  const extendFields = {
360
360
  deletedAt: db.datetime({ optional: true }).description("Soft delete timestamp"),
361
361
  };
@@ -470,7 +470,7 @@ import type { Plugin, GeneratorResult } from "@tailor-platform/sdk";
470
470
 
471
471
  const typeListPlugin: Plugin = {
472
472
  id: "@example/type-list",
473
- description: "Generates a list of all TailorDB type names",
473
+ description: "Generates a list of all TailorDB table names",
474
474
 
475
475
  onTailorDBReady(ctx): GeneratorResult {
476
476
  const allTypes = ctx.tailordb.flatMap((ns) =>
@@ -495,15 +495,15 @@ A plugin that uses both definition-time and generation-time hooks:
495
495
  ```typescript
496
496
  const plugin: Plugin = {
497
497
  id: "@example/hybrid",
498
- description: "Generates derived types and produces output files",
498
+ description: "Generates derived tables and produces output files",
499
499
  importPath: "./plugins/hybrid",
500
500
 
501
- // Definition-time: Generate additional types from attached source types
501
+ // Definition-time: Generate additional tables from attached source tables
502
502
  onTypeLoaded(context) {
503
503
  return { types: { derived: createDerivedType(context.type) } };
504
504
  },
505
505
 
506
- // Generation-time: Generate output files from all finalized types
506
+ // Generation-time: Generate output files from all finalized tables
507
507
  onTailorDBReady(ctx) {
508
508
  const allTypes = ctx.tailordb.flatMap((ns) => Object.values(ns.types).map((t) => t.name));
509
509
  return {
@@ -539,7 +539,7 @@ const plugin: Plugin<MyTypeConfig, MyPluginConfig> = {
539
539
  };
540
540
  ```
541
541
 
542
- ### Per-type `.plugin()` type safety (declaration merging)
542
+ ### Per-table `.plugin()` type safety (declaration merging)
543
543
 
544
544
  To enable type checking when users attach plugins via `.plugin()`, provide a declaration merge
545
545
  for the `PluginConfigs` interface. Plugin authors should ship this in their package's type definitions:
@@ -556,7 +556,7 @@ declare module "@tailor-platform/sdk" {
556
556
  }
557
557
  ```
558
558
 
559
- The `Fields` type parameter provides field names from the type being configured, enabling field-aware configurations:
559
+ The `Fields` type parameter provides field names from the table being configured, enabling field-aware configurations:
560
560
 
561
561
  ```typescript
562
562
  declare module "@tailor-platform/sdk" {
@@ -2,15 +2,15 @@
2
2
 
3
3
  > **Beta Feature**: The plugin system is currently in beta. APIs may change in future releases.
4
4
 
5
- Plugins extend TailorDB types by automatically generating additional types, executors, and output files based on your type definitions.
5
+ Plugins extend TailorDB tables by automatically generating additional tables, executors, and output files based on your table definitions.
6
6
 
7
7
  ## Overview
8
8
 
9
9
  When you run `tailor generate`, the SDK:
10
10
 
11
- 1. Loads all TailorDB types with plugin attachments
12
- 2. Passes each type to the attached plugins
13
- 3. Generates additional types and executors based on plugin output
11
+ 1. Loads all TailorDB tables with plugin attachments
12
+ 2. Passes each table to the attached plugins
13
+ 3. Generates additional tables and executors based on plugin output
14
14
  4. Writes all generated files to the appropriate locations
15
15
 
16
16
  This enables plugins to create derived functionality based on your application's schema.
@@ -35,9 +35,9 @@ export default defineConfig({
35
35
 
36
36
  **Important**: The `plugins` export must be a named export (not default).
37
37
 
38
- ### Attaching Plugins to Types
38
+ ### Attaching Plugins to Tables
39
39
 
40
- Use the `.plugin()` method to attach plugins to specific types:
40
+ Use the `.plugin()` method to attach plugins to specific tables:
41
41
 
42
42
  ```typescript
43
43
  import { db } from "@tailor-platform/sdk";
@@ -54,7 +54,7 @@ export const user = db
54
54
 
55
55
  ### Plugin Configuration
56
56
 
57
- Some plugins accept per-type configuration:
57
+ Some plugins accept per-table configuration:
58
58
 
59
59
  ```typescript
60
60
  export const customer = db
@@ -70,9 +70,9 @@ export const customer = db
70
70
  });
71
71
  ```
72
72
 
73
- ### Per-type Config Requirement
73
+ ### Per-table Config Requirement
74
74
 
75
- Per-type config is optional by default. Plugin authors can change this with
75
+ Per-table config is optional by default. Plugin authors can change this with
76
76
  `typeConfigRequired` (boolean or function). When a function is used, it receives
77
77
  the plugin-level config from `definePlugins()`.
78
78
 
@@ -97,9 +97,9 @@ export const plugins = definePlugins(
97
97
 
98
98
  Plugins can generate:
99
99
 
100
- - **Types**: Additional TailorDB types (e.g., `CustomerHistory`, `Deleted_Customer`)
100
+ - **Tables**: Additional TailorDB tables (e.g., `CustomerHistory`, `Deleted_Customer`)
101
101
  - **Executors**: Event handlers triggered by record changes
102
- - **Field Extensions**: Additional fields added to the source type
102
+ - **Field Extensions**: Additional fields added to the source table
103
103
  - **Output Files**: TypeScript code and other files via generation-time hooks
104
104
 
105
105
  Generated files are placed under `.tailor/<plugin-id>/` (the plugin ID is sanitized,
@@ -115,13 +115,13 @@ Plugins have 5 hooks across two lifecycle phases. Each hook fires at a specific
115
115
  ```
116
116
  tailor generate
117
117
 
118
- ├─ Load TailorDB types
119
- │ ├─ onTypeLoaded ← per type with .plugin() attached
118
+ ├─ Load TailorDB tables
119
+ │ ├─ onTypeLoaded ← per table with .plugin() attached
120
120
  │ └─ onNamespaceLoaded ← once per namespace (namespace plugins)
121
121
 
122
122
  ├─ Resolve Auth
123
123
 
124
- ├─ onTailorDBReady ← all types finalized
124
+ ├─ onTailorDBReady ← all tables finalized
125
125
 
126
126
  ├─ Load Resolvers
127
127
 
@@ -134,20 +134,20 @@ tailor generate
134
134
 
135
135
  ### Definition-time hooks
136
136
 
137
- | Hook | Trigger | Can do |
138
- | ------------------- | ----------------------------------- | --------------------------------------------------------------- |
139
- | `onTypeLoaded` | Each type with `.plugin()` attached | Generate types, resolvers, executors; extend source type fields |
140
- | `onNamespaceLoaded` | Once per namespace | Generate types, resolvers, executors |
137
+ | Hook | Trigger | Can do |
138
+ | ------------------- | ------------------------------------ | ----------------------------------------------------------------- |
139
+ | `onTypeLoaded` | Each table with `.plugin()` attached | Generate tables, resolvers, executors; extend source table fields |
140
+ | `onNamespaceLoaded` | Once per namespace | Generate tables, resolvers, executors |
141
141
 
142
- These hooks produce TailorDB types, resolvers, and executors that become part of the application. Requires `importPath` on the plugin.
142
+ These hooks produce TailorDB tables, resolvers, and executors that become part of the application. Requires `importPath` on the plugin.
143
143
 
144
144
  ### Generation-time hooks
145
145
 
146
- | Hook | Available data | Can do |
147
- | ----------------- | ------------------------------------------ | ------------------ |
148
- | `onTailorDBReady` | TailorDB types, Auth | Write output files |
149
- | `onResolverReady` | TailorDB types, Resolvers, Auth | Write output files |
150
- | `onExecutorReady` | TailorDB types, Resolvers, Executors, Auth | Write output files |
146
+ | Hook | Available data | Can do |
147
+ | ----------------- | ------------------------------------------- | ------------------ |
148
+ | `onTailorDBReady` | TailorDB tables, Auth | Write output files |
149
+ | `onResolverReady` | TailorDB tables, Resolvers, Auth | Write output files |
150
+ | `onExecutorReady` | TailorDB tables, Resolvers, Executors, Auth | Write output files |
151
151
 
152
152
  These hooks receive all finalized data and produce output files (TypeScript code, etc.). No `importPath` required.
153
153