@tailor-platform/sdk 2.1.0 → 2.3.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 (98) hide show
  1. package/CHANGELOG.md +199 -0
  2. package/{dist/cli/index.mjs → bin/tailor.mjs} +1 -1
  3. package/dist/application-BZfk4HKm.mjs +3 -0
  4. package/dist/{application-D77KJFKD.mjs → application-F-nl107y.mjs} +121 -27
  5. package/dist/application-F-nl107y.mjs.map +1 -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 +52 -22
  9. package/dist/cli/commands/tailordb/migrate/file-state.d.mts +1 -0
  10. package/dist/cli/commands/tailordb/migrate/generate.d.mts +6 -0
  11. package/dist/cli/commands/tailordb/migrate/rename-detection.d.mts +22 -0
  12. package/dist/cli/commands/tailordb/migrate/schema-checks.d.mts +2 -2
  13. package/dist/cli/commands/tailordb/migrate/snapshot-types.d.mts +9 -2
  14. package/dist/cli/commands/tailordb/migrate/snapshot.d.mts +30 -9
  15. package/dist/cli/lib.d.mts +4 -4
  16. package/dist/cli/lib.mjs +3 -482
  17. package/dist/cli/lib.mjs.map +1 -1
  18. package/dist/cli/main.mjs +1151 -208
  19. package/dist/cli/main.mjs.map +1 -1
  20. package/dist/cli/ts-hook.mjs +52 -7
  21. package/dist/completion/zsh-worker.zsh +167 -4
  22. package/dist/configure/index.d.mts +3 -3
  23. package/dist/configure/index.mjs +90 -23
  24. package/dist/configure/index.mjs.map +1 -1
  25. package/dist/configure/services/index.d.mts +3 -2
  26. package/dist/configure/services/tailordb/index.d.mts +2 -1
  27. package/dist/configure/services/tailordb/schema.d.mts +46 -46
  28. package/dist/configure/services/tailordb/types.d.mts +30 -4
  29. package/dist/configure/services/workflow/index.d.mts +2 -2
  30. package/dist/configure/services/workflow/wait-point.d.mts +72 -13
  31. package/dist/{crashreport-B5LqCTfF.mjs → crashreport-CIIfLnoO.mjs} +2 -2
  32. package/dist/{crashreport-B5LqCTfF.mjs.map → crashreport-CIIfLnoO.mjs.map} +1 -1
  33. package/dist/{crashreport-eI7ty7ok.mjs → crashreport-CINZ5dVN.mjs} +1 -1
  34. package/dist/errors-BVb6vYGy.mjs +89 -0
  35. package/dist/errors-BVb6vYGy.mjs.map +1 -0
  36. package/dist/kysely/index.d.mts +53 -5
  37. package/dist/kysely/index.mjs +7 -2
  38. package/dist/kysely/index.mjs.map +1 -1
  39. package/dist/{logger-CXQq9YIp.mjs → logger-DSdExfor.mjs} +83 -42
  40. package/dist/logger-DSdExfor.mjs.map +1 -0
  41. package/dist/plugin/builtin/seed/index.mjs +1 -1
  42. package/dist/{register-ts-hook-BU18uU44.mjs → register-ts-hook-ClI226n2.mjs} +3541 -703
  43. package/dist/register-ts-hook-ClI226n2.mjs.map +1 -0
  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-k1xy_A5G.mjs → service-C_WpbKHu.mjs} +39 -5
  51. package/dist/service-C_WpbKHu.mjs.map +1 -0
  52. package/dist/service-D1RCdzIL.mjs +3 -0
  53. package/dist/{service-B5WynBHQ.mjs → service-hZskxZmg.mjs} +3 -3
  54. package/dist/{service-B5WynBHQ.mjs.map → service-hZskxZmg.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 +6 -3
  59. package/dist/utils/test/index.mjs +25 -13
  60. package/dist/utils/test/index.mjs.map +1 -1
  61. package/dist/vitest/index.d.mts +2 -1
  62. package/dist/vitest/index.mjs +167 -3
  63. package/dist/vitest/index.mjs.map +1 -1
  64. package/dist/vitest/mocks/workflow.d.mts +13 -1
  65. package/dist/vitest/pglite-kysely.d.mts +43 -0
  66. package/dist/wait-point-invoker-__oE88_P.mjs +148 -0
  67. package/dist/wait-point-invoker-__oE88_P.mjs.map +1 -0
  68. package/dist/wait-point-registry-TL99zotw.mjs +47 -0
  69. package/dist/wait-point-registry-TL99zotw.mjs.map +1 -0
  70. package/dist/{workspace_resource_pb-DXnO2AT-.mjs → workspace_resource_pb-HNIL_Vfj.mjs} +10 -2
  71. package/dist/{workspace_resource_pb-DXnO2AT-.mjs.map → workspace_resource_pb-HNIL_Vfj.mjs.map} +1 -1
  72. package/docs/cli/setup.md +14 -1
  73. package/docs/cli/tailordb.md +96 -28
  74. package/docs/cli-reference.md +15 -12
  75. package/docs/configuration.md +1 -1
  76. package/docs/github-actions.md +73 -28
  77. package/docs/migration/v2.md +55 -1
  78. package/docs/plugin/custom.md +48 -48
  79. package/docs/plugin/index.md +24 -24
  80. package/docs/services/auth.md +10 -10
  81. package/docs/services/executor.md +1 -1
  82. package/docs/services/resolver.md +2 -2
  83. package/docs/services/tailordb-migration.md +485 -84
  84. package/docs/services/tailordb.md +28 -28
  85. package/docs/services/workflow.md +52 -2
  86. package/docs/testing.md +14 -0
  87. package/package.json +12 -7
  88. package/dist/application-Af1zIqSI.mjs +0 -3
  89. package/dist/application-D77KJFKD.mjs.map +0 -1
  90. package/dist/errors-D7583Zz7.mjs +0 -58
  91. package/dist/errors-D7583Zz7.mjs.map +0 -1
  92. package/dist/logger-CXQq9YIp.mjs.map +0 -1
  93. package/dist/register-ts-hook-BU18uU44.mjs.map +0 -1
  94. package/dist/seed-B-yckgQY.mjs.map +0 -1
  95. package/dist/service-M7OYziQP.mjs +0 -3
  96. package/dist/service-k1xy_A5G.mjs.map +0 -1
  97. package/dist/test-env-key-D7UkZp99.mjs +0 -75
  98. package/dist/test-env-key-D7UkZp99.mjs.map +0 -1
@@ -8,22 +8,22 @@ TailorDB provides:
8
8
 
9
9
  - Type-safe schema definitions using TypeScript
10
10
  - Automatic GraphQL API generation (CRUD operations)
11
- - Relations between types with automatic index and foreign key constraints
11
+ - Relations between tables with automatic index and foreign key constraints
12
12
  - Permission system for access control
13
13
  - Field-level hooks and validations
14
14
 
15
15
  For the official Tailor Platform documentation, see [TailorDB Guide](https://docs.tailor.tech/guides/tailordb/overview).
16
16
 
17
- ## Type Definition
17
+ ## Table Definition
18
18
 
19
- Define TailorDB Types in files matching glob patterns specified in `tailor.config.ts`.
19
+ Define TailorDB tables in files matching glob patterns specified in `tailor.config.ts`.
20
20
 
21
21
  **Definition Rules:**
22
22
 
23
- - **Multiple types per file**: You can define multiple TailorDB types in a single file
23
+ - **Multiple tables per file**: You can define multiple TailorDB tables in a single file
24
24
  - **Export method**: Use named exports (`export const`)
25
25
  - **Export both value and type**: Always export both the runtime value and TypeScript type
26
- - **Uniqueness**: Type names must be unique across all TailorDB namespaces in the application
26
+ - **Uniqueness**: Table names must be unique across all TailorDB namespaces in the application
27
27
 
28
28
  ```typescript
29
29
  import { db } from "@tailor-platform/sdk";
@@ -37,7 +37,7 @@ export const user = db.table("User", {
37
37
  });
38
38
  export type user = typeof user;
39
39
 
40
- // You can define multiple types in the same file
40
+ // You can define multiple tables in the same file
41
41
  export const role = db.table("Role", {
42
42
  name: db.string().unique(),
43
43
  });
@@ -254,8 +254,8 @@ type User {
254
254
  }
255
255
  ```
256
256
 
257
- - `toward.as` - Customizes the field name for accessing the related type from this type
258
- - `backward` - Customizes the field name for accessing this type from the related type
257
+ - `toward.as` - Customizes the field name for accessing the related table from this table
258
+ - `backward` - Customizes the field name for accessing this table from the related table
259
259
 
260
260
  Relation names share the same GraphQL field namespace as fields, files, and other relations on
261
261
  the table. The SDK rejects duplicate or empty relation names. When `toward.as` is omitted, the
@@ -356,7 +356,7 @@ export const order = db
356
356
  });
