@xyne/workflow-sdk 3.2.39 → 3.2.40
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/builder/index.d.ts +3 -1
- package/dist/builder/index.d.ts.map +1 -1
- package/dist/builder/index.js +7 -1
- package/dist/builder/index.js.map +1 -1
- package/dist/client/types.d.ts +13 -0
- package/dist/client/types.d.ts.map +1 -1
- package/dist/client/workflow-client.d.ts.map +1 -1
- package/dist/client/workflow-client.js +8 -0
- package/dist/client/workflow-client.js.map +1 -1
- package/dist/common/citation-ref.d.ts +36 -36
- package/dist/connectors/builtin/steps/http-request.step.d.ts +2 -2
- package/dist/connectors/builtin/steps/switch.step.d.ts +12 -12
- package/dist/connectors/builtin/steps/wait.step.d.ts +90 -90
- package/dist/connectors/builtin/triggers/default-cron-trigger.d.ts +9 -1
- package/dist/connectors/builtin/triggers/default-cron-trigger.d.ts.map +1 -1
- package/dist/connectors/builtin/triggers/default-cron-trigger.js +3 -3
- package/dist/connectors/builtin/triggers/default-cron-trigger.js.map +1 -1
- package/dist/connectors/builtin/triggers/default-event-trigger.d.ts +12 -1
- package/dist/connectors/builtin/triggers/default-event-trigger.d.ts.map +1 -1
- package/dist/connectors/builtin/triggers/default-event-trigger.js +13 -1
- package/dist/connectors/builtin/triggers/default-event-trigger.js.map +1 -1
- package/dist/connectors/builtin/triggers/default-manual-trigger.d.ts +4 -1
- package/dist/connectors/builtin/triggers/default-manual-trigger.d.ts.map +1 -1
- package/dist/connectors/builtin/triggers/default-manual-trigger.js +3 -1
- package/dist/connectors/builtin/triggers/default-manual-trigger.js.map +1 -1
- package/dist/connectors/core/connector-registry.d.ts.map +1 -1
- package/dist/connectors/core/connector-registry.js +19 -1
- package/dist/connectors/core/connector-registry.js.map +1 -1
- package/dist/engine/condition-evaluator.d.ts.map +1 -1
- package/dist/engine/condition-evaluator.js +41 -5
- package/dist/engine/condition-evaluator.js.map +1 -1
- package/dist/engine/config-validator.d.ts +8 -0
- package/dist/engine/config-validator.d.ts.map +1 -1
- package/dist/engine/config-validator.js +61 -4
- package/dist/engine/config-validator.js.map +1 -1
- package/dist/engine/workflow-executor.d.ts.map +1 -1
- package/dist/engine/workflow-executor.js +5 -28
- package/dist/engine/workflow-executor.js.map +1 -1
- package/dist/index.d.ts +8 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/ingest/start-policy.d.ts +202 -0
- package/dist/ingest/start-policy.d.ts.map +1 -0
- package/dist/ingest/start-policy.js +199 -0
- package/dist/ingest/start-policy.js.map +1 -0
- package/dist/ingest/types.d.ts +25 -6
- package/dist/ingest/types.d.ts.map +1 -1
- package/dist/persistence/in-memory-adapter.d.ts +4 -2
- package/dist/persistence/in-memory-adapter.d.ts.map +1 -1
- package/dist/persistence/in-memory-adapter.js +9 -1
- package/dist/persistence/in-memory-adapter.js.map +1 -1
- package/dist/persistence/types.d.ts +53 -1
- package/dist/persistence/types.d.ts.map +1 -1
- package/dist/router/types.d.ts +1 -0
- package/dist/router/types.d.ts.map +1 -1
- package/dist/router/workflow-router.d.ts.map +1 -1
- package/dist/router/workflow-router.js +35 -0
- package/dist/router/workflow-router.js.map +1 -1
- package/dist/runtime/types.d.ts +5 -0
- package/dist/runtime/types.d.ts.map +1 -1
- package/dist/runtime/workflow-runtime.d.ts +114 -3
- package/dist/runtime/workflow-runtime.d.ts.map +1 -1
- package/dist/runtime/workflow-runtime.js +411 -53
- package/dist/runtime/workflow-runtime.js.map +1 -1
- package/dist/schema/options.d.ts +101 -0
- package/dist/schema/options.d.ts.map +1 -0
- package/dist/schema/options.js +14 -0
- package/dist/schema/options.js.map +1 -0
- package/dist/steps/base-step.d.ts +11 -1
- package/dist/steps/base-step.d.ts.map +1 -1
- package/dist/steps/base-step.js.map +1 -1
- package/dist/triggers/api-trigger.d.ts +1 -1
- package/dist/triggers/api-trigger.d.ts.map +1 -1
- package/dist/triggers/api-trigger.js.map +1 -1
- package/dist/triggers/base-trigger.d.ts +66 -8
- package/dist/triggers/base-trigger.d.ts.map +1 -1
- package/dist/triggers/base-trigger.js +14 -3
- package/dist/triggers/base-trigger.js.map +1 -1
- package/dist/triggers/cron-trigger.d.ts +1 -1
- package/dist/triggers/cron-trigger.d.ts.map +1 -1
- package/dist/triggers/cron-trigger.js.map +1 -1
- package/dist/triggers/event-trigger.d.ts +3 -3
- package/dist/triggers/event-trigger.d.ts.map +1 -1
- package/dist/triggers/event-trigger.js +2 -2
- package/dist/triggers/event-trigger.js.map +1 -1
- package/dist/triggers/manual-trigger.d.ts +1 -1
- package/dist/triggers/manual-trigger.d.ts.map +1 -1
- package/dist/triggers/manual-trigger.js.map +1 -1
- package/dist/triggers/webhook-trigger.d.ts +3 -3
- package/dist/triggers/webhook-trigger.d.ts.map +1 -1
- package/dist/triggers/webhook-trigger.js.map +1 -1
- package/dist/types/config-path.d.ts +24 -0
- package/dist/types/config-path.d.ts.map +1 -0
- package/dist/types/config-path.js +18 -0
- package/dist/types/config-path.js.map +1 -0
- package/dist/types/context.d.ts.map +1 -1
- package/dist/types/operators.d.ts +15 -1
- package/dist/types/operators.d.ts.map +1 -1
- package/dist/types/operators.js +21 -0
- package/dist/types/operators.js.map +1 -1
- package/dist/types/workflow-config.d.ts +13 -0
- package/dist/types/workflow-config.d.ts.map +1 -1
- package/dist/types/workflow-config.js +9 -7
- package/dist/types/workflow-config.js.map +1 -1
- package/dist/util/option-mark.d.ts +44 -0
- package/dist/util/option-mark.d.ts.map +1 -0
- package/dist/util/option-mark.js +132 -0
- package/dist/util/option-mark.js.map +1 -0
- package/dist/util/schema-convert.d.ts +5 -0
- package/dist/util/schema-convert.d.ts.map +1 -1
- package/dist/util/schema-convert.js +7 -1
- package/dist/util/schema-convert.js.map +1 -1
- package/dist/util/schema-marks.d.ts +58 -0
- package/dist/util/schema-marks.d.ts.map +1 -0
- package/dist/util/schema-marks.js +161 -0
- package/dist/util/schema-marks.js.map +1 -0
- package/dist/util/variable-ref.d.ts +0 -5
- package/dist/util/variable-ref.d.ts.map +1 -1
- package/dist/util/variable-ref.js +0 -5
- package/dist/util/variable-ref.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cron-trigger.d.ts","sourceRoot":"","sources":["../../src/triggers/cron-trigger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAIrE;;;;;;;;GAQG;AACH,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,eAAe,CAC9B,SAAS,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAEnE,QAAQ,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;IACrC,UAAU,EAAE;QACV,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;QACnC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;QAChD,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;KACpC,CAAC;IACF,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAID;;;;;;;;;GASG;AACH,8BAAsB,WAAW,CAC/B,OAAO,SAAS,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,UAAU,CAC3C,SAAQ,WAAW,CAAC,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"cron-trigger.d.ts","sourceRoot":"","sources":["../../src/triggers/cron-trigger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,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;;OAIG;IACH,YAAY,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CACjE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cron-trigger.js","sourceRoot":"","sources":["../../src/triggers/cron-trigger.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AA8BhD,sBAAsB;AAEtB;;;;;;;;;GASG;AACH,MAAM,OAAgB,
|
|
1
|
+
{"version":3,"file":"cron-trigger.js","sourceRoot":"","sources":["../../src/triggers/cron-trigger.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AA8BhD,sBAAsB;AAEtB;;;;;;;;;GASG;AACH,MAAM,OAAgB,WAGpB,SAAQ,WAA6B;CAqBtC"}
|
|
@@ -4,11 +4,11 @@ import { BaseTrigger } from './base-trigger.js';
|
|
|
4
4
|
* Passive trigger — fires when the host calls `runtime.dispatchEvent()`.
|
|
5
5
|
*
|
|
6
6
|
* The runtime looks up all active workflows whose trigger type matches the
|
|
7
|
-
* event type,
|
|
8
|
-
*
|
|
7
|
+
* event type, then admits each one through `accepts()` → `hydrate()` → the
|
|
8
|
+
* author's conditions, and enqueues the survivors.
|
|
9
9
|
*
|
|
10
10
|
* Hosts extend this for domain events (e.g. TicketCreatedTrigger).
|
|
11
11
|
*/
|
|
12
|
-
export declare abstract class EventTrigger<TConfig extends z.ZodTypeAny = z.ZodTypeAny> extends BaseTrigger<TConfig> {
|
|
12
|
+
export declare abstract class EventTrigger<TConfig extends z.ZodTypeAny = z.ZodTypeAny, TOutput extends z.ZodTypeAny = z.ZodTypeAny, TRaw extends Record<string, unknown> = Record<string, unknown>> extends BaseTrigger<TConfig, TOutput, TRaw> {
|
|
13
13
|
}
|
|
14
14
|
//# sourceMappingURL=event-trigger.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-trigger.d.ts","sourceRoot":"","sources":["../../src/triggers/event-trigger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;;;;;;;GAQG;AACH,8BAAsB,YAAY,CAChC,OAAO,SAAS,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,UAAU,
|
|
1
|
+
{"version":3,"file":"event-trigger.d.ts","sourceRoot":"","sources":["../../src/triggers/event-trigger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;;;;;;;GAQG;AACH,8BAAsB,YAAY,CAChC,OAAO,SAAS,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,UAAU,EAC3C,OAAO,SAAS,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,UAAU,EAC3C,IAAI,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAC9D,SAAQ,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC;CAAG"}
|
|
@@ -3,8 +3,8 @@ import { BaseTrigger } from './base-trigger.js';
|
|
|
3
3
|
* Passive trigger — fires when the host calls `runtime.dispatchEvent()`.
|
|
4
4
|
*
|
|
5
5
|
* The runtime looks up all active workflows whose trigger type matches the
|
|
6
|
-
* event type,
|
|
7
|
-
*
|
|
6
|
+
* event type, then admits each one through `accepts()` → `hydrate()` → the
|
|
7
|
+
* author's conditions, and enqueues the survivors.
|
|
8
8
|
*
|
|
9
9
|
* Hosts extend this for domain events (e.g. TicketCreatedTrigger).
|
|
10
10
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-trigger.js","sourceRoot":"","sources":["../../src/triggers/event-trigger.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;;;;;;;GAQG;AACH,MAAM,OAAgB,
|
|
1
|
+
{"version":3,"file":"event-trigger.js","sourceRoot":"","sources":["../../src/triggers/event-trigger.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;;;;;;;GAQG;AACH,MAAM,OAAgB,YAIpB,SAAQ,WAAmC;CAAG"}
|
|
@@ -6,6 +6,6 @@ import { BaseTrigger } from './base-trigger.js';
|
|
|
6
6
|
* Used for test runs and user-initiated workflow executions.
|
|
7
7
|
* The payload is whatever the caller passes.
|
|
8
8
|
*/
|
|
9
|
-
export declare abstract class ManualTrigger<TConfig extends z.ZodTypeAny = z.ZodTypeAny> extends BaseTrigger<TConfig> {
|
|
9
|
+
export declare abstract class ManualTrigger<TConfig extends z.ZodTypeAny = z.ZodTypeAny, TOutput extends z.ZodTypeAny = z.ZodTypeAny> extends BaseTrigger<TConfig, TOutput> {
|
|
10
10
|
}
|
|
11
11
|
//# sourceMappingURL=manual-trigger.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manual-trigger.d.ts","sourceRoot":"","sources":["../../src/triggers/manual-trigger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;;;;GAKG;AACH,8BAAsB,aAAa,CACjC,OAAO,SAAS,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,UAAU,CAC3C,SAAQ,WAAW,CAAC,OAAO,CAAC;CAAG"}
|
|
1
|
+
{"version":3,"file":"manual-trigger.d.ts","sourceRoot":"","sources":["../../src/triggers/manual-trigger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;;;;GAKG;AACH,8BAAsB,aAAa,CACjC,OAAO,SAAS,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,UAAU,EAC3C,OAAO,SAAS,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,UAAU,CAC3C,SAAQ,WAAW,CAAC,OAAO,EAAE,OAAO,CAAC;CAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manual-trigger.js","sourceRoot":"","sources":["../../src/triggers/manual-trigger.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;;;;GAKG;AACH,MAAM,OAAgB,
|
|
1
|
+
{"version":3,"file":"manual-trigger.js","sourceRoot":"","sources":["../../src/triggers/manual-trigger.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;;;;GAKG;AACH,MAAM,OAAgB,aAGpB,SAAQ,WAA6B;CAAG"}
|
|
@@ -25,7 +25,7 @@ import type { InboundHttpRequest, InboundReply, RawInboundRequest, Translation }
|
|
|
25
25
|
* an implementation that accepts everything leaves the workflow open to anyone
|
|
26
26
|
* who learns its id.
|
|
27
27
|
*/
|
|
28
|
-
export declare abstract class WebhookTrigger<TConfig extends z.ZodTypeAny = z.ZodTypeAny> extends BaseTrigger<TConfig> {
|
|
28
|
+
export declare abstract class WebhookTrigger<TConfig extends z.ZodTypeAny = z.ZodTypeAny, TOutput extends z.ZodTypeAny = z.ZodTypeAny, TRaw extends Record<string, unknown> = Record<string, unknown>> extends BaseTrigger<TConfig, TOutput, TRaw> {
|
|
29
29
|
/**
|
|
30
30
|
* Answer a provider's URL handshake: the request some providers send when the
|
|
31
31
|
* URL is registered, before any real delivery, expecting a reply in their own
|
|
@@ -55,8 +55,8 @@ export declare abstract class WebhookTrigger<TConfig extends z.ZodTypeAny = z.Zo
|
|
|
55
55
|
* Turn a verified request into events, and say what to reply.
|
|
56
56
|
*
|
|
57
57
|
* Should be pure: no network calls. Enrichment that needs the provider's API
|
|
58
|
-
* belongs in `
|
|
58
|
+
* belongs in `hydrate`, which runs before the run starts.
|
|
59
59
|
*/
|
|
60
|
-
abstract handleRequest(request: RawInboundRequest, config: z.infer<TConfig>, ctx: TriggerExecutionContext): Promise<Translation
|
|
60
|
+
abstract handleRequest(request: RawInboundRequest, config: z.infer<TConfig>, ctx: TriggerExecutionContext): Promise<Translation<TRaw>>;
|
|
61
61
|
}
|
|
62
62
|
//# sourceMappingURL=webhook-trigger.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhook-trigger.d.ts","sourceRoot":"","sources":["../../src/triggers/webhook-trigger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,KAAK,EAAE,kBAAkB,EAAE,YAAY,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAE3G;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,8BAAsB,cAAc,CAClC,OAAO,SAAS,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,UAAU,
|
|
1
|
+
{"version":3,"file":"webhook-trigger.d.ts","sourceRoot":"","sources":["../../src/triggers/webhook-trigger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,KAAK,EAAE,kBAAkB,EAAE,YAAY,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAE3G;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,8BAAsB,cAAc,CAClC,OAAO,SAAS,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,UAAU,EAC3C,OAAO,SAAS,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,UAAU,EAC3C,IAAI,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAC9D,SAAQ,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC;IAC3C;;;;;;;;;;;;;;;;OAgBG;IACH,SAAS,CACP,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,EACzB,IAAI,EAAE,uBAAuB,GAC5B,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC;IAIpC;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,CACb,OAAO,EAAE,kBAAkB,EAC3B,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,EACxB,GAAG,EAAE,uBAAuB,GAC3B,OAAO,CAAC,OAAO,CAAC;IAEnB;;;;;OAKG;IACH,QAAQ,CAAC,aAAa,CACpB,OAAO,EAAE,iBAAiB,EAC1B,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,EACxB,GAAG,EAAE,uBAAuB,GAC3B,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;CAC9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhook-trigger.js","sourceRoot":"","sources":["../../src/triggers/webhook-trigger.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIhD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,OAAgB,
|
|
1
|
+
{"version":3,"file":"webhook-trigger.js","sourceRoot":"","sources":["../../src/triggers/webhook-trigger.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIhD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,OAAgB,cAIpB,SAAQ,WAAmC;IAC3C;;;;;;;;;;;;;;;;OAgBG;IACH,SAAS,CACP,QAA4B,EAC5B,OAAyB,EACzB,IAA6B;QAE7B,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACpC,CAAC;CAyBF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dotted paths into a config object, as a type.
|
|
3
|
+
*
|
|
4
|
+
* Used to declare which of a component's fields offer choices. A name is how the
|
|
5
|
+
* editor finds the field and how `getOptions` tells them apart, so a typo means a
|
|
6
|
+
* picker that never appears and nothing that says why — the one failure this
|
|
7
|
+
* declaration exists to prevent. Typing the paths turns it into a build error.
|
|
8
|
+
*
|
|
9
|
+
* ConfigPath<{ repo: string; owner: { login: string } }>
|
|
10
|
+
* → 'repo' | 'owner' | 'owner.login'
|
|
11
|
+
*
|
|
12
|
+
* Depth is capped at three levels: config shapes that nest deeper are a sign the
|
|
13
|
+
* form itself needs rethinking, and an uncapped recursive type is a tax on every
|
|
14
|
+
* compile. An array's own name is a valid path (that field will take a multi
|
|
15
|
+
* picker); paths *into* an array are not, until the editor can render one.
|
|
16
|
+
*/
|
|
17
|
+
type Primitive = string | number | boolean | bigint | symbol | null | undefined;
|
|
18
|
+
type Depth = 0 | 1 | 2 | 3;
|
|
19
|
+
type Decrement = [never, 0, 1, 2];
|
|
20
|
+
export type ConfigPath<T, D extends Depth = 3> = [D] extends [never] ? never : T extends Primitive ? never : T extends readonly unknown[] ? never : {
|
|
21
|
+
[K in Extract<keyof T, string>]: NonNullable<T[K]> extends Primitive ? K : NonNullable<T[K]> extends readonly unknown[] ? K : K | `${K}.${ConfigPath<NonNullable<T[K]>, Decrement[D]>}`;
|
|
22
|
+
}[Extract<keyof T, string>];
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=config-path.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-path.d.ts","sourceRoot":"","sources":["../../src/types/config-path.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,KAAK,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;AAEhF,KAAK,KAAK,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAC3B,KAAK,SAAS,GAAG,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAElC,MAAM,MAAM,UAAU,CAAC,CAAC,EAAE,CAAC,SAAS,KAAK,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GAChE,KAAK,GACL,CAAC,SAAS,SAAS,GACjB,KAAK,GACL,CAAC,SAAS,SAAS,OAAO,EAAE,GAC1B,KAAK,GACL;KACG,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,SAAS,GAChE,CAAC,GACD,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,SAAS,OAAO,EAAE,GAC1C,CAAC,GACD,CAAC,GAAG,GAAG,CAAC,IAAI,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE;CAChE,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dotted paths into a config object, as a type.
|
|
3
|
+
*
|
|
4
|
+
* Used to declare which of a component's fields offer choices. A name is how the
|
|
5
|
+
* editor finds the field and how `getOptions` tells them apart, so a typo means a
|
|
6
|
+
* picker that never appears and nothing that says why — the one failure this
|
|
7
|
+
* declaration exists to prevent. Typing the paths turns it into a build error.
|
|
8
|
+
*
|
|
9
|
+
* ConfigPath<{ repo: string; owner: { login: string } }>
|
|
10
|
+
* → 'repo' | 'owner' | 'owner.login'
|
|
11
|
+
*
|
|
12
|
+
* Depth is capped at three levels: config shapes that nest deeper are a sign the
|
|
13
|
+
* form itself needs rethinking, and an uncapped recursive type is a tax on every
|
|
14
|
+
* compile. An array's own name is a valid path (that field will take a multi
|
|
15
|
+
* picker); paths *into* an array are not, until the editor can render one.
|
|
16
|
+
*/
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=config-path.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-path.js","sourceRoot":"","sources":["../../src/types/config-path.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/types/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAE5D;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAExE,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;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aG;QACH,UAAU,EAAE,kBAAkB,CAAC,UAAU,CAAC,CAAC;QAC3C;;;;WAIG;QACH,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACnC,CAAC;IACF,OAAO,EAAE,cAAc,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IACxC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IACpC,MAAM,CAAC,EAAE;QACP,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACtB,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;QAE1B;;;WAGG;QACH,WAAW,CAAC,EAAE;YACZ,WAAW,EAAE,MAAM,CAAC;YACpB,aAAa,EAAE,MAAM,CAAC;YACtB,UAAU,EAAE,MAAM,CAAC;SACpB,CAAC;QACF;;;;;WAKG;QACH,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC3C;;;;WAIG;QACH,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAC7C,CAAC;CACH"}
|
|
@@ -1,13 +1,27 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* What a condition can ask of a value.
|
|
4
|
+
*
|
|
5
|
+
* Deliberately small: anything the tree can already say another way is left out.
|
|
6
|
+
* `in` is an `any` group of `eq`s, `not in` is an `all` group of `neq`s — adding
|
|
7
|
+
* operators for those would give authors two ways to write one rule. What IS here
|
|
8
|
+
* is what the tree cannot express at all: negation of a substring test, the two
|
|
9
|
+
* ends of a string, and the difference between absent and empty.
|
|
10
|
+
*/
|
|
2
11
|
export declare enum ConditionOperator {
|
|
3
12
|
EQ = "eq",
|
|
4
13
|
NEQ = "neq",
|
|
5
14
|
CONTAINS = "contains",
|
|
15
|
+
NOT_CONTAINS = "not_contains",
|
|
16
|
+
STARTS_WITH = "starts_with",
|
|
17
|
+
ENDS_WITH = "ends_with",
|
|
6
18
|
GT = "gt",
|
|
7
19
|
GTE = "gte",
|
|
8
20
|
LT = "lt",
|
|
9
21
|
LTE = "lte",
|
|
10
|
-
EXISTS = "exists"
|
|
22
|
+
EXISTS = "exists",
|
|
23
|
+
NOT_EXISTS = "not_exists",
|
|
24
|
+
IS_EMPTY = "is_empty"
|
|
11
25
|
}
|
|
12
26
|
export declare const ConditionOperatorSchema: z.ZodNativeEnum<typeof ConditionOperator>;
|
|
13
27
|
export declare const VALUE_LESS_OPERATORS: ReadonlySet<ConditionOperator>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operators.d.ts","sourceRoot":"","sources":["../../src/types/operators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,oBAAY,iBAAiB;IAC3B,EAAE,OAAO;IACT,GAAG,QAAQ;IACX,QAAQ,aAAa;IACrB,EAAE,OAAO;IACT,GAAG,QAAQ;IACX,EAAE,OAAO;IACT,GAAG,QAAQ;IACX,MAAM,WAAW;
|
|
1
|
+
{"version":3,"file":"operators.d.ts","sourceRoot":"","sources":["../../src/types/operators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;GAQG;AACH,oBAAY,iBAAiB;IAC3B,EAAE,OAAO;IACT,GAAG,QAAQ;IACX,QAAQ,aAAa;IACrB,YAAY,iBAAiB;IAC7B,WAAW,gBAAgB;IAC3B,SAAS,cAAc;IACvB,EAAE,OAAO;IACT,GAAG,QAAQ;IACX,EAAE,OAAO;IACT,GAAG,QAAQ;IACX,MAAM,WAAW;IACjB,UAAU,eAAe;IACzB,QAAQ,aAAa;CACtB;AAED,eAAO,MAAM,uBAAuB,2CAAkC,CAAC;AAEvE,eAAO,MAAM,oBAAoB,EAAE,WAAW,CAAC,iBAAiB,CAI9D,CAAC;AAIH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAC;IAClC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,CAAC;CAC9D;AAED,eAAO,MAAM,oBAAoB,EAAE,SAAS,kBAAkB,EAc7D,CAAC"}
|
package/dist/types/operators.js
CHANGED
|
@@ -1,27 +1,48 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* What a condition can ask of a value.
|
|
4
|
+
*
|
|
5
|
+
* Deliberately small: anything the tree can already say another way is left out.
|
|
6
|
+
* `in` is an `any` group of `eq`s, `not in` is an `all` group of `neq`s — adding
|
|
7
|
+
* operators for those would give authors two ways to write one rule. What IS here
|
|
8
|
+
* is what the tree cannot express at all: negation of a substring test, the two
|
|
9
|
+
* ends of a string, and the difference between absent and empty.
|
|
10
|
+
*/
|
|
2
11
|
export var ConditionOperator;
|
|
3
12
|
(function (ConditionOperator) {
|
|
4
13
|
ConditionOperator["EQ"] = "eq";
|
|
5
14
|
ConditionOperator["NEQ"] = "neq";
|
|
6
15
|
ConditionOperator["CONTAINS"] = "contains";
|
|
16
|
+
ConditionOperator["NOT_CONTAINS"] = "not_contains";
|
|
17
|
+
ConditionOperator["STARTS_WITH"] = "starts_with";
|
|
18
|
+
ConditionOperator["ENDS_WITH"] = "ends_with";
|
|
7
19
|
ConditionOperator["GT"] = "gt";
|
|
8
20
|
ConditionOperator["GTE"] = "gte";
|
|
9
21
|
ConditionOperator["LT"] = "lt";
|
|
10
22
|
ConditionOperator["LTE"] = "lte";
|
|
11
23
|
ConditionOperator["EXISTS"] = "exists";
|
|
24
|
+
ConditionOperator["NOT_EXISTS"] = "not_exists";
|
|
25
|
+
ConditionOperator["IS_EMPTY"] = "is_empty";
|
|
12
26
|
})(ConditionOperator || (ConditionOperator = {}));
|
|
13
27
|
export const ConditionOperatorSchema = z.nativeEnum(ConditionOperator);
|
|
14
28
|
export const VALUE_LESS_OPERATORS = new Set([
|
|
15
29
|
ConditionOperator.EXISTS,
|
|
30
|
+
ConditionOperator.NOT_EXISTS,
|
|
31
|
+
ConditionOperator.IS_EMPTY,
|
|
16
32
|
]);
|
|
17
33
|
export const OPERATOR_DESCRIPTORS = [
|
|
18
34
|
{ value: ConditionOperator.EQ, label: 'equals', valueType: 'string' },
|
|
19
35
|
{ value: ConditionOperator.NEQ, label: 'does not equal', valueType: 'string' },
|
|
20
36
|
{ value: ConditionOperator.CONTAINS, label: 'contains', valueType: 'string' },
|
|
37
|
+
{ value: ConditionOperator.NOT_CONTAINS, label: 'does not contain', valueType: 'string' },
|
|
38
|
+
{ value: ConditionOperator.STARTS_WITH, label: 'starts with', valueType: 'string' },
|
|
39
|
+
{ value: ConditionOperator.ENDS_WITH, label: 'ends with', valueType: 'string' },
|
|
21
40
|
{ value: ConditionOperator.GT, label: 'is greater than', valueType: 'number' },
|
|
22
41
|
{ value: ConditionOperator.GTE, label: 'is greater than or equal to', valueType: 'number' },
|
|
23
42
|
{ value: ConditionOperator.LT, label: 'is less than', valueType: 'number' },
|
|
24
43
|
{ value: ConditionOperator.LTE, label: 'is less than or equal to', valueType: 'number' },
|
|
25
44
|
{ value: ConditionOperator.EXISTS, label: 'exists', valueType: 'none' },
|
|
45
|
+
{ value: ConditionOperator.NOT_EXISTS, label: 'does not exist', valueType: 'none' },
|
|
46
|
+
{ value: ConditionOperator.IS_EMPTY, label: 'is empty', valueType: 'none' },
|
|
26
47
|
];
|
|
27
48
|
//# sourceMappingURL=operators.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operators.js","sourceRoot":"","sources":["../../src/types/operators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAN,IAAY,
|
|
1
|
+
{"version":3,"file":"operators.js","sourceRoot":"","sources":["../../src/types/operators.ts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ACnF,EAAE,KAAK,EAAE,iBAAiB,CAAC,SAAS,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE;IAC/E,EAAE,KAAK,EAAE,iBAAiB,CAAC,EAAE,EAAE,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,QAAQ,EAAE;IAC9E,EAAE,KAAK,EAAE,iBAAiB,CAAC,GAAG,EAAE,KAAK,EAAE,6BAA6B,EAAE,SAAS,EAAE,QAAQ,EAAE;IAC3F,EAAE,KAAK,EAAE,iBAAiB,CAAC,EAAE,EAAE,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,QAAQ,EAAE;IAC3E,EAAE,KAAK,EAAE,iBAAiB,CAAC,GAAG,EAAE,KAAK,EAAE,0BAA0B,EAAE,SAAS,EAAE,QAAQ,EAAE;IACxF,EAAE,KAAK,EAAE,iBAAiB,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE;IACvE,EAAE,KAAK,EAAE,iBAAiB,CAAC,UAAU,EAAE,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,EAAE;IACnF,EAAE,KAAK,EAAE,iBAAiB,CAAC,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE;CAC5E,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import type { TriggerStart } from '../ingest/start-policy.js';
|
|
2
3
|
import type { TriggerType } from './trigger-types.js';
|
|
3
4
|
import type { StepType } from './step-types.js';
|
|
4
5
|
import { BuiltinStepType } from './known-types.js';
|
|
@@ -9,6 +10,11 @@ import type { WorkflowVariable } from './workflow-variable.js';
|
|
|
9
10
|
* Wraps a Zod schema to also accept a `{{...}}` variable reference string.
|
|
10
11
|
* Used in step config schemas — e.g. `variableRef(z.string())` accepts
|
|
11
12
|
* either a literal string or a `{{trigger.someField}}` reference.
|
|
13
|
+
*
|
|
14
|
+
* The union is marked rather than described: a reference being legal is a fact
|
|
15
|
+
* about the field, not a sentence about it, and `description` belongs to the
|
|
16
|
+
* author. The inner schema keeps its own description, which is where the editor
|
|
17
|
+
* reads it from.
|
|
12
18
|
*/
|
|
13
19
|
export declare function variableRef<T extends z.ZodTypeAny>(inner: T): z.ZodUnion<[T, z.ZodString]>;
|
|
14
20
|
/**
|
|
@@ -184,6 +190,13 @@ export interface WorkflowConfig {
|
|
|
184
190
|
* is which of its events the workflow wants. See {@link TriggerFilter}.
|
|
185
191
|
*/
|
|
186
192
|
filter?: TriggerFilter;
|
|
193
|
+
/**
|
|
194
|
+
* When a matching event becomes a run — immediately, or later. A delayed
|
|
195
|
+
* binding is armed on arrival and admitted when it fires, so {@link filter}
|
|
196
|
+
* and the trigger's own filter judge the world as it is then, not as it was.
|
|
197
|
+
* See {@link TriggerStart}.
|
|
198
|
+
*/
|
|
199
|
+
start?: TriggerStart;
|
|
187
200
|
};
|
|
188
201
|
steps: WorkflowStepConfig[];
|
|
189
202
|
settings?: WorkflowSettings;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-config.d.ts","sourceRoot":"","sources":["../../src/types/workflow-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAE5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"workflow-config.d.ts","sourceRoot":"","sources":["../../src/types/workflow-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;A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gBAAgB,EAAE,CAAC;CAChC;AAID;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;CACxB;AAED,eAAO,MAAM,mBAAmB,EAAE,CAAC,CAAC,OAAO,CAAC,aAAa,CAElB,CAAC;AAExC;;;GAGG;AACH,eAAO,MAAM,oBAAoB,aAAa,CAAC;AAI/C;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,IAAI,EAAE,MAAM,GACX,OAAO,CAcT"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { BuiltinStepType } from './known-types.js';
|
|
3
3
|
import { ConditionOperatorSchema } from './operators.js';
|
|
4
|
-
import { VARIABLE_REF_REGEX
|
|
4
|
+
import { VARIABLE_REF_REGEX } from '../util/variable-ref.js';
|
|
5
|
+
import { isMarked, markSchema } from '../util/schema-marks.js';
|
|
5
6
|
// ─── Variable Reference Helpers ───
|
|
6
7
|
const variableRefStringSchema = z
|
|
7
8
|
.string()
|
|
@@ -10,20 +11,21 @@ const variableRefStringSchema = z
|
|
|
10
11
|
* Wraps a Zod schema to also accept a `{{...}}` variable reference string.
|
|
11
12
|
* Used in step config schemas — e.g. `variableRef(z.string())` accepts
|
|
12
13
|
* either a literal string or a `{{trigger.someField}}` reference.
|
|
14
|
+
*
|
|
15
|
+
* The union is marked rather than described: a reference being legal is a fact
|
|
16
|
+
* about the field, not a sentence about it, and `description` belongs to the
|
|
17
|
+
* author. The inner schema keeps its own description, which is where the editor
|
|
18
|
+
* reads it from.
|
|
13
19
|
*/
|
|
14
20
|
export function variableRef(inner) {
|
|
15
|
-
return z
|
|
16
|
-
.union([inner, variableRefStringSchema])
|
|
17
|
-
.describe(`${VARIABLE_REF_DESCRIPTION_PREFIX}${inner.description ?? inner._def.typeName}`);
|
|
21
|
+
return markSchema(z.union([inner, variableRefStringSchema]), 'isVariableRef');
|
|
18
22
|
}
|
|
19
23
|
/**
|
|
20
24
|
* Given a schema that may be a variableRef union, extract the inner (non-ref) schema.
|
|
21
25
|
* Returns null if the schema is not a variableRef union.
|
|
22
26
|
*/
|
|
23
27
|
export function getVariableRefInnerSchema(schema) {
|
|
24
|
-
if (schema instanceof z.ZodUnion &&
|
|
25
|
-
typeof schema.description === 'string' &&
|
|
26
|
-
schema.description.startsWith(VARIABLE_REF_DESCRIPTION_PREFIX)) {
|
|
28
|
+
if (schema instanceof z.ZodUnion && isMarked(schema._def, 'isVariableRef')) {
|
|
27
29
|
const options = schema._def
|
|
28
30
|
.options;
|
|
29
31
|
return options[0] ?? null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-config.js","sourceRoot":"","sources":["../../src/types/workflow-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"workflow-config.js","sourceRoot":"","sources":["../../src/types/workflow-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAEzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAG/D,qCAAqC;AAErC,MAAM,uBAAuB,GAAG,CAAC;KAC9B,MAAM,EAAE;KACR,KAAK,CAAC,kBAAkB,EAAE,wCAAwC,CAAC,CAAC;AAEvE;;;;;;;;;GASG;AACH,MAAM,UAAU,WAAW,CACzB,KAAQ;IAER,OAAO,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,uBAAuB,CAAC,CAAC,EAAE,eAAe,CAE3E,CAAC;AACJ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AAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC;KACvC,CAAC;SACD,QAAQ,EAAE;CACd,CAAC,CAAC;AA4DH,MAAM,CAAC,MAAM,mBAAmB,GAA6B,CAAC;KAC3D,MAAM,CAAC,EAAE,UAAU,EAAE,eAAe,CAAC,QAAQ,EAAE,EAAE,CAAC;KAClD,MAAM,EAA8B,CAAC;AAExC;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,UAAU,CAAC;AAE/C,kBAAkB;AAElB;;;GAGG;AACH,MAAM,UAAU,cAAc,CAC5B,OAAgC,EAChC,IAAY;IAEZ,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC9B,IAAI,OAAO,GAAY,OAAO,CAAC;IAC/B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IACE,OAAO,KAAK,IAAI;YAChB,OAAO,KAAK,SAAS;YACrB,OAAO,OAAO,KAAK,QAAQ,EAC3B,CAAC;YACD,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,OAAO,GAAI,OAAmC,CAAC,IAAI,CAAC,CAAC;IACvD,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Marking a config field as one whose values the owning component can list.
|
|
3
|
+
*
|
|
4
|
+
* The mark rides on the Zod schema and is projected into the generated JSON
|
|
5
|
+
* Schema by `zod-to-json-schema`'s `postProcess` hook, which fires once per
|
|
6
|
+
* converted node. That is the entire mechanism. Because the converter already
|
|
7
|
+
* recurses, nesting, arrays, arrays-of-objects and union variants need no code
|
|
8
|
+
* here — and because nothing is addressed by name, there is no path to typo and
|
|
9
|
+
* no second traversal that could disagree with the first.
|
|
10
|
+
*/
|
|
11
|
+
import type { z } from 'zod';
|
|
12
|
+
import type { PostProcessCallback } from 'zod-to-json-schema';
|
|
13
|
+
/**
|
|
14
|
+
* Declare that this field's values are drawn from a set the component can
|
|
15
|
+
* enumerate — the difference between pasting a repository id and picking one.
|
|
16
|
+
*
|
|
17
|
+
* Wrap the innermost schema: `withOptions(z.string()).optional()`, not
|
|
18
|
+
* `withOptions(z.string().optional())`, so the mark lands on the node the
|
|
19
|
+
* converter actually emits for the field.
|
|
20
|
+
*
|
|
21
|
+
* A suggestion, not a constraint. Free text and `{{trigger.x}}` references stay
|
|
22
|
+
* legal, which is why this is not `z.enum` — it says where good values come
|
|
23
|
+
* from, not which values are allowed. The component answers with `getOptions`,
|
|
24
|
+
* and `ctx.field` tells it which field is asking.
|
|
25
|
+
*/
|
|
26
|
+
export declare function withOptions<T extends z.ZodTypeAny>(inner: T): T;
|
|
27
|
+
/** Whether {@link withOptions} marked the schema this def belongs to. */
|
|
28
|
+
export declare function isOptionMarked(def: object): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Projects the mark onto the generated JSON Schema as `hasOptions: true`.
|
|
31
|
+
*
|
|
32
|
+
* Passed to every conversion in `zodToJsonSchemaRecord`, so a component never
|
|
33
|
+
* has to know the editor's vocabulary, and `decorateConfigSchema` is left alone.
|
|
34
|
+
*/
|
|
35
|
+
export declare const markOptions: PostProcessCallback;
|
|
36
|
+
/**
|
|
37
|
+
* Whether any field in a converted schema offers choices.
|
|
38
|
+
*
|
|
39
|
+
* Asks the generated JSON Schema rather than the Zod tree, because that is what
|
|
40
|
+
* the editor reads: a mark that failed to survive conversion is not a picker,
|
|
41
|
+
* whatever the declaration said.
|
|
42
|
+
*/
|
|
43
|
+
export declare function schemaOffersOptions(node: unknown): boolean;
|
|
44
|
+
//# sourceMappingURL=option-mark.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"option-mark.d.ts","sourceRoot":"","sources":["../../src/util/option-mark.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAqB9D;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,CAAC,CAAC,UAAU,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAQ/D;AAED,yEAAyE;AACzE,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEnD;AAED;;;;;GAKG;AACH,eAAO,MAAM,WAAW,EAAE,mBAKzB,CAAC;AAiDF;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAM1D"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Marking a config field as one whose values the owning component can list.
|
|
3
|
+
*
|
|
4
|
+
* The mark rides on the Zod schema and is projected into the generated JSON
|
|
5
|
+
* Schema by `zod-to-json-schema`'s `postProcess` hook, which fires once per
|
|
6
|
+
* converted node. That is the entire mechanism. Because the converter already
|
|
7
|
+
* recurses, nesting, arrays, arrays-of-objects and union variants need no code
|
|
8
|
+
* here — and because nothing is addressed by name, there is no path to typo and
|
|
9
|
+
* no second traversal that could disagree with the first.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Anchored on `globalThis` rather than module scope.
|
|
13
|
+
*
|
|
14
|
+
* A config schema is DECLARED in a connector package and CONVERTED in this one.
|
|
15
|
+
* Were two copies of the SDK ever loaded, a module-local set would lose every
|
|
16
|
+
* mark and quietly render plain text boxes — the precise failure this feature
|
|
17
|
+
* exists to prevent.
|
|
18
|
+
*/
|
|
19
|
+
const MARK_KEY = Symbol.for('@xyne/workflow-sdk:option-marks');
|
|
20
|
+
const marks = (() => {
|
|
21
|
+
const g = globalThis;
|
|
22
|
+
const existing = g[MARK_KEY];
|
|
23
|
+
if (existing instanceof WeakSet)
|
|
24
|
+
return existing;
|
|
25
|
+
const created = new WeakSet();
|
|
26
|
+
g[MARK_KEY] = created;
|
|
27
|
+
return created;
|
|
28
|
+
})();
|
|
29
|
+
/**
|
|
30
|
+
* Declare that this field's values are drawn from a set the component can
|
|
31
|
+
* enumerate — the difference between pasting a repository id and picking one.
|
|
32
|
+
*
|
|
33
|
+
* Wrap the innermost schema: `withOptions(z.string()).optional()`, not
|
|
34
|
+
* `withOptions(z.string().optional())`, so the mark lands on the node the
|
|
35
|
+
* converter actually emits for the field.
|
|
36
|
+
*
|
|
37
|
+
* A suggestion, not a constraint. Free text and `{{trigger.x}}` references stay
|
|
38
|
+
* legal, which is why this is not `z.enum` — it says where good values come
|
|
39
|
+
* from, not which values are allowed. The component answers with `getOptions`,
|
|
40
|
+
* and `ctx.field` tells it which field is asking.
|
|
41
|
+
*/
|
|
42
|
+
export function withOptions(inner) {
|
|
43
|
+
// Cloned rather than marked in place: a schema held in a `const` and reused
|
|
44
|
+
// across several fields would otherwise light up every field it appears in.
|
|
45
|
+
const def = { ...inner._def };
|
|
46
|
+
const Ctor = inner.constructor;
|
|
47
|
+
const clone = new Ctor(def);
|
|
48
|
+
marks.add(def);
|
|
49
|
+
return clone;
|
|
50
|
+
}
|
|
51
|
+
/** Whether {@link withOptions} marked the schema this def belongs to. */
|
|
52
|
+
export function isOptionMarked(def) {
|
|
53
|
+
return marks.has(def);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Projects the mark onto the generated JSON Schema as `hasOptions: true`.
|
|
57
|
+
*
|
|
58
|
+
* Passed to every conversion in `zodToJsonSchemaRecord`, so a component never
|
|
59
|
+
* has to know the editor's vocabulary, and `decorateConfigSchema` is left alone.
|
|
60
|
+
*/
|
|
61
|
+
export const markOptions = (jsonSchema, def) => {
|
|
62
|
+
if (jsonSchema === undefined)
|
|
63
|
+
return jsonSchema;
|
|
64
|
+
const node = jsonSchema;
|
|
65
|
+
const found = marks.has(def) || variantMarked(node) || innerMarked(def);
|
|
66
|
+
return found ? { ...jsonSchema, hasOptions: true } : jsonSchema;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Whether a union variant carries the mark.
|
|
70
|
+
*
|
|
71
|
+
* `.nullable()` and {@link variableRef} emit the field as an `anyOf`, which puts
|
|
72
|
+
* the marked node one level below the property the editor reads. The field is
|
|
73
|
+
* still a picker, so the mark is lifted to where it will be seen. Only a
|
|
74
|
+
* variant's OWN mark lifts — an object variant holding a marked property does
|
|
75
|
+
* not make the object itself a picker.
|
|
76
|
+
*/
|
|
77
|
+
function variantMarked(node) {
|
|
78
|
+
for (const key of ['anyOf', 'oneOf']) {
|
|
79
|
+
const variants = node[key];
|
|
80
|
+
if (!Array.isArray(variants))
|
|
81
|
+
continue;
|
|
82
|
+
const any = variants.some((v) => typeof v === 'object' && v !== null && v['hasOptions'] === true);
|
|
83
|
+
if (any)
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Whether a modifier is wrapping a marked schema.
|
|
90
|
+
*
|
|
91
|
+
* `.optional()`, `.nullable()` and `.default()` each decide for themselves which
|
|
92
|
+
* node reaches the output: optional emits the INNER type's node and records the
|
|
93
|
+
* name in `required`, while a nullable primitive collapses to
|
|
94
|
+
* `type: ['string','null']` emitted from the OUTER def. So neither "wrap
|
|
95
|
+
* innermost" nor "wrap outermost" is universally right, and an author should not
|
|
96
|
+
* have to know which is which — the mark is looked for in both directions
|
|
97
|
+
* instead.
|
|
98
|
+
*
|
|
99
|
+
* Bounded at three wrappers: `.optional().nullable().default(x)` is already more
|
|
100
|
+
* than a config field should need, and an unbounded walk over internals is a
|
|
101
|
+
* cost paid on every conversion.
|
|
102
|
+
*/
|
|
103
|
+
function innerMarked(def) {
|
|
104
|
+
let current = def;
|
|
105
|
+
for (let depth = 0; depth < 3; depth += 1) {
|
|
106
|
+
const inner = current.innerType?._def;
|
|
107
|
+
if (typeof inner !== 'object' || inner === null)
|
|
108
|
+
return false;
|
|
109
|
+
if (marks.has(inner))
|
|
110
|
+
return true;
|
|
111
|
+
current = inner;
|
|
112
|
+
}
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Whether any field in a converted schema offers choices.
|
|
117
|
+
*
|
|
118
|
+
* Asks the generated JSON Schema rather than the Zod tree, because that is what
|
|
119
|
+
* the editor reads: a mark that failed to survive conversion is not a picker,
|
|
120
|
+
* whatever the declaration said.
|
|
121
|
+
*/
|
|
122
|
+
export function schemaOffersOptions(node) {
|
|
123
|
+
if (Array.isArray(node))
|
|
124
|
+
return node.some(schemaOffersOptions);
|
|
125
|
+
if (typeof node !== 'object' || node === null)
|
|
126
|
+
return false;
|
|
127
|
+
const record = node;
|
|
128
|
+
if (record['hasOptions'] === true)
|
|
129
|
+
return true;
|
|
130
|
+
return Object.values(record).some(schemaOffersOptions);
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=option-mark.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"option-mark.js","sourceRoot":"","sources":["../../src/util/option-mark.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH;;;;;;;GAOG;AACH,MAAM,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;AAE/D,MAAM,KAAK,GAAoB,CAAC,GAAoB,EAAE;IACpD,MAAM,CAAC,GAAG,UAAgD,CAAC;IAC3D,MAAM,QAAQ,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC;IAC7B,IAAI,QAAQ,YAAY,OAAO;QAAE,OAAO,QAA2B,CAAC;IACpE,MAAM,OAAO,GAAG,IAAI,OAAO,EAAU,CAAC;IACtC,CAAC,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC;IACtB,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC,EAAE,CAAC;AAEL;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,WAAW,CAAyB,KAAQ;IAC1D,4EAA4E;IAC5E,4EAA4E;IAC5E,MAAM,GAA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,IAAI,GAAG;YAAE,OAAO,IAAI,CAAC;IACvB,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,SAAS,WAAW,CAAC,GAAW;IAC9B,IAAI,OAAO,GAAW,GAAG,CAAC;IAC1B,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QAC1C,MAAM,KAAK,GAAI,OAA8C,CAAC,SAAS,EAAE,IAAI,CAAC;QAC9E,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;YAAE,OAAO,KAAK,CAAC;QAC9D,IAAI,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC;QAClC,OAAO,GAAG,KAAK,CAAC;IAClB,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAa;IAC/C,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;IAC/D,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAC5D,MAAM,MAAM,GAAG,IAA+B,CAAC;IAC/C,IAAI,MAAM,CAAC,YAAY,CAAC,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAC/C,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;AACzD,CAAC"}
|
|
@@ -9,6 +9,11 @@ import type { z } from 'zod';
|
|
|
9
9
|
*
|
|
10
10
|
* Returns `Record<string, unknown>` so callers don't need to
|
|
11
11
|
* depend on the `zod-to-json-schema` package directly.
|
|
12
|
+
*
|
|
13
|
+
* Every conversion carries {@link applyMarks}, so a field declared with
|
|
14
|
+
* `withOptions` or `variableRef` arrives marked wherever it sits — the
|
|
15
|
+
* converter's own recursion does the walking, and nothing here has to know the
|
|
16
|
+
* shape of the schema.
|
|
12
17
|
*/
|
|
13
18
|
export declare function zodToJsonSchemaRecord(schema: z.ZodTypeAny): Record<string, unknown>;
|
|
14
19
|
//# sourceMappingURL=schema-convert.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-convert.d.ts","sourceRoot":"","sources":["../../src/util/schema-convert.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"schema-convert.d.ts","sourceRoot":"","sources":["../../src/util/schema-convert.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAG7B;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,CAAC,CAAC,UAAU,GACnB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEzB"}
|
|
@@ -4,13 +4,19 @@
|
|
|
4
4
|
* Centralised so the conversion options stay consistent across the SDK.
|
|
5
5
|
*/
|
|
6
6
|
import { zodToJsonSchema } from 'zod-to-json-schema';
|
|
7
|
+
import { applyMarks } from './schema-marks.js';
|
|
7
8
|
/**
|
|
8
9
|
* Convert a Zod schema to a plain JSON Schema object.
|
|
9
10
|
*
|
|
10
11
|
* Returns `Record<string, unknown>` so callers don't need to
|
|
11
12
|
* depend on the `zod-to-json-schema` package directly.
|
|
13
|
+
*
|
|
14
|
+
* Every conversion carries {@link applyMarks}, so a field declared with
|
|
15
|
+
* `withOptions` or `variableRef` arrives marked wherever it sits — the
|
|
16
|
+
* converter's own recursion does the walking, and nothing here has to know the
|
|
17
|
+
* shape of the schema.
|
|
12
18
|
*/
|
|
13
19
|
export function zodToJsonSchemaRecord(schema) {
|
|
14
|
-
return zodToJsonSchema(schema);
|
|
20
|
+
return zodToJsonSchema(schema, { postProcess: applyMarks });
|
|
15
21
|
}
|
|
16
22
|
//# sourceMappingURL=schema-convert.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-convert.js","sourceRoot":"","sources":["../../src/util/schema-convert.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"schema-convert.js","sourceRoot":"","sources":["../../src/util/schema-convert.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C;;;;;;;;;;GAUG;AACH,MAAM,UAAU,qBAAqB,CACnC,MAAoB;IAEpB,OAAO,eAAe,CAAC,MAAM,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE,CAA4B,CAAC;AACzF,CAAC"}
|