@bitblit/ratchet-aws 4.0.98-alpha → 4.0.102-alpha
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/dist/{types/batch → batch}/aws-batch-background-processor.d.ts +1 -5
- package/dist/{es/batch → batch}/aws-batch-background-processor.js +6 -1
- package/dist/batch/aws-batch-background-processor.spec.js +15 -0
- package/dist/{types/batch → batch}/aws-batch-ratchet.d.ts +0 -3
- package/dist/{es/batch → batch}/aws-batch-ratchet.js +5 -1
- package/dist/batch/aws-batch-ratchet.spec.js +33 -0
- package/dist/{types/build → build}/ratchet-aws-info.d.ts +1 -1
- package/dist/{types/cache → cache}/dynamo-db-storage-provider.d.ts +3 -3
- package/dist/{es/cache → cache}/dynamo-db-storage-provider.js +3 -1
- package/dist/{types/cache → cache}/s3-storage-provider.d.ts +3 -3
- package/dist/{es/cache → cache}/s3-storage-provider.js +4 -1
- package/dist/{types/cache → cache}/simple-cache-storage-provider.d.ts +1 -1
- package/dist/{types/cache → cache}/simple-cache.d.ts +3 -3
- package/dist/{es/cache → cache}/simple-cache.js +4 -2
- package/dist/cache/simple-cache.spec.js +67 -0
- package/dist/{es/cloudwatch → cloudwatch}/cloud-watch-log-group-ratchet.js +4 -2
- package/dist/cloudwatch/cloud-watch-log-group-ratchet.spec.js +19 -0
- package/dist/{es/cloudwatch → cloudwatch}/cloud-watch-logs-ratchet.js +6 -5
- package/dist/cloudwatch/cloud-watch-logs-ratchet.spec.js +84 -0
- package/dist/{types/cloudwatch → cloudwatch}/cloud-watch-metrics-ratchet.d.ts +3 -3
- package/dist/{es/cloudwatch → cloudwatch}/cloud-watch-metrics-ratchet.js +3 -2
- package/dist/cloudwatch/cloud-watch-metrics-ratchet.spec.js +23 -0
- package/dist/{types/daemon → daemon}/daemon-like.d.ts +3 -3
- package/dist/{types/daemon → daemon}/daemon-process-state-public-token.d.ts +1 -1
- package/dist/{types/daemon → daemon}/daemon-util.d.ts +5 -11
- package/dist/{es/daemon → daemon}/daemon-util.js +3 -3
- package/dist/daemon/daemon-util.spec.d.ts +4 -0
- package/dist/daemon/daemon-util.spec.js +79 -0
- package/dist/{types/daemon → daemon}/daemon.d.ts +5 -5
- package/dist/{es/daemon → daemon}/daemon.js +12 -6
- package/dist/{types/dao → dao}/prototype-dao-provider.d.ts +1 -1
- package/dist/{types/dao → dao}/prototype-dao.d.ts +2 -2
- package/dist/{es/dao → dao}/prototype-dao.js +5 -1
- package/dist/dao/prototype-dao.spec.d.ts +8 -0
- package/dist/dao/prototype-dao.spec.js +26 -0
- package/dist/{types/dao → dao}/s3-prototype-dao-provider.d.ts +3 -3
- package/dist/{es/dao → dao}/s3-prototype-dao-provider.js +3 -1
- package/dist/{types/dao → dao}/s3-simple-dao.d.ts +2 -2
- package/dist/{es/dao → dao}/s3-simple-dao.js +4 -2
- package/dist/{types/dynamodb → dynamodb}/dynamo-ratchet-like.d.ts +3 -3
- package/dist/{types/dynamodb → dynamodb}/dynamo-ratchet.d.ts +4 -4
- package/dist/{es/dynamodb → dynamodb}/dynamo-ratchet.js +7 -6
- package/dist/dynamodb/dynamo-ratchet.spec.js +156 -0
- package/dist/{es/dynamodb → dynamodb}/dynamo-table-ratchet.js +5 -4
- package/dist/{es/dynamodb → dynamodb}/hash-spreader.js +8 -1
- package/dist/dynamodb/hash-spreader.spec.js +17 -0
- package/dist/{types/ec2 → ec2}/ec2-ratchet.d.ts +0 -11
- package/dist/{es/ec2 → ec2}/ec2-ratchet.js +7 -3
- package/dist/ec2/ec2-ratchet.spec.js +31 -0
- package/dist/{types/environment → environment}/cascade-environment-service-provider.d.ts +1 -4
- package/dist/{es/environment → environment}/cascade-environment-service-provider.js +3 -2
- package/dist/{types/environment → environment}/env-var-environment-service-provider.d.ts +1 -5
- package/dist/{es/environment → environment}/env-var-environment-service-provider.js +5 -4
- package/dist/{types/environment → environment}/environment-service-config.d.ts +0 -3
- package/dist/environment/environment-service-provider.d.ts +3 -0
- package/dist/{types/environment → environment}/environment-service.d.ts +2 -5
- package/dist/{es/environment → environment}/environment-service.js +7 -5
- package/dist/environment/environment-service.spec.js +22 -0
- package/dist/{types/environment → environment}/fixed-environment-service-provider.d.ts +1 -4
- package/dist/{es/environment → environment}/fixed-environment-service-provider.js +3 -2
- package/dist/{types/environment → environment}/s3-environment-service-provider.d.ts +1 -4
- package/dist/{es/environment → environment}/s3-environment-service-provider.js +7 -5
- package/dist/{types/environment → environment}/ssm-environment-service-provider.d.ts +1 -5
- package/dist/{es/environment → environment}/ssm-environment-service-provider.js +9 -6
- package/dist/{types/expiring-code → expiring-code}/dynamo-expiring-code-provider.d.ts +4 -4
- package/dist/{es/expiring-code → expiring-code}/dynamo-expiring-code-provider.js +2 -0
- package/dist/{types/expiring-code → expiring-code}/expiring-code-provider.d.ts +1 -1
- package/dist/{types/expiring-code → expiring-code}/expiring-code-ratchet.d.ts +3 -6
- package/dist/{es/expiring-code → expiring-code}/expiring-code-ratchet.js +3 -2
- package/dist/expiring-code/expiring-code-ratchet.spec.js +7 -0
- package/dist/{types/expiring-code → expiring-code}/s3-expiring-code-provider.d.ts +3 -3
- package/dist/{es/expiring-code → expiring-code}/s3-expiring-code-provider.js +4 -1
- package/dist/expiring-code/s3-expiring-code-provider.spec.js +46 -0
- package/dist/{types/iam → iam}/aws-credentials-ratchet.d.ts +0 -5
- package/dist/{es/iam → iam}/aws-credentials-ratchet.js +2 -1
- package/dist/{es/lambda → lambda}/lambda-event-type-guards.js +1 -1
- package/dist/{types/model → model}/cloud-watch-metrics-minute-level-dynamo-count-request.d.ts +2 -2
- package/dist/model/dynamo/doc-put-item-command-input.js +1 -0
- package/dist/model/dynamo/doc-query-command-input.js +1 -0
- package/dist/model/dynamo/doc-scan-command-input.js +1 -0
- package/dist/model/dynamo/doc-update-item-command-input.js +1 -0
- package/dist/{es/route53 → route53}/route-53-ratchet.js +3 -1
- package/dist/{types/runtime-parameter → runtime-parameter}/cached-stored-runtime-parameter.d.ts +1 -1
- package/dist/runtime-parameter/cached-stored-runtime-parameter.js +1 -0
- package/dist/{types/runtime-parameter → runtime-parameter}/dynamo-runtime-parameter-provider.d.ts +3 -3
- package/dist/{es/runtime-parameter → runtime-parameter}/dynamo-runtime-parameter-provider.js +4 -2
- package/dist/runtime-parameter/dynamo-runtime-parameter-provider.spec.d.ts +1 -0
- package/dist/runtime-parameter/dynamo-runtime-parameter-provider.spec.js +49 -0
- package/dist/{types/runtime-parameter → runtime-parameter}/global-variable-override-runtime-parameter-provider.d.ts +2 -9
- package/dist/{es/runtime-parameter → runtime-parameter}/global-variable-override-runtime-parameter-provider.js +10 -8
- package/dist/runtime-parameter/global-variable-override-runtime-parameter-provider.spec.d.ts +1 -0
- package/dist/runtime-parameter/global-variable-override-runtime-parameter-provider.spec.js +37 -0
- package/dist/{types/runtime-parameter → runtime-parameter}/memory-runtime-parameter-provider.d.ts +2 -6
- package/dist/{es/runtime-parameter → runtime-parameter}/memory-runtime-parameter-provider.js +2 -1
- package/dist/{types/runtime-parameter → runtime-parameter}/runtime-parameter-provider.d.ts +1 -6
- package/dist/runtime-parameter/runtime-parameter-provider.js +1 -0
- package/dist/{types/runtime-parameter → runtime-parameter}/runtime-parameter-ratchet.d.ts +2 -2
- package/dist/{es/runtime-parameter → runtime-parameter}/runtime-parameter-ratchet.js +4 -3
- package/dist/runtime-parameter/runtime-parameter-ratchet.spec.d.ts +1 -0
- package/dist/runtime-parameter/runtime-parameter-ratchet.spec.js +39 -0
- package/dist/runtime-parameter/stored-runtime-parameter.js +1 -0
- package/dist/{types/s3 → s3}/s3-cache-ratchet.d.ts +3 -4
- package/dist/{es/s3 → s3}/s3-cache-ratchet.js +7 -5
- package/dist/s3/s3-cache-ratchet.spec.d.ts +1 -0
- package/dist/s3/s3-cache-ratchet.spec.js +97 -0
- package/dist/{types/s3 → s3}/s3-cache-to-local-disk-ratchet.d.ts +2 -5
- package/dist/{es/s3 → s3}/s3-cache-to-local-disk-ratchet.js +8 -3
- package/dist/s3/s3-cache-to-local-dist-ratchet.spec.d.ts +1 -0
- package/dist/s3/s3-cache-to-local-dist-ratchet.spec.js +22 -0
- package/dist/{es/s3 → s3}/s3-location-sync-ratchet.js +4 -1
- package/dist/{es/s3 → s3}/s3-ratchet.js +1 -1
- package/dist/s3/s3-ratchet.spec.d.ts +1 -0
- package/dist/s3/s3-ratchet.spec.js +20 -0
- package/dist/ses/email-attachment.d.ts +5 -0
- package/dist/ses/email-attachment.js +1 -0
- package/dist/{types/ses → ses}/mailer-config.d.ts +2 -5
- package/dist/ses/mailer-config.js +1 -0
- package/dist/{types/ses → ses}/mailer-like.d.ts +2 -9
- package/dist/ses/mailer-like.js +1 -0
- package/dist/{types/ses → ses}/mailer.d.ts +4 -11
- package/dist/{es/ses → ses}/mailer.js +8 -6
- package/dist/ses/mailer.spec.d.ts +1 -0
- package/dist/ses/mailer.spec.js +104 -0
- package/dist/{types/ses → ses}/ratchet-template-renderer.d.ts +0 -4
- package/dist/ses/ratchet-template-renderer.js +1 -0
- package/dist/ses/ready-to-send-email.d.ts +13 -0
- package/dist/ses/ready-to-send-email.js +1 -0
- package/dist/{types/ses → ses}/remote-handlebars-template-renderer.d.ts +1 -3
- package/dist/{es/ses → ses}/remote-handlebars-template-renderer.js +6 -2
- package/dist/ses/resolved-ready-to-send-email.d.ts +5 -0
- package/dist/ses/resolved-ready-to-send-email.js +1 -0
- package/dist/{es/sns → sns}/sns-ratchet.js +4 -2
- package/dist/sns/sns-ratchet.spec.d.ts +1 -0
- package/dist/sns/sns-ratchet.spec.js +17 -0
- package/dist/{types/sync-lock → sync-lock}/dynamo-db-sync-lock.d.ts +2 -2
- package/dist/{es/sync-lock → sync-lock}/dynamo-db-sync-lock.js +5 -1
- package/dist/sync-lock/dynamo-db-sync-lock.spec.d.ts +1 -0
- package/dist/sync-lock/dynamo-db-sync-lock.spec.js +30 -0
- package/dist/{types/sync-lock → sync-lock}/memory-sync-lock.d.ts +1 -4
- package/dist/{es/sync-lock → sync-lock}/memory-sync-lock.js +3 -4
- package/dist/sync-lock/sync-lock-provider.js +1 -0
- package/package.json +50 -51
- package/dist/cjs/batch/aws-batch-background-processor.js +0 -44
- package/dist/cjs/batch/aws-batch-ratchet.js +0 -55
- package/dist/cjs/build/ratchet-aws-info.js +0 -18
- package/dist/cjs/cache/dynamo-db-storage-provider.js +0 -111
- package/dist/cjs/cache/s3-storage-provider.js +0 -44
- package/dist/cjs/cache/simple-cache-object-wrapper.js +0 -2
- package/dist/cjs/cache/simple-cache-read-options.js +0 -2
- package/dist/cjs/cache/simple-cache-storage-provider.js +0 -2
- package/dist/cjs/cache/simple-cache.js +0 -66
- package/dist/cjs/cloudwatch/cloud-watch-log-group-ratchet.js +0 -73
- package/dist/cjs/cloudwatch/cloud-watch-logs-ratchet.js +0 -173
- package/dist/cjs/cloudwatch/cloud-watch-metrics-ratchet.js +0 -57
- package/dist/cjs/daemon/daemon-like.js +0 -2
- package/dist/cjs/daemon/daemon-process-create-options.js +0 -2
- package/dist/cjs/daemon/daemon-process-state-public-token.js +0 -2
- package/dist/cjs/daemon/daemon-process-state.js +0 -2
- package/dist/cjs/daemon/daemon-util.js +0 -152
- package/dist/cjs/daemon/daemon.js +0 -126
- package/dist/cjs/dao/prototype-dao-config.js +0 -2
- package/dist/cjs/dao/prototype-dao-db.js +0 -2
- package/dist/cjs/dao/prototype-dao-provider.js +0 -2
- package/dist/cjs/dao/prototype-dao.js +0 -88
- package/dist/cjs/dao/s3-prototype-dao-provider.js +0 -28
- package/dist/cjs/dao/s3-simple-dao.js +0 -78
- package/dist/cjs/dao/simple-dao-item.js +0 -2
- package/dist/cjs/dynamodb/dynamo-ratchet-like.js +0 -2
- package/dist/cjs/dynamodb/dynamo-ratchet.js +0 -667
- package/dist/cjs/dynamodb/dynamo-table-ratchet.js +0 -91
- package/dist/cjs/dynamodb/hash-spreader.js +0 -62
- package/dist/cjs/ec2/ec2-ratchet.js +0 -107
- package/dist/cjs/environment/cascade-environment-service-provider.js +0 -27
- package/dist/cjs/environment/env-var-environment-service-provider.js +0 -33
- package/dist/cjs/environment/environment-service-config.js +0 -2
- package/dist/cjs/environment/environment-service-provider.js +0 -2
- package/dist/cjs/environment/environment-service.js +0 -52
- package/dist/cjs/environment/fixed-environment-service-provider.js +0 -24
- package/dist/cjs/environment/s3-environment-service-provider.js +0 -29
- package/dist/cjs/environment/ssm-environment-service-provider.js +0 -61
- package/dist/cjs/expiring-code/dynamo-expiring-code-provider.js +0 -26
- package/dist/cjs/expiring-code/expiring-code-params.js +0 -2
- package/dist/cjs/expiring-code/expiring-code-provider.js +0 -2
- package/dist/cjs/expiring-code/expiring-code-ratchet.js +0 -37
- package/dist/cjs/expiring-code/expiring-code.js +0 -2
- package/dist/cjs/expiring-code/s3-expiring-code-provider.js +0 -49
- package/dist/cjs/iam/aws-credentials-ratchet.js +0 -21
- package/dist/cjs/index.js +0 -81
- package/dist/cjs/lambda/lambda-event-detector.js +0 -42
- package/dist/cjs/lambda/lambda-event-type-guards.js +0 -28
- package/dist/cjs/model/cloud-watch-metrics-minute-level-dynamo-count-request.js +0 -2
- package/dist/cjs/model/cloud-watch-metrics-unit.js +0 -33
- package/dist/cjs/model/dynamo/doc-put-item-command-input.js +0 -2
- package/dist/cjs/model/dynamo/doc-query-command-input.js +0 -2
- package/dist/cjs/model/dynamo/doc-scan-command-input.js +0 -2
- package/dist/cjs/model/dynamo/doc-update-item-command-input.js +0 -2
- package/dist/cjs/model/dynamo-count-result.js +0 -2
- package/dist/cjs/route53/route-53-ratchet.js +0 -57
- package/dist/cjs/runtime-parameter/cached-stored-runtime-parameter.js +0 -2
- package/dist/cjs/runtime-parameter/dynamo-runtime-parameter-provider.js +0 -38
- package/dist/cjs/runtime-parameter/global-variable-override-runtime-parameter-provider.js +0 -54
- package/dist/cjs/runtime-parameter/memory-runtime-parameter-provider.js +0 -30
- package/dist/cjs/runtime-parameter/runtime-parameter-provider.js +0 -2
- package/dist/cjs/runtime-parameter/runtime-parameter-ratchet.js +0 -74
- package/dist/cjs/runtime-parameter/stored-runtime-parameter.js +0 -2
- package/dist/cjs/s3/s3-cache-ratchet.js +0 -332
- package/dist/cjs/s3/s3-cache-to-local-disk-ratchet.js +0 -105
- package/dist/cjs/s3/s3-location-sync-ratchet.js +0 -142
- package/dist/cjs/s3/s3-ratchet.js +0 -26
- package/dist/cjs/ses/email-attachment.js +0 -2
- package/dist/cjs/ses/mailer-config.js +0 -2
- package/dist/cjs/ses/mailer-like.js +0 -2
- package/dist/cjs/ses/mailer.js +0 -208
- package/dist/cjs/ses/ratchet-template-renderer.js +0 -2
- package/dist/cjs/ses/ready-to-send-email.js +0 -2
- package/dist/cjs/ses/remote-handlebars-template-renderer.js +0 -79
- package/dist/cjs/ses/resolved-ready-to-send-email.js +0 -2
- package/dist/cjs/sns/sns-ratchet.js +0 -47
- package/dist/cjs/sync-lock/dynamo-db-sync-lock.js +0 -69
- package/dist/cjs/sync-lock/memory-sync-lock.js +0 -40
- package/dist/cjs/sync-lock/sync-lock-provider.js +0 -2
- package/dist/es/index.js +0 -78
- package/dist/tsconfig.cjs.tsbuildinfo +0 -1
- package/dist/tsconfig.es.tsbuildinfo +0 -1
- package/dist/tsconfig.types.tsbuildinfo +0 -1
- package/dist/types/environment/environment-service-provider.d.ts +0 -7
- package/dist/types/index.d.ts +0 -81
- package/dist/types/ses/email-attachment.d.ts +0 -23
- package/dist/types/ses/ready-to-send-email.d.ts +0 -66
- package/dist/types/ses/resolved-ready-to-send-email.d.ts +0 -16
- /package/dist/{es/cache/simple-cache-object-wrapper.js → batch/aws-batch-background-processor.spec.d.ts} +0 -0
- /package/dist/{es/cache/simple-cache-read-options.js → batch/aws-batch-ratchet.spec.d.ts} +0 -0
- /package/dist/{es/build → build}/ratchet-aws-info.js +0 -0
- /package/dist/{types/cache → cache}/simple-cache-object-wrapper.d.ts +0 -0
- /package/dist/{es/cache/simple-cache-storage-provider.js → cache/simple-cache-object-wrapper.js} +0 -0
- /package/dist/{types/cache → cache}/simple-cache-read-options.d.ts +0 -0
- /package/dist/{es/daemon/daemon-like.js → cache/simple-cache-read-options.js} +0 -0
- /package/dist/{es/daemon/daemon-process-create-options.js → cache/simple-cache-storage-provider.js} +0 -0
- /package/dist/{es/daemon/daemon-process-state-public-token.js → cache/simple-cache.spec.d.ts} +0 -0
- /package/dist/{types/cloudwatch → cloudwatch}/cloud-watch-log-group-ratchet.d.ts +0 -0
- /package/dist/{es/daemon/daemon-process-state.js → cloudwatch/cloud-watch-log-group-ratchet.spec.d.ts} +0 -0
- /package/dist/{types/cloudwatch → cloudwatch}/cloud-watch-logs-ratchet.d.ts +0 -0
- /package/dist/{es/dao/prototype-dao-config.js → cloudwatch/cloud-watch-logs-ratchet.spec.d.ts} +0 -0
- /package/dist/{es/dao/prototype-dao-db.js → cloudwatch/cloud-watch-metrics-ratchet.spec.d.ts} +0 -0
- /package/dist/{es/dao/prototype-dao-provider.js → daemon/daemon-like.js} +0 -0
- /package/dist/{types/daemon → daemon}/daemon-process-create-options.d.ts +0 -0
- /package/dist/{es/dao/simple-dao-item.js → daemon/daemon-process-create-options.js} +0 -0
- /package/dist/{es/dynamodb/dynamo-ratchet-like.js → daemon/daemon-process-state-public-token.js} +0 -0
- /package/dist/{types/daemon → daemon}/daemon-process-state.d.ts +0 -0
- /package/dist/{es/environment/environment-service-config.js → daemon/daemon-process-state.js} +0 -0
- /package/dist/{types/dao → dao}/prototype-dao-config.d.ts +0 -0
- /package/dist/{es/environment/environment-service-provider.js → dao/prototype-dao-config.js} +0 -0
- /package/dist/{types/dao → dao}/prototype-dao-db.d.ts +0 -0
- /package/dist/{es/expiring-code/expiring-code-params.js → dao/prototype-dao-db.js} +0 -0
- /package/dist/{es/expiring-code/expiring-code-provider.js → dao/prototype-dao-provider.js} +0 -0
- /package/dist/{types/dao → dao}/simple-dao-item.d.ts +0 -0
- /package/dist/{es/expiring-code/expiring-code.js → dao/simple-dao-item.js} +0 -0
- /package/dist/{es/model/cloud-watch-metrics-minute-level-dynamo-count-request.js → dynamodb/dynamo-ratchet-like.js} +0 -0
- /package/dist/{es/model/dynamo-count-result.js → dynamodb/dynamo-ratchet.spec.d.ts} +0 -0
- /package/dist/{types/dynamodb → dynamodb}/dynamo-table-ratchet.d.ts +0 -0
- /package/dist/{types/dynamodb → dynamodb}/hash-spreader.d.ts +0 -0
- /package/dist/{es/model/dynamo/doc-put-item-command-input.js → dynamodb/hash-spreader.spec.d.ts} +0 -0
- /package/dist/{es/model/dynamo/doc-query-command-input.js → ec2/ec2-ratchet.spec.d.ts} +0 -0
- /package/dist/{es/model/dynamo/doc-scan-command-input.js → environment/environment-service-config.js} +0 -0
- /package/dist/{es/model/dynamo/doc-update-item-command-input.js → environment/environment-service-provider.js} +0 -0
- /package/dist/{es/runtime-parameter/cached-stored-runtime-parameter.js → environment/environment-service.spec.d.ts} +0 -0
- /package/dist/{types/expiring-code → expiring-code}/expiring-code-params.d.ts +0 -0
- /package/dist/{es/runtime-parameter/runtime-parameter-provider.js → expiring-code/expiring-code-params.js} +0 -0
- /package/dist/{es/runtime-parameter/stored-runtime-parameter.js → expiring-code/expiring-code-provider.js} +0 -0
- /package/dist/{es/ses/email-attachment.js → expiring-code/expiring-code-ratchet.spec.d.ts} +0 -0
- /package/dist/{types/expiring-code → expiring-code}/expiring-code.d.ts +0 -0
- /package/dist/{es/ses/mailer-config.js → expiring-code/expiring-code.js} +0 -0
- /package/dist/{es/ses/mailer-like.js → expiring-code/s3-expiring-code-provider.spec.d.ts} +0 -0
- /package/dist/{es/ses/ratchet-template-renderer.js → index.d.ts} +0 -0
- /package/dist/{es/ses/ready-to-send-email.js → index.js} +0 -0
- /package/dist/{types/lambda → lambda}/lambda-event-detector.d.ts +0 -0
- /package/dist/{es/lambda → lambda}/lambda-event-detector.js +0 -0
- /package/dist/{types/lambda → lambda}/lambda-event-type-guards.d.ts +0 -0
- /package/dist/{es/ses/resolved-ready-to-send-email.js → model/cloud-watch-metrics-minute-level-dynamo-count-request.js} +0 -0
- /package/dist/{types/model → model}/cloud-watch-metrics-unit.d.ts +0 -0
- /package/dist/{es/model → model}/cloud-watch-metrics-unit.js +0 -0
- /package/dist/{types/model → model}/dynamo/doc-put-item-command-input.d.ts +0 -0
- /package/dist/{types/model → model}/dynamo/doc-query-command-input.d.ts +0 -0
- /package/dist/{types/model → model}/dynamo/doc-scan-command-input.d.ts +0 -0
- /package/dist/{types/model → model}/dynamo/doc-update-item-command-input.d.ts +0 -0
- /package/dist/{types/model → model}/dynamo-count-result.d.ts +0 -0
- /package/dist/{es/sync-lock/sync-lock-provider.js → model/dynamo-count-result.js} +0 -0
- /package/dist/{types/route53 → route53}/route-53-ratchet.d.ts +0 -0
- /package/dist/{types/runtime-parameter → runtime-parameter}/stored-runtime-parameter.d.ts +0 -0
- /package/dist/{types/s3 → s3}/s3-location-sync-ratchet.d.ts +0 -0
- /package/dist/{types/s3 → s3}/s3-ratchet.d.ts +0 -0
- /package/dist/{types/sns → sns}/sns-ratchet.d.ts +0 -0
- /package/dist/{types/sync-lock → sync-lock}/sync-lock-provider.d.ts +0 -0
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
import crypto from 'crypto';
|
|
2
2
|
import fs from 'fs';
|
|
3
3
|
import path from 'path';
|
|
4
|
-
import { Logger
|
|
4
|
+
import { Logger } from '@bitblit/ratchet-common/dist/logger/logger.js';
|
|
5
|
+
import { RequireRatchet } from '@bitblit/ratchet-common/dist/lang/require-ratchet.js';
|
|
6
|
+
import { StringRatchet } from '@bitblit/ratchet-common/dist/lang/string-ratchet.js';
|
|
5
7
|
export class S3CacheToLocalDiskRatchet {
|
|
8
|
+
s3;
|
|
9
|
+
tmpFolder;
|
|
10
|
+
cacheTimeoutSeconds;
|
|
11
|
+
static DEFAULT_CACHE_TIMEOUT_SEC = 7 * 24 * 3600;
|
|
12
|
+
currentlyLoading = new Map();
|
|
6
13
|
constructor(s3, tmpFolder, cacheTimeoutSeconds = S3CacheToLocalDiskRatchet.DEFAULT_CACHE_TIMEOUT_SEC) {
|
|
7
14
|
this.s3 = s3;
|
|
8
15
|
this.tmpFolder = tmpFolder;
|
|
9
16
|
this.cacheTimeoutSeconds = cacheTimeoutSeconds;
|
|
10
|
-
this.currentlyLoading = new Map();
|
|
11
17
|
RequireRatchet.notNullOrUndefined(s3, 's3');
|
|
12
18
|
RequireRatchet.notNullOrUndefined(StringRatchet.trimToNull(tmpFolder));
|
|
13
19
|
RequireRatchet.true(fs.existsSync(tmpFolder), 'folder must exist : ' + tmpFolder);
|
|
@@ -97,4 +103,3 @@ export class S3CacheToLocalDiskRatchet {
|
|
|
97
103
|
return rval;
|
|
98
104
|
}
|
|
99
105
|
}
|
|
100
|
-
S3CacheToLocalDiskRatchet.DEFAULT_CACHE_TIMEOUT_SEC = 7 * 24 * 3600;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { S3CacheToLocalDiskRatchet } from './s3-cache-to-local-disk-ratchet.js';
|
|
2
|
+
import { tmpdir } from 'os';
|
|
3
|
+
import { JestRatchet } from '@bitblit/ratchet-jest/dist/jest/jest-ratchet.js';
|
|
4
|
+
import { jest } from '@jest/globals';
|
|
5
|
+
let mockS3CR;
|
|
6
|
+
describe('#S3CacheToLocalDiskRatchet', () => {
|
|
7
|
+
beforeEach(() => {
|
|
8
|
+
mockS3CR = JestRatchet.mock(jest.fn);
|
|
9
|
+
});
|
|
10
|
+
it('should download file and store in tmp', async () => {
|
|
11
|
+
mockS3CR.fetchCacheFileAsBuffer.mockResolvedValue(Buffer.from(JSON.stringify({ a: 'b' })));
|
|
12
|
+
const pth = 'test-path';
|
|
13
|
+
const svc = new S3CacheToLocalDiskRatchet(mockS3CR, tmpdir());
|
|
14
|
+
svc.removeCacheFileForKey(pth);
|
|
15
|
+
const proms = [];
|
|
16
|
+
for (let i = 0; i < 5; i++) {
|
|
17
|
+
proms.push(svc.getFileBuffer(pth));
|
|
18
|
+
}
|
|
19
|
+
const all = await Promise.all(proms);
|
|
20
|
+
expect(all.length).toEqual(5);
|
|
21
|
+
});
|
|
22
|
+
});
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { CopyObjectCommand, GetObjectCommand, ListObjectsV2Command, } from '@aws-sdk/client-s3';
|
|
2
2
|
import _ from 'lodash';
|
|
3
|
-
import { Logger
|
|
3
|
+
import { Logger } from '@bitblit/ratchet-common/dist/logger/logger.js';
|
|
4
|
+
import { RequireRatchet } from '@bitblit/ratchet-common/dist/lang/require-ratchet.js';
|
|
5
|
+
import { PromiseRatchet } from '@bitblit/ratchet-common/dist/lang/promise-ratchet.js';
|
|
4
6
|
import { Upload } from '@aws-sdk/lib-storage';
|
|
5
7
|
export class S3LocationSyncRatchet {
|
|
8
|
+
config;
|
|
6
9
|
constructor(config) {
|
|
7
10
|
RequireRatchet.notNullOrUndefined(config, 'config');
|
|
8
11
|
this.config = config;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { S3Client } from '@aws-sdk/client-s3';
|
|
2
|
+
import { S3Ratchet } from './s3-ratchet.js';
|
|
3
|
+
import { mockClient } from 'aws-sdk-client-mock';
|
|
4
|
+
let mockS3;
|
|
5
|
+
describe('#S3Ratchet', function () {
|
|
6
|
+
mockS3 = mockClient(S3Client);
|
|
7
|
+
beforeEach(() => {
|
|
8
|
+
mockS3.reset();
|
|
9
|
+
});
|
|
10
|
+
it('should checkS3UrlForValidity', async () => {
|
|
11
|
+
expect(S3Ratchet.checkS3UrlForValidity('s3://test/out/b.txt')).toBeTruthy();
|
|
12
|
+
expect(S3Ratchet.checkS3UrlForValidity('http://test/out/b.txt')).toBeFalsy();
|
|
13
|
+
});
|
|
14
|
+
it('should extractBucketFromURL', async () => {
|
|
15
|
+
expect(S3Ratchet.extractBucketFromURL('s3://test/out/b.txt')).toEqual('test');
|
|
16
|
+
});
|
|
17
|
+
it('should extractKeyFromURL', async () => {
|
|
18
|
+
expect(S3Ratchet.extractKeyFromURL('s3://test/out/b.txt')).toEqual('out/b.txt');
|
|
19
|
+
});
|
|
20
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import { RatchetTemplateRenderer } from './ratchet-template-renderer';
|
|
2
|
-
import { S3CacheRatchet } from '../s3/s3-cache-ratchet';
|
|
3
|
-
/**
|
|
4
|
-
* Configuration options for generic mailer
|
|
5
|
-
*/
|
|
1
|
+
import { RatchetTemplateRenderer } from './ratchet-template-renderer.js';
|
|
2
|
+
import { S3CacheRatchet } from '../s3/s3-cache-ratchet.js';
|
|
6
3
|
export interface MailerConfig {
|
|
7
4
|
defaultSendingAddress?: string;
|
|
8
5
|
autoBccAddresses?: string[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
import { ReadyToSendEmail } from './ready-to-send-email';
|
|
1
|
+
import { ReadyToSendEmail } from './ready-to-send-email.js';
|
|
2
2
|
import { SendRawEmailResponse } from '@aws-sdk/client-ses';
|
|
3
|
-
import { ResolvedReadyToSendEmail } from './resolved-ready-to-send-email';
|
|
4
|
-
/**
|
|
5
|
-
* Generic Mail Sender for AWS.
|
|
6
|
-
*
|
|
7
|
-
* Params:
|
|
8
|
-
* ses: AWS SES handler, properly configured
|
|
9
|
-
* defaultSendingAddress:
|
|
10
|
-
*/
|
|
3
|
+
import { ResolvedReadyToSendEmail } from './resolved-ready-to-send-email.js';
|
|
11
4
|
export interface MailerLike {
|
|
12
5
|
fillEmailBody(rts: ReadyToSendEmail, context: any, htmlTemplateName: string, txtTemplateName?: string, layoutName?: string, partialNames?: string[]): Promise<ReadyToSendEmail>;
|
|
13
6
|
fillEmailBodyAndSend(rts: ReadyToSendEmail, context: any, htmlTemplateName: string, txtTemplateName?: string, layoutName?: string, partialNames?: string[]): Promise<SendRawEmailResponse>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
import { ReadyToSendEmail } from './ready-to-send-email';
|
|
1
|
+
import { ReadyToSendEmail } from './ready-to-send-email.js';
|
|
2
2
|
import { SendRawEmailCommandOutput, SendRawEmailResponse, SESClient } from '@aws-sdk/client-ses';
|
|
3
|
-
import { MailerConfig } from './mailer-config';
|
|
4
|
-
import { ResolvedReadyToSendEmail } from './resolved-ready-to-send-email';
|
|
5
|
-
import { MailerLike } from './mailer-like';
|
|
6
|
-
/**
|
|
7
|
-
* Generic Mail Sender for AWS.
|
|
8
|
-
*
|
|
9
|
-
* Params:
|
|
10
|
-
* ses: AWS SES handler, properly configured
|
|
11
|
-
* defaultSendingAddress:
|
|
12
|
-
*/
|
|
3
|
+
import { MailerConfig } from './mailer-config.js';
|
|
4
|
+
import { ResolvedReadyToSendEmail } from './resolved-ready-to-send-email.js';
|
|
5
|
+
import { MailerLike } from './mailer-like.js';
|
|
13
6
|
export declare class Mailer implements MailerLike {
|
|
14
7
|
private ses;
|
|
15
8
|
private config;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ErrorRatchet } from '@bitblit/ratchet-common/dist/lang/error-ratchet.js';
|
|
2
|
+
import { Logger } from '@bitblit/ratchet-common/dist/logger/logger.js';
|
|
3
|
+
import { RequireRatchet } from '@bitblit/ratchet-common/dist/lang/require-ratchet.js';
|
|
4
|
+
import { Base64Ratchet } from '@bitblit/ratchet-common/dist/lang/base64-ratchet.js';
|
|
5
|
+
import { StringRatchet } from '@bitblit/ratchet-common/dist/lang/string-ratchet.js';
|
|
2
6
|
import { SendRawEmailCommand } from '@aws-sdk/client-ses';
|
|
3
|
-
import { StringRatchet } from '@bitblit/ratchet-common';
|
|
4
|
-
import { ErrorRatchet } from '@bitblit/ratchet-common';
|
|
5
7
|
import { DateTime } from 'luxon';
|
|
6
|
-
import { Base64Ratchet } from '@bitblit/ratchet-common';
|
|
7
|
-
import { RequireRatchet } from '@bitblit/ratchet-common';
|
|
8
8
|
export class Mailer {
|
|
9
|
+
ses;
|
|
10
|
+
config;
|
|
11
|
+
static EMAIL = new RegExp('.+@.+\\.[a-z]+');
|
|
9
12
|
constructor(ses, config = {}) {
|
|
10
13
|
this.ses = ses;
|
|
11
14
|
this.config = config;
|
|
@@ -201,4 +204,3 @@ export class Mailer {
|
|
|
201
204
|
return email !== null && Mailer.EMAIL.test(email);
|
|
202
205
|
}
|
|
203
206
|
}
|
|
204
|
-
Mailer.EMAIL = new RegExp('.+@.+\\.[a-z]+');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { SendRawEmailCommand, SESClient } from '@aws-sdk/client-ses';
|
|
2
|
+
import { Mailer } from './mailer.js';
|
|
3
|
+
import { StringRatchet } from '@bitblit/ratchet-common/dist/lang/string-ratchet.js';
|
|
4
|
+
import { Base64Ratchet } from '@bitblit/ratchet-common/dist/lang/base64-ratchet.js';
|
|
5
|
+
import { mockClient } from 'aws-sdk-client-mock';
|
|
6
|
+
let mockSES;
|
|
7
|
+
const smallImageBase64 = 'iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII';
|
|
8
|
+
describe('#mailer', function () {
|
|
9
|
+
mockSES = mockClient(SESClient);
|
|
10
|
+
beforeEach(() => {
|
|
11
|
+
mockSES.reset();
|
|
12
|
+
});
|
|
13
|
+
it('should send email', async () => {
|
|
14
|
+
const config = {
|
|
15
|
+
defaultSendingAddress: 'test1@test.com',
|
|
16
|
+
autoBccAddresses: [],
|
|
17
|
+
archive: null,
|
|
18
|
+
archivePrefix: null,
|
|
19
|
+
};
|
|
20
|
+
const svc = new Mailer(mockSES, config);
|
|
21
|
+
const attach1 = {
|
|
22
|
+
filename: 'test.txt',
|
|
23
|
+
contentType: 'text/plain',
|
|
24
|
+
base64Data: Base64Ratchet.generateBase64VersionOfString('This is a test2'),
|
|
25
|
+
};
|
|
26
|
+
const attach2 = {
|
|
27
|
+
filename: 'a2.png',
|
|
28
|
+
contentType: 'image/png',
|
|
29
|
+
base64Data: smallImageBase64,
|
|
30
|
+
};
|
|
31
|
+
const rts = {
|
|
32
|
+
txtMessage: 'test txt',
|
|
33
|
+
htmlMessage: '<h1>Test html</h1><p>Test paragraph</p>',
|
|
34
|
+
subject: 'Test subject',
|
|
35
|
+
fromAddress: 'test@test.com',
|
|
36
|
+
destinationAddresses: ['testout@test.com'],
|
|
37
|
+
attachments: [attach1, attach2],
|
|
38
|
+
};
|
|
39
|
+
mockSES.on(SendRawEmailCommand).resolves({});
|
|
40
|
+
const result = await svc.sendEmail(rts);
|
|
41
|
+
expect(result).toBeTruthy();
|
|
42
|
+
});
|
|
43
|
+
it('should allow for unicode in email subject', async () => {
|
|
44
|
+
const config = {
|
|
45
|
+
defaultSendingAddress: 'jflint@adomni.com',
|
|
46
|
+
autoBccAddresses: [],
|
|
47
|
+
archive: null,
|
|
48
|
+
archivePrefix: null,
|
|
49
|
+
};
|
|
50
|
+
const svc = new Mailer(mockSES, config);
|
|
51
|
+
const rts = {
|
|
52
|
+
txtMessage: 'test txt',
|
|
53
|
+
htmlMessage: '<h1>Test html</h1><p>Test paragraph</p>',
|
|
54
|
+
subject: "Rappel: Votre panneau d'affichage Shout est diffusé aujourd'hui!",
|
|
55
|
+
fromAddress: 'jflint@adomni.com',
|
|
56
|
+
destinationAddresses: ['jflint@adomni.com'],
|
|
57
|
+
};
|
|
58
|
+
mockSES.on(SendRawEmailCommand).resolves({});
|
|
59
|
+
const result = await svc.sendEmail(rts);
|
|
60
|
+
expect(result).toBeTruthy();
|
|
61
|
+
});
|
|
62
|
+
it('should filter outbound', async () => {
|
|
63
|
+
const config = {
|
|
64
|
+
allowedDestinationEmails: [/.*test\.com/, /.*.test2\.com/],
|
|
65
|
+
};
|
|
66
|
+
const svc = new Mailer({}, config);
|
|
67
|
+
const out1 = ['a@test.com', 'b@fail.com'];
|
|
68
|
+
const res1 = svc.filterEmailsToValid(out1);
|
|
69
|
+
expect(res1).toBeTruthy();
|
|
70
|
+
expect(res1.length).toEqual(1);
|
|
71
|
+
const out2 = ['a@fail.com', 'b@fail.com'];
|
|
72
|
+
const res2 = svc.filterEmailsToValid(out2);
|
|
73
|
+
expect(res2).toBeTruthy();
|
|
74
|
+
expect(res2.length).toEqual(0);
|
|
75
|
+
});
|
|
76
|
+
it('should fix a huge text/html body', async () => {
|
|
77
|
+
const config = {
|
|
78
|
+
defaultSendingAddress: 'test@test.com',
|
|
79
|
+
autoBccAddresses: [],
|
|
80
|
+
archive: null,
|
|
81
|
+
archivePrefix: null,
|
|
82
|
+
maxMessageBodySizeInBytes: 500,
|
|
83
|
+
maxAttachmentSizeInBase64Bytes: 1000,
|
|
84
|
+
};
|
|
85
|
+
const svc = new Mailer(mockSES, config);
|
|
86
|
+
const bigBody = StringRatchet.createRandomHexString(300);
|
|
87
|
+
const bigAttach = {
|
|
88
|
+
filename: 'test.txt',
|
|
89
|
+
contentType: 'text/plain',
|
|
90
|
+
base64Data: Base64Ratchet.generateBase64VersionOfString(StringRatchet.createRandomHexString(2000)),
|
|
91
|
+
};
|
|
92
|
+
const rts = {
|
|
93
|
+
txtMessage: bigBody,
|
|
94
|
+
htmlMessage: bigBody,
|
|
95
|
+
subject: 'Test big message',
|
|
96
|
+
fromAddress: 'test@test.com',
|
|
97
|
+
destinationAddresses: ['test@test.com'],
|
|
98
|
+
attachments: [bigAttach],
|
|
99
|
+
};
|
|
100
|
+
mockSES.on(SendRawEmailCommand).resolves({});
|
|
101
|
+
const result = await svc.sendEmail(rts);
|
|
102
|
+
expect(result).toBeTruthy();
|
|
103
|
+
});
|
|
104
|
+
});
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* tbd
|
|
3
|
-
* @interface RatchetTemplateRenderer
|
|
4
|
-
*/
|
|
5
1
|
export interface RatchetTemplateRenderer {
|
|
6
2
|
renderTemplate(templateName: string, context: any, layoutName?: string, partialNames?: string[]): Promise<string>;
|
|
7
3
|
renderTemplateDirect(templateValue: string, context: any, layoutName?: string): Promise<string>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { EmailAttachment } from './email-attachment.js';
|
|
2
|
+
export interface ReadyToSendEmail {
|
|
3
|
+
destinationAddresses?: Array<string>;
|
|
4
|
+
bccAddresses?: Array<string>;
|
|
5
|
+
attachments?: Array<EmailAttachment>;
|
|
6
|
+
fromAddress?: string;
|
|
7
|
+
txtMessage?: string;
|
|
8
|
+
htmlMessage?: string;
|
|
9
|
+
subject?: string;
|
|
10
|
+
fromName?: string;
|
|
11
|
+
doNotAutoBcc?: boolean;
|
|
12
|
+
doNotArchive?: boolean;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { RatchetTemplateRenderer } from './ratchet-template-renderer';
|
|
2
|
-
/**
|
|
3
|
-
*/
|
|
1
|
+
import { RatchetTemplateRenderer } from './ratchet-template-renderer.js';
|
|
4
2
|
export declare class RemoteHandlebarsTemplateRenderer implements RatchetTemplateRenderer {
|
|
5
3
|
private prefix;
|
|
6
4
|
private suffix;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import handlebars from 'handlebars';
|
|
2
2
|
import fetch from 'cross-fetch';
|
|
3
|
-
import { StringRatchet } from '@bitblit/ratchet-common';
|
|
4
|
-
import { Logger } from '@bitblit/ratchet-common';
|
|
3
|
+
import { StringRatchet } from '@bitblit/ratchet-common/dist/lang/string-ratchet.js';
|
|
4
|
+
import { Logger } from '@bitblit/ratchet-common/dist/logger/logger.js';
|
|
5
5
|
import layouts from 'handlebars-layouts';
|
|
6
6
|
export class RemoteHandlebarsTemplateRenderer {
|
|
7
|
+
prefix;
|
|
8
|
+
suffix;
|
|
9
|
+
maxCacheTemplates;
|
|
10
|
+
cache;
|
|
7
11
|
constructor(prefix = '', suffix = '', maxCacheTemplates = 10) {
|
|
8
12
|
this.prefix = prefix;
|
|
9
13
|
this.suffix = suffix;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { Logger } from '@bitblit/ratchet-common';
|
|
1
|
+
import { Logger } from '@bitblit/ratchet-common/dist/logger/logger.js';
|
|
2
|
+
import { RequireRatchet } from '@bitblit/ratchet-common/dist/lang/require-ratchet.js';
|
|
2
3
|
import { PublishCommand, SNSClient } from '@aws-sdk/client-sns';
|
|
3
|
-
import { RequireRatchet } from '@bitblit/ratchet-common';
|
|
4
4
|
export class SnsRatchet {
|
|
5
|
+
sns;
|
|
6
|
+
topicArn;
|
|
5
7
|
constructor(sns = new SNSClient({ region: 'us-east-1' }), topicArn) {
|
|
6
8
|
this.sns = sns;
|
|
7
9
|
this.topicArn = topicArn;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { PublishCommand, SNSClient } from '@aws-sdk/client-sns';
|
|
2
|
+
import { SnsRatchet } from './sns-ratchet.js';
|
|
3
|
+
import { mockClient } from 'aws-sdk-client-mock';
|
|
4
|
+
let mockSNS;
|
|
5
|
+
describe('#SNSRatchet', function () {
|
|
6
|
+
mockSNS = mockClient(SNSClient);
|
|
7
|
+
beforeEach(() => {
|
|
8
|
+
mockSNS.reset();
|
|
9
|
+
});
|
|
10
|
+
it('should send a message', async () => {
|
|
11
|
+
mockSNS.on(PublishCommand).resolves({});
|
|
12
|
+
const topicArn = 'TOPIC-ARN-HERE';
|
|
13
|
+
const ratchet = new SnsRatchet(mockSNS, topicArn);
|
|
14
|
+
const out = await ratchet.sendMessage('test \n\n' + new Date() + '\n\n---\n\nTest CR');
|
|
15
|
+
expect(out).toBeTruthy();
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DynamoRatchet } from '../dynamodb/dynamo-ratchet';
|
|
2
|
-
import { SyncLockProvider } from './sync-lock-provider';
|
|
1
|
+
import { DynamoRatchet } from '../dynamodb/dynamo-ratchet.js';
|
|
2
|
+
import { SyncLockProvider } from './sync-lock-provider.js';
|
|
3
3
|
export declare class DynamoDbSyncLock implements SyncLockProvider {
|
|
4
4
|
private ratchet;
|
|
5
5
|
private tableName;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import { Logger
|
|
1
|
+
import { Logger } from '@bitblit/ratchet-common/dist/logger/logger.js';
|
|
2
|
+
import { RequireRatchet } from '@bitblit/ratchet-common/dist/lang/require-ratchet.js';
|
|
3
|
+
import { StringRatchet } from '@bitblit/ratchet-common/dist/lang/string-ratchet.js';
|
|
2
4
|
import { PutItemCommand } from '@aws-sdk/client-dynamodb';
|
|
3
5
|
export class DynamoDbSyncLock {
|
|
6
|
+
ratchet;
|
|
7
|
+
tableName;
|
|
4
8
|
constructor(ratchet, tableName) {
|
|
5
9
|
this.ratchet = ratchet;
|
|
6
10
|
this.tableName = tableName;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { DynamoDbSyncLock } from './dynamo-db-sync-lock.js';
|
|
2
|
+
import { Logger } from '@bitblit/ratchet-common/dist/logger/logger.js';
|
|
3
|
+
import { JestRatchet } from '@bitblit/ratchet-jest/dist/jest/jest-ratchet.js';
|
|
4
|
+
import { jest } from '@jest/globals';
|
|
5
|
+
let mockDR;
|
|
6
|
+
describe('#syncLockService', () => {
|
|
7
|
+
beforeEach(() => {
|
|
8
|
+
mockDR = JestRatchet.mock(jest.fn);
|
|
9
|
+
});
|
|
10
|
+
xit('should test sync locks', async () => {
|
|
11
|
+
const svc = new DynamoDbSyncLock(mockDR, 'test-table');
|
|
12
|
+
const lockTestValue = 'SYNC_LOCK_TEST';
|
|
13
|
+
const aq1 = await svc.acquireLock(lockTestValue);
|
|
14
|
+
expect(aq1).toBe(true);
|
|
15
|
+
const aq2 = await svc.acquireLock(lockTestValue);
|
|
16
|
+
expect(aq2).toBe(false);
|
|
17
|
+
await svc.releaseLock(lockTestValue);
|
|
18
|
+
const aq3 = await svc.acquireLock(lockTestValue);
|
|
19
|
+
expect(aq3).toBe(true);
|
|
20
|
+
await svc.releaseLock(lockTestValue);
|
|
21
|
+
});
|
|
22
|
+
it('should clear expired sync locks', async () => {
|
|
23
|
+
mockDR.fullyExecuteScan.mockResolvedValue([{ lockingKey: 'aa' }, { lockingKey: 'ab' }]);
|
|
24
|
+
mockDR.deleteAllInBatches.mockResolvedValue(2);
|
|
25
|
+
const svc = new DynamoDbSyncLock(mockDR, 'test-table');
|
|
26
|
+
const res = await svc.clearExpiredSyncLocks();
|
|
27
|
+
Logger.info('Got : %s', res);
|
|
28
|
+
expect(res).toEqual(2);
|
|
29
|
+
});
|
|
30
|
+
});
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import { SyncLockProvider } from './sync-lock-provider';
|
|
2
|
-
/**
|
|
3
|
-
* Simple in-memory implementation of the SyncLockProvider interface
|
|
4
|
-
*/
|
|
1
|
+
import { SyncLockProvider } from './sync-lock-provider.js';
|
|
5
2
|
export declare class MemorySyncLock implements SyncLockProvider {
|
|
6
3
|
private _locks;
|
|
7
4
|
constructor();
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { StringRatchet } from '@bitblit/ratchet-common';
|
|
1
|
+
import { StringRatchet } from '@bitblit/ratchet-common/dist/lang/string-ratchet.js';
|
|
2
2
|
export class MemorySyncLock {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
3
|
+
_locks = new Map();
|
|
4
|
+
constructor() { }
|
|
6
5
|
async acquireLock(lockKey, expirationSeconds = 30) {
|
|
7
6
|
let rval = false;
|
|
8
7
|
if (StringRatchet.trimToNull(lockKey)) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bitblit/ratchet-aws",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.102-alpha",
|
|
4
4
|
"description": "Common tools for use with AWS browser and node",
|
|
5
5
|
"sideEffects": false,
|
|
6
|
-
"
|
|
7
|
-
"module": "
|
|
8
|
-
"types": "./dist/types/index.d.ts",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"module": "index.js",
|
|
9
8
|
"files": [
|
|
10
|
-
"dist/*"
|
|
9
|
+
"dist/*",
|
|
10
|
+
"includes/*"
|
|
11
11
|
],
|
|
12
12
|
"contributors": [
|
|
13
13
|
"Christopher Weiss <bitblit@gmail.com>",
|
|
@@ -31,15 +31,14 @@
|
|
|
31
31
|
"scripts": {
|
|
32
32
|
"watch": "tsc-watch",
|
|
33
33
|
"clean": "shx rm -Rf dist",
|
|
34
|
-
"test": "jest",
|
|
34
|
+
"test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest",
|
|
35
35
|
"docs": "typedoc",
|
|
36
36
|
"lint": "eslint src/**/*.ts",
|
|
37
37
|
"lint-fix": "eslint --fix src/**/*.ts",
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"build
|
|
41
|
-
"build
|
|
42
|
-
"build:types": "tsc -p tsconfig.types.json"
|
|
38
|
+
"__generate-barrels": "barrelsby -q --delete -d src -e .*\\.spec\\.ts",
|
|
39
|
+
"__build": "yarn run generate-barrels && tsc",
|
|
40
|
+
"build": "tsc",
|
|
41
|
+
"force-build": "tsc --build --force"
|
|
43
42
|
},
|
|
44
43
|
"repository": {
|
|
45
44
|
"type": "git",
|
|
@@ -61,49 +60,49 @@
|
|
|
61
60
|
"@bitblit/ratchet-common": "*"
|
|
62
61
|
},
|
|
63
62
|
"optionalDependencies": {
|
|
64
|
-
"@aws-sdk/abort-controller": "3.
|
|
65
|
-
"@aws-sdk/client-athena": "3.
|
|
66
|
-
"@aws-sdk/client-batch": "3.
|
|
67
|
-
"@aws-sdk/client-cloudwatch": "3.
|
|
68
|
-
"@aws-sdk/client-cloudwatch-logs": "3.
|
|
69
|
-
"@aws-sdk/client-dynamodb": "3.
|
|
70
|
-
"@aws-sdk/client-ec2": "3.
|
|
71
|
-
"@aws-sdk/client-ec2-instance-connect": "3.
|
|
72
|
-
"@aws-sdk/client-route-53": "3.
|
|
73
|
-
"@aws-sdk/client-s3": "3.
|
|
74
|
-
"@aws-sdk/client-ses": "3.
|
|
75
|
-
"@aws-sdk/client-sns": "3.
|
|
76
|
-
"@aws-sdk/client-ssm": "3.
|
|
77
|
-
"@aws-sdk/lib-dynamodb": "3.
|
|
78
|
-
"@aws-sdk/lib-storage": "3.
|
|
79
|
-
"@aws-sdk/s3-request-presigner": "3.
|
|
80
|
-
"@aws-sdk/smithy-client": "3.
|
|
81
|
-
"@aws-sdk/types": "3.
|
|
82
|
-
"@aws-sdk/util-waiter": "3.
|
|
83
|
-
"@types/aws-lambda": "8.10.
|
|
63
|
+
"@aws-sdk/abort-controller": "3.303.0",
|
|
64
|
+
"@aws-sdk/client-athena": "3.303.0",
|
|
65
|
+
"@aws-sdk/client-batch": "3.303.0",
|
|
66
|
+
"@aws-sdk/client-cloudwatch": "3.303.0",
|
|
67
|
+
"@aws-sdk/client-cloudwatch-logs": "3.303.0",
|
|
68
|
+
"@aws-sdk/client-dynamodb": "3.303.0",
|
|
69
|
+
"@aws-sdk/client-ec2": "3.303.0",
|
|
70
|
+
"@aws-sdk/client-ec2-instance-connect": "3.303.0",
|
|
71
|
+
"@aws-sdk/client-route-53": "3.303.0",
|
|
72
|
+
"@aws-sdk/client-s3": "3.303.0",
|
|
73
|
+
"@aws-sdk/client-ses": "3.303.0",
|
|
74
|
+
"@aws-sdk/client-sns": "3.303.0",
|
|
75
|
+
"@aws-sdk/client-ssm": "3.303.0",
|
|
76
|
+
"@aws-sdk/lib-dynamodb": "3.303.0",
|
|
77
|
+
"@aws-sdk/lib-storage": "3.303.0",
|
|
78
|
+
"@aws-sdk/s3-request-presigner": "3.303.0",
|
|
79
|
+
"@aws-sdk/smithy-client": "3.303.0",
|
|
80
|
+
"@aws-sdk/types": "3.303.0",
|
|
81
|
+
"@aws-sdk/util-waiter": "3.303.0",
|
|
82
|
+
"@types/aws-lambda": "8.10.114"
|
|
84
83
|
},
|
|
85
84
|
"peerDependencies": {
|
|
86
|
-
"@aws-sdk/abort-controller": "3.
|
|
87
|
-
"@aws-sdk/client-athena": "3.
|
|
88
|
-
"@aws-sdk/client-batch": "3.
|
|
89
|
-
"@aws-sdk/client-cloudwatch": "3.
|
|
90
|
-
"@aws-sdk/client-cloudwatch-logs": "3.
|
|
91
|
-
"@aws-sdk/client-dynamodb": "3.
|
|
92
|
-
"@aws-sdk/client-ec2": "3.
|
|
93
|
-
"@aws-sdk/client-ec2-instance-connect": "3.
|
|
94
|
-
"@aws-sdk/client-route-53": "3.
|
|
95
|
-
"@aws-sdk/client-s3": "3.
|
|
96
|
-
"@aws-sdk/client-ses": "3.
|
|
97
|
-
"@aws-sdk/client-sns": "3.
|
|
98
|
-
"@aws-sdk/client-ssm": "3.
|
|
99
|
-
"@aws-sdk/lib-dynamodb": "3.
|
|
100
|
-
"@aws-sdk/lib-storage": "3.
|
|
101
|
-
"@aws-sdk/s3-request-presigner": "3.
|
|
102
|
-
"@aws-sdk/smithy-client": "3.
|
|
103
|
-
"@aws-sdk/types": "3.
|
|
104
|
-
"@aws-sdk/util-waiter": "3.
|
|
85
|
+
"@aws-sdk/abort-controller": "3.303.0",
|
|
86
|
+
"@aws-sdk/client-athena": "3.303.0",
|
|
87
|
+
"@aws-sdk/client-batch": "3.303.0",
|
|
88
|
+
"@aws-sdk/client-cloudwatch": "3.303.0",
|
|
89
|
+
"@aws-sdk/client-cloudwatch-logs": "3.303.0",
|
|
90
|
+
"@aws-sdk/client-dynamodb": "3.303.0",
|
|
91
|
+
"@aws-sdk/client-ec2": "3.303.0",
|
|
92
|
+
"@aws-sdk/client-ec2-instance-connect": "3.303.0",
|
|
93
|
+
"@aws-sdk/client-route-53": "3.303.0",
|
|
94
|
+
"@aws-sdk/client-s3": "3.303.0",
|
|
95
|
+
"@aws-sdk/client-ses": "3.303.0",
|
|
96
|
+
"@aws-sdk/client-sns": "3.303.0",
|
|
97
|
+
"@aws-sdk/client-ssm": "3.303.0",
|
|
98
|
+
"@aws-sdk/lib-dynamodb": "3.303.0",
|
|
99
|
+
"@aws-sdk/lib-storage": "3.303.0",
|
|
100
|
+
"@aws-sdk/s3-request-presigner": "3.303.0",
|
|
101
|
+
"@aws-sdk/smithy-client": "3.303.0",
|
|
102
|
+
"@aws-sdk/types": "3.303.0",
|
|
103
|
+
"@aws-sdk/util-waiter": "3.303.0",
|
|
105
104
|
"@bitblit/ratchet-common": "*",
|
|
106
|
-
"@types/aws-lambda": "8.10.
|
|
105
|
+
"@types/aws-lambda": "8.10.114"
|
|
107
106
|
},
|
|
108
107
|
"resolutions": {},
|
|
109
108
|
"devDependencies": {
|