357
357
  ```
358
358
 
359
- **Note:** `.hooks()` can only be called once on a type. Duplicate type-level calls fail at compile time and throw at runtime.
359
+ **Note:** `.hooks()` can only be called once on a table. Duplicate type-level calls fail at compile time and throw at runtime.
360
360
 
361
361
  ### Validation
362
362
 
@@ -415,7 +415,7 @@ For datetime/date/time fields, pass `"now"` to use the operation timestamp:
415
415
  db.datetime().default("now");
416
416
  ```
417
417
 
418
- **Note:** `.validate()` can only be called once on a type. Duplicate type-level calls fail at compile time and throw at runtime.
418
+ **Note:** `.validate()` can only be called once on a table. Duplicate type-level calls fail at compile time and throw at runtime.
419
419
 
420
420
  ### Vector Search
421
421
 
@@ -448,14 +448,14 @@ export const user = db.table("User", {
448
448
 
449
449
  `db.fields.timestamps()` adds non-null `createdAt` and `updatedAt` datetime fields. Both fields are populated when a record is created; provided values are preserved so seed data can use historical timestamps. `updatedAt` is also refreshed automatically when a record is updated.
450
450
 
451
- ## Type Modifiers
451
+ ## Table Modifiers
452
452
 
453
- Type builder methods that set one type-level configuration can be called only once on the same type. Duplicate calls fail at compile time and throw at runtime. This applies to `.description()`, `.hooks()`, `.validate()`, `.features()`, `.indexes()`, `.files()`, `.permission()`, and `.gqlPermission()`.
453
+ Table builder methods that set one type-level configuration can be called only once on the same table. Duplicate calls fail at compile time and throw at runtime. This applies to `.description()`, `.hooks()`, `.validate()`, `.features()`, `.indexes()`, `.files()`, `.permission()`, and `.gqlPermission()`.
454
454
 
455
455
  Conditional assignment is still supported when only one branch calls the method:
456
456
 
457
457
  ```typescript
458
- let user = db.type("User", {
458
+ let user = db.table("User", {
459
459
  name: db.string(),
460
460
  });
461
461
 
@@ -502,7 +502,7 @@ db.table("User", {
502
502
 
503
503
  #### Event Publishing
504
504
 
505
- Enable event publishing for a type to trigger executors on record changes:
505
+ Enable event publishing for a table to trigger executors on record changes:
506
506
 
507
507
  ```typescript
508
508
  db.table("User", {
@@ -515,15 +515,15 @@ db.table("User", {
515
515
  **Behavior:**
516
516
 
517
517
  - When `publishEvents: true`, record creation/update/deletion events are published
518
- - When not specified, `deploy` sets it from the executors taking part in the same run: `true` while one of them uses this type with `recordCreatedTrigger`, `recordUpdatedTrigger`, or `recordDeletedTrigger`, and `false` once none does. Removing the last such trigger turns publishing back off on the next `deploy`
519
- - When explicitly set to `false` while an executor taking part in the same run uses this type, `deploy` fails
518
+ - When not specified, `deploy` sets it from the executors taking part in the same run: `true` while one of them uses this table with `recordCreatedTrigger`, `recordUpdatedTrigger`, or `recordDeletedTrigger`, and `false` once none does. Removing the last such trigger turns publishing back off on the next `deploy`
519
+ - When explicitly set to `false` while an executor taking part in the same run uses this table, `deploy` fails
520
520
 
521
521
  **Use cases:**
522
522
 
523
523
  1. **Auto-detection (recommended)**: Don't set `publishEvents` - `deploy` enables it while an executor taking part in the same run needs it
524
524
 
525
525
  ```typescript
526
- // publishEvents is automatically enabled because an executor uses this type
526
+ // publishEvents is automatically enabled because an executor uses this table
527
527
  export const order = db.table("Order", {
528
528
  status: db.string(),
529
529
  });
@@ -545,7 +545,7 @@ db.table("User", {
545
545
  });
546
546
  ```
547
547
 
548
- 3. **Explicit disable**: Disable event publishing for a type that doesn't need it (error if an executor taking part in the same run uses it)
548
+ 3. **Explicit disable**: Disable event publishing for a table that doesn't need it (error if an executor taking part in the same run uses it)
549
549
 
550
550
  ```typescript
551
551
  db.table("TempData", {
@@ -555,14 +555,14 @@ db.table("User", {
555
555
  });
556
556
  ```
557
557
 
558
- **Sharing a type across configs:** an executor in another config auto-enables publishing the same way, as long as both configs take part in the same `deploy` (`--config a,b`). `deploy` records that dependency, so deploying the owning config alone later asks for confirmation instead of silently turning publishing off — it fails outright in a non-interactive environment. Set `publishEvents: true` on the type to keep it on regardless of which configs take part.
558
+ **Sharing a table across configs:** an executor in another config auto-enables publishing the same way, as long as both configs take part in the same `deploy` (`--config a,b`). `deploy` records that dependency, so deploying the owning config alone later asks for confirmation instead of silently turning publishing off — it fails outright in a non-interactive environment. Set `publishEvents: true` on the table to keep it on regardless of which configs take part.
559
559
 
560
560
  #### GraphQL Operations
561
561
 
562
- Control which GraphQL operations (`create`, `update`, `delete`, `read`) are exposed for a type. All operations are enabled by default.
562
+ Control which GraphQL operations (`create`, `update`, `delete`, `read`) are exposed for a table. All operations are enabled by default.
563
563
 
564
564
  ```typescript
565
- db.type("Order", {
565
+ db.table("Order", {
566
566
  status: db.string(),
567
567
  }).features({
568
568
  gqlOperations: {
@@ -571,10 +571,10 @@ db.type("Order", {
571
571
  });
572
572
  ```
573
573
 
574
- Use the `"query"` alias to disable all mutations at once (read-only type: `create`/`update`/`delete` false, `read` true):
574
+ Use the `"query"` alias to disable all mutations at once (read-only table: `create`/`update`/`delete` false, `read` true):
575
575
 
576
576
  ```typescript
577
- db.type("AuditLog", {
577
+ db.table("AuditLog", {
578
578
  action: db.string(),
579
579
  }).features({
580
580
  gqlOperations: "query",
@@ -583,7 +583,7 @@ db.type("AuditLog", {
583
583
 
584
584
  **Namespace-level default**
585
585
 
586
- Set a default for every type in a TailorDB namespace in `tailor.config.ts`. A type's own `.features({ gqlOperations })` always takes precedence over this default.
586
+ Set a default for every table in a TailorDB namespace in `tailor.config.ts`. A table's own `.features({ gqlOperations })` always takes precedence over this default.
587
587
 
588
588
  ```typescript
589
589
  // tailor.config.ts
@@ -591,13 +591,13 @@ export default defineConfig({
591
591
  db: {
592
592
  tailordb: {
593
593
  files: ["./tailordb/*.ts"],
594
- gqlOperations: { delete: false }, // Default for every type in this namespace
594
+ gqlOperations: { delete: false }, // Default for every table in this namespace
595
595
  },
596
596
  },
597
597
  });
598
598
  ```
599
599
 
600
- This default is re-evaluated on every `tailor deploy`, so changing it also updates types that already exist on the platform, not only newly created ones.
600
+ This default is re-evaluated on every `tailor deploy`, so changing it also updates tables that already exist on the platform, not only newly created ones.
601
601
 
602
602
  ### Field Extraction (`pickFields` / `omitFields`)
603
603
 
@@ -679,7 +679,7 @@ Configure Permission and GQLPermission. For details, see the [TailorDB Permissio
679
679
 
680
680
  **Important**: Following the secure-by-default principle, all operations are denied if permissions are not configured. You must explicitly grant permissions for each operation (create, read, update, delete).
681
681
 
682
- `generate`/`deploy` reject a type that has no `.permission()`, or no `.gqlPermission()` while GraphQL operations are enabled for it (see [GraphQL Operations](#graphql-operations) above). Disable GraphQL exposure entirely with `.features({ gqlOperations: { create: false, update: false, delete: false, read: false } })` if a type only needs record-level permission.
682
+ `generate`/`deploy` reject a table that has no `.permission()`, or no `.gqlPermission()` while GraphQL operations are enabled for it (see [GraphQL Operations](#graphql-operations) above). Disable GraphQL exposure entirely with `.features({ gqlOperations: { create: false, update: false, delete: false, read: false } })` if a table only needs record-level permission.
683
683
 
684
684
  ```typescript
685
685
  db.table("User", {
@@ -723,6 +723,6 @@ db.table("User", {
723
723
 
724
724
  ## Migrations
725
725
 
726
- When you change a TailorDB type definition, the SDK can generate a migration that captures the diff and, for breaking changes, runs a data transformation script during `tailor deploy`. See the [TailorDB Migrations guide](./tailordb-migration.md) for the full workflow, configuration, supported change types, team coordination, and troubleshooting.
726
+ When you change a TailorDB table definition, the SDK can generate a migration that captures the diff and, for breaking changes, runs a data transformation script during `tailor deploy`. See the [TailorDB Migrations guide](./tailordb-migration.md) for the full workflow, configuration, supported change types, team coordination, and troubleshooting.
727
727
 
728
728
  For the CLI command reference, see [`tailordb migration`](../cli/tailordb.md#tailordb-migration).
@@ -248,6 +248,8 @@ export const approval = createWaitPoint<
248
248
  >("approval");
249
249
  ```
250
250
 
251
+ Keys must match `[a-z0-9-]`, be 3 to 63 characters long, and start and end with `[a-z0-9]`.
252
+
251
253
  For multiple wait points, use `createWaitPoints` with a builder callback. Property names become wait point keys, and JSDoc on each property is preserved in IDE autocompletion:
252
254
 
253
255
  ```typescript
@@ -255,9 +257,19 @@ import { createWaitPoints } from "@tailor-platform/sdk";
255
257
 
256
258
  export const waitPoints = createWaitPoints((define) => ({
257
259
  /** Manager approval step */
258
- managerApproval: define<{ amount: number }, { approved: boolean }>(),
260
+ "manager-approval": define<{ amount: number }, { approved: boolean }>(),
259
261
  /** Finance review step */
260
- financeReview: define<{ invoiceId: string }, { validated: boolean }>(),
262
+ "finance-review": define<{ invoiceId: string }, { validated: boolean }>(),
263
+ }));
264
+
265
+ await waitPoints["manager-approval"].wait({ amount: 50000 });
266
+ ```
267
+
268
+ Pass the key to `define` when the property name you want to read at the call site is not a valid key:
269
+
270
+ ```typescript
271
+ export const waitPoints = createWaitPoints((define) => ({
272
+ managerApproval: define.for("manager-approval")<{ amount: number }, { approved: boolean }>(),
261
273
  }));
262
274
 
263
275
  await waitPoints.managerApproval.wait({ amount: 50000 });
@@ -335,6 +347,44 @@ export default createResolver({
335
347
 
336
348
  Wait points can be imported and used in any file (workflow jobs, resolvers, executors). For local testing, see [Jobs that wait on approval](../testing.md#jobs-that-wait-on-approval) in the testing guide.
337
349
 
350
+ ### Keys With Runtime Values
351
+
352
+ A wait point key identifies one suspension inside one execution. When a job suspends more than once for the same reason — one approval per order line, one per approver — every suspension needs its own key, otherwise the second `wait()` fails because a suspension with that key is already pending.
353
+
354
+ Write `$paramName` as a whole `-`-delimited segment of the key to leave a slot for a runtime value — `line-approval-$lineId` works, `line-approval$lineId` does not. Declare such a key through `createWaitPoints`, passing it to `define` **before** the `Payload` and `Result` type arguments — the param names then become the argument of `.with()`, which builds the concrete key:
355
+
356
+ ```typescript
357
+ export const { lineApproval } = createWaitPoints((define) => ({
358
+ lineApproval: define.for("line-approval-$lineId")<{ message: string }, { approved: boolean }>(),
359
+ }));
360
+
361
+ // Suspends on "line-approval-<lineId>", so parallel lines never collide
362
+ const result = await lineApproval.with({ lineId: line.id }).wait({ message: "Please approve" });
363
+ ```
364
+
365
+ The key has to come before the type arguments because TypeScript stops inferring it as a literal type once `Payload` and `Result` are given explicitly, and the param names can only be read off a literal. `createWaitPoint` takes its type arguments first, so it cannot type `$params` at all, and `deploy` rejects such a key — one wait point per key is what it is for, and a key with `$params` stands for a family of them.
366
+
367
+ `deploy` checks every declared key against the grammar above, so a key the platform would reject is reported before anything is deployed.
368
+
369
+ A parameterized wait point exposes only `.with()` — there is no way to wait on the unsubstituted key.
370
+
371
+ Resolve it from the same param values:
372
+
373
+ ```typescript
374
+ await lineApproval.with({ lineId: input.lineId }).resolve(input.executionId, (payload) => {
375
+ console.log("Resolving:", payload.message);
376
+ return { approved: input.approved };
377
+ });
378
+ ```
379
+
380
+ Rules to keep in mind:
381
+
382
+ - Param values must match `[a-z0-9-]`, cannot be empty, and cannot start or end with `-`. Record IDs work as-is; uppercase or underscored values do not.
383
+ - The composed key still has to fit 63 characters. A UUID takes 36, so a key holding one leaves 26 characters for everything else.
384
+ - The key needs at least one literal segment alongside its `$params`, so `"$lineId"` alone is rejected: a key made only of caller data carries no identity of its own.
385
+ - Param values are part of the key, so they must be derived from the job's input. A value from `Date.now()` or `Math.random()` changes when the platform replays the job and the execution fails.
386
+ - Keys are compared exactly, and the SDK does not check whether two declared keys can produce the same string. `"a-$x"` with `x = "b-c"` and `"a-b-$y"` with `y = "c"` both produce `a-b-c`. Keep the literal part of each key distinct, and prefer putting `$params` last.
387
+
338
388
  ## Retry Policy
339
389
 
340
390
  You can configure automatic retry behavior with exponential backoff by setting `retryPolicy` on a workflow. All fields are required when `retryPolicy` is set:
package/docs/testing.md CHANGED
@@ -180,6 +180,18 @@ await approvalWaitPoint.wait({ message: "Please approve" });
180
180
  expect(approvalMock.wait).toHaveBeenCalledWith({ message: "Please approve" });
181
181
  ```
182
182
 
183
+ For a wait point whose key contains `$params`, use `waitPointWith(definition, params)` to control one param binding at a time. Calls made with any other binding fall through to the platform mock:
184
+
185
+ ```typescript
186
+ using wf = mockWorkflow();
187
+ const lineOne = wf.waitPointWith(lineApproval, { lineId: "line-1" });
188
+
189
+ lineOne.wait.mockResolvedValue({ approved: true });
190
+ await lineApproval.with({ lineId: "line-1" }).wait({ message: "Please approve" });
191
+
192
+ expect(lineOne.wait).toHaveBeenCalledWith({ message: "Please approve" });
193
+ ```
194
+
183
195
  Use `wf.setEnv(...)` when locally-run workflow job bodies need configuration values. Per-run `runWorkflowLocally(..., { env })` options take precedence over the mock's env.
184
196
 
185
197
  ### SecretManager Mock
@@ -582,6 +594,8 @@ describe("upsertUsers resolver", () => {
582
594
 
583
595
  Reach for [`mockTailordb`](#mocking-the-tailordb-client) instead when you want to drive the raw query sequence at the `tailordb.Client` level rather than at the Kysely layer.
584
596
 
597
+ TailorDB migration scripts (`migrate.ts`) are unit-tested the same way: the generated `db.ts` exports the `Database` interface to type the mock, and `tailor tailordb migration script <N> --with-test` scaffolds a ready-to-fill test. To execute a migration script against real rows in an in-memory Postgres, use `createKyselyPGlite` with `@electric-sql/pglite`. See [Testing Migrations Locally](./services/tailordb-migration.md#testing-migrations-locally).
598
+
585
599
  #### Resolvers that resume a workflow
586
600
 
587
601
  Resolvers that call `waitPoint.resolve(...)` delegate to `tailor.workflow.resolve` at runtime. With the `tailor-runtime` environment active, use `mockWorkflow().waitPoint(definition)` to invoke the callback with the payload that originally suspended the job:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tailor-platform/sdk",
3
- "version": "2.1.0",
3
+ "version": "2.3.0",
4
4
  "description": "Tailor Platform SDK - The SDK to work with Tailor Platform",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -9,9 +9,10 @@
9
9
  "directory": "packages/sdk"
10
10
  },
11
11
  "bin": {
12
- "tailor": "./dist/cli/index.mjs"
12
+ "tailor": "./bin/tailor.mjs"
13
13
  },
14
14
  "files": [
15
+ "bin",
15
16
  "CHANGELOG.md",
16
17
  "dist",
17
18
  "docs",
@@ -168,18 +169,17 @@
168
169
  "@secretlint/secretlint-rule-preset-recommend": "13.0.4",
169
170
  "@standard-schema/spec": "1.1.0",
170
171
  "@tailor-platform/function-kysely-tailordb": "0.1.3",
171
- "@toiroakr/lines-db": "0.11.0",
172
+ "@toiroakr/lines-db": "0.12.0",
172
173
  "@toiroakr/read-multiline": "0.4.1",
173
174
  "@urql/core": "6.0.3",
174
175
  "amaro": "1.1.11",
175
- "chalk": "5.6.2",
176
176
  "confbox": "0.2.4",
177
177
  "date-fns": "4.4.0",
178
178
  "es-toolkit": "1.50.0",
179
179
  "find-up-simple": "1.0.1",
180
180
  "get-east-asian-width": "1.6.0",
181
181
  "get-tsconfig": "4.14.1",
182
- "globals": "17.8.0",
182
+ "globals": "17.9.0",
183
183
  "graphql": "17.0.2",
184
184
  "inflection": "3.0.2",
185
185
  "kysely": "0.29.4",
@@ -204,7 +204,7 @@
204
204
  "@opentelemetry/sdk-trace-base": "2.10.0",
205
205
  "@types/mime-types": "3.0.1",
206
206
  "@types/node": "24.13.3",
207
- "@types/semver": "7.7.1",
207
+ "@types/semver": "7.8.0",
208
208
  "@typescript/native-preview": "7.0.0-dev.20260707.2",
209
209
  "@vitest/coverage-v8": "4.1.10",
210
210
  "eslint-plugin-zod": "4.9.0",
@@ -216,13 +216,18 @@
216
216
  "typescript": "6.0.3",
217
217
  "vitest": "4.1.10",
218
218
  "zinfer": "0.2.7",
219
+ "@tailor-platform/shared": "^0.0.0",
219
220
  "@tailor-platform/tailor-proto": "^0.0.1"
220
221
  },
221
222
  "peerDependencies": {
223
+ "@electric-sql/pglite": ">=0.2.0",
222
224
  "vite": "^6.0.0 || ^7.0.0 || ^8.0.0",
223
225
  "vitest": ">=4"
224
226
  },
225
227
  "peerDependenciesMeta": {
228
+ "@electric-sql/pglite": {
229
+ "optional": true
230
+ },
226
231
  "vite": {
227
232
  "optional": true
228
233
  },
@@ -241,7 +246,7 @@
241
246
  "test:coverage": "vitest --coverage",
242
247
  "docs:check": "vitest run --project=unit* src/cli/docs.test.ts",
243
248
  "docs:update": "POLITTY_DOCS_UPDATE=true vitest run --project=unit* src/cli/docs.test.ts",
244
- "build": "tsdown && politty generate-shim --entry ./main.mjs --program tailor && politty generate-worker --bin dist/cli/main.mjs --program tailor --shell zsh --verify",
249
+ "build": "tsdown && politty generate-shim --entry ../dist/cli/main.mjs --program tailor && politty generate-worker --bin dist/cli/main.mjs --program tailor --shell zsh --verify",
245
250
  "lint": "oxlint --type-aware .",
246
251
  "check:public-api-jsdoc": "node --experimental-strip-types scripts/check-public-api-jsdoc.ts",
247
252
  "check:zod-isolation": "node --experimental-strip-types scripts/check-zod-isolation.ts",
@@ -1,3 +0,0 @@
1
- import { n as generatePluginFilesIfNeeded, r as loadApplication, t as defineApplication } from "./application-D77KJFKD.mjs";
2
-
3
- export { defineApplication, generatePluginFilesIfNeeded };