@synergenius/flow-weaver 0.30.7 → 0.30.9
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.9";
|
|
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.9" : "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.9";
|
|
2
2
|
//# sourceMappingURL=generated-version.d.ts.map
|
package/dist/npm-packages.js
CHANGED
|
@@ -143,25 +143,23 @@ function inferNodeTypeFromDtsFunction(fn, packageName) {
|
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
const unwrappedText = returnType.getText();
|
|
146
|
-
if (unwrappedText !== 'void' && unwrappedText !== 'undefined') {
|
|
146
|
+
if (unwrappedText !== 'void' && unwrappedText !== 'undefined' && unwrappedText !== 'never') {
|
|
147
147
|
const isPrimitive = PRIMITIVE_TYPES.has(unwrappedText);
|
|
148
148
|
const isArray = unwrappedText.endsWith('[]') || unwrappedText.startsWith('Array<');
|
|
149
149
|
const properties = returnType.getProperties();
|
|
150
150
|
const isObjectLike = !isPrimitive && !isArray && returnType.isObject() && properties.length > 0;
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
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) {
|
|
154
156
|
const propName = prop.getName();
|
|
155
|
-
if (propName === 'onSuccess' || propName === 'onFailure')
|
|
156
|
-
continue;
|
|
157
157
|
const propType = prop.getTypeAtLocation(fn.getTypeResolutionNode());
|
|
158
|
-
const propTypeText = propType.getText();
|
|
159
|
-
const dataType = inferDataTypeFromTS(propTypeText);
|
|
160
158
|
ports.push({
|
|
161
159
|
name: propName,
|
|
162
160
|
defaultLabel: capitalize(propName),
|
|
163
161
|
reference: propName,
|
|
164
|
-
type:
|
|
162
|
+
type: inferDataTypeFromTS(propType.getText()),
|
|
165
163
|
direction: 'OUTPUT',
|
|
166
164
|
});
|
|
167
165
|
}
|
|
@@ -197,7 +195,7 @@ function inferNodeTypeFromDtsFunction(fn, packageName) {
|
|
|
197
195
|
failure: true,
|
|
198
196
|
});
|
|
199
197
|
return {
|
|
200
|
-
name:
|
|
198
|
+
name: fnName,
|
|
201
199
|
variant: 'FUNCTION',
|
|
202
200
|
category: 'NPM Packages',
|
|
203
201
|
function: fnName,
|
|
@@ -248,10 +246,12 @@ export function getPackageExports(packageName, workdir, nodeModulesOverride) {
|
|
|
248
246
|
const nodeTypes = [];
|
|
249
247
|
const seenFunctionNames = new Set();
|
|
250
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;
|
|
251
251
|
const fileSymbol = dtsFile.getSymbol();
|
|
252
252
|
if (fileSymbol) {
|
|
253
253
|
for (const exportSymbol of fileSymbol.getExports()) {
|
|
254
|
-
|
|
254
|
+
let exportName = exportSymbol.getName();
|
|
255
255
|
if (seenFunctionNames.has(exportName))
|
|
256
256
|
continue;
|
|
257
257
|
// Check if this export is callable (has call signatures)
|
|
@@ -259,6 +259,48 @@ export function getPackageExports(packageName, workdir, nodeModulesOverride) {
|
|
|
259
259
|
const callSignatures = exportType.getCallSignatures();
|
|
260
260
|
if (callSignatures.length === 0)
|
|
261
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;
|
|
262
304
|
seenFunctionNames.add(exportName);
|
|
263
305
|
// Use the first call signature to infer ports
|
|
264
306
|
const sig = callSignatures[0];
|
|
@@ -291,16 +333,17 @@ export function getPackageExports(packageName, workdir, nodeModulesOverride) {
|
|
|
291
333
|
}
|
|
292
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
349
|
name: propName, defaultLabel: capitalize(propName), reference: propName,
|
|
@@ -309,6 +352,7 @@ export function getPackageExports(packageName, workdir, nodeModulesOverride) {
|
|
|
309
352
|
}
|
|
310
353
|
}
|
|
311
354
|
else {
|
|
355
|
+
// Single result port: either primitive/array, or object with too many properties
|
|
312
356
|
ports.push({
|
|
313
357
|
name: 'result', defaultLabel: 'Result', reference: 'result',
|
|
314
358
|
type: inferDataTypeFromTS(unwrapped), direction: 'OUTPUT', defaultOrder: outputOrder++,
|
|
@@ -324,7 +368,7 @@ export function getPackageExports(packageName, workdir, nodeModulesOverride) {
|
|
|
324
368
|
type: 'STEP', direction: 'OUTPUT', defaultOrder: 101, failure: true,
|
|
325
369
|
});
|
|
326
370
|
nodeTypes.push({
|
|
327
|
-
name:
|
|
371
|
+
name: exportName,
|
|
328
372
|
variant: 'FUNCTION',
|
|
329
373
|
category: 'NPM Packages',
|
|
330
374
|
function: exportName,
|
|
@@ -378,13 +422,13 @@ export function getPackageExports(packageName, workdir, nodeModulesOverride) {
|
|
|
378
422
|
returnType = typeArgs[0];
|
|
379
423
|
}
|
|
380
424
|
const unwrapped = returnType.getText();
|
|
381
|
-
if (unwrapped !== 'void' && unwrapped !== 'undefined') {
|
|
425
|
+
if (unwrapped !== 'void' && unwrapped !== 'undefined' && unwrapped !== 'never') {
|
|
382
426
|
ports.push({ name: 'result', defaultLabel: 'Result', reference: 'result', type: inferDataTypeFromTS(unwrapped), direction: 'OUTPUT', defaultOrder: 0 });
|
|
383
427
|
}
|
|
384
428
|
ports.push({ name: 'onSuccess', defaultLabel: 'On Success', reference: 'onSuccess', type: 'STEP', direction: 'OUTPUT', defaultOrder: 100 });
|
|
385
429
|
ports.push({ name: 'onFailure', defaultLabel: 'On Failure', reference: 'onFailure', type: 'STEP', direction: 'OUTPUT', defaultOrder: 101, failure: true });
|
|
386
430
|
nodeTypes.push({
|
|
387
|
-
name:
|
|
431
|
+
name: exportName,
|
|
388
432
|
variant: 'FUNCTION',
|
|
389
433
|
category: 'NPM Packages',
|
|
390
434
|
function: exportName,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synergenius/flow-weaver",
|
|
3
|
-
"version": "0.30.
|
|
3
|
+
"version": "0.30.9",
|
|
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",
|