@tailor-platform/sdk 1.19.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.
- package/CHANGELOG.md +44 -0
- package/dist/{application-A6PZjujv.mjs → application-CEv5c7TU.mjs} +97929 -97634
- package/dist/application-CEv5c7TU.mjs.map +1 -0
- package/dist/{application-nPS5veK6.mjs → application-DiCzM9b0.mjs} +3 -3
- package/dist/cli/index.mjs +118 -63
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +117 -58
- package/dist/cli/lib.mjs +7 -7
- package/dist/cli/lib.mjs.map +1 -1
- package/dist/cli/skills.mjs +1 -1
- package/dist/cli/skills.mjs.map +1 -1
- package/dist/configure/index.d.mts +4 -4
- package/dist/configure/index.mjs +5 -0
- package/dist/configure/index.mjs.map +1 -1
- package/dist/{index-B91ZpOcd.d.mts → index-BWVAwea4.d.mts} +2 -2
- package/dist/{index-ClLZCbcm.d.mts → index-CnHd6BNg.d.mts} +9 -43
- package/dist/{index-DDqKNFh4.d.mts → index-Dn61THJK.d.mts} +2 -2
- package/dist/{index-B6pvy1MK.d.mts → index-DxlmLUag.d.mts} +2 -2
- package/dist/{index-CPzbMghQ.d.mts → index-oZXVKyfX.d.mts} +2 -2
- package/dist/{package-json-DUY2kB6z.mjs → package-json-3H5gfhA4.mjs} +2 -2
- package/dist/package-json-3H5gfhA4.mjs.map +1 -0
- package/dist/package-json-DTDAqRRJ.mjs +3 -0
- package/dist/plugin/builtin/enum-constants/index.d.mts +2 -2
- package/dist/plugin/builtin/file-utils/index.d.mts +2 -2
- package/dist/plugin/builtin/kysely-type/index.d.mts +2 -2
- package/dist/plugin/builtin/seed/index.d.mts +2 -2
- package/dist/plugin/builtin/seed/index.mjs +1 -1
- package/dist/plugin/index.d.mts +1 -1
- package/dist/{seed-CeUEANfQ.mjs → seed-D-rYCN5F.mjs} +2 -2
- package/dist/{seed-CeUEANfQ.mjs.map → seed-D-rYCN5F.mjs.map} +1 -1
- package/dist/telemetry-Dhzj9Ncm.mjs +3 -0
- package/dist/{telemetry-rFq0QdvJ.mjs → telemetry-DuBhnd0X.mjs} +2 -2
- package/dist/telemetry-DuBhnd0X.mjs.map +1 -0
- package/dist/{types-CJF3Y1x8.d.mts → types-C0o90Cmb.d.mts} +87 -3
- package/dist/types-ClK_HJ0G.mjs.map +1 -1
- package/dist/{types-CblXasFV.d.mts → types-QKq1usl7.d.mts} +20 -9
- package/dist/{update-Cr5c7h1r.mjs → update-9MTRN1UA.mjs} +456 -244
- package/dist/update-9MTRN1UA.mjs.map +1 -0
- package/dist/utils/test/index.d.mts +3 -3
- package/docs/cli/application.md +2 -0
- package/docs/services/resolver.md +61 -0
- package/docs/services/tailordb.md +55 -0
- package/package.json +1 -1
- package/dist/application-A6PZjujv.mjs.map +0 -1
- package/dist/package-json-DUY2kB6z.mjs.map +0 -1
- package/dist/package-json-Dd1AnA5F.mjs +0 -3
- package/dist/telemetry-9A1BZqbl.mjs +0 -3
- package/dist/telemetry-rFq0QdvJ.mjs.map +0 -1
- package/dist/update-Cr5c7h1r.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-
|
|
3
|
-
import "../../types-
|
|
4
|
-
import { G as
|
|
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
|
package/docs/cli/application.md
CHANGED
|
@@ -111,6 +111,8 @@ tailor-sdk apply [options]
|
|
|
111
111
|
| `--yes` | `-y` | Skip confirmation prompts | No | `false` |
|
|
112
112
|
| `--dry-run` | `-d` | Run the command without making any changes | No | - |
|
|
113
113
|
| `--no-schema-check` | - | Skip schema diff check against migration snapshots | No | - |
|
|
114
|
+
| `--no-cache` | - | Disable bundle caching for this run | No | - |
|
|
115
|
+
| `--clean-cache` | - | Clean the bundle cache before building | No | - |
|
|
114
116
|
|
|
115
117
|
<!-- politty:command:apply:options:end -->
|
|
116
118
|
|
|
@@ -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).
|