@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.
@@ -13,18 +13,30 @@ declare const ConditionElseSchema: z.ZodObject<{
13
13
  type: z.ZodEnum<["local", "module", "runtime.python3", "runtime.nodejs", "runtime.bun", "runtime.go", "runtime.java", "runtime.rust", "runtime.php", "runtime.csharp", "runtime.ruby", "runtime.docker", "runtime.wasm"]>;
14
14
  inputs: z.ZodOptional<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>>;
15
15
  runtime: z.ZodOptional<z.ZodEnum<["nodejs", "bun", "python3", "go", "java", "rust", "php", "csharp", "ruby", "docker", "wasm"]>>;
16
+ set_var: z.ZodOptional<z.ZodBoolean>;
17
+ active: z.ZodOptional<z.ZodBoolean>;
18
+ stop: z.ZodOptional<z.ZodBoolean>;
19
+ stream_logs: z.ZodOptional<z.ZodBoolean>;
16
20
  }, "strip", z.ZodTypeAny, {
17
21
  name: string;
18
22
  node: string;
19
23
  type: "local" | "module" | "runtime.python3" | "runtime.nodejs" | "runtime.bun" | "runtime.go" | "runtime.java" | "runtime.rust" | "runtime.php" | "runtime.csharp" | "runtime.ruby" | "runtime.docker" | "runtime.wasm";
20
24
  inputs?: {} | undefined;
21
25
  runtime?: "nodejs" | "bun" | "python3" | "go" | "java" | "rust" | "php" | "csharp" | "ruby" | "docker" | "wasm" | undefined;
26
+ set_var?: boolean | undefined;
27
+ active?: boolean | undefined;
28
+ stop?: boolean | undefined;
29
+ stream_logs?: boolean | undefined;
22
30
  }, {
23
31
  name: string;
24
32
  node: string;
25
33
  type: "local" | "module" | "runtime.python3" | "runtime.nodejs" | "runtime.bun" | "runtime.go" | "runtime.java" | "runtime.rust" | "runtime.php" | "runtime.csharp" | "runtime.ruby" | "runtime.docker" | "runtime.wasm";
26
34
  inputs?: {} | undefined;
27
35
  runtime?: "nodejs" | "bun" | "python3" | "go" | "java" | "rust" | "php" | "csharp" | "ruby" | "docker" | "wasm" | undefined;
36
+ set_var?: boolean | undefined;
37
+ active?: boolean | undefined;
38
+ stop?: boolean | undefined;
39
+ stream_logs?: boolean | undefined;
28
40
  }>, "many">>;
29
41
  }, "strip", z.ZodTypeAny, {
30
42
  type: "if" | "else";
@@ -34,6 +46,10 @@ declare const ConditionElseSchema: z.ZodObject<{
34
46
  type: "local" | "module" | "runtime.python3" | "runtime.nodejs" | "runtime.bun" | "runtime.go" | "runtime.java" | "runtime.rust" | "runtime.php" | "runtime.csharp" | "runtime.ruby" | "runtime.docker" | "runtime.wasm";
35
47
  inputs?: {} | undefined;
36
48
  runtime?: "nodejs" | "bun" | "python3" | "go" | "java" | "rust" | "php" | "csharp" | "ruby" | "docker" | "wasm" | undefined;
49
+ set_var?: boolean | undefined;
50
+ active?: boolean | undefined;
51
+ stop?: boolean | undefined;
52
+ stream_logs?: boolean | undefined;
37
53
  }[] | undefined;
38
54
  }, {
39
55
  type: "if" | "else";
@@ -43,6 +59,10 @@ declare const ConditionElseSchema: z.ZodObject<{
43
59
  type: "local" | "module" | "runtime.python3" | "runtime.nodejs" | "runtime.bun" | "runtime.go" | "runtime.java" | "runtime.rust" | "runtime.php" | "runtime.csharp" | "runtime.ruby" | "runtime.docker" | "runtime.wasm";
44
60
  inputs?: {} | undefined;
45
61
  runtime?: "nodejs" | "bun" | "python3" | "go" | "java" | "rust" | "php" | "csharp" | "ruby" | "docker" | "wasm" | undefined;
62
+ set_var?: boolean | undefined;
63
+ active?: boolean | undefined;
64
+ stop?: boolean | undefined;
65
+ stream_logs?: boolean | undefined;
46
66
  }[] | undefined;
47
67
  }>;
48
68
  export type ConditionElseOpts = z.infer<typeof ConditionElseSchema>;
@@ -16,18 +16,30 @@ declare const ConditionSchema: z.ZodObject<{
16
16
  type: z.ZodEnum<["local", "module", "runtime.python3", "runtime.nodejs", "runtime.bun", "runtime.go", "runtime.java", "runtime.rust", "runtime.php", "runtime.csharp", "runtime.ruby", "runtime.docker", "runtime.wasm"]>;
17
17
  inputs: z.ZodOptional<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>>;
18
18
  runtime: z.ZodOptional<z.ZodEnum<["nodejs", "bun", "python3", "go", "java", "rust", "php", "csharp", "ruby", "docker", "wasm"]>>;
19
+ set_var: z.ZodOptional<z.ZodBoolean>;
20
+ active: z.ZodOptional<z.ZodBoolean>;
21
+ stop: z.ZodOptional<z.ZodBoolean>;
22
+ stream_logs: z.ZodOptional<z.ZodBoolean>;
19
23
  }, "strip", z.ZodTypeAny, {
20
24
  name: string;
21
25
  node: string;
22
26
  type: "local" | "module" | "runtime.python3" | "runtime.nodejs" | "runtime.bun" | "runtime.go" | "runtime.java" | "runtime.rust" | "runtime.php" | "runtime.csharp" | "runtime.ruby" | "runtime.docker" | "runtime.wasm";
23
27
  inputs?: {} | undefined;
24
28
  runtime?: "nodejs" | "bun" | "python3" | "go" | "java" | "rust" | "php" | "csharp" | "ruby" | "docker" | "wasm" | undefined;
29
+ set_var?: boolean | undefined;
30
+ active?: boolean | undefined;
31
+ stop?: boolean | undefined;
32
+ stream_logs?: boolean | undefined;
25
33
  }, {
26
34
  name: string;
27
35
  node: string;
28
36
  type: "local" | "module" | "runtime.python3" | "runtime.nodejs" | "runtime.bun" | "runtime.go" | "runtime.java" | "runtime.rust" | "runtime.php" | "runtime.csharp" | "runtime.ruby" | "runtime.docker" | "runtime.wasm";
29
37
  inputs?: {} | undefined;
30
38
  runtime?: "nodejs" | "bun" | "python3" | "go" | "java" | "rust" | "php" | "csharp" | "ruby" | "docker" | "wasm" | undefined;
39
+ set_var?: boolean | undefined;
40
+ active?: boolean | undefined;
41
+ stop?: boolean | undefined;
42
+ stream_logs?: boolean | undefined;
31
43
  }>, "many">>;
