@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
package/dist/cjs/ses/mailer.js
DELETED
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Mailer = void 0;
|
|
4
|
-
const ratchet_common_1 = require("@bitblit/ratchet-common");
|
|
5
|
-
const client_ses_1 = require("@aws-sdk/client-ses");
|
|
6
|
-
const ratchet_common_2 = require("@bitblit/ratchet-common");
|
|
7
|
-
const ratchet_common_3 = require("@bitblit/ratchet-common");
|
|
8
|
-
const luxon_1 = require("luxon");
|
|
9
|
-
const ratchet_common_4 = require("@bitblit/ratchet-common");
|
|
10
|
-
const ratchet_common_5 = require("@bitblit/ratchet-common");
|
|
11
|
-
class Mailer {
|
|
12
|
-
constructor(ses, config = {}) {
|
|
13
|
-
this.ses = ses;
|
|
14
|
-
this.config = config;
|
|
15
|
-
ratchet_common_5.RequireRatchet.notNullOrUndefined(this.ses);
|
|
16
|
-
if (!!config.archive && !config.archive.getDefaultBucket()) {
|
|
17
|
-
throw new Error('If archive specified, must set a default bucket');
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
async fillEmailBody(rts, context, htmlTemplateName, txtTemplateName = null, layoutName = null, partialNames = null) {
|
|
21
|
-
ratchet_common_5.RequireRatchet.notNullOrUndefined(htmlTemplateName);
|
|
22
|
-
if (!this.config.templateRenderer) {
|
|
23
|
-
ratchet_common_3.ErrorRatchet.throwFormattedErr('Cannot use fill body if template renderer not set');
|
|
24
|
-
}
|
|
25
|
-
rts.htmlMessage = await this.config.templateRenderer.renderTemplate(htmlTemplateName, context, layoutName, partialNames);
|
|
26
|
-
rts.txtMessage = !!txtTemplateName ? await this.config.templateRenderer.renderTemplate(txtTemplateName, context) : null;
|
|
27
|
-
return rts;
|
|
28
|
-
}
|
|
29
|
-
async fillEmailBodyAndSend(rts, context, htmlTemplateName, txtTemplateName = null, layoutName = null, partialNames = null) {
|
|
30
|
-
const newVal = await this.fillEmailBody(rts, context, htmlTemplateName, txtTemplateName, layoutName, partialNames);
|
|
31
|
-
const rval = await this.sendEmail(newVal);
|
|
32
|
-
return rval;
|
|
33
|
-
}
|
|
34
|
-
filterEmailsToValid(emails) {
|
|
35
|
-
const rval = (emails || []).filter((e) => {
|
|
36
|
-
if (!this.config.allowedDestinationEmails || this.config.allowedDestinationEmails.length == 0) {
|
|
37
|
-
return true;
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
const match = this.config.allowedDestinationEmails.find((s) => s.test(e));
|
|
41
|
-
return !!match;
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
return rval;
|
|
45
|
-
}
|
|
46
|
-
async archiveEmailIfConfigured(rts) {
|
|
47
|
-
let rval = false;
|
|
48
|
-
if (!!rts && !!this.config.archive && !rts.doNotArchive) {
|
|
49
|
-
ratchet_common_1.Logger.debug('Archiving outbound email to : %j', rts.destinationAddresses);
|
|
50
|
-
let targetPath = ratchet_common_2.StringRatchet.trimToEmpty(this.config.archivePrefix);
|
|
51
|
-
if (!targetPath.endsWith('/')) {
|
|
52
|
-
targetPath += '/';
|
|
53
|
-
}
|
|
54
|
-
const now = luxon_1.DateTime.utc();
|
|
55
|
-
targetPath +=
|
|
56
|
-
'year=' +
|
|
57
|
-
now.toFormat('yyyy') +
|
|
58
|
-
'/month=' +
|
|
59
|
-
now.toFormat('MM') +
|
|
60
|
-
'/day=' +
|
|
61
|
-
now.toFormat('dd') +
|
|
62
|
-
'/hour=' +
|
|
63
|
-
now.toFormat('HH') +
|
|
64
|
-
'/' +
|
|
65
|
-
now.toFormat('mm_ss__SSS');
|
|
66
|
-
targetPath += '.json';
|
|
67
|
-
try {
|
|
68
|
-
await this.config.archive.writeObjectToCacheFile(targetPath, rts);
|
|
69
|
-
rval = true;
|
|
70
|
-
}
|
|
71
|
-
catch (err) {
|
|
72
|
-
ratchet_common_1.Logger.warn('Failed to archive email %s %j : %s', targetPath, rts, err);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
return rval;
|
|
76
|
-
}
|
|
77
|
-
applyLimitsToBodySizesIfAnyInPlace(rts) {
|
|
78
|
-
if (this.config.maxMessageBodySizeInBytes) {
|
|
79
|
-
const txtSize = ratchet_common_2.StringRatchet.trimToEmpty(rts.txtMessage).length;
|
|
80
|
-
const htmlSize = ratchet_common_2.StringRatchet.trimToEmpty(rts.htmlMessage).length;
|
|
81
|
-
const totalSize = txtSize + htmlSize;
|
|
82
|
-
if (totalSize > this.config.maxMessageBodySizeInBytes) {
|
|
83
|
-
ratchet_common_1.Logger.warn('Max message size is %d but size is %d - converting', this.config.maxMessageBodySizeInBytes, totalSize);
|
|
84
|
-
rts.attachments = rts.attachments || [];
|
|
85
|
-
if (ratchet_common_2.StringRatchet.trimToNull(rts.txtMessage)) {
|
|
86
|
-
const txtAttach = {
|
|
87
|
-
filename: 'original-txt-body.txt',
|
|
88
|
-
contentType: 'text/plain',
|
|
89
|
-
base64Data: ratchet_common_4.Base64Ratchet.generateBase64VersionOfString(rts.txtMessage),
|
|
90
|
-
};
|
|
91
|
-
rts.attachments.push(txtAttach);
|
|
92
|
-
}
|
|
93
|
-
if (ratchet_common_2.StringRatchet.trimToNull(rts.htmlMessage)) {
|
|
94
|
-
const htmlAttach = {
|
|
95
|
-
filename: 'original-html-body.html',
|
|
96
|
-
contentType: 'text/html',
|
|
97
|
-
base64Data: ratchet_common_4.Base64Ratchet.generateBase64VersionOfString(rts.htmlMessage),
|
|
98
|
-
};
|
|
99
|
-
rts.attachments.push(htmlAttach);
|
|
100
|
-
}
|
|
101
|
-
rts.htmlMessage = null;
|
|
102
|
-
rts.txtMessage = 'The message was too large and was converted to attachment(s). Please see attached files for content';
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
applyLimitsToAttachmentSizesIfAnyInPlace(rts) {
|
|
107
|
-
if (this.config.maxAttachmentSizeInBase64Bytes) {
|
|
108
|
-
const filtered = [];
|
|
109
|
-
if (rts.attachments) {
|
|
110
|
-
rts.attachments.forEach((a) => {
|
|
111
|
-
if (a.base64Data && a.base64Data.length < this.config.maxAttachmentSizeInBase64Bytes) {
|
|
112
|
-
filtered.push(a);
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
ratchet_common_1.Logger.warn('Removing too-large attachment : %s : %s : %d', a.filename, a.contentType, a.base64Data.length);
|
|
116
|
-
filtered.push({
|
|
117
|
-
filename: 'attachment-removed-notice-' + ratchet_common_2.StringRatchet.createRandomHexString(4) + '.txt',
|
|
118
|
-
contentType: 'text/plain',
|
|
119
|
-
base64Data: ratchet_common_4.Base64Ratchet.generateBase64VersionOfString('Attachment ' +
|
|
120
|
-
a.filename +
|
|
121
|
-
' of type ' +
|
|
122
|
-
a.contentType +
|
|
123
|
-
' was removed since it was ' +
|
|
124
|
-
a.base64Data.length +
|
|
125
|
-
' bytes but max allowed is ' +
|
|
126
|
-
this.config.maxAttachmentSizeInBase64Bytes),
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
rts.attachments = filtered;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
async sendEmail(inRts) {
|
|
135
|
-
ratchet_common_5.RequireRatchet.notNullOrUndefined(inRts, 'RTS must be defined');
|
|
136
|
-
ratchet_common_5.RequireRatchet.notNullOrUndefined(inRts.destinationAddresses, 'Destination addresses must be defined');
|
|
137
|
-
let rval = null;
|
|
138
|
-
let toAddresses = this.filterEmailsToValid(inRts.destinationAddresses);
|
|
139
|
-
const autoBcc = inRts.doNotAutoBcc ? [] : this.config.autoBccAddresses || [];
|
|
140
|
-
const bccAddresses = (inRts.bccAddresses || []).concat(autoBcc);
|
|
141
|
-
if (toAddresses.length === 0 && bccAddresses.length > 0) {
|
|
142
|
-
ratchet_common_1.Logger.debug('Destination emails filtered to none but BCC defined, copying BCC');
|
|
143
|
-
toAddresses = bccAddresses;
|
|
144
|
-
}
|
|
145
|
-
const rts = Object.assign({}, inRts);
|
|
146
|
-
rts.srcDestinationAddresses = inRts.destinationAddresses;
|
|
147
|
-
rts.srcBccAddresses = inRts.bccAddresses;
|
|
148
|
-
rts.destinationAddresses = toAddresses;
|
|
149
|
-
rts.bccAddresses = bccAddresses;
|
|
150
|
-
this.applyLimitsToBodySizesIfAnyInPlace(rts);
|
|
151
|
-
this.applyLimitsToAttachmentSizesIfAnyInPlace(rts);
|
|
152
|
-
await this.archiveEmailIfConfigured(rts);
|
|
153
|
-
if (rts.destinationAddresses.length === 0) {
|
|
154
|
-
ratchet_common_1.Logger.info('After cleaning email lists, no destination addresses left - not sending email');
|
|
155
|
-
}
|
|
156
|
-
else {
|
|
157
|
-
const toLine = 'To: ' + rts.destinationAddresses.join(', ') + '\n';
|
|
158
|
-
const bccLine = !!rts.bccAddresses && rts.bccAddresses.length > 0 ? 'Bcc: ' + rts.bccAddresses.join(', ') + '\n' : '';
|
|
159
|
-
try {
|
|
160
|
-
const from = rts.fromAddress || this.config.defaultSendingAddress;
|
|
161
|
-
const boundary = 'NextPart';
|
|
162
|
-
const altBoundary = 'AltPart';
|
|
163
|
-
let rawMail = 'From: ' + from + '\n';
|
|
164
|
-
rawMail += toLine;
|
|
165
|
-
rawMail += bccLine;
|
|
166
|
-
rawMail += 'Subject: ' + rts.subject + '\n';
|
|
167
|
-
rawMail += 'MIME-Version: 1.0\n';
|
|
168
|
-
rawMail += 'Content-Type: multipart/mixed; boundary="' + boundary + '"\n';
|
|
169
|
-
rawMail += '\n\n--' + boundary + '\n';
|
|
170
|
-
rawMail += 'Content-Type: multipart/alternative; boundary="' + altBoundary + '"\n';
|
|
171
|
-
if (!!ratchet_common_2.StringRatchet.trimToNull(rts.htmlMessage)) {
|
|
172
|
-
rawMail += '\n\n--' + altBoundary + '\n';
|
|
173
|
-
rawMail += 'Content-Type: text/html; charset="UTF-8"\n\n';
|
|
174
|
-
rawMail += rts.htmlMessage;
|
|
175
|
-
}
|
|
176
|
-
if (!!ratchet_common_2.StringRatchet.trimToNull(rts.txtMessage)) {
|
|
177
|
-
rawMail += '\n\n--' + altBoundary + '\n';
|
|
178
|
-
rawMail += 'Content-Type: text/plain\n\n';
|
|
179
|
-
rawMail += rts.txtMessage;
|
|
180
|
-
}
|
|
181
|
-
rawMail += '\n\n--' + altBoundary + '--\n';
|
|
182
|
-
if (rts.attachments) {
|
|
183
|
-
rts.attachments.forEach((a) => {
|
|
184
|
-
rawMail += '\n\n--' + boundary + '\n';
|
|
185
|
-
rawMail += 'Content-Type: ' + a.contentType + '; name="' + a.filename + '"\n';
|
|
186
|
-
rawMail += 'Content-Transfer-Encoding: base64\n';
|
|
187
|
-
rawMail += 'Content-Disposition: attachment\n\n';
|
|
188
|
-
rawMail += a.base64Data.replace(/([^\0]{76})/g, '$1\n') + '\n\n';
|
|
189
|
-
});
|
|
190
|
-
}
|
|
191
|
-
rawMail += '\n\n--' + boundary + '--\n';
|
|
192
|
-
const params = {
|
|
193
|
-
RawMessage: { Data: new TextEncoder().encode(rawMail) },
|
|
194
|
-
};
|
|
195
|
-
rval = await this.ses.send(new client_ses_1.SendRawEmailCommand(params));
|
|
196
|
-
}
|
|
197
|
-
catch (err) {
|
|
198
|
-
ratchet_common_1.Logger.error('Error while processing email: %s', err, err);
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
return rval;
|
|
202
|
-
}
|
|
203
|
-
static validEmail(email) {
|
|
204
|
-
return email !== null && Mailer.EMAIL.test(email);
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
exports.Mailer = Mailer;
|
|
208
|
-
Mailer.EMAIL = new RegExp('.+@.+\\.[a-z]+');
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RemoteHandlebarsTemplateRenderer = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const handlebars_1 = tslib_1.__importDefault(require("handlebars"));
|
|
6
|
-
const cross_fetch_1 = tslib_1.__importDefault(require("cross-fetch"));
|
|
7
|
-
const ratchet_common_1 = require("@bitblit/ratchet-common");
|
|
8
|
-
const ratchet_common_2 = require("@bitblit/ratchet-common");
|
|
9
|
-
const handlebars_layouts_1 = tslib_1.__importDefault(require("handlebars-layouts"));
|
|
10
|
-
class RemoteHandlebarsTemplateRenderer {
|
|
11
|
-
constructor(prefix = '', suffix = '', maxCacheTemplates = 10) {
|
|
12
|
-
this.prefix = prefix;
|
|
13
|
-
this.suffix = suffix;
|
|
14
|
-
this.maxCacheTemplates = maxCacheTemplates;
|
|
15
|
-
if (this.maxCacheTemplates > 0) {
|
|
16
|
-
this.cache = new Map();
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
async renderTemplate(templateName, context, layoutName = null) {
|
|
20
|
-
return this.renderRemoteTemplate(templateName, context, layoutName);
|
|
21
|
-
}
|
|
22
|
-
async renderRemoteTemplate(templateName, inContext, layoutName = null) {
|
|
23
|
-
const template = await this.fetchTemplate(templateName);
|
|
24
|
-
const layoutText = !!layoutName ? await this.fetchTemplateText(layoutName) : null;
|
|
25
|
-
if (!!layoutText) {
|
|
26
|
-
await handlebars_layouts_1.default.register(handlebars_1.default);
|
|
27
|
-
handlebars_1.default.registerPartial(layoutName, layoutText);
|
|
28
|
-
}
|
|
29
|
-
const context = inContext || {};
|
|
30
|
-
const result = !!template ? template(context) : null;
|
|
31
|
-
return result;
|
|
32
|
-
}
|
|
33
|
-
async renderTemplateDirect(templateText, context, layoutName = null) {
|
|
34
|
-
const template = handlebars_1.default.compile(templateText);
|
|
35
|
-
const result = template(context);
|
|
36
|
-
return result;
|
|
37
|
-
}
|
|
38
|
-
async fetchTemplate(templateName) {
|
|
39
|
-
let rval = null;
|
|
40
|
-
try {
|
|
41
|
-
if (!!this.cache && this.cache.has(templateName)) {
|
|
42
|
-
ratchet_common_2.Logger.silly('Cache hit for template : %s', templateName);
|
|
43
|
-
rval = this.cache.get(templateName);
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
ratchet_common_2.Logger.debug('Cache miss for template : %s', templateName);
|
|
47
|
-
const templateText = await this.fetchTemplateText(templateName);
|
|
48
|
-
if (!!templateText) {
|
|
49
|
-
rval = handlebars_1.default.compile(templateText);
|
|
50
|
-
if (!!this.cache && !!rval) {
|
|
51
|
-
this.cache.set(templateName, rval);
|
|
52
|
-
if (this.cache.size > this.maxCacheTemplates) {
|
|
53
|
-
this.cache.delete(Array.from(this.cache.keys())[0]);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
catch (err) {
|
|
60
|
-
ratchet_common_2.Logger.warn('Could not fetch and compile template : %s : %s', templateName, err, err);
|
|
61
|
-
rval = null;
|
|
62
|
-
}
|
|
63
|
-
return rval;
|
|
64
|
-
}
|
|
65
|
-
async fetchTemplateText(templateName) {
|
|
66
|
-
let rval = null;
|
|
67
|
-
const url = ratchet_common_1.StringRatchet.trimToEmpty(this.prefix) + templateName + ratchet_common_1.StringRatchet.trimToEmpty(this.suffix);
|
|
68
|
-
try {
|
|
69
|
-
const resp = await (0, cross_fetch_1.default)(url);
|
|
70
|
-
rval = await resp.text();
|
|
71
|
-
}
|
|
72
|
-
catch (err) {
|
|
73
|
-
ratchet_common_2.Logger.warn('Could not fetch url : %s : %s', url, err, err);
|
|
74
|
-
rval = null;
|
|
75
|
-
}
|
|
76
|
-
return rval;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
exports.RemoteHandlebarsTemplateRenderer = RemoteHandlebarsTemplateRenderer;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SnsRatchet = void 0;
|
|
4
|
-
const ratchet_common_1 = require("@bitblit/ratchet-common");
|
|
5
|
-
const client_sns_1 = require("@aws-sdk/client-sns");
|
|
6
|
-
const ratchet_common_2 = require("@bitblit/ratchet-common");
|
|
7
|
-
class SnsRatchet {
|
|
8
|
-
constructor(sns = new client_sns_1.SNSClient({ region: 'us-east-1' }), topicArn) {
|
|
9
|
-
this.sns = sns;
|
|
10
|
-
this.topicArn = topicArn;
|
|
11
|
-
ratchet_common_2.RequireRatchet.notNullOrUndefined(this.sns, 'sns');
|
|
12
|
-
ratchet_common_2.RequireRatchet.notNullOrUndefined(this.topicArn, 'topicArn');
|
|
13
|
-
}
|
|
14
|
-
async sendMessage(inMsg, suppressErrors = false) {
|
|
15
|
-
let result = null;
|
|
16
|
-
try {
|
|
17
|
-
const safeInMsg = inMsg ? inMsg : 'NO-MESSAGE-PROVIDED';
|
|
18
|
-
const msg = typeof safeInMsg === 'string' ? safeInMsg : JSON.stringify(safeInMsg);
|
|
19
|
-
const params = {
|
|
20
|
-
TopicArn: this.topicArn,
|
|
21
|
-
Message: msg,
|
|
22
|
-
};
|
|
23
|
-
ratchet_common_1.Logger.debug('Sending via SNS : %j', params);
|
|
24
|
-
result = await this.sns.send(new client_sns_1.PublishCommand(params));
|
|
25
|
-
}
|
|
26
|
-
catch (err) {
|
|
27
|
-
if (suppressErrors) {
|
|
28
|
-
ratchet_common_1.Logger.error('Failed to fire SNS notification : %j : %s', inMsg, err);
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
throw err;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
return result;
|
|
35
|
-
}
|
|
36
|
-
async conditionallySendMessage(inMsg, condition, suppressErrors = false) {
|
|
37
|
-
let rval = null;
|
|
38
|
-
if (condition) {
|
|
39
|
-
rval = await this.sendMessage(inMsg, suppressErrors);
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
ratchet_common_1.Logger.info('Not sending message, condition was false : %j', inMsg);
|
|
43
|
-
}
|
|
44
|
-
return rval;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
exports.SnsRatchet = SnsRatchet;
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DynamoDbSyncLock = void 0;
|
|
4
|
-
const ratchet_common_1 = require("@bitblit/ratchet-common");
|
|
5
|
-
const client_dynamodb_1 = require("@aws-sdk/client-dynamodb");
|
|
6
|
-
class DynamoDbSyncLock {
|
|
7
|
-
constructor(ratchet, tableName) {
|
|
8
|
-
this.ratchet = ratchet;
|
|
9
|
-
this.tableName = tableName;
|
|
10
|
-
ratchet_common_1.RequireRatchet.notNullOrUndefined(ratchet, 'ratchet');
|
|
11
|
-
ratchet_common_1.RequireRatchet.notNullOrUndefined(ratchet_common_1.StringRatchet.trimToNull(this.tableName), 'tableName');
|
|
12
|
-
}
|
|
13
|
-
async acquireLock(lockKey, expirationSeconds = 30) {
|
|
14
|
-
let rval = false;
|
|
15
|
-
if (!!lockKey && !!expirationSeconds) {
|
|
16
|
-
const nowSeconds = Math.floor(new Date().getTime() / 1000);
|
|
17
|
-
const row = {
|
|
18
|
-
lockingKey: lockKey,
|
|
19
|
-
timestamp: nowSeconds,
|
|
20
|
-
expires: nowSeconds + expirationSeconds,
|
|
21
|
-
};
|
|
22
|
-
const params = {
|
|
23
|
-
Item: row,
|
|
24
|
-
ReturnConsumedCapacity: 'TOTAL',
|
|
25
|
-
TableName: this.tableName,
|
|
26
|
-
ConditionExpression: 'attribute_not_exists(lockingKey)',
|
|
27
|
-
};
|
|
28
|
-
try {
|
|
29
|
-
const pio = await this.ratchet.getDDB().send(new client_dynamodb_1.PutItemCommand(params));
|
|
30
|
-
rval = true;
|
|
31
|
-
}
|
|
32
|
-
catch (err) {
|
|
33
|
-
if (String(err).indexOf('ConditionalCheckFailedException') > -1) {
|
|
34
|
-
ratchet_common_1.Logger.silly('Unable to acquire lock on %s', lockKey);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
return rval;
|
|
39
|
-
}
|
|
40
|
-
async releaseLock(lockKey) {
|
|
41
|
-
if (ratchet_common_1.StringRatchet.trimToNull(lockKey)) {
|
|
42
|
-
try {
|
|
43
|
-
const dio = await this.ratchet.simpleDelete(this.tableName, { lockingKey: lockKey });
|
|
44
|
-
ratchet_common_1.Logger.silly('Released lock %s : %s', lockKey, dio);
|
|
45
|
-
}
|
|
46
|
-
catch (err) {
|
|
47
|
-
ratchet_common_1.Logger.warn('Failed to release lock key : %s : %s', lockKey, err, err);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
async clearExpiredSyncLocks() {
|
|
52
|
-
const nowSeconds = Math.floor(new Date().getTime() / 1000);
|
|
53
|
-
const scan = {
|
|
54
|
-
TableName: this.tableName,
|
|
55
|
-
FilterExpression: 'expires < :now',
|
|
56
|
-
ExpressionAttributeValues: {
|
|
57
|
-
':now': nowSeconds,
|
|
58
|
-
},
|
|
59
|
-
};
|
|
60
|
-
const vals = await this.ratchet.fullyExecuteScan(scan);
|
|
61
|
-
const keysOnly = vals.map((v) => {
|
|
62
|
-
const next = { lockingKey: v['lockingKey'] };
|
|
63
|
-
return next;
|
|
64
|
-
});
|
|
65
|
-
const removed = await this.ratchet.deleteAllInBatches(this.tableName, keysOnly, 25);
|
|
66
|
-
return removed;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
exports.DynamoDbSyncLock = DynamoDbSyncLock;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MemorySyncLock = void 0;
|
|
4
|
-
const ratchet_common_1 = require("@bitblit/ratchet-common");
|
|
5
|
-
class MemorySyncLock {
|
|
6
|
-
constructor() {
|
|
7
|
-
this._locks = new Map();
|
|
8
|
-
}
|
|
9
|
-
async acquireLock(lockKey, expirationSeconds = 30) {
|
|
10
|
-
let rval = false;
|
|
11
|
-
if (ratchet_common_1.StringRatchet.trimToNull(lockKey)) {
|
|
12
|
-
const now = Date.now();
|
|
13
|
-
const val = this._locks.get(lockKey);
|
|
14
|
-
if (!val || val < now) {
|
|
15
|
-
this._locks.set(lockKey, now + expirationSeconds * 1000);
|
|
16
|
-
rval = true;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return rval;
|
|
20
|
-
}
|
|
21
|
-
async releaseLock(lockKey) {
|
|
22
|
-
if (ratchet_common_1.StringRatchet.trimToNull(lockKey)) {
|
|
23
|
-
this._locks.delete(lockKey);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
async clearExpiredSyncLocks() {
|
|
27
|
-
const toRemove = [];
|
|
28
|
-
const now = Date.now();
|
|
29
|
-
this._locks.forEach((v, k) => {
|
|
30
|
-
if (v < now) {
|
|
31
|
-
toRemove.push(k);
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
toRemove.forEach((k) => {
|
|
35
|
-
this._locks.delete(k);
|
|
36
|
-
});
|
|
37
|
-
return toRemove.length;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
exports.MemorySyncLock = MemorySyncLock;
|
package/dist/es/index.js
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
export * from './batch/aws-batch-background-processor';
|
|
2
|
-
export * from './batch/aws-batch-ratchet';
|
|
3
|
-
export * from './build/ratchet-aws-info';
|
|
4
|
-
export * from './cache/dynamo-db-storage-provider';
|
|
5
|
-
export * from './cache/s3-storage-provider';
|
|
6
|
-
export * from './cache/simple-cache-object-wrapper';
|
|
7
|
-
export * from './cache/simple-cache-read-options';
|
|
8
|
-
export * from './cache/simple-cache-storage-provider';
|
|
9
|
-
export * from './cache/simple-cache';
|
|
10
|
-
export * from './cloudwatch/cloud-watch-log-group-ratchet';
|
|
11
|
-
export * from './cloudwatch/cloud-watch-logs-ratchet';
|
|
12
|
-
export * from './cloudwatch/cloud-watch-metrics-ratchet';
|
|
13
|
-
export * from './daemon/daemon-like';
|
|
14
|
-
export * from './daemon/daemon-process-create-options';
|
|
15
|
-
export * from './daemon/daemon-process-state-public-token';
|
|
16
|
-
export * from './daemon/daemon-process-state';
|
|
17
|
-
export * from './daemon/daemon-util';
|
|
18
|
-
export * from './daemon/daemon';
|
|
19
|
-
export * from './dao/prototype-dao-config';
|
|
20
|
-
export * from './dao/prototype-dao-db';
|
|
21
|
-
export * from './dao/prototype-dao-provider';
|
|
22
|
-
export * from './dao/prototype-dao';
|
|
23
|
-
export * from './dao/s3-prototype-dao-provider';
|
|
24
|
-
export * from './dao/s3-simple-dao';
|
|
25
|
-
export * from './dao/simple-dao-item';
|
|
26
|
-
export * from './dynamodb/dynamo-ratchet-like';
|
|
27
|
-
export * from './dynamodb/dynamo-ratchet';
|
|
28
|
-
export * from './dynamodb/dynamo-table-ratchet';
|
|
29
|
-
export * from './dynamodb/hash-spreader';
|
|
30
|
-
export * from './ec2/ec2-ratchet';
|
|
31
|
-
export * from './environment/cascade-environment-service-provider';
|
|
32
|
-
export * from './environment/env-var-environment-service-provider';
|
|
33
|
-
export * from './environment/environment-service-config';
|
|
34
|
-
export * from './environment/environment-service-provider';
|
|
35
|
-
export * from './environment/environment-service';
|
|
36
|
-
export * from './environment/fixed-environment-service-provider';
|
|
37
|
-
export * from './environment/s3-environment-service-provider';
|
|
38
|
-
export * from './environment/ssm-environment-service-provider';
|
|
39
|
-
export * from './expiring-code/dynamo-expiring-code-provider';
|
|
40
|
-
export * from './expiring-code/expiring-code-params';
|
|
41
|
-
export * from './expiring-code/expiring-code-provider';
|
|
42
|
-
export * from './expiring-code/expiring-code-ratchet';
|
|
43
|
-
export * from './expiring-code/expiring-code';
|
|
44
|
-
export * from './expiring-code/s3-expiring-code-provider';
|
|
45
|
-
export * from './iam/aws-credentials-ratchet';
|
|
46
|
-
export * from './lambda/lambda-event-detector';
|
|
47
|
-
export * from './lambda/lambda-event-type-guards';
|
|
48
|
-
export * from './model/cloud-watch-metrics-minute-level-dynamo-count-request';
|
|
49
|
-
export * from './model/cloud-watch-metrics-unit';
|
|
50
|
-
export * from './model/dynamo-count-result';
|
|
51
|
-
export * from './model/dynamo/doc-put-item-command-input';
|
|
52
|
-
export * from './model/dynamo/doc-query-command-input';
|
|
53
|
-
export * from './model/dynamo/doc-scan-command-input';
|
|
54
|
-
export * from './model/dynamo/doc-update-item-command-input';
|
|
55
|
-
export * from './route53/route-53-ratchet';
|
|
56
|
-
export * from './runtime-parameter/cached-stored-runtime-parameter';
|
|
57
|
-
export * from './runtime-parameter/dynamo-runtime-parameter-provider';
|
|
58
|
-
export * from './runtime-parameter/global-variable-override-runtime-parameter-provider';
|
|
59
|
-
export * from './runtime-parameter/memory-runtime-parameter-provider';
|
|
60
|
-
export * from './runtime-parameter/runtime-parameter-provider';
|
|
61
|
-
export * from './runtime-parameter/runtime-parameter-ratchet';
|
|
62
|
-
export * from './runtime-parameter/stored-runtime-parameter';
|
|
63
|
-
export * from './s3/s3-cache-ratchet';
|
|
64
|
-
export * from './s3/s3-cache-to-local-disk-ratchet';
|
|
65
|
-
export * from './s3/s3-location-sync-ratchet';
|
|
66
|
-
export * from './s3/s3-ratchet';
|
|
67
|
-
export * from './ses/email-attachment';
|
|
68
|
-
export * from './ses/mailer-config';
|
|
69
|
-
export * from './ses/mailer-like';
|
|
70
|
-
export * from './ses/mailer';
|
|
71
|
-
export * from './ses/ratchet-template-renderer';
|
|
72
|
-
export * from './ses/ready-to-send-email';
|
|
73
|
-
export * from './ses/remote-handlebars-template-renderer';
|
|
74
|
-
export * from './ses/resolved-ready-to-send-email';
|
|
75
|
-
export * from './sns/sns-ratchet';
|
|
76
|
-
export * from './sync-lock/dynamo-db-sync-lock';
|
|
77
|
-
export * from './sync-lock/memory-sync-lock';
|
|
78
|
-
export * from './sync-lock/sync-lock-provider';
|