@flarcos/arazzo-sdk 0.1.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/CHANGELOG.md +13 -0
- package/README.md +252 -0
- package/dist/cli.d.ts +11 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +212 -0
- package/dist/cli.js.map +1 -0
- package/dist/generated/open-payments-client.d.ts +283 -0
- package/dist/generated/open-payments-client.d.ts.map +1 -0
- package/dist/generated/open-payments-client.js +1588 -0
- package/dist/generated/open-payments-client.js.map +1 -0
- package/dist/generator/codegen.d.ts +32 -0
- package/dist/generator/codegen.d.ts.map +1 -0
- package/dist/generator/codegen.js +127 -0
- package/dist/generator/codegen.js.map +1 -0
- package/dist/generator/templates.d.ts +27 -0
- package/dist/generator/templates.d.ts.map +1 -0
- package/dist/generator/templates.js +154 -0
- package/dist/generator/templates.js.map +1 -0
- package/dist/generator/type-mapper.d.ts +35 -0
- package/dist/generator/type-mapper.d.ts.map +1 -0
- package/dist/generator/type-mapper.js +145 -0
- package/dist/generator/type-mapper.js.map +1 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/dist/parser/arazzo-parser.d.ts +38 -0
- package/dist/parser/arazzo-parser.d.ts.map +1 -0
- package/dist/parser/arazzo-parser.js +162 -0
- package/dist/parser/arazzo-parser.js.map +1 -0
- package/dist/parser/types.d.ts +115 -0
- package/dist/parser/types.d.ts.map +1 -0
- package/dist/parser/types.js +10 -0
- package/dist/parser/types.js.map +1 -0
- package/dist/runtime/expression-resolver.d.ts +59 -0
- package/dist/runtime/expression-resolver.d.ts.map +1 -0
- package/dist/runtime/expression-resolver.js +180 -0
- package/dist/runtime/expression-resolver.js.map +1 -0
- package/dist/runtime/http-client.d.ts +47 -0
- package/dist/runtime/http-client.d.ts.map +1 -0
- package/dist/runtime/http-client.js +126 -0
- package/dist/runtime/http-client.js.map +1 -0
- package/dist/runtime/types.d.ts +109 -0
- package/dist/runtime/types.d.ts.map +1 -0
- package/dist/runtime/types.js +7 -0
- package/dist/runtime/types.js.map +1 -0
- package/dist/runtime/workflow-executor.d.ts +33 -0
- package/dist/runtime/workflow-executor.d.ts.map +1 -0
- package/dist/runtime/workflow-executor.js +506 -0
- package/dist/runtime/workflow-executor.js.map +1 -0
- package/package.json +57 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP Client
|
|
3
|
+
*
|
|
4
|
+
* Pluggable HTTP client with GNAP authentication integration.
|
|
5
|
+
* Uses the native fetch API with support for auth header injection
|
|
6
|
+
* and HTTP message signatures.
|
|
7
|
+
*/
|
|
8
|
+
import type { HttpClient, HttpRequest, HttpResponse, AuthProvider, GnapAuthConfig } from './types.js';
|
|
9
|
+
export declare class FetchHttpClient implements HttpClient {
|
|
10
|
+
private authProvider?;
|
|
11
|
+
constructor(authProvider?: AuthProvider);
|
|
12
|
+
execute(request: HttpRequest): Promise<HttpResponse>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Auth provider that integrates with @flarcos/kiota-authentication-gnap
|
|
16
|
+
* for GNAP token management and HTTP message signatures.
|
|
17
|
+
*/
|
|
18
|
+
export declare class GnapAuthProvider implements AuthProvider {
|
|
19
|
+
private tokens;
|
|
20
|
+
private config;
|
|
21
|
+
constructor(config: GnapAuthConfig);
|
|
22
|
+
/**
|
|
23
|
+
* Set the access token for a specific source/context.
|
|
24
|
+
*/
|
|
25
|
+
setToken(sourceName: string, token: string): void;
|
|
26
|
+
/**
|
|
27
|
+
* Set token by operation type for convenience.
|
|
28
|
+
*/
|
|
29
|
+
setTokenForOperation(operationPrefix: string, token: string): void;
|
|
30
|
+
getAuthHeader(sourceName: string, _operationId: string): Promise<string | undefined>;
|
|
31
|
+
signRequest(request: HttpRequest): Promise<HttpRequest>;
|
|
32
|
+
/**
|
|
33
|
+
* Get the GNAP client wallet address for grant requests.
|
|
34
|
+
*/
|
|
35
|
+
getClientWalletAddress(): string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Simple auth provider that uses static bearer tokens.
|
|
39
|
+
* Useful for testing or when tokens are managed externally.
|
|
40
|
+
*/
|
|
41
|
+
export declare class BearerAuthProvider implements AuthProvider {
|
|
42
|
+
private tokens;
|
|
43
|
+
constructor(defaultToken?: string);
|
|
44
|
+
setToken(sourceName: string, token: string): void;
|
|
45
|
+
getAuthHeader(sourceName: string, _operationId: string): Promise<string | undefined>;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=http-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-client.d.ts","sourceRoot":"","sources":["../../src/runtime/http-client.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,cAAc,EACf,MAAM,YAAY,CAAC;AAIpB,qBAAa,eAAgB,YAAW,UAAU;IAChD,OAAO,CAAC,YAAY,CAAC,CAAe;gBAExB,YAAY,CAAC,EAAE,YAAY;IAIjC,OAAO,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC;CAiD3D;AAID;;;GAGG;AACH,qBAAa,gBAAiB,YAAW,YAAY;IACnD,OAAO,CAAC,MAAM,CAAkC;IAChD,OAAO,CAAC,MAAM,CAAiB;gBAEnB,MAAM,EAAE,cAAc;IAIlC;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAIjD;;OAEG;IACH,oBAAoB,CAAC,eAAe,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAI5D,aAAa,CACjB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAQxB,WAAW,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IAc7D;;OAEG;IACH,sBAAsB,IAAI,MAAM;CAGjC;AAID;;;GAGG;AACH,qBAAa,kBAAmB,YAAW,YAAY;IACrD,OAAO,CAAC,MAAM,CAAkC;gBAEpC,YAAY,CAAC,EAAE,MAAM;IAMjC,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAI3C,aAAa,CACjB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;CAG/B"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP Client
|
|
3
|
+
*
|
|
4
|
+
* Pluggable HTTP client with GNAP authentication integration.
|
|
5
|
+
* Uses the native fetch API with support for auth header injection
|
|
6
|
+
* and HTTP message signatures.
|
|
7
|
+
*/
|
|
8
|
+
// ─── Default Fetch-Based HTTP Client ───
|
|
9
|
+
export class FetchHttpClient {
|
|
10
|
+
authProvider;
|
|
11
|
+
constructor(authProvider) {
|
|
12
|
+
this.authProvider = authProvider;
|
|
13
|
+
}
|
|
14
|
+
async execute(request) {
|
|
15
|
+
let finalRequest = { ...request };
|
|
16
|
+
// Apply auth if provider is configured
|
|
17
|
+
if (this.authProvider) {
|
|
18
|
+
// Sign request if the auth provider supports full request signing
|
|
19
|
+
if (this.authProvider.signRequest) {
|
|
20
|
+
finalRequest = await this.authProvider.signRequest(finalRequest);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
const fetchOptions = {
|
|
24
|
+
method: finalRequest.method,
|
|
25
|
+
headers: finalRequest.headers,
|
|
26
|
+
};
|
|
27
|
+
if (finalRequest.body !== undefined) {
|
|
28
|
+
fetchOptions.body = JSON.stringify(finalRequest.body);
|
|
29
|
+
}
|
|
30
|
+
const response = await fetch(finalRequest.url, fetchOptions);
|
|
31
|
+
// Parse response headers
|
|
32
|
+
const headers = {};
|
|
33
|
+
response.headers.forEach((value, key) => {
|
|
34
|
+
headers[key] = value;
|
|
35
|
+
});
|
|
36
|
+
// Parse response body
|
|
37
|
+
let body;
|
|
38
|
+
const contentType = response.headers.get('content-type') || '';
|
|
39
|
+
if (contentType.includes('application/json')) {
|
|
40
|
+
body = await response.json();
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
const text = await response.text();
|
|
44
|
+
// Try to parse as JSON anyway
|
|
45
|
+
try {
|
|
46
|
+
body = JSON.parse(text);
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
body = text;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
status: response.status,
|
|
54
|
+
headers,
|
|
55
|
+
body,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
// ─── GNAP Auth Provider ───
|
|
60
|
+
/**
|
|
61
|
+
* Auth provider that integrates with @flarcos/kiota-authentication-gnap
|
|
62
|
+
* for GNAP token management and HTTP message signatures.
|
|
63
|
+
*/
|
|
64
|
+
export class GnapAuthProvider {
|
|
65
|
+
tokens = new Map();
|
|
66
|
+
config;
|
|
67
|
+
constructor(config) {
|
|
68
|
+
this.config = config;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Set the access token for a specific source/context.
|
|
72
|
+
*/
|
|
73
|
+
setToken(sourceName, token) {
|
|
74
|
+
this.tokens.set(sourceName, token);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Set token by operation type for convenience.
|
|
78
|
+
*/
|
|
79
|
+
setTokenForOperation(operationPrefix, token) {
|
|
80
|
+
this.tokens.set(operationPrefix, token);
|
|
81
|
+
}
|
|
82
|
+
async getAuthHeader(sourceName, _operationId) {
|
|
83
|
+
const token = this.tokens.get(sourceName);
|
|
84
|
+
if (token) {
|
|
85
|
+
return `GNAP ${token}`;
|
|
86
|
+
}
|
|
87
|
+
return undefined;
|
|
88
|
+
}
|
|
89
|
+
async signRequest(request) {
|
|
90
|
+
const headers = { ...request.headers };
|
|
91
|
+
// Find matching token by checking source names
|
|
92
|
+
for (const [_source, token] of this.tokens) {
|
|
93
|
+
if (token) {
|
|
94
|
+
headers['Authorization'] = `GNAP ${token}`;
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return { ...request, headers };
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Get the GNAP client wallet address for grant requests.
|
|
102
|
+
*/
|
|
103
|
+
getClientWalletAddress() {
|
|
104
|
+
return this.config.clientWalletAddress;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
// ─── Simple Bearer Auth Provider ───
|
|
108
|
+
/**
|
|
109
|
+
* Simple auth provider that uses static bearer tokens.
|
|
110
|
+
* Useful for testing or when tokens are managed externally.
|
|
111
|
+
*/
|
|
112
|
+
export class BearerAuthProvider {
|
|
113
|
+
tokens = new Map();
|
|
114
|
+
constructor(defaultToken) {
|
|
115
|
+
if (defaultToken) {
|
|
116
|
+
this.tokens.set('*', defaultToken);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
setToken(sourceName, token) {
|
|
120
|
+
this.tokens.set(sourceName, token);
|
|
121
|
+
}
|
|
122
|
+
async getAuthHeader(sourceName, _operationId) {
|
|
123
|
+
return this.tokens.get(sourceName) || this.tokens.get('*');
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=http-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-client.js","sourceRoot":"","sources":["../../src/runtime/http-client.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAUH,0CAA0C;AAE1C,MAAM,OAAO,eAAe;IAClB,YAAY,CAAgB;IAEpC,YAAY,YAA2B;QACrC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,OAAoB;QAChC,IAAI,YAAY,GAAG,EAAE,G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,GAAG,OAAO,EAAE,OAAO,EAAE,CAAC;IACjC,CAAC;IAED;;OAEG;IACH,sBAAsB;QACpB,OAAO,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC;IACzC,CAAC;CACF;AAED,sCAAsC;AAEtC;;;GAGG;AACH,MAAM,OAAO,kBAAkB;IACrB,MAAM,GAAwB,IAAI,GAAG,EAAE,CAAC;IAEhD,YAAY,YAAqB;QAC/B,IAAI,YAAY,EAAE,CAAC;YACjB,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;QACrC,CAAC;IACH,CAAC;IAED,QAAQ,CAAC,UAAkB,EAAE,KAAa;QACxC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;IACrC,CAAC;IAED,KAAK,CAAC,aAAa,CACjB,UAAkB,EAClB,YAAoB;QAEpB,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC7D,CAAC;CACF"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* Types used by the workflow executor and HTTP client at runtime.
|
|
5
|
+
*/
|
|
6
|
+
export interface WorkflowExecutionOptions {
|
|
7
|
+
/** Input values for the workflow */
|
|
8
|
+
inputs: Record<string, unknown>;
|
|
9
|
+
/** Base URLs for source descriptions (name → baseUrl) */
|
|
10
|
+
serverUrls: Record<string, string>;
|
|
11
|
+
/** Auth token provider: given a source name, return the auth header value */
|
|
12
|
+
authProvider?: AuthProvider;
|
|
13
|
+
/** Custom HTTP client (defaults to fetch-based) */
|
|
14
|
+
httpClient?: HttpClient;
|
|
15
|
+
/** Event hooks for step execution */
|
|
16
|
+
hooks?: ExecutionHooks;
|
|
17
|
+
/**
|
|
18
|
+
* Handler for interactive GNAP grants that require user consent.
|
|
19
|
+
*
|
|
20
|
+
* When a step's response contains `interact.redirect`, the executor pauses
|
|
21
|
+
* and calls this handler with the redirect URL. The handler must:
|
|
22
|
+
* 1. Redirect the user to the URL for consent
|
|
23
|
+
* 2. Capture the `interact_ref` from the callback
|
|
24
|
+
* 3. Return the `interact_ref` so the executor can continue the grant
|
|
25
|
+
*
|
|
26
|
+
* If not provided, interactive grant steps will throw an error.
|
|
27
|
+
*/
|
|
28
|
+
interactionHandler?: InteractionHandler;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Handles interactive GNAP grant consent flows.
|
|
32
|
+
*
|
|
33
|
+
* @param context - Details about the interaction required
|
|
34
|
+
* @returns The `interact_ref` received from the redirect callback
|
|
35
|
+
*/
|
|
36
|
+
export type InteractionHandler = (context: InteractionContext) => Promise<string>;
|
|
37
|
+
export interface InteractionContext {
|
|
38
|
+
/** The URL to redirect the user to for consent */
|
|
39
|
+
redirectUrl: string;
|
|
40
|
+
/** The grant continuation URI */
|
|
41
|
+
continueUri: string;
|
|
42
|
+
/** The continue access token */
|
|
43
|
+
continueAccessToken: string;
|
|
44
|
+
/** Finish nonce for verifying the interaction hash */
|
|
45
|
+
finishNonce?: string;
|
|
46
|
+
/** Server-suggested wait time in seconds before continuing */
|
|
47
|
+
continueWait?: number;
|
|
48
|
+
/** The workflow step that triggered the interaction */
|
|
49
|
+
stepId: string;
|
|
50
|
+
}
|
|
51
|
+
export interface AuthProvider {
|
|
52
|
+
/** Get authorization header value for requests to a given source */
|
|
53
|
+
getAuthHeader(sourceName: string, operationId: string): Promise<string | undefined>;
|
|
54
|
+
/** Optional: sign the full request (for HTTP message signatures) */
|
|
55
|
+
signRequest?(request: HttpRequest): Promise<HttpRequest>;
|
|
56
|
+
}
|
|
57
|
+
export interface HttpClient {
|
|
58
|
+
execute(request: HttpRequest): Promise<HttpResponse>;
|
|
59
|
+
}
|
|
60
|
+
export interface HttpRequest {
|
|
61
|
+
url: string;
|
|
62
|
+
method: string;
|
|
63
|
+
headers: Record<string, string>;
|
|
64
|
+
body?: unknown;
|
|
65
|
+
}
|
|
66
|
+
export interface HttpResponse {
|
|
67
|
+
status: number;
|
|
68
|
+
headers: Record<string, string>;
|
|
69
|
+
body: unknown;
|
|
70
|
+
}
|
|
71
|
+
export interface StepResult {
|
|
72
|
+
stepId: string;
|
|
73
|
+
request: HttpRequest;
|
|
74
|
+
response: HttpResponse;
|
|
75
|
+
outputs: Record<string, unknown>;
|
|
76
|
+
success: boolean;
|
|
77
|
+
duration: number;
|
|
78
|
+
/** If this step triggered an interaction, the details are captured here */
|
|
79
|
+
interaction?: InteractionContext;
|
|
80
|
+
}
|
|
81
|
+
export interface WorkflowResult {
|
|
82
|
+
workflowId: string;
|
|
83
|
+
success: boolean;
|
|
84
|
+
outputs: Record<string, unknown>;
|
|
85
|
+
steps: StepResult[];
|
|
86
|
+
duration: number;
|
|
87
|
+
error?: string;
|
|
88
|
+
}
|
|
89
|
+
export interface ExecutionHooks {
|
|
90
|
+
/** Called before each step executes */
|
|
91
|
+
beforeStep?(stepId: string, request: HttpRequest): void | Promise<void>;
|
|
92
|
+
/** Called after each step completes */
|
|
93
|
+
afterStep?(stepId: string, result: StepResult): void | Promise<void>;
|
|
94
|
+
/** Called if a step fails */
|
|
95
|
+
onStepError?(stepId: string, error: Error): void | Promise<void>;
|
|
96
|
+
/** Called when a token is acquired from a grant step */
|
|
97
|
+
onTokenAcquired?(stepId: string, token: string, type: string): void | Promise<void>;
|
|
98
|
+
/** Called when server URLs are dynamically resolved */
|
|
99
|
+
onServerResolved?(stepId: string, servers: Record<string, string>): void | Promise<void>;
|
|
100
|
+
}
|
|
101
|
+
export interface GnapAuthConfig {
|
|
102
|
+
/** The client's wallet address URL for GNAP identification */
|
|
103
|
+
clientWalletAddress: string;
|
|
104
|
+
/** Private key for HTTP message signatures (PEM or JWK) */
|
|
105
|
+
privateKey: string | JsonWebKey;
|
|
106
|
+
/** Key ID for the signing key */
|
|
107
|
+
keyId: string;
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/runtime/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,MAAM,WAAW,wBAAwB;IACvC,oCAAoC;IACpC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,yDAAyD;IACzD,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,6EAA6E;IAC7E,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,mDAAmD;IACnD,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,qCAAqC;IACrC,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB;;;;;;;;;;OAUG;IACH,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC;AAED;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAC/B,OAAO,EAAE,kBAAkB,KACxB,OAAO,CAAC,MAAM,CAAC,CAAC;AAErB,MAAM,WAAW,kBAAkB;IACjC,kDAAkD;IAClD,WAAW,EAAE,MAAM,CAAC;IACpB,iCAAiC;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,gCAAgC;IAChC,mBAAmB,EAAE,MAAM,CAAC;IAC5B,sDAAsD;IACtD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8DAA8D;IAC9D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uDAAuD;IACvD,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,YAAY;IAC3B,oEAAoE;IACpE,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IACpF,oEAAoE;IACpE,WAAW,CAAC,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,C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U,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACrE,6BAA6B;IAC7B,WAAW,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACjE,wDAAwD;IACxD,eAAe,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpF,uDAAuD;IACvD,gBAAgB,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1F;AAID,MAAM,WAAW,cAAc;IAC7B,8DAA8D;IAC9D,mBAAmB,EAAE,MAAM,CAAC;IAC5B,2DAA2D;IAC3D,UAAU,EAAE,MAAM,GAAG,UAAU,CAAC;IAChC,iCAAiC;IACjC,KAAK,EAAE,MAAM,CAAC;CACf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/runtime/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workflow Executor
|
|
3
|
+
*
|
|
4
|
+
* Executes a parsed Arazzo workflow at runtime with:
|
|
5
|
+
*
|
|
6
|
+
* 1. **Dynamic token passing** — Captures access tokens from grant steps
|
|
7
|
+
* and automatically injects them as Authorization headers in subsequent
|
|
8
|
+
* resource server calls.
|
|
9
|
+
*
|
|
10
|
+
* 2. **Interactive grant handling** — When a step returns an interact.redirect,
|
|
11
|
+
* the executor pauses and calls the user-provided InteractionHandler to
|
|
12
|
+
* obtain consent, then resumes the grant continuation.
|
|
13
|
+
*
|
|
14
|
+
* 3. **Dynamic server URL resolution** — When a wallet address resolution step
|
|
15
|
+
* returns authServer/resourceServer URLs, the executor dynamically updates
|
|
16
|
+
* the server URL map for subsequent steps.
|
|
17
|
+
*/
|
|
18
|
+
import type { WorkflowObject } from '../parser/types.js';
|
|
19
|
+
import type { WorkflowExecutionOptions, WorkflowResult } from './types.js';
|
|
20
|
+
export declare class WorkflowExecutionError extends Error {
|
|
21
|
+
workflowId: string;
|
|
22
|
+
stepId?: string | undefined;
|
|
23
|
+
constructor(message: string, workflowId: string, stepId?: string | undefined);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Execute an Arazzo workflow.
|
|
27
|
+
*
|
|
28
|
+
* @param workflow - The parsed workflow object
|
|
29
|
+
* @param options - Execution options including inputs, server URLs, and auth
|
|
30
|
+
* @returns The workflow result with all outputs and step details
|
|
31
|
+
*/
|
|
32
|
+
export declare function executeWorkflow(workflow: WorkflowObject, options: WorkflowExecutionOptions): Promise<WorkflowResult>;
|
|
33
|
+
//# sourceMappingURL=workflow-executor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-executor.d.ts","sourceRoot":"","sources":["../../src/runtime/workflow-executor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAc,MAAM,oBAAoB,CAAC;AAQrE,OAAO,KAAK,EACV,wBAAwB,EACxB,cAAc,EAKf,MAAM,YAAY,CAAC;AAEpB,qBAAa,sBAAuB,SAAQ,KAAK;IAGtC,UAAU,EAAE,MAAM;IAClB,MAAM,CAAC,EAAE,MAAM;gBAFtB,OAAO,EAAE,MAAM,EACR,UAAU,EAAE,MAAM,EAClB,MAAM,CAAC,EAAE,MAAM,YAAA;CAOzB;AAeD;;;;;;GAMG;AACH,wBAAsB,eAAe,CACnC,QAAQ,EAAE,cAAc,EACxB,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,cAAc,CAAC,CAiGzB"}
|