@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,506 @@
|
|
|
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 { splitOperationId } from '../parser/arazzo-parser.js';
|
|
19
|
+
import { resolveExpression, resolveDeep, } from './expression-resolver.js';
|
|
20
|
+
import { FetchHttpClient } from './http-client.js';
|
|
21
|
+
export class WorkflowExecutionError extends Error {
|
|
22
|
+
workflowId;
|
|
23
|
+
stepId;
|
|
24
|
+
constructor(message, workflowId, stepId) {
|
|
25
|
+
super(`[WorkflowExecutor] ${workflowId}${stepId ? `.${stepId}` : ''}: ${message}`);
|
|
26
|
+
this.workflowId = workflowId;
|
|
27
|
+
this.stepId = stepId;
|
|
28
|
+
this.name = 'WorkflowExecutionError';
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Execute an Arazzo workflow.
|
|
33
|
+
*
|
|
34
|
+
* @param workflow - The parsed workflow object
|
|
35
|
+
* @param options - Execution options including inputs, server URLs, and auth
|
|
36
|
+
* @returns The workflow result with all outputs and step details
|
|
37
|
+
*/
|
|
38
|
+
export async function executeWorkflow(workflow, options) {
|
|
39
|
+
const startTime = Date.now();
|
|
40
|
+
const httpClient = options.httpClient || new FetchHttpClient(options.authProvider);
|
|
41
|
+
// Build execution context
|
|
42
|
+
const context = {
|
|
43
|
+
inputs: options.inputs,
|
|
44
|
+
steps: {},
|
|
45
|
+
};
|
|
46
|
+
// Initialize mutable execution state
|
|
47
|
+
const state = {
|
|
48
|
+
serverUrls: { ...options.serverUrls },
|
|
49
|
+
currentToken: null,
|
|
50
|
+
tokenHistory: new Map(),
|
|
51
|
+
};
|
|
52
|
+
const stepResults = [];
|
|
53
|
+
try {
|
|
54
|
+
// Execute each step sequentially
|
|
55
|
+
for (const step of workflow.steps) {
|
|
56
|
+
const stepResult = await executeStep(step, workflow.workflowId, context, options, state, httpClient);
|
|
57
|
+
stepResults.push(stepResult);
|
|
58
|
+
// Store step result in context for subsequent expression resolution
|
|
59
|
+
context.steps[step.stepId] = stepResult;
|
|
60
|
+
// ─── Feature 1: Capture tokens from grant step outputs ───
|
|
61
|
+
captureTokens(stepResult, state, options);
|
|
62
|
+
// ─── Feature 3: Capture dynamic server URLs ───
|
|
63
|
+
captureDynamicServerUrls(stepResult, state, options);
|
|
64
|
+
// ─── Feature 2: Handle interactive grants ───
|
|
65
|
+
if (hasInteractionRedirect(stepResult)) {
|
|
66
|
+
await handleInteraction(step, stepResult, workflow.workflowId, context, options, state, httpClient, stepResults);
|
|
67
|
+
}
|
|
68
|
+
// Call afterStep hook
|
|
69
|
+
if (options.hooks?.afterStep) {
|
|
70
|
+
await options.hooks.afterStep(step.stepId, stepResult);
|
|
71
|
+
}
|
|
72
|
+
// Check if step failed
|
|
73
|
+
if (!stepResult.success) {
|
|
74
|
+
return {
|
|
75
|
+
workflowId: workflow.workflowId,
|
|
76
|
+
success: false,
|
|
77
|
+
outputs: {},
|
|
78
|
+
steps: stepResults,
|
|
79
|
+
duration: Date.now() - startTime,
|
|
80
|
+
error: `Step "${step.stepId}" failed with status ${stepResult.response.status}`,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
// Resolve workflow-level outputs
|
|
85
|
+
const outputs = resolveWorkflowOutputs(workflow, context);
|
|
86
|
+
return {
|
|
87
|
+
workflowId: workflow.workflowId,
|
|
88
|
+
success: true,
|
|
89
|
+
outputs,
|
|
90
|
+
steps: stepResults,
|
|
91
|
+
duration: Date.now() - startTime,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
catch (error) {
|
|
95
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
96
|
+
return {
|
|
97
|
+
workflowId: workflow.workflowId,
|
|
98
|
+
success: false,
|
|
99
|
+
outputs: {},
|
|
100
|
+
steps: stepResults,
|
|
101
|
+
duration: Date.now() - startTime,
|
|
102
|
+
error: errorMessage,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
107
|
+
// Feature 1: Dynamic Token Passing
|
|
108
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
109
|
+
/**
|
|
110
|
+
* Token output naming convention in Open Payments Arazzo workflows:
|
|
111
|
+
*
|
|
112
|
+
* incomingPaymentAccessToken → used for create-incoming-payment
|
|
113
|
+
* quoteAccessToken → used for create-quote
|
|
114
|
+
* outgoingPaymentAccessToken → used for create-outgoing-payment
|
|
115
|
+
* continueAccessToken → used for post-continue
|
|
116
|
+
* accessToken → generic (used for list/get operations)
|
|
117
|
+
*
|
|
118
|
+
* The executor captures ANY output whose key ends with "AccessToken" or
|
|
119
|
+
* equals "accessToken" and stores it as the current auth token for the
|
|
120
|
+
* next resource server request.
|
|
121
|
+
*/
|
|
122
|
+
const TOKEN_OUTPUT_PATTERNS = [
|
|
123
|
+
/AccessToken$/, // e.g., incomingPaymentAccessToken
|
|
124
|
+
/^accessToken$/, // generic accessToken
|
|
125
|
+
];
|
|
126
|
+
function captureTokens(stepResult, state, options) {
|
|
127
|
+
for (const [key, value] of Object.entries(stepResult.outputs)) {
|
|
128
|
+
if (typeof value === 'string' && isTokenOutput(key)) {
|
|
129
|
+
state.currentToken = value;
|
|
130
|
+
state.tokenHistory.set(key, value);
|
|
131
|
+
// Notify via hook
|
|
132
|
+
if (options.hooks?.onTokenAcquired) {
|
|
133
|
+
options.hooks.onTokenAcquired(stepResult.stepId, value, key);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
function isTokenOutput(key) {
|
|
139
|
+
return TOKEN_OUTPUT_PATTERNS.some((pattern) => pattern.test(key));
|
|
140
|
+
}
|
|
141
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
142
|
+
// Feature 2: Interactive Grant Handling
|
|
143
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
144
|
+
/**
|
|
145
|
+
* Detects if a step's response contains an interactive grant redirect.
|
|
146
|
+
* In Open Payments, this means the response has `interact.redirect`.
|
|
147
|
+
*/
|
|
148
|
+
function hasInteractionRedirect(stepResult) {
|
|
149
|
+
const body = stepResult.response.body;
|
|
150
|
+
if (!body || typeof body !== 'object')
|
|
151
|
+
return false;
|
|
152
|
+
const interact = body.interact;
|
|
153
|
+
return !!(interact && typeof interact.redirect === 'string');
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Handle an interactive grant by:
|
|
157
|
+
* 1. Extracting redirect URL and continuation details
|
|
158
|
+
* 2. Calling the user's InteractionHandler
|
|
159
|
+
* 3. The interact_ref is stored so the NEXT step (continue grant)
|
|
160
|
+
* can use it in its request body
|
|
161
|
+
*/
|
|
162
|
+
async function handleInteraction(step, stepResult, workflowId, context, options, state, _httpClient, _stepResults) {
|
|
163
|
+
const body = stepResult.response.body;
|
|
164
|
+
const interact = body.interact;
|
|
165
|
+
const continueInfo = body.continue;
|
|
166
|
+
const redirectUrl = interact.redirect;
|
|
167
|
+
const continueUri = continueInfo?.uri;
|
|
168
|
+
const continueAccessTokenObj = continueInfo?.access_token;
|
|
169
|
+
const continueAccessToken = continueAccessTokenObj?.value;
|
|
170
|
+
const continueWait = continueInfo?.wait;
|
|
171
|
+
const finishNonce = interact.finish;
|
|
172
|
+
const interactionContext = {
|
|
173
|
+
redirectUrl,
|
|
174
|
+
continueUri,
|
|
175
|
+
continueAccessToken,
|
|
176
|
+
finishNonce,
|
|
177
|
+
continueWait,
|
|
178
|
+
stepId: step.stepId,
|
|
179
|
+
};
|
|
180
|
+
// Store interaction context on the step result
|
|
181
|
+
stepResult.interaction = interactionContext;
|
|
182
|
+
// Store the continue token for the next step
|
|
183
|
+
if (continueAccessToken) {
|
|
184
|
+
state.currentToken = continueAccessToken;
|
|
185
|
+
state.tokenHistory.set('continueAccessToken', continueAccessToken);
|
|
186
|
+
}
|
|
187
|
+
if (!options.interactionHandler) {
|
|
188
|
+
throw new WorkflowExecutionError(`Step "${step.stepId}" requires user interaction (redirect to ${redirectUrl}) ` +
|
|
189
|
+
`but no interactionHandler was provided. Pass an interactionHandler in the ` +
|
|
190
|
+
`workflow execution options to handle interactive grants.`, workflowId, step.stepId);
|
|
191
|
+
}
|
|
192
|
+
// Call the user's handler and get the interact_ref
|
|
193
|
+
const interactRef = await options.interactionHandler(interactionContext);
|
|
194
|
+
// Store the interact_ref in the step outputs so the next step
|
|
195
|
+
// (continue grant) can reference it via $steps.{stepId}.outputs.interactRef
|
|
196
|
+
stepResult.outputs.interactRef = interactRef;
|
|
197
|
+
// Also update in the context
|
|
198
|
+
if (context.steps[step.stepId]) {
|
|
199
|
+
context.steps[step.stepId].outputs.interactRef = interactRef;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
203
|
+
// Feature 3: Dynamic Server URL Resolution
|
|
204
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
205
|
+
/**
|
|
206
|
+
* When a wallet address resolution step returns authServer and
|
|
207
|
+
* resourceServer URLs, dynamically update the server URL map.
|
|
208
|
+
*
|
|
209
|
+
* This handles the Open Payments pattern where:
|
|
210
|
+
* - Step 1: GET wallet address → returns authServer + resourceServer
|
|
211
|
+
* - Step 2+: Use the discovered URLs for subsequent requests
|
|
212
|
+
*/
|
|
213
|
+
const SERVER_OUTPUT_PATTERNS = {
|
|
214
|
+
// Output keys that map to source description names
|
|
215
|
+
authServer: 'authServer',
|
|
216
|
+
recipientAuthServer: 'authServer',
|
|
217
|
+
senderAuthServer: 'authServer',
|
|
218
|
+
resourceServer: 'resourceServer',
|
|
219
|
+
recipientResourceServer: 'resourceServer',
|
|
220
|
+
senderResourceServer: 'resourceServer',
|
|
221
|
+
};
|
|
222
|
+
function captureDynamicServerUrls(stepResult, state, options) {
|
|
223
|
+
const resolved = {};
|
|
224
|
+
for (const [key, value] of Object.entries(stepResult.outputs)) {
|
|
225
|
+
if (typeof value === 'string' && key in SERVER_OUTPUT_PATTERNS) {
|
|
226
|
+
const sourceName = SERVER_OUTPUT_PATTERNS[key];
|
|
227
|
+
state.serverUrls[sourceName] = value;
|
|
228
|
+
resolved[sourceName] = value;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
if (Object.keys(resolved).length > 0 && options.hooks?.onServerResolved) {
|
|
232
|
+
options.hooks.onServerResolved(stepResult.stepId, resolved);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
236
|
+
// Step Execution
|
|
237
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
238
|
+
async function executeStep(step, workflowId, context, options, state, httpClient) {
|
|
239
|
+
const stepStart = Date.now();
|
|
240
|
+
// Build the HTTP request from the step definition
|
|
241
|
+
const request = buildRequest(step, workflowId, context, state);
|
|
242
|
+
// ─── Inject auth token ───
|
|
243
|
+
// If we have a current token and this is a resource server or auth continue call,
|
|
244
|
+
// inject it as the Authorization header
|
|
245
|
+
if (state.currentToken && !request.headers['Authorization']) {
|
|
246
|
+
const [sourceName, operationName] = splitOperationId(step.operationId || '');
|
|
247
|
+
// Inject token for resource server calls and auth continuation calls
|
|
248
|
+
if (sourceName === 'resourceServer' ||
|
|
249
|
+
operationName === 'post-continue' ||
|
|
250
|
+
operationName === 'post-token' ||
|
|
251
|
+
operationName === 'delete-token' ||
|
|
252
|
+
operationName === 'delete-continue') {
|
|
253
|
+
request.headers['Authorization'] = `GNAP ${state.currentToken}`;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
// Call beforeStep hook
|
|
257
|
+
if (options.hooks?.beforeStep) {
|
|
258
|
+
await options.hooks.beforeStep(step.stepId, request);
|
|
259
|
+
}
|
|
260
|
+
try {
|
|
261
|
+
// Execute HTTP request
|
|
262
|
+
const response = await httpClient.execute(request);
|
|
263
|
+
// Update context with current response for expression resolution
|
|
264
|
+
context.currentResponse = {
|
|
265
|
+
status: response.status,
|
|
266
|
+
headers: response.headers,
|
|
267
|
+
body: response.body,
|
|
268
|
+
};
|
|
269
|
+
context.currentRequest = {
|
|
270
|
+
url: request.url,
|
|
271
|
+
method: request.method,
|
|
272
|
+
};
|
|
273
|
+
// Evaluate success criteria
|
|
274
|
+
const success = evaluateSuccessCriteria(step, context);
|
|
275
|
+
// Resolve step outputs
|
|
276
|
+
const outputs = resolveStepOutputs(step, context);
|
|
277
|
+
return {
|
|
278
|
+
stepId: step.stepId,
|
|
279
|
+
request,
|
|
280
|
+
response,
|
|
281
|
+
outputs,
|
|
282
|
+
success,
|
|
283
|
+
duration: Date.now() - stepStart,
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
catch (error) {
|
|
287
|
+
if (options.hooks?.onStepError) {
|
|
288
|
+
await options.hooks.onStepError(step.stepId, error instanceof Error ? error : new Error(String(error)));
|
|
289
|
+
}
|
|
290
|
+
throw new WorkflowExecutionError(`HTTP request failed: ${error instanceof Error ? error.message : error}`, workflowId, step.stepId);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
294
|
+
// Request Building
|
|
295
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
296
|
+
function buildRequest(step, workflowId, context, state) {
|
|
297
|
+
if (!step.operationId) {
|
|
298
|
+
throw new WorkflowExecutionError('Only operationId-based steps are currently supported', workflowId, step.stepId);
|
|
299
|
+
}
|
|
300
|
+
const [sourceName, operationName] = splitOperationId(step.operationId);
|
|
301
|
+
// Use dynamically resolved server URLs
|
|
302
|
+
const baseUrl = state.serverUrls[sourceName];
|
|
303
|
+
if (!baseUrl) {
|
|
304
|
+
throw new WorkflowExecutionError(`No server URL configured for source "${sourceName}". ` +
|
|
305
|
+
`Available: [${Object.keys(state.serverUrls).join(', ')}]`, workflowId, step.stepId);
|
|
306
|
+
}
|
|
307
|
+
// Build URL from operation name
|
|
308
|
+
const { url, method } = resolveOperationUrl(baseUrl, operationName, step, context);
|
|
309
|
+
// Build headers
|
|
310
|
+
const headers = {
|
|
311
|
+
'Content-Type': 'application/json',
|
|
312
|
+
Accept: 'application/json',
|
|
313
|
+
};
|
|
314
|
+
// Apply parameter-based headers
|
|
315
|
+
if (step.parameters) {
|
|
316
|
+
for (const param of step.parameters) {
|
|
317
|
+
if (param.in === 'header') {
|
|
318
|
+
const value = resolveExpression(String(param.value), context);
|
|
319
|
+
headers[param.name] = String(value);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
// Build request body
|
|
324
|
+
let body;
|
|
325
|
+
if (step.requestBody?.payload) {
|
|
326
|
+
body = resolveDeep(step.requestBody.payload, context);
|
|
327
|
+
// ─── Feature 2: Replace interact_ref placeholder ───
|
|
328
|
+
// If the body contains the placeholder string, replace it with the
|
|
329
|
+
// actual interact_ref from the previous step's outputs
|
|
330
|
+
body = replaceInteractRefPlaceholder(body, context);
|
|
331
|
+
}
|
|
332
|
+
return { url, method, headers, body };
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Replace the `{interact_ref_from_redirect}` placeholder in request bodies
|
|
336
|
+
* with the actual interact_ref obtained from the interaction handler.
|
|
337
|
+
*/
|
|
338
|
+
function replaceInteractRefPlaceholder(body, context) {
|
|
339
|
+
if (typeof body === 'string') {
|
|
340
|
+
if (body === '{interact_ref_from_redirect}') {
|
|
341
|
+
// Find the interact_ref from any previous step's outputs
|
|
342
|
+
for (const stepResult of Object.values(context.steps)) {
|
|
343
|
+
if (stepResult.outputs.interactRef) {
|
|
344
|
+
return stepResult.outputs.interactRef;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
return body;
|
|
349
|
+
}
|
|
350
|
+
if (Array.isArray(body)) {
|
|
351
|
+
return body.map((item) => replaceInteractRefPlaceholder(item, context));
|
|
352
|
+
}
|
|
353
|
+
if (body !== null && typeof body === 'object') {
|
|
354
|
+
const replaced = {};
|
|
355
|
+
for (const [key, val] of Object.entries(body)) {
|
|
356
|
+
replaced[key] = replaceInteractRefPlaceholder(val, context);
|
|
357
|
+
}
|
|
358
|
+
return replaced;
|
|
359
|
+
}
|
|
360
|
+
return body;
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Maps an Arazzo operationId to an HTTP method and URL path.
|
|
364
|
+
* Uses Open Payments naming conventions.
|
|
365
|
+
*/
|
|
366
|
+
function resolveOperationUrl(baseUrl, operationName, step, context) {
|
|
367
|
+
// Operation name to HTTP method + path mapping
|
|
368
|
+
const operationMap = {
|
|
369
|
+
// Wallet Address
|
|
370
|
+
'get-wallet-address': { method: 'GET', path: '/' },
|
|
371
|
+
// Incoming Payments
|
|
372
|
+
'create-incoming-payment': { method: 'POST', path: '/incoming-payments' },
|
|
373
|
+
'list-incoming-payments': { method: 'GET', path: '/incoming-payments' },
|
|
374
|
+
'get-incoming-payment': { method: 'GET', path: '/incoming-payments/{id}' },
|
|
375
|
+
'complete-incoming-payment': {
|
|
376
|
+
method: 'POST',
|
|
377
|
+
path: '/incoming-payments/{id}/complete',
|
|
378
|
+
},
|
|
379
|
+
// Outgoing Payments
|
|
380
|
+
'create-outgoing-payment': { method: 'POST', path: '/outgoing-payments' },
|
|
381
|
+
'list-outgoing-payments': { method: 'GET', path: '/outgoing-payments' },
|
|
382
|
+
'get-outgoing-payment': {
|
|
383
|
+
method: 'GET',
|
|
384
|
+
path: '/outgoing-payments/{id}',
|
|
385
|
+
},
|
|
386
|
+
// Quotes
|
|
387
|
+
'create-quote': { method: 'POST', path: '/quotes' },
|
|
388
|
+
'get-quote': { method: 'GET', path: '/quotes/{id}' },
|
|
389
|
+
// Auth (GNAP)
|
|
390
|
+
'post-request': { method: 'POST', path: '/' },
|
|
391
|
+
'post-continue': { method: 'POST', path: '/continue/{id}' },
|
|
392
|
+
'delete-continue': { method: 'DELETE', path: '/continue/{id}' },
|
|
393
|
+
'post-token': { method: 'POST', path: '/token/{id}' },
|
|
394
|
+
'delete-token': { method: 'DELETE', path: '/token/{id}' },
|
|
395
|
+
};
|
|
396
|
+
const mapping = operationMap[operationName];
|
|
397
|
+
if (!mapping) {
|
|
398
|
+
throw new Error(`Unknown operation "${operationName}". Add it to the operation map.`);
|
|
399
|
+
}
|
|
400
|
+
let path = mapping.path;
|
|
401
|
+
// Resolve path parameters
|
|
402
|
+
if (step.parameters) {
|
|
403
|
+
for (const param of step.parameters) {
|
|
404
|
+
if (param.in === 'path') {
|
|
405
|
+
const value = resolveExpression(String(param.value), context);
|
|
406
|
+
path = path.replace(`{${param.name}}`, encodeURIComponent(String(value)));
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
// Resolve query parameters
|
|
411
|
+
const queryParams = [];
|
|
412
|
+
if (step.parameters) {
|
|
413
|
+
for (const param of step.parameters) {
|
|
414
|
+
if (param.in === 'query') {
|
|
415
|
+
const value = resolveExpression(String(param.value), context);
|
|
416
|
+
if (value !== undefined && value !== null) {
|
|
417
|
+
queryParams.push(`${encodeURIComponent(param.name)}=${encodeURIComponent(String(value))}`);
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
const cleanBase = baseUrl.replace(/\/+$/, '');
|
|
423
|
+
const cleanPath = path === '/' ? '' : path;
|
|
424
|
+
let url = `${cleanBase}${cleanPath}`;
|
|
425
|
+
if (queryParams.length > 0) {
|
|
426
|
+
url += `?${queryParams.join('&')}`;
|
|
427
|
+
}
|
|
428
|
+
return { url, method: mapping.method };
|
|
429
|
+
}
|
|
430
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
431
|
+
// Success Criteria Evaluation
|
|
432
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
433
|
+
function evaluateSuccessCriteria(step, context) {
|
|
434
|
+
if (!step.successCriteria || step.successCriteria.length === 0) {
|
|
435
|
+
const status = context.currentResponse?.status ?? 0;
|
|
436
|
+
return status >= 200 && status < 300;
|
|
437
|
+
}
|
|
438
|
+
return step.successCriteria.every((criterion) => {
|
|
439
|
+
return evaluateCondition(criterion.condition, context);
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
function evaluateCondition(condition, context) {
|
|
443
|
+
const match = condition.match(/^(\$[.\w]+)\s*(==|!=|>=|<=|>|<)\s*(.+)$/);
|
|
444
|
+
if (!match) {
|
|
445
|
+
return true;
|
|
446
|
+
}
|
|
447
|
+
const [, leftExpr, operator, rightRaw] = match;
|
|
448
|
+
const leftValue = resolveExpression(leftExpr, context);
|
|
449
|
+
const rightValue = parseConditionValue(rightRaw.trim());
|
|
450
|
+
switch (operator) {
|
|
451
|
+
case '==':
|
|
452
|
+
return leftValue == rightValue;
|
|
453
|
+
case '!=':
|
|
454
|
+
return leftValue != rightValue;
|
|
455
|
+
case '>=':
|
|
456
|
+
return Number(leftValue) >= Number(rightValue);
|
|
457
|
+
case '<=':
|
|
458
|
+
return Number(leftValue) <= Number(rightValue);
|
|
459
|
+
case '>':
|
|
460
|
+
return Number(leftValue) > Number(rightValue);
|
|
461
|
+
case '<':
|
|
462
|
+
return Number(leftValue) < Number(rightValue);
|
|
463
|
+
default:
|
|
464
|
+
return true;
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
function parseConditionValue(raw) {
|
|
468
|
+
if (/^\d+$/.test(raw)) {
|
|
469
|
+
return Number(raw);
|
|
470
|
+
}
|
|
471
|
+
if (raw === 'true')
|
|
472
|
+
return true;
|
|
473
|
+
if (raw === 'false')
|
|
474
|
+
return false;
|
|
475
|
+
if (raw === 'null')
|
|
476
|
+
return null;
|
|
477
|
+
if ((raw.startsWith('"') && raw.endsWith('"')) ||
|
|
478
|
+
(raw.startsWith("'") && raw.endsWith("'"))) {
|
|
479
|
+
return raw.slice(1, -1);
|
|
480
|
+
}
|
|
481
|
+
return raw;
|
|
482
|
+
}
|
|
483
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
484
|
+
// Output Resolution
|
|
485
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
486
|
+
function resolveStepOutputs(step, context) {
|
|
487
|
+
if (!step.outputs) {
|
|
488
|
+
return {};
|
|
489
|
+
}
|
|
490
|
+
const outputs = {};
|
|
491
|
+
for (const [key, expression] of Object.entries(step.outputs)) {
|
|
492
|
+
outputs[key] = resolveExpression(expression, context);
|
|
493
|
+
}
|
|
494
|
+
return outputs;
|
|
495
|
+
}
|
|
496
|
+
function resolveWorkflowOutputs(workflow, context) {
|
|
497
|
+
if (!workflow.outputs) {
|
|
498
|
+
return {};
|
|
499
|
+
}
|
|
500
|
+
const outputs = {};
|
|
501
|
+
for (const [key, expression] of Object.entries(workflow.outputs)) {
|
|
502
|
+
outputs[key] = resolveExpression(expression, context);
|
|
503
|
+
}
|
|
504
|
+
return outputs;
|
|
505
|
+
}
|
|
506
|
+
//# sourceMappingURL=workflow-executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-executor.js","sourceRoot":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CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QAC7D,OAAO,CAAC,GAAG,CAAC,GAAG,iBAAiB,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IACxD,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAS,sBAAsB,CAC7B,QAAwB,EACxB,OAA0B;IAE1B,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;QACtB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,OAAO,GAA4B,EAAE,CAAC;IAC5C,KAAK,MAAM,CAAC,GAAG,EAAE,UAAU,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QACjE,OAAO,CAAC,GAAG,CAAC,GAAG,iBAAiB,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IACxD,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@flarcos/arazzo-sdk",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Parse Arazzo 1.0.1 workflow specifications and generate typed TypeScript SDKs for Open Payments API workflows",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"arazzo-sdk": "dist/cli.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist",
|
|
13
|
+
"README.md",
|
|
14
|
+
"CHANGELOG.md"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "tsc",
|
|
18
|
+
"test": "vitest run",
|
|
19
|
+
"test:watch": "vitest",
|
|
20
|
+
"generate": "node dist/cli.js generate --input ../arazzo/*.arazzo.yaml --output src/generated/",
|
|
21
|
+
"validate": "node dist/cli.js validate --input ../arazzo/*.arazzo.yaml",
|
|
22
|
+
"prepublishOnly": "npm run build"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"arazzo",
|
|
26
|
+
"openapi",
|
|
27
|
+
"open-payments",
|
|
28
|
+
"interledger",
|
|
29
|
+
"gnap",
|
|
30
|
+
"sdk-generator",
|
|
31
|
+
"workflow",
|
|
32
|
+
"codegen"
|
|
33
|
+
],
|
|
34
|
+
"author": "flarcos",
|
|
35
|
+
"license": "Apache-2.0",
|
|
36
|
+
"repository": {
|
|
37
|
+
"type": "git",
|
|
38
|
+
"url": "https://github.com/flarcos/interledger"
|
|
39
|
+
},
|
|
40
|
+
"homepage": "https://github.com/flarcos/interledger/tree/main/arazzo-sdk",
|
|
41
|
+
"bugs": {
|
|
42
|
+
"url": "https://github.com/flarcos/interledger/issues"
|
|
43
|
+
},
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"@flarcos/kiota-authentication-gnap": "^0.1.0",
|
|
46
|
+
"yaml": "^2.6.0",
|
|
47
|
+
"glob": "^11.0.0"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"@types/node": "^22.0.0",
|
|
51
|
+
"typescript": "^5.5.0",
|
|
52
|
+
"vitest": "^4.1.2"
|
|
53
|
+
},
|
|
54
|
+
"engines": {
|
|
55
|
+
"node": ">=18.0.0"
|
|
56
|
+
}
|
|
57
|
+
}
|