@tailor-platform/sdk 1.20.0 → 1.21.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 (33) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/{application-Bli2ieqY.mjs → application-CEv5c7TU.mjs} +7 -5
  3. package/dist/{application-Bli2ieqY.mjs.map → application-CEv5c7TU.mjs.map} +1 -1
  4. package/dist/{application-CZdieD3K.mjs → application-DiCzM9b0.mjs} +2 -2
  5. package/dist/cli/index.mjs +3 -3
  6. package/dist/cli/lib.d.mts +7 -6
  7. package/dist/cli/lib.mjs +3 -3
  8. package/dist/configure/index.d.mts +3 -3
  9. package/dist/configure/index.mjs +5 -0
  10. package/dist/configure/index.mjs.map +1 -1
  11. package/dist/{index-B86CIKCW.d.mts → index-BWVAwea4.d.mts} +2 -2
  12. package/dist/{index-DcY0e3S5.d.mts → index-CnHd6BNg.d.mts} +8 -3
  13. package/dist/{index-i6QUsr5p.d.mts → index-Dn61THJK.d.mts} +2 -2
  14. package/dist/{index-CGjiOz_W.d.mts → index-DxlmLUag.d.mts} +2 -2
  15. package/dist/{index-CIXOwe6g.d.mts → index-oZXVKyfX.d.mts} +2 -2
  16. package/dist/plugin/builtin/enum-constants/index.d.mts +2 -2
  17. package/dist/plugin/builtin/file-utils/index.d.mts +2 -2
  18. package/dist/plugin/builtin/kysely-type/index.d.mts +2 -2
  19. package/dist/plugin/builtin/seed/index.d.mts +2 -2
  20. package/dist/plugin/builtin/seed/index.mjs +1 -1
  21. package/dist/plugin/index.d.mts +1 -1
  22. package/dist/{seed-CeUEANfQ.mjs → seed-D-rYCN5F.mjs} +2 -2
  23. package/dist/{seed-CeUEANfQ.mjs.map → seed-D-rYCN5F.mjs.map} +1 -1
  24. package/dist/{types-C14GuyPI.d.mts → types-C0o90Cmb.d.mts} +2 -2
  25. package/dist/types-ClK_HJ0G.mjs.map +1 -1
  26. package/dist/{types-CNw4p8V7.d.mts → types-QKq1usl7.d.mts} +19 -8
  27. package/dist/{update-DkpWgrzL.mjs → update-9MTRN1UA.mjs} +121 -87
  28. package/dist/update-9MTRN1UA.mjs.map +1 -0
  29. package/dist/utils/test/index.d.mts +3 -3
  30. package/docs/services/resolver.md +61 -0
  31. package/docs/services/tailordb.md +55 -0
  32. package/package.json +1 -1
  33. package/dist/update-DkpWgrzL.mjs.map +0 -1
@@ -1,7 +1,7 @@
1
1
  /// <reference path="./../../user-defined.d.ts" />
2
- import { Ot as TailorField, s as TailorDBType } from "../../types-CNw4p8V7.mjs";
3
- import "../../types-C14GuyPI.mjs";
4
- import { G as WORKFLOW_TEST_USER_KEY, W as WORKFLOW_TEST_ENV_KEY, n as output } from "../../index-DcY0e3S5.mjs";
2
+ import { Ot as TailorField, s as TailorDBType } from "../../types-QKq1usl7.mjs";
3
+ import "../../types-C0o90Cmb.mjs";
4
+ import { G as WORKFLOW_TEST_USER_KEY, W as WORKFLOW_TEST_ENV_KEY, n as output } from "../../index-CnHd6BNg.mjs";
5
5
  import { StandardSchemaV1 } from "@standard-schema/spec";
6
6
 
7
7
  //#region src/utils/test/index.d.ts
@@ -214,3 +214,64 @@ createResolver({
214
214
  // ...
215
215
  });
