@bitblit/ratchet-aws 4.0.99-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 +13 -9
- 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 +13 -11
- 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 +10 -11
- 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,8 +1,4 @@
|
|
|
1
|
-
import { EnvironmentServiceProvider } from './environment-service-provider';
|
|
2
|
-
/**
|
|
3
|
-
* Service for reading environmental variables
|
|
4
|
-
* Also hides the decryption detail from higher up services
|
|
5
|
-
*/
|
|
1
|
+
import { EnvironmentServiceProvider } from './environment-service-provider.js';
|
|
6
2
|
export declare class SsmEnvironmentServiceProvider<T> implements EnvironmentServiceProvider<T> {
|
|
7
3
|
private region;
|
|
8
4
|
private ssmEncrypted;
|
|
@@ -1,10 +1,13 @@
|
|
|
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 { StringRatchet } from '@bitblit/ratchet-common/dist/lang/string-ratchet.js';
|
|
5
|
+
import { PromiseRatchet } from '@bitblit/ratchet-common/dist/lang/promise-ratchet.js';
|
|
2
6
|
import { GetParameterCommand, SSMClient } from '@aws-sdk/client-ssm';
|
|
3
|
-
import { PromiseRatchet } from '@bitblit/ratchet-common';
|
|
4
|
-
import { RequireRatchet } from '@bitblit/ratchet-common';
|
|
5
|
-
import { ErrorRatchet } from '@bitblit/ratchet-common';
|
|
6
|
-
import { StringRatchet } from '@bitblit/ratchet-common';
|
|
7
7
|
export class SsmEnvironmentServiceProvider {
|
|
8
|
+
region;
|
|
9
|
+
ssmEncrypted;
|
|
10
|
+
ssm;
|
|
8
11
|
constructor(region = 'us-east-1', ssmEncrypted = true) {
|
|
9
12
|
this.region = region;
|
|
10
13
|
this.ssmEncrypted = ssmEncrypted;
|
|
@@ -28,7 +31,7 @@ export class SsmEnvironmentServiceProvider {
|
|
|
28
31
|
const errCode = err['code'] || '';
|
|
29
32
|
if (errCode.toLowerCase().indexOf('throttlingexception') !== -1) {
|
|
30
33
|
Logger.warn('Throttled while trying to read parameters - waiting 1 second before allowing retry');
|
|
31
|
-
await PromiseRatchet.wait(
|
|
34
|
+
await PromiseRatchet.wait(1_000);
|
|
32
35
|
}
|
|
33
36
|
else if (errCode.toLowerCase().indexOf('parameternotfound') !== -1) {
|
|
34
37
|
const errMsg = Logger.warn('AWS could not find parameter %s - are you using the right AWS key?', name);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ExpiringCodeProvider } from './expiring-code-provider';
|
|
2
|
-
import { DynamoRatchet } from '../dynamodb/dynamo-ratchet';
|
|
3
|
-
import { ExpiringCode } from './expiring-code';
|
|
4
|
-
import { DynamoTableRatchet } from '../dynamodb/dynamo-table-ratchet';
|
|
1
|
+
import { ExpiringCodeProvider } from './expiring-code-provider.js';
|
|
2
|
+
import { DynamoRatchet } from '../dynamodb/dynamo-ratchet.js';
|
|
3
|
+
import { ExpiringCode } from './expiring-code.js';
|
|
4
|
+
import { DynamoTableRatchet } from '../dynamodb/dynamo-table-ratchet.js';
|
|
5
5
|
export declare class DynamoExpiringCodeProvider implements ExpiringCodeProvider {
|
|
6
6
|
private tableName;
|
|
7
7
|
private dynamoRatchet;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ExpiringCode } from './expiring-code';
|
|
1
|
+
import { ExpiringCode } from './expiring-code.js';
|
|
2
2
|
export interface ExpiringCodeProvider {
|
|
3
3
|
storeCode(code: ExpiringCode): Promise<boolean>;
|
|
4
4
|
checkCode(code: string, context: string, deleteOnMatch?: boolean): Promise<boolean>;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import { ExpiringCodeProvider } from './expiring-code-provider';
|
|
2
|
-
import { ExpiringCodeParams } from './expiring-code-params';
|
|
3
|
-
import { ExpiringCode } from './expiring-code';
|
|
4
|
-
/**
|
|
5
|
-
* Supports creating and checking single use codes
|
|
6
|
-
*/
|
|
1
|
+
import { ExpiringCodeProvider } from './expiring-code-provider.js';
|
|
2
|
+
import { ExpiringCodeParams } from './expiring-code-params.js';
|
|
3
|
+
import { ExpiringCode } from './expiring-code.js';
|
|
7
4
|
export declare class ExpiringCodeRatchet {
|
|
8
5
|
private provider;
|
|
9
6
|
constructor(provider: ExpiringCodeProvider);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { RequireRatchet } from '@bitblit/ratchet-common';
|
|
2
|
-
import { StringRatchet } from '@bitblit/ratchet-common';
|
|
1
|
+
import { RequireRatchet } from '@bitblit/ratchet-common/dist/lang/require-ratchet.js';
|
|
2
|
+
import { StringRatchet } from '@bitblit/ratchet-common/dist/lang/string-ratchet.js';
|
|
3
3
|
export class ExpiringCodeRatchet {
|
|
4
|
+
provider;
|
|
4
5
|
constructor(provider) {
|
|
5
6
|
this.provider = provider;
|
|
6
7
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ExpiringCodeRatchet } from './expiring-code-ratchet.js';
|
|
2
|
+
describe('#ExpiringCodeRatchet', () => {
|
|
3
|
+
it('Should generate valid codes', async () => {
|
|
4
|
+
const output = ExpiringCodeRatchet.generateCode({ context: 'test', length: 5, timeToLiveSeconds: 10, alphabet: 'A' });
|
|
5
|
+
expect(output.code).toEqual('AAAAA');
|
|
6
|
+
});
|
|
7
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ExpiringCodeProvider } from './expiring-code-provider';
|
|
2
|
-
import { ExpiringCode } from './expiring-code';
|
|
3
|
-
import { S3CacheRatchet } from '../s3/s3-cache-ratchet';
|
|
1
|
+
import { ExpiringCodeProvider } from './expiring-code-provider.js';
|
|
2
|
+
import { ExpiringCode } from './expiring-code.js';
|
|
3
|
+
import { S3CacheRatchet } from '../s3/s3-cache-ratchet.js';
|
|
4
4
|
import { PutObjectOutput } from '@aws-sdk/client-s3';
|
|
5
5
|
export declare class S3ExpiringCodeProvider implements ExpiringCodeProvider {
|
|
6
6
|
private s3CacheRatchet;
|
|
@@ -1,5 +1,8 @@
|
|
|
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';
|
|
2
3
|
export class S3ExpiringCodeProvider {
|
|
4
|
+
s3CacheRatchet;
|
|
5
|
+
keyName;
|
|
3
6
|
constructor(s3CacheRatchet, keyName) {
|
|
4
7
|
this.s3CacheRatchet = s3CacheRatchet;
|
|
5
8
|
this.keyName = keyName;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { JestRatchet } from '@bitblit/ratchet-jest/dist/jest/jest-ratchet.js';
|
|
2
|
+
import { S3ExpiringCodeProvider } from './s3-expiring-code-provider.js';
|
|
3
|
+
import { jest } from '@jest/globals';
|
|
4
|
+
let mockS3Ratchet;
|
|
5
|
+
const testCode = { code: '12345', context: 'ctx', expiresEpochMS: Date.now() + 100_000, tags: ['tag1'] };
|
|
6
|
+
const testCode2 = { code: '45678', context: 'ctx', expiresEpochMS: Date.now() + 100_000, tags: ['tag1'] };
|
|
7
|
+
describe('#S3ExpiringCodeProvider', () => {
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
mockS3Ratchet = JestRatchet.mock(jest.fn);
|
|
10
|
+
mockS3Ratchet.getDefaultBucket.mockReturnValue('TEST-BUCKET');
|
|
11
|
+
});
|
|
12
|
+
it('Should fetch file', async () => {
|
|
13
|
+
const val = new S3ExpiringCodeProvider(mockS3Ratchet, 'test.json');
|
|
14
|
+
const output = await val.fetchFile();
|
|
15
|
+
expect(output).not.toBeFalsy();
|
|
16
|
+
expect(output.data).not.toBeFalsy();
|
|
17
|
+
expect(output.lastModifiedEpochMS).not.toBeFalsy();
|
|
18
|
+
});
|
|
19
|
+
it('Should update file', async () => {
|
|
20
|
+
const val = new S3ExpiringCodeProvider(mockS3Ratchet, 'test.json');
|
|
21
|
+
mockS3Ratchet.writeObjectToCacheFile.mockResolvedValue({});
|
|
22
|
+
const wrote = await val.updateFile([testCode]);
|
|
23
|
+
expect(wrote).not.toBeFalsy();
|
|
24
|
+
});
|
|
25
|
+
it('Should check code', async () => {
|
|
26
|
+
mockS3Ratchet.fetchCacheFileAsObject.mockResolvedValue({
|
|
27
|
+
data: [testCode],
|
|
28
|
+
lastModifiedEpochMS: 1234,
|
|
29
|
+
});
|
|
30
|
+
const val = new S3ExpiringCodeProvider(mockS3Ratchet, 'test.json');
|
|
31
|
+
const testValidCode = await val.checkCode('12345', 'ctx', false);
|
|
32
|
+
const testInvalidCode = await val.checkCode('09876', 'ctx', false);
|
|
33
|
+
expect(testValidCode).toBeTruthy();
|
|
34
|
+
expect(testInvalidCode).toBeFalsy();
|
|
35
|
+
});
|
|
36
|
+
it('Should store code', async () => {
|
|
37
|
+
mockS3Ratchet.fetchCacheFileAsObject.mockResolvedValue({
|
|
38
|
+
data: [testCode],
|
|
39
|
+
lastModifiedEpochMS: 1234,
|
|
40
|
+
});
|
|
41
|
+
mockS3Ratchet.writeObjectToCacheFile.mockResolvedValue({});
|
|
42
|
+
const val = new S3ExpiringCodeProvider(mockS3Ratchet, 'test.json');
|
|
43
|
+
const output = await val.storeCode(testCode2);
|
|
44
|
+
expect(output).toBeTruthy();
|
|
45
|
+
});
|
|
46
|
+
});
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Ratchet for manipulating credentials
|
|
3
|
-
*
|
|
4
|
-
* Mainly here so I don't have to remember certain specific AWS environmental variable names
|
|
5
|
-
*/
|
|
6
1
|
export declare class AwsCredentialsRatchet {
|
|
7
2
|
private constructor();
|
|
8
3
|
static applySetProfileEnvironmentalVariable(newProfile: string): void;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { ErrorRatchet
|
|
1
|
+
import { ErrorRatchet } from '@bitblit/ratchet-common/dist/lang/error-ratchet.js';
|
|
2
|
+
import { StringRatchet } from '@bitblit/ratchet-common/dist/lang/string-ratchet.js';
|
|
2
3
|
export class AwsCredentialsRatchet {
|
|
3
4
|
constructor() { }
|
|
4
5
|
static applySetProfileEnvironmentalVariable(newProfile) {
|
package/dist/{types/model → model}/cloud-watch-metrics-minute-level-dynamo-count-request.d.ts
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { KeyValue } from '@bitblit/ratchet-common';
|
|
2
|
-
import { DynamoRatchet } from '../dynamodb/dynamo-ratchet';
|
|
1
|
+
import { KeyValue } from '@bitblit/ratchet-common/dist/lang/key-value.js';
|
|
2
|
+
import { DynamoRatchet } from '../dynamodb/dynamo-ratchet.js';
|
|
3
3
|
import { QueryInput, ScanCommandInput } from '@aws-sdk/client-dynamodb';
|
|
4
4
|
export interface CloudWatchMetricsMinuteLevelDynamoCountRequest {
|
|
5
5
|
dynamoRatchet: DynamoRatchet;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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
2
|
import { ChangeResourceRecordSetsCommand, waitUntilResourceRecordSetsChanged, } from '@aws-sdk/client-route-53';
|
|
3
3
|
import { WaiterState } from '@aws-sdk/util-waiter';
|
|
4
4
|
export class Route53Ratchet {
|
|
5
|
+
route53;
|
|
6
|
+
hostedZoneId;
|
|
5
7
|
constructor(route53, hostedZoneId) {
|
|
6
8
|
this.route53 = route53;
|
|
7
9
|
this.hostedZoneId = hostedZoneId;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/{types/runtime-parameter → runtime-parameter}/dynamo-runtime-parameter-provider.d.ts
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { RuntimeParameterProvider } from './runtime-parameter-provider';
|
|
2
|
-
import { StoredRuntimeParameter } from './stored-runtime-parameter';
|
|
3
|
-
import { DynamoRatchet } from '../dynamodb/dynamo-ratchet';
|
|
1
|
+
import { RuntimeParameterProvider } from './runtime-parameter-provider.js';
|
|
2
|
+
import { StoredRuntimeParameter } from './stored-runtime-parameter.js';
|
|
3
|
+
import { DynamoRatchet } from '../dynamodb/dynamo-ratchet.js';
|
|
4
4
|
export declare class DynamoRuntimeParameterProvider implements RuntimeParameterProvider {
|
|
5
5
|
private dynamo;
|
|
6
6
|
private tableName;
|
package/dist/{es/runtime-parameter → runtime-parameter}/dynamo-runtime-parameter-provider.js
RENAMED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { RequireRatchet } from '@bitblit/ratchet-common';
|
|
2
|
-
import { Logger } from '@bitblit/ratchet-common';
|
|
1
|
+
import { RequireRatchet } from '@bitblit/ratchet-common/dist/lang/require-ratchet.js';
|
|
2
|
+
import { Logger } from '@bitblit/ratchet-common/dist/logger/logger.js';
|
|
3
3
|
export class DynamoRuntimeParameterProvider {
|
|
4
|
+
dynamo;
|
|
5
|
+
tableName;
|
|
4
6
|
constructor(dynamo, tableName) {
|
|
5
7
|
this.dynamo = dynamo;
|
|
6
8
|
this.tableName = tableName;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { DynamoRuntimeParameterProvider } from './dynamo-runtime-parameter-provider.js';
|
|
2
|
+
import { JestRatchet } from '@bitblit/ratchet-jest/dist/jest/jest-ratchet.js';
|
|
3
|
+
import { RuntimeParameterRatchet } from './runtime-parameter-ratchet.js';
|
|
4
|
+
import { Logger } from '@bitblit/ratchet-common/dist/logger/logger.js';
|
|
5
|
+
import { LoggerLevelName } from '@bitblit/ratchet-common/dist/logger/logger-level-name.js';
|
|
6
|
+
import { PromiseRatchet } from '@bitblit/ratchet-common/dist/lang/promise-ratchet.js';
|
|
7
|
+
import { jest } from '@jest/globals';
|
|
8
|
+
let mockDynamoRatchet;
|
|
9
|
+
const testEntry = { groupId: 'test', paramKey: 'test', paramValue: '15', ttlSeconds: 0.5 };
|
|
10
|
+
const testEntry2 = { groupId: 'test', paramKey: 'test1', paramValue: '20', ttlSeconds: 0.5 };
|
|
11
|
+
describe('#runtimeParameterRatchet', function () {
|
|
12
|
+
beforeEach(() => {
|
|
13
|
+
mockDynamoRatchet = JestRatchet.mock(jest.fn);
|
|
14
|
+
});
|
|
15
|
+
it('fetch and cache a runtime parameter', async () => {
|
|
16
|
+
Logger.setLevel(LoggerLevelName.silly);
|
|
17
|
+
const tableName = 'default-table';
|
|
18
|
+
mockDynamoRatchet.simpleGet.mockResolvedValue(testEntry);
|
|
19
|
+
mockDynamoRatchet.simplePut.mockResolvedValue({});
|
|
20
|
+
const drpp = new DynamoRuntimeParameterProvider(mockDynamoRatchet, tableName);
|
|
21
|
+
const rpr = new RuntimeParameterRatchet(drpp);
|
|
22
|
+
const stored = await rpr.storeParameter('test', 'test1', 15, 0.5);
|
|
23
|
+
Logger.info('Stored : %j', stored);
|
|
24
|
+
const cache1 = await rpr.fetchParameter('test', 'test1');
|
|
25
|
+
const cache1a = await rpr.fetchParameter('test', 'test1');
|
|
26
|
+
const cache1b = await rpr.fetchParameter('test', 'test1');
|
|
27
|
+
expect(cache1).toEqual(15);
|
|
28
|
+
expect(cache1a).toEqual(15);
|
|
29
|
+
expect(cache1b).toEqual(15);
|
|
30
|
+
await PromiseRatchet.wait(1000);
|
|
31
|
+
const cache2 = await rpr.fetchParameter('test', 'test1');
|
|
32
|
+
expect(cache2).toEqual(15);
|
|
33
|
+
mockDynamoRatchet.simpleGet.mockResolvedValue(null);
|
|
34
|
+
const cacheMiss = await rpr.fetchParameter('test', 'test-miss');
|
|
35
|
+
expect(cacheMiss).toBeNull();
|
|
36
|
+
const cacheDefault = await rpr.fetchParameter('test', 'test-miss', 27);
|
|
37
|
+
expect(cacheDefault).toEqual(27);
|
|
38
|
+
}, 30_000);
|
|
39
|
+
it('reads underlying entries', async () => {
|
|
40
|
+
Logger.setLevel(LoggerLevelName.silly);
|
|
41
|
+
const tableName = 'default-table';
|
|
42
|
+
mockDynamoRatchet.fullyExecuteQuery.mockResolvedValue([testEntry, testEntry2]);
|
|
43
|
+
const drpp = new DynamoRuntimeParameterProvider(mockDynamoRatchet, tableName);
|
|
44
|
+
const rpr = new RuntimeParameterRatchet(drpp);
|
|
45
|
+
const vals = await rpr.readUnderlyingEntries('test');
|
|
46
|
+
expect(vals).not.toBeFalsy();
|
|
47
|
+
expect(vals.length).toEqual(2);
|
|
48
|
+
}, 30_000);
|
|
49
|
+
});
|
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
import { RuntimeParameterProvider } from './runtime-parameter-provider';
|
|
2
|
-
import { StoredRuntimeParameter } from './stored-runtime-parameter';
|
|
3
|
-
/**
|
|
4
|
-
* Provides parameters for a runtime parameter from an global (ie, process.env or global.xx) variable, where the key follows
|
|
5
|
-
* a given format
|
|
6
|
-
*
|
|
7
|
-
* "Simple" because it forces all ttls to be the same value (ignores what is passed in) so that the
|
|
8
|
-
* envvar itself can be just a string instead of a complex value
|
|
9
|
-
*/
|
|
1
|
+
import { RuntimeParameterProvider } from './runtime-parameter-provider.js';
|
|
2
|
+
import { StoredRuntimeParameter } from './stored-runtime-parameter.js';
|
|
10
3
|
export declare class GlobalVariableOverrideRuntimeParameterProvider implements RuntimeParameterProvider {
|
|
11
4
|
private wrapped;
|
|
12
5
|
private options;
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { RequireRatchet } from '@bitblit/ratchet-common';
|
|
2
|
-
import { ErrorRatchet
|
|
1
|
+
import { RequireRatchet } from '@bitblit/ratchet-common/dist/lang/require-ratchet.js';
|
|
2
|
+
import { ErrorRatchet } from '@bitblit/ratchet-common/dist/lang/error-ratchet.js';
|
|
3
|
+
import { StringRatchet } from '@bitblit/ratchet-common/dist/lang/string-ratchet.js';
|
|
3
4
|
export class GlobalVariableOverrideRuntimeParameterProvider {
|
|
5
|
+
wrapped;
|
|
6
|
+
options = {
|
|
7
|
+
globalTTL: 1,
|
|
8
|
+
separator: '.',
|
|
9
|
+
prefix: 'RuntimeEnv-',
|
|
10
|
+
suffix: '',
|
|
11
|
+
};
|
|
4
12
|
constructor(wrapped, opts) {
|
|
5
13
|
this.wrapped = wrapped;
|
|
6
|
-
this.options = {
|
|
7
|
-
globalTTL: 1,
|
|
8
|
-
separator: '.',
|
|
9
|
-
prefix: 'RuntimeEnv-',
|
|
10
|
-
suffix: '',
|
|
11
|
-
};
|
|
12
14
|
RequireRatchet.notNullOrUndefined(this.wrapped, 'wrapped');
|
|
13
15
|
RequireRatchet.notNullOrUndefined(global?.process?.env, '"process" not found - this only runs in Node, not the browser');
|
|
14
16
|
if (opts) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { DynamoRuntimeParameterProvider } from './dynamo-runtime-parameter-provider.js';
|
|
2
|
+
import { JestRatchet } from '@bitblit/ratchet-jest/dist/jest/jest-ratchet.js';
|
|
3
|
+
import { Logger } from '@bitblit/ratchet-common/dist/logger/logger.js';
|
|
4
|
+
import { LoggerLevelName } from '@bitblit/ratchet-common/dist/logger/logger-level-name.js';
|
|
5
|
+
import { RuntimeParameterRatchet } from './runtime-parameter-ratchet.js';
|
|
6
|
+
import { GlobalVariableOverrideRuntimeParameterProvider } from './global-variable-override-runtime-parameter-provider.js';
|
|
7
|
+
import { jest } from '@jest/globals';
|
|
8
|
+
let mockDynamoRatchet;
|
|
9
|
+
const testEntry = { groupId: 'test', paramKey: 'test', paramValue: '15', ttlSeconds: 0.5 };
|
|
10
|
+
const testEntry2 = { groupId: 'test', paramKey: 'test1', paramValue: '"not-overridden"', ttlSeconds: 0.5 };
|
|
11
|
+
describe('#globalVariableOverrideRuntimeParameterProvider', function () {
|
|
12
|
+
beforeEach(() => {
|
|
13
|
+
mockDynamoRatchet = JestRatchet.mock(jest.fn);
|
|
14
|
+
});
|
|
15
|
+
it('reads underlying entries', async () => {
|
|
16
|
+
Logger.setLevel(LoggerLevelName.silly);
|
|
17
|
+
mockDynamoRatchet.simpleGet.mockResolvedValue(testEntry2);
|
|
18
|
+
const drpp = new DynamoRuntimeParameterProvider(mockDynamoRatchet, 'test-table');
|
|
19
|
+
const er = new GlobalVariableOverrideRuntimeParameterProvider(drpp, {
|
|
20
|
+
globalTTL: 1,
|
|
21
|
+
separator: '.',
|
|
22
|
+
prefix: 'p-',
|
|
23
|
+
suffix: null,
|
|
24
|
+
});
|
|
25
|
+
process.env[er.generateName('test', 'test1')] = '"override"';
|
|
26
|
+
const rpr = new RuntimeParameterRatchet(er);
|
|
27
|
+
const root = await drpp.readParameter('test', 'test1');
|
|
28
|
+
const override = await er.readParameter('test', 'test1');
|
|
29
|
+
const fetched = await rpr.fetchParameter('test', 'test1');
|
|
30
|
+
expect(root).not.toBeNull();
|
|
31
|
+
expect(override).not.toBeNull();
|
|
32
|
+
expect(fetched).not.toBeNull();
|
|
33
|
+
expect(root.paramValue).toEqual('"not-overridden"');
|
|
34
|
+
expect(override.paramValue).toEqual('"override"');
|
|
35
|
+
expect(fetched).toEqual('override');
|
|
36
|
+
}, 30_000);
|
|
37
|
+
});
|
package/dist/{types/runtime-parameter → runtime-parameter}/memory-runtime-parameter-provider.d.ts
RENAMED
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import { RuntimeParameterProvider } from './runtime-parameter-provider';
|
|
2
|
-
import { StoredRuntimeParameter } from './stored-runtime-parameter';
|
|
3
|
-
/**
|
|
4
|
-
* Very simple class, basically here just for unit testing although I suppose you could
|
|
5
|
-
* use it for something else
|
|
6
|
-
*/
|
|
1
|
+
import { RuntimeParameterProvider } from './runtime-parameter-provider.js';
|
|
2
|
+
import { StoredRuntimeParameter } from './stored-runtime-parameter.js';
|
|
7
3
|
export declare class MemoryRuntimeParameterProvider implements RuntimeParameterProvider {
|
|
8
4
|
private data;
|
|
9
5
|
constructor(data?: Promise<Record<string, StoredRuntimeParameter>>);
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* Classes implementing RuntimeParameterProvider offer the ability to fetch a runtime parameter
|
|
3
|
-
* object from _somewhere_
|
|
4
|
-
* They do NOT handle local caching - the RuntimeParameterRatchet does that
|
|
5
|
-
*/
|
|
6
|
-
import { StoredRuntimeParameter } from './stored-runtime-parameter';
|
|
1
|
+
import { StoredRuntimeParameter } from './stored-runtime-parameter.js';
|
|
7
2
|
export interface RuntimeParameterProvider {
|
|
8
3
|
readParameter(groupId: string, paramKey: string): Promise<StoredRuntimeParameter>;
|
|
9
4
|
readAllParametersForGroup(groupId: string): Promise<StoredRuntimeParameter[]>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { RuntimeParameterProvider } from './runtime-parameter-provider';
|
|
2
|
-
import { StoredRuntimeParameter } from './stored-runtime-parameter';
|
|
1
|
+
import { RuntimeParameterProvider } from './runtime-parameter-provider.js';
|
|
2
|
+
import { StoredRuntimeParameter } from './stored-runtime-parameter.js';
|
|
3
3
|
export declare class RuntimeParameterRatchet {
|
|
4
4
|
private provider;
|
|
5
5
|
private cache;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { Logger } from '@bitblit/ratchet-common';
|
|
2
|
-
import { RequireRatchet } 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';
|
|
3
3
|
export class RuntimeParameterRatchet {
|
|
4
|
+
provider;
|
|
5
|
+
cache = new Map();
|
|
4
6
|
constructor(provider) {
|
|
5
7
|
this.provider = provider;
|
|
6
|
-
this.cache = new Map();
|
|
7
8
|
RequireRatchet.notNullOrUndefined(this.provider);
|
|
8
9
|
}
|
|
9
10
|
async fetchParameter(groupId, paramKey, defaultValue = null, forceFreshRead = false) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { RuntimeParameterRatchet } from './runtime-parameter-ratchet.js';
|
|
2
|
+
import { Logger } from '@bitblit/ratchet-common/dist/logger/logger.js';
|
|
3
|
+
import { LoggerLevelName } from '@bitblit/ratchet-common/dist/logger/logger-level-name.js';
|
|
4
|
+
import { PromiseRatchet } from '@bitblit/ratchet-common/dist/lang/promise-ratchet.js';
|
|
5
|
+
import { MemoryRuntimeParameterProvider } from './memory-runtime-parameter-provider.js';
|
|
6
|
+
const testEntry = { groupId: 'test', paramKey: 'test', paramValue: '15', ttlSeconds: 0.5 };
|
|
7
|
+
const testEntry2 = { groupId: 'test', paramKey: 'test1', paramValue: '20', ttlSeconds: 0.5 };
|
|
8
|
+
describe('#runtimeParameterRatchet', function () {
|
|
9
|
+
it('fetch and cache a runtime parameter', async () => {
|
|
10
|
+
Logger.setLevel(LoggerLevelName.silly);
|
|
11
|
+
const mp = new MemoryRuntimeParameterProvider();
|
|
12
|
+
const rpr = new RuntimeParameterRatchet(mp);
|
|
13
|
+
const stored = await rpr.storeParameter('test', 'test1', 15, 0.5);
|
|
14
|
+
Logger.info('Stored : %j', stored);
|
|
15
|
+
const cache1 = await rpr.fetchParameter('test', 'test1');
|
|
16
|
+
const cache1a = await rpr.fetchParameter('test', 'test1');
|
|
17
|
+
const cache1b = await rpr.fetchParameter('test', 'test1');
|
|
18
|
+
expect(cache1).toEqual(15);
|
|
19
|
+
expect(cache1a).toEqual(15);
|
|
20
|
+
expect(cache1b).toEqual(15);
|
|
21
|
+
await PromiseRatchet.wait(1000);
|
|
22
|
+
const cache2 = await rpr.fetchParameter('test', 'test1');
|
|
23
|
+
expect(cache2).toEqual(15);
|
|
24
|
+
const cacheMiss = await rpr.fetchParameter('test', 'test-miss');
|
|
25
|
+
expect(cacheMiss).toBeNull();
|
|
26
|
+
const cacheDefault = await rpr.fetchParameter('test', 'test-miss', 27);
|
|
27
|
+
expect(cacheDefault).toEqual(27);
|
|
28
|
+
}, 30_000);
|
|
29
|
+
it('reads underlying entries', async () => {
|
|
30
|
+
Logger.setLevel(LoggerLevelName.silly);
|
|
31
|
+
const mrpp = new MemoryRuntimeParameterProvider();
|
|
32
|
+
await mrpp.writeParameter(testEntry);
|
|
33
|
+
await mrpp.writeParameter(testEntry2);
|
|
34
|
+
const rpr = new RuntimeParameterRatchet(mrpp);
|
|
35
|
+
const vals = await rpr.readUnderlyingEntries('test');
|
|
36
|
+
expect(vals).not.toBeFalsy();
|
|
37
|
+
expect(vals.length).toEqual(2);
|
|
38
|
+
}, 30_000);
|
|
39
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
3
3
|
import { CompleteMultipartUploadCommandOutput, CopyObjectCommandOutput, DeleteObjectCommandOutput, GetObjectCommandOutput, HeadObjectCommandOutput, PutObjectCommandInput, S3Client } from '@aws-sdk/client-s3';
|
|
4
4
|
import { Readable } from 'stream';
|
|
5
5
|
export declare class S3CacheRatchet {
|
|
@@ -17,8 +17,7 @@ export declare class S3CacheRatchet {
|
|
|
17
17
|
fetchCacheFileAsString(key: string, bucket?: string): Promise<string>;
|
|
18
18
|
fetchCacheFileAsObject<T>(key: string, bucket?: string): Promise<T>;
|
|
19
19
|
removeCacheFile(key: string, bucket?: string): Promise<DeleteObjectCommandOutput>;
|
|
20
|
-
writeObjectToCacheFile(key: string, dataObject: any,
|
|
21
|
-
template?: PutObjectCommandInput, bucket?: string): Promise<CompleteMultipartUploadCommandOutput>;
|
|
20
|
+
writeObjectToCacheFile(key: string, dataObject: any, template?: PutObjectCommandInput, bucket?: string): Promise<CompleteMultipartUploadCommandOutput>;
|
|
22
21
|
writeStringToCacheFile(key: string, dataString: string, template?: PutObjectCommandInput, bucket?: string): Promise<CompleteMultipartUploadCommandOutput>;
|
|
23
22
|
writeStreamToCacheFile(key: string, data: ReadableStream | Readable, template?: PutObjectCommandInput, bucket?: string): Promise<CompleteMultipartUploadCommandOutput>;
|
|
24
23
|
synchronize(srcPrefix: string, targetPrefix: string, targetRatchet?: S3CacheRatchet, recurseSubFolders?: boolean): Promise<string[]>;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { CopyObjectCommand, DeleteObjectCommand, GetObjectCommand, HeadObjectCommand, ListObjectsCommand, NoSuchKey, } from '@aws-sdk/client-s3';
|
|
2
|
-
import { Logger } from '@bitblit/ratchet-common';
|
|
3
|
-
import { RequireRatchet } from '@bitblit/ratchet-common';
|
|
4
|
-
import {
|
|
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 { StringRatchet } from '@bitblit/ratchet-common/dist/lang/string-ratchet.js';
|
|
5
|
+
import { StopWatch } from '@bitblit/ratchet-common/dist/lang/stop-watch.js';
|
|
6
|
+
import { StreamRatchet } from '@bitblit/ratchet-common/dist/stream/stream-ratchet.js';
|
|
5
7
|
import { getSignedUrl } from '@aws-sdk/s3-request-presigner';
|
|
6
8
|
import { Upload } from '@aws-sdk/lib-storage';
|
|
7
|
-
import { StringRatchet } from '@bitblit/ratchet-common';
|
|
8
|
-
import { StreamRatchet } from '@bitblit/ratchet-common';
|
|
9
9
|
export class S3CacheRatchet {
|
|
10
|
+
s3;
|
|
11
|
+
defaultBucket;
|
|
10
12
|
constructor(s3, defaultBucket = null) {
|
|
11
13
|
this.s3 = s3;
|
|
12
14
|
this.defaultBucket = defaultBucket;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|