@xyne/workflow-sdk 3.2.31 → 3.2.33
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 +12 -0
- package/dist/agents/agent-step.d.ts.map +1 -1
- package/dist/agents/agent-step.js +58 -4
- package/dist/agents/agent-step.js.map +1 -1
- package/dist/agents/base-runtime.d.ts +7 -6
- package/dist/agents/base-runtime.d.ts.map +1 -1
- package/dist/agents/base-runtime.js.map +1 -1
- package/dist/agents/index.d.ts +3 -1
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +2 -0
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/pi-session-runtime.d.ts +90 -0
- package/dist/agents/pi-session-runtime.d.ts.map +1 -0
- package/dist/agents/pi-session-runtime.js +231 -0
- package/dist/agents/pi-session-runtime.js.map +1 -0
- package/dist/agents/types.d.ts +1 -0
- package/dist/agents/types.d.ts.map +1 -1
- package/dist/agents/types.js.map +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/types.d.ts +35 -17
- package/dist/client/types.d.ts.map +1 -1
- package/dist/client/workflow-client.d.ts.map +1 -1
- package/dist/client/workflow-client.js +24 -13
- package/dist/client/workflow-client.js.map +1 -1
- package/dist/common/credentials.d.ts +258 -0
- package/dist/common/credentials.d.ts.map +1 -0
- package/dist/common/credentials.js +176 -0
- package/dist/common/credentials.js.map +1 -0
- package/dist/common/index.d.ts +7 -1
- package/dist/common/index.d.ts.map +1 -1
- package/dist/common/index.js +19 -1
- package/dist/common/index.js.map +1 -1
- package/dist/engine/workflow-executor.d.ts.map +1 -1
- package/dist/engine/workflow-executor.js +24 -9
- package/dist/engine/workflow-executor.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/persistence/in-memory-adapter.d.ts +93 -29
- package/dist/persistence/in-memory-adapter.d.ts.map +1 -1
- package/dist/persistence/in-memory-adapter.js +171 -52
- package/dist/persistence/in-memory-adapter.js.map +1 -1
- package/dist/persistence/types.d.ts +84 -26
- package/dist/persistence/types.d.ts.map +1 -1
- package/dist/router/workflow-router.d.ts +3 -1
- package/dist/router/workflow-router.d.ts.map +1 -1
- package/dist/router/workflow-router.js +218 -40
- package/dist/router/workflow-router.js.map +1 -1
- package/dist/runtime/workflow-runtime.d.ts +22 -30
- package/dist/runtime/workflow-runtime.d.ts.map +1 -1
- package/dist/runtime/workflow-runtime.js +46 -54
- package/dist/runtime/workflow-runtime.js.map +1 -1
- package/dist/steps/base-step.d.ts +12 -26
- package/dist/steps/base-step.d.ts.map +1 -1
- package/dist/steps/base-step.js +2 -4
- package/dist/steps/base-step.js.map +1 -1
- package/dist/steps/builtin/code.step.d.ts +7 -3
- package/dist/steps/builtin/code.step.d.ts.map +1 -1
- package/dist/steps/builtin/code.step.js +77 -47
- package/dist/steps/builtin/code.step.js.map +1 -1
- package/dist/steps/builtin/http-request.step.d.ts +18 -264
- package/dist/steps/builtin/http-request.step.d.ts.map +1 -1
- package/dist/steps/builtin/http-request.step.js +48 -157
- package/dist/steps/builtin/http-request.step.js.map +1 -1
- package/dist/steps/builtin/ssrf-guard.d.ts +9 -0
- package/dist/steps/builtin/ssrf-guard.d.ts.map +1 -0
- package/dist/steps/builtin/ssrf-guard.js +115 -0
- package/dist/steps/builtin/ssrf-guard.js.map +1 -0
- package/dist/steps/builtin/switch.step.d.ts +14 -14
- package/dist/steps/builtin/wait.step.d.ts +56 -56
- package/dist/steps/step-registry.d.ts +1 -3
- package/dist/steps/step-registry.d.ts.map +1 -1
- package/dist/steps/step-registry.js +0 -1
- package/dist/steps/step-registry.js.map +1 -1
- package/dist/testing/index.d.ts +1 -1
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +1 -1
- package/dist/testing/index.js.map +1 -1
- package/dist/testing/mock-step-context.d.ts +7 -2
- package/dist/testing/mock-step-context.d.ts.map +1 -1
- package/dist/testing/mock-step-context.js +9 -1
- package/dist/testing/mock-step-context.js.map +1 -1
- package/dist/triggers/webhook-trigger.d.ts +1 -5
- package/dist/triggers/webhook-trigger.d.ts.map +1 -1
- package/dist/triggers/webhook-trigger.js.map +1 -1
- package/package.json +7 -2
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { Action } from '../authz/types.js';
|
|
3
|
+
import type { ResourceAttributes } from '../authz/attributes.js';
|
|
4
|
+
export declare const CredentialStatusSchema: z.ZodEnum<["ACTIVE", "REVOKED"]>;
|
|
5
|
+
export type CredentialStatus = z.infer<typeof CredentialStatusSchema>;
|
|
6
|
+
export type CredentialFieldControl = 'password' | 'text' | 'url';
|
|
7
|
+
export interface CredentialRegistryInputField {
|
|
8
|
+
readonly key: string;
|
|
9
|
+
readonly label: string;
|
|
10
|
+
readonly control: CredentialFieldControl;
|
|
11
|
+
/** Optional example hint shown as the input's placeholder. */
|
|
12
|
+
readonly placeholder?: string;
|
|
13
|
+
}
|
|
14
|
+
export type CredentialRegistryEntryField = CredentialRegistryInputField;
|
|
15
|
+
interface CredentialRegistryEntryBase {
|
|
16
|
+
readonly label: string;
|
|
17
|
+
readonly fields: readonly CredentialRegistryEntryField[];
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Bearer token values.
|
|
21
|
+
*
|
|
22
|
+
* Runtime: `Authorization: Bearer <token>` is added to the request.
|
|
23
|
+
*/
|
|
24
|
+
export declare const BearerValuesSchema: z.ZodObject<{
|
|
25
|
+
token: z.ZodString;
|
|
26
|
+
}, "strict", z.ZodTypeAny, {
|
|
27
|
+
token: string;
|
|
28
|
+
}, {
|
|
29
|
+
token: string;
|
|
30
|
+
}>;
|
|
31
|
+
export type BearerValues = z.infer<typeof BearerValuesSchema>;
|
|
32
|
+
/**
|
|
33
|
+
* HTTP Basic authentication values.
|
|
34
|
+
*
|
|
35
|
+
* Runtime: `Authorization: Basic base64(username:password)` is added.
|
|
36
|
+
*/
|
|
37
|
+
export declare const BasicValuesSchema: z.ZodObject<{
|
|
38
|
+
username: z.ZodString;
|
|
39
|
+
password: z.ZodString;
|
|
40
|
+
}, "strict", z.ZodTypeAny, {
|
|
41
|
+
password: string;
|
|
42
|
+
username: string;
|
|
43
|
+
}, {
|
|
44
|
+
password: string;
|
|
45
|
+
username: string;
|
|
46
|
+
}>;
|
|
47
|
+
export type BasicValues = z.infer<typeof BasicValuesSchema>;
|
|
48
|
+
/**
|
|
49
|
+
* Custom header values.
|
|
50
|
+
*
|
|
51
|
+
* Runtime: a single header `<name>: <value>` is added to the request.
|
|
52
|
+
*/
|
|
53
|
+
export declare const CustomHeaderValuesSchema: z.ZodObject<{
|
|
54
|
+
name: z.ZodString;
|
|
55
|
+
value: z.ZodString;
|
|
56
|
+
}, "strict", z.ZodTypeAny, {
|
|
57
|
+
value: string;
|
|
58
|
+
name: string;
|
|
59
|
+
}, {
|
|
60
|
+
value: string;
|
|
61
|
+
name: string;
|
|
62
|
+
}>;
|
|
63
|
+
export type CustomHeaderValues = z.infer<typeof CustomHeaderValuesSchema>;
|
|
64
|
+
/**
|
|
65
|
+
* OAuth 2.0 client credentials values.
|
|
66
|
+
*/
|
|
67
|
+
export declare const OAuth2ClientCredentialsValuesSchema: z.ZodObject<{
|
|
68
|
+
tokenUrl: z.ZodString;
|
|
69
|
+
clientId: z.ZodString;
|
|
70
|
+
clientSecret: z.ZodString;
|
|
71
|
+
}, "strict", z.ZodTypeAny, {
|
|
72
|
+
tokenUrl: string;
|
|
73
|
+
clientId: string;
|
|
74
|
+
clientSecret: string;
|
|
75
|
+
}, {
|
|
76
|
+
tokenUrl: string;
|
|
77
|
+
clientId: string;
|
|
78
|
+
clientSecret: string;
|
|
79
|
+
}>;
|
|
80
|
+
export type OAuth2ClientCredentialsValues = z.infer<typeof OAuth2ClientCredentialsValuesSchema>;
|
|
81
|
+
/**
|
|
82
|
+
* Credential authentication is discriminated by `authType`, keeping each
|
|
83
|
+
* authentication type paired with its exact values shape.
|
|
84
|
+
*/
|
|
85
|
+
export declare const CredentialAuthSchema: z.ZodDiscriminatedUnion<"authType", [z.ZodObject<{
|
|
86
|
+
authType: z.ZodLiteral<"bearer">;
|
|
87
|
+
values: z.ZodObject<{
|
|
88
|
+
token: z.ZodString;
|
|
89
|
+
}, "strict", z.ZodTypeAny, {
|
|
90
|
+
token: string;
|
|
91
|
+
}, {
|
|
92
|
+
token: string;
|
|
93
|
+
}>;
|
|
94
|
+
}, "strict", z.ZodTypeAny, {
|
|
95
|
+
values: {
|
|
96
|
+
token: string;
|
|
97
|
+
};
|
|
98
|
+
authType: "bearer";
|
|
99
|
+
}, {
|
|
100
|
+
values: {
|
|
101
|
+
token: string;
|
|
102
|
+
};
|
|
103
|
+
authType: "bearer";
|
|
104
|
+
}>, z.ZodObject<{
|
|
105
|
+
authType: z.ZodLiteral<"basic">;
|
|
106
|
+
values: z.ZodObject<{
|
|
107
|
+
username: z.ZodString;
|
|
108
|
+
password: z.ZodString;
|
|
109
|
+
}, "strict", z.ZodTypeAny, {
|
|
110
|
+
password: string;
|
|
111
|
+
username: string;
|
|
112
|
+
}, {
|
|
113
|
+
password: string;
|
|
114
|
+
username: string;
|
|
115
|
+
}>;
|
|
116
|
+
}, "strict", z.ZodTypeAny, {
|
|
117
|
+
values: {
|
|
118
|
+
password: string;
|
|
119
|
+
username: string;
|
|
120
|
+
};
|
|
121
|
+
authType: "basic";
|
|
122
|
+
}, {
|
|
123
|
+
values: {
|
|
124
|
+
password: string;
|
|
125
|
+
username: string;
|
|
126
|
+
};
|
|
127
|
+
authType: "basic";
|
|
128
|
+
}>, z.ZodObject<{
|
|
129
|
+
authType: z.ZodLiteral<"custom_header">;
|
|
130
|
+
values: z.ZodObject<{
|
|
131
|
+
name: z.ZodString;
|
|
132
|
+
value: z.ZodString;
|
|
133
|
+
}, "strict", z.ZodTypeAny, {
|
|
134
|
+
value: string;
|
|
135
|
+
name: string;
|
|
136
|
+
}, {
|
|
137
|
+
value: string;
|
|
138
|
+
name: string;
|
|
139
|
+
}>;
|
|
140
|
+
}, "strict", z.ZodTypeAny, {
|
|
141
|
+
values: {
|
|
142
|
+
value: string;
|
|
143
|
+
name: string;
|
|
144
|
+
};
|
|
145
|
+
authType: "custom_header";
|
|
146
|
+
}, {
|
|
147
|
+
values: {
|
|
148
|
+
value: string;
|
|
149
|
+
name: string;
|
|
150
|
+
};
|
|
151
|
+
authType: "custom_header";
|
|
152
|
+
}>, z.ZodObject<{
|
|
153
|
+
authType: z.ZodLiteral<"oauth2_client_credentials">;
|
|
154
|
+
values: z.ZodObject<{
|
|
155
|
+
tokenUrl: z.ZodString;
|
|
156
|
+
clientId: z.ZodString;
|
|
157
|
+
clientSecret: z.ZodString;
|
|
158
|
+
}, "strict", z.ZodTypeAny, {
|
|
159
|
+
tokenUrl: string;
|
|
160
|
+
clientId: string;
|
|
161
|
+
clientSecret: string;
|
|
162
|
+
}, {
|
|
163
|
+
tokenUrl: string;
|
|
164
|
+
clientId: string;
|
|
165
|
+
clientSecret: string;
|
|
166
|
+
}>;
|
|
167
|
+
}, "strict", z.ZodTypeAny, {
|
|
168
|
+
values: {
|
|
169
|
+
tokenUrl: string;
|
|
170
|
+
clientId: string;
|
|
171
|
+
clientSecret: string;
|
|
172
|
+
};
|
|
173
|
+
authType: "oauth2_client_credentials";
|
|
174
|
+
}, {
|
|
175
|
+
values: {
|
|
176
|
+
tokenUrl: string;
|
|
177
|
+
clientId: string;
|
|
178
|
+
clientSecret: string;
|
|
179
|
+
};
|
|
180
|
+
authType: "oauth2_client_credentials";
|
|
181
|
+
}>]>;
|
|
182
|
+
export type CredentialAuth = z.infer<typeof CredentialAuthSchema>;
|
|
183
|
+
export type CredentialAuthType = CredentialAuth['authType'];
|
|
184
|
+
export type AuthSpecificValues = CredentialAuth['values'];
|
|
185
|
+
/**
|
|
186
|
+
* Per-auth-type value schemas, extracted from the discriminated union.
|
|
187
|
+
*/
|
|
188
|
+
export declare const CREDENTIAL_VALUE_SCHEMAS: Record<CredentialAuthType, z.ZodTypeAny>;
|
|
189
|
+
export declare function validateCredentialAuth(authType: CredentialAuthType, values: unknown): CredentialAuth;
|
|
190
|
+
export declare function validateCredentialValues(authType: CredentialAuthType, values: unknown): AuthSpecificValues;
|
|
191
|
+
export declare const CredentialNameSchema: z.ZodString;
|
|
192
|
+
export interface CredentialSummary {
|
|
193
|
+
readonly name: string;
|
|
194
|
+
readonly authType: CredentialAuthType;
|
|
195
|
+
readonly status: CredentialStatus;
|
|
196
|
+
readonly createdAt: number;
|
|
197
|
+
readonly updatedAt: number;
|
|
198
|
+
}
|
|
199
|
+
export type ResolvedCredential = Readonly<{
|
|
200
|
+
name: string;
|
|
201
|
+
status: CredentialStatus;
|
|
202
|
+
}> & Readonly<CredentialAuth>;
|
|
203
|
+
/**
|
|
204
|
+
* Apply an already-resolved credential to HTTP request headers.
|
|
205
|
+
*
|
|
206
|
+
* Credential resolution belongs to the executor/runtime. This shared helper
|
|
207
|
+
* only translates the validated credential value into its HTTP representation,
|
|
208
|
+
* so workflow steps and server-side credential testing use identical logic.
|
|
209
|
+
*/
|
|
210
|
+
export declare function applyResolvedCredentialAuth(headers: Headers, credential: ResolvedCredential): void;
|
|
211
|
+
export type CreateCredentialInput = Readonly<{
|
|
212
|
+
name: string;
|
|
213
|
+
}> & Readonly<CredentialAuth>;
|
|
214
|
+
export interface ReplaceCredentialValuesInput {
|
|
215
|
+
readonly values: AuthSpecificValues;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* One safe credential row returned by list operations.
|
|
219
|
+
*
|
|
220
|
+
* `summary` is the SDK-owned credential shape. `attributes` is the host-owned,
|
|
221
|
+
* typed metadata carried opaquely by the SDK. `permittedActions` is projected
|
|
222
|
+
* by the runtime so UIs can gate row actions without knowing host policy.
|
|
223
|
+
*/
|
|
224
|
+
export interface CredentialListItem {
|
|
225
|
+
readonly summary: CredentialSummary;
|
|
226
|
+
readonly attributes?: ResourceAttributes<'credential'>;
|
|
227
|
+
readonly permittedActions?: readonly Action[];
|
|
228
|
+
}
|
|
229
|
+
export interface CredentialListResponse {
|
|
230
|
+
readonly credentials: CredentialListItem[];
|
|
231
|
+
}
|
|
232
|
+
/** Safe request shape for testing a stored credential against an HTTP endpoint. */
|
|
233
|
+
export interface TestCredentialInput {
|
|
234
|
+
readonly url: string;
|
|
235
|
+
readonly method?: string;
|
|
236
|
+
readonly headers?: Record<string, string>;
|
|
237
|
+
readonly body?: string;
|
|
238
|
+
}
|
|
239
|
+
/** Redacted result of a server-side credential test. Secret values are never returned. */
|
|
240
|
+
export interface TestCredentialResult {
|
|
241
|
+
readonly ok: boolean;
|
|
242
|
+
readonly status?: number;
|
|
243
|
+
readonly statusText?: string;
|
|
244
|
+
readonly durationMs?: number;
|
|
245
|
+
readonly headers?: Record<string, string>;
|
|
246
|
+
readonly bodyText?: string;
|
|
247
|
+
readonly error?: string;
|
|
248
|
+
}
|
|
249
|
+
export interface CredentialRegistryEntry extends CredentialRegistryEntryBase {
|
|
250
|
+
readonly type: CredentialAuthType;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Minimal registry for host-rendered credential forms. Entries and field keys
|
|
254
|
+
* are extracted from CredentialAuthSchema; Zod remains the source of truth.
|
|
255
|
+
*/
|
|
256
|
+
export declare const CREDENTIAL_AUTH_REGISTRY: readonly CredentialRegistryEntry[];
|
|
257
|
+
export {};
|
|
258
|
+
//# sourceMappingURL=credentials.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../src/common/credentials.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAEjE,eAAO,MAAM,sBAAsB,kCAA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;AAcD;;;GAGG;AACH,eAAO,MAAM,wBAAwB,EAAE,SAAS,uBAAuB,EAKlE,CAAC"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const CredentialStatusSchema = z.enum(['ACTIVE', 'REVOKED']);
|
|
3
|
+
const credentialFieldMetadata = new WeakMap();
|
|
4
|
+
function credentialField(schema, metadata) {
|
|
5
|
+
const describedSchema = schema.describe(metadata.label);
|
|
6
|
+
credentialFieldMetadata.set(describedSchema, metadata);
|
|
7
|
+
return describedSchema;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Bearer token values.
|
|
11
|
+
*
|
|
12
|
+
* Runtime: `Authorization: Bearer <token>` is added to the request.
|
|
13
|
+
*/
|
|
14
|
+
export const BearerValuesSchema = z
|
|
15
|
+
.object({
|
|
16
|
+
token: credentialField(z.string().min(1), {
|
|
17
|
+
label: 'Token',
|
|
18
|
+
control: 'password',
|
|
19
|
+
}),
|
|
20
|
+
})
|
|
21
|
+
.strict();
|
|
22
|
+
/**
|
|
23
|
+
* HTTP Basic authentication values.
|
|
24
|
+
*
|
|
25
|
+
* Runtime: `Authorization: Basic base64(username:password)` is added.
|
|
26
|
+
*/
|
|
27
|
+
export const BasicValuesSchema = z
|
|
28
|
+
.object({
|
|
29
|
+
username: credentialField(z.string().min(1), {
|
|
30
|
+
label: 'Username',
|
|
31
|
+
control: 'text',
|
|
32
|
+
}),
|
|
33
|
+
password: credentialField(z.string().min(1), {
|
|
34
|
+
label: 'Password',
|
|
35
|
+
control: 'password',
|
|
36
|
+
}),
|
|
37
|
+
})
|
|
38
|
+
.strict();
|
|
39
|
+
/**
|
|
40
|
+
* Custom header values.
|
|
41
|
+
*
|
|
42
|
+
* Runtime: a single header `<name>: <value>` is added to the request.
|
|
43
|
+
*/
|
|
44
|
+
export const CustomHeaderValuesSchema = z
|
|
45
|
+
.object({
|
|
46
|
+
name: credentialField(z.string().min(1), {
|
|
47
|
+
label: 'Header name',
|
|
48
|
+
control: 'text',
|
|
49
|
+
placeholder: 'e.g. X-Custom-Token',
|
|
50
|
+
}),
|
|
51
|
+
value: credentialField(z.string().min(1), {
|
|
52
|
+
label: 'Header value',
|
|
53
|
+
control: 'password',
|
|
54
|
+
placeholder: 'The header value to send',
|
|
55
|
+
}),
|
|
56
|
+
})
|
|
57
|
+
.strict();
|
|
58
|
+
/**
|
|
59
|
+
* OAuth 2.0 client credentials values.
|
|
60
|
+
*/
|
|
61
|
+
export const OAuth2ClientCredentialsValuesSchema = z
|
|
62
|
+
.object({
|
|
63
|
+
tokenUrl: credentialField(z.string().url(), {
|
|
64
|
+
label: 'Token URL',
|
|
65
|
+
control: 'url',
|
|
66
|
+
}),
|
|
67
|
+
clientId: credentialField(z.string().min(1), {
|
|
68
|
+
label: 'Client ID',
|
|
69
|
+
control: 'text',
|
|
70
|
+
}),
|
|
71
|
+
clientSecret: credentialField(z.string().min(1), {
|
|
72
|
+
label: 'Client Secret',
|
|
73
|
+
control: 'password',
|
|
74
|
+
}),
|
|
75
|
+
})
|
|
76
|
+
.strict();
|
|
77
|
+
const BearerCredentialAuthSchema = z
|
|
78
|
+
.object({
|
|
79
|
+
authType: z.literal('bearer'),
|
|
80
|
+
values: BearerValuesSchema,
|
|
81
|
+
})
|
|
82
|
+
.strict()
|
|
83
|
+
.describe('Bearer Token');
|
|
84
|
+
const BasicCredentialAuthSchema = z
|
|
85
|
+
.object({
|
|
86
|
+
authType: z.literal('basic'),
|
|
87
|
+
values: BasicValuesSchema,
|
|
88
|
+
})
|
|
89
|
+
.strict()
|
|
90
|
+
.describe('Basic Auth');
|
|
91
|
+
const CustomHeaderCredentialAuthSchema = z
|
|
92
|
+
.object({
|
|
93
|
+
authType: z.literal('custom_header'),
|
|
94
|
+
values: CustomHeaderValuesSchema,
|
|
95
|
+
})
|
|
96
|
+
.strict()
|
|
97
|
+
.describe('Custom Header');
|
|
98
|
+
const OAuth2ClientCredentialsCredentialAuthSchema = z
|
|
99
|
+
.object({
|
|
100
|
+
authType: z.literal('oauth2_client_credentials'),
|
|
101
|
+
values: OAuth2ClientCredentialsValuesSchema,
|
|
102
|
+
})
|
|
103
|
+
.strict()
|
|
104
|
+
.describe('OAuth 2.0 Client Credentials');
|
|
105
|
+
/**
|
|
106
|
+
* Credential authentication is discriminated by `authType`, keeping each
|
|
107
|
+
* authentication type paired with its exact values shape.
|
|
108
|
+
*/
|
|
109
|
+
export const CredentialAuthSchema = z.discriminatedUnion('authType', [
|
|
110
|
+
BearerCredentialAuthSchema,
|
|
111
|
+
BasicCredentialAuthSchema,
|
|
112
|
+
CustomHeaderCredentialAuthSchema,
|
|
113
|
+
OAuth2ClientCredentialsCredentialAuthSchema,
|
|
114
|
+
]);
|
|
115
|
+
/**
|
|
116
|
+
* Per-auth-type value schemas, extracted from the discriminated union.
|
|
117
|
+
*/
|
|
118
|
+
export const CREDENTIAL_VALUE_SCHEMAS = Object.fromEntries(CredentialAuthSchema.options.map((option) => [
|
|
119
|
+
option.shape.authType.value,
|
|
120
|
+
option.shape.values,
|
|
121
|
+
]));
|
|
122
|
+
export function validateCredentialAuth(authType, values) {
|
|
123
|
+
return CredentialAuthSchema.parse({ authType, values });
|
|
124
|
+
}
|
|
125
|
+
export function validateCredentialValues(authType, values) {
|
|
126
|
+
return validateCredentialAuth(authType, values).values;
|
|
127
|
+
}
|
|
128
|
+
export const CredentialNameSchema = z.string().min(1).max(255);
|
|
129
|
+
/**
|
|
130
|
+
* Apply an already-resolved credential to HTTP request headers.
|
|
131
|
+
*
|
|
132
|
+
* Credential resolution belongs to the executor/runtime. This shared helper
|
|
133
|
+
* only translates the validated credential value into its HTTP representation,
|
|
134
|
+
* so workflow steps and server-side credential testing use identical logic.
|
|
135
|
+
*/
|
|
136
|
+
export function applyResolvedCredentialAuth(headers, credential) {
|
|
137
|
+
switch (credential.authType) {
|
|
138
|
+
case 'bearer': {
|
|
139
|
+
const { token } = credential.values;
|
|
140
|
+
headers.set('authorization', `Bearer ${token}`);
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
case 'basic': {
|
|
144
|
+
const { username, password } = credential.values;
|
|
145
|
+
headers.set('authorization', `Basic ${btoa(`${username}:${password}`)}`);
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
148
|
+
case 'custom_header': {
|
|
149
|
+
const { name, value } = credential.values;
|
|
150
|
+
headers.set(name, value);
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
case 'oauth2_client_credentials': {
|
|
154
|
+
throw new Error('oauth2_client_credentials is not yet supported for HTTP requests');
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
function extractRegistryFields(schema) {
|
|
159
|
+
return Object.entries(schema.shape).map(([key, fieldSchema]) => {
|
|
160
|
+
const metadata = credentialFieldMetadata.get(fieldSchema);
|
|
161
|
+
if (!metadata) {
|
|
162
|
+
throw new Error(`Credential field "${key}" is missing UI metadata`);
|
|
163
|
+
}
|
|
164
|
+
return { key, ...metadata };
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Minimal registry for host-rendered credential forms. Entries and field keys
|
|
169
|
+
* are extracted from CredentialAuthSchema; Zod remains the source of truth.
|
|
170
|
+
*/
|
|
171
|
+
export const CREDENTIAL_AUTH_REGISTRY = CredentialAuthSchema.options.map((option) => ({
|
|
172
|
+
type: option.shape.authType.value,
|
|
173
|
+
label: option.description ?? option.shape.authType.value,
|
|
174
|
+
fields: extractRegistryFields(option.shape.values),
|
|
175
|
+
}));
|
|
176
|
+
//# sourceMappingURL=credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credentials.js","sourceRoot":"","sources":["../../src/common/credentials.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,SAAS,CAAC,C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;GAGG;AACH,MAAM,CAAC,MAAM,wBAAwB,GACnC,oBAAoB,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAC5C,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK;IACjC,KAAK,EAAE,MAAM,CAAC,WAAW,IAAI,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK;IACxD,MAAM,EAAE,qBAAqB,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC;CACnD,CAAC,CAAC,CAAC"}
|
package/dist/common/index.d.ts
CHANGED
|
@@ -9,10 +9,14 @@
|
|
|
9
9
|
* - {@link CitationRef} — runtime, agent-emitted provenance for one data point
|
|
10
10
|
* - {@link ResumePayload} / {@link ResumeAttachment} / {@link ResumeAction} — pause/resume contract
|
|
11
11
|
* - {@link isExecutable}, {@link extensionOf} — upload safety check used at both perimeter and UI
|
|
12
|
+
* - Credential vault schemas, types, and the minimal auth-type registry —
|
|
13
|
+
* shared between the server (SDK router + persistence), the workflow-ui
|
|
14
|
+
* credential dropdown, and the xyne-search frontend credential management
|
|
15
|
+
* page. All of these imports are browser-safe (only `zod` is required).
|
|
12
16
|
*
|
|
13
17
|
* The main `@xyne/workflow-sdk` barrel still re-exports these for
|
|
14
18
|
* server-side use; UI / builder code should import from here so that
|
|
15
|
-
* Node-only modules (
|
|
19
|
+
* Node-only modules (persistence runtimes, DNS/socket APIs) stay out of the
|
|
16
20
|
* browser bundle.
|
|
17
21
|
*/
|
|
18
22
|
export type { Attachment } from './attachment.js';
|
|
@@ -24,4 +28,6 @@ export { validateTriggerPayload } from './validate-payload.js';
|
|
|
24
28
|
export type { ResumePayload, ResumeAttachment, ResumeAction, } from './resume-payload.js';
|
|
25
29
|
export { isExecutable, extensionOf, BLOCKED_EXECUTABLE_MIME_TYPES, BLOCKED_EXECUTABLE_EXTENSIONS, } from './executable-check.js';
|
|
26
30
|
export { recordKey, framePrefix, leafStepId } from '../engine/node-path.js';
|
|
31
|
+
export type { CredentialStatus, CredentialAuthType, BearerValues, BasicValues, CustomHeaderValues, OAuth2ClientCredentialsValues, CredentialAuth, AuthSpecificValues, CredentialSummary, ResolvedCredential, CreateCredentialInput, ReplaceCredentialValuesInput, CredentialListItem, CredentialListResponse, TestCredentialInput, TestCredentialResult, CredentialFieldControl, CredentialRegistryInputField, CredentialRegistryEntryField, CredentialRegistryEntry, } from './credentials.js';
|
|
32
|
+
export { CredentialStatusSchema, BearerValuesSchema, BasicValuesSchema, CustomHeaderValuesSchema, OAuth2ClientCredentialsValuesSchema, CredentialAuthSchema, CREDENTIAL_VALUE_SCHEMAS, validateCredentialAuth, validateCredentialValues, applyResolvedCredentialAuth, CredentialNameSchema, CREDENTIAL_AUTH_REGISTRY, } from './credentials.js';
|
|
27
33
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,YAAY,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,sBAAsB,EACtB,4BAA4B,EAC5B,oBAAoB,EACpB,YAAY,EACZ,YAAY,EACZ,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,WAAW,EACX,OAAO,EACP,WAAW,EACX,WAAW,EACX,eAAe,EACf,cAAc,EACd,WAAW,GACZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,wBAAwB,EACxB,wBAAwB,EACxB,oBAAoB,EACpB,aAAa,EACb,aAAa,EACb,kBAAkB,GACnB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,YAAY,EACV,aAAa,EACb,gBAAgB,EAChB,YAAY,GACb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,YAAY,EACZ,WAAW,EACX,6BAA6B,EAC7B,6BAA6B,GAC9B,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAG5E,YAAY,EAEV,gBAAgB,EAChB,kBAAkB,EAGlB,YAAY,EACZ,WAAW,EACX,kBAAkB,EAClB,6BAA6B,EAE7B,cAAc,EACd,kBAAkB,EAIlB,iBAAiB,EACjB,kBAAkB,EAClB,qBAAqB,EACrB,4BAA4B,EAC5B,kBAAkB,EAClB,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,EAGpB,sBAAsB,EACtB,4BAA4B,EAC5B,4BAA4B,EAC5B,uBAAuB,GACxB,MAAM,kBAAkB,CAAC;AAI1B,OAAO,EAEL,sBAAsB,EAGtB,kBAAkB,EAClB,iBAAiB,EACjB,wBAAwB,EACxB,mCAAmC,EACnC,oBAAoB,EAIpB,wBAAwB,EAGxB,sBAAsB,EACtB,wBAAwB,EACxB,2BAA2B,EAG3B,oBAAoB,EAGpB,wBAAwB,GACzB,MAAM,kBAAkB,CAAC"}
|
package/dist/common/index.js
CHANGED
|
@@ -9,10 +9,14 @@
|
|
|
9
9
|
* - {@link CitationRef} — runtime, agent-emitted provenance for one data point
|
|
10
10
|
* - {@link ResumePayload} / {@link ResumeAttachment} / {@link ResumeAction} — pause/resume contract
|
|
11
11
|
* - {@link isExecutable}, {@link extensionOf} — upload safety check used at both perimeter and UI
|
|
12
|
+
* - Credential vault schemas, types, and the minimal auth-type registry —
|
|
13
|
+
* shared between the server (SDK router + persistence), the workflow-ui
|
|
14
|
+
* credential dropdown, and the xyne-search frontend credential management
|
|
15
|
+
* page. All of these imports are browser-safe (only `zod` is required).
|
|
12
16
|
*
|
|
13
17
|
* The main `@xyne/workflow-sdk` barrel still re-exports these for
|
|
14
18
|
* server-side use; UI / builder code should import from here so that
|
|
15
|
-
* Node-only modules (
|
|
19
|
+
* Node-only modules (persistence runtimes, DNS/socket APIs) stay out of the
|
|
16
20
|
* browser bundle.
|
|
17
21
|
*/
|
|
18
22
|
export { AttachmentSchema, ATTACHMENT_FORMAT, ATTACHMENT_JSON_SCHEMA, ATTACHMENT_ARRAY_JSON_SCHEMA, markAttachmentFields, isAttachment, mimeAccepted, attachmentProperty, } from './attachment.js';
|
|
@@ -22,4 +26,18 @@ export { isExecutable, extensionOf, BLOCKED_EXECUTABLE_MIME_TYPES, BLOCKED_EXECU
|
|
|
22
26
|
// Node-path addressing for step records — pure string utilities (no Node deps),
|
|
23
27
|
// used by the execution viewer / approvals UI to map node-path keys ↔ config ids.
|
|
24
28
|
export { recordKey, framePrefix, leafStepId } from '../engine/node-path.js';
|
|
29
|
+
// ── Runtime value exports (Zod schemas, registry, validation helper) ──
|
|
30
|
+
export {
|
|
31
|
+
// ─ Status & auth type Zod schemas ──
|
|
32
|
+
CredentialStatusSchema,
|
|
33
|
+
// ─ Per-auth-type Zod value schemas ──
|
|
34
|
+
BearerValuesSchema, BasicValuesSchema, CustomHeaderValuesSchema, OAuth2ClientCredentialsValuesSchema, CredentialAuthSchema,
|
|
35
|
+
// ─ Value schema registry (runtime validation) ──
|
|
36
|
+
CREDENTIAL_VALUE_SCHEMAS,
|
|
37
|
+
// ─ Validation helper ──
|
|
38
|
+
validateCredentialAuth, validateCredentialValues, applyResolvedCredentialAuth,
|
|
39
|
+
// ─ Credential name schema ──
|
|
40
|
+
CredentialNameSchema,
|
|
41
|
+
// ─ The minimal auth-type registry ──
|
|
42
|
+
CREDENTIAL_AUTH_REGISTRY, } from './credentials.js';
|
|
25
43
|
//# sourceMappingURL=index.js.map
|
package/dist/common/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,sBAAsB,EACtB,4BAA4B,EAC5B,oBAAoB,EACpB,YAAY,EACZ,YAAY,EACZ,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AAUzB,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,wBAAwB,EACxB,wBAAwB,EACxB,oBAAoB,EACpB,aAAa,EACb,aAAa,EACb,kBAAkB,GACnB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAM/D,OAAO,EACL,YAAY,EACZ,WAAW,EACX,6BAA6B,EAC7B,6BAA6B,GAC9B,MAAM,uBAAuB,CAAC;AAC/B,gFAAgF;AAChF,kFAAkF;AAClF,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAmC5E,yEAAyE;AAEzE,OAAO;AACL,sCAAsC;AACtC,sBAAsB;AAEtB,uCAAuC;AACvC,kBAAkB,EAClB,iBAAiB,EACjB,wBAAwB,EACxB,mCAAmC,EACnC,oBAAoB;AAEpB,kDAAkD;AAElD,wBAAwB;AAExB,yBAAyB;AACzB,sBAAsB,EACtB,wBAAwB,EACxB,2BAA2B;AAE3B,8BAA8B;AAC9B,oBAAoB;AAEpB,sCAAsC;AACtC,wBAAwB,GACzB,MAAM,kBAAkB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-executor.d.ts","sourceRoot":"","sources":["../../src/engine/workflow-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ACzB,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE;QACR,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC1C,gBAAgB,CAAC,EAAE,OAAO,CAAC;KAC5B,GACA,OAAO,CAAC,MAAM,CAAC;YA0HJ,WAAW;IAmDzB;;;;;;;;;;;;OAYG;YACW,SAAS;IA2LvB,8EAA8E;YAChE,WAAW;YAiBX,oBAAoB;IAgClC;;;;;OAKG;YACW,WAAW;YA2HX,gBAAgB;CAuH/B"}
|
|
@@ -609,7 +609,7 @@ export class WorkflowExecutor {
|
|
|
609
609
|
throw new Error(`Step "${step.id}" (${step.type}) config validation failed:\n${formatZodErrors(parsed.error)}`);
|
|
610
610
|
}
|
|
611
611
|
this.log.info(`step ${callCtx.isResuming ? 'RESUME' : 'START'} id=${step.id} type=${step.type}`);
|
|
612
|
-
const stepCtx = await this.buildStepContext(context, { ...callCtx, stepId: step.id, rawConfig: step.config }, stepImpl);
|
|
612
|
+
const stepCtx = await this.buildStepContext(context, { ...callCtx, stepId: step.id, rawConfig: step.config }, stepImpl, undefined, parsed.data);
|
|
613
613
|
const output = await controlImpl.execute(parsed.data, {
|
|
614
614
|
...stepCtx,
|
|
615
615
|
walkBranch: (branchSteps, branchScope, branchKey, iter) => this.walkScope(branchSteps, branchScope, framePrefix(prefix, step.id, branchKey ?? 'default', iter ?? 0), walkCtx),
|
|
@@ -638,7 +638,7 @@ export class WorkflowExecutor {
|
|
|
638
638
|
};
|
|
639
639
|
const actionImpl = stepImpl;
|
|
640
640
|
const resumePayload = resumeData?.['resumePayload'];
|
|
641
|
-
const stepCtx = await this.buildStepContext(context, { ...callCtx, stepId: step.id, rawConfig: baseConfig }, stepImpl, resumePayload);
|
|
641
|
+
const stepCtx = await this.buildStepContext(context, { ...callCtx, stepId: step.id, rawConfig: baseConfig }, stepImpl, resumePayload, resolvedInput);
|
|
642
642
|
this.log.info(`step ${callCtx.isResuming ? 'RESUME' : 'START'} id=${step.id} type=${step.type}`);
|
|
643
643
|
try {
|
|
644
644
|
let output;
|
|
@@ -671,19 +671,33 @@ export class WorkflowExecutor {
|
|
|
671
671
|
throw err;
|
|
672
672
|
}
|
|
673
673
|
}
|
|
674
|
-
async buildStepContext(context, callCtx, stepImpl, resumePayload) {
|
|
675
|
-
// Resolve credentials if step declares credentialSlots
|
|
674
|
+
async buildStepContext(context, callCtx, stepImpl, resumePayload, resolvedConfig) {
|
|
676
675
|
const credentials = {};
|
|
677
676
|
if (stepImpl.credentialSlots && stepImpl.credentialSlots.length > 0) {
|
|
678
677
|
for (const slot of stepImpl.credentialSlots) {
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
678
|
+
const configuredName = resolvedConfig?.[slot.name];
|
|
679
|
+
if (configuredName === undefined ||
|
|
680
|
+
configuredName === null ||
|
|
681
|
+
configuredName === '') {
|
|
682
|
+
if (slot.required) {
|
|
683
|
+
throw new Error(`Required credential slot "${slot.name}" is not configured`);
|
|
684
|
+
}
|
|
685
|
+
continue;
|
|
686
|
+
}
|
|
687
|
+
if (typeof configuredName !== 'string') {
|
|
688
|
+
throw new Error(`Credential slot "${slot.name}" must resolve to a credential name`);
|
|
689
|
+
}
|
|
690
|
+
// Pass the running workflow so the adapter can identify and verify the
|
|
691
|
+
// workspace in which this execution is taking place.
|
|
692
|
+
const resolved = await this.persistence.resolveCredential(context.workflow, configuredName);
|
|
682
693
|
if (resolved) {
|
|
683
694
|
credentials[slot.name] = resolved;
|
|
684
695
|
}
|
|
685
696
|
else if (slot.required) {
|
|
686
|
-
throw new Error(`Required credential "${
|
|
697
|
+
throw new Error(`Required credential "${configuredName}" not found`);
|
|
698
|
+
}
|
|
699
|
+
else {
|
|
700
|
+
throw new Error(`Credential "${configuredName}" not found or revoked`);
|
|
687
701
|
}
|
|
688
702
|
}
|
|
689
703
|
}
|
|
@@ -693,7 +707,7 @@ export class WorkflowExecutor {
|
|
|
693
707
|
const metadata = resumePayload
|
|
694
708
|
? { ...context.workflow.metadata, resumePayload }
|
|
695
709
|
: context.workflow.metadata;
|
|
696
|
-
|
|
710
|
+
const stepContext = {
|
|
697
711
|
workflow: context,
|
|
698
712
|
runtime: {
|
|
699
713
|
executionId: callCtx.executionId,
|
|
@@ -741,6 +755,7 @@ export class WorkflowExecutor {
|
|
|
741
755
|
},
|
|
742
756
|
log: this.log,
|
|
743
757
|
};
|
|
758
|
+
return stepContext;
|
|
744
759
|
}
|
|
745
760
|
}
|
|
746
761
|
// ─── Helpers ───
|