216
216
  ```
217
+
218
+ ## Event Publishing
219
+
220
+ Enable event publishing for a resolver to trigger executors on resolver execution:
221
+
222
+ ```typescript
223
+ createResolver({
224
+ name: "processOrder",
225
+ operation: "mutation",
226
+ publishEvents: true,
227
+ // ...
228
+ });
229
+ ```
230
+
231
+ **Behavior:**
232
+
233
+ - When `publishEvents: true`, resolver execution events are published
234
+ - When not specified, it is **automatically set to `true`** if an executor uses this resolver with `resolverExecutedTrigger`
235
+ - When explicitly set to `false` while an executor uses this resolver, an error is thrown during `tailor apply`
236
+
237
+ **Use cases:**
238
+
239
+ 1. **Auto-detection (recommended)**: Don't set `publishEvents` - the SDK automatically enables it when needed by executors
240
+
241
+ ```typescript
242
+ // publishEvents is automatically enabled because an executor uses this resolver
243
+ export default createResolver({
244
+ name: "processPayment",
245
+ operation: "mutation",
246
+ // publishEvents not set - auto-detected
247
+ // ...
248
+ });
249
+
250
+ // In executor file:
251
+ export default createExecutor({
252
+ trigger: resolverExecutedTrigger("processPayment"),
253
+ // ...
254
+ });
255
+ ```
256
+
257
+ 2. **Manual enable**: Enable event publishing for external consumers or debugging
258
+
259
+ ```typescript
260
+ createResolver({
261
+ name: "auditAction",
262
+ operation: "mutation",
263
+ publishEvents: true, // Enable even without executor triggers
264
+ // ...
265
+ });
266
+ ```
267
+
268
+ 3. **Explicit disable**: Disable event publishing for a resolver that doesn't need it (error if executor uses it)
269
+
270
+ ```typescript
271
+ createResolver({
272
+ name: "internalHelper",
273
+ operation: "query",
274
+ publishEvents: false, // Explicitly disable
275
+ // ...
276
+ });
277
+ ```
@@ -394,6 +394,61 @@ db.type("User", {
394
394
  });
395
395
  ```
396
396
 
397
+ #### Event Publishing
398
+
399
+ Enable event publishing for a type to trigger executors on record changes:
400
+
401
+ ```typescript
402
+ db.type("User", {
403
+ name: db.string(),
404
+ }).features({
405
+ publishEvents: true,
406
+ });
407
+ ```
408
+
409
+ **Behavior:**
410
+
411
+ - When `publishEvents: true`, record creation/update/deletion events are published
412
+ - When not specified, it is **automatically set to `true`** if an executor uses this type with `recordCreatedTrigger`, `recordUpdatedTrigger`, or `recordDeletedTrigger`
413
+ - When explicitly set to `false` while an executor uses this type, an error is thrown during `tailor apply`
414
+
415
+ **Use cases:**
416
+
417
+ 1. **Auto-detection (recommended)**: Don't set `publishEvents` - the SDK automatically enables it when needed by executors
418
+
419
+ ```typescript
420
+ // publishEvents is automatically enabled because an executor uses this type
421
+ export const order = db.type("Order", {
422
+ status: db.string(),
423
+ });
424
+
425
+ // In executor file:
426
+ export default createExecutor({
427
+ trigger: recordCreatedTrigger(order),
428
+ // ...
429
+ });
430
+ ```
431
+
432
+ 2. **Manual enable**: Enable event publishing for external consumers or debugging
433
+
434
+ ```typescript
435
+ db.type("AuditLog", {
436
+ action: db.string(),
437
+ }).features({
438
+ publishEvents: true, // Enable even without executor triggers
439
+ });
440
+ ```
441
+
442
+ 3. **Explicit disable**: Disable event publishing for a type that doesn't need it (error if executor uses it)
443
+
444
+ ```typescript
445
+ db.type("TempData", {
446
+ data: db.string(),
447
+ }).features({
448
+ publishEvents: false, // Explicitly disable
449
+ });
450
+ ```
451
+
397
452
  ### Permissions
398
453
 
399
454
  Configure Permission and GQLPermission. For details, see the [TailorDB Permission documentation](https://docs.tailor.tech/guides/tailordb/permission).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tailor-platform/sdk",
3
- "version": "1.20.0",
3
+ "version": "1.21.0",
4
4
  "description": "Tailor Platform SDK - The SDK to work with Tailor Platform",
5
5
  "license": "MIT",
6
6
  "repository": {