@xyne/workflow-sdk 1.0.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/README.md +36 -0
- package/dist/agents/agent-step.d.ts +152 -0
- package/dist/agents/agent-step.d.ts.map +1 -0
- package/dist/agents/agent-step.js +403 -0
- package/dist/agents/agent-step.js.map +1 -0
- package/dist/agents/base-runtime.d.ts +38 -0
- package/dist/agents/base-runtime.d.ts.map +1 -0
- package/dist/agents/base-runtime.js +21 -0
- package/dist/agents/base-runtime.js.map +1 -0
- package/dist/agents/index.d.ts +12 -0
- package/dist/agents/index.d.ts.map +1 -0
- package/dist/agents/index.js +17 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/agents/interceptor.d.ts +19 -0
- package/dist/agents/interceptor.d.ts.map +1 -0
- package/dist/agents/interceptor.js +21 -0
- package/dist/agents/interceptor.js.map +1 -0
- package/dist/agents/interceptors/approval-gate.d.ts +14 -0
- package/dist/agents/interceptors/approval-gate.d.ts.map +1 -0
- package/dist/agents/interceptors/approval-gate.js +19 -0
- package/dist/agents/interceptors/approval-gate.js.map +1 -0
- package/dist/agents/interceptors/tool-logger.d.ts +15 -0
- package/dist/agents/interceptors/tool-logger.d.ts.map +1 -0
- package/dist/agents/interceptors/tool-logger.js +23 -0
- package/dist/agents/interceptors/tool-logger.js.map +1 -0
- package/dist/agents/pi-mono-runtime.d.ts +88 -0
- package/dist/agents/pi-mono-runtime.d.ts.map +1 -0
- package/dist/agents/pi-mono-runtime.js +129 -0
- package/dist/agents/pi-mono-runtime.js.map +1 -0
- package/dist/agents/tool-registry.d.ts +25 -0
- package/dist/agents/tool-registry.d.ts.map +1 -0
- package/dist/agents/tool-registry.js +47 -0
- package/dist/agents/tool-registry.js.map +1 -0
- package/dist/agents/tool-types.d.ts +25 -0
- package/dist/agents/tool-types.d.ts.map +1 -0
- package/dist/agents/tool-types.js +9 -0
- package/dist/agents/tool-types.js.map +1 -0
- package/dist/agents/types.d.ts +91 -0
- package/dist/agents/types.d.ts.map +1 -0
- package/dist/agents/types.js +12 -0
- package/dist/agents/types.js.map +1 -0
- package/dist/builder/index.d.ts +30 -0
- package/dist/builder/index.d.ts.map +1 -0
- package/dist/builder/index.js +32 -0
- package/dist/builder/index.js.map +1 -0
- package/dist/client/index.d.ts +19 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +18 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/types.d.ts +128 -0
- package/dist/client/types.d.ts.map +1 -0
- package/dist/client/types.js +10 -0
- package/dist/client/types.js.map +1 -0
- package/dist/client/workflow-client.d.ts +15 -0
- package/dist/client/workflow-client.d.ts.map +1 -0
- package/dist/client/workflow-client.js +293 -0
- package/dist/client/workflow-client.js.map +1 -0
- package/dist/common/attachment.d.ts +31 -0
- package/dist/common/attachment.d.ts.map +1 -0
- package/dist/common/attachment.js +21 -0
- package/dist/common/attachment.js.map +1 -0
- package/dist/common/executable-check.d.ts +42 -0
- package/dist/common/executable-check.d.ts.map +1 -0
- package/dist/common/executable-check.js +115 -0
- package/dist/common/executable-check.js.map +1 -0
- package/dist/common/index.d.ts +21 -0
- package/dist/common/index.d.ts.map +1 -0
- package/dist/common/index.js +19 -0
- package/dist/common/index.js.map +1 -0
- package/dist/common/resume-payload.d.ts +34 -0
- package/dist/common/resume-payload.d.ts.map +1 -0
- package/dist/common/resume-payload.js +12 -0
- package/dist/common/resume-payload.js.map +1 -0
- package/dist/engine/available-context.d.ts +29 -0
- package/dist/engine/available-context.d.ts.map +1 -0
- package/dist/engine/available-context.js +66 -0
- package/dist/engine/available-context.js.map +1 -0
- package/dist/engine/condition-evaluator.d.ts +13 -0
- package/dist/engine/condition-evaluator.d.ts.map +1 -0
- package/dist/engine/condition-evaluator.js +92 -0
- package/dist/engine/condition-evaluator.js.map +1 -0
- package/dist/engine/config-validator.d.ts +25 -0
- package/dist/engine/config-validator.d.ts.map +1 -0
- package/dist/engine/config-validator.js +316 -0
- package/dist/engine/config-validator.js.map +1 -0
- package/dist/engine/pause-step.d.ts +20 -0
- package/dist/engine/pause-step.d.ts.map +1 -0
- package/dist/engine/pause-step.js +24 -0
- package/dist/engine/pause-step.js.map +1 -0
- package/dist/engine/service-registry.d.ts +49 -0
- package/dist/engine/service-registry.d.ts.map +1 -0
- package/dist/engine/service-registry.js +76 -0
- package/dist/engine/service-registry.js.map +1 -0
- package/dist/engine/variable-resolver.d.ts +29 -0
- package/dist/engine/variable-resolver.d.ts.map +1 -0
- package/dist/engine/variable-resolver.js +130 -0
- package/dist/engine/variable-resolver.js.map +1 -0
- package/dist/engine/workflow-executor.d.ts +96 -0
- package/dist/engine/workflow-executor.d.ts.map +1 -0
- package/dist/engine/workflow-executor.js +837 -0
- package/dist/engine/workflow-executor.js.map +1 -0
- package/dist/index.d.ts +57 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +56 -0
- package/dist/index.js.map +1 -0
- package/dist/persistence/in-memory-adapter.d.ts +138 -0
- package/dist/persistence/in-memory-adapter.d.ts.map +1 -0
- package/dist/persistence/in-memory-adapter.js +315 -0
- package/dist/persistence/in-memory-adapter.js.map +1 -0
- package/dist/persistence/types.d.ts +214 -0
- package/dist/persistence/types.d.ts.map +1 -0
- package/dist/persistence/types.js +8 -0
- package/dist/persistence/types.js.map +1 -0
- package/dist/router/types.d.ts +57 -0
- package/dist/router/types.d.ts.map +1 -0
- package/dist/router/types.js +8 -0
- package/dist/router/types.js.map +1 -0
- package/dist/router/workflow-router.d.ts +26 -0
- package/dist/router/workflow-router.d.ts.map +1 -0
- package/dist/router/workflow-router.js +611 -0
- package/dist/router/workflow-router.js.map +1 -0
- package/dist/runtime/execution-event-bus.d.ts +38 -0
- package/dist/runtime/execution-event-bus.d.ts.map +1 -0
- package/dist/runtime/execution-event-bus.js +87 -0
- package/dist/runtime/execution-event-bus.js.map +1 -0
- package/dist/runtime/types.d.ts +129 -0
- package/dist/runtime/types.d.ts.map +1 -0
- package/dist/runtime/types.js +5 -0
- package/dist/runtime/types.js.map +1 -0
- package/dist/runtime/workflow-runtime.d.ts +256 -0
- package/dist/runtime/workflow-runtime.d.ts.map +1 -0
- package/dist/runtime/workflow-runtime.js +699 -0
- package/dist/runtime/workflow-runtime.js.map +1 -0
- package/dist/steps/base-step.d.ts +204 -0
- package/dist/steps/base-step.d.ts.map +1 -0
- package/dist/steps/base-step.js +69 -0
- package/dist/steps/base-step.js.map +1 -0
- package/dist/steps/builtin/code.step.d.ts +95 -0
- package/dist/steps/builtin/code.step.d.ts.map +1 -0
- package/dist/steps/builtin/code.step.js +122 -0
- package/dist/steps/builtin/code.step.js.map +1 -0
- package/dist/steps/builtin/conditional.step.d.ts +146 -0
- package/dist/steps/builtin/conditional.step.d.ts.map +1 -0
- package/dist/steps/builtin/conditional.step.js +71 -0
- package/dist/steps/builtin/conditional.step.js.map +1 -0
- package/dist/steps/builtin/dedup.step.d.ts +65 -0
- package/dist/steps/builtin/dedup.step.d.ts.map +1 -0
- package/dist/steps/builtin/dedup.step.js +61 -0
- package/dist/steps/builtin/dedup.step.js.map +1 -0
- package/dist/steps/builtin/http-request.step.d.ts +928 -0
- package/dist/steps/builtin/http-request.step.d.ts.map +1 -0
- package/dist/steps/builtin/http-request.step.js +570 -0
- package/dist/steps/builtin/http-request.step.js.map +1 -0
- package/dist/steps/builtin/loop.step.d.ts +100 -0
- package/dist/steps/builtin/loop.step.d.ts.map +1 -0
- package/dist/steps/builtin/loop.step.js +79 -0
- package/dist/steps/builtin/loop.step.js.map +1 -0
- package/dist/steps/builtin/parallel.step.d.ts +208 -0
- package/dist/steps/builtin/parallel.step.d.ts.map +1 -0
- package/dist/steps/builtin/parallel.step.js +249 -0
- package/dist/steps/builtin/parallel.step.js.map +1 -0
- package/dist/steps/builtin/switch.step.d.ts +200 -0
- package/dist/steps/builtin/switch.step.d.ts.map +1 -0
- package/dist/steps/builtin/switch.step.js +92 -0
- package/dist/steps/builtin/switch.step.js.map +1 -0
- package/dist/steps/builtin/transform.step.d.ts +247 -0
- package/dist/steps/builtin/transform.step.d.ts.map +1 -0
- package/dist/steps/builtin/transform.step.js +135 -0
- package/dist/steps/builtin/transform.step.js.map +1 -0
- package/dist/steps/builtin/wait.step.d.ts +921 -0
- package/dist/steps/builtin/wait.step.d.ts.map +1 -0
- package/dist/steps/builtin/wait.step.js +211 -0
- package/dist/steps/builtin/wait.step.js.map +1 -0
- package/dist/steps/step-registry.d.ts +64 -0
- package/dist/steps/step-registry.d.ts.map +1 -0
- package/dist/steps/step-registry.js +102 -0
- package/dist/steps/step-registry.js.map +1 -0
- package/dist/storage/in-memory-adapter.d.ts +25 -0
- package/dist/storage/in-memory-adapter.d.ts.map +1 -0
- package/dist/storage/in-memory-adapter.js +41 -0
- package/dist/storage/in-memory-adapter.js.map +1 -0
- package/dist/storage/types.d.ts +53 -0
- package/dist/storage/types.d.ts.map +1 -0
- package/dist/storage/types.js +13 -0
- package/dist/storage/types.js.map +1 -0
- package/dist/testing/index.d.ts +10 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +10 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/mock-context.d.ts +13 -0
- package/dist/testing/mock-context.d.ts.map +1 -0
- package/dist/testing/mock-context.js +21 -0
- package/dist/testing/mock-context.js.map +1 -0
- package/dist/testing/mock-step-context.d.ts +47 -0
- package/dist/testing/mock-step-context.d.ts.map +1 -0
- package/dist/testing/mock-step-context.js +59 -0
- package/dist/testing/mock-step-context.js.map +1 -0
- package/dist/triggers/base-trigger.d.ts +58 -0
- package/dist/triggers/base-trigger.d.ts.map +1 -0
- package/dist/triggers/base-trigger.js +37 -0
- package/dist/triggers/base-trigger.js.map +1 -0
- package/dist/triggers/builtin/default-cron-trigger.d.ts +44 -0
- package/dist/triggers/builtin/default-cron-trigger.d.ts.map +1 -0
- package/dist/triggers/builtin/default-cron-trigger.js +31 -0
- package/dist/triggers/builtin/default-cron-trigger.js.map +1 -0
- package/dist/triggers/builtin/default-event-trigger.d.ts +32 -0
- package/dist/triggers/builtin/default-event-trigger.d.ts.map +1 -0
- package/dist/triggers/builtin/default-event-trigger.js +21 -0
- package/dist/triggers/builtin/default-event-trigger.js.map +1 -0
- package/dist/triggers/builtin/default-manual-trigger.d.ts +119 -0
- package/dist/triggers/builtin/default-manual-trigger.d.ts.map +1 -0
- package/dist/triggers/builtin/default-manual-trigger.js +64 -0
- package/dist/triggers/builtin/default-manual-trigger.js.map +1 -0
- package/dist/triggers/builtin/default-webhook-trigger.d.ts +72 -0
- package/dist/triggers/builtin/default-webhook-trigger.d.ts.map +1 -0
- package/dist/triggers/builtin/default-webhook-trigger.js +91 -0
- package/dist/triggers/builtin/default-webhook-trigger.js.map +1 -0
- package/dist/triggers/cron-trigger.d.ts +52 -0
- package/dist/triggers/cron-trigger.d.ts.map +1 -0
- package/dist/triggers/cron-trigger.js +15 -0
- package/dist/triggers/cron-trigger.js.map +1 -0
- package/dist/triggers/event-trigger.d.ts +14 -0
- package/dist/triggers/event-trigger.d.ts.map +1 -0
- package/dist/triggers/event-trigger.js +13 -0
- package/dist/triggers/event-trigger.js.map +1 -0
- package/dist/triggers/manual-trigger.d.ts +11 -0
- package/dist/triggers/manual-trigger.d.ts.map +1 -0
- package/dist/triggers/manual-trigger.js +10 -0
- package/dist/triggers/manual-trigger.js.map +1 -0
- package/dist/triggers/trigger-registry.d.ts +48 -0
- package/dist/triggers/trigger-registry.d.ts.map +1 -0
- package/dist/triggers/trigger-registry.js +81 -0
- package/dist/triggers/trigger-registry.js.map +1 -0
- package/dist/triggers/webhook-trigger.d.ts +54 -0
- package/dist/triggers/webhook-trigger.d.ts.map +1 -0
- package/dist/triggers/webhook-trigger.js +13 -0
- package/dist/triggers/webhook-trigger.js.map +1 -0
- package/dist/types/attachment.d.ts +23 -0
- package/dist/types/attachment.d.ts.map +1 -0
- package/dist/types/attachment.js +2 -0
- package/dist/types/attachment.js.map +1 -0
- package/dist/types/categories.d.ts +14 -0
- package/dist/types/categories.d.ts.map +1 -0
- package/dist/types/categories.js +10 -0
- package/dist/types/categories.js.map +1 -0
- package/dist/types/context.d.ts +61 -0
- package/dist/types/context.d.ts.map +1 -0
- package/dist/types/context.js +2 -0
- package/dist/types/context.js.map +1 -0
- package/dist/types/index.d.ts +18 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +12 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/known-types.d.ts +34 -0
- package/dist/types/known-types.d.ts.map +1 -0
- package/dist/types/known-types.js +49 -0
- package/dist/types/known-types.js.map +1 -0
- package/dist/types/operators.d.ts +20 -0
- package/dist/types/operators.d.ts.map +1 -0
- package/dist/types/operators.js +27 -0
- package/dist/types/operators.js.map +1 -0
- package/dist/types/pause-path.d.ts +23 -0
- package/dist/types/pause-path.d.ts.map +1 -0
- package/dist/types/pause-path.js +2 -0
- package/dist/types/pause-path.js.map +1 -0
- package/dist/types/pause-state.d.ts +100 -0
- package/dist/types/pause-state.d.ts.map +1 -0
- package/dist/types/pause-state.js +15 -0
- package/dist/types/pause-state.js.map +1 -0
- package/dist/types/resume-payload.d.ts +34 -0
- package/dist/types/resume-payload.d.ts.map +1 -0
- package/dist/types/resume-payload.js +12 -0
- package/dist/types/resume-payload.js.map +1 -0
- package/dist/types/status.d.ts +27 -0
- package/dist/types/status.d.ts.map +1 -0
- package/dist/types/status.js +41 -0
- package/dist/types/status.js.map +1 -0
- package/dist/types/step-events.d.ts +22 -0
- package/dist/types/step-events.d.ts.map +1 -0
- package/dist/types/step-events.js +8 -0
- package/dist/types/step-events.js.map +1 -0
- package/dist/types/step-types.d.ts +12 -0
- package/dist/types/step-types.d.ts.map +1 -0
- package/dist/types/step-types.js +2 -0
- package/dist/types/step-types.js.map +1 -0
- package/dist/types/trigger-types.d.ts +12 -0
- package/dist/types/trigger-types.d.ts.map +1 -0
- package/dist/types/trigger-types.js +2 -0
- package/dist/types/trigger-types.js.map +1 -0
- package/dist/types/validation.d.ts +19 -0
- package/dist/types/validation.d.ts.map +1 -0
- package/dist/types/validation.js +11 -0
- package/dist/types/validation.js.map +1 -0
- package/dist/types/workflow-config.d.ts +122 -0
- package/dist/types/workflow-config.d.ts.map +1 -0
- package/dist/types/workflow-config.js +71 -0
- package/dist/types/workflow-config.js.map +1 -0
- package/dist/util/executable-check.d.ts +42 -0
- package/dist/util/executable-check.d.ts.map +1 -0
- package/dist/util/executable-check.js +115 -0
- package/dist/util/executable-check.js.map +1 -0
- package/dist/util/schema-convert.d.ts +14 -0
- package/dist/util/schema-convert.d.ts.map +1 -0
- package/dist/util/schema-convert.js +16 -0
- package/dist/util/schema-convert.js.map +1 -0
- package/dist/util/variable-ref.d.ts +52 -0
- package/dist/util/variable-ref.d.ts.map +1 -0
- package/dist/util/variable-ref.js +89 -0
- package/dist/util/variable-ref.js.map +1 -0
- package/package.json +97 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { WebhookTrigger } from '../webhook-trigger.js';
|
|
3
|
+
import { BuiltinTriggerType } from '../../types/known-types.js';
|
|
4
|
+
import { TriggerCategory } from '../../types/categories.js';
|
|
5
|
+
const DefaultWebhookTriggerConfigSchema = z.object({
|
|
6
|
+
secret: z.string().optional()
|
|
7
|
+
.describe('Shared secret for validating incoming webhook requests'),
|
|
8
|
+
headersSchema: z.record(z.unknown()).optional()
|
|
9
|
+
.describe('JSON Schema describing the expected headers. Drives the variable picker for downstream steps; runtime parsing is unchanged.'),
|
|
10
|
+
bodySchema: z.record(z.unknown()).optional()
|
|
11
|
+
.describe('JSON Schema describing the expected body. Drives the variable picker for downstream steps; runtime parsing is unchanged.'),
|
|
12
|
+
});
|
|
13
|
+
/**
|
|
14
|
+
* Default webhook trigger — accepts an incoming POST request and emits the
|
|
15
|
+
* body + headers as trigger data.
|
|
16
|
+
*
|
|
17
|
+
* Method is always POST (the router is POST-only for webhooks); query
|
|
18
|
+
* parameters are intentionally dropped — webhook payloads belong in the
|
|
19
|
+
* body, not in the query string. If you need a vendor that uses query
|
|
20
|
+
* params, subclass {@link WebhookTrigger} for that integration.
|
|
21
|
+
*
|
|
22
|
+
* Authors can optionally describe the expected shape of the incoming
|
|
23
|
+
* `headers` and `body` via JSON Schema fields in the config. These schemas
|
|
24
|
+
* type the variable picker for downstream steps — runtime parsing is
|
|
25
|
+
* unchanged (no rejection on mismatch).
|
|
26
|
+
*/
|
|
27
|
+
export class DefaultWebhookTrigger extends WebhookTrigger {
|
|
28
|
+
type = BuiltinTriggerType.WEBHOOK;
|
|
29
|
+
name = 'Webhook Trigger';
|
|
30
|
+
description = 'Trigger a workflow via an incoming HTTP POST request';
|
|
31
|
+
category = TriggerCategory.WEBHOOK;
|
|
32
|
+
icon = 'satellite';
|
|
33
|
+
configSchema = DefaultWebhookTriggerConfigSchema;
|
|
34
|
+
outputSchema = z.object({
|
|
35
|
+
headers: z.record(z.unknown()),
|
|
36
|
+
body: z.unknown(),
|
|
37
|
+
});
|
|
38
|
+
decorateConfigSchema(jsonSchema) {
|
|
39
|
+
// Reuse the JSON Schema builder UI for each typeable slot.
|
|
40
|
+
const props = jsonSchema['properties'];
|
|
41
|
+
for (const field of ['headersSchema', 'bodySchema']) {
|
|
42
|
+
if (props?.[field]) {
|
|
43
|
+
props[field] = { ...props[field], format: 'json-schema' };
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return jsonSchema;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Per-instance output schema. Plugs each user-supplied JSON Schema into
|
|
50
|
+
* the corresponding standard field; defaults to permissive shapes when
|
|
51
|
+
* the author hasn't typed it.
|
|
52
|
+
*/
|
|
53
|
+
resolveOutputJsonSchema(config) {
|
|
54
|
+
const headersSchema = nonEmptySchema(config['headersSchema']);
|
|
55
|
+
const bodySchema = nonEmptySchema(config['bodySchema']);
|
|
56
|
+
return {
|
|
57
|
+
type: 'object',
|
|
58
|
+
properties: {
|
|
59
|
+
// HTTP header values are always strings — that's the only generic
|
|
60
|
+
// default that makes navigation sane.
|
|
61
|
+
headers: headersSchema ?? {
|
|
62
|
+
type: 'object',
|
|
63
|
+
additionalProperties: { type: 'string' },
|
|
64
|
+
},
|
|
65
|
+
body: bodySchema ?? { type: 'object' },
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
async handleRequest(request, _config) {
|
|
70
|
+
return {
|
|
71
|
+
triggerData: {
|
|
72
|
+
headers: request.headers,
|
|
73
|
+
body: request.body,
|
|
74
|
+
},
|
|
75
|
+
httpResponse: {
|
|
76
|
+
status: 200,
|
|
77
|
+
body: { ok: true },
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/** Return the schema only when it's a meaningful object — `{}` or undefined → no schema. */
|
|
83
|
+
function nonEmptySchema(raw) {
|
|
84
|
+
if (!raw || typeof raw !== 'object' || Array.isArray(raw))
|
|
85
|
+
return undefined;
|
|
86
|
+
const obj = raw;
|
|
87
|
+
if (Object.keys(obj).length === 0)
|
|
88
|
+
return undefined;
|
|
89
|
+
return obj;
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=default-webhook-trigger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-webhook-trigger.js","sourceRoot":"","sources":["../../../src/triggers/builtin/default-webhook-trigger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE5D,MAAM,iCAAiC,GAAG,CAAC,CAAC,MAAM,CAAC;IACjD,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;SAC1B,QAAQ,CAAC,wDAAwD,CAAC;IACrE,aAAa,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC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AAC,YAAY,CAAC,CAAC,CAAC;QAExD,OAAO;YACL,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,kEAAkE;gBAClE,sCAAsC;gBACtC,OAAO,EAAE,aAAa,IAAI;oBACxB,IAAI,EAAE,QAAQ;oBACd,oBAAoB,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;iBACzC;gBACD,IAAI,EAAE,UAAU,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE;aACvC;SACF,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,aAAa,CACjB,OAAuB,EACvB,OAA0D;QAE1D,OAAO;YACL,WAAW,EAAE;gBACX,OAAO,EAAE,OAAO,CAAC,OAAO;gBACxB,IAAI,EAAE,OAAO,CAAC,IAAI;aACnB;YACD,YAAY,EAAE;gBACZ,MAAM,EAAE,GAAG;gBACX,IAAI,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE;aACnB;SACF,CAAC;IACJ,CAAC;CACF;AAED,4FAA4F;AAC5F,SAAS,cAAc,CAAC,GAAY;IAClC,IAAI,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;QAAE,OAAO,SAAS,CAAC;IAC5E,MAAM,GAAG,GAAG,GAA8B,CAAC;IAC3C,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IACpD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import { BaseTrigger } from './base-trigger.js';
|
|
3
|
+
import type { ServiceRegistry } from '../engine/service-registry.js';
|
|
4
|
+
/**
|
|
5
|
+
* Cron schedule returned by a CronTrigger.
|
|
6
|
+
*
|
|
7
|
+
* Timezone is intentionally not exposed at the trigger level — the runtime
|
|
8
|
+
* applies its `defaultCronTimezone` (configured via RuntimeOptions, defaults
|
|
9
|
+
* to `Asia/Kolkata`) when registering with the SchedulerAdapter. This keeps
|
|
10
|
+
* workflow authors out of the timezone-config business; hosts pick the
|
|
11
|
+
* scheduling policy once at deployment time.
|
|
12
|
+
*/
|
|
13
|
+
export interface CronSchedule {
|
|
14
|
+
expression: string;
|
|
15
|
+
}
|
|
16
|
+
export interface CronPollContext<TServices extends Record<string, unknown> = Record<string, unknown>> {
|
|
17
|
+
services: ServiceRegistry<TServices>;
|
|
18
|
+
staticData: {
|
|
19
|
+
get(key: string): Promise<unknown>;
|
|
20
|
+
set(key: string, value: unknown): Promise<void>;
|
|
21
|
+
delete(key: string): Promise<void>;
|
|
22
|
+
};
|
|
23
|
+
metadata: Record<string, unknown>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Scheduled trigger — fires on a cron schedule.
|
|
27
|
+
*
|
|
28
|
+
* On activation, the runtime registers a cron job via the SchedulerAdapter.
|
|
29
|
+
* Each tick calls `poll()` (if defined) to check whether to fire. If `poll()`
|
|
30
|
+
* is not defined, every tick fires the workflow.
|
|
31
|
+
*
|
|
32
|
+
* `poll()` is useful for "check every 5 minutes for new items" patterns.
|
|
33
|
+
* Use `staticData` to track high-water marks across ticks.
|
|
34
|
+
*/
|
|
35
|
+
export declare abstract class CronTrigger<TConfig extends z.ZodTypeAny = z.ZodTypeAny> extends BaseTrigger<TConfig> {
|
|
36
|
+
/**
|
|
37
|
+
* Extract the cron schedule from the trigger config.
|
|
38
|
+
*/
|
|
39
|
+
abstract getSchedule(config: z.infer<TConfig>): CronSchedule;
|
|
40
|
+
/**
|
|
41
|
+
* Optional poll function called on each cron tick.
|
|
42
|
+
* Return data to fire the workflow, or `null` to skip this tick.
|
|
43
|
+
*/
|
|
44
|
+
poll?(config: z.infer<TConfig>, ctx: CronPollContext): Promise<Record<string, unknown> | null>;
|
|
45
|
+
/**
|
|
46
|
+
* Build a default trigger payload when `poll()` is not defined.
|
|
47
|
+
* Override to customize what the workflow receives.
|
|
48
|
+
* Default: `{ firedAt: <ISO string> }`.
|
|
49
|
+
*/
|
|
50
|
+
buildPayload?(config: z.infer<TConfig>): Record<string, unknown>;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=cron-trigger.d.ts.map
|
|
@@ -0,0 +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;IAC5B;;OAEG;IACH,QAAQ,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,YAAY;IAE5D;;;OAGG;IACH,IAAI,CAAC,CACH,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,EACxB,GAAG,EAAE,eAAe,GACnB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAE1C;;;;OAIG;IACH,YAAY,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CACjE"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BaseTrigger } from './base-trigger.js';
|
|
2
|
+
// ─── CronTrigger ───
|
|
3
|
+
/**
|
|
4
|
+
* Scheduled trigger — fires on a cron schedule.
|
|
5
|
+
*
|
|
6
|
+
* On activation, the runtime registers a cron job via the SchedulerAdapter.
|
|
7
|
+
* Each tick calls `poll()` (if defined) to check whether to fire. If `poll()`
|
|
8
|
+
* is not defined, every tick fires the workflow.
|
|
9
|
+
*
|
|
10
|
+
* `poll()` is useful for "check every 5 minutes for new items" patterns.
|
|
11
|
+
* Use `staticData` to track high-water marks across ticks.
|
|
12
|
+
*/
|
|
13
|
+
export class CronTrigger extends BaseTrigger {
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=cron-trigger.js.map
|
|
@@ -0,0 +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,WAEpB,SAAQ,WAAoB;CAqB7B"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import { BaseTrigger } from './base-trigger.js';
|
|
3
|
+
/**
|
|
4
|
+
* Passive trigger — fires when the host calls `runtime.dispatchEvent()`.
|
|
5
|
+
*
|
|
6
|
+
* The runtime looks up all active workflows whose trigger type matches the
|
|
7
|
+
* event type, runs `hydratePayload()` + `matchFilters()`, and enqueues
|
|
8
|
+
* executions for the ones that match.
|
|
9
|
+
*
|
|
10
|
+
* Hosts extend this for domain events (e.g. TicketCreatedTrigger).
|
|
11
|
+
*/
|
|
12
|
+
export declare abstract class EventTrigger<TConfig extends z.ZodTypeAny = z.ZodTypeAny> extends BaseTrigger<TConfig> {
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=event-trigger.d.ts.map
|
|
@@ -0,0 +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,CAC3C,SAAQ,WAAW,CAAC,OAAO,CAAC;CAAG"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BaseTrigger } from './base-trigger.js';
|
|
2
|
+
/**
|
|
3
|
+
* Passive trigger — fires when the host calls `runtime.dispatchEvent()`.
|
|
4
|
+
*
|
|
5
|
+
* The runtime looks up all active workflows whose trigger type matches the
|
|
6
|
+
* event type, runs `hydratePayload()` + `matchFilters()`, and enqueues
|
|
7
|
+
* executions for the ones that match.
|
|
8
|
+
*
|
|
9
|
+
* Hosts extend this for domain events (e.g. TicketCreatedTrigger).
|
|
10
|
+
*/
|
|
11
|
+
export class EventTrigger extends BaseTrigger {
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=event-trigger.js.map
|
|
@@ -0,0 +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,YAEpB,SAAQ,WAAoB;CAAG"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import { BaseTrigger } from './base-trigger.js';
|
|
3
|
+
/**
|
|
4
|
+
* Manual trigger — fires only via `runtime.triggerManual()`.
|
|
5
|
+
*
|
|
6
|
+
* Used for test runs and user-initiated workflow executions.
|
|
7
|
+
* The payload is whatever the caller passes.
|
|
8
|
+
*/
|
|
9
|
+
export declare abstract class ManualTrigger<TConfig extends z.ZodTypeAny = z.ZodTypeAny> extends BaseTrigger<TConfig> {
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=manual-trigger.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BaseTrigger } from './base-trigger.js';
|
|
2
|
+
/**
|
|
3
|
+
* Manual trigger — fires only via `runtime.triggerManual()`.
|
|
4
|
+
*
|
|
5
|
+
* Used for test runs and user-initiated workflow executions.
|
|
6
|
+
* The payload is whatever the caller passes.
|
|
7
|
+
*/
|
|
8
|
+
export class ManualTrigger extends BaseTrigger {
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=manual-trigger.js.map
|
|
@@ -0,0 +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,aAEpB,SAAQ,WAAoB;CAAG"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import type { TriggerType } from '../types/trigger-types.js';
|
|
3
|
+
import type { TriggerCategory } from '../types/categories.js';
|
|
4
|
+
import { BaseTrigger } from './base-trigger.js';
|
|
5
|
+
export interface TriggerSummary {
|
|
6
|
+
type: TriggerType;
|
|
7
|
+
name: string;
|
|
8
|
+
description: string;
|
|
9
|
+
category: TriggerCategory;
|
|
10
|
+
icon?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface TriggerDescriptor extends TriggerSummary {
|
|
13
|
+
/** JSON Schema for the trigger's config — generated from the Zod schema. */
|
|
14
|
+
configSchema: Record<string, unknown>;
|
|
15
|
+
/** JSON Schema for the trigger's output — generated from the Zod schema. */
|
|
16
|
+
outputSchema: Record<string, unknown>;
|
|
17
|
+
/** Whether this trigger requires scope-based filtering in the UI. */
|
|
18
|
+
requiresScopeFilter: boolean;
|
|
19
|
+
/** Fields used for scope filtering (e.g. channelIds, boardIds). */
|
|
20
|
+
scopeFilterFields: readonly string[];
|
|
21
|
+
}
|
|
22
|
+
export declare class UnknownTriggerError extends Error {
|
|
23
|
+
readonly triggerType: TriggerType;
|
|
24
|
+
constructor(triggerType: TriggerType);
|
|
25
|
+
}
|
|
26
|
+
type AnyTrigger = BaseTrigger<z.ZodTypeAny>;
|
|
27
|
+
export declare class TriggerRegistry {
|
|
28
|
+
private readonly map;
|
|
29
|
+
constructor();
|
|
30
|
+
/** Register a trigger implementation. Throws on duplicate type. */
|
|
31
|
+
register(instance: AnyTrigger): void;
|
|
32
|
+
/** Look up a trigger by type. Throws `UnknownTriggerError` if not found. */
|
|
33
|
+
get(type: TriggerType): AnyTrigger;
|
|
34
|
+
/** All registered trigger instances. */
|
|
35
|
+
list(): AnyTrigger[];
|
|
36
|
+
/** Lightweight summaries — type, name, description, category, icon. */
|
|
37
|
+
listSummaries(): TriggerSummary[];
|
|
38
|
+
/** Full descriptor for a single trigger type — includes JSON Schemas and all metadata. */
|
|
39
|
+
getDescriptor(type: TriggerType): TriggerDescriptor;
|
|
40
|
+
/** Check if a trigger type is registered. */
|
|
41
|
+
has(type: TriggerType): boolean;
|
|
42
|
+
/** Number of registered triggers. */
|
|
43
|
+
get size(): number;
|
|
44
|
+
private buildSummary;
|
|
45
|
+
private buildDescriptor;
|
|
46
|
+
}
|
|
47
|
+
export {};
|
|
48
|
+
//# sourceMappingURL=trigger-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trigger-registry.d.ts","sourceRoot":"","sources":["../../src/triggers/trigger-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAShD,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,WAAW,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,eAAe,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAID,MAAM,WAAW,iBAAkB,SAAQ,cAAc;IACvD,4EAA4E;IAC5E,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,4EAA4E;IAC5E,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,qEAAqE;IACrE,mBAAmB,EAAE,OAAO,CAAC;IAC7B,mEAAmE;IACnE,iBAAiB,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC;AAID,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;gBAEtB,WAAW,EAAE,WAAW;CAOrC;AAID,KAAK,UAAU,GAAG,WAAW,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;AAE5C,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAsC;;IAU1D,mEAAmE;IACnE,QAAQ,CAAC,QAAQ,EAAE,UAAU,GAAG,IAAI;IASpC,4EAA4E;IAC5E,GAAG,CAAC,IAAI,EAAE,WAAW,GAAG,UAAU;IAQlC,wCAAwC;IACxC,IAAI,IAAI,UAAU,EAAE;IAIpB,uEAAuE;IACvE,aAAa,IAAI,cAAc,EAAE;IAIjC,0FAA0F;IAC1F,aAAa,CAAC,IAAI,EAAE,WAAW,GAAG,iBAAiB;IAKnD,6CAA6C;IAC7C,GAAG,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO;IAI/B,qCAAqC;IACrC,IAAI,IAAI,IAAI,MAAM,CAEjB;IAID,OAAO,CAAC,YAAY;IAUpB,OAAO,CAAC,eAAe;CASxB"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { BaseTrigger } from './base-trigger.js';
|
|
2
|
+
import { zodToJsonSchemaRecord } from '../util/schema-convert.js';
|
|
3
|
+
import { DefaultManualTrigger } from './builtin/default-manual-trigger.js';
|
|
4
|
+
import { DefaultWebhookTrigger } from './builtin/default-webhook-trigger.js';
|
|
5
|
+
import { DefaultCronTrigger } from './builtin/default-cron-trigger.js';
|
|
6
|
+
import { DefaultEventTrigger } from './builtin/default-event-trigger.js';
|
|
7
|
+
// ─── Error ───
|
|
8
|
+
export class UnknownTriggerError extends Error {
|
|
9
|
+
triggerType;
|
|
10
|
+
constructor(triggerType) {
|
|
11
|
+
super(`TriggerRegistry: unknown trigger type "${triggerType}". Is it registered at boot?`);
|
|
12
|
+
this.name = 'UnknownTriggerError';
|
|
13
|
+
this.triggerType = triggerType;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export class TriggerRegistry {
|
|
17
|
+
map = new Map();
|
|
18
|
+
constructor() {
|
|
19
|
+
// Auto-register all built-in triggers
|
|
20
|
+
this.map.set('MANUAL', new DefaultManualTrigger());
|
|
21
|
+
this.map.set('WEBHOOK', new DefaultWebhookTrigger());
|
|
22
|
+
this.map.set('CRON', new DefaultCronTrigger());
|
|
23
|
+
this.map.set('EVENT', new DefaultEventTrigger());
|
|
24
|
+
}
|
|
25
|
+
/** Register a trigger implementation. Throws on duplicate type. */
|
|
26
|
+
register(instance) {
|
|
27
|
+
if (this.map.has(instance.type)) {
|
|
28
|
+
throw new Error(`TriggerRegistry: trigger type "${instance.type}" is already registered.`);
|
|
29
|
+
}
|
|
30
|
+
this.map.set(instance.type, instance);
|
|
31
|
+
}
|
|
32
|
+
/** Look up a trigger by type. Throws `UnknownTriggerError` if not found. */
|
|
33
|
+
get(type) {
|
|
34
|
+
const impl = this.map.get(type);
|
|
35
|
+
if (!impl) {
|
|
36
|
+
throw new UnknownTriggerError(type);
|
|
37
|
+
}
|
|
38
|
+
return impl;
|
|
39
|
+
}
|
|
40
|
+
/** All registered trigger instances. */
|
|
41
|
+
list() {
|
|
42
|
+
return Array.from(this.map.values());
|
|
43
|
+
}
|
|
44
|
+
/** Lightweight summaries — type, name, description, category, icon. */
|
|
45
|
+
listSummaries() {
|
|
46
|
+
return this.list().map((t) => this.buildSummary(t));
|
|
47
|
+
}
|
|
48
|
+
/** Full descriptor for a single trigger type — includes JSON Schemas and all metadata. */
|
|
49
|
+
getDescriptor(type) {
|
|
50
|
+
const impl = this.get(type);
|
|
51
|
+
return this.buildDescriptor(impl);
|
|
52
|
+
}
|
|
53
|
+
/** Check if a trigger type is registered. */
|
|
54
|
+
has(type) {
|
|
55
|
+
return this.map.has(type);
|
|
56
|
+
}
|
|
57
|
+
/** Number of registered triggers. */
|
|
58
|
+
get size() {
|
|
59
|
+
return this.map.size;
|
|
60
|
+
}
|
|
61
|
+
// ─── Internal builders ───
|
|
62
|
+
buildSummary(t) {
|
|
63
|
+
return {
|
|
64
|
+
type: t.type,
|
|
65
|
+
name: t.name,
|
|
66
|
+
description: t.description,
|
|
67
|
+
category: t.category,
|
|
68
|
+
...(t.icon !== undefined ? { icon: t.icon } : {}),
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
buildDescriptor(t) {
|
|
72
|
+
return {
|
|
73
|
+
...this.buildSummary(t),
|
|
74
|
+
configSchema: t.decorateConfigSchema(zodToJsonSchemaRecord(t.configSchema)),
|
|
75
|
+
outputSchema: zodToJsonSchemaRecord(t.outputSchema),
|
|
76
|
+
requiresScopeFilter: t.requiresScopeFilter ?? false,
|
|
77
|
+
scopeFilterFields: t.scopeFilterFields ?? [],
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=trigger-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trigger-registry.js","sourceRoot":"","sources":["../../src/triggers/trigger-registry.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAyBzE,gBAAgB;AAEhB,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IACnC,WAAW,CAAc;IAElC,YAAY,WAAwB;QAClC,KAAK,CACH,0CAA0C,WAAW,8BAA8B,CACpF,CAAC;QACF,IAAI,CAAC,IAAI,G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C7C,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import { BaseTrigger } from './base-trigger.js';
|
|
3
|
+
export interface WebhookRequest {
|
|
4
|
+
method: string;
|
|
5
|
+
headers: Record<string, string | string[] | undefined>;
|
|
6
|
+
body: unknown;
|
|
7
|
+
query: Record<string, string | string[] | undefined>;
|
|
8
|
+
}
|
|
9
|
+
export interface WebhookResponse {
|
|
10
|
+
status: number;
|
|
11
|
+
headers?: Record<string, string>;
|
|
12
|
+
body?: unknown;
|
|
13
|
+
}
|
|
14
|
+
export interface WebhookHandleResult {
|
|
15
|
+
/** Data to pass into the workflow as trigger context. */
|
|
16
|
+
triggerData: Record<string, unknown>;
|
|
17
|
+
/** HTTP response to return to the webhook caller. */
|
|
18
|
+
httpResponse: WebhookResponse;
|
|
19
|
+
}
|
|
20
|
+
export interface WebhookActivationContext {
|
|
21
|
+
/** The full URL the webhook will be reachable at. */
|
|
22
|
+
webhookUrl: string;
|
|
23
|
+
/** Resolved credentials if the trigger declares credentialSlots. */
|
|
24
|
+
credentials: Record<string, {
|
|
25
|
+
type: string;
|
|
26
|
+
data: Record<string, unknown>;
|
|
27
|
+
}>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Webhook trigger — fires when an external HTTP request hits the webhook URL.
|
|
31
|
+
*
|
|
32
|
+
* On activation, the runtime generates a unique webhook path and calls
|
|
33
|
+
* `onActivate()` so the trigger can register it with the external service.
|
|
34
|
+
* On incoming requests, `handleRequest()` validates the request and
|
|
35
|
+
* returns the trigger data + HTTP response.
|
|
36
|
+
*/
|
|
37
|
+
export declare abstract class WebhookTrigger<TConfig extends z.ZodTypeAny = z.ZodTypeAny> extends BaseTrigger<TConfig> {
|
|
38
|
+
/**
|
|
39
|
+
* Process an incoming webhook request.
|
|
40
|
+
* Return the data to inject as trigger context and the HTTP response.
|
|
41
|
+
*/
|
|
42
|
+
abstract handleRequest(request: WebhookRequest, config: z.infer<TConfig>): Promise<WebhookHandleResult>;
|
|
43
|
+
/**
|
|
44
|
+
* Called when the workflow is activated. Use to register the webhook URL
|
|
45
|
+
* with the external service (e.g. Stripe, GitHub).
|
|
46
|
+
*/
|
|
47
|
+
onActivate?(config: z.infer<TConfig>, ctx: WebhookActivationContext): Promise<void>;
|
|
48
|
+
/**
|
|
49
|
+
* Called when the workflow is deactivated. Use to unregister from the
|
|
50
|
+
* external service.
|
|
51
|
+
*/
|
|
52
|
+
onDeactivate?(config: z.infer<TConfig>, ctx: WebhookActivationContext): Promise<void>;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=webhook-trigger.d.ts.map
|
|
@@ -0,0 +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;AAIhD,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC;IACvD,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC;CACtD;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,mBAAmB;IAClC,yDAAyD;IACzD,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,qDAAqD;IACrD,YAAY,EAAE,eAAe,CAAC;CAC/B;AAED,MAAM,WAAW,wBAAwB;IACvC,qDAAqD;IACrD,UAAU,EAAE,MAAM,CAAC;IACnB,oEAAoE;IACpE,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC,CAAC;CAC9E;AAID;;;;;;;GAOG;AACH,8BAAsB,cAAc,CAClC,OAAO,SAAS,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,UAAU,CAC3C,SAAQ,WAAW,CAAC,OAAO,CAAC;IAC5B;;;OAGG;IACH,QAAQ,CAAC,aAAa,CACpB,OAAO,EAAE,cAAc,EACvB,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,GACvB,OAAO,CAAC,mBAAmB,CAAC;IAE/B;;;OAGG;IACH,UAAU,CAAC,CACT,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,EACxB,GAAG,EAAE,wBAAwB,GAC5B,OAAO,CAAC,IAAI,CAAC;IAEhB;;;OAGG;IACH,YAAY,CAAC,CACX,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,EACxB,GAAG,EAAE,wBAAwB,GAC5B,OAAO,CAAC,IAAI,CAAC;CACjB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BaseTrigger } from './base-trigger.js';
|
|
2
|
+
// ─── WebhookTrigger ───
|
|
3
|
+
/**
|
|
4
|
+
* Webhook trigger — fires when an external HTTP request hits the webhook URL.
|
|
5
|
+
*
|
|
6
|
+
* On activation, the runtime generates a unique webhook path and calls
|
|
7
|
+
* `onActivate()` so the trigger can register it with the external service.
|
|
8
|
+
* On incoming requests, `handleRequest()` validates the request and
|
|
9
|
+
* returns the trigger data + HTTP response.
|
|
10
|
+
*/
|
|
11
|
+
export class WebhookTrigger extends BaseTrigger {
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=webhook-trigger.js.map
|
|
@@ -0,0 +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;AA+BhD,yBAAyB;AAEzB;;;;;;;GAOG;AACH,MAAM,OAAgB,cAEpB,SAAQ,WAAoB;CA2B7B"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Attachment — opaque reference to a file managed by the host's StorageAdapter.
|
|
3
|
+
*
|
|
4
|
+
* Used everywhere the framework carries a file:
|
|
5
|
+
* - Trigger inputs (uploaded via `POST /uploads`, attached to `context.trigger.attachments`)
|
|
6
|
+
* - Resume payloads (uploaded with feedback in a review-gate retry)
|
|
7
|
+
* - Step inputs (rerunFromStep with attachments in configOverrides)
|
|
8
|
+
*
|
|
9
|
+
* The framework never opens `data` — it's a host-defined reference (URL,
|
|
10
|
+
* blob ID, signed token, `mem://uuid`). Steps that need the bytes call
|
|
11
|
+
* `StorageAdapter.read()` via a service the host registers.
|
|
12
|
+
*/
|
|
13
|
+
export interface Attachment {
|
|
14
|
+
/** Original filename — e.g. "contract.pdf". */
|
|
15
|
+
name: string;
|
|
16
|
+
/** MIME type — e.g. "application/pdf", "image/png". */
|
|
17
|
+
mimeType: string;
|
|
18
|
+
/** Opaque host reference. Framework treats this as a string. */
|
|
19
|
+
data: string;
|
|
20
|
+
/** Size in bytes — set by storage after upload. Useful for UI display + size budgets. */
|
|
21
|
+
size?: number;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=attachment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachment.d.ts","sourceRoot":"","sources":["../../src/types/attachment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,UAAU;IACzB,+CAA+C;IAC/C,IAAI,EAAE,MAAM,CAAC;IACb,uDAAuD;IACvD,QAAQ,EAAE,MAAM,CAAC;IACjB,gEAAgE;IAChE,IAAI,EAAE,MAAM,CAAC;IACb,yFAAyF;IACzF,IAAI,CAAC,EAAE,MAAM,CAAC;CACf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachment.js","sourceRoot":"","sources":["../../src/types/attachment.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare enum TriggerCategory {
|
|
3
|
+
EVENT = "event",
|
|
4
|
+
WEBHOOK = "webhook",
|
|
5
|
+
CRON = "cron",
|
|
6
|
+
MANUAL = "manual"
|
|
7
|
+
}
|
|
8
|
+
export declare const TriggerCategorySchema: z.ZodNativeEnum<typeof TriggerCategory>;
|
|
9
|
+
/**
|
|
10
|
+
* Step category is a plain string — the SDK only uses 'control' internally.
|
|
11
|
+
* Host defines domain-specific categories ('messaging', 'ticket', 'ai', etc.).
|
|
12
|
+
*/
|
|
13
|
+
export type StepCategory = 'control' | (string & {});
|
|
14
|
+
//# sourceMappingURL=categories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"categories.d.ts","sourceRoot":"","sources":["../../src/types/categories.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,oBAAY,eAAe;IACzB,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,IAAI,SAAS;IACb,MAAM,WAAW;CAClB;AAED,eAAO,MAAM,qBAAqB,yCAAgC,CAAC;AAEnE;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export var TriggerCategory;
|
|
3
|
+
(function (TriggerCategory) {
|
|
4
|
+
TriggerCategory["EVENT"] = "event";
|
|
5
|
+
TriggerCategory["WEBHOOK"] = "webhook";
|
|
6
|
+
TriggerCategory["CRON"] = "cron";
|
|
7
|
+
TriggerCategory["MANUAL"] = "manual";
|
|
8
|
+
})(TriggerCategory || (TriggerCategory = {}));
|
|
9
|
+
export const TriggerCategorySchema = z.nativeEnum(TriggerCategory);
|
|
10
|
+
//# sourceMappingURL=categories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"categories.js","sourceRoot":"","sources":["../../src/types/categories.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAN,IAAY,eAKX;AALD,WAAY,eAAe;IACzB,kCAAe,CAAA;IACf,sCAAmB,CAAA;IACnB,gCAAa,CAAA;IACb,oCAAiB,CAAA;AACnB,CAAC,EALW,eAAe,KAAf,eAAe,QAK1B;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { StepType } from './step-types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Trigger context is generic in the SDK — host defines concrete shapes.
|
|
4
|
+
* Must have at minimum a `type` field for matching.
|
|
5
|
+
*/
|
|
6
|
+
export type TriggerContext = Record<string, unknown> & {
|
|
7
|
+
type: string;
|
|
8
|
+
};
|
|
9
|
+
export interface StepContextEntry {
|
|
10
|
+
type: StepType;
|
|
11
|
+
input?: Record<string, unknown>;
|
|
12
|
+
output: Record<string, unknown>;
|
|
13
|
+
error?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The shared context that flows through a workflow execution.
|
|
17
|
+
*
|
|
18
|
+
* - `workflow` — identity: just the workflow id + host-defined metadata
|
|
19
|
+
* - `trigger` — the event/webhook/cron payload that started the execution
|
|
20
|
+
* - `steps` — accumulated outputs from each step (keyed by step id)
|
|
21
|
+
* - `__meta` — internal bookkeeping (error state, execution chain for cycle detection)
|
|
22
|
+
*
|
|
23
|
+
* The SDK only needs `workflow.id` internally (static data scoping, execution tracking).
|
|
24
|
+
* Host-specific fields (workspaceId, createdById, tenantId, etc.) go in `workflow.metadata`.
|
|
25
|
+
*/
|
|
26
|
+
export interface WorkflowContext {
|
|
27
|
+
workflow: {
|
|
28
|
+
id: string;
|
|
29
|
+
/** Host-defined metadata — workspaceId, createdById, tenantId, etc. */
|
|
30
|
+
metadata: Record<string, unknown>;
|
|
31
|
+
};
|
|
32
|
+
trigger: TriggerContext;
|
|
33
|
+
steps: Record<string, StepContextEntry>;
|
|
34
|
+
__meta?: {
|
|
35
|
+
error?: string | null;
|
|
36
|
+
chain?: readonly string[];
|
|
37
|
+
/**
|
|
38
|
+
* Set when this execution was created via `rerunFromStep()`.
|
|
39
|
+
* Tells the executor to start at `fromStepIndex` (skipping cached prior steps).
|
|
40
|
+
*/
|
|
41
|
+
rerunSource?: {
|
|
42
|
+
executionId: string;
|
|
43
|
+
fromStepIndex: number;
|
|
44
|
+
fromStepId: string;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Prior execution's data for the first step being re-executed
|
|
48
|
+
* (review-gate retry or cross-execution rerun). The executor hydrates this
|
|
49
|
+
* from persistence on entry and exposes it via `ctx.priorState`.
|
|
50
|
+
* Transient — not persisted in this shape; lives inside `runExecution`.
|
|
51
|
+
*/
|
|
52
|
+
__priorStepState?: Record<string, unknown>;
|
|
53
|
+
/**
|
|
54
|
+
* Config overrides for the first re-executing step, supplied by
|
|
55
|
+
* `rerunFromStep({ configOverrides })`. Merged into `step.config`
|
|
56
|
+
* before variable resolution.
|
|
57
|
+
*/
|
|
58
|
+
__configOverrides?: Record<string, unknown>;
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/types/context.ts"],"names":[],"mappings":"AAAA,OAAO,KA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1,18 @@
|
|
|
1
|
+
export { BuiltinStepType, BuiltinStepTypeSchema, ControlFlowStepTypeSchema, CONTROL_FLOW_STEP_TYPES, BuiltinTriggerType, BuiltinTriggerTypeSchema, } from './known-types.js';
|
|
2
|
+
export type { ControlFlowStepType } from './known-types.js';
|
|
3
|
+
export type { StepType } from './step-types.js';
|
|
4
|
+
export type { TriggerType } from './trigger-types.js';
|
|
5
|
+
export { TriggerCategory, TriggerCategorySchema, } from './categories.js';
|
|
6
|
+
export type { StepCategory } from './categories.js';
|
|
7
|
+
export { ConditionOperator, ConditionOperatorSchema, VALUE_LESS_OPERATORS, OPERATOR_DESCRIPTORS, } from './operators.js';
|
|
8
|
+
export type { OperatorDescriptor } from './operators.js';
|
|
9
|
+
export { WorkflowStatus, WorkflowStatusSchema, isLiveStatus, isProposalStatus, isTerminalProposalStatus, ExecutionStatus, ExecutionStatusSchema, } from './status.js';
|
|
10
|
+
export { ValidationIssueCode, ValidationIssueCodeSchema, } from './validation.js';
|
|
11
|
+
export type { ValidationIssue, ValidationResult } from './validation.js';
|
|
12
|
+
export type { TriggerContext, StepContextEntry, WorkflowContext, } from './context.js';
|
|
13
|
+
export type { PausePathSegment, PausePath } from './pause-path.js';
|
|
14
|
+
export type { PauseDisplaySection, PauseFormFieldOption, PauseFormField, PauseForm, PauseAction, PauseState, PauseCategory, } from './pause-state.js';
|
|
15
|
+
export type { StepProgressEventType, StepProgressEvent, StepEventRecord, } from './step-events.js';
|
|
16
|
+
export { variableRef, getVariableRefInnerSchema, LeafConditionSchema, ConditionSchema, WorkflowSettingsSchema, readDottedPath, } from './workflow-config.js';
|
|
17
|
+
export type { LeafCondition, Condition, ActionStepConfig, ConditionalStepConfig, SwitchCaseEntry, SwitchStepConfig, WorkflowStepConfig, WorkflowSettings, WorkflowConfig, StepCompletionGate, } from './workflow-config.js';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","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