@blokjs/helper 0.2.1 → 0.4.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/dist/components/AddElse.d.ts +20 -0
- package/dist/components/AddIf.d.ts +20 -0
- package/dist/components/StepNode.d.ts +6 -0
- package/dist/components/StepNode.js +9 -0
- package/dist/components/StepNode.js.map +1 -1
- package/dist/components/Trigger.d.ts +10 -2
- package/dist/components/Trigger.js +16 -5
- package/dist/components/Trigger.js.map +1 -1
- package/dist/components/branch.d.ts +44 -0
- package/dist/components/branch.js +57 -0
- package/dist/components/branch.js.map +1 -0
- package/dist/components/workflowV2.d.ts +83 -0
- package/dist/components/workflowV2.js +84 -0
- package/dist/components/workflowV2.js.map +1 -0
- package/dist/index.d.ts +8 -3
- package/dist/index.js +19 -4
- package/dist/index.js.map +1 -1
- package/dist/proxy/$.d.ts +95 -0
- package/dist/proxy/$.js +130 -0
- package/dist/proxy/$.js.map +1 -0
- package/dist/types/StepOpts.d.ts +456 -3
- package/dist/types/StepOpts.js +456 -3
- package/dist/types/StepOpts.js.map +1 -1
- package/dist/types/TriggerOpts.d.ts +1196 -19
- package/dist/types/TriggerOpts.js +395 -19
- package/dist/types/TriggerOpts.js.map +1 -1
- package/dist/types/WorkflowOpts.d.ts +312 -28
- package/dist/types/WorkflowOpts.js +55 -3
- package/dist/types/WorkflowOpts.js.map +1 -1
- package/dist/utils/parseDuration.d.ts +33 -0
- package/dist/utils/parseDuration.js +78 -0
- package/dist/utils/parseDuration.js.map +1 -0
- package/dist/workflow.schema.json +426 -0
- package/package.json +6 -6
|
@@ -1,15 +1,314 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
//
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
// =============================================================================
|
|
3
|
+
// Concurrency keys (Tier 2 #6) — shared across HTTP & Worker triggers
|
|
4
|
+
// =============================================================================
|
|
5
|
+
/**
|
|
6
|
+
* Reusable Zod field bag for per-key concurrency gating.
|
|
7
|
+
*
|
|
8
|
+
* Spread into a trigger's `z.object({...})` and pair with the
|
|
9
|
+
* {@link concurrencyRefinement} cross-field check to add concurrency-key
|
|
10
|
+
* support to a trigger schema.
|
|
11
|
+
*
|
|
12
|
+
* Authors set `concurrencyKey` (literal or `$`-proxy expression) plus an
|
|
13
|
+
* optional `concurrencyLimit` (defaults to 1, matching Trigger.dev's
|
|
14
|
+
* "named mutex per key" pattern). When omitted, the trigger has no
|
|
15
|
+
* concurrency gate (zero-overhead default).
|
|
16
|
+
*/
|
|
17
|
+
export const ConcurrencyOptsFields = {
|
|
18
|
+
concurrencyKey: z
|
|
19
|
+
.string()
|
|
20
|
+
.min(1)
|
|
21
|
+
.optional()
|
|
22
|
+
.describe("OPTIONAL. Per-key concurrency gating. Literal string or `$.<path>` proxy expression " +
|
|
23
|
+
"evaluated against the live ctx at run-entry time. When set, runs sharing the resolved " +
|
|
24
|
+
"key contend for at most `concurrencyLimit` concurrent slots. When unset, no gating applies."),
|
|
25
|
+
concurrencyLimit: z
|
|
26
|
+
.number()
|
|
27
|
+
.int()
|
|
28
|
+
.min(1)
|
|
29
|
+
.max(10000)
|
|
30
|
+
.optional()
|
|
31
|
+
.describe("OPTIONAL. Maximum concurrent runs for the resolved `concurrencyKey`. " +
|
|
32
|
+
"Defaults to 1 (matches Trigger.dev's named-mutex semantics). " +
|
|
33
|
+
"Ignored when `concurrencyKey` is unset. Bump for throughput-oriented use cases."),
|
|
34
|
+
concurrencyLeaseMs: z
|
|
35
|
+
.number()
|
|
36
|
+
.int()
|
|
37
|
+
.min(1000)
|
|
38
|
+
.optional()
|
|
39
|
+
.describe("OPTIONAL. Lease duration for the concurrency slot in milliseconds. " +
|
|
40
|
+
"Defaults to 3600000 (1h). Tunable per-trigger; process-wide override via " +
|
|
41
|
+
"`BLOK_CONCURRENCY_LEASE_MS`. Crash-safety upper bound on slot leaks."),
|
|
42
|
+
onLimit: z
|
|
43
|
+
.enum(["throw", "queue"])
|
|
44
|
+
.optional()
|
|
45
|
+
.describe("OPTIONAL. Behavior when the concurrency gate denies a run. " +
|
|
46
|
+
"`'throw'` (default): HTTP returns 429 + Retry-After / Worker NACKs with redelivery " +
|
|
47
|
+
"(transient resource state, doesn't count against the workflow's retry budget). " +
|
|
48
|
+
"`'queue'`: defer the run via the in-process scheduler and re-attempt acquisition " +
|
|
49
|
+
"after a 1s delay. Reuses the Tier 2 #5+#7 deferred-dispatch plumbing; HTTP returns " +
|
|
50
|
+
"202 Accepted + Location, Worker ACKs without retry. Requires `concurrencyKey` to be set."),
|
|
51
|
+
// PR 5 B2 — TTL on queued runs.
|
|
52
|
+
concurrencyQueueTimeoutMs: z
|
|
53
|
+
.number()
|
|
54
|
+
.int()
|
|
55
|
+
.min(1000)
|
|
56
|
+
.optional()
|
|
57
|
+
.describe('OPTIONAL. Time-to-live for queued runs in milliseconds. When set AND `onLimit: "queue"`, ' +
|
|
58
|
+
"queued runs that age past this timeout flip to `expired` instead of re-queueing. " +
|
|
59
|
+
'Requires `onLimit: "queue"`. Without this, queued runs retry indefinitely (lease-bounded only).'),
|
|
60
|
+
// PR 5 B3 — capped exponential backoff for onLimit:queue re-defer.
|
|
61
|
+
concurrencyQueueRetry: z
|
|
62
|
+
.object({
|
|
63
|
+
minBackoffMs: z.number().int().min(0).optional().describe("Initial backoff (default 1000)."),
|
|
64
|
+
maxBackoffMs: z.number().int().min(0).optional().describe("Cap on the backoff between retries (default 30000)."),
|
|
65
|
+
factor: z.number().min(1).optional().describe("Exponential factor (default 2)."),
|
|
66
|
+
})
|
|
67
|
+
.optional()
|
|
68
|
+
.describe('OPTIONAL. Capped exponential backoff config for `onLimit: "queue"` re-defer. ' +
|
|
69
|
+
"Replaces the fixed 1s retry. delay = min(maxBackoffMs, minBackoffMs * factor^attempt). " +
|
|
70
|
+
'Requires `onLimit: "queue"`.'),
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Cross-field refinement: `concurrencyLimit` / `concurrencyLeaseMs` / `onLimit`
|
|
74
|
+
* set without `concurrencyKey` are meaningless and rejected at validation time.
|
|
75
|
+
*/
|
|
76
|
+
export const concurrencyRefinement = (val, ctx) => {
|
|
77
|
+
if (val.concurrencyLimit !== undefined && val.concurrencyKey === undefined) {
|
|
78
|
+
ctx.addIssue({
|
|
79
|
+
code: z.ZodIssueCode.custom,
|
|
80
|
+
path: ["concurrencyLimit"],
|
|
81
|
+
message: "`concurrencyLimit` requires `concurrencyKey` to be set.",
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
if (val.concurrencyLeaseMs !== undefined && val.concurrencyKey === undefined) {
|
|
85
|
+
ctx.addIssue({
|
|
86
|
+
code: z.ZodIssueCode.custom,
|
|
87
|
+
path: ["concurrencyLeaseMs"],
|
|
88
|
+
message: "`concurrencyLeaseMs` requires `concurrencyKey` to be set.",
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
if (val.onLimit !== undefined && val.concurrencyKey === undefined) {
|
|
92
|
+
ctx.addIssue({
|
|
93
|
+
code: z.ZodIssueCode.custom,
|
|
94
|
+
path: ["onLimit"],
|
|
95
|
+
message: "`onLimit` requires `concurrencyKey` to be set.",
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
// PR 5 B2 — concurrencyQueueTimeoutMs requires onLimit: "queue".
|
|
99
|
+
if (val.concurrencyQueueTimeoutMs !== undefined && val.onLimit !== "queue") {
|
|
100
|
+
ctx.addIssue({
|
|
101
|
+
code: z.ZodIssueCode.custom,
|
|
102
|
+
path: ["concurrencyQueueTimeoutMs"],
|
|
103
|
+
message: '`concurrencyQueueTimeoutMs` requires `onLimit: "queue"`.',
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
// PR 5 B3 — concurrencyQueueRetry requires onLimit: "queue".
|
|
107
|
+
if (val.concurrencyQueueRetry !== undefined && val.onLimit !== "queue") {
|
|
108
|
+
ctx.addIssue({
|
|
109
|
+
code: z.ZodIssueCode.custom,
|
|
110
|
+
path: ["concurrencyQueueRetry"],
|
|
111
|
+
message: '`concurrencyQueueRetry` requires `onLimit: "queue"`.',
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* Standalone schema exposing just the concurrency fields. Useful for tests
|
|
117
|
+
* and tools that want to validate concurrency config in isolation. Real
|
|
118
|
+
* triggers spread {@link ConcurrencyOptsFields} into their own `z.object`
|
|
119
|
+
* and apply {@link concurrencyRefinement}.
|
|
120
|
+
*/
|
|
121
|
+
export const ConcurrencyOptsSchema = z.object(ConcurrencyOptsFields).superRefine(concurrencyRefinement);
|
|
122
|
+
// =============================================================================
|
|
123
|
+
// Scheduling: delay / TTL / debounce (Tier 2 #5 + #7) — shared across HTTP & Worker
|
|
124
|
+
// =============================================================================
|
|
125
|
+
/**
|
|
126
|
+
* Duration value: a non-negative integer (interpreted as milliseconds) or a
|
|
127
|
+
* single-unit string (`"500ms"`, `"30s"`, `"5m"`, `"2h"`, `"1d"`). Validated
|
|
128
|
+
* at trigger-config parse time; converted to milliseconds at run-entry time
|
|
129
|
+
* by `parseDuration` (`@blokjs/helper`).
|
|
130
|
+
*/
|
|
131
|
+
/**
|
|
132
|
+
* Duration value: a non-negative integer (ms) or a single-unit string
|
|
133
|
+
* (`"500ms"`, `"30s"`, `"5m"`, `"2h"`, `"1d"`). Reused by Tier 2 #5+#7
|
|
134
|
+
* scheduling fields and the Tier 2 quick-wins `maxDuration` step field.
|
|
135
|
+
*/
|
|
136
|
+
export const DurationSchema = z.union([
|
|
137
|
+
z.number().int().min(0),
|
|
138
|
+
z
|
|
139
|
+
.string()
|
|
140
|
+
.min(1)
|
|
141
|
+
.regex(/^\d+(ms|s|m|h|d)$/, {
|
|
142
|
+
message: 'Duration must be a non-negative integer + unit (ms|s|m|h|d), e.g. "500ms", "30s", "5m", "2h", "1d".',
|
|
143
|
+
}),
|
|
144
|
+
]);
|
|
145
|
+
/**
|
|
146
|
+
* Per-key debounce configuration. When set, repeated triggers sharing the
|
|
147
|
+
* resolved `key` collapse into one delayed run. Modes:
|
|
148
|
+
*
|
|
149
|
+
* - `"trailing"` (default): each ping resets a `delay` ms timer; the run
|
|
150
|
+
* fires after `delay` ms of silence. `maxDelay` (when set) bounds the
|
|
151
|
+
* tail latency — even with continuous pings, the run fires after
|
|
152
|
+
* `maxDelay` ms.
|
|
153
|
+
* - `"leading"`: the first ping in a window fires immediately; subsequent
|
|
154
|
+
* pings within `delay` ms are dropped with status `"debounced"`. Window
|
|
155
|
+
* resets when `delay` ms of silence pass.
|
|
156
|
+
*
|
|
157
|
+
* `key` is a literal string OR a `js/...` expression that evaluates to a
|
|
158
|
+
* string at run-entry time (typically derived from the request payload via
|
|
159
|
+
* a `$`-proxy expression like `$.req.body.userId`).
|
|
160
|
+
*/
|
|
161
|
+
export const DebounceOptsSchema = z
|
|
162
|
+
.object({
|
|
163
|
+
key: z
|
|
164
|
+
.string()
|
|
165
|
+
.min(1)
|
|
166
|
+
.describe("Debounce key — literal string or `js/ctx.<path>` expression. Pings sharing the resolved key collapse."),
|
|
167
|
+
mode: z
|
|
168
|
+
.enum(["leading", "trailing"])
|
|
169
|
+
.default("trailing")
|
|
170
|
+
.describe("`trailing` (default) waits for `delay` ms of silence then fires once with the latest payload. " +
|
|
171
|
+
"`leading` fires immediately and suppresses follow-ups within `delay` ms."),
|
|
172
|
+
delay: DurationSchema.describe("Debounce window. Number (ms) or string (`500ms`, `5s`, `2m`, etc.)."),
|
|
173
|
+
maxDelay: DurationSchema.optional().describe("OPTIONAL. Force a fire after this many ms even if pings keep coming. Bounds tail latency. " +
|
|
174
|
+
"Must be >= `delay` when set. Ignored in leading mode."),
|
|
175
|
+
})
|
|
176
|
+
.refine((d) => {
|
|
177
|
+
if (d.maxDelay === undefined)
|
|
178
|
+
return true;
|
|
179
|
+
// Accept any combo at the schema layer — duration normalization happens at runtime.
|
|
180
|
+
// We DO check the easy numeric case to catch obvious typos early.
|
|
181
|
+
if (typeof d.delay === "number" && typeof d.maxDelay === "number") {
|
|
182
|
+
return d.maxDelay >= d.delay;
|
|
183
|
+
}
|
|
184
|
+
return true;
|
|
185
|
+
}, {
|
|
186
|
+
message: "`debounce.maxDelay` must be >= `debounce.delay`.",
|
|
187
|
+
path: ["maxDelay"],
|
|
188
|
+
});
|
|
189
|
+
/**
|
|
190
|
+
* Reusable Zod field bag for run-scheduling primitives. Spread into a
|
|
191
|
+
* trigger's `z.object({...})` and pair with {@link schedulingRefinement}
|
|
192
|
+
* for cross-field validation.
|
|
193
|
+
*
|
|
194
|
+
* - `delay`: defer the run by N (number = ms, or string = `"1h"`).
|
|
195
|
+
* - `ttl`: expire if not started within N. Auto-cancels with status
|
|
196
|
+
* `"expired"`.
|
|
197
|
+
* - `debounce`: coalesce rapid same-key triggers into one delayed run.
|
|
198
|
+
*
|
|
199
|
+
* Zero-overhead default: when none of these fields are set, the trigger
|
|
200
|
+
* behaves exactly as before.
|
|
201
|
+
*/
|
|
202
|
+
export const SchedulingOptsFields = {
|
|
203
|
+
delay: DurationSchema.optional().describe("OPTIONAL. Defer the run by this many ms (number) or duration string (`'1h'`, `'30m'`, `'500ms'`). " +
|
|
204
|
+
"When set, the trigger schedules the run for later and returns immediately. " +
|
|
205
|
+
"HTTP returns 202 Accepted with `Location: /__blok/runs/:id`. Worker forwards to the adapter's native delay."),
|
|
206
|
+
ttl: DurationSchema.optional().describe("OPTIONAL. Expire if not started within this many ms (number) or duration string. " +
|
|
207
|
+
"At dispatch time, runs older than `ttl` are skipped with status `'expired'`. " +
|
|
208
|
+
"For HTTP, `ttl` requires `delay` to be set (otherwise immediate-dispatch makes TTL meaningless). " +
|
|
209
|
+
"For Worker, `ttl` is independent of `delay` (queue-time TTL applies regardless)."),
|
|
210
|
+
debounce: DebounceOptsSchema.optional().describe("OPTIONAL. Per-key trigger coalescing. See `DebounceOptsSchema` for modes and timing semantics."),
|
|
211
|
+
};
|
|
212
|
+
/**
|
|
213
|
+
* Cross-field refinement for scheduling fields. Per-trigger callers pass
|
|
214
|
+
* the trigger kind so HTTP and Worker can have different rules for
|
|
215
|
+
* `ttl`-without-`delay`.
|
|
216
|
+
*/
|
|
217
|
+
export function makeSchedulingRefinement(triggerKind) {
|
|
218
|
+
return (val, ctx) => {
|
|
219
|
+
// HTTP: TTL without delay is meaningless (the request is dispatched
|
|
220
|
+
// immediately). Worker: TTL alone is the queue-time TTL — allowed.
|
|
221
|
+
if (triggerKind === "http" && val.ttl !== undefined && val.delay === undefined) {
|
|
222
|
+
ctx.addIssue({
|
|
223
|
+
code: z.ZodIssueCode.custom,
|
|
224
|
+
path: ["ttl"],
|
|
225
|
+
message: "HTTP `ttl` requires `delay` to be set (TTL is only meaningful for deferred runs).",
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Standalone schema exposing just the scheduling fields. Useful for tests
|
|
232
|
+
* and tools. Real triggers spread {@link SchedulingOptsFields} into their
|
|
233
|
+
* own `z.object` and apply {@link makeSchedulingRefinement}.
|
|
234
|
+
*/
|
|
235
|
+
export const SchedulingOptsSchema = z.object(SchedulingOptsFields);
|
|
236
|
+
// =============================================================================
|
|
237
|
+
// HTTP Trigger
|
|
238
|
+
// =============================================================================
|
|
239
|
+
/**
|
|
240
|
+
* Canonical HTTP method names.
|
|
241
|
+
*
|
|
242
|
+
* `"ANY"` is the wildcard. Legacy `"*"` (used by old JSON workflows) is
|
|
243
|
+
* accepted via {@link HttpMethodSchema} preprocessing and normalized to
|
|
244
|
+
* `"ANY"` with a one-time deprecation warning.
|
|
245
|
+
*/
|
|
246
|
+
export const HTTP_METHODS = ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS", "ANY"];
|
|
247
|
+
let _wildcardWarned = false;
|
|
248
|
+
function warnWildcardOnce() {
|
|
249
|
+
if (_wildcardWarned)
|
|
250
|
+
return;
|
|
251
|
+
_wildcardWarned = true;
|
|
252
|
+
console.warn('[blok] trigger.http.method "*" is deprecated; use "ANY" instead. ' +
|
|
253
|
+
"Run `blokctl migrate workflows` to update your workflows.");
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* HTTP method schema — accepts the canonical names plus the legacy `"*"`
|
|
257
|
+
* (which is preprocessed to `"ANY"` with a one-time warning).
|
|
258
|
+
*/
|
|
259
|
+
export const HttpMethodSchema = z.preprocess((val) => {
|
|
260
|
+
if (val === "*") {
|
|
261
|
+
warnWildcardOnce();
|
|
262
|
+
return "ANY";
|
|
263
|
+
}
|
|
264
|
+
return val;
|
|
265
|
+
}, z.enum(HTTP_METHODS));
|
|
266
|
+
/** Validation schema for the HTTP trigger configuration. */
|
|
267
|
+
export const HttpTriggerOptsSchema = z
|
|
268
|
+
.object({
|
|
269
|
+
method: HttpMethodSchema.describe("HTTP method this workflow responds to. " +
|
|
270
|
+
"Use 'ANY' to match all methods. The legacy '*' is accepted for back-compat but warns."),
|
|
271
|
+
path: z
|
|
272
|
+
.string()
|
|
273
|
+
.optional()
|
|
274
|
+
.describe("OPTIONAL. When set, this is the FULL URL path (e.g. '/api/users/:id'). " +
|
|
275
|
+
"When omitted, the URL is derived from the workflow file's location " +
|
|
276
|
+
"under the workflows root. Examples: " +
|
|
277
|
+
"workflows/users/list.ts → /users/list; " +
|
|
278
|
+
"workflows/users/[id].ts → /users/:id; " +
|
|
279
|
+
"workflows/users/index.ts → /users."),
|
|
280
|
+
accept: z
|
|
281
|
+
.string()
|
|
282
|
+
.default("application/json")
|
|
283
|
+
.describe("Default response Content-Type when the workflow doesn't set one explicitly."),
|
|
284
|
+
headers: z
|
|
285
|
+
.record(z.string(), z.any())
|
|
286
|
+
.optional()
|
|
287
|
+
.describe("Required headers for incoming requests (validated at trigger entry)."),
|
|
288
|
+
legacyKeyPrefix: z
|
|
289
|
+
.boolean()
|
|
290
|
+
.optional()
|
|
291
|
+
.describe("Opt-in back-compat for the v1 URL scheme `/<workflow-key>/<path>`. " +
|
|
292
|
+
"When true, the workflow is also reachable at the legacy filename-prefixed URL. " +
|
|
293
|
+
"Off (undefined / false) by default. Will be removed after one minor version."),
|
|
294
|
+
...ConcurrencyOptsFields,
|
|
295
|
+
...SchedulingOptsFields,
|
|
296
|
+
})
|
|
297
|
+
.superRefine((val, ctx) => {
|
|
298
|
+
concurrencyRefinement(val, ctx);
|
|
299
|
+
makeSchedulingRefinement("http")(val, ctx);
|
|
8
300
|
});
|
|
9
|
-
|
|
301
|
+
/**
|
|
302
|
+
* Legacy alias for {@link HttpTriggerOptsSchema}. Prefer the explicit name.
|
|
303
|
+
*
|
|
304
|
+
* @deprecated Use {@link HttpTriggerOptsSchema} directly. Will be removed in
|
|
305
|
+
* the next minor version.
|
|
306
|
+
*/
|
|
10
307
|
export const TriggerOptsSchema = HttpTriggerOptsSchema;
|
|
11
|
-
//
|
|
12
|
-
|
|
308
|
+
// =============================================================================
|
|
309
|
+
// Queue Trigger (Kafka, RabbitMQ, SQS, Redis, NATS, Beanstalk)
|
|
310
|
+
// =============================================================================
|
|
311
|
+
export const QueueProviderSchema = z.enum(["kafka", "rabbitmq", "sqs", "redis", "beanstalk", "nats"]);
|
|
13
312
|
export const QueueTriggerOptsSchema = z.object({
|
|
14
313
|
provider: QueueProviderSchema,
|
|
15
314
|
topic: z.string().describe("Topic or queue name to consume from"),
|
|
@@ -22,7 +321,9 @@ export const QueueTriggerOptsSchema = z.object({
|
|
|
22
321
|
batchSize: z.number().default(1).describe("Number of messages to process in batch"),
|
|
23
322
|
concurrency: z.number().default(1).describe("Number of concurrent consumers"),
|
|
24
323
|
});
|
|
25
|
-
//
|
|
324
|
+
// =============================================================================
|
|
325
|
+
// Pub/Sub Trigger (GCP Pub/Sub, AWS SNS/SQS, Azure Service Bus)
|
|
326
|
+
// =============================================================================
|
|
26
327
|
export const PubSubProviderSchema = z.enum(["gcp", "aws", "azure"]);
|
|
27
328
|
export const PubSubTriggerOptsSchema = z.object({
|
|
28
329
|
provider: PubSubProviderSchema,
|
|
@@ -36,29 +337,51 @@ export const PubSubTriggerOptsSchema = z.object({
|
|
|
36
337
|
deadLetterTopic: z.string().optional().describe("Dead letter topic for failed messages"),
|
|
37
338
|
filter: z.string().optional().describe("Message filter expression"),
|
|
38
339
|
});
|
|
39
|
-
//
|
|
40
|
-
|
|
340
|
+
// =============================================================================
|
|
341
|
+
// Worker Trigger (background jobs)
|
|
342
|
+
// =============================================================================
|
|
343
|
+
export const WorkerTriggerOptsSchema = z
|
|
344
|
+
.object({
|
|
41
345
|
queue: z.string().describe("Worker queue name"),
|
|
42
|
-
concurrency: z
|
|
346
|
+
concurrency: z
|
|
347
|
+
.number()
|
|
348
|
+
.default(1)
|
|
349
|
+
.describe("Number of concurrent consumers (parallelism cap). Orthogonal to `concurrencyKey` — " +
|
|
350
|
+
"`concurrency` is the consumer count; `concurrencyKey` is per-key fairness within those consumers."),
|
|
43
351
|
timeout: z.number().optional().describe("Job timeout in milliseconds"),
|
|
44
352
|
retries: z.number().default(3).describe("Number of retry attempts"),
|
|
45
353
|
priority: z.number().default(0).describe("Job priority (higher = more priority)"),
|
|
46
|
-
delay
|
|
354
|
+
// `delay` (and `ttl`, `debounce`) live in SchedulingOptsFields below.
|
|
355
|
+
// The legacy number-only `delay` (pre-Tier-2-#5+#7) is superseded by
|
|
356
|
+
// the duration-or-number SchedulingOptsFields.delay. Number values
|
|
357
|
+
// remain accepted for back-compat — only the type widens.
|
|
358
|
+
...ConcurrencyOptsFields,
|
|
359
|
+
...SchedulingOptsFields,
|
|
360
|
+
})
|
|
361
|
+
.superRefine((val, ctx) => {
|
|
362
|
+
concurrencyRefinement(val, ctx);
|
|
363
|
+
makeSchedulingRefinement("worker")(val, ctx);
|
|
47
364
|
});
|
|
48
|
-
//
|
|
365
|
+
// =============================================================================
|
|
366
|
+
// Cron Trigger (scheduled workflows)
|
|
367
|
+
// =============================================================================
|
|
49
368
|
export const CronTriggerOptsSchema = z.object({
|
|
50
369
|
schedule: z.string().describe("Cron expression (e.g., '0 * * * *' for hourly)"),
|
|
51
370
|
timezone: z.string().default("UTC").describe("Timezone for schedule evaluation"),
|
|
52
371
|
overlap: z.boolean().default(false).describe("Allow overlapping executions"),
|
|
53
372
|
});
|
|
54
|
-
//
|
|
373
|
+
// =============================================================================
|
|
374
|
+
// Webhook Trigger (external service events)
|
|
375
|
+
// =============================================================================
|
|
55
376
|
export const WebhookTriggerOptsSchema = z.object({
|
|
56
377
|
source: z.string().describe("Source service (github, stripe, shopify, etc.)"),
|
|
57
378
|
events: z.array(z.string()).describe("Event types to listen for"),
|
|
58
379
|
secret: z.string().optional().describe("Webhook secret for verification"),
|
|
59
380
|
path: z.string().optional().describe("Custom webhook path"),
|
|
60
381
|
});
|
|
61
|
-
//
|
|
382
|
+
// =============================================================================
|
|
383
|
+
// WebSocket Trigger (real-time bidirectional)
|
|
384
|
+
// =============================================================================
|
|
62
385
|
export const WebSocketTriggerOptsSchema = z.object({
|
|
63
386
|
events: z.array(z.string()).default(["*"]).describe("Event names to listen for (supports wildcards)"),
|
|
64
387
|
rooms: z.array(z.string()).optional().describe("Room/channel filters"),
|
|
@@ -67,7 +390,9 @@ export const WebSocketTriggerOptsSchema = z.object({
|
|
|
67
390
|
heartbeatInterval: z.number().default(30000).describe("Heartbeat interval in milliseconds"),
|
|
68
391
|
messageRateLimit: z.number().default(100).describe("Max messages per second per client"),
|
|
69
392
|
});
|
|
70
|
-
//
|
|
393
|
+
// =============================================================================
|
|
394
|
+
// SSE Trigger (Server-Sent Events)
|
|
395
|
+
// =============================================================================
|
|
71
396
|
export const SSETriggerOptsSchema = z.object({
|
|
72
397
|
events: z.array(z.string()).default(["*"]).describe("Event names to emit"),
|
|
73
398
|
channels: z.array(z.string()).optional().describe("Channel filters"),
|
|
@@ -76,7 +401,10 @@ export const SSETriggerOptsSchema = z.object({
|
|
|
76
401
|
heartbeatInterval: z.number().default(30000).describe("Heartbeat interval in milliseconds"),
|
|
77
402
|
retryInterval: z.number().default(3000).describe("Client retry interval in milliseconds"),
|
|
78
403
|
});
|
|
79
|
-
//
|
|
404
|
+
// =============================================================================
|
|
405
|
+
// Trigger registry (the dispatch table)
|
|
406
|
+
// =============================================================================
|
|
407
|
+
/** All trigger names supported by Blok. */
|
|
80
408
|
export const TriggersSchema = z.enum([
|
|
81
409
|
"http",
|
|
82
410
|
"grpc",
|
|
@@ -89,4 +417,52 @@ export const TriggersSchema = z.enum([
|
|
|
89
417
|
"sse",
|
|
90
418
|
"websocket",
|
|
91
419
|
]);
|
|
420
|
+
/**
|
|
421
|
+
* Map of trigger name → validation schema. `null` means the trigger does not
|
|
422
|
+
* have a required configuration shape (currently `grpc` and `manual`).
|
|
423
|
+
*
|
|
424
|
+
* Single source of truth for runtime trigger-config validation. Used by
|
|
425
|
+
* {@link validateTriggerConfig}.
|
|
426
|
+
*/
|
|
427
|
+
export const TRIGGER_SCHEMAS = {
|
|
428
|
+
http: HttpTriggerOptsSchema,
|
|
429
|
+
queue: QueueTriggerOptsSchema,
|
|
430
|
+
pubsub: PubSubTriggerOptsSchema,
|
|
431
|
+
worker: WorkerTriggerOptsSchema,
|
|
432
|
+
cron: CronTriggerOptsSchema,
|
|
433
|
+
webhook: WebhookTriggerOptsSchema,
|
|
434
|
+
sse: SSETriggerOptsSchema,
|
|
435
|
+
websocket: WebSocketTriggerOptsSchema,
|
|
436
|
+
grpc: null,
|
|
437
|
+
manual: null,
|
|
438
|
+
};
|
|
439
|
+
/**
|
|
440
|
+
* Validate a trigger configuration against the schema for the given trigger
|
|
441
|
+
* kind. When the trigger has a schema, returns the parsed config (with
|
|
442
|
+
* defaults applied). When the trigger has no schema (`grpc`, `manual`),
|
|
443
|
+
* returns the input config (or an empty object when `undefined`).
|
|
444
|
+
*
|
|
445
|
+
* Throws when the trigger requires a schema and the config is missing or
|
|
446
|
+
* invalid. The thrown error is either a `ZodError` (for shape violations) or
|
|
447
|
+
* a regular `Error` (when config is missing entirely).
|
|
448
|
+
*
|
|
449
|
+
* @example
|
|
450
|
+
* const cfg = validateTriggerConfig("cron", { schedule: "0 * * * *" });
|
|
451
|
+
* // cfg.timezone === "UTC" (default applied)
|
|
452
|
+
*
|
|
453
|
+
* @example
|
|
454
|
+
* validateTriggerConfig("cron", undefined);
|
|
455
|
+
* // throws: 'Trigger "cron" requires a configuration object.'
|
|
456
|
+
*/
|
|
457
|
+
export function validateTriggerConfig(name, config) {
|
|
458
|
+
const schema = TRIGGER_SCHEMAS[name];
|
|
459
|
+
if (schema === null) {
|
|
460
|
+
// Triggers with no schema accept anything (including undefined).
|
|
461
|
+
return config ?? {};
|
|
462
|
+
}
|
|
463
|
+
if (config === undefined) {
|
|
464
|
+
throw new Error(`Trigger "${name}" requires a configuration object. See ${name.charAt(0).toUpperCase()}${name.slice(1)}TriggerOpts.`);
|
|
465
|
+
}
|
|
466
|
+
return schema.parse(config);
|
|
467
|
+
}
|
|
92
468
|
//# sourceMappingURL=TriggerOpts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TriggerOpts.js","sourceRoot":"","sources":["../../src/types/TriggerOpts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,uBAAuB;AACvB,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;IAChE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,kBAAkB,CAAC;IAC9C,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,QAAQ,EAAE;CACjD,CAAC,CAAC;AAEH,0CAA0C;AAC1C,MAAM,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