@xyne/workflow-sdk 3.2.36 → 3.2.38
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/agents/agent-step.d.ts +2 -2
- package/dist/agents/host-agent-step.d.ts +1 -1
- package/dist/builder/index.d.ts +2 -2
- package/dist/builder/index.d.ts.map +1 -1
- package/dist/builder/index.js +1 -1
- package/dist/builder/index.js.map +1 -1
- package/dist/client/events-client.d.ts +57 -0
- package/dist/client/events-client.d.ts.map +1 -0
- package/dist/client/events-client.js +107 -0
- package/dist/client/events-client.js.map +1 -0
- package/dist/client/index.d.ts +2 -0
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/sse.d.ts +30 -0
- package/dist/client/sse.d.ts.map +1 -0
- package/dist/client/sse.js +76 -0
- package/dist/client/sse.js.map +1 -0
- package/dist/client/types.d.ts +31 -6
- package/dist/client/types.d.ts.map +1 -1
- package/dist/client/url.d.ts +11 -0
- package/dist/client/url.d.ts.map +1 -0
- package/dist/client/url.js +28 -0
- package/dist/client/url.js.map +1 -0
- package/dist/client/workflow-client.d.ts +1 -1
- package/dist/client/workflow-client.d.ts.map +1 -1
- package/dist/client/workflow-client.js +32 -20
- package/dist/client/workflow-client.js.map +1 -1
- package/dist/common/citation-ref.d.ts +4 -4
- package/dist/common/credentials.d.ts +107 -0
- package/dist/common/credentials.d.ts.map +1 -1
- package/dist/common/credentials.js +67 -0
- package/dist/common/credentials.js.map +1 -1
- package/dist/common/index.d.ts +2 -2
- package/dist/common/index.d.ts.map +1 -1
- package/dist/common/index.js +2 -2
- package/dist/common/index.js.map +1 -1
- package/dist/connectors/builtin/builtin-connector.d.ts +32 -0
- package/dist/connectors/builtin/builtin-connector.d.ts.map +1 -0
- package/dist/connectors/builtin/builtin-connector.js +62 -0
- package/dist/connectors/builtin/builtin-connector.js.map +1 -0
- package/dist/connectors/builtin/credentials.d.ts +18 -0
- package/dist/connectors/builtin/credentials.d.ts.map +1 -0
- package/dist/connectors/builtin/credentials.js +50 -0
- package/dist/connectors/builtin/credentials.js.map +1 -0
- package/dist/connectors/builtin/steps/code.step.d.ts +99 -0
- package/dist/connectors/builtin/steps/code.step.d.ts.map +1 -0
- package/dist/connectors/builtin/steps/code.step.js +152 -0
- package/dist/connectors/builtin/steps/code.step.js.map +1 -0
- package/dist/connectors/builtin/steps/conditional.step.d.ts +182 -0
- package/dist/connectors/builtin/steps/conditional.step.d.ts.map +1 -0
- package/dist/connectors/builtin/steps/conditional.step.js +82 -0
- package/dist/connectors/builtin/steps/conditional.step.js.map +1 -0
- package/dist/connectors/builtin/steps/dedup.step.d.ts +65 -0
- package/dist/connectors/builtin/steps/dedup.step.d.ts.map +1 -0
- package/dist/connectors/builtin/steps/dedup.step.js +61 -0
- package/dist/connectors/builtin/steps/dedup.step.js.map +1 -0
- package/dist/connectors/builtin/steps/http-request.step.d.ts +1027 -0
- package/dist/connectors/builtin/steps/http-request.step.d.ts.map +1 -0
- package/dist/connectors/builtin/steps/http-request.step.js +497 -0
- package/dist/connectors/builtin/steps/http-request.step.js.map +1 -0
- package/dist/connectors/builtin/steps/loop.step.d.ts +100 -0
- package/dist/connectors/builtin/steps/loop.step.d.ts.map +1 -0
- package/dist/connectors/builtin/steps/loop.step.js +73 -0
- package/dist/connectors/builtin/steps/loop.step.js.map +1 -0
- package/dist/connectors/builtin/steps/map.step.d.ts +148 -0
- package/dist/connectors/builtin/steps/map.step.d.ts.map +1 -0
- package/dist/connectors/builtin/steps/map.step.js +111 -0
- package/dist/connectors/builtin/steps/map.step.js.map +1 -0
- package/dist/connectors/builtin/steps/parallel.step.d.ts +246 -0
- package/dist/connectors/builtin/steps/parallel.step.d.ts.map +1 -0
- package/dist/connectors/builtin/steps/parallel.step.js +175 -0
- package/dist/connectors/builtin/steps/parallel.step.js.map +1 -0
- package/dist/connectors/builtin/steps/ssrf-guard.d.ts +9 -0
- package/dist/connectors/builtin/steps/ssrf-guard.d.ts.map +1 -0
- package/dist/connectors/builtin/steps/ssrf-guard.js +115 -0
- package/dist/connectors/builtin/steps/ssrf-guard.js.map +1 -0
- package/dist/connectors/builtin/steps/switch.step.d.ts +235 -0
- package/dist/connectors/builtin/steps/switch.step.d.ts.map +1 -0
- package/dist/connectors/builtin/steps/switch.step.js +101 -0
- package/dist/connectors/builtin/steps/switch.step.js.map +1 -0
- package/dist/connectors/builtin/steps/wait.step.d.ts +1072 -0
- package/dist/connectors/builtin/steps/wait.step.d.ts.map +1 -0
- package/dist/connectors/builtin/steps/wait.step.js +254 -0
- package/dist/connectors/builtin/steps/wait.step.js.map +1 -0
- package/dist/connectors/builtin/triggers/default-cron-trigger.d.ts +44 -0
- package/dist/connectors/builtin/triggers/default-cron-trigger.d.ts.map +1 -0
- package/dist/connectors/builtin/triggers/default-cron-trigger.js +31 -0
- package/dist/connectors/builtin/triggers/default-cron-trigger.js.map +1 -0
- package/dist/connectors/builtin/triggers/default-event-trigger.d.ts +32 -0
- package/dist/connectors/builtin/triggers/default-event-trigger.d.ts.map +1 -0
- package/dist/connectors/builtin/triggers/default-event-trigger.js +21 -0
- package/dist/connectors/builtin/triggers/default-event-trigger.js.map +1 -0
- package/dist/connectors/builtin/triggers/default-manual-trigger.d.ts +45 -0
- package/dist/connectors/builtin/triggers/default-manual-trigger.d.ts.map +1 -0
- package/dist/connectors/builtin/triggers/default-manual-trigger.js +51 -0
- package/dist/connectors/builtin/triggers/default-manual-trigger.js.map +1 -0
- package/dist/connectors/builtin/triggers/default-webhook-v2-trigger.d.ts +31 -0
- package/dist/connectors/builtin/triggers/default-webhook-v2-trigger.d.ts.map +1 -0
- package/dist/connectors/builtin/triggers/default-webhook-v2-trigger.js +40 -0
- package/dist/connectors/builtin/triggers/default-webhook-v2-trigger.js.map +1 -0
- package/dist/connectors/core/base-connector.d.ts +45 -0
- package/dist/connectors/core/base-connector.d.ts.map +1 -0
- package/dist/connectors/core/base-connector.js +3 -0
- package/dist/connectors/core/base-connector.js.map +1 -0
- package/dist/connectors/core/connector-registry.d.ts +130 -0
- package/dist/connectors/core/connector-registry.d.ts.map +1 -0
- package/dist/connectors/core/connector-registry.js +357 -0
- package/dist/connectors/core/connector-registry.js.map +1 -0
- package/dist/connectors/core/credentials.d.ts +104 -0
- package/dist/connectors/core/credentials.d.ts.map +1 -0
- package/dist/connectors/core/credentials.js +67 -0
- package/dist/connectors/core/credentials.js.map +1 -0
- package/dist/connectors/core/index.d.ts +7 -0
- package/dist/connectors/core/index.d.ts.map +1 -0
- package/dist/connectors/core/index.js +5 -0
- package/dist/connectors/core/index.js.map +1 -0
- package/dist/engine/available-context.d.ts +3 -4
- package/dist/engine/available-context.d.ts.map +1 -1
- package/dist/engine/available-context.js +17 -13
- package/dist/engine/available-context.js.map +1 -1
- package/dist/engine/config-validator.d.ts +13 -5
- package/dist/engine/config-validator.d.ts.map +1 -1
- package/dist/engine/config-validator.js +89 -11
- package/dist/engine/config-validator.js.map +1 -1
- package/dist/engine/credential-resolver.d.ts +42 -0
- package/dist/engine/credential-resolver.d.ts.map +1 -0
- package/dist/engine/credential-resolver.js +63 -0
- package/dist/engine/credential-resolver.js.map +1 -0
- package/dist/engine/workflow-executor.d.ts +15 -9
- package/dist/engine/workflow-executor.d.ts.map +1 -1
- package/dist/engine/workflow-executor.js +31 -40
- package/dist/engine/workflow-executor.js.map +1 -1
- package/dist/events/in-memory-adapter.d.ts +15 -0
- package/dist/events/in-memory-adapter.d.ts.map +1 -0
- package/dist/events/in-memory-adapter.js +50 -0
- package/dist/events/in-memory-adapter.js.map +1 -0
- package/dist/events/types.d.ts +154 -0
- package/dist/events/types.d.ts.map +1 -0
- package/dist/events/types.js +34 -0
- package/dist/events/types.js.map +1 -0
- package/dist/index.d.ts +50 -31
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +39 -16
- package/dist/index.js.map +1 -1
- package/dist/ingest/body.d.ts +18 -0
- package/dist/ingest/body.d.ts.map +1 -0
- package/dist/ingest/body.js +47 -0
- package/dist/ingest/body.js.map +1 -0
- package/dist/ingest/filter.d.ts +11 -0
- package/dist/ingest/filter.d.ts.map +1 -0
- package/dist/ingest/filter.js +23 -0
- package/dist/ingest/filter.js.map +1 -0
- package/dist/ingest/headers.d.ts +3 -0
- package/dist/ingest/headers.d.ts.map +1 -0
- package/dist/ingest/headers.js +11 -0
- package/dist/ingest/headers.js.map +1 -0
- package/dist/ingest/types.d.ts +50 -0
- package/dist/ingest/types.d.ts.map +1 -0
- package/dist/ingest/types.js +9 -0
- package/dist/ingest/types.js.map +1 -0
- package/dist/persistence/in-memory-adapter.d.ts +4 -8
- package/dist/persistence/in-memory-adapter.d.ts.map +1 -1
- package/dist/persistence/in-memory-adapter.js +8 -25
- package/dist/persistence/in-memory-adapter.js.map +1 -1
- package/dist/persistence/types.d.ts +5 -19
- package/dist/persistence/types.d.ts.map +1 -1
- package/dist/router/types.d.ts +31 -3
- package/dist/router/types.d.ts.map +1 -1
- package/dist/router/workflow-router.d.ts +4 -3
- package/dist/router/workflow-router.d.ts.map +1 -1
- package/dist/router/workflow-router.js +258 -63
- package/dist/router/workflow-router.js.map +1 -1
- package/dist/runtime/types.d.ts +36 -56
- package/dist/runtime/types.d.ts.map +1 -1
- package/dist/runtime/workflow-runtime.d.ts +70 -46
- package/dist/runtime/workflow-runtime.d.ts.map +1 -1
- package/dist/runtime/workflow-runtime.js +217 -141
- package/dist/runtime/workflow-runtime.js.map +1 -1
- package/dist/steps/base-step.d.ts +23 -0
- package/dist/steps/base-step.d.ts.map +1 -1
- package/dist/steps/base-step.js +22 -0
- package/dist/steps/base-step.js.map +1 -1
- package/dist/steps/step-descriptor.d.ts +52 -0
- package/dist/steps/step-descriptor.d.ts.map +1 -0
- package/dist/steps/step-descriptor.js +32 -0
- package/dist/steps/step-descriptor.js.map +1 -0
- package/dist/testing/authz-conformance.d.ts.map +1 -1
- package/dist/testing/authz-conformance.js +6 -7
- package/dist/testing/authz-conformance.js.map +1 -1
- package/dist/testing/index.d.ts +1 -0
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +1 -0
- package/dist/testing/index.js.map +1 -1
- package/dist/testing/mock-step-context.d.ts +1 -0
- package/dist/testing/mock-step-context.d.ts.map +1 -1
- package/dist/testing/mock-step-context.js +1 -0
- package/dist/testing/mock-step-context.js.map +1 -1
- package/dist/testing/test-connector.d.ts +40 -0
- package/dist/testing/test-connector.d.ts.map +1 -0
- package/dist/testing/test-connector.js +39 -0
- package/dist/testing/test-connector.js.map +1 -0
- package/dist/triggers/api-trigger.d.ts +15 -0
- package/dist/triggers/api-trigger.d.ts.map +1 -0
- package/dist/triggers/api-trigger.js +14 -0
- package/dist/triggers/api-trigger.js.map +1 -0
- package/dist/triggers/base-trigger.d.ts +29 -0
- package/dist/triggers/base-trigger.d.ts.map +1 -1
- package/dist/triggers/base-trigger.js +16 -0
- package/dist/triggers/base-trigger.js.map +1 -1
- package/dist/triggers/trigger-descriptor.d.ts +42 -0
- package/dist/triggers/trigger-descriptor.d.ts.map +1 -0
- package/dist/triggers/trigger-descriptor.js +29 -0
- package/dist/triggers/trigger-descriptor.js.map +1 -0
- package/dist/triggers/webhook-trigger.d.ts +31 -38
- package/dist/triggers/webhook-trigger.d.ts.map +1 -1
- package/dist/triggers/webhook-trigger.js +19 -6
- package/dist/triggers/webhook-trigger.js.map +1 -1
- package/dist/types/known-types.d.ts +0 -1
- package/dist/types/known-types.d.ts.map +1 -1
- package/dist/types/known-types.js +0 -1
- package/dist/types/known-types.js.map +1 -1
- package/dist/types/validation.d.ts +3 -1
- package/dist/types/validation.d.ts.map +1 -1
- package/dist/types/validation.js +2 -0
- package/dist/types/validation.js.map +1 -1
- package/dist/types/workflow-config.d.ts +23 -0
- package/dist/types/workflow-config.d.ts.map +1 -1
- package/dist/types/workflow-config.js +8 -0
- package/dist/types/workflow-config.js.map +1 -1
- package/dist/util/credential-slot-schema.d.ts +20 -0
- package/dist/util/credential-slot-schema.d.ts.map +1 -0
- package/dist/util/credential-slot-schema.js +30 -0
- package/dist/util/credential-slot-schema.js.map +1 -0
- package/dist/util/event-channel.d.ts +25 -0
- package/dist/util/event-channel.d.ts.map +1 -0
- package/dist/util/event-channel.js +61 -0
- package/dist/util/event-channel.js.map +1 -0
- package/package.json +1 -1
- package/dist/common/expression-eval.d.ts +0 -35
- package/dist/common/expression-eval.d.ts.map +0 -1
- package/dist/common/expression-eval.js +0 -214
- package/dist/common/expression-eval.js.map +0 -1
- package/dist/common/principal.d.ts +0 -45
- package/dist/common/principal.d.ts.map +0 -1
- package/dist/common/principal.js +0 -9
- package/dist/common/principal.js.map +0 -1
- package/dist/steps/builtin/transform.step.d.ts +0 -247
- package/dist/steps/builtin/transform.step.d.ts.map +0 -1
- package/dist/steps/builtin/transform.step.js +0 -135
- package/dist/steps/builtin/transform.step.js.map +0 -1
- package/dist/types/attachment.d.ts +0 -23
- package/dist/types/attachment.d.ts.map +0 -1
- package/dist/types/attachment.js +0 -2
- package/dist/types/attachment.js.map +0 -1
- package/dist/types/resume-payload.d.ts +0 -34
- package/dist/types/resume-payload.d.ts.map +0 -1
- package/dist/types/resume-payload.js +0 -12
- package/dist/types/resume-payload.js.map +0 -1
- package/dist/util/executable-check.d.ts +0 -42
- package/dist/util/executable-check.d.ts.map +0 -1
- package/dist/util/executable-check.js +0 -115
- package/dist/util/executable-check.js.map +0 -1
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a connector declares about its credentials, and what a component accepts.
|
|
3
|
+
*
|
|
4
|
+
* ─── Type and shape are different things ───
|
|
5
|
+
*
|
|
6
|
+
* A credential has a TYPE and a SHAPE.
|
|
7
|
+
*
|
|
8
|
+
* - The type, `credType`, is the connector's own enum value — `SLACK_BOT_TOKEN`,
|
|
9
|
+
* `GITHUB_WEBHOOK_SECRET`. It says who owns the credential and what it is for,
|
|
10
|
+
* and it is what compatibility is checked on: a Slack step lists only Slack
|
|
11
|
+
* credentials, even though a Jira token has the same shape.
|
|
12
|
+
* - The shape, `authType`, is one of the framework's small fixed set
|
|
13
|
+
* ({@link CredentialAuthType}). It decides how values are stored, which form
|
|
14
|
+
* the vault renders, and how the value is applied to an outbound request.
|
|
15
|
+
*
|
|
16
|
+
* A definition binds one type to one shape, and a stored credential carries both.
|
|
17
|
+
*
|
|
18
|
+
* ─── Definitions are referenced, not retyped ───
|
|
19
|
+
*
|
|
20
|
+
* Components refer to the DEFINITION OBJECT rather than repeating the type as
|
|
21
|
+
* text, so a typo is a compile error rather than a boot error:
|
|
22
|
+
*
|
|
23
|
+
* export const SLACK_BOT_TOKEN = defineCredential({
|
|
24
|
+
* connectorId: 'slack', credType: 'SLACK_BOT_TOKEN',
|
|
25
|
+
* label: 'Bot token', authType: CredentialAuthType.Bearer,
|
|
26
|
+
* });
|
|
27
|
+
*
|
|
28
|
+
* override readonly credential = [SLACK_BOT_TOKEN]; // not ['SLACK_BOT_TOKEN']
|
|
29
|
+
*/
|
|
30
|
+
import type { CredentialAuthType } from '../../common/credentials.js';
|
|
31
|
+
import type { AnyStep } from './base-connector.js';
|
|
32
|
+
/**
|
|
33
|
+
* The format a `credType` must follow: SCREAMING_SNAKE_CASE, the way the
|
|
34
|
+
* framework's other enums read. Checked by the registry at boot.
|
|
35
|
+
*/
|
|
36
|
+
export declare const CREDENTIAL_TYPE_PATTERN: RegExp;
|
|
37
|
+
/**
|
|
38
|
+
* One credential type a connector offers. Build with {@link defineCredential}.
|
|
39
|
+
*
|
|
40
|
+
* Generic over the OWNING CONNECTOR'S ID so the owner survives in the type:
|
|
41
|
+
* a definition owned by `acme` and one owned by `other` are different types,
|
|
42
|
+
* which is what lets {@link declareSteps} reject a step reaching for another
|
|
43
|
+
* connector's credential without running anything.
|
|
44
|
+
*/
|
|
45
|
+
export interface CredentialDefinition<TConnector extends string = string> {
|
|
46
|
+
/** The connector's enum value, e.g. `'SLACK_BOT_TOKEN'`. Globally unique. */
|
|
47
|
+
readonly credType: string;
|
|
48
|
+
/** The connector that owns it, for the registry's ownership check. */
|
|
49
|
+
readonly connectorId: TConnector;
|
|
50
|
+
/** Human label for the vault, e.g. `"Bot token"`. */
|
|
51
|
+
readonly label: string;
|
|
52
|
+
/** Where to find or how to choose the value. Shown when creating one. */
|
|
53
|
+
readonly description?: string;
|
|
54
|
+
/** The stored shape. Drives the vault's form and outbound application. */
|
|
55
|
+
readonly authType: CredentialAuthType;
|
|
56
|
+
}
|
|
57
|
+
/** Declare a credential type. Frozen, so every component holds the same object. */
|
|
58
|
+
export declare function defineCredential<TConnector extends string>(input: {
|
|
59
|
+
connectorId: TConnector;
|
|
60
|
+
credType: string;
|
|
61
|
+
label: string;
|
|
62
|
+
description?: string;
|
|
63
|
+
authType: CredentialAuthType;
|
|
64
|
+
}): CredentialDefinition<TConnector>;
|
|
65
|
+
/**
|
|
66
|
+
* The credential types a component accepts — the definitions themselves.
|
|
67
|
+
*
|
|
68
|
+
* Empty means "authenticates nothing", which is most components. This says
|
|
69
|
+
* WHICH types are acceptable, not WHETHER one is needed: that stays with
|
|
70
|
+
* `credentialSlots`, because HTTP_REQUEST accepts several types while needing
|
|
71
|
+
* none.
|
|
72
|
+
*/
|
|
73
|
+
export type CredentialRequirement = readonly CredentialDefinition[];
|
|
74
|
+
/** A component that authenticates nothing — a CODE step, a LOOP step. */
|
|
75
|
+
export declare const NO_CREDENTIAL: CredentialRequirement;
|
|
76
|
+
/** Can a stored credential of this type satisfy the requirement? */
|
|
77
|
+
export declare function acceptsCredential(requirement: CredentialRequirement, credType: string): boolean;
|
|
78
|
+
/**
|
|
79
|
+
* A step, narrowed to the credential types one connector offers.
|
|
80
|
+
*
|
|
81
|
+
* `AnyStep` erases each step's credential types, which is what lets a registry
|
|
82
|
+
* hold steps from every connector in one map — and also what stops the compiler
|
|
83
|
+
* from noticing a step reaching for a credential its connector never declared.
|
|
84
|
+
* This type puts that information back for the one moment it matters: when a
|
|
85
|
+
* connector lists the steps it owns.
|
|
86
|
+
*/
|
|
87
|
+
export type StepAccepting<TCredential extends CredentialDefinition> = Omit<AnyStep, 'credential'> & {
|
|
88
|
+
readonly credential?: readonly TCredential[];
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* Declare a connector's steps, checked against its credentials AT COMPILE TIME.
|
|
92
|
+
*
|
|
93
|
+
* override readonly credentials = BUILTIN_CREDENTIALS;
|
|
94
|
+
* override readonly steps = declareSteps(BUILTIN_CREDENTIALS, [
|
|
95
|
+
* new HttpRequestStep(), // accepts builtin types — fine
|
|
96
|
+
* new ForeignStep(), // accepts another connector's type — red squiggle
|
|
97
|
+
* ]);
|
|
98
|
+
*
|
|
99
|
+
* The registry makes the same check at boot, because a step whose `credential`
|
|
100
|
+
* is typed as the wide `CredentialDefinition[]` has no literal types left to
|
|
101
|
+
* compare.
|
|
102
|
+
*/
|
|
103
|
+
export declare function declareSteps<TCredential extends CredentialDefinition>(_credentials: readonly TCredential[], steps: readonly StepAccepting<TCredential>[]): readonly AnyStep[];
|
|
104
|
+
//# sourceMappingURL=credentials.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../../src/connectors/core/credentials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEnD;;;GAGG;AACH,eAAO,MAAM,uBAAuB,QAAoC,CAAC;AAEzE;;;;;;;GAOG;AACH,MAAM,WAAW,oBAAoB,CAAC,UAAU,SAAS,MAAM,GAAG,MAAM;IACtE,6EAA6E;IAC7E,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,sEAAsE;IACtE,QAAQ,CAAC,WAAW,EAAE,UAAU,CAAC;IACjC,qDAAqD;IACrD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,yEAAyE;IACzE,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,0EAA0E;IAC1E,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,CAAC;CACvC;AAED,mFAAmF;AACnF,wBAAgB,gBAAgB,CAAC,UAAU,SAAS,MAAM,EAAE,KAAK,EAAE;IACjE,WAAW,EAAE,UAAU,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,kBAAkB,CAAC;CAC9B,GAAG,oBAAoB,CAAC,UAAU,CAAC,CAQnC;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,qBAAqB,GAAG,SAAS,oBAAoB,EAAE,CAAC;AAEpE,yEAAyE;AACzE,eAAO,MAAM,aAAa,EAAE,qBAA0B,CAAC;AAEvD,oEAAoE;AACpE,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,qBAAqB,EAClC,QAAQ,EAAE,MAAM,GACf,OAAO,CAET;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,aAAa,CAAC,WAAW,SAAS,oBAAoB,IAChE,IAAI,CAAC,OAAO,EAAE,YAAY,CAAC,GAAG;IAC5B,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,WAAW,EAAE,CAAC;CAC9C,CAAC;AAEJ;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAAC,WAAW,SAAS,oBAAoB,EACnE,YAAY,EAAE,SAAS,WAAW,EAAE,EACpC,KAAK,EAAE,SAAS,aAAa,CAAC,WAAW,CAAC,EAAE,GAC3C,SAAS,OAAO,EAAE,CAEpB"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a connector declares about its credentials, and what a component accepts.
|
|
3
|
+
*
|
|
4
|
+
* ─── Type and shape are different things ───
|
|
5
|
+
*
|
|
6
|
+
* A credential has a TYPE and a SHAPE.
|
|
7
|
+
*
|
|
8
|
+
* - The type, `credType`, is the connector's own enum value — `SLACK_BOT_TOKEN`,
|
|
9
|
+
* `GITHUB_WEBHOOK_SECRET`. It says who owns the credential and what it is for,
|
|
10
|
+
* and it is what compatibility is checked on: a Slack step lists only Slack
|
|
11
|
+
* credentials, even though a Jira token has the same shape.
|
|
12
|
+
* - The shape, `authType`, is one of the framework's small fixed set
|
|
13
|
+
* ({@link CredentialAuthType}). It decides how values are stored, which form
|
|
14
|
+
* the vault renders, and how the value is applied to an outbound request.
|
|
15
|
+
*
|
|
16
|
+
* A definition binds one type to one shape, and a stored credential carries both.
|
|
17
|
+
*
|
|
18
|
+
* ─── Definitions are referenced, not retyped ───
|
|
19
|
+
*
|
|
20
|
+
* Components refer to the DEFINITION OBJECT rather than repeating the type as
|
|
21
|
+
* text, so a typo is a compile error rather than a boot error:
|
|
22
|
+
*
|
|
23
|
+
* export const SLACK_BOT_TOKEN = defineCredential({
|
|
24
|
+
* connectorId: 'slack', credType: 'SLACK_BOT_TOKEN',
|
|
25
|
+
* label: 'Bot token', authType: CredentialAuthType.Bearer,
|
|
26
|
+
* });
|
|
27
|
+
*
|
|
28
|
+
* override readonly credential = [SLACK_BOT_TOKEN]; // not ['SLACK_BOT_TOKEN']
|
|
29
|
+
*/
|
|
30
|
+
/**
|
|
31
|
+
* The format a `credType` must follow: SCREAMING_SNAKE_CASE, the way the
|
|
32
|
+
* framework's other enums read. Checked by the registry at boot.
|
|
33
|
+
*/
|
|
34
|
+
export const CREDENTIAL_TYPE_PATTERN = /^[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)*$/;
|
|
35
|
+
/** Declare a credential type. Frozen, so every component holds the same object. */
|
|
36
|
+
export function defineCredential(input) {
|
|
37
|
+
return Object.freeze({
|
|
38
|
+
credType: input.credType,
|
|
39
|
+
connectorId: input.connectorId,
|
|
40
|
+
label: input.label,
|
|
41
|
+
...(input.description !== undefined ? { description: input.description } : {}),
|
|
42
|
+
authType: input.authType,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
/** A component that authenticates nothing — a CODE step, a LOOP step. */
|
|
46
|
+
export const NO_CREDENTIAL = [];
|
|
47
|
+
/** Can a stored credential of this type satisfy the requirement? */
|
|
48
|
+
export function acceptsCredential(requirement, credType) {
|
|
49
|
+
return requirement.some((definition) => definition.credType === credType);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Declare a connector's steps, checked against its credentials AT COMPILE TIME.
|
|
53
|
+
*
|
|
54
|
+
* override readonly credentials = BUILTIN_CREDENTIALS;
|
|
55
|
+
* override readonly steps = declareSteps(BUILTIN_CREDENTIALS, [
|
|
56
|
+
* new HttpRequestStep(), // accepts builtin types — fine
|
|
57
|
+
* new ForeignStep(), // accepts another connector's type — red squiggle
|
|
58
|
+
* ]);
|
|
59
|
+
*
|
|
60
|
+
* The registry makes the same check at boot, because a step whose `credential`
|
|
61
|
+
* is typed as the wide `CredentialDefinition[]` has no literal types left to
|
|
62
|
+
* compare.
|
|
63
|
+
*/
|
|
64
|
+
export function declareSteps(_credentials, steps) {
|
|
65
|
+
return steps;
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credentials.js","sourceRoot":"","sources":["../../../src/connectors/core/credentials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAKH;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,iCAAiC,CAAC;AAuBzE,mFAAmF;AACnF,MAAM,UAAU,gBAAgB,CAA4B,KAM3D;IACC,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,GAAG,CAAC,KAAK,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9E,QAAQ,EAAE,KAAK,CAAC,QAAQ;KACzB,CAAC,CAAC;AACL,CAAC;AAYD,yEAAyE;AACzE,MAAM,CAAC,MAAM,aAAa,GAA0B,EAAE,CAAC;AAEvD,oEAAoE;AACpE,MAAM,UAAU,iBAAiB,CAC/B,WAAkC,EAClC,QAAgB;IAEhB,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC;AAC5E,CAAC;AAgBD;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,YAAY,CAC1B,YAAoC,EACpC,KAA4C;IAE5C,OAAO,KAA2B,CAAC;AACrC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { BaseConnector } from './base-connector.js';
|
|
2
|
+
export type { AnyStep, AnyTrigger } from './base-connector.js';
|
|
3
|
+
export { ConnectorRegistry, ConnectorRegistrationError, UnknownComponentError, } from './connector-registry.js';
|
|
4
|
+
export type { RegisteredStep, RegisteredTrigger, RegisteredCredential, } from './connector-registry.js';
|
|
5
|
+
export { defineCredential, acceptsCredential, declareSteps, NO_CREDENTIAL, CREDENTIAL_TYPE_PATTERN, } from './credentials.js';
|
|
6
|
+
export type { CredentialDefinition, CredentialRequirement } from './credentials.js';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/connectors/core/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,YAAY,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAE/D,OAAO,EACL,iBAAiB,EACjB,0BAA0B,EAC1B,qBAAqB,GACtB,MAAM,yBAAyB,CAAC;AACjC,YAAY,EACV,cAAc,EACd,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,uBAAuB,GACxB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// The connector contract: what a connector is, and the registry that holds them.
|
|
2
|
+
export { BaseConnector } from './base-connector.js';
|
|
3
|
+
export { ConnectorRegistry, ConnectorRegistrationError, UnknownComponentError, } from './connector-registry.js';
|
|
4
|
+
export { defineCredential, acceptsCredential, declareSteps, NO_CREDENTIAL, CREDENTIAL_TYPE_PATTERN, } from './credentials.js';
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/connectors/core/index.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGpD,OAAO,EACL,iBAAiB,EACjB,0BAA0B,EAC1B,qBAAqB,GACtB,MAAM,yBAAyB,CAAC;AAOjC,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,uBAAuB,GACxB,MAAM,kBAAkB,CAAC"}
|
|
@@ -6,8 +6,7 @@
|
|
|
6
6
|
* The frontend's variable picker uses this to show what refs are available at each step.
|
|
7
7
|
*/
|
|
8
8
|
import type { WorkflowConfig } from '../types/workflow-config.js';
|
|
9
|
-
import type {
|
|
10
|
-
import type { TriggerRegistry } from '../triggers/trigger-registry.js';
|
|
9
|
+
import type { ConnectorRegistry } from '../connectors/core/connector-registry.js';
|
|
11
10
|
import { zodToJsonSchemaRecord } from '../util/schema-convert.js';
|
|
12
11
|
/**
|
|
13
12
|
* Resolve a step's or trigger's output to a JSON Schema — the single source of
|
|
@@ -21,7 +20,7 @@ export interface OutputSchemaProvider {
|
|
|
21
20
|
resolveOutputJsonSchema?: (config: Record<string, unknown>) => Record<string, unknown>;
|
|
22
21
|
outputSchema: Parameters<typeof zodToJsonSchemaRecord>[0];
|
|
23
22
|
}
|
|
24
|
-
export declare function resolveOutputJsonSchemaOf(impl: OutputSchemaProvider, config: Record<string, unknown>,
|
|
23
|
+
export declare function resolveOutputJsonSchemaOf(impl: OutputSchemaProvider, config: Record<string, unknown>, connectors?: ConnectorRegistry): Record<string, unknown>;
|
|
25
24
|
export interface AvailableContext {
|
|
26
25
|
/**
|
|
27
26
|
* Map of context path → JSON Schema.
|
|
@@ -39,5 +38,5 @@ export interface AvailableContext {
|
|
|
39
38
|
* preceding step outputs. Returns `null` if `atStepId` is not found
|
|
40
39
|
* anywhere in the step tree.
|
|
41
40
|
*/
|
|
42
|
-
export declare function getAvailableContext(config: WorkflowConfig, atStepId: string,
|
|
41
|
+
export declare function getAvailableContext(config: WorkflowConfig, atStepId: string, connectors: ConnectorRegistry): AvailableContext | null;
|
|
43
42
|
//# sourceMappingURL=available-context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"available-context.d.ts","sourceRoot":"","sources":["../../src/engine/available-context.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,cAAc,EAEf,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"available-context.d.ts","sourceRoot":"","sources":["../../src/engine/available-context.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,cAAc,EAEf,MAAM,6BAA6B,CAAC;AAErC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAElF,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAGlE;;;;;;;GAOG;AACH,MAAM,WAAW,oBAAoB;IACnC,uBAAuB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvF,YAAY,EAAE,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC;CAC3D;AAED,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,oBAAoB,EAC1B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,UAAU,CAAC,EAAE,iBAAiB,GAC7B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA0CzB;AAED,MAAM,WAAW,gBAAgB;IAC/B;;;;;;OAMG;IACH,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACzC;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,cAAc,EACtB,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,iBAAiB,GAC5B,gBAAgB,GAAG,IAAI,CA0BzB"}
|
|
@@ -5,10 +5,11 @@
|
|
|
5
5
|
* JSON Schema objects keyed by dotted path (e.g. "trigger", "steps.fetch_data.output").
|
|
6
6
|
* The frontend's variable picker uses this to show what refs are available at each step.
|
|
7
7
|
*/
|
|
8
|
+
import { TRIGGER_FILTER_SCOPE } from '../types/workflow-config.js';
|
|
8
9
|
import { BaseControlFlowStep } from '../steps/base-step.js';
|
|
9
10
|
import { zodToJsonSchemaRecord } from '../util/schema-convert.js';
|
|
10
11
|
import { varsJsonSchema } from '../types/workflow-variable.js';
|
|
11
|
-
export function resolveOutputJsonSchemaOf(impl, config,
|
|
12
|
+
export function resolveOutputJsonSchemaOf(impl, config, connectors) {
|
|
12
13
|
const base = impl.resolveOutputJsonSchema
|
|
13
14
|
? impl.resolveOutputJsonSchema(config)
|
|
14
15
|
: zodToJsonSchemaRecord(impl.outputSchema);
|
|
@@ -18,17 +19,17 @@ export function resolveOutputJsonSchemaOf(impl, config, steps) {
|
|
|
18
19
|
// step (present and future) gets result-referencing for free. Needs the
|
|
19
20
|
// registry to resolve each inner step's output schema, and recurses so nested
|
|
20
21
|
// control flow types all the way down. Without `steps` it degrades to `base`.
|
|
21
|
-
if (
|
|
22
|
+
if (connectors && impl instanceof BaseControlFlowStep && impl.getBranches) {
|
|
22
23
|
const branchProps = {};
|
|
23
24
|
for (const [key, branchSteps] of Object.entries(impl.getBranches(config))) {
|
|
24
25
|
const stepProps = {};
|
|
25
26
|
for (const s of branchSteps) {
|
|
26
|
-
if (!
|
|
27
|
+
if (!connectors.hasStep(s.type))
|
|
27
28
|
continue;
|
|
28
29
|
stepProps[s.id] = {
|
|
29
30
|
type: 'object',
|
|
30
31
|
properties: {
|
|
31
|
-
output: resolveOutputJsonSchemaOf(
|
|
32
|
+
output: resolveOutputJsonSchemaOf(connectors.getStep(s.type), s.config, connectors),
|
|
32
33
|
},
|
|
33
34
|
};
|
|
34
35
|
}
|
|
@@ -53,14 +54,14 @@ export function resolveOutputJsonSchemaOf(impl, config, steps) {
|
|
|
53
54
|
* preceding step outputs. Returns `null` if `atStepId` is not found
|
|
54
55
|
* anywhere in the step tree.
|
|
55
56
|
*/
|
|
56
|
-
export function getAvailableContext(config, atStepId,
|
|
57
|
+
export function getAvailableContext(config, atStepId, connectors) {
|
|
57
58
|
const ctx = {};
|
|
58
59
|
// Add trigger output if registered. Use the trigger's per-instance
|
|
59
60
|
// `resolveOutputJsonSchema(config)` when available (lets webhook /
|
|
60
61
|
// manual triggers type headers/body/query from author-supplied schemas);
|
|
61
62
|
// otherwise fall back to the static outputSchema.
|
|
62
|
-
if (config.trigger &&
|
|
63
|
-
const triggerImpl =
|
|
63
|
+
if (config.trigger && connectors.hasTrigger(config.trigger.type)) {
|
|
64
|
+
const triggerImpl = connectors.getTrigger(config.trigger.type);
|
|
64
65
|
ctx['trigger'] = resolveOutputJsonSchemaOf(triggerImpl, (config.trigger.config ?? {}));
|
|
65
66
|
}
|
|
66
67
|
// Author-time workflow variables, referenceable anywhere as {{vars.<key>}}.
|
|
@@ -68,23 +69,26 @@ export function getAvailableContext(config, atStepId, steps, triggers) {
|
|
|
68
69
|
if (config.variables?.some((v) => v.key.trim().length > 0)) {
|
|
69
70
|
ctx['vars'] = varsJsonSchema(config.variables);
|
|
70
71
|
}
|
|
71
|
-
|
|
72
|
+
// A trigger filter runs before any step exists, so it sees only the above.
|
|
73
|
+
if (atStepId === TRIGGER_FILTER_SCOPE)
|
|
74
|
+
return ctx;
|
|
75
|
+
const found = walkForContext(config.steps, atStepId, ctx, connectors);
|
|
72
76
|
return found ? ctx : null;
|
|
73
77
|
}
|
|
74
78
|
/**
|
|
75
79
|
* Walk steps in order. Returns true if `targetId` was found (meaning ctx is populated).
|
|
76
80
|
* Stops as soon as the target is found — no further steps are added.
|
|
77
81
|
*/
|
|
78
|
-
function walkForContext(stepList, targetId, ctx,
|
|
82
|
+
function walkForContext(stepList, targetId, ctx, connectors) {
|
|
79
83
|
for (const step of stepList) {
|
|
80
84
|
// If this is the target step, stop — don't include its own output
|
|
81
85
|
if (step.id === targetId) {
|
|
82
86
|
return true;
|
|
83
87
|
}
|
|
84
88
|
// Register this step's output schema if registered
|
|
85
|
-
if (
|
|
86
|
-
const impl =
|
|
87
|
-
ctx[`steps.${step.id}.output`] = resolveOutputJsonSchemaOf(impl, step.config,
|
|
89
|
+
if (connectors.hasStep(step.type)) {
|
|
90
|
+
const impl = connectors.getStep(step.type);
|
|
91
|
+
ctx[`steps.${step.id}.output`] = resolveOutputJsonSchemaOf(impl, step.config, connectors);
|
|
88
92
|
// Recurse into control-flow branches
|
|
89
93
|
if (impl instanceof BaseControlFlowStep && impl.getBranches) {
|
|
90
94
|
const branches = impl.getBranches(step.config);
|
|
@@ -92,7 +96,7 @@ function walkForContext(stepList, targetId, ctx, steps) {
|
|
|
92
96
|
// Branch gets a snapshot of current context — steps inside a branch
|
|
93
97
|
// shouldn't leak to sibling branches
|
|
94
98
|
const branchCtx = { ...ctx };
|
|
95
|
-
if (walkForContext(branchSteps, targetId, branchCtx,
|
|
99
|
+
if (walkForContext(branchSteps, targetId, branchCtx, connectors)) {
|
|
96
100
|
// Found inside this branch — copy back accumulated context
|
|
97
101
|
Object.assign(ctx, branchCtx);
|
|
98
102
|
return true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"available-context.js","sourceRoot":"","sources":["../../src/engine/available-context.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"available-context.js","sourceRoot":"","sources":["../../src/engine/available-context.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { WorkflowConfig } from '../types/workflow-config.js';
|
|
2
2
|
import type { ValidationResult } from '../types/validation.js';
|
|
3
|
-
import type {
|
|
4
|
-
import type { StepRegistry } from '../steps/step-registry.js';
|
|
3
|
+
import type { ConnectorRegistry } from '../connectors/core/connector-registry.js';
|
|
5
4
|
/**
|
|
6
5
|
* Validates a complete WorkflowConfig against registered triggers and steps.
|
|
7
6
|
*
|
|
@@ -13,11 +12,20 @@ import type { StepRegistry } from '../steps/step-registry.js';
|
|
|
13
12
|
* 5. Control-flow branches are recursively validated via `getBranches()`
|
|
14
13
|
*/
|
|
15
14
|
export declare class ConfigValidator {
|
|
16
|
-
private readonly
|
|
17
|
-
|
|
18
|
-
constructor(triggerRegistry: TriggerRegistry, stepRegistry: StepRegistry);
|
|
15
|
+
private readonly connectors;
|
|
16
|
+
constructor(connectors: ConnectorRegistry);
|
|
19
17
|
validate(config: WorkflowConfig): ValidationResult;
|
|
20
18
|
private walkSteps;
|
|
19
|
+
/**
|
|
20
|
+
* A required credential slot left empty. Reported once per field: a field the
|
|
21
|
+
* config schema already rejected keeps that issue instead.
|
|
22
|
+
*/
|
|
23
|
+
private checkCredentialSlots;
|
|
24
|
+
/**
|
|
25
|
+
* A trigger filter must be well formed, and may only read what exists before
|
|
26
|
+
* a run: the trigger's output and workflow variables.
|
|
27
|
+
*/
|
|
28
|
+
private validateTriggerFilter;
|
|
21
29
|
/**
|
|
22
30
|
* Validate a step's author citations (documentation overlay):
|
|
23
31
|
* - the cited field path must address a real field in `config`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-validator.d.ts","sourceRoot":"","sources":["../../src/engine/config-validator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,cAAc,EAGf,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"config-validator.d.ts","sourceRoot":"","sources":["../../src/engine/config-validator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,cAAc,EAGf,MAAM,6BAA6B,CAAC;AAOrC,OAAO,KAAK,EAGV,gBAAgB,EACjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAiQlF;;;;;;;;;GASG;AACH,qBAAa,eAAe;IAExB,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAAV,UAAU,EAAE,iBAAiB;IAGhD,QAAQ,CAAC,MAAM,EAAE,cAAc,GAAG,gBAAgB;IA4DlD,OAAO,CAAC,SAAS;IAgGjB;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IA2B5B;;;OAGG;IACH,OAAO,CAAC,qBAAqB;IA+C7B;;;;;;OAMG;IACH,OAAO,CAAC,iBAAiB;IA8CzB,OAAO,CAAC,YAAY;IA0BpB,OAAO,CAAC,QAAQ;IAqGhB,OAAO,CAAC,sBAAsB;CAmB/B"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { getVariableRefInnerSchema } from '../types/workflow-config.js';
|
|
2
|
+
import { getVariableRefInnerSchema, TriggerFilterSchema } from '../types/workflow-config.js';
|
|
3
|
+
import { extractRefPath } from '../util/variable-ref.js';
|
|
3
4
|
import { resolveCitationPath } from '../util/citation-path.js';
|
|
4
5
|
import { ValidationIssueCode } from '../types/validation.js';
|
|
5
6
|
import { BaseControlFlowStep } from '../steps/base-step.js';
|
|
@@ -247,11 +248,9 @@ function stepRefLocation(stepId, prefix, location) {
|
|
|
247
248
|
* 5. Control-flow branches are recursively validated via `getBranches()`
|
|
248
249
|
*/
|
|
249
250
|
export class ConfigValidator {
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
this.triggerRegistry = triggerRegistry;
|
|
254
|
-
this.stepRegistry = stepRegistry;
|
|
251
|
+
connectors;
|
|
252
|
+
constructor(connectors) {
|
|
253
|
+
this.connectors = connectors;
|
|
255
254
|
}
|
|
256
255
|
validate(config) {
|
|
257
256
|
const issues = [];
|
|
@@ -260,7 +259,7 @@ export class ConfigValidator {
|
|
|
260
259
|
const outputSchemas = new Map();
|
|
261
260
|
// --- Trigger validation ---
|
|
262
261
|
if (config.trigger) {
|
|
263
|
-
if (!this.
|
|
262
|
+
if (!this.connectors.hasTrigger(config.trigger.type)) {
|
|
264
263
|
issues.push({
|
|
265
264
|
path: 'trigger.type',
|
|
266
265
|
code: ValidationIssueCode.SHAPE,
|
|
@@ -269,7 +268,7 @@ export class ConfigValidator {
|
|
|
269
268
|
});
|
|
270
269
|
}
|
|
271
270
|
else {
|
|
272
|
-
const triggerImpl = this.
|
|
271
|
+
const triggerImpl = this.connectors.getTrigger(config.trigger.type);
|
|
273
272
|
const result = triggerImpl.configSchema.safeParse(config.trigger.config);
|
|
274
273
|
if (!result.success) {
|
|
275
274
|
for (const issue of result.error.issues) {
|
|
@@ -281,8 +280,10 @@ export class ConfigValidator {
|
|
|
281
280
|
});
|
|
282
281
|
}
|
|
283
282
|
}
|
|
283
|
+
this.checkCredentialSlots(triggerImpl.credentialSlots, config.trigger.config, 'trigger.config', { scope: 'trigger' }, issues);
|
|
284
284
|
outputSchemas.set('trigger', resolveOutputJsonSchemaOf(triggerImpl, (config.trigger.config ?? {})));
|
|
285
285
|
}
|
|
286
|
+
this.validateTriggerFilter(config.trigger.filter, issues);
|
|
286
287
|
}
|
|
287
288
|
// --- Variables (author-time constants) ---
|
|
288
289
|
// Registered unconditionally so a `{{vars.x}}` ref when nothing is declared
|
|
@@ -307,7 +308,7 @@ export class ConfigValidator {
|
|
|
307
308
|
});
|
|
308
309
|
}
|
|
309
310
|
seenIds.add(step.id);
|
|
310
|
-
if (!this.
|
|
311
|
+
if (!this.connectors.hasStep(step.type)) {
|
|
311
312
|
issues.push({
|
|
312
313
|
path: `${stepPath}.type`,
|
|
313
314
|
code: ValidationIssueCode.SHAPE,
|
|
@@ -316,7 +317,7 @@ export class ConfigValidator {
|
|
|
316
317
|
});
|
|
317
318
|
continue;
|
|
318
319
|
}
|
|
319
|
-
const stepImpl = this.
|
|
320
|
+
const stepImpl = this.connectors.getStep(step.type);
|
|
320
321
|
const shapeResult = stepImpl.configSchema.safeParse(step.config);
|
|
321
322
|
if (!shapeResult.success) {
|
|
322
323
|
for (const issue of shapeResult.error.issues) {
|
|
@@ -328,12 +329,13 @@ export class ConfigValidator {
|
|
|
328
329
|
});
|
|
329
330
|
}
|
|
330
331
|
}
|
|
332
|
+
this.checkCredentialSlots(stepImpl.credentialSlots, step.config, `${stepPath}.config`, { scope: 'step', stepId: step.id }, issues);
|
|
331
333
|
// Ref validation for action steps
|
|
332
334
|
this.validateRefs(step.config, `${stepPath}.config`, stepImpl.configSchema, outputSchemas, issues, step.id);
|
|
333
335
|
// Register this step's input + output schemas (JSON Schema, resolved like
|
|
334
336
|
// the picker so refs into dynamic outputs — e.g. HTTP body — line up).
|
|
335
337
|
outputSchemas.set(`${step.id}.input`, zodToJsonSchemaRecord(stepImpl.configSchema));
|
|
336
|
-
outputSchemas.set(`${step.id}.output`, resolveOutputJsonSchemaOf(stepImpl, step.config, this.
|
|
338
|
+
outputSchemas.set(`${step.id}.output`, resolveOutputJsonSchemaOf(stepImpl, step.config, this.connectors));
|
|
337
339
|
// Author citations (documentation overlay) — validate target field + ref.
|
|
338
340
|
this.validateCitations(step, stepPath, outputSchemas, issues);
|
|
339
341
|
// Control-flow branch discovery via getBranches()
|
|
@@ -346,6 +348,82 @@ export class ConfigValidator {
|
|
|
346
348
|
}
|
|
347
349
|
}
|
|
348
350
|
}
|
|
351
|
+
/**
|
|
352
|
+
* A required credential slot left empty. Reported once per field: a field the
|
|
353
|
+
* config schema already rejected keeps that issue instead.
|
|
354
|
+
*/
|
|
355
|
+
checkCredentialSlots(slots, config, pathPrefix, location, issues) {
|
|
356
|
+
for (const slot of slots ?? []) {
|
|
357
|
+
if (!slot.required)
|
|
358
|
+
continue;
|
|
359
|
+
const value = config?.[slot.name];
|
|
360
|
+
if (value !== undefined && value !== null && value !== '')
|
|
361
|
+
continue;
|
|
362
|
+
const alreadyReported = issues.some((issue) => issue.location?.scope === location.scope &&
|
|
363
|
+
issue.location.stepId === location.stepId &&
|
|
364
|
+
issue.location.field === slot.name);
|
|
365
|
+
if (alreadyReported)
|
|
366
|
+
continue;
|
|
367
|
+
issues.push({
|
|
368
|
+
path: `${pathPrefix}.${slot.name}`,
|
|
369
|
+
code: ValidationIssueCode.MISSING_CREDENTIAL,
|
|
370
|
+
message: 'Select a credential',
|
|
371
|
+
location: { ...location, field: slot.name },
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* A trigger filter must be well formed, and may only read what exists before
|
|
377
|
+
* a run: the trigger's output and workflow variables.
|
|
378
|
+
*/
|
|
379
|
+
validateTriggerFilter(filter, issues) {
|
|
380
|
+
if (filter === undefined)
|
|
381
|
+
return;
|
|
382
|
+
const location = { scope: 'trigger', field: 'filter' };
|
|
383
|
+
const parsed = TriggerFilterSchema.safeParse(filter);
|
|
384
|
+
if (!parsed.success) {
|
|
385
|
+
for (const issue of parsed.error.issues) {
|
|
386
|
+
issues.push({
|
|
387
|
+
path: ['trigger.filter', ...issue.path].join('.'),
|
|
388
|
+
code: ValidationIssueCode.INVALID_FILTER,
|
|
389
|
+
message: issue.message,
|
|
390
|
+
location,
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
395
|
+
const visit = (condition, path) => {
|
|
396
|
+
if ('all' in condition) {
|
|
397
|
+
condition.all.forEach((child, i) => visit(child, `${path}.all[${i}]`));
|
|
398
|
+
return;
|
|
399
|
+
}
|
|
400
|
+
if ('any' in condition) {
|
|
401
|
+
condition.any.forEach((child, i) => visit(child, `${path}.any[${i}]`));
|
|
402
|
+
return;
|
|
403
|
+
}
|
|
404
|
+
const refPath = extractRefPath(condition.variable);
|
|
405
|
+
if (!refPath) {
|
|
406
|
+
issues.push({
|
|
407
|
+
path: `${path}.variable`,
|
|
408
|
+
code: ValidationIssueCode.INVALID_FILTER,
|
|
409
|
+
message: 'Choose a value for every filter condition',
|
|
410
|
+
location,
|
|
411
|
+
});
|
|
412
|
+
return;
|
|
413
|
+
}
|
|
414
|
+
const head = refPath.split('.')[0];
|
|
415
|
+
if (head !== 'trigger' && head !== 'vars') {
|
|
416
|
+
issues.push({
|
|
417
|
+
path: `${path}.variable`,
|
|
418
|
+
code: ValidationIssueCode.INVALID_FILTER,
|
|
419
|
+
message: `Filters can only use trigger data and workflow variables, not "{{${refPath}}}"`,
|
|
420
|
+
location,
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
};
|
|
424
|
+
if (parsed.data.conditions)
|
|
425
|
+
visit(parsed.data.conditions, 'trigger.filter.conditions');
|
|
426
|
+
}
|
|
349
427
|
/**
|
|
350
428
|
* Validate a step's author citations (documentation overlay):
|
|
351
429
|
* - the cited field path must address a real field in `config`;
|