32
44
  }, "strip", z.ZodTypeAny, {
33
45
  type: "if" | "else";
@@ -38,6 +50,10 @@ declare const ConditionSchema: z.ZodObject<{
38
50
  type: "local" | "module" | "runtime.python3" | "runtime.nodejs" | "runtime.bun" | "runtime.go" | "runtime.java" | "runtime.rust" | "runtime.php" | "runtime.csharp" | "runtime.ruby" | "runtime.docker" | "runtime.wasm";
39
51
  inputs?: {} | undefined;
40
52
  runtime?: "nodejs" | "bun" | "python3" | "go" | "java" | "rust" | "php" | "csharp" | "ruby" | "docker" | "wasm" | undefined;
53
+ set_var?: boolean | undefined;
54
+ active?: boolean | undefined;
55
+ stop?: boolean | undefined;
56
+ stream_logs?: boolean | undefined;
41
57
  }[] | undefined;
42
58
  }, {
43
59
  type: "if" | "else";
@@ -48,6 +64,10 @@ declare const ConditionSchema: z.ZodObject<{
48
64
  type: "local" | "module" | "runtime.python3" | "runtime.nodejs" | "runtime.bun" | "runtime.go" | "runtime.java" | "runtime.rust" | "runtime.php" | "runtime.csharp" | "runtime.ruby" | "runtime.docker" | "runtime.wasm";
49
65
  inputs?: {} | undefined;
50
66
  runtime?: "nodejs" | "bun" | "python3" | "go" | "java" | "rust" | "php" | "csharp" | "ruby" | "docker" | "wasm" | undefined;
67
+ set_var?: boolean | undefined;
68
+ active?: boolean | undefined;
69
+ stop?: boolean | undefined;
70
+ stream_logs?: boolean | undefined;
51
71
  }[] | undefined;
52
72
  }>;
53
73
  export type ConditionOpts = z.infer<typeof ConditionSchema>;
@@ -1,5 +1,11 @@
1
1
  import { type StepConditionOpts, type StepOpts } from "../types/StepOpts";
2
2
  import HelperResponse from "./HelperResponse";
