@synergenius/flow-weaver 0.30.3 → 0.30.5

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.
@@ -1118,6 +1118,45 @@ function generateWorkflowJSDoc(ast, options = {}) {
1118
1118
  line += ` period="${t.period}"`;
1119
1119
  lines.push(line);
1120
1120
  }
1121
+ // CI/CD annotations round-trip (from pack-contributed tag handlers)
1122
+ if (ast.options?.cicd) {
1123
+ const cicd = ast.options.cicd;
1124
+ if (cicd.triggers && Array.isArray(cicd.triggers)) {
1125
+ for (const trigger of cicd.triggers) {
1126
+ const parts = [String(trigger.type || '')];
1127
+ if (trigger.branches)
1128
+ parts.push(`branches="${trigger.branches}"`);
1129
+ if (trigger.types)
1130
+ parts.push(`types="${trigger.types}"`);
1131
+ if (trigger.pattern)
1132
+ parts.push(`pattern="${trigger.pattern}"`);
1133
+ if (trigger.cron)
1134
+ parts.push(`cron="${trigger.cron}"`);
1135
+ lines.push(` * @trigger ${parts.join(' ')}`);
1136
+ }
1137
+ }
1138
+ if (cicd.secrets && Array.isArray(cicd.secrets)) {
1139
+ for (const secret of cicd.secrets) {
1140
+ let line = ` * @secret ${secret.name}`;
1141
+ if (secret.description)
1142
+ line += ` - ${secret.description}`;
1143
+ lines.push(line);
1144
+ }
1145
+ }
1146
+ if (cicd.runner) {
1147
+ lines.push(` * @runner ${cicd.runner}`);
1148
+ }
1149
+ if (cicd.caches && Array.isArray(cicd.caches)) {
1150
+ for (const cache of cicd.caches) {
1151
+ let line = ` * @cache ${cache.strategy || 'npm'}`;
1152
+ if (cache.key)
1153
+ line += ` key="${cache.key}"`;
1154
+ if (cache.path)
1155
+ line += ` path="${cache.path}"`;
1156
+ lines.push(line);
1157
+ }
1158
+ }
1159
+ }
1121
1160
  // Add name if different from function name
1122
1161
  if (ast.name && ast.name !== ast.functionName) {
1123
1162
  lines.push(` * @name ${ast.name}`);
@@ -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.3";
5990
+ VERSION = "0.30.5";
5991
5991
  }
5992
5992
  });
5993
5993
 
@@ -7760,7 +7760,18 @@ function generateControlFlowWithExecutionContext(workflow, nodeTypes, isAsync2,
7760
7760
  );
7761
7761
  }
7762
7762
  }
7763
- const allProps = defaults.length > 0 ? `${defaults.join(", ")}${returnProps.length > 0 ? ", " : ""}${returnProps.join(", ")}` : returnProps.join(", ");
7763
+ const allPropsUnsorted = [...defaults, ...returnProps];
7764
+ const onSuccessProp = allPropsUnsorted.find((p) => p.trimStart().startsWith("onSuccess"));
7765
+ const onFailureProp = allPropsUnsorted.find((p) => p.trimStart().startsWith("onFailure"));
7766
+ const dataProps = allPropsUnsorted.filter((p) => {
7767
+ const key = p.trimStart().split(":")[0].trim();
7768
+ return key !== "onSuccess" && key !== "onFailure";
7769
+ });
7770
+ const orderedProps = [];
7771
+ if (onSuccessProp) orderedProps.push(onSuccessProp);
7772
+ if (onFailureProp) orderedProps.push(onFailureProp);
7773
+ orderedProps.push(...dataProps);
7774
+ const allProps = orderedProps.join(", ");
7764
7775
  lines.push(` const finalResult = { ${allProps} };`);
7765
7776
  lines.push("");
7766
7777
  lines.push(` ${awaitPrefixTop}ctx.sendStatusChangedEvent({`);
@@ -16166,6 +16177,37 @@ function generateWorkflowJSDoc(ast, options = {}) {
16166
16177
  if (t.period) line += ` period="${t.period}"`;
16167
16178
  lines.push(line);
16168
16179
  }
