@lafken/state-machine 0.10.5 → 0.11.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.
@@ -8,6 +8,7 @@ const state_machine_1 = require("./state-machine/state-machine");
8
8
  class StateMachineResolver {
9
9
  type = main_1.RESOURCE_TYPE;
10
10
  async create(module, resource) {
11
+ const minify = (0, resolver_1.getContextValueByScope)(module, 'minify');
11
12
  const metadata = (0, common_1.getResourceMetadata)(resource);
12
13
  const handlers = (0, common_1.getResourceHandlerMetadata)(resource);
13
14
  resolver_1.lambdaAssets.initializeMetadata({
@@ -15,9 +16,10 @@ class StateMachineResolver {
15
16
  filename: metadata.filename,
16
17
  className: metadata.originalName,
17
18
  methods: handlers.map((handler) => handler.name),
18
- minify: metadata.minify,
19
+ minify: metadata.minify ?? minify,
19
20
  });
20
21
  const stateMachine = new state_machine_1.StateMachine(module, metadata.name, {
22
+ minify,
21
23
  classResource: resource,
22
24
  resourceMetadata: metadata,
23
25
  moduleName: module.id,
@@ -4,6 +4,7 @@ import type { BucketPermission, DefinitionSchema, SchemaProps } from './schema.t
4
4
  export declare class Schema {
5
5
  private scope;
6
6
  private resource;
7
+ private props;
7
8
  private states;
8
9
  private resourceMetadata;
9
10
  private handlers;
@@ -8,6 +8,7 @@ const schema_utils_1 = require("./schema.utils");
8
8
  class Schema {
9
9
  scope;
10
10
  resource;
11
+ props;
11
12
  states = {};
12
13
  resourceMetadata;
13
14
  handlers = {};
@@ -18,6 +19,7 @@ class Schema {
18
19
  constructor(scope, resource, props = {}) {
19
20
  this.scope = scope;
20
21
  this.resource = resource;
22
+ this.props = props;
21
23
  this.stateNames = props.stateNames || new schema_utils_1.StateNames();
22
24
  this.lambdaStates = props.lambdas || new schema_utils_1.LambdaStates();
23
25
  this.getMetadata(props.initializeAssets ?? false);
@@ -52,7 +54,7 @@ class Schema {
52
54
  get buckets() {
53
55
  return this.bucketPermissions;
54
56
  }
55
- getMetadata(initializeAssets) {
57
+ getMetadata(initializeAssets, minify) {
56
58
  this.resourceMetadata = (0, common_1.getResourceMetadata)(this.resource);
57
59
  const handlers = (0, common_1.getResourceHandlerMetadata)(this.resource);
58
60
  this.handlers = handlers.reduce((acc, handler) => {
@@ -65,7 +67,7 @@ class Schema {
65
67
  filename: this.resourceMetadata.filename,
66
68
  className: this.resourceMetadata.originalName,
67
69
  methods: handlers.map((handler) => handler.name),
68
- minify: this.resourceMetadata.minify,
70
+ minify: this.resourceMetadata.minify ?? minify,
69
71
  });
70
72
  }
71
73
  }
@@ -135,6 +137,7 @@ class Schema {
135
137
  initializeAssets: true,
136
138
  lambdas: this.lambdaStates,
137
139
  stateNames: this.stateNames,
140
+ minify: this.props.minify,
138
141
  });
139
142
  branchStates.push(branchSchema.getDefinition());
140
143
  this.mergeBucketPermissions(branchSchema.buckets);
@@ -157,6 +160,7 @@ class Schema {
157
160
  initializeAssets: true,
158
161
  lambdas: this.lambdaStates,
159
162
  stateNames: this.stateNames,
163
+ minify: this.props.minify,
160
164
  });
161
165
  this.mergeBucketPermissions(mapSchema.buckets);
162
166
  const mapState = mapSchema.getDefinition();
@@ -137,6 +137,7 @@ export type States = StateTask | ParallelTask | MapTask | ChoiceTask | WaitTask
137
137
  export type StatesWithCatchErrors = StateTask | ParallelTask | MapTask;
138
138
  export interface SchemaProps {
139
139
  initializeAssets?: boolean;
140
+ minify?: boolean;
140
141
  stateNames?: StateNames | undefined;
141
142
  lambdas?: LambdaStates | undefined;
142
143
  }
@@ -26,7 +26,7 @@ class StateMachine extends resolver_1.lafkenResource.make(sfn_state_machine_1.Sf
26
26
  }
27
27
  async attachDefinition() {
28
28
  const { classResource } = this.props;
29
- const schema = new schema_1.Schema(this, classResource);
29
+ const schema = new schema_1.Schema(this, classResource, { minify: this.props.minify });
30
30
  const definition = await schema.getDefinition();
31
31
  this.overrideRole(schema);
32
32
  if (!schema.hasUnresolvedDependency) {
@@ -4,4 +4,5 @@ export interface StateMachineProps {
4
4
  classResource: ClassResource;
5
5
  resourceMetadata: StateMachineResourceMetadata;
6
6
  moduleName: string;
7
+ minify?: boolean;
7
8
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lafken/state-machine",
3
- "version": "0.10.5",
3
+ "version": "0.11.0",
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.10.5"
53
+ "@lafken/resolver": "0.11.0"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@cdktn/provider-aws": "^23.5.0",
@@ -63,13 +63,13 @@
63
63
  "typescript": "6.0.2",
64
64
  "unplugin-swc": "^1.5.9",
65
65
  "vitest": "^4.1.2",
66
- "@lafken/common": "0.10.5"
66
+ "@lafken/common": "0.11.0"
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.10.5"
72
+ "@lafken/common": "0.11.0"
73
73
  },
74
74
  "engines": {
75
75
  "node": ">=20.19"