3
+ /**
4
+ * Builder step that adds workflow steps and conditional branches.
5
+ *
6
+ * Each call returns a new {@link StepNode} carrying the accumulated config
7
+ * so workflow definitions remain immutable from the outside.
8
+ */
3
9
  export default class StepNode extends HelperResponse {
4
10
  addStep(config: StepOpts): StepNode;
5
11
  addCondition(conditions: StepConditionOpts): StepNode;
@@ -1,5 +1,11 @@
1
1
  import { StepConditionSchema, StepOptsSchema, } from "../types/StepOpts";
2
2
  import HelperResponse from "./HelperResponse";
3
+ /**
4
+ * Builder step that adds workflow steps and conditional branches.
5
+ *
6
+ * Each call returns a new {@link StepNode} carrying the accumulated config
7
+ * so workflow definitions remain immutable from the outside.
8
+ */
3
9
  export default class StepNode extends HelperResponse {
4
10
  addStep(config) {
5
11
  StepOptsSchema.parse(config);
@@ -13,6 +19,9 @@ export default class StepNode extends HelperResponse {
13
19
  node: config.node,
14
20
  type: config.type,
15
21
  runtime: config.runtime,
22
+ set_var: config.set_var,
23
+ active: config.active,
24
+ stop: config.stop,
16
25
  });
17
26
  const helperResponse = new StepNode();
18
27
  helperResponse.setConfig(this._config);
@@ -1 +1 @@
1
- {"version":3,"file":"StepNode.js","sourceRoot":"","sources":["../../src/components/StepNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,mBAAmB,EAEnB,cAAc,GACd,MAAM,mBAAmB,CAAC;AAG3B,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAE9C,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,cAAc;IACnD,OAAO,CAAC,MAAgB;QACvB,cAAc,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAE7B,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,KAAK,SAAS;YAAE,IAAI,CAAC,OAAO,CAAC,KAAK,GAAG,EAAE,CAAC;QAC9D,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG;YACjC,MAAM,EAAE,MAAM,CAAC,MAAM;SACrB,CAAC;QAEF,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC;YACxB,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,OAAO,EAAE,MAAM,CAAC,OAAO;SACvB,CAAC,CAAC;QAEH,MAAM,cAAc,GAAG,IAAI,QAAQ,EAAE,CAAC;QACtC,cAAc,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACvC,OAAO,cAAc,CAAC;IACvB,CAAC;IAED,YAAY,CAAC,UAA6B;QACzC,mBA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WebSocketTriggerOpts, type WebhookTriggerOpts, type WorkerTriggerOpts } from "../types/TriggerOpts";
1
+ import { type CronTriggerOpts, type HttpTriggerOpts, type PubSubTriggerOpts, type QueueTriggerOpts, type SSETriggerOpts, type WebSocketTriggerOpts, type WebhookTriggerOpts, type WorkerTriggerOpts } from "../types/TriggerOpts";
2
2
  import HelperResponse from "./HelperResponse";
3
3
  import StepNode from "./StepNode";
4
+ /**
5
+ * Builder step that attaches a trigger to a workflow.
6
+ *
7
+ * Returned by {@link Workflow}; chains into {@link StepNode} via
8
+ * {@link Trigger.addTrigger}. Type-safe overloads constrain the `config`
9
+ * argument shape per trigger kind; {@link validateTriggerConfig} runs the
10
+ * matching Zod schema at call time.
11
+ */
4
12
  export default class Trigger extends HelperResponse {
5
- addTrigger(name: "http", config: TriggerOpts): StepNode;
13
+ addTrigger(name: "http", config: HttpTriggerOpts): StepNode;
6
14
  addTrigger(name: "queue", config: QueueTriggerOpts): StepNode;
7
15
  addTrigger(name: "pubsub", config: PubSubTriggerOpts): StepNode;
8
16
  addTrigger(name: "cron", config: CronTriggerOpts): StepNode;
@@ -1,13 +1,24 @@
1
- import { TriggerOptsSchema, TriggersSchema, } from "../types/TriggerOpts";
1
+ import { TriggersSchema, validateTriggerConfig, } from "../types/TriggerOpts";
2
2
  import HelperResponse from "./HelperResponse";
3
3
  import StepNode from "./StepNode";
4
+ /**
5
+ * Builder step that attaches a trigger to a workflow.
6
+ *
7
+ * Returned by {@link Workflow}; chains into {@link StepNode} via
8
+ * {@link Trigger.addTrigger}. Type-safe overloads constrain the `config`
9
+ * argument shape per trigger kind; {@link validateTriggerConfig} runs the
10
+ * matching Zod schema at call time.
11
+ */
4
12
  export default class Trigger extends HelperResponse {
5
13
  addTrigger(name, config) {
14
+ // Validate the trigger NAME first so callers get a clear error for typos
15
+ // before we try to dispatch to a schema.
6
16
  TriggersSchema.parse(name);
7
- if (name === "http" && config) {
8
- TriggerOptsSchema.parse(config);
9
- }
10
- this._config.trigger = { [name]: config || {} };
17
+ // Dispatch to the per-kind schema. Returns the parsed config (with
18
+ // defaults applied) for typed triggers, or the input config for
19
+ // grpc/manual which have no schema.
20
+ const validated = validateTriggerConfig(name, config);
21
+ this._config.trigger = { [name]: validated };
11
22
  const helperResponse = new StepNode();
12
23
  helperResponse.setConfig(this._config);
13
24
  return helperResponse;
@@ -1 +1 @@
1
- {"version":3,"file":"Trigger.js","sourceRoot":"","sources":["../../src/components/Trigger.ts"],"names":[],"mappings":"AAAA,OAAO,EAON,iBAAiB,EAEjB,cAAc,GAId,MAAM,sBAAsB,CAAC;AAC9B,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC,MAAM,CAAC,OAAO,OAAO,OAAQ,SAAQ,cAAc;IAWlD,UAAU,CAAyB,IAAO,EAAE,MAA4B;QACvE,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAE3B,IAAI,IAAI,KAAK,MAAM,IAAI,MAAM,EAAE,CAAC;YAC/B,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QACjC,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,IAAI,EAAE,EAAE,CAAC;QAEhD,MAAM,cAAc,GAAG,IAAI,QAAQ,EAAE,CAAC;QACtC,cAAc,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACvC,OAAO,cAAc,CAAC;IACvB,CAAC;CACD"}
1
+ {"version":3,"file":"Trigger.js","sourceRoot":"","sources":["../../src/components/Trigger.ts"],"names":[],"mappings":"AAAA,OAAO,EAQN,cAAc,EAId,qBAAqB,GACrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,OAAO,OAAQ,SAAQ,cAAc;IAUlD,UAAU,CAAyB,IAAO,EAAE,MAA4B;QACvE,yEAAyE;QACzE,yCAAyC;QACzC,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAE3B,mEAAmE;QACnE,gEAAgE;QAChE,oCAAoC;QACpC,MAAM,SAAS,GAAG,qBAAqB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACtD,IAAI,CAAC,OAAO,CAAC,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,CAAC;QAE7C,MAAM,cAAc,GAAG,IAAI,QAAQ,EAAE,CAAC;QACtC,cAAc,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACvC,OAAO,cAAc,CAAC;IACvB,CAAC;CACD"}
@@ -0,0 +1,44 @@
1
+ import type { V2BranchStep, V2Step } from "../types/StepOpts";
2
+ /**
3
+ * Author-facing options for {@link branch}.
4
+ *
5
+ * `when` accepts either a plain string (`"$.req.method === 'POST'"`) or
6
+ * a `$` proxy expression that will compile to a string at definition
7
+ * time (`$.req.method`). Note that JavaScript's `===` operator can't be
8
+ * intercepted, so equality comparisons must be expressed as strings.
9
+ */
10
+ export interface BranchOpts {
11
+ /** Stable identifier — visible in traces, referenced as `$.state[id]`. */
12
+ id: string;
13
+ /** JS condition. Truthy → run `then`; falsy → run `else`. */
14
+ when: string | unknown;
15
+ then: V2Step[];
16
+ /** Optional. Steps to run when `when` is falsy. */
17
+ else?: V2Step[];
18
+ /** Skip this branch step at runtime. Default true (active). */
19
+ active?: boolean;
20
+ /** Halt the workflow after this branch step completes. */
21
+ stop?: boolean;
22
+ }
23
+ /**
24
+ * Create a branch step — a step that runs one of two sub-pipelines based
25
+ * on a JS condition.
26
+ *
27
+ * Compiles down to today's `@blokjs/if-else` flow node at workflow load
28
+ * time, so the runner core needs no change. Authors get a single primitive
29
+ * with the same shape as a regular step: `{ id, ... }`.
30
+ *
31
+ * @example
32
+ * branch({
33
+ * id: "route",
34
+ * when: '$.req.method === "POST"',
35
+ * then: [{ id: "create", use: "...", inputs: {...} }],
36
+ * else: [{ id: "read", use: "...", inputs: {...} }]
37
+ * })
38
+ *
39
+ * @example
40
+ * // `when` accepts a $ proxy expression — compiles to a string at
41
+ * // definition time, so `js/ctx.req.query.kind` lands in the workflow.
42
+ * branch({ id: "route-by-kind", when: $.req.query.kind, then: [...] })
43
+ */
44
+ export declare function branch(opts: BranchOpts): V2BranchStep;
@@ -0,0 +1,57 @@
1
+ import { unwrapProxies } from "../proxy/$";
2
+ /**
3
+ * Create a branch step — a step that runs one of two sub-pipelines based
4
+ * on a JS condition.
5
+ *
6
+ * Compiles down to today's `@blokjs/if-else` flow node at workflow load
7
+ * time, so the runner core needs no change. Authors get a single primitive
8
+ * with the same shape as a regular step: `{ id, ... }`.
9
+ *
10
+ * @example
11
+ * branch({
12
+ * id: "route",
13
+ * when: '$.req.method === "POST"',
14
+ * then: [{ id: "create", use: "...", inputs: {...} }],
15
+ * else: [{ id: "read", use: "...", inputs: {...} }]
16
+ * })
17
+ *
18
+ * @example
19
+ * // `when` accepts a $ proxy expression — compiles to a string at
20
+ * // definition time, so `js/ctx.req.query.kind` lands in the workflow.
21
+ * branch({ id: "route-by-kind", when: $.req.query.kind, then: [...] })
22
+ */
23
+ export function branch(opts) {
24
+ if (!opts || typeof opts !== "object") {
25
+ throw new Error("branch() requires an options object.");
26
+ }
27
+ if (!opts.id || typeof opts.id !== "string") {
28
+ throw new Error("branch() requires a non-empty `id` string.");
29
+ }
30
+ const when = unwrapProxies(opts.when);
31
+ if (typeof when !== "string" || when.length === 0) {
32
+ throw new Error(`branch("${opts.id}") requires a non-empty \`when\` string. Use a $ proxy path (e.g. $.req.query.kind) or a plain expression (e.g. '$.req.method === "POST"'). For equality comparisons, use a plain string — JavaScript's === operator can't be intercepted by the proxy.`);
33
+ }
34
+ if (!Array.isArray(opts.then)) {
35
+ throw new Error(`branch("${opts.id}") requires \`then\` to be an array of steps.`);
36
+ }
37
+ if (opts.else !== undefined && !Array.isArray(opts.else)) {
38
+ throw new Error(`branch("${opts.id}") \`else\` must be an array of steps when set.`);
39
+ }
40
+ // Walk the steps to convert any inline proxies in their inputs.
41
+ const thenSteps = unwrapProxies(opts.then);
42
+ const elseSteps = opts.else ? unwrapProxies(opts.else) : undefined;
43
+ const result = {
44
+ id: opts.id,
45
+ branch: {
46
+ when,
47
+ then: thenSteps,
48
+ ...(elseSteps ? { else: elseSteps } : {}),
49
+ },
50
+ };
51
+ if (opts.active === false)
52
+ result.active = false;
53
+ if (opts.stop === true)
54
+ result.stop = true;
55
+ return result;
56
+ }
57
+ //# sourceMappingURL=branch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"branch.js","sourceRoot":"","sources":["../../src/components/branch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAyB3C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,MAAM,CAAC,IAAgB;IACtC,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QACvC,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;IACzD,CAAC;IACD,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,OAAO,IAAI,CAAC,EAAE,KAAK,QAAQ,EAAE,CAAC;QAC7C,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAC/D,CAAC;IACD,MAAM,IAAI,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtC,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACnD,MAAM,IAAI,KAAK,CACd,WAAW,IAAI,CAAC,EAAE,yPAAyP,CAC3Q,CAAC;IACH,CAAC;IACD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CAAC,WAAW,IAAI,CAAC,EAAE,+CAA+C,CAAC,CAAC;IACpF,CAAC;IACD,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAC1D,MAAM,IAAI,KAAK,CAAC,WAAW,IAAI,CAAC,EAAE,iDAAiD,CAAC,CAAC;IACtF,CAAC;IAED,gEAAgE;IAChE,MAAM,SAAS,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,CAAa,CAAC;IACvD,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAE,aAAa,CAAC,IAAI,CAAC,IAAI,CAAc,CAAC,CAAC,CAAC,SAAS,CAAC;IAEjF,MAAM,MAAM,GAAiB;QAC5B,EAAE,EAAE,IAAI,CAAC,EAAE;QACX,MAAM,EAAE;YACP,IAAI;YACJ,IAAI,EAAE,SAAS;YACf,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACzC;KACD,CAAC;IACF,IAAI,IAAI,CAAC,MAAM,KAAK,KAAK;QAAG,MAA6C,CAAC,MAAM,GAAG,KAAK,CAAC;IACzF,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI;QAAG,MAA2C,CAAC,IAAI,GAAG,IAAI,CAAC;IACjF,OAAO,MAAM,CAAC;AACf,CAAC"}
@@ -0,0 +1,83 @@
1
+ import { type V2Step } from "../types/StepOpts";
2
+ import type { WorkflowV2 } from "../types/WorkflowOpts";
3
+ /**
4
+ * V2 workflow author input — strict TypeScript shape with the user-facing
5
+ * fields the lowercase `workflow()` factory accepts.
6
+ */
7
+ export interface WorkflowOpts {
8
+ /** Workflow display name. Min 3 characters. Shown in Studio. */
9
+ name: string;
10
+ /** Semantic version (x.x.x). Used for trace recording and audit. */
11
+ version: string;
12
+ /** What this workflow does. Optional but recommended. */
13
+ description?: string;
14
+ /**
15
+ * Trigger configuration. Most workflows use a single key:
16
+ * `{ http: { method: "GET" } }`
17
+ * `{ cron: { schedule: "0 * * * *" } }`
18
+ * `{ queue: { provider: "kafka", topic: "..." } }`
19
+ *
20
+ * See `TRIGGER_SCHEMAS` for per-kind shapes. Validated per-kind at
21
+ * factory time.
22
+ */
23
+ trigger: Record<string, unknown>;
24
+ /** Pipeline of steps to execute in order. At least one required. */
25
+ steps: V2Step[];
26
+ }
27
+ /**
28
+ * The shape returned by `workflow()`. Tagged with `_blokV2: true` so the
29
+ * scanner / loader can detect a v2-shape default export and route it
30
+ * through the v1→v2 normalizer cleanly. The internal `_config` field
31
+ * mirrors the legacy v1 builder output for back-compat with code that
32
+ * already reads `step._config.trigger` etc.
33
+ */
34
+ export interface WorkflowV2Builder {
35
+ readonly _blokV2: true;
36
+ readonly _config: WorkflowV2;
37
+ /**
38
+ * Serialize the wrapped workflow to a JSON string. Mirrors the
39
+ * `HelperResponse.toJson()` contract so v2 builders are
40
+ * structurally compatible with the v1 workflow registry
41
+ * (`Workflows` map → `LocalStorage.get` fallback).
42
+ */
43
+ toJson(): string;
44
+ }
45
+ /**
46
+ * Lowercase v2 workflow factory. Validates inputs against the v2 schema,
47
+ * compiles any `$` proxy expressions inside step `inputs` into
48
+ * `"js/ctx..."` strings at definition time, and returns a tagged object
49
+ * the runner's normalizer recognizes.
50
+ *
51
+ * Differences from the legacy `Workflow()` (capital W):
52
+ * - **No chaining.** The full workflow is a single object literal —
53
+ * exactly what JSON workflows look like.
54
+ * - **No separate `nodes{}` map.** `inputs` lives on each step.
55
+ * - **No `set_var: true`** — every step's output auto-stores in `ctx.state`.
56
+ * Opt out with `ephemeral: true`. Multi-output: `spread: true`. Rename:
57
+ * `as: "<name>"`.
58
+ * - **`branch({when, then, else})`** replaces `addCondition + AddIf + AddElse`.
59
+ * - **`$` proxy** replaces hand-written `js/ctx....` strings with typed
60
+ * property access.
61
+ *
62
+ * @example
63
+ * import { workflow, branch, $ } from "@blokjs/helper";
64
+ *
65
+ * export default workflow({
66
+ * name: "World Countries",
67
+ * version: "1.0.0",
68
+ * trigger: { http: { method: "GET" } },
69
+ * steps: [
70
+ * { id: "fetch", use: "@blokjs/api-call",
71
+ * inputs: { url: "https://countriesnow.space/api/v0.1/countries" } },
72
+ * branch({
73
+ * id: "route",
74
+ * when: $.req.query.kind,
75
+ * then: [{ id: "respond", use: "@blokjs/respond",
76
+ * inputs: { body: $.state.fetch } }],
77
+ * else: [{ id: "fallback", use: "@blokjs/api-call",
78
+ * inputs: { url: "https://catfact.ninja/fact" } }]
79
+ * })
80
+ * ]
81
+ * });
82
+ */
83
+ export declare function workflow(opts: WorkflowOpts): WorkflowV2Builder;
@@ -0,0 +1,84 @@
1
+ import { unwrapProxies } from "../proxy/$";
2
+ import { V2StepSchema } from "../types/StepOpts";
3
+ import { TriggersSchema, validateTriggerConfig } from "../types/TriggerOpts";
4
+ /**
5
+ * Lowercase v2 workflow factory. Validates inputs against the v2 schema,
6
+ * compiles any `$` proxy expressions inside step `inputs` into
7
+ * `"js/ctx..."` strings at definition time, and returns a tagged object
8
+ * the runner's normalizer recognizes.
9
+ *
10
+ * Differences from the legacy `Workflow()` (capital W):
11
+ * - **No chaining.** The full workflow is a single object literal —
12
+ * exactly what JSON workflows look like.
13
+ * - **No separate `nodes{}` map.** `inputs` lives on each step.
14
+ * - **No `set_var: true`** — every step's output auto-stores in `ctx.state`.
15
+ * Opt out with `ephemeral: true`. Multi-output: `spread: true`. Rename:
16
+ * `as: "<name>"`.
17
+ * - **`branch({when, then, else})`** replaces `addCondition + AddIf + AddElse`.
18
+ * - **`$` proxy** replaces hand-written `js/ctx....` strings with typed
19
+ * property access.
20
+ *
21
+ * @example
22
+ * import { workflow, branch, $ } from "@blokjs/helper";
23
+ *
24
+ * export default workflow({
25
+ * name: "World Countries",
26
+ * version: "1.0.0",
27
+ * trigger: { http: { method: "GET" } },
28
+ * steps: [
29
+ * { id: "fetch", use: "@blokjs/api-call",
30
+ * inputs: { url: "https://countriesnow.space/api/v0.1/countries" } },
31
+ * branch({
32
+ * id: "route",
33
+ * when: $.req.query.kind,
34
+ * then: [{ id: "respond", use: "@blokjs/respond",
35
+ * inputs: { body: $.state.fetch } }],
36
+ * else: [{ id: "fallback", use: "@blokjs/api-call",
37
+ * inputs: { url: "https://catfact.ninja/fact" } }]
38
+ * })
39
+ * ]
40
+ * });
41
+ */
42
+ export function workflow(opts) {
43
+ if (!opts || typeof opts !== "object") {
44
+ throw new Error("workflow() requires an options object.");
45
+ }
46
+ // Compile $ proxy expressions into js/ strings BEFORE schema validation
47
+ // (the schema sees only strings; proxies would fail z.string().min(1)).
48
+ const compiledSteps = unwrapProxies(opts.steps);
49
+ // Per-step schema check — surface authoring errors loudly.
50
+ for (let i = 0; i < compiledSteps.length; i++) {
51
+ const parsed = V2StepSchema.safeParse(compiledSteps[i]);
52
+ if (!parsed.success) {
53
+ const id = compiledSteps[i]?.id ?? compiledSteps[i]?.name ?? `<step ${i}>`;
54
+ throw new Error(`workflow("${opts.name}") step "${id}" failed validation: ${parsed.error.message}`);
55
+ }
56
+ }
57
+ // Per-kind trigger validation. Mirrors what `Trigger.addTrigger` does
58
+ // in the v1 builder so v2 authors get the same error messages.
59
+ const triggerKeys = Object.keys(opts.trigger ?? {});
60
+ if (triggerKeys.length === 0) {
61
+ throw new Error(`workflow("${opts.name}") requires a trigger.`);
62
+ }
63
+ const validatedTrigger = {};
64
+ for (const kind of triggerKeys) {
65
+ const parsedKind = TriggersSchema.safeParse(kind);
66
+ if (!parsedKind.success) {
67
+ throw new Error(`workflow("${opts.name}") trigger kind "${kind}" is not recognized. Allowed: http, queue, pubsub, worker, cron, webhook, sse, websocket, grpc, manual.`);
68
+ }
69
+ validatedTrigger[kind] = validateTriggerConfig(parsedKind.data, opts.trigger[kind]);
70
+ }
71
+ const _config = {
72
+ name: opts.name,
73
+ version: opts.version,
74
+ description: opts.description,
75
+ trigger: validatedTrigger,
76
+ steps: compiledSteps,
77
+ };
78
+ return Object.freeze({
79
+ _blokV2: true,
80
+ _config,
81
+ toJson: () => JSON.stringify(_config),
82
+ });
83
+ }
84
+ //# sourceMappingURL=workflowV2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflowV2.js","sourceRoot":"","sources":["../../src/components/workflowV2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAe,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AA+C7E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAkB;IAC1C,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QACvC,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;IAC3D,CAAC;IAED,wEAAwE;IACxE,wEAAwE;IACxE,MAAM,aAAa,GAAG,aAAa,CAAC,IAAI,CAAC,KAAK,CAAa,CAAC;IAE5D,2DAA2D;IAC3D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAC/C,MAAM,MAAM,GAAG,YAAY,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;QACxD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACrB,MAAM,EAAE,GACN,aAAa,CAAC,CAAC,CAAqB,EAAE,EAAE,IAAK,aAAa,CAAC,CAAC,CAAuB,EAAE,IAAI,IAAI,SAAS,CAAC,GAAG,CAAC;YAC7G,MAAM,IAAI,KAAK,CAAC,aAAa,IAAI,CAAC,IAAI,YAAY,EAAE,wBAAwB,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QACrG,CAAC;IACF,CAAC;IAED,sEAAsE;IACtE,+DAA+D;IAC/D,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;IACpD,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CAAC,aAAa,IAAI,CAAC,IAAI,wBAAwB,CAAC,CAAC;IACjE,CAAC;IACD,MAAM,gBAAgB,GAA4B,EAAE,CAAC;IACrD,KAAK,MAAM,IAAI,IAAI,WAAW,EAAE,CAAC;QAChC,MAAM,UAAU,GAAG,cAAc,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAClD,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CACd,aAAa,IAAI,CAAC,IAAI,oBAAoB,IAAI,yGAAyG,CACvJ,CAAC;QACH,CAAC;QACD,gBAAgB,CAAC,IAAI,CAAC,GAAG,qBAAqB,CAAC,UAAU,CAAC,IAAI,EAAG,IAAI,CAAC,OAAmC,CAAC,IAAI,CAAC,CAAC,CAAC;IAClH,CAAC;IAED,MAAM,OAAO,GAAe;QAC3B,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,OAAO,EAAE,gBAAgB;QACzB,KAAK,EAAE,aAAa;KACpB,CAAC;IAEF,OAAO,MAAM,CAAC,MAAM,CAAC;QACpB,OAAO,EAAE,IAAa;QACtB,OAAO;QACP,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;KACrC,CAAC,CAAC;AACJ,CAAC"}
package/dist/index.d.ts CHANGED
@@ -4,6 +4,11 @@ import HelperResponse from "./components/HelperResponse";
4
4
  import Step from "./components/StepNode";
5
5
  import Trigger from "./components/Trigger";
6
6
  import Workflow from "./components/Workflow";
7
- import { NodeType, NodeTypeSchema, RuntimeKind, RuntimeKindSchema, StepInputs, StepOpts } from "./types/StepOpts";
8
- import { CronTriggerOpts, CronTriggerOptsSchema, HttpTriggerOptsSchema, PubSubProvider, PubSubProviderSchema, PubSubTriggerOpts, PubSubTriggerOptsSchema, QueueProvider, QueueProviderSchema, QueueTriggerOpts, QueueTriggerOptsSchema, SSETriggerOpts, SSETriggerOptsSchema, TriggerOpts, TriggerOptsSchema, TriggersEnum, TriggersSchema, WebSocketTriggerOpts, WebSocketTriggerOptsSchema, WebhookTriggerOpts, WebhookTriggerOptsSchema, WorkerTriggerOpts, WorkerTriggerOptsSchema } from "./types/TriggerOpts";
9
- export { AddElse, AddIf, ConditionOpts, HelperResponse, NodeType, NodeTypeSchema, RuntimeKind, RuntimeKindSchema, Step, StepInputs, StepOpts, Trigger, Workflow, TriggerOpts, TriggerOptsSchema, HttpTriggerOptsSchema, QueueProvider, QueueProviderSchema, QueueTriggerOpts, QueueTriggerOptsSchema, PubSubProvider, PubSubProviderSchema, PubSubTriggerOpts, PubSubTriggerOptsSchema, WorkerTriggerOpts, WorkerTriggerOptsSchema, CronTriggerOpts, CronTriggerOptsSchema, WebhookTriggerOpts, WebhookTriggerOptsSchema, WebSocketTriggerOpts, WebSocketTriggerOptsSchema, SSETriggerOpts, SSETriggerOptsSchema, TriggersSchema, TriggersEnum, };
7
+ import { type BranchOpts, branch } from "./components/branch";
8
+ import { type WorkflowV2Builder, type WorkflowOpts as WorkflowV2Opts, workflow } from "./components/workflowV2";
9
+ import { $, type DollarProxy, type ExprPath, JS_EXPR_TAG, unwrapProxies } from "./proxy/$";
10
+ import { NodeType, NodeTypeSchema, RetryConfig, RetryConfigSchema, RuntimeKind, RuntimeKindSchema, StepInputs, StepOpts, V2BranchStep, V2BranchStepSchema, V2RegularStep, V2RegularStepSchema, V2Step, V2StepSchema, V2SubworkflowStep, V2SubworkflowStepSchema, V2WaitStep, V2WaitStepSchema, isBranchStep, isSubworkflowStep, isWaitStep } from "./types/StepOpts";
11
+ import { AnyTriggerOpts, ConcurrencyOpts, ConcurrencyOptsFields, ConcurrencyOptsSchema, CronTriggerOpts, CronTriggerOptsSchema, DebounceOpts, DebounceOptsSchema, HTTP_METHODS, HttpMethod, HttpMethodSchema, HttpTriggerOpts, HttpTriggerOptsSchema, PubSubProvider, PubSubProviderSchema, PubSubTriggerOpts, PubSubTriggerOptsSchema, QueueProvider, QueueProviderSchema, QueueTriggerOpts, QueueTriggerOptsSchema, SSETriggerOpts, SSETriggerOptsSchema, SchedulingOpts, SchedulingOptsFields, SchedulingOptsSchema, TRIGGER_SCHEMAS, TriggerConfigMap, TriggerOpts, TriggerOptsSchema, TriggersEnum, TriggersSchema, WebSocketTriggerOpts, WebSocketTriggerOptsSchema, WebhookTriggerOpts, WebhookTriggerOptsSchema, WorkerTriggerOpts, WorkerTriggerOptsSchema, concurrencyRefinement, makeSchedulingRefinement, validateTriggerConfig } from "./types/TriggerOpts";
12
+ import { WorkflowV2, WorkflowV2Schema } from "./types/WorkflowOpts";
13
+ import { parseDuration, tryParseDuration } from "./utils/parseDuration";
14
+ export { AddElse, AddIf, ConditionOpts, HelperResponse, NodeType, NodeTypeSchema, RuntimeKind, RuntimeKindSchema, Step, StepInputs, StepOpts, Trigger, Workflow, workflow, branch, $, unwrapProxies, type BranchOpts, type WorkflowV2Opts, type WorkflowV2Builder, type DollarProxy, type ExprPath, JS_EXPR_TAG, V2Step, V2StepSchema, V2RegularStep, V2RegularStepSchema, V2BranchStep, V2BranchStepSchema, isBranchStep, V2SubworkflowStep, V2SubworkflowStepSchema, isSubworkflowStep, V2WaitStep, V2WaitStepSchema, isWaitStep, RetryConfig, RetryConfigSchema, WorkflowV2, WorkflowV2Schema, HTTP_METHODS, HttpMethod, HttpMethodSchema, ConcurrencyOpts, ConcurrencyOptsFields, ConcurrencyOptsSchema, concurrencyRefinement, DebounceOpts, DebounceOptsSchema, makeSchedulingRefinement, SchedulingOpts, SchedulingOptsFields, SchedulingOptsSchema, HttpTriggerOpts, HttpTriggerOptsSchema, TriggerOpts, TriggerOptsSchema, QueueProvider, QueueProviderSchema, QueueTriggerOpts, QueueTriggerOptsSchema, PubSubProvider, PubSubProviderSchema, PubSubTriggerOpts, PubSubTriggerOptsSchema, WorkerTriggerOpts, WorkerTriggerOptsSchema, CronTriggerOpts, CronTriggerOptsSchema, WebhookTriggerOpts, WebhookTriggerOptsSchema, WebSocketTriggerOpts, WebSocketTriggerOptsSchema, SSETriggerOpts, SSETriggerOptsSchema, TriggersSchema, TriggersEnum, TriggerConfigMap, TRIGGER_SCHEMAS, AnyTriggerOpts, validateTriggerConfig, parseDuration, tryParseDuration, };
package/dist/index.js CHANGED
@@ -4,9 +4,24 @@ import HelperResponse from "./components/HelperResponse";
4
4
  import Step from "./components/StepNode";
5
5
  import Trigger from "./components/Trigger";
6
6
  import Workflow from "./components/Workflow";
7
- import { NodeTypeSchema, RuntimeKindSchema } from "./types/StepOpts";
8
- import { CronTriggerOptsSchema, HttpTriggerOptsSchema, PubSubProviderSchema, PubSubTriggerOptsSchema, QueueProviderSchema, QueueTriggerOptsSchema, SSETriggerOptsSchema, TriggerOptsSchema,
7
+ import { branch } from "./components/branch";
8
+ import { workflow } from "./components/workflowV2";
9
+ import { $, JS_EXPR_TAG, unwrapProxies } from "./proxy/$";
10
+ import { NodeTypeSchema, RetryConfigSchema, RuntimeKindSchema, V2BranchStepSchema, V2RegularStepSchema, V2StepSchema, V2SubworkflowStepSchema, V2WaitStepSchema, isBranchStep, isSubworkflowStep, isWaitStep, } from "./types/StepOpts";
11
+ import { ConcurrencyOptsFields, ConcurrencyOptsSchema, CronTriggerOptsSchema, DebounceOptsSchema,
12
+ // HTTP method enum (canonical names + legacy * preprocess)
13
+ HTTP_METHODS, HttpMethodSchema, HttpTriggerOptsSchema, PubSubProviderSchema, PubSubTriggerOptsSchema, QueueProviderSchema, QueueTriggerOptsSchema, SSETriggerOptsSchema, SchedulingOptsFields, SchedulingOptsSchema,
14
+ // Trigger registry
15
+ TRIGGER_SCHEMAS, TriggerOptsSchema,
9
16
  // Triggers enum
10
- TriggersSchema, WebSocketTriggerOptsSchema, WebhookTriggerOptsSchema, WorkerTriggerOptsSchema, } from "./types/TriggerOpts";
11
- export { AddElse, AddIf, HelperResponse, NodeTypeSchema, RuntimeKindSchema, Step, Trigger, Workflow, TriggerOptsSchema, HttpTriggerOptsSchema, QueueProviderSchema, QueueTriggerOptsSchema, PubSubProviderSchema, PubSubTriggerOptsSchema, WorkerTriggerOptsSchema, CronTriggerOptsSchema, WebhookTriggerOptsSchema, WebSocketTriggerOptsSchema, SSETriggerOptsSchema, TriggersSchema, };
17
+ TriggersSchema, WebSocketTriggerOptsSchema, WebhookTriggerOptsSchema, WorkerTriggerOptsSchema, concurrencyRefinement, makeSchedulingRefinement, validateTriggerConfig, } from "./types/TriggerOpts";
18
+ import { WorkflowV2Schema } from "./types/WorkflowOpts";
19
+ import { parseDuration, tryParseDuration } from "./utils/parseDuration";
20
+ export { AddElse, AddIf, HelperResponse, NodeTypeSchema, RuntimeKindSchema, Step, Trigger, Workflow,
21
+ // v2 DSL primitives — the canonical authoring surface
22
+ workflow, branch, $, unwrapProxies, JS_EXPR_TAG, V2StepSchema, V2RegularStepSchema, V2BranchStepSchema, isBranchStep, V2SubworkflowStepSchema, isSubworkflowStep, V2WaitStepSchema, isWaitStep, RetryConfigSchema, WorkflowV2Schema,
23
+ // HTTP method enum
24
+ HTTP_METHODS, HttpMethodSchema, ConcurrencyOptsFields, ConcurrencyOptsSchema, concurrencyRefinement, DebounceOptsSchema, makeSchedulingRefinement, SchedulingOptsFields, SchedulingOptsSchema, HttpTriggerOptsSchema, TriggerOptsSchema, QueueProviderSchema, QueueTriggerOptsSchema, PubSubProviderSchema, PubSubTriggerOptsSchema, WorkerTriggerOptsSchema, CronTriggerOptsSchema, WebhookTriggerOptsSchema, WebSocketTriggerOptsSchema, SSETriggerOptsSchema, TriggersSchema, TRIGGER_SCHEMAS, validateTriggerConfig,
25
+ // Duration parser (Tier 2 #5 + #7)
26
+ parseDuration, tryParseDuration, };
12
27
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,sBAAsB,CAAC;AAC3C,OAAO,KAAwB,MAAM,oBAAoB,CAAC;AAC1D,OAAO,cAAc,MAAM,6BAA6B,CAAC;AACzD,OAAO,IAAI,MAAM,uBAAuB,CAAC;AACzC,OAAO,OAAO,MAAM,sBAAsB,CAAC;AAC3C,OAAO,QAAQ,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAY,cAAc,EAAe,iBAAiB,EAAwB,MAAM,kBAAkB,CAAC;AAClH,OAAO,EAGN,qBAAqB,EACrB,qBAAqB,EAGrB,oBAAoB,EAEpB,uBAAuB,EAGvB,mBAAmB,EAEnB,sBAAsB,EAGtB,oBAAoB,EAGpB,iBAAiB;AAEjB,gBAAgB;AAChB,cAAc,EAGd,0BAA0B,EAG1B,wBAAwB,EAGxB,uBAAuB,GACvB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACN,OAAO,EACP,KAAK,EAEL,cAAc,EAEd,cAAc,EAEd,iBAAiB,EACjB,IAAI,EAGJ,OAAO,EACP,QAAQ,EAGR,iBAAiB,EACjB,qBAAqB,EAErB,mBAAmB,EAEnB,sBAAsB,EAEtB,oBAAoB,EAEpB,uBAAuB,EAEvB,uBAAuB,EAEvB,qBAAqB,EAErB,wBAAwB,EAExB,0BAA0B,EAE1B,oBAAoB,EACpB,cAAc,GAEd,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,sBAAsB,CAAC;AAC3C,OAAO,KAAwB,MAAM,oBAAoB,CAAC;AAC1D,OAAO,cAAc,MAAM,6BAA6B,CAAC;AACzD,OAAO,IAAI,MAAM,uBAAuB,CAAC;AACzC,OAAO,OAAO,MAAM,sBAA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