16180
+ if (ast.options?.cicd) {
16181
+ const cicd = ast.options.cicd;
16182
+ if (cicd.triggers && Array.isArray(cicd.triggers)) {
16183
+ for (const trigger of cicd.triggers) {
16184
+ const parts = [String(trigger.type || "")];
16185
+ if (trigger.branches) parts.push(`branches="${trigger.branches}"`);
16186
+ if (trigger.types) parts.push(`types="${trigger.types}"`);
16187
+ if (trigger.pattern) parts.push(`pattern="${trigger.pattern}"`);
16188
+ if (trigger.cron) parts.push(`cron="${trigger.cron}"`);
16189
+ lines.push(` * @trigger ${parts.join(" ")}`);
16190
+ }
16191
+ }
16192
+ if (cicd.secrets && Array.isArray(cicd.secrets)) {
16193
+ for (const secret of cicd.secrets) {
16194
+ let line = ` * @secret ${secret.name}`;
16195
+ if (secret.description) line += ` - ${secret.description}`;
16196
+ lines.push(line);
16197
+ }
16198
+ }
16199
+ if (cicd.runner) {
16200
+ lines.push(` * @runner ${cicd.runner}`);
16201
+ }
16202
+ if (cicd.caches && Array.isArray(cicd.caches)) {
16203
+ for (const cache of cicd.caches) {
16204
+ let line = ` * @cache ${cache.strategy || "npm"}`;
16205
+ if (cache.key) line += ` key="${cache.key}"`;
16206
+ if (cache.path) line += ` path="${cache.path}"`;
16207
+ lines.push(line);
16208
+ }
16209
+ }
16210
+ }
16169
16211
  if (ast.name && ast.name !== ast.functionName) {
16170
16212
  lines.push(` * @name ${ast.name}`);
16171
16213
  }
@@ -88893,7 +88935,7 @@ function parseIntStrict(value) {
88893
88935
  // src/cli/index.ts
88894
88936
  init_logger();
88895
88937
  init_error_utils();
88896
- var version2 = true ? "0.30.3" : "0.0.0-dev";
88938
+ var version2 = true ? "0.30.5" : "0.0.0-dev";
88897
88939
  var program2 = new Command();
88898
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", () => {
88899
88941
  logger.banner(version2);
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.30.3";
1
+ export declare const VERSION = "0.30.5";
2
2
  //# sourceMappingURL=generated-version.d.ts.map
@@ -1,3 +1,3 @@
1
1
  // Auto-generated by scripts/generate-version.ts — do not edit manually
2
- export const VERSION = '0.30.3';
2
+ export const VERSION = '0.30.5';
3
3
  //# sourceMappingURL=generated-version.js.map
@@ -607,9 +607,22 @@ export function generateControlFlowWithExecutionContext(workflow, nodeTypes, isA
607
607
  lines.push(` ${setCallForDefaults}({ id: '${RESERVED_NODE_NAMES.EXIT}', portName: 'onFailure', executionIndex: exitIdx, nodeTypeName: '${RESERVED_NODE_NAMES.EXIT}' }, false);`);
608
608
  }
609
609
  }
610
- const allProps = defaults.length > 0
611
- ? `${defaults.join(', ')}${returnProps.length > 0 ? ', ' : ''}${returnProps.join(', ')}`
612
- : returnProps.join(', ');
610
+ // Assemble final result with onSuccess first, onFailure second, then data ports.
611
+ // This ensures JSON.stringify output is readable and predictable.
612
+ const allPropsUnsorted = [...defaults, ...returnProps];
613
+ const onSuccessProp = allPropsUnsorted.find(p => p.trimStart().startsWith('onSuccess'));
614
+ const onFailureProp = allPropsUnsorted.find(p => p.trimStart().startsWith('onFailure'));
615
+ const dataProps = allPropsUnsorted.filter(p => {
616
+ const key = p.trimStart().split(':')[0].trim();
617
+ return key !== 'onSuccess' && key !== 'onFailure';
618
+ });
619
+ const orderedProps = [];
620
+ if (onSuccessProp)
621
+ orderedProps.push(onSuccessProp);
622
+ if (onFailureProp)
623
+ orderedProps.push(onFailureProp);
624
+ orderedProps.push(...dataProps);
625
+ const allProps = orderedProps.join(', ');
613
626
  lines.push(` const finalResult = { ${allProps} };`);
614
627
  lines.push('');
615
628
  lines.push(` ${awaitPrefixTop}ctx.sendStatusChangedEvent({`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synergenius/flow-weaver",
3
- "version": "0.30.3",
3
+ "version": "0.30.5",
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",