@lafken/state-machine 0.11.8 → 0.11.10
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BucketNames, ClassResource, LambdaMetadata, LambdaProps, ResourceMetadata, ResourceOutputType, ResourceProps, ServicesValues, StateMachineNames } from '@lafken/common';
|
|
1
|
+
import type { BucketNames, ClassResource, LambdaMetadata, LambdaProps, ResourceMetadata, ResourceOutputType, ResourceProps, ServicesValues, StateMachineNames, StateMachineReferenceNames } from '@lafken/common';
|
|
2
2
|
import type { JsonAtaString } from '../param';
|
|
3
3
|
export declare enum StateMachineReflectKeys {
|
|
4
4
|
nested = "state_machine:nested"
|
|
@@ -179,6 +179,15 @@ interface StateMachineProps<T> extends StateMachineBaseProps<T> {
|
|
|
179
179
|
* }
|
|
180
180
|
*/
|
|
181
181
|
outputs?: ResourceOutputType<StateMachineOutputAttributes>;
|
|
182
|
+
/**
|
|
183
|
+
* Registers this State Machine as a named global reference, allowing other resources
|
|
184
|
+
* to access its attributes (e.g. execution ARN) by reference name.
|
|
185
|
+
*
|
|
186
|
+
* @example
|
|
187
|
+
* // Register the API under a reference name
|
|
188
|
+
* ref: 'my-state-machine'
|
|
189
|
+
*/
|
|
190
|
+
ref?: StateMachineReferenceNames;
|
|
182
191
|
}
|
|
183
192
|
interface WaitStateBase<T> {
|
|
184
193
|
/**
|
|
@@ -707,7 +716,7 @@ interface MapReaderCSVItem extends MapReaderItemBase {
|
|
|
707
716
|
}
|
|
708
717
|
interface MapWriteResult {
|
|
709
718
|
bucket: BucketNames;
|
|
710
|
-
prefix
|
|
719
|
+
prefix: string;
|
|
711
720
|
config?: {
|
|
712
721
|
outputType: 'JSON' | 'JSONL';
|
|
713
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.
|
|
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.
|
|
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.
|
|
170
|
+
this.lambdaResources.push(...mapSchema.resources);
|
|
171
171
|
this.mergeBucketPermissions(mapSchema.buckets);
|
|
172
172
|
const mapState = mapSchema.definition;
|
|
173
173
|
this.setUnresolvedDependency(mapSchema.hasUnresolvedDependency);
|
|
@@ -181,7 +181,7 @@ class Schema {
|
|
|
181
181
|
Type: 'Map',
|
|
182
182
|
Items: currentState.items,
|
|
183
183
|
ItemProcessor: itemProcessor,
|
|
184
|
-
End: currentState.
|
|
184
|
+
End: currentState.next !== undefined ? undefined : (currentState.end ?? true),
|
|
185
185
|
Next: this.getNextState(currentState.next, currentState.end),
|
|
186
186
|
Output: currentState.output,
|
|
187
187
|
Assign: currentState.assign,
|
|
@@ -299,14 +299,14 @@ class Schema {
|
|
|
299
299
|
addTaskState(handler) {
|
|
300
300
|
const stateName = this.stateNames.createName(handler.name);
|
|
301
301
|
if (this.states[stateName]) {
|
|
302
|
-
return
|
|
302
|
+
return stateName;
|
|
303
303
|
}
|
|
304
304
|
const task = {
|
|
305
305
|
Type: 'Task',
|
|
306
306
|
Resource: '',
|
|
307
307
|
Arguments: {},
|
|
308
308
|
Next: this.getNextState(handler.next, handler.end),
|
|
309
|
-
End: handler.end,
|
|
309
|
+
End: handler.next !== undefined ? undefined : handler.end,
|
|
310
310
|
Assign: handler.assign,
|
|
311
311
|
...(handler.integrationResource !== undefined
|
|
312
312
|
? this.getIntegrationTask(handler)
|
|
@@ -419,10 +419,9 @@ class Schema {
|
|
|
419
419
|
this.addRetry(state, stateName);
|
|
420
420
|
}
|
|
421
421
|
setUnresolvedDependency(unresolved) {
|
|
422
|
-
if (
|
|
423
|
-
|
|
422
|
+
if (unresolved) {
|
|
423
|
+
this.unresolvedDependency = true;
|
|
424
424
|
}
|
|
425
|
-
this.unresolvedDependency = true;
|
|
426
425
|
}
|
|
427
426
|
mergeBucketPermissions(bucketPermissions) {
|
|
428
427
|
for (const bucket in bucketPermissions) {
|
|
@@ -2,8 +2,8 @@ import { SfnStateMachine } from '@cdktn/provider-aws/lib/sfn-state-machine';
|
|
|
2
2
|
import { type AppModule } from '@lafken/resolver';
|
|
3
3
|
import type { StateMachineProps } from './state-machine.types';
|
|
4
4
|
declare const StateMachine_base: (new (...args: any[]) => {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
register(namespaces: import("@lafken/common").RegisterNamespaces | (string & {}), id: string): void;
|
|
6
|
+
onResolve(callback: () => void): void;
|
|
7
7
|
readonly node: import("constructs").Node;
|
|
8
8
|
with(...mixins: import("constructs").IMixin[]): import("constructs").IConstruct;
|
|
9
9
|
toString(): string;
|
|
@@ -22,7 +22,9 @@ class StateMachine extends resolver_1.lafkenResource.make(sfn_state_machine_1.Sf
|
|
|
22
22
|
: undefined,
|
|
23
23
|
});
|
|
24
24
|
this.props = props;
|
|
25
|
-
|
|
25
|
+
if (resourceMetadata.ref) {
|
|
26
|
+
this.register('state-machine', resourceMetadata.ref);
|
|
27
|
+
}
|
|
26
28
|
this.addLoggingConfiguration(resourceMetadata);
|
|
27
29
|
new resolver_1.ResourceOutput(this, resourceMetadata.outputs);
|
|
28
30
|
}
|
|
@@ -36,7 +38,7 @@ class StateMachine extends resolver_1.lafkenResource.make(sfn_state_machine_1.Sf
|
|
|
36
38
|
this.addDependency(...schema.resources);
|
|
37
39
|
}
|
|
38
40
|
else {
|
|
39
|
-
this.
|
|
41
|
+
this.onResolve(async () => {
|
|
40
42
|
this.overrideDefinition(await schema.resolveArguments(definition));
|
|
41
43
|
this.addDependency(...schema.resources);
|
|
42
44
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lafken/state-machine",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.10",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Build Step Functions workflows with TypeScript decorators - declarative orchestration with Lafken",
|
|
6
6
|
"keywords": [
|
|
@@ -50,26 +50,26 @@
|
|
|
50
50
|
],
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"reflect-metadata": "^0.2.2",
|
|
53
|
-
"@lafken/resolver": "0.11.
|
|
53
|
+
"@lafken/resolver": "0.11.10"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@cdktn/provider-aws": "^23.
|
|
57
|
-
"@swc/core": "^1.15.
|
|
58
|
-
"@swc/helpers": "^0.5.
|
|
59
|
-
"@vitest/runner": "^4.1.
|
|
56
|
+
"@cdktn/provider-aws": "^23.9.0",
|
|
57
|
+
"@swc/core": "^1.15.30",
|
|
58
|
+
"@swc/helpers": "^0.5.21",
|
|
59
|
+
"@vitest/runner": "^4.1.5",
|
|
60
60
|
"cdktn": "^0.22.1",
|
|
61
61
|
"cdktn-vitest": "^1.0.0",
|
|
62
62
|
"constructs": "^10.6.0",
|
|
63
|
-
"typescript": "6.0.
|
|
63
|
+
"typescript": "6.0.3",
|
|
64
64
|
"unplugin-swc": "^1.5.9",
|
|
65
|
-
"vitest": "^4.1.
|
|
66
|
-
"@lafken/common": "0.11.
|
|
65
|
+
"vitest": "^4.1.5",
|
|
66
|
+
"@lafken/common": "0.11.10"
|
|
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.
|
|
72
|
+
"@lafken/common": "0.11.10"
|
|
73
73
|
},
|
|
74
74
|
"engines": {
|
|
75
75
|
"node": ">=20.19"
|