@mbc-cqrs-serverless/cli 0.1.43-beta.0 → 0.1.45-beta.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/package.json +2 -2
- package/templates/.env.local +1 -0
- package/templates/infra/libs/infra-stack.ts +12 -3
- package/templates/infra/test/__snapshots__/infra.test.ts.snap +23 -2
- package/templates/infra-local/cognito-local/db/local_2G7noHgW.json +2 -2
- package/templates/infra-local/cognito-local/package-lock.json +11 -9
- package/templates/infra-local/elasticmq.conf +5 -0
- package/templates/infra-local/serverless.yml +23 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mbc-cqrs-serverless/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.45-beta.0",
|
|
4
4
|
"description": "a CLI to get started with MBC CQRS serverless framework",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mbc",
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@faker-js/faker": "^8.3.1"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "6dfc72e062a7c97915aca77c3f2438e198785d1f"
|
|
53
53
|
}
|
package/templates/.env.local
CHANGED
|
@@ -30,6 +30,7 @@ SFN_COMMAND_ARN=arn:aws:states:ap-northeast-1:101010101010:stateMachine:command
|
|
|
30
30
|
SNS_ENDPOINT=http://localhost:4002
|
|
31
31
|
SNS_REGION=ap-northeast-1
|
|
32
32
|
SNS_TOPIC_ARN=arn:aws:sns:ap-northeast-1:101010101010:CqrsSnsTopic
|
|
33
|
+
SNS_ALARM_TOPIC_ARN=arn:aws:sns:ap-northeast-1:101010101010:AlarmSnsTopic
|
|
33
34
|
# Cognito endpoint, useful for local development
|
|
34
35
|
COGNITO_URL=http://localhost:9229
|
|
35
36
|
COGNITO_USER_POOL_ID=local_2G7noHgW
|
|
@@ -72,7 +72,7 @@ export class InfraStack extends cdk.Stack {
|
|
|
72
72
|
mfa: cdk.aws_cognito.Mfa.OFF,
|
|
73
73
|
accountRecovery: cdk.aws_cognito.AccountRecovery.NONE,
|
|
74
74
|
customAttributes: {
|
|
75
|
-
|
|
75
|
+
tenant: new cdk.aws_cognito.StringAttribute({
|
|
76
76
|
mutable: true,
|
|
77
77
|
maxLen: 50,
|
|
78
78
|
}),
|
|
@@ -334,6 +334,7 @@ export class InfraStack extends cdk.Stack {
|
|
|
334
334
|
S3_BUCKET_NAME: ddbBucket.bucketName,
|
|
335
335
|
SFN_COMMAND_ARN: commandSfnArn,
|
|
336
336
|
SNS_TOPIC_ARN: mainSns.topicArn,
|
|
337
|
+
SNS_ALARM_TOPIC_ARN: alarmSns.topicArn,
|
|
337
338
|
COGNITO_USER_POOL_ID: userPool.userPoolId,
|
|
338
339
|
APPSYNC_ENDPOINT: appSyncApi.graphqlUrl,
|
|
339
340
|
SES_FROM_EMAIL: props.config.fromEmailAddress,
|
|
@@ -697,9 +698,15 @@ export class InfraStack extends cdk.Stack {
|
|
|
697
698
|
transformData,
|
|
698
699
|
cdk.aws_stepfunctions.IntegrationPattern.REQUEST_RESPONSE,
|
|
699
700
|
)
|
|
701
|
+
const setTtlCommand = lambdaInvoke(
|
|
702
|
+
'set_ttl_command',
|
|
703
|
+
historyCopy,
|
|
704
|
+
cdk.aws_stepfunctions.IntegrationPattern.REQUEST_RESPONSE,
|
|
705
|
+
)
|
|
706
|
+
|
|
700
707
|
const waitPrevCommand = lambdaInvoke(
|
|
701
708
|
'wait_prev_command',
|
|
702
|
-
|
|
709
|
+
setTtlCommand,
|
|
703
710
|
cdk.aws_stepfunctions.IntegrationPattern.WAIT_FOR_TASK_TOKEN,
|
|
704
711
|
)
|
|
705
712
|
|
|
@@ -713,7 +720,7 @@ export class InfraStack extends cdk.Stack {
|
|
|
713
720
|
)
|
|
714
721
|
.when(
|
|
715
722
|
cdk.aws_stepfunctions.Condition.numberEquals('$.result', 0),
|
|
716
|
-
|
|
723
|
+
setTtlCommand,
|
|
717
724
|
)
|
|
718
725
|
.when(
|
|
719
726
|
cdk.aws_stepfunctions.Condition.numberEquals('$.result', 1),
|
|
@@ -832,6 +839,7 @@ export class InfraStack extends cdk.Stack {
|
|
|
832
839
|
ddbBucket.grantReadWrite(lambdaApi)
|
|
833
840
|
publicBucket.grantReadWrite(lambdaApi)
|
|
834
841
|
mainSns.grantPublish(lambdaApi)
|
|
842
|
+
alarmSns.grantPublish(lambdaApi)
|
|
835
843
|
taskSqs.grantSendMessages(lambdaApi)
|
|
836
844
|
notifySqs.grantSendMessages(lambdaApi)
|
|
837
845
|
appSyncApi.grantMutation(lambdaApi)
|
|
@@ -906,6 +914,7 @@ export class InfraStack extends cdk.Stack {
|
|
|
906
914
|
ddbBucket.grantReadWrite(taskRole)
|
|
907
915
|
publicBucket.grantReadWrite(taskRole)
|
|
908
916
|
mainSns.grantPublish(taskRole)
|
|
917
|
+
alarmSns.grantPublish(taskRole)
|
|
909
918
|
taskSqs.grantSendMessages(taskRole)
|
|
910
919
|
notifySqs.grantSendMessages(taskRole)
|
|
911
920
|
appSyncApi.grantMutation(taskRole)
|
|
@@ -242,7 +242,7 @@ exports[`snapshot test for InfraStack 1`] = `
|
|
|
242
242
|
"Arn",
|
|
243
243
|
],
|
|
244
244
|
},
|
|
245
|
-
"","Payload":{"input.$":"$","context.$":"$$"}}},"check_version_result":{"Type":"Choice","Choices":[{"Variable":"$.result","NumericEquals":0,"Next":"
|
|
245
|
+
"","Payload":{"input.$":"$","context.$":"$$"}}},"check_version_result":{"Type":"Choice","Choices":[{"Variable":"$.result","NumericEquals":0,"Next":"set_ttl_command"},{"Variable":"$.result","NumericEquals":1,"Next":"wait_prev_command"},{"Variable":"$.result","NumericEquals":-1,"Next":"fail"}],"Default":"wait_prev_command"},"wait_prev_command":{"Next":"set_ttl_command","Retry":[{"ErrorEquals":["Lambda.ClientExecutionTimeoutException","Lambda.ServiceException","Lambda.AWSLambdaException","Lambda.SdkClientException"],"IntervalSeconds":2,"MaxAttempts":6,"BackoffRate":2}],"Type":"Task","OutputPath":"$.Payload[0][0]","Resource":"arn:",
|
|
246
246
|
{
|
|
247
247
|
"Ref": "AWS::Partition",
|
|
248
248
|
},
|
|
@@ -253,7 +253,18 @@ exports[`snapshot test for InfraStack 1`] = `
|
|
|
253
253
|
"Arn",
|
|
254
254
|
],
|
|
255
255
|
},
|
|
256
|
-
"","Payload":{"input.$":"$","context.$":"$$","taskToken.$":"$$.Task.Token"}}},"
|
|
256
|
+
"","Payload":{"input.$":"$","context.$":"$$","taskToken.$":"$$.Task.Token"}}},"set_ttl_command":{"Next":"history_copy","Retry":[{"ErrorEquals":["Lambda.ClientExecutionTimeoutException","Lambda.ServiceException","Lambda.AWSLambdaException","Lambda.SdkClientException"],"IntervalSeconds":2,"MaxAttempts":6,"BackoffRate":2}],"Type":"Task","OutputPath":"$.Payload[0][0]","Resource":"arn:",
|
|
257
|
+
{
|
|
258
|
+
"Ref": "AWS::Partition",
|
|
259
|
+
},
|
|
260
|
+
":states:::lambda:invoke","Parameters":{"FunctionName":"",
|
|
261
|
+
{
|
|
262
|
+
"Fn::GetAtt": [
|
|
263
|
+
"lambdaapi893CD94E",
|
|
264
|
+
"Arn",
|
|
265
|
+
],
|
|
266
|
+
},
|
|
267
|
+
"","Payload":{"input.$":"$","context.$":"$$"}}},"history_copy":{"Next":"transform_data","Retry":[{"ErrorEquals":["Lambda.ClientExecutionTimeoutException","Lambda.ServiceException","Lambda.AWSLambdaException","Lambda.SdkClientException"],"IntervalSeconds":2,"MaxAttempts":6,"BackoffRate":2}],"Type":"Task","OutputPath":"$.Payload[0][0]","Resource":"arn:",
|
|
257
268
|
{
|
|
258
269
|
"Ref": "AWS::Partition",
|
|
259
270
|
},
|
|
@@ -631,6 +642,9 @@ exports[`snapshot test for InfraStack 1`] = `
|
|
|
631
642
|
},
|
|
632
643
|
"SES_FROM_EMAIL": "noreply@mbc-cqrs-serverless.mbc-net.com",
|
|
633
644
|
"SFN_COMMAND_ARN": "arn:aws:states:ap-northeast-1:101010101010:stateMachine:dev-cdk-test-deploy-command-handler",
|
|
645
|
+
"SNS_ALARM_TOPIC_ARN": {
|
|
646
|
+
"Ref": "alarmsnsFB7BBC3B",
|
|
647
|
+
},
|
|
634
648
|
"SNS_TOPIC_ARN": {
|
|
635
649
|
"Ref": "mainsnsC0381B34",
|
|
636
650
|
},
|
|
@@ -983,6 +997,13 @@ exports[`snapshot test for InfraStack 1`] = `
|
|
|
983
997
|
"Ref": "mainsnsC0381B34",
|
|
984
998
|
},
|
|
985
999
|
},
|
|
1000
|
+
{
|
|
1001
|
+
"Action": "sns:Publish",
|
|
1002
|
+
"Effect": "Allow",
|
|
1003
|
+
"Resource": {
|
|
1004
|
+
"Ref": "alarmsnsFB7BBC3B",
|
|
1005
|
+
},
|
|
1006
|
+
},
|
|
986
1007
|
{
|
|
987
1008
|
"Action": [
|
|
988
1009
|
"sqs:SendMessage",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"Value": "admin@test.com"
|
|
12
12
|
},
|
|
13
13
|
{
|
|
14
|
-
"Name": "custom:
|
|
14
|
+
"Name": "custom:tenant",
|
|
15
15
|
"Value": "mbc"
|
|
16
16
|
},
|
|
17
17
|
{
|
|
@@ -261,7 +261,7 @@
|
|
|
261
261
|
}
|
|
262
262
|
},
|
|
263
263
|
{
|
|
264
|
-
"Name": "custom:
|
|
264
|
+
"Name": "custom:tenant",
|
|
265
265
|
"AttributeDataType": "String",
|
|
266
266
|
"DeveloperOnlyAttribute": false,
|
|
267
267
|
"Mutable": true,
|
|
@@ -919,10 +919,9 @@
|
|
|
919
919
|
}
|
|
920
920
|
},
|
|
921
921
|
"node_modules/express": {
|
|
922
|
-
"version": "4.21.
|
|
923
|
-
"resolved": "https://registry.npmjs.org/express/-/express-4.21.
|
|
924
|
-
"integrity": "sha512-
|
|
925
|
-
"license": "MIT",
|
|
922
|
+
"version": "4.21.2",
|
|
923
|
+
"resolved": "https://registry.npmjs.org/express/-/express-4.21.2.tgz",
|
|
924
|
+
"integrity": "sha512-28HqgMZAmih1Czt9ny7qr6ek2qddF4FclbMzwhCREB6OFfH+rXAnuNCwo1/wFvrtbgsQDb4kSbX9de9lFbrXnA==",
|
|
926
925
|
"dependencies": {
|
|
927
926
|
"accepts": "~1.3.8",
|
|
928
927
|
"array-flatten": "1.1.1",
|
|
@@ -943,7 +942,7 @@
|
|
|
943
942
|
"methods": "~1.1.2",
|
|
944
943
|
"on-finished": "2.4.1",
|
|
945
944
|
"parseurl": "~1.3.3",
|
|
946
|
-
"path-to-regexp": "0.1.
|
|
945
|
+
"path-to-regexp": "0.1.12",
|
|
947
946
|
"proxy-addr": "~2.0.7",
|
|
948
947
|
"qs": "6.13.0",
|
|
949
948
|
"range-parser": "~1.2.1",
|
|
@@ -958,6 +957,10 @@
|
|
|
958
957
|
},
|
|
959
958
|
"engines": {
|
|
960
959
|
"node": ">= 0.10.0"
|
|
960
|
+
},
|
|
961
|
+
"funding": {
|
|
962
|
+
"type": "opencollective",
|
|
963
|
+
"url": "https://opencollective.com/express"
|
|
961
964
|
}
|
|
962
965
|
},
|
|
963
966
|
"node_modules/fast-redact": {
|
|
@@ -1854,10 +1857,9 @@
|
|
|
1854
1857
|
}
|
|
1855
1858
|
},
|
|
1856
1859
|
"node_modules/path-to-regexp": {
|
|
1857
|
-
"version": "0.1.
|
|
1858
|
-
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.
|
|
1859
|
-
"integrity": "sha512-
|
|
1860
|
-
"license": "MIT"
|
|
1860
|
+
"version": "0.1.12",
|
|
1861
|
+
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.12.tgz",
|
|
1862
|
+
"integrity": "sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ=="
|
|
1861
1863
|
},
|
|
1862
1864
|
"node_modules/picomatch": {
|
|
1863
1865
|
"version": "2.3.1",
|
|
@@ -40,6 +40,10 @@ custom:
|
|
|
40
40
|
['notification-action', 'command-status', 'task-status'],
|
|
41
41
|
}
|
|
42
42
|
queue: http://localhost:9324/101010101010/notification-queue
|
|
43
|
+
- topic:
|
|
44
|
+
topicName: AlarmSnsTopic
|
|
45
|
+
rawMessageDelivery: 'true'
|
|
46
|
+
queue: http://localhost:9324/101010101010/alarm-queue
|
|
43
47
|
# host: 0.0.0.0 # Optional, defaults to 127.0.0.1 if not provided to serverless-offline
|
|
44
48
|
# sns-endpoint: http://127.0.0.1:4567 # Optional. Only if you want to use a custom SNS provider endpoint
|
|
45
49
|
# sns-subscribe-endpoint: http://127.0.0.1:3000 # Optional. Only if you want to use a custom subscribe endpoint from SNS to send messages back to
|
|
@@ -187,7 +191,7 @@ stepFunctions:
|
|
|
187
191
|
Choices:
|
|
188
192
|
- Variable: $.result
|
|
189
193
|
NumericEquals: 0
|
|
190
|
-
Next:
|
|
194
|
+
Next: set_ttl_command
|
|
191
195
|
- Variable: $.result
|
|
192
196
|
NumericEquals: 1
|
|
193
197
|
Next: wait_prev_command
|
|
@@ -213,6 +217,24 @@ stepFunctions:
|
|
|
213
217
|
MaxAttempts: 5
|
|
214
218
|
BackoffRate: 2
|
|
215
219
|
OutputPath: $.Payload[0][0]
|
|
220
|
+
Next: set_ttl_command
|
|
221
|
+
set_ttl_command:
|
|
222
|
+
Type: Task
|
|
223
|
+
Resource: arn:aws:states:::lambda:invoke
|
|
224
|
+
Parameters:
|
|
225
|
+
FunctionName: arn:aws:lambda:ap-northeast-1:101010101010:function:serverless-example-dev-main
|
|
226
|
+
Payload:
|
|
227
|
+
input.$: $
|
|
228
|
+
context.$: $$
|
|
229
|
+
Retry:
|
|
230
|
+
- ErrorEquals:
|
|
231
|
+
- Lambda.ServiceException
|
|
232
|
+
- Lambda.AWSLambdaException
|
|
233
|
+
- Lambda.SdkClientException
|
|
234
|
+
IntervalSeconds: 2
|
|
235
|
+
MaxAttempts: 5
|
|
236
|
+
BackoffRate: 2
|
|
237
|
+
OutputPath: $.Payload[0][0]
|
|
216
238
|
Next: history_copy
|
|
217
239
|
history_copy:
|
|
218
240
|
Type: Task
|