@mbc-cqrs-serverless/cli 1.1.4 → 1.1.5
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mbc-cqrs-serverless/cli",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.5",
|
|
4
4
|
"description": "a CLI to get started with MBC CQRS serverless framework",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mbc",
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"@faker-js/faker": "^8.3.1",
|
|
59
59
|
"copyfiles": "^2.4.1"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "49613427dee943fe5d821a1c08661ca28c59a3a4"
|
|
62
62
|
}
|
|
@@ -887,9 +887,45 @@ export class InfraStack extends cdk.Stack {
|
|
|
887
887
|
cdk.aws_stepfunctions.IntegrationPattern.REQUEST_RESPONSE,
|
|
888
888
|
)
|
|
889
889
|
|
|
890
|
+
const importCsvSuccess = new cdk.aws_stepfunctions.Succeed(
|
|
891
|
+
this,
|
|
892
|
+
'ImportCsvSuccess',
|
|
893
|
+
{
|
|
894
|
+
stateName: 'success',
|
|
895
|
+
},
|
|
896
|
+
)
|
|
897
|
+
|
|
898
|
+
const finalizeParentJobInvoke = new cdk.aws_stepfunctions_tasks.LambdaInvoke(
|
|
899
|
+
this,
|
|
900
|
+
'finalize_parent_job',
|
|
901
|
+
{
|
|
902
|
+
lambdaFunction: lambdaApi,
|
|
903
|
+
payload: cdk.aws_stepfunctions.TaskInput.fromObject({
|
|
904
|
+
'input.$': '$',
|
|
905
|
+
'context.$': '$$',
|
|
906
|
+
}),
|
|
907
|
+
stateName: 'finalize_parent_job',
|
|
908
|
+
outputPath: '$.Payload[0][0]',
|
|
909
|
+
integrationPattern:
|
|
910
|
+
cdk.aws_stepfunctions.IntegrationPattern.REQUEST_RESPONSE,
|
|
911
|
+
retryOnServiceExceptions: false,
|
|
912
|
+
},
|
|
913
|
+
)
|
|
914
|
+
finalizeParentJobInvoke.addRetry({
|
|
915
|
+
errors: [
|
|
916
|
+
'Lambda.ServiceException',
|
|
917
|
+
'Lambda.AWSLambdaException',
|
|
918
|
+
'Lambda.SdkClientException',
|
|
919
|
+
],
|
|
920
|
+
interval: cdk.Duration.seconds(2),
|
|
921
|
+
maxAttempts: 5,
|
|
922
|
+
backoffRate: 2,
|
|
923
|
+
})
|
|
924
|
+
const finalizeParentJobState = finalizeParentJobInvoke.next(importCsvSuccess)
|
|
925
|
+
|
|
890
926
|
const sfnImportCsvDefinition = new DistributedMap(this, 'import-csv', {
|
|
891
927
|
maxConcurrency: 50,
|
|
892
|
-
resultPath:
|
|
928
|
+
resultPath: '$.processingResults',
|
|
893
929
|
})
|
|
894
930
|
.setLabel('import-csv')
|
|
895
931
|
.setItemReader({
|
|
@@ -903,8 +939,10 @@ export class InfraStack extends cdk.Stack {
|
|
|
903
939
|
'Key.$': '$.key',
|
|
904
940
|
},
|
|
905
941
|
})
|
|
942
|
+
// For ImportPublishMode.SYNC tables, keep MaxItemsPerBatch low enough that sequential
|
|
943
|
+
// publishSync per row stays within the Lambda timeout (see import package import-publish.ts).
|
|
906
944
|
.setItemBatcher({
|
|
907
|
-
|
|
945
|
+
MaxItemsPerBatch: 100,
|
|
908
946
|
BatchInput: {
|
|
909
947
|
'Attributes.$': '$',
|
|
910
948
|
},
|
|
@@ -912,6 +950,7 @@ export class InfraStack extends cdk.Stack {
|
|
|
912
950
|
.itemProcessor(csvRowsHandlerState, {
|
|
913
951
|
executionType: cdk.aws_stepfunctions.ProcessorType.EXPRESS,
|
|
914
952
|
})
|
|
953
|
+
.next(finalizeParentJobState)
|
|
915
954
|
|
|
916
955
|
const sfnImportCsvLogGroup = new cdk.aws_logs.LogGroup(
|
|
917
956
|
this,
|
|
@@ -435,7 +435,76 @@ stepFunctions:
|
|
|
435
435
|
IntervalSeconds: 2
|
|
436
436
|
MaxAttempts: 5
|
|
437
437
|
BackoffRate: 2
|
|
438
|
-
OutputPath: $.Payload
|
|
438
|
+
OutputPath: $.Payload
|
|
439
|
+
Next: finalize_parent_job
|
|
440
|
+
finalize_parent_job:
|
|
441
|
+
Type: Task
|
|
442
|
+
Resource: arn:aws:states:::lambda:invoke
|
|
443
|
+
Parameters:
|
|
444
|
+
FunctionName: arn:aws:lambda:ap-northeast-1:101010101010:function:serverless-example-dev-main
|
|
445
|
+
Payload:
|
|
446
|
+
input.$: $
|
|
447
|
+
context.$: $$
|
|
448
|
+
Retry:
|
|
449
|
+
- ErrorEquals:
|
|
450
|
+
- Lambda.ServiceException
|
|
451
|
+
- Lambda.AWSLambdaException
|
|
452
|
+
- Lambda.SdkClientException
|
|
453
|
+
IntervalSeconds: 2
|
|
454
|
+
MaxAttempts: 5
|
|
455
|
+
BackoffRate: 2
|
|
456
|
+
OutputPath: $.Payload
|
|
457
|
+
End: true
|
|
458
|
+
import-zip:
|
|
459
|
+
name: import-zip
|
|
460
|
+
definition:
|
|
461
|
+
Comment: 'Orchestrates the sequential processing of CSV files from a ZIP
|
|
462
|
+
archive.'
|
|
463
|
+
StartAt: ProcessFilesSequentially
|
|
464
|
+
States:
|
|
465
|
+
ProcessFilesSequentially:
|
|
466
|
+
Type: Map
|
|
467
|
+
ItemsPath: $.sortedS3Keys # The sorted array of S3 keys from the trigger
|
|
468
|
+
MaxConcurrency: 1 # Enforces sequential processing
|
|
469
|
+
Iterator:
|
|
470
|
+
StartAt: trigger_single_csv_and_wait
|
|
471
|
+
States:
|
|
472
|
+
trigger_single_csv_and_wait:
|
|
473
|
+
Type: Task
|
|
474
|
+
Resource: 'arn:aws:states:::lambda:invoke.waitForTaskToken'
|
|
475
|
+
Parameters:
|
|
476
|
+
FunctionName: 'arn:aws:lambda:ap-northeast-1:101010101010:function:serverless-example-dev-main'
|
|
477
|
+
Payload:
|
|
478
|
+
input.$: '$' # Passes the current S3 key to the Lambda
|
|
479
|
+
context.$: '$$' # Passes the full state machine context
|
|
480
|
+
taskToken.$: '$$.Task.Token'
|
|
481
|
+
Retry:
|
|
482
|
+
- ErrorEquals:
|
|
483
|
+
- Lambda.ServiceException
|
|
484
|
+
- Lambda.AWSLambdaException
|
|
485
|
+
- Lambda.SdkClientException
|
|
486
|
+
IntervalSeconds: 2
|
|
487
|
+
MaxAttempts: 5
|
|
488
|
+
BackoffRate: 2
|
|
489
|
+
End: true
|
|
490
|
+
Next: finalize_zip_job
|
|
491
|
+
finalize_zip_job:
|
|
492
|
+
Type: Task
|
|
493
|
+
Resource: arn:aws:states:::lambda:invoke
|
|
494
|
+
Parameters:
|
|
495
|
+
FunctionName: arn:aws:lambda:ap-northeast-1:101010101010:function:serverless-example-dev-main
|
|
496
|
+
Payload:
|
|
497
|
+
input.$: $
|
|
498
|
+
context.$: $$
|
|
499
|
+
Retry:
|
|
500
|
+
- ErrorEquals:
|
|
501
|
+
- Lambda.ServiceException
|
|
502
|
+
- Lambda.AWSLambdaException
|
|
503
|
+
- Lambda.SdkClientException
|
|
504
|
+
IntervalSeconds: 2
|
|
505
|
+
MaxAttempts: 5
|
|
506
|
+
BackoffRate: 2
|
|
507
|
+
OutputPath: $.Payload
|
|
439
508
|
End: true
|
|
440
509
|
resources:
|
|
441
510
|
Resources:
|