@lafken/state-machine 0.11.9 → 0.11.11

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.
@@ -716,7 +716,7 @@ interface MapReaderCSVItem extends MapReaderItemBase {
716
716
  }
717
717
  interface MapWriteResult {
718
718
  bucket: BucketNames;
719
- prefix?: string;
719
+ prefix: string;
720
720
  config?: {
721
721
  outputType: 'JSON' | 'JSONL';
722
722
  transformation?: 'NONE' | 'COMPACT' | 'FLATTEN';
@@ -23,7 +23,7 @@ class Schema {
23
23
  this.props = props;
24
24
  this.stateNames = props.stateNames || new schema_utils_1.StateNames();
25
25
  this.lambdaStates = props.lambdas || new schema_utils_1.LambdaStates();
26
- this.getMetadata(props.initializeAssets ?? false);
26
+ this.getMetadata(props.initializeAssets ?? false, props.minify);
27
27
  }
28
28
  get definition() {
29
29
  const startName = this.getNextState(this.resourceMetadata.startAt);
@@ -128,7 +128,7 @@ class Schema {
128
128
  Type: 'Pass',
129
129
  Assign: currentState.assign,
130
130
  Output: currentState.output,
131
- End: currentState.end,
131
+ End: currentState.next !== undefined ? undefined : currentState.end,
132
132
  Next: this.getNextState(currentState.next, currentState.end),
133
133
  };
134
134
  break;
@@ -143,7 +143,7 @@ class Schema {
143
143
  stateNames: this.stateNames,
144
144
  minify: this.props.minify,
145
145
  });
146
- this.resources.push(...this.resources);
146
+ this.lambdaResources.push(...branchSchema.resources);
147
147
  branchStates.push(branchSchema.definition);
148
148
  this.mergeBucketPermissions(branchSchema.buckets);
149
149
  this.setUnresolvedDependency(branchSchema.unresolvedDependency);
@@ -153,7 +153,7 @@ class Schema {
153
153
  Arguments: this.getParallelArguments(currentState.arguments),
154
154
  Output: currentState.output,
155
155
  Assign: currentState.assign,
156
- End: currentState.end ?? currentState.next === undefined,
156
+ End: currentState.next !== undefined ? undefined : (currentState.end ?? true),
157
157
  Next: this.getNextState(currentState.next, currentState.end),
158
158
  Branches: branchStates,
159
159
  };
@@ -167,7 +167,7 @@ class Schema {
167
167
  stateNames: this.stateNames,
168
168
  minify: this.props.minify,
169
169
  });
170
- this.resources.push(...this.resources);
170
+ this.lambdaResources.push(...mapSchema.resources);
171
171
  this.mergeBucketPermissions(mapSchema.buckets);
172
172
  const mapState = mapSchema.definition;
173
173
  this.setUnresolvedDependency(mapSchema.hasUnresolvedDependency);
@@ -180,8 +180,10 @@ class Schema {
180
180
  const mapTask = {
181
181
  Type: 'Map',
182
182
  Items: currentState.items,
183
+ ItemSelector: currentState.itemSelector,
184
+ MaxConcurrency: currentState.maxCurrency,
183
185
  ItemProcessor: itemProcessor,
184
- End: currentState.end ?? currentState.next === undefined,
186
+ End: currentState.next !== undefined ? undefined : (currentState.end ?? true),
185
187
  Next: this.getNextState(currentState.next, currentState.end),
186
188
  Output: currentState.output,
187
189
  Assign: currentState.assign,
@@ -239,8 +241,7 @@ class Schema {
239
241
  mapTask.ToleratedFailureCount = currentState.toleratedFailureCount;
240
242
  }
241
243
  if (currentState.toleratedFailurePercentage) {
242
- mapTask.ToleratedFailurePercentage =
243
- currentState.toleratedFailurePercentage.toString();
244
+ mapTask.ToleratedFailurePercentage = currentState.toleratedFailurePercentage;
244
245
  }
245
246
  }
246
247
  this.states[stateName] = mapTask;
@@ -299,14 +300,14 @@ class Schema {
299
300
  addTaskState(handler) {
300
301
  const stateName = this.stateNames.createName(handler.name);
301
302
  if (this.states[stateName]) {
302
- return handler.name;
303
+ return stateName;
303
304
  }
304
305
  const task = {
305
306
  Type: 'Task',
306
307
  Resource: '',
307
308
  Arguments: {},
308
309
  Next: this.getNextState(handler.next, handler.end),
309
- End: handler.end,
310
+ End: handler.next !== undefined ? undefined : handler.end,
310
311
  Assign: handler.assign,
311
312
  ...(handler.integrationResource !== undefined
312
313
  ? this.getIntegrationTask(handler)
@@ -419,10 +420,9 @@ class Schema {
419
420
  this.addRetry(state, stateName);
420
421
  }
421
422
  setUnresolvedDependency(unresolved) {
422
- if (!this.unresolvedDependency || !unresolved) {
423
- return;
423
+ if (unresolved) {
424
+ this.unresolvedDependency = true;
424
425
  }
425
- this.unresolvedDependency = true;
426
426
  }
427
427
  mergeBucketPermissions(bucketPermissions) {
428
428
  for (const bucket in bucketPermissions) {
@@ -87,8 +87,9 @@ export interface MapTask {
87
87
  ResultWriter?: ResultWriter;
88
88
  ItemBatcher?: ItemBatcher;
89
89
  Items?: any[] | string;
90
+ ItemSelector?: string | Record<string, any>;
90
91
  MaxConcurrency?: number;
91
- ToleratedFailurePercentage?: string;
92
+ ToleratedFailurePercentage?: number | string;
92
93
  ToleratedFailureCount?: number;
93
94
  Output?: string | Record<string, any>;
94
95
  Assign?: Record<string, any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lafken/state-machine",
3
- "version": "0.11.9",
3
+ "version": "0.11.11",
4
4
  "private": false,
5
5
  "description": "Build Step Functions workflows with TypeScript decorators - declarative orchestration with Lafken",
6
6
  "keywords": [
@@ -50,7 +50,7 @@
50
50
  ],
51
51
  "dependencies": {
52
52
  "reflect-metadata": "^0.2.2",
53
- "@lafken/resolver": "0.11.9"
53
+ "@lafken/resolver": "0.11.11"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@cdktn/provider-aws": "^23.9.0",
@@ -63,13 +63,13 @@
63
63
  "typescript": "6.0.3",
64
64
  "unplugin-swc": "^1.5.9",
65
65
  "vitest": "^4.1.5",
66
- "@lafken/common": "0.11.9"
66
+ "@lafken/common": "0.11.11"
67
67
  },
68
68
  "peerDependencies": {
69
69
  "@cdktn/provider-aws": ">=23.0.0",
70
70
  "cdktn": ">=0.22.0",
71
71
  "constructs": "^10.4.5",
72
- "@lafken/common": "0.11.9"
72
+ "@lafken/common": "0.11.11"
73
73
  },
74
74
  "engines": {
75
75
  "node": ">=20.19"