@synergenius/flow-weaver 0.30.6 → 0.30.8
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/cli/flow-weaver.mjs
CHANGED
|
@@ -5987,7 +5987,7 @@ var VERSION;
|
|
|
5987
5987
|
var init_generated_version = __esm({
|
|
5988
5988
|
"src/generated-version.ts"() {
|
|
5989
5989
|
"use strict";
|
|
5990
|
-
VERSION = "0.30.
|
|
5990
|
+
VERSION = "0.30.8";
|
|
5991
5991
|
}
|
|
5992
5992
|
});
|
|
5993
5993
|
|
|
@@ -88935,7 +88935,7 @@ function parseIntStrict(value) {
|
|
|
88935
88935
|
// src/cli/index.ts
|
|
88936
88936
|
init_logger();
|
|
88937
88937
|
init_error_utils();
|
|
88938
|
-
var version2 = true ? "0.30.
|
|
88938
|
+
var version2 = true ? "0.30.8" : "0.0.0-dev";
|
|
88939
88939
|
var program2 = new Command();
|
|
88940
88940
|
program2.name("fw").description("Flow Weaver Annotations - Compile and validate workflow files").option("-v, --version", "Output the current version").option("--no-color", "Disable colors").option("--color", "Force colors").on("option:version", () => {
|
|
88941
88941
|
logger.banner(version2);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.30.
|
|
1
|
+
export declare const VERSION = "0.30.8";
|
|
2
2
|
//# sourceMappingURL=generated-version.d.ts.map
|
package/dist/npm-packages.d.ts
CHANGED
package/dist/npm-packages.js
CHANGED
|
@@ -115,6 +115,7 @@ function inferNodeTypeFromDtsFunction(fn, packageName) {
|
|
|
115
115
|
reference: 'execute',
|
|
116
116
|
type: 'STEP',
|
|
117
117
|
direction: 'INPUT',
|
|
118
|
+
defaultOrder: 0,
|
|
118
119
|
});
|
|
119
120
|
// Infer inputs from parameters
|
|
120
121
|
for (const param of fn.getParameters()) {
|
|
@@ -142,25 +143,23 @@ function inferNodeTypeFromDtsFunction(fn, packageName) {
|
|
|
142
143
|
}
|
|
143
144
|
}
|
|
144
145
|
const unwrappedText = returnType.getText();
|
|
145
|
-
if (unwrappedText !== 'void' && unwrappedText !== 'undefined') {
|
|
146
|
+
if (unwrappedText !== 'void' && unwrappedText !== 'undefined' && unwrappedText !== 'never') {
|
|
146
147
|
const isPrimitive = PRIMITIVE_TYPES.has(unwrappedText);
|
|
147
148
|
const isArray = unwrappedText.endsWith('[]') || unwrappedText.startsWith('Array<');
|
|
148
149
|
const properties = returnType.getProperties();
|
|
149
150
|
const isObjectLike = !isPrimitive && !isArray && returnType.isObject() && properties.length > 0;
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
151
|
+
const dataProps = isObjectLike
|
|
152
|
+
? properties.filter(p => p.getName() !== 'onSuccess' && p.getName() !== 'onFailure')
|
|
153
|
+
: [];
|
|
154
|
+
if (isObjectLike && dataProps.length <= 8) {
|
|
155
|
+
for (const prop of dataProps) {
|
|
153
156
|
const propName = prop.getName();
|
|
154
|
-
if (propName === 'onSuccess' || propName === 'onFailure')
|
|
155
|
-
continue;
|
|
156
157
|
const propType = prop.getTypeAtLocation(fn.getTypeResolutionNode());
|
|
157
|
-
const propTypeText = propType.getText();
|
|
158
|
-
const dataType = inferDataTypeFromTS(propTypeText);
|
|
159
158
|
ports.push({
|
|
160
159
|
name: propName,
|
|
161
160
|
defaultLabel: capitalize(propName),
|
|
162
161
|
reference: propName,
|
|
163
|
-
type:
|
|
162
|
+
type: inferDataTypeFromTS(propType.getText()),
|
|
164
163
|
direction: 'OUTPUT',
|
|
165
164
|
});
|
|
166
165
|
}
|
|
@@ -184,6 +183,7 @@ function inferNodeTypeFromDtsFunction(fn, packageName) {
|
|
|
184
183
|
reference: 'onSuccess',
|
|
185
184
|
type: 'STEP',
|
|
186
185
|
direction: 'OUTPUT',
|
|
186
|
+
defaultOrder: 100,
|
|
187
187
|
});
|
|
188
188
|
ports.push({
|
|
189
189
|
name: 'onFailure',
|
|
@@ -191,6 +191,8 @@ function inferNodeTypeFromDtsFunction(fn, packageName) {
|
|
|
191
191
|
reference: 'onFailure',
|
|
192
192
|
type: 'STEP',
|
|
193
193
|
direction: 'OUTPUT',
|
|
194
|
+
defaultOrder: 101,
|
|
195
|
+
failure: true,
|
|
194
196
|
});
|
|
195
197
|
return {
|
|
196
198
|
name: `npm/${packageName}/${fnName}`,
|
|
@@ -244,10 +246,12 @@ export function getPackageExports(packageName, workdir, nodeModulesOverride) {
|
|
|
244
246
|
const nodeTypes = [];
|
|
245
247
|
const seenFunctionNames = new Set();
|
|
246
248
|
// First pass: try symbol-based enumeration (handles re-exports, declare const, etc.)
|
|
249
|
+
// Maximum data output ports before collapsing to a single "result" port
|
|
250
|
+
const MAX_DATA_OUTPUT_PORTS = 8;
|
|
247
251
|
const fileSymbol = dtsFile.getSymbol();
|
|
248
252
|
if (fileSymbol) {
|
|
249
253
|
for (const exportSymbol of fileSymbol.getExports()) {
|
|
250
|
-
|
|
254
|
+
let exportName = exportSymbol.getName();
|
|
251
255
|
if (seenFunctionNames.has(exportName))
|
|
252
256
|
continue;
|
|
253
257
|
// Check if this export is callable (has call signatures)
|
|
@@ -255,29 +259,66 @@ export function getPackageExports(packageName, workdir, nodeModulesOverride) {
|
|
|
255
259
|
const callSignatures = exportType.getCallSignatures();
|
|
256
260
|
if (callSignatures.length === 0)
|
|
257
261
|
continue;
|
|
262
|
+
// Handle export= (CJS): skip namespaces, include single functions
|
|
263
|
+
if (exportName === 'export=') {
|
|
264
|
+
// If the type has many non-call properties, it's a namespace (lodash)
|
|
265
|
+
const props = exportType.getProperties().filter(p => !p.getName().startsWith('__'));
|
|
266
|
+
if (props.length > 5)
|
|
267
|
+
continue; // Namespace with many methods — skip
|
|
268
|
+
// Try to get the real name from the declaration
|
|
269
|
+
const decl = exportSymbol.getValueDeclaration();
|
|
270
|
+
const declName = decl && 'getName' in decl ? decl.getName?.() : undefined;
|
|
271
|
+
if (declName && declName !== 'export=') {
|
|
272
|
+
exportName = declName;
|
|
273
|
+
}
|
|
274
|
+
else {
|
|
275
|
+
// Try aliased declarations
|
|
276
|
+
const aliased = exportSymbol.getAliasedSymbol?.();
|
|
277
|
+
const aliasedName = aliased?.getName();
|
|
278
|
+
if (aliasedName && aliasedName !== 'export=' && aliasedName !== '__type') {
|
|
279
|
+
exportName = aliasedName;
|
|
280
|
+
}
|
|
281
|
+
else {
|
|
282
|
+
continue; // Can't determine a useful name — skip
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
// Handle default exports: resolve to the actual function name
|
|
287
|
+
if (exportName === 'default') {
|
|
288
|
+
const decl = exportSymbol.getValueDeclaration();
|
|
289
|
+
const declName = decl && 'getName' in decl ? decl.getName?.() : undefined;
|
|
290
|
+
if (declName && declName !== 'default') {
|
|
291
|
+
exportName = declName;
|
|
292
|
+
}
|
|
293
|
+
else {
|
|
294
|
+
const aliased = exportSymbol.getAliasedSymbol?.();
|
|
295
|
+
const aliasedName = aliased?.getName();
|
|
296
|
+
if (aliasedName && aliasedName !== 'default' && aliasedName !== '__type') {
|
|
297
|
+
exportName = aliasedName;
|
|
298
|
+
}
|
|
299
|
+
// If still "default", keep it — some packages genuinely have unnamed default exports
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
if (seenFunctionNames.has(exportName))
|
|
303
|
+
continue;
|
|
258
304
|
seenFunctionNames.add(exportName);
|
|
259
305
|
// Use the first call signature to infer ports
|
|
260
306
|
const sig = callSignatures[0];
|
|
261
307
|
const ports = [];
|
|
262
308
|
// Execute input port
|
|
263
309
|
ports.push({
|
|
264
|
-
name: 'execute',
|
|
265
|
-
|
|
266
|
-
reference: 'execute',
|
|
267
|
-
type: 'STEP',
|
|
268
|
-
direction: 'INPUT',
|
|
310
|
+
name: 'execute', defaultLabel: 'Execute', reference: 'execute',
|
|
311
|
+
type: 'STEP', direction: 'INPUT', defaultOrder: 0,
|
|
269
312
|
});
|
|
270
313
|
// Input ports from parameters
|
|
314
|
+
let inputOrder = 1;
|
|
271
315
|
for (const param of sig.getParameters()) {
|
|
272
316
|
const paramName = param.getName();
|
|
273
317
|
const paramType = param.getTypeAtLocation(dtsFile);
|
|
274
318
|
const dataType = inferDataTypeFromTS(paramType.getText());
|
|
275
319
|
ports.push({
|
|
276
|
-
name: paramName,
|
|
277
|
-
|
|
278
|
-
reference: paramName,
|
|
279
|
-
type: dataType,
|
|
280
|
-
direction: 'INPUT',
|
|
320
|
+
name: paramName, defaultLabel: capitalize(paramName), reference: paramName,
|
|
321
|
+
type: dataType, direction: 'INPUT', defaultOrder: inputOrder++,
|
|
281
322
|
});
|
|
282
323
|
}
|
|
283
324
|
// Output ports from return type
|
|
@@ -290,50 +331,41 @@ export function getPackageExports(packageName, workdir, nodeModulesOverride) {
|
|
|
290
331
|
if (typeArgs.length > 0)
|
|
291
332
|
returnType = typeArgs[0];
|
|
292
333
|
}
|
|
334
|
+
let outputOrder = 0;
|
|
293
335
|
const unwrapped = returnType.getText();
|
|
294
|
-
if (unwrapped !== 'void' && unwrapped !== 'undefined') {
|
|
336
|
+
if (unwrapped !== 'void' && unwrapped !== 'undefined' && unwrapped !== 'never') {
|
|
295
337
|
const isPrimitive = PRIMITIVE_TYPES.has(unwrapped);
|
|
296
338
|
const isArray = unwrapped.endsWith('[]') || unwrapped.startsWith('Array<');
|
|
297
339
|
const properties = returnType.getProperties();
|
|
298
340
|
const isObjectLike = !isPrimitive && !isArray && returnType.isObject() && properties.length > 0;
|
|
299
|
-
|
|
300
|
-
|
|
341
|
+
const dataProps = isObjectLike
|
|
342
|
+
? properties.filter(p => p.getName() !== 'onSuccess' && p.getName() !== 'onFailure')
|
|
343
|
+
: [];
|
|
344
|
+
if (isObjectLike && dataProps.length <= MAX_DATA_OUTPUT_PORTS) {
|
|
345
|
+
for (const prop of dataProps) {
|
|
301
346
|
const propName = prop.getName();
|
|
302
|
-
if (propName === 'onSuccess' || propName === 'onFailure')
|
|
303
|
-
continue;
|
|
304
347
|
const propType = prop.getTypeAtLocation(dtsFile);
|
|
305
348
|
ports.push({
|
|
306
|
-
name: propName,
|
|
307
|
-
|
|
308
|
-
reference: propName,
|
|
309
|
-
type: inferDataTypeFromTS(propType.getText()),
|
|
310
|
-
direction: 'OUTPUT',
|
|
349
|
+
name: propName, defaultLabel: capitalize(propName), reference: propName,
|
|
350
|
+
type: inferDataTypeFromTS(propType.getText()), direction: 'OUTPUT', defaultOrder: outputOrder++,
|
|
311
351
|
});
|
|
312
352
|
}
|
|
313
353
|
}
|
|
314
354
|
else {
|
|
355
|
+
// Single result port: either primitive/array, or object with too many properties
|
|
315
356
|
ports.push({
|
|
316
|
-
name: 'result',
|
|
317
|
-
|
|
318
|
-
reference: 'result',
|
|
319
|
-
type: inferDataTypeFromTS(unwrapped),
|
|
320
|
-
direction: 'OUTPUT',
|
|
357
|
+
name: 'result', defaultLabel: 'Result', reference: 'result',
|
|
358
|
+
type: inferDataTypeFromTS(unwrapped), direction: 'OUTPUT', defaultOrder: outputOrder++,
|
|
321
359
|
});
|
|
322
360
|
}
|
|
323
361
|
}
|
|
324
362
|
ports.push({
|
|
325
|
-
name: 'onSuccess',
|
|
326
|
-
|
|
327
|
-
reference: 'onSuccess',
|
|
328
|
-
type: 'STEP',
|
|
329
|
-
direction: 'OUTPUT',
|
|
363
|
+
name: 'onSuccess', defaultLabel: 'On Success', reference: 'onSuccess',
|
|
364
|
+
type: 'STEP', direction: 'OUTPUT', defaultOrder: 100,
|
|
330
365
|
});
|
|
331
366
|
ports.push({
|
|
332
|
-
name: 'onFailure',
|
|
333
|
-
|
|
334
|
-
reference: 'onFailure',
|
|
335
|
-
type: 'STEP',
|
|
336
|
-
direction: 'OUTPUT',
|
|
367
|
+
name: 'onFailure', defaultLabel: 'On Failure', reference: 'onFailure',
|
|
368
|
+
type: 'STEP', direction: 'OUTPUT', defaultOrder: 101, failure: true,
|
|
337
369
|
});
|
|
338
370
|
nodeTypes.push({
|
|
339
371
|
name: `npm/${packageName}/${exportName}`,
|
|
@@ -370,16 +402,14 @@ export function getPackageExports(packageName, workdir, nodeModulesOverride) {
|
|
|
370
402
|
seenFunctionNames.add(exportName);
|
|
371
403
|
const sig = callSignatures[0];
|
|
372
404
|
const ports = [];
|
|
373
|
-
ports.push({ name: 'execute', defaultLabel: 'Execute', reference: 'execute', type: 'STEP', direction: 'INPUT' });
|
|
405
|
+
ports.push({ name: 'execute', defaultLabel: 'Execute', reference: 'execute', type: 'STEP', direction: 'INPUT', defaultOrder: 0 });
|
|
406
|
+
let starInputOrder = 1;
|
|
374
407
|
for (const param of sig.getParameters()) {
|
|
375
408
|
const paramName = param.getName();
|
|
376
409
|
const paramType = param.getTypeAtLocation(targetFile);
|
|
377
410
|
ports.push({
|
|
378
|
-
name: paramName,
|
|
379
|
-
|
|
380
|
-
reference: paramName,
|
|
381
|
-
type: inferDataTypeFromTS(paramType.getText()),
|
|
382
|
-
direction: 'INPUT',
|
|
411
|
+
name: paramName, defaultLabel: capitalize(paramName), reference: paramName,
|
|
412
|
+
type: inferDataTypeFromTS(paramType.getText()), direction: 'INPUT', defaultOrder: starInputOrder++,
|
|
383
413
|
});
|
|
384
414
|
}
|
|
385
415
|
let returnType = sig.getReturnType();
|
|
@@ -392,11 +422,11 @@ export function getPackageExports(packageName, workdir, nodeModulesOverride) {
|
|
|
392
422
|
returnType = typeArgs[0];
|
|
393
423
|
}
|
|
394
424
|
const unwrapped = returnType.getText();
|
|
395
|
-
if (unwrapped !== 'void' && unwrapped !== 'undefined') {
|
|
396
|
-
ports.push({ name: 'result', defaultLabel: 'Result', reference: 'result', type: inferDataTypeFromTS(unwrapped), direction: 'OUTPUT' });
|
|
425
|
+
if (unwrapped !== 'void' && unwrapped !== 'undefined' && unwrapped !== 'never') {
|
|
426
|
+
ports.push({ name: 'result', defaultLabel: 'Result', reference: 'result', type: inferDataTypeFromTS(unwrapped), direction: 'OUTPUT', defaultOrder: 0 });
|
|
397
427
|
}
|
|
398
|
-
ports.push({ name: 'onSuccess', defaultLabel: 'On Success', reference: 'onSuccess', type: 'STEP', direction: 'OUTPUT' });
|
|
399
|
-
ports.push({ name: 'onFailure', defaultLabel: 'On Failure', reference: 'onFailure', type: 'STEP', direction: 'OUTPUT' });
|
|
428
|
+
ports.push({ name: 'onSuccess', defaultLabel: 'On Success', reference: 'onSuccess', type: 'STEP', direction: 'OUTPUT', defaultOrder: 100 });
|
|
429
|
+
ports.push({ name: 'onFailure', defaultLabel: 'On Failure', reference: 'onFailure', type: 'STEP', direction: 'OUTPUT', defaultOrder: 101, failure: true });
|
|
400
430
|
nodeTypes.push({
|
|
401
431
|
name: `npm/${packageName}/${exportName}`,
|
|
402
432
|
variant: 'FUNCTION',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synergenius/flow-weaver",
|
|
3
|
-
"version": "0.30.
|
|
3
|
+
"version": "0.30.8",
|
|
4
4
|
"description": "Flow Weaver: deterministic TypeScript workflow compiler. Define workflows with JSDoc annotations, compile to standalone functions with zero runtime dependencies.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|