@codemation/core-nodes 0.2.0 → 0.3.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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # @codemation/core-nodes
2
2
 
3
+ ## 0.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#78](https://github.com/MadeRelevant/codemation/pull/78) [`f451b1b`](https://github.com/MadeRelevant/codemation/commit/f451b1b4657b59406e15ce5f50b243e487ff99ed) Thanks [@cblokland90](https://github.com/cblokland90)! - Normalize fluent workflow DSL callback helpers around the runtime item contract.
8
+
9
+ `.map(...)`, `.if(...)`, and `.switch({ resolveCaseKey })` now receive `(item, ctx)` so workflow authors can use `item.json` consistently and read prior completed outputs through `ctx.data` without dropping down to direct node configs.
10
+
3
11
  ## 0.2.0
4
12
 
5
13
  ### Minor Changes
package/dist/index.cjs CHANGED
@@ -4058,7 +4058,7 @@ var WorkflowBranchBuilder = class WorkflowBranchBuilder {
4058
4058
  map(nameOrMapper, mapperOrUndefined, options) {
4059
4059
  const name = typeof nameOrMapper === "string" ? nameOrMapper : "Map data";
4060
4060
  const mapper = typeof nameOrMapper === "string" ? mapperOrUndefined : nameOrMapper;
4061
- return this.then(new MapData(name, (item) => mapper(item.json), options));
4061
+ return this.then(new MapData(name, mapper, options));
4062
4062
  }
4063
4063
  wait(nameOrDuration, durationOrUndefined, id) {
4064
4064
  const name = typeof nameOrDuration === "string" && durationOrUndefined !== void 0 ? nameOrDuration : "Wait";
@@ -4104,7 +4104,7 @@ var WorkflowChain = class WorkflowChain {
4104
4104
  map(nameOrMapper, mapperOrUndefined, options) {
4105
4105
  const name = typeof nameOrMapper === "string" ? nameOrMapper : "Map data";
4106
4106
  const mapper = typeof nameOrMapper === "string" ? mapperOrUndefined : nameOrMapper;
4107
- return this.then(new MapData(name, (item) => mapper(item.json), options));
4107
+ return this.then(new MapData(name, mapper, options));
4108
4108
  }
4109
4109
  wait(nameOrDuration, durationOrUndefined, id) {
4110
4110
  const name = typeof nameOrDuration === "string" && durationOrUndefined !== void 0 ? nameOrDuration : "Wait";
@@ -4136,7 +4136,7 @@ var WorkflowChain = class WorkflowChain {
4136
4136
  const name = typeof nameOrPredicate === "string" ? nameOrPredicate : "If";
4137
4137
  const predicate = typeof nameOrPredicate === "string" ? predicateOrBranches : nameOrPredicate;
4138
4138
  const branches = typeof nameOrPredicate === "string" ? branchesOrUndefined : predicateOrBranches;
4139
- const cursor = this.chain.then(new If(name, (item) => predicate(item.json)));
4139
+ const cursor = this.chain.then(new If(name, (item, _index, _items, ctx) => predicate(item, ctx)));
4140
4140
  const trueSteps = branches.true?.(new WorkflowBranchBuilder()).getSteps();
4141
4141
  const falseSteps = branches.false?.(new WorkflowBranchBuilder()).getSteps();
4142
4142
  return new WorkflowChain(cursor.when({
@@ -4154,7 +4154,7 @@ var WorkflowChain = class WorkflowChain {
4154
4154
  return this.then(new Switch(name, {
4155
4155
  cases: cfg.cases,
4156
4156
  defaultCase: cfg.defaultCase,
4157
- resolveCaseKey: (item) => cfg.resolveCaseKey(item.json)
4157
+ resolveCaseKey: (item, _index, _items, ctx) => cfg.resolveCaseKey(item, ctx)
4158
4158
  }, id)).route(cfg.branches);
4159
4159
  }
4160
4160
  agent(nameOrOptions, optionsOrUndefined) {