@mettlecast/domain-cli 0.2.34 → 0.2.35

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.
@@ -35,9 +35,136 @@ const DomainEventStepSchema = z.object({
35
35
  version: z.number().int().positive(),
36
36
  next: z.string().optional(),
37
37
  });
38
+ const DynamoAttributeValueSchema = z.object({ type: z.enum(['S', 'N', 'B']), value: z.string() });
39
+ const DomainQueryDynamoGetItemStepSchema = z.object({
40
+ type: z.literal('domain-query'),
41
+ queryType: z.literal('dynamodb-get-item'),
42
+ name: z.string().min(1),
43
+ domainId: z.string().regex(/^[a-z][a-z0-9-]*$/),
44
+ key: z.object({ PK: z.string(), SK: z.string() }),
45
+ resultPath: z.string().optional(),
46
+ next: z.string().optional(),
47
+ });
48
+ const DomainQueryDynamoQueryStepSchema = z.object({
49
+ type: z.literal('domain-query'),
50
+ queryType: z.literal('dynamodb-query'),
51
+ name: z.string().min(1),
52
+ domainId: z.string().regex(/^[a-z][a-z0-9-]*$/),
53
+ keyConditionExpression: z.string().min(1),
54
+ expressionAttributeValues: z.record(z.string(), DynamoAttributeValueSchema),
55
+ expressionAttributeNames: z.record(z.string(), z.string()).optional(),
56
+ filterExpression: z.string().optional(),
57
+ indexName: z.string().optional(),
58
+ limit: z.number().int().positive().optional(),
59
+ scanIndexForward: z.boolean().optional(),
60
+ resultPath: z.string().optional(),
61
+ next: z.string().optional(),
62
+ });
63
+ const DomainQueryS3GetObjectStepSchema = z.object({
64
+ type: z.literal('domain-query'),
65
+ queryType: z.literal('s3-get-object'),
66
+ name: z.string().min(1),
67
+ domainId: z.string().regex(/^[a-z][a-z0-9-]*$/),
68
+ key: z.string().min(1),
69
+ resultPath: z.string().optional(),
70
+ next: z.string().optional(),
71
+ });
72
+ const DomainQueryStepSchema = z.union([
73
+ DomainQueryDynamoGetItemStepSchema,
74
+ DomainQueryDynamoQueryStepSchema,
75
+ DomainQueryS3GetObjectStepSchema,
76
+ ]);
77
+ const SnsMessageAttributeSchema = z.object({ dataType: z.string(), stringValue: z.string() });
78
+ const AwsServiceSnsPublishStepSchema = z.object({
79
+ type: z.literal('aws-service'),
80
+ serviceAction: z.literal('sns-publish'),
81
+ name: z.string().min(1),
82
+ topicArn: z.string().min(1),
83
+ message: z.string().min(1),
84
+ subject: z.string().optional(),
85
+ messageAttributes: z.record(z.string(), SnsMessageAttributeSchema).optional(),
86
+ resultPath: z.string().optional(),
87
+ next: z.string().optional(),
88
+ });
89
+ const AwsServiceGlueStartJobRunStepSchema = z.object({
90
+ type: z.literal('aws-service'),
91
+ serviceAction: z.literal('glue-start-job-run'),
92
+ name: z.string().min(1),
93
+ jobName: z.string().min(1),
94
+ arguments: z.record(z.string(), z.string()).optional(),
95
+ timeout: z.number().int().positive().optional(),
96
+ workerType: z.enum(['Standard', 'G.1X', 'G.2X']).optional(),
97
+ numberOfWorkers: z.number().int().positive().optional(),
98
+ resultPath: z.string().optional(),
99
+ next: z.string().optional(),
100
+ });
101
+ const AwsServiceBatchSubmitJobStepSchema = z.object({
102
+ type: z.literal('aws-service'),
103
+ serviceAction: z.literal('batch-submit-job'),
104
+ name: z.string().min(1),
105
+ batchJobName: z.string().min(1),
106
+ jobQueue: z.string().min(1),
107
+ jobDefinition: z.string().min(1),
108
+ parameters: z.record(z.string(), z.string()).optional(),
109
+ resultPath: z.string().optional(),
110
+ next: z.string().optional(),
111
+ });
112
+ const AwsServiceStepFunctionsStartExecutionStepSchema = z.object({
113
+ type: z.literal('aws-service'),
114
+ serviceAction: z.literal('step-functions-start-execution'),
115
+ name: z.string().min(1),
116
+ stateMachineArn: z.string().min(1),
117
+ input: z.record(z.string(), z.unknown()).optional(),
118
+ executionName: z.string().optional(),
119
+ resultPath: z.string().optional(),
120
+ next: z.string().optional(),
121
+ });
122
+ const AwsServiceHttpsCallStepSchema = z.object({
123
+ type: z.literal('aws-service'),
124
+ serviceAction: z.literal('https-call'),
125
+ name: z.string().min(1),
126
+ endpoint: z.string().min(1),
127
+ method: z.enum(['GET', 'POST', 'PUT', 'PATCH', 'DELETE']),
128
+ headers: z.record(z.string(), z.string()).optional(),
129
+ body: z.unknown().optional(),
130
+ resultPath: z.string().optional(),
131
+ next: z.string().optional(),
132
+ });
133
+ const AwsServiceSqsSendMessageStepSchema = z.object({
134
+ type: z.literal('aws-service'),
135
+ serviceAction: z.literal('sqs-send-message'),
136
+ name: z.string().min(1),
137
+ queueUrl: z.string().min(1),
138
+ messageBody: z.string().min(1),
139
+ delaySeconds: z.number().int().nonnegative().optional(),
140
+ messageAttributes: z.record(z.string(), SnsMessageAttributeSchema).optional(),
141
+ resultPath: z.string().optional(),
142
+ next: z.string().optional(),
143
+ });
144
+ const AwsServiceAthenaStartQueryStepSchema = z.object({
145
+ type: z.literal('aws-service'),
146
+ serviceAction: z.literal('athena-start-query'),
147
+ name: z.string().min(1),
148
+ queryString: z.string().min(1),
149
+ database: z.string().min(1),
150
+ outputLocation: z.string().min(1),
151
+ workGroup: z.string().optional(),
152
+ resultPath: z.string().optional(),
153
+ next: z.string().optional(),
154
+ });
155
+ const AwsServiceStepSchema = z.union([
156
+ AwsServiceSnsPublishStepSchema,
157
+ AwsServiceGlueStartJobRunStepSchema,
158
+ AwsServiceBatchSubmitJobStepSchema,
159
+ AwsServiceStepFunctionsStartExecutionStepSchema,
160
+ AwsServiceHttpsCallStepSchema,
161
+ AwsServiceSqsSendMessageStepSchema,
162
+ AwsServiceAthenaStartQueryStepSchema,
163
+ ]);
38
164
  const FlowControlStepSchema = z.discriminatedUnion('control', [
39
165
  z.object({ type: z.literal('flow-control'), control: z.literal('choice'), name: z.string(), choices: z.array(z.object({ when: z.string(), next: z.string() })), default: z.string().optional() }),
40
166
  z.object({ type: z.literal('flow-control'), control: z.literal('parallel'), name: z.string(), branches: z.array(z.array(z.unknown())), next: z.string().optional() }),
167
+ z.object({ type: z.literal('flow-control'), control: z.literal('map'), name: z.string(), iterator: z.array(z.unknown()).min(1), itemsPath: z.string().optional(), maxConcurrency: z.number().int().nonnegative().optional(), next: z.string().optional() }),
41
168
  z.object({ type: z.literal('flow-control'), control: z.literal('wait'), name: z.string(), seconds: z.number().int().positive(), next: z.string().optional() }),
42
169
  z.object({ type: z.literal('flow-control'), control: z.literal('succeed'), name: z.string() }),
43
170
  z.object({ type: z.literal('flow-control'), control: z.literal('fail'), name: z.string(), cause: z.string().optional(), error: z.string().optional() }),
@@ -47,6 +174,8 @@ const FlowStepSchema = z.union([
47
174
  DomainActionStepSchema,
48
175
  DomainApiStepSchema,
49
176
  DomainEventStepSchema,
177
+ DomainQueryStepSchema,
178
+ AwsServiceStepSchema,
50
179
  FlowControlStepSchema,
51
180
  ]);
52
181
  const FlowConfigSchema = z.object({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mettlecast/domain-cli",
3
- "version": "0.2.34",
3
+ "version": "0.2.35",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org",
@@ -51,9 +51,150 @@ const DomainEventStepSchema = z.object({
51
51
  next: z.string().optional(),
52
52
  });
53
53
 
54
+ const DynamoAttributeValueSchema = z.object({ type: z.enum(['S', 'N', 'B']), value: z.string() });
55
+
56
+ const DomainQueryDynamoGetItemStepSchema = z.object({
57
+ type: z.literal('domain-query'),
58
+ queryType: z.literal('dynamodb-get-item'),
59
+ name: z.string().min(1),
60
+ domainId: z.string().regex(/^[a-z][a-z0-9-]*$/),
61
+ key: z.object({ PK: z.string(), SK: z.string() }),
62
+ resultPath: z.string().optional(),
63
+ next: z.string().optional(),
64
+ });
65
+
66
+ const DomainQueryDynamoQueryStepSchema = z.object({
67
+ type: z.literal('domain-query'),
68
+ queryType: z.literal('dynamodb-query'),
69
+ name: z.string().min(1),
70
+ domainId: z.string().regex(/^[a-z][a-z0-9-]*$/),
71
+ keyConditionExpression: z.string().min(1),
72
+ expressionAttributeValues: z.record(z.string(), DynamoAttributeValueSchema),
73
+ expressionAttributeNames: z.record(z.string(), z.string()).optional(),
74
+ filterExpression: z.string().optional(),
75
+ indexName: z.string().optional(),
76
+ limit: z.number().int().positive().optional(),
77
+ scanIndexForward: z.boolean().optional(),
78
+ resultPath: z.string().optional(),
79
+ next: z.string().optional(),
80
+ });
81
+
82
+ const DomainQueryS3GetObjectStepSchema = z.object({
83
+ type: z.literal('domain-query'),
84
+ queryType: z.literal('s3-get-object'),
85
+ name: z.string().min(1),
86
+ domainId: z.string().regex(/^[a-z][a-z0-9-]*$/),
87
+ key: z.string().min(1),
88
+ resultPath: z.string().optional(),
89
+ next: z.string().optional(),
90
+ });
91
+
92
+ const DomainQueryStepSchema = z.union([
93
+ DomainQueryDynamoGetItemStepSchema,
94
+ DomainQueryDynamoQueryStepSchema,
95
+ DomainQueryS3GetObjectStepSchema,
96
+ ]);
97
+
98
+ const SnsMessageAttributeSchema = z.object({ dataType: z.string(), stringValue: z.string() });
99
+
100
+ const AwsServiceSnsPublishStepSchema = z.object({
101
+ type: z.literal('aws-service'),
102
+ serviceAction: z.literal('sns-publish'),
103
+ name: z.string().min(1),
104
+ topicArn: z.string().min(1),
105
+ message: z.string().min(1),
106
+ subject: z.string().optional(),
107
+ messageAttributes: z.record(z.string(), SnsMessageAttributeSchema).optional(),
108
+ resultPath: z.string().optional(),
109
+ next: z.string().optional(),
110
+ });
111
+
112
+ const AwsServiceGlueStartJobRunStepSchema = z.object({
113
+ type: z.literal('aws-service'),
114
+ serviceAction: z.literal('glue-start-job-run'),
115
+ name: z.string().min(1),
116
+ jobName: z.string().min(1),
117
+ arguments: z.record(z.string(), z.string()).optional(),
118
+ timeout: z.number().int().positive().optional(),
119
+ workerType: z.enum(['Standard', 'G.1X', 'G.2X']).optional(),
120
+ numberOfWorkers: z.number().int().positive().optional(),
121
+ resultPath: z.string().optional(),
122
+ next: z.string().optional(),
123
+ });
124
+
125
+ const AwsServiceBatchSubmitJobStepSchema = z.object({
126
+ type: z.literal('aws-service'),
127
+ serviceAction: z.literal('batch-submit-job'),
128
+ name: z.string().min(1),
129
+ batchJobName: z.string().min(1),
130
+ jobQueue: z.string().min(1),
131
+ jobDefinition: z.string().min(1),
132
+ parameters: z.record(z.string(), z.string()).optional(),
133
+ resultPath: z.string().optional(),
134
+ next: z.string().optional(),
135
+ });
136
+
137
+ const AwsServiceStepFunctionsStartExecutionStepSchema = z.object({
138
+ type: z.literal('aws-service'),
139
+ serviceAction: z.literal('step-functions-start-execution'),
140
+ name: z.string().min(1),
141
+ stateMachineArn: z.string().min(1),
142
+ input: z.record(z.string(), z.unknown()).optional(),
143
+ executionName: z.string().optional(),
144
+ resultPath: z.string().optional(),
145
+ next: z.string().optional(),
146
+ });
147
+
148
+ const AwsServiceHttpsCallStepSchema = z.object({
149
+ type: z.literal('aws-service'),
150
+ serviceAction: z.literal('https-call'),
151
+ name: z.string().min(1),
152
+ endpoint: z.string().min(1),
153
+ method: z.enum(['GET', 'POST', 'PUT', 'PATCH', 'DELETE']),
154
+ headers: z.record(z.string(), z.string()).optional(),
155
+ body: z.unknown().optional(),
156
+ resultPath: z.string().optional(),
157
+ next: z.string().optional(),
158
+ });
159
+
160
+ const AwsServiceSqsSendMessageStepSchema = z.object({
161
+ type: z.literal('aws-service'),
162
+ serviceAction: z.literal('sqs-send-message'),
163
+ name: z.string().min(1),
164
+ queueUrl: z.string().min(1),
165
+ messageBody: z.string().min(1),
166
+ delaySeconds: z.number().int().nonnegative().optional(),
167
+ messageAttributes: z.record(z.string(), SnsMessageAttributeSchema).optional(),
168
+ resultPath: z.string().optional(),
169
+ next: z.string().optional(),
170
+ });
171
+
172
+ const AwsServiceAthenaStartQueryStepSchema = z.object({
173
+ type: z.literal('aws-service'),
174
+ serviceAction: z.literal('athena-start-query'),
175
+ name: z.string().min(1),
176
+ queryString: z.string().min(1),
177
+ database: z.string().min(1),
178
+ outputLocation: z.string().min(1),
179
+ workGroup: z.string().optional(),
180
+ resultPath: z.string().optional(),
181
+ next: z.string().optional(),
182
+ });
183
+
184
+ const AwsServiceStepSchema = z.union([
185
+ AwsServiceSnsPublishStepSchema,
186
+ AwsServiceGlueStartJobRunStepSchema,
187
+ AwsServiceBatchSubmitJobStepSchema,
188
+ AwsServiceStepFunctionsStartExecutionStepSchema,
189
+ AwsServiceHttpsCallStepSchema,
190
+ AwsServiceSqsSendMessageStepSchema,
191
+ AwsServiceAthenaStartQueryStepSchema,
192
+ ]);
193
+
54
194
  const FlowControlStepSchema = z.discriminatedUnion('control', [
55
195
  z.object({ type: z.literal('flow-control'), control: z.literal('choice'), name: z.string(), choices: z.array(z.object({ when: z.string(), next: z.string() })), default: z.string().optional() }),
56
196
  z.object({ type: z.literal('flow-control'), control: z.literal('parallel'), name: z.string(), branches: z.array(z.array(z.unknown())), next: z.string().optional() }),
197
+ z.object({ type: z.literal('flow-control'), control: z.literal('map'), name: z.string(), iterator: z.array(z.unknown()).min(1), itemsPath: z.string().optional(), maxConcurrency: z.number().int().nonnegative().optional(), next: z.string().optional() }),
57
198
  z.object({ type: z.literal('flow-control'), control: z.literal('wait'), name: z.string(), seconds: z.number().int().positive(), next: z.string().optional() }),
58
199
  z.object({ type: z.literal('flow-control'), control: z.literal('succeed'), name: z.string() }),
59
200
  z.object({ type: z.literal('flow-control'), control: z.literal('fail'), name: z.string(), cause: z.string().optional(), error: z.string().optional() }),
@@ -64,6 +205,8 @@ const FlowStepSchema = z.union([
64
205
  DomainActionStepSchema,
65
206
  DomainApiStepSchema,
66
207
  DomainEventStepSchema,
208
+ DomainQueryStepSchema,
209
+ AwsServiceStepSchema,
67
210
  FlowControlStepSchema,
68
211
  ]);
69
212