@bitblit/ratchet-aws 4.0.99-alpha → 4.0.103-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 → lib}/batch/aws-batch-background-processor.d.ts +1 -5
- package/{dist/es → lib}/batch/aws-batch-background-processor.js +6 -1
- package/lib/batch/aws-batch-background-processor.spec.js +15 -0
- package/{dist/types → lib}/batch/aws-batch-ratchet.d.ts +0 -3
- package/{dist/es → lib}/batch/aws-batch-ratchet.js +5 -1
- package/lib/batch/aws-batch-ratchet.spec.js +33 -0
- package/{dist/types → lib}/build/ratchet-aws-info.d.ts +1 -1
- package/{dist/types → lib}/cache/dynamo-db-storage-provider.d.ts +3 -3
- package/{dist/es → lib}/cache/dynamo-db-storage-provider.js +3 -1
- package/{dist/types → lib}/cache/s3-storage-provider.d.ts +3 -3
- package/{dist/es → lib}/cache/s3-storage-provider.js +4 -1
- package/{dist/types → lib}/cache/simple-cache-storage-provider.d.ts +1 -1
- package/{dist/types → lib}/cache/simple-cache.d.ts +3 -3
- package/{dist/es → lib}/cache/simple-cache.js +4 -2
- package/lib/cache/simple-cache.spec.js +67 -0
- package/{dist/es → lib}/cloudwatch/cloud-watch-log-group-ratchet.js +4 -2
- package/lib/cloudwatch/cloud-watch-log-group-ratchet.spec.js +19 -0
- package/{dist/es → lib}/cloudwatch/cloud-watch-logs-ratchet.js +6 -5
- package/lib/cloudwatch/cloud-watch-logs-ratchet.spec.js +84 -0
- package/{dist/types → lib}/cloudwatch/cloud-watch-metrics-ratchet.d.ts +3 -3
- package/{dist/es → lib}/cloudwatch/cloud-watch-metrics-ratchet.js +3 -2
- package/lib/cloudwatch/cloud-watch-metrics-ratchet.spec.js +23 -0
- package/{dist/types → lib}/daemon/daemon-like.d.ts +3 -3
- package/{dist/types → lib}/daemon/daemon-process-state-public-token.d.ts +1 -1
- package/{dist/types → lib}/daemon/daemon-util.d.ts +5 -11
- package/{dist/es → lib}/daemon/daemon-util.js +3 -3
- package/lib/daemon/daemon-util.spec.d.ts +4 -0
- package/lib/daemon/daemon-util.spec.js +79 -0
- package/{dist/types → lib}/daemon/daemon.d.ts +5 -5
- package/{dist/es → lib}/daemon/daemon.js +12 -6
- package/{dist/types → lib}/dao/prototype-dao-provider.d.ts +1 -1
- package/{dist/types → lib}/dao/prototype-dao.d.ts +2 -2
- package/{dist/es → lib}/dao/prototype-dao.js +13 -9
- package/lib/dao/prototype-dao.spec.d.ts +8 -0
- package/lib/dao/prototype-dao.spec.js +26 -0
- package/{dist/types → lib}/dao/s3-prototype-dao-provider.d.ts +3 -3
- package/{dist/es → lib}/dao/s3-prototype-dao-provider.js +3 -1
- package/{dist/types → lib}/dao/s3-simple-dao.d.ts +2 -2
- package/{dist/es → lib}/dao/s3-simple-dao.js +4 -2
- package/{dist/types → lib}/dynamodb/dynamo-ratchet-like.d.ts +3 -3
- package/{dist/types → lib}/dynamodb/dynamo-ratchet.d.ts +4 -4
- package/{dist/es → lib}/dynamodb/dynamo-ratchet.js +7 -6
- package/lib/dynamodb/dynamo-ratchet.spec.js +156 -0
- package/{dist/es → lib}/dynamodb/dynamo-table-ratchet.js +5 -4
- package/{dist/es → lib}/dynamodb/hash-spreader.js +8 -1
- package/lib/dynamodb/hash-spreader.spec.js +17 -0
- package/{dist/types → lib}/ec2/ec2-ratchet.d.ts +0 -11
- package/{dist/es → lib}/ec2/ec2-ratchet.js +7 -3
- package/lib/ec2/ec2-ratchet.spec.js +31 -0
- package/{dist/types → lib}/environment/cascade-environment-service-provider.d.ts +1 -4
- package/{dist/es → lib}/environment/cascade-environment-service-provider.js +3 -2
- package/{dist/types → lib}/environment/env-var-environment-service-provider.d.ts +1 -5
- package/{dist/es → lib}/environment/env-var-environment-service-provider.js +5 -4
- package/{dist/types → lib}/environment/environment-service-config.d.ts +0 -3
- package/lib/environment/environment-service-provider.d.ts +3 -0
- package/{dist/types → lib}/environment/environment-service.d.ts +2 -5
- package/{dist/es → lib}/environment/environment-service.js +13 -11
- package/lib/environment/environment-service.spec.js +22 -0
- package/{dist/types → lib}/environment/fixed-environment-service-provider.d.ts +1 -4
- package/{dist/es → lib}/environment/fixed-environment-service-provider.js +3 -2
- package/{dist/types → lib}/environment/s3-environment-service-provider.d.ts +1 -4
- package/{dist/es → lib}/environment/s3-environment-service-provider.js +7 -5
- package/{dist/types → lib}/environment/ssm-environment-service-provider.d.ts +1 -5
- package/{dist/es → lib}/environment/ssm-environment-service-provider.js +9 -6
- package/{dist/types → lib}/expiring-code/dynamo-expiring-code-provider.d.ts +4 -4
- package/{dist/es → lib}/expiring-code/dynamo-expiring-code-provider.js +2 -0
- package/{dist/types → lib}/expiring-code/expiring-code-provider.d.ts +1 -1
- package/{dist/types → lib}/expiring-code/expiring-code-ratchet.d.ts +3 -6
- package/{dist/es → lib}/expiring-code/expiring-code-ratchet.js +3 -2
- package/lib/expiring-code/expiring-code-ratchet.spec.js +7 -0
- package/{dist/types → lib}/expiring-code/s3-expiring-code-provider.d.ts +3 -3
- package/{dist/es → lib}/expiring-code/s3-expiring-code-provider.js +4 -1
- package/lib/expiring-code/s3-expiring-code-provider.spec.js +46 -0
- package/{dist/types → lib}/iam/aws-credentials-ratchet.d.ts +0 -5
- package/{dist/es → lib}/iam/aws-credentials-ratchet.js +2 -1
- package/{dist/es → lib}/lambda/lambda-event-type-guards.js +1 -1
- package/{dist/types → lib}/model/cloud-watch-metrics-minute-level-dynamo-count-request.d.ts +2 -2
- package/lib/model/dynamo/doc-put-item-command-input.js +1 -0
- package/lib/model/dynamo/doc-query-command-input.js +1 -0
- package/lib/model/dynamo/doc-scan-command-input.js +1 -0
- package/lib/model/dynamo/doc-update-item-command-input.js +1 -0
- package/{dist/es → lib}/route53/route-53-ratchet.js +3 -1
- package/{dist/types → lib}/runtime-parameter/cached-stored-runtime-parameter.d.ts +1 -1
- package/lib/runtime-parameter/cached-stored-runtime-parameter.js +1 -0
- package/{dist/types → lib}/runtime-parameter/dynamo-runtime-parameter-provider.d.ts +3 -3
- package/{dist/es → lib}/runtime-parameter/dynamo-runtime-parameter-provider.js +4 -2
- package/lib/runtime-parameter/dynamo-runtime-parameter-provider.spec.d.ts +1 -0
- package/lib/runtime-parameter/dynamo-runtime-parameter-provider.spec.js +49 -0
- package/{dist/types → lib}/runtime-parameter/global-variable-override-runtime-parameter-provider.d.ts +2 -9
- package/{dist/es → lib}/runtime-parameter/global-variable-override-runtime-parameter-provider.js +10 -8
- package/lib/runtime-parameter/global-variable-override-runtime-parameter-provider.spec.d.ts +1 -0
- package/lib/runtime-parameter/global-variable-override-runtime-parameter-provider.spec.js +37 -0
- package/{dist/types → lib}/runtime-parameter/memory-runtime-parameter-provider.d.ts +2 -6
- package/{dist/es → lib}/runtime-parameter/memory-runtime-parameter-provider.js +2 -1
- package/{dist/types → lib}/runtime-parameter/runtime-parameter-provider.d.ts +1 -6
- package/lib/runtime-parameter/runtime-parameter-provider.js +1 -0
- package/{dist/types → lib}/runtime-parameter/runtime-parameter-ratchet.d.ts +2 -2
- package/{dist/es → lib}/runtime-parameter/runtime-parameter-ratchet.js +4 -3
- package/lib/runtime-parameter/runtime-parameter-ratchet.spec.d.ts +1 -0
- package/lib/runtime-parameter/runtime-parameter-ratchet.spec.js +39 -0
- package/lib/runtime-parameter/stored-runtime-parameter.js +1 -0
- package/{dist/types → lib}/s3/s3-cache-ratchet.d.ts +3 -4
- package/{dist/es → lib}/s3/s3-cache-ratchet.js +7 -5
- package/lib/s3/s3-cache-ratchet.spec.d.ts +1 -0
- package/lib/s3/s3-cache-ratchet.spec.js +97 -0
- package/{dist/types → lib}/s3/s3-cache-to-local-disk-ratchet.d.ts +2 -5
- package/{dist/es → lib}/s3/s3-cache-to-local-disk-ratchet.js +8 -3
- package/lib/s3/s3-cache-to-local-dist-ratchet.spec.d.ts +1 -0
- package/lib/s3/s3-cache-to-local-dist-ratchet.spec.js +22 -0
- package/{dist/es → lib}/s3/s3-location-sync-ratchet.js +4 -1
- package/{dist/es → lib}/s3/s3-ratchet.js +1 -1
- package/lib/s3/s3-ratchet.spec.d.ts +1 -0
- package/lib/s3/s3-ratchet.spec.js +20 -0
- package/lib/ses/email-attachment.d.ts +5 -0
- package/lib/ses/email-attachment.js +1 -0
- package/{dist/types → lib}/ses/mailer-config.d.ts +2 -5
- package/lib/ses/mailer-config.js +1 -0
- package/{dist/types → lib}/ses/mailer-like.d.ts +2 -9
- package/lib/ses/mailer-like.js +1 -0
- package/{dist/types → lib}/ses/mailer.d.ts +4 -11
- package/{dist/es → lib}/ses/mailer.js +8 -6
- package/lib/ses/mailer.spec.d.ts +1 -0
- package/lib/ses/mailer.spec.js +104 -0
- package/{dist/types → lib}/ses/ratchet-template-renderer.d.ts +0 -4
- package/lib/ses/ratchet-template-renderer.js +1 -0
- package/lib/ses/ready-to-send-email.d.ts +13 -0
- package/lib/ses/ready-to-send-email.js +1 -0
- package/{dist/types → lib}/ses/remote-handlebars-template-renderer.d.ts +1 -3
- package/{dist/es → lib}/ses/remote-handlebars-template-renderer.js +6 -2
- package/lib/ses/resolved-ready-to-send-email.d.ts +5 -0
- package/lib/ses/resolved-ready-to-send-email.js +1 -0
- package/{dist/es → lib}/sns/sns-ratchet.js +4 -2
- package/lib/sns/sns-ratchet.spec.d.ts +1 -0
- package/lib/sns/sns-ratchet.spec.js +17 -0
- package/{dist/types → lib}/sync-lock/dynamo-db-sync-lock.d.ts +2 -2
- package/{dist/es → lib}/sync-lock/dynamo-db-sync-lock.js +5 -1
- package/lib/sync-lock/dynamo-db-sync-lock.spec.d.ts +1 -0
- package/lib/sync-lock/dynamo-db-sync-lock.spec.js +30 -0
- package/{dist/types → lib}/sync-lock/memory-sync-lock.d.ts +1 -4
- package/{dist/es → lib}/sync-lock/memory-sync-lock.js +3 -4
- package/lib/sync-lock/sync-lock-provider.js +1 -0
- package/package.json +11 -12
- 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 → lib/batch/aws-batch-background-processor.spec.d.ts} +0 -0
- /package/{dist/es/cache/simple-cache-read-options.js → lib/batch/aws-batch-ratchet.spec.d.ts} +0 -0
- /package/{dist/es → lib}/build/ratchet-aws-info.js +0 -0
- /package/{dist/types → lib}/cache/simple-cache-object-wrapper.d.ts +0 -0
- /package/{dist/es/cache/simple-cache-storage-provider.js → lib/cache/simple-cache-object-wrapper.js} +0 -0
- /package/{dist/types → lib}/cache/simple-cache-read-options.d.ts +0 -0
- /package/{dist/es/daemon/daemon-like.js → lib/cache/simple-cache-read-options.js} +0 -0
- /package/{dist/es/daemon/daemon-process-create-options.js → lib/cache/simple-cache-storage-provider.js} +0 -0
- /package/{dist/es/daemon/daemon-process-state-public-token.js → lib/cache/simple-cache.spec.d.ts} +0 -0
- /package/{dist/types → lib}/cloudwatch/cloud-watch-log-group-ratchet.d.ts +0 -0
- /package/{dist/es/daemon/daemon-process-state.js → lib/cloudwatch/cloud-watch-log-group-ratchet.spec.d.ts} +0 -0
- /package/{dist/types → lib}/cloudwatch/cloud-watch-logs-ratchet.d.ts +0 -0
- /package/{dist/es/dao/prototype-dao-config.js → lib/cloudwatch/cloud-watch-logs-ratchet.spec.d.ts} +0 -0
- /package/{dist/es/dao/prototype-dao-db.js → lib/cloudwatch/cloud-watch-metrics-ratchet.spec.d.ts} +0 -0
- /package/{dist/es/dao/prototype-dao-provider.js → lib/daemon/daemon-like.js} +0 -0
- /package/{dist/types → lib}/daemon/daemon-process-create-options.d.ts +0 -0
- /package/{dist/es/dao/simple-dao-item.js → lib/daemon/daemon-process-create-options.js} +0 -0
- /package/{dist/es/dynamodb/dynamo-ratchet-like.js → lib/daemon/daemon-process-state-public-token.js} +0 -0
- /package/{dist/types → lib}/daemon/daemon-process-state.d.ts +0 -0
- /package/{dist/es/environment/environment-service-config.js → lib/daemon/daemon-process-state.js} +0 -0
- /package/{dist/types → lib}/dao/prototype-dao-config.d.ts +0 -0
- /package/{dist/es/environment/environment-service-provider.js → lib/dao/prototype-dao-config.js} +0 -0
- /package/{dist/types → lib}/dao/prototype-dao-db.d.ts +0 -0
- /package/{dist/es/expiring-code/expiring-code-params.js → lib/dao/prototype-dao-db.js} +0 -0
- /package/{dist/es/expiring-code/expiring-code-provider.js → lib/dao/prototype-dao-provider.js} +0 -0
- /package/{dist/types → lib}/dao/simple-dao-item.d.ts +0 -0
- /package/{dist/es/expiring-code/expiring-code.js → lib/dao/simple-dao-item.js} +0 -0
- /package/{dist/es/model/cloud-watch-metrics-minute-level-dynamo-count-request.js → lib/dynamodb/dynamo-ratchet-like.js} +0 -0
- /package/{dist/es/model/dynamo-count-result.js → lib/dynamodb/dynamo-ratchet.spec.d.ts} +0 -0
- /package/{dist/types → lib}/dynamodb/dynamo-table-ratchet.d.ts +0 -0
- /package/{dist/types → lib}/dynamodb/hash-spreader.d.ts +0 -0
- /package/{dist/es/model/dynamo/doc-put-item-command-input.js → lib/dynamodb/hash-spreader.spec.d.ts} +0 -0
- /package/{dist/es/model/dynamo/doc-query-command-input.js → lib/ec2/ec2-ratchet.spec.d.ts} +0 -0
- /package/{dist/es/model/dynamo/doc-scan-command-input.js → lib/environment/environment-service-config.js} +0 -0
- /package/{dist/es/model/dynamo/doc-update-item-command-input.js → lib/environment/environment-service-provider.js} +0 -0
- /package/{dist/es/runtime-parameter/cached-stored-runtime-parameter.js → lib/environment/environment-service.spec.d.ts} +0 -0
- /package/{dist/types → lib}/expiring-code/expiring-code-params.d.ts +0 -0
- /package/{dist/es/runtime-parameter/runtime-parameter-provider.js → lib/expiring-code/expiring-code-params.js} +0 -0
- /package/{dist/es/runtime-parameter/stored-runtime-parameter.js → lib/expiring-code/expiring-code-provider.js} +0 -0
- /package/{dist/es/ses/email-attachment.js → lib/expiring-code/expiring-code-ratchet.spec.d.ts} +0 -0
- /package/{dist/types → lib}/expiring-code/expiring-code.d.ts +0 -0
- /package/{dist/es/ses/mailer-config.js → lib/expiring-code/expiring-code.js} +0 -0
- /package/{dist/es/ses/mailer-like.js → lib/expiring-code/s3-expiring-code-provider.spec.d.ts} +0 -0
- /package/{dist/es/ses/ratchet-template-renderer.js → lib/index.d.ts} +0 -0
- /package/{dist/es/ses/ready-to-send-email.js → lib/index.js} +0 -0
- /package/{dist/types → lib}/lambda/lambda-event-detector.d.ts +0 -0
- /package/{dist/es → lib}/lambda/lambda-event-detector.js +0 -0
- /package/{dist/types → lib}/lambda/lambda-event-type-guards.d.ts +0 -0
- /package/{dist/es/ses/resolved-ready-to-send-email.js → lib/model/cloud-watch-metrics-minute-level-dynamo-count-request.js} +0 -0
- /package/{dist/types → lib}/model/cloud-watch-metrics-unit.d.ts +0 -0
- /package/{dist/es → lib}/model/cloud-watch-metrics-unit.js +0 -0
- /package/{dist/types → lib}/model/dynamo/doc-put-item-command-input.d.ts +0 -0
- /package/{dist/types → lib}/model/dynamo/doc-query-command-input.d.ts +0 -0
- /package/{dist/types → lib}/model/dynamo/doc-scan-command-input.d.ts +0 -0
- /package/{dist/types → lib}/model/dynamo/doc-update-item-command-input.d.ts +0 -0
- /package/{dist/types → lib}/model/dynamo-count-result.d.ts +0 -0
- /package/{dist/es/sync-lock/sync-lock-provider.js → lib/model/dynamo-count-result.js} +0 -0
- /package/{dist/types → lib}/route53/route-53-ratchet.d.ts +0 -0
- /package/{dist/types → lib}/runtime-parameter/stored-runtime-parameter.d.ts +0 -0
- /package/{dist/types → lib}/s3/s3-location-sync-ratchet.d.ts +0 -0
- /package/{dist/types → lib}/s3/s3-ratchet.d.ts +0 -0
- /package/{dist/types → lib}/sns/sns-ratchet.d.ts +0 -0
- /package/{dist/types → lib}/sync-lock/sync-lock-provider.d.ts +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PrototypeDaoProvider } from './prototype-dao-provider';
|
|
2
|
-
import { PrototypeDaoConfig } from './prototype-dao-config';
|
|
1
|
+
import { PrototypeDaoProvider } from './prototype-dao-provider.js';
|
|
2
|
+
import { PrototypeDaoConfig } from './prototype-dao-config.js';
|
|
3
3
|
export declare class PrototypeDao<T> {
|
|
4
4
|
private provider;
|
|
5
5
|
private cfg;
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RequireRatchet } from '@bitblit/ratchet-common/lib/lang/require-ratchet.js';
|
|
2
|
+
import { StringRatchet } from '@bitblit/ratchet-common/lib/lang/string-ratchet.js';
|
|
3
|
+
import { MapRatchet } from '@bitblit/ratchet-common/lib/lang/map-ratchet.js';
|
|
2
4
|
import { DateTime } from 'luxon';
|
|
3
5
|
export class PrototypeDao {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
this.cfg = cfg;
|
|
7
|
-
RequireRatchet.notNullOrUndefined(provider, 'provider');
|
|
8
|
-
RequireRatchet.notNullOrUndefined(cfg, 'cfg');
|
|
9
|
-
RequireRatchet.notNullOrUndefined(cfg.guidCreateFunction, 'cfg.guidCreateFunction');
|
|
10
|
-
RequireRatchet.notNullOrUndefined(cfg.guidFieldName, 'cfg.guidFieldName');
|
|
11
|
-
}
|
|
6
|
+
provider;
|
|
7
|
+
cfg;
|
|
12
8
|
static defaultDaoConfig() {
|
|
13
9
|
return {
|
|
14
10
|
guidCreateFunction: StringRatchet.createType4Guid,
|
|
@@ -19,6 +15,14 @@ export class PrototypeDao {
|
|
|
19
15
|
updatedUtcTimestampFieldName: null,
|
|
20
16
|
};
|
|
21
17
|
}
|
|
18
|
+
constructor(provider, cfg = PrototypeDao.defaultDaoConfig()) {
|
|
19
|
+
this.provider = provider;
|
|
20
|
+
this.cfg = cfg;
|
|
21
|
+
RequireRatchet.notNullOrUndefined(provider, 'provider');
|
|
22
|
+
RequireRatchet.notNullOrUndefined(cfg, 'cfg');
|
|
23
|
+
RequireRatchet.notNullOrUndefined(cfg.guidCreateFunction, 'cfg.guidCreateFunction');
|
|
24
|
+
RequireRatchet.notNullOrUndefined(cfg.guidFieldName, 'cfg.guidFieldName');
|
|
25
|
+
}
|
|
22
26
|
async fetchAll() {
|
|
23
27
|
const db = await this.provider.loadDatabase();
|
|
24
28
|
return db.items || [];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { PrototypeDao } from './prototype-dao.js';
|
|
2
|
+
import { S3PrototypeDaoProvider } from './s3-prototype-dao-provider.js';
|
|
3
|
+
import { S3CacheRatchet } from '../s3/s3-cache-ratchet.js';
|
|
4
|
+
import { S3Client } from '@aws-sdk/client-s3';
|
|
5
|
+
describe('#PrototypeDao', () => {
|
|
6
|
+
xit('Should save/load files', async () => {
|
|
7
|
+
const svc = new PrototypeDao(new S3PrototypeDaoProvider(new S3CacheRatchet(new S3Client({}), 'some-bucket'), 'test-data.json'));
|
|
8
|
+
await svc.resetDatabase();
|
|
9
|
+
await svc.store({ fieldA: 1, fieldB: 'test1', type: 'a' });
|
|
10
|
+
await svc.store({ fieldA: 2, fieldB: 'test2', type: 'a' });
|
|
11
|
+
await svc.store({ fieldA: 2, fieldB: 'test3', type: 'b' });
|
|
12
|
+
await svc.store({ guid: 'forceGuid', fieldA: 4, fieldB: 'test4', type: 'c' });
|
|
13
|
+
const test1 = await svc.fetchAll();
|
|
14
|
+
expect(test1.length).toBe(4);
|
|
15
|
+
const test2 = await svc.fetchById('forceGuid');
|
|
16
|
+
expect(test2).not.toBeNull();
|
|
17
|
+
expect(test2.createdEpochMS).not.toBeNull();
|
|
18
|
+
expect(test2.updatedEpochMS).not.toBeNull();
|
|
19
|
+
const test3 = await svc.searchByField('fieldA', 4);
|
|
20
|
+
expect(test3.length).toBe(1);
|
|
21
|
+
expect(test3[0].guid).toEqual('forceGuid');
|
|
22
|
+
const test4 = await svc.searchByFieldMap({ type: 'a', fieldA: 2 });
|
|
23
|
+
expect(test4.length).toBe(1);
|
|
24
|
+
await svc.resetDatabase();
|
|
25
|
+
}, 300_000);
|
|
26
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { S3CacheRatchet } from '../s3/s3-cache-ratchet';
|
|
2
|
-
import { PrototypeDaoProvider } from './prototype-dao-provider';
|
|
3
|
-
import { PrototypeDaoDb } from './prototype-dao-db';
|
|
1
|
+
import { S3CacheRatchet } from '../s3/s3-cache-ratchet.js';
|
|
2
|
+
import { PrototypeDaoProvider } from './prototype-dao-provider.js';
|
|
3
|
+
import { PrototypeDaoDb } from './prototype-dao-db.js';
|
|
4
4
|
export declare class S3PrototypeDaoProvider<T> implements PrototypeDaoProvider<T> {
|
|
5
5
|
private s3CacheRatchet;
|
|
6
6
|
private keyName;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { RequireRatchet } from '@bitblit/ratchet-common';
|
|
1
|
+
import { RequireRatchet } from '@bitblit/ratchet-common/lib/lang/require-ratchet.js';
|
|
2
2
|
export class S3PrototypeDaoProvider {
|
|
3
|
+
s3CacheRatchet;
|
|
4
|
+
keyName;
|
|
3
5
|
constructor(s3CacheRatchet, keyName) {
|
|
4
6
|
this.s3CacheRatchet = s3CacheRatchet;
|
|
5
7
|
this.keyName = keyName;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S3CacheRatchet } from '../s3/s3-cache-ratchet';
|
|
2
|
-
import { SimpleDaoItem } from './simple-dao-item';
|
|
1
|
+
import { S3CacheRatchet } from '../s3/s3-cache-ratchet.js';
|
|
2
|
+
import { SimpleDaoItem } from './simple-dao-item.js';
|
|
3
3
|
export declare class S3SimpleDao<T extends SimpleDaoItem> {
|
|
4
4
|
private cache;
|
|
5
5
|
private prefix?;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { Logger } from '@bitblit/ratchet-common';
|
|
2
|
-
import { StringRatchet } from '@bitblit/ratchet-common';
|
|
1
|
+
import { Logger } from '@bitblit/ratchet-common/lib/logger/logger.js';
|
|
2
|
+
import { StringRatchet } from '@bitblit/ratchet-common/lib/lang/string-ratchet.js';
|
|
3
3
|
export class S3SimpleDao {
|
|
4
|
+
cache;
|
|
5
|
+
prefix;
|
|
4
6
|
constructor(cache, prefix) {
|
|
5
7
|
this.cache = cache;
|
|
6
8
|
this.prefix = prefix;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { DynamoCountResult } from '../model/dynamo-count-result';
|
|
1
|
+
import { DynamoCountResult } from '../model/dynamo-count-result.js';
|
|
2
2
|
import { DynamoDBDocumentClient } from '@aws-sdk/lib-dynamodb';
|
|
3
3
|
import { DeleteItemCommandOutput, PutItemOutput } from '@aws-sdk/client-dynamodb';
|
|
4
|
-
import { DocQueryCommandInput } from '../model/dynamo/doc-query-command-input';
|
|
5
|
-
import { DocScanCommandInput } from '../model/dynamo/doc-scan-command-input';
|
|
4
|
+
import { DocQueryCommandInput } from '../model/dynamo/doc-query-command-input.js';
|
|
5
|
+
import { DocScanCommandInput } from '../model/dynamo/doc-scan-command-input.js';
|
|
6
6
|
export interface DynamoRatchetLike {
|
|
7
7
|
getDDB(): DynamoDBDocumentClient;
|
|
8
8
|
tableIsEmpty(tableName: string): Promise<boolean>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { DynamoDBDocumentClient } from '@aws-sdk/lib-dynamodb';
|
|
2
|
-
import { DynamoCountResult } from '../model/dynamo-count-result';
|
|
3
|
-
import { DynamoRatchetLike } from './dynamo-ratchet-like';
|
|
2
|
+
import { DynamoCountResult } from '../model/dynamo-count-result.js';
|
|
3
|
+
import { DynamoRatchetLike } from './dynamo-ratchet-like.js';
|
|
4
4
|
import { DeleteItemCommandOutput, PutItemCommandOutput, QueryCommandOutput, ScanCommandOutput } from '@aws-sdk/client-dynamodb';
|
|
5
|
-
import { DocScanCommandInput } from '../model/dynamo/doc-scan-command-input';
|
|
6
|
-
import { DocQueryCommandInput } from '../model/dynamo/doc-query-command-input';
|
|
5
|
+
import { DocScanCommandInput } from '../model/dynamo/doc-scan-command-input.js';
|
|
6
|
+
import { DocQueryCommandInput } from '../model/dynamo/doc-query-command-input.js';
|
|
7
7
|
export declare class DynamoRatchet implements DynamoRatchetLike {
|
|
8
8
|
private awsDDB;
|
|
9
9
|
constructor(awsDDB: DynamoDBDocumentClient);
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { BatchGetCommand, BatchWriteCommand, DeleteCommand, GetCommand, PutCommand, QueryCommand, ScanCommand, } from '@aws-sdk/lib-dynamodb';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
2
|
+
import { ErrorRatchet } from '@bitblit/ratchet-common/lib/lang/error-ratchet.js';
|
|
3
|
+
import { Logger } from '@bitblit/ratchet-common/lib/logger/logger.js';
|
|
4
|
+
import { RequireRatchet } from '@bitblit/ratchet-common/lib/lang/require-ratchet.js';
|
|
5
|
+
import { PromiseRatchet } from '@bitblit/ratchet-common/lib/lang/promise-ratchet.js';
|
|
6
|
+
import { DurationRatchet } from '@bitblit/ratchet-common/lib/lang/duration-ratchet.js';
|
|
7
|
+
import { NumberRatchet } from '@bitblit/ratchet-common/lib/lang/number-ratchet.js';
|
|
8
8
|
import { UpdateItemCommand, } from '@aws-sdk/client-dynamodb';
|
|
9
9
|
export class DynamoRatchet {
|
|
10
|
+
awsDDB;
|
|
10
11
|
constructor(awsDDB) {
|
|
11
12
|
this.awsDDB = awsDDB;
|
|
12
13
|
if (!awsDDB) {
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { DynamoRatchet } from './dynamo-ratchet.js';
|
|
2
|
+
import { Logger } from '@bitblit/ratchet-common/lib/logger/logger.js';
|
|
3
|
+
import { LoggerLevelName } from '@bitblit/ratchet-common/lib/logger/logger-level-name.js';
|
|
4
|
+
import { DynamoDBDocumentClient } from '@aws-sdk/lib-dynamodb';
|
|
5
|
+
import { mockClient } from 'aws-sdk-client-mock';
|
|
6
|
+
let mockDynamo;
|
|
7
|
+
describe('#dynamoRatchet', function () {
|
|
8
|
+
mockDynamo = mockClient(DynamoDBDocumentClient);
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
mockDynamo.reset();
|
|
11
|
+
});
|
|
12
|
+
xit('should handle ProvisionedThroughputExceeded exceptions', async () => {
|
|
13
|
+
const dr = new DynamoRatchet(mockDynamo);
|
|
14
|
+
let row = 0;
|
|
15
|
+
const scan = {
|
|
16
|
+
TableName: 'cache-device-data',
|
|
17
|
+
ProjectionExpression: 'compositeKey',
|
|
18
|
+
};
|
|
19
|
+
Logger.info('Starting scan');
|
|
20
|
+
const cnt = await dr.fullyExecuteProcessOverScan(scan, async (ob) => {
|
|
21
|
+
if (row % 100 === 0) {
|
|
22
|
+
Logger.info('Row : %d : %j', row, ob);
|
|
23
|
+
}
|
|
24
|
+
row++;
|
|
25
|
+
});
|
|
26
|
+
Logger.info('Count was : %d', cnt);
|
|
27
|
+
}, 300_000_000);
|
|
28
|
+
xit('should only write if a field is null', async () => {
|
|
29
|
+
const dr = new DynamoRatchet(mockDynamo);
|
|
30
|
+
const tableName = 'some-table';
|
|
31
|
+
const test1 = { lockingKey: 'aaa', xx: null };
|
|
32
|
+
await dr.simplePut(tableName, test1);
|
|
33
|
+
const test2 = { lockingKey: 'aaa', xx: 5 };
|
|
34
|
+
const val1 = await dr.simplePutOnlyIfFieldIsNullOrUndefined(tableName, test2, 'xx');
|
|
35
|
+
expect(val1).toBeTruthy();
|
|
36
|
+
const test3 = { lockingKey: 'aaa', xx: 7 };
|
|
37
|
+
const val2 = await dr.simplePutOnlyIfFieldIsNullOrUndefined(tableName, test3, 'xx');
|
|
38
|
+
expect(val2).toBeFalsy();
|
|
39
|
+
});
|
|
40
|
+
xit('should fetch items from a key-only index query', async () => {
|
|
41
|
+
const dr = new DynamoRatchet(mockDynamo);
|
|
42
|
+
const tableName = 'some-table';
|
|
43
|
+
const limit = 200;
|
|
44
|
+
const qry = {
|
|
45
|
+
TableName: tableName,
|
|
46
|
+
IndexName: 'purchaseId-notBeforeEpochMS-index',
|
|
47
|
+
KeyConditionExpression: 'purchaseId = :purchaseId',
|
|
48
|
+
Limit: limit,
|
|
49
|
+
ExpressionAttributeValues: {
|
|
50
|
+
':purchaseId': 'some-purchase',
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
const res = await dr.fetchFullObjectsMatchingKeysOnlyIndexQuery(qry, ['key1', 'key2']);
|
|
54
|
+
Logger.info('Got : %s', res);
|
|
55
|
+
expect(res).toBeTruthy();
|
|
56
|
+
});
|
|
57
|
+
xit('should increment the counter and return the new value', async () => {
|
|
58
|
+
const dr = new DynamoRatchet(mockDynamo);
|
|
59
|
+
const tableName = 'xxx';
|
|
60
|
+
const res = await dr.atomicCounter(tableName, { groupId: 'global', unitId: 'sequence' }, 'lastValue', 1);
|
|
61
|
+
Logger.info('Got : %s', res);
|
|
62
|
+
expect(res).toBeTruthy();
|
|
63
|
+
});
|
|
64
|
+
xit('should stop after the soft limit', async () => {
|
|
65
|
+
const dr = new DynamoRatchet(mockDynamo);
|
|
66
|
+
const now = new Date().getTime();
|
|
67
|
+
const nowSec = Math.floor(now / 1000);
|
|
68
|
+
const curHash = 'someHash';
|
|
69
|
+
const qry = {
|
|
70
|
+
TableName: 'some-table',
|
|
71
|
+
KeyConditionExpression: 'hashVal = :hashVal',
|
|
72
|
+
ExpressionAttributeValues: {
|
|
73
|
+
':hashVal': curHash,
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
const res = await dr.fullyExecuteQuery(qry, null, 150);
|
|
77
|
+
Logger.info('Got : %s', res);
|
|
78
|
+
expect(res).toBeTruthy();
|
|
79
|
+
}, 300_000);
|
|
80
|
+
xit('should run an insert / read test for slowdown', async () => {
|
|
81
|
+
const dr = new DynamoRatchet(mockDynamo);
|
|
82
|
+
Logger.setLevel(LoggerLevelName.debug);
|
|
83
|
+
const now = new Date().getTime();
|
|
84
|
+
const nowSec = Math.floor(now / 1000);
|
|
85
|
+
const nums = [];
|
|
86
|
+
for (let i = 0; i < 300; i++) {
|
|
87
|
+
const toWrite = {
|
|
88
|
+
id: 'CW_DDB_TEST',
|
|
89
|
+
data: 'SOME DATA',
|
|
90
|
+
numData: i,
|
|
91
|
+
};
|
|
92
|
+
nums.push(toWrite);
|
|
93
|
+
}
|
|
94
|
+
Logger.info('About to start');
|
|
95
|
+
const writeProms = nums.map((n) => dr.simplePut('some-table', n));
|
|
96
|
+
const writeOut = await Promise.all(writeProms);
|
|
97
|
+
Logger.info('Write : %j', writeOut);
|
|
98
|
+
const readProms = [];
|
|
99
|
+
Logger.info('Start : %d', new Date().getTime());
|
|
100
|
+
for (let i = 0; i < 10000; i++) {
|
|
101
|
+
readProms.push(dr.simpleGet('some-table', { id: 'CW_DDB_TEST' }));
|
|
102
|
+
}
|
|
103
|
+
Logger.info('Mid : %d', new Date().getTime());
|
|
104
|
+
const readOut = await Promise.all(readProms);
|
|
105
|
+
Logger.info('Read : %d : %j', new Date().getTime(), readOut);
|
|
106
|
+
});
|
|
107
|
+
xit('should run a collision test', async () => {
|
|
108
|
+
const dr = new DynamoRatchet(mockDynamo);
|
|
109
|
+
Logger.setLevel(LoggerLevelName.debug);
|
|
110
|
+
const val = {
|
|
111
|
+
k1: 'abc',
|
|
112
|
+
k2: 1,
|
|
113
|
+
};
|
|
114
|
+
for (let i = 0; i < 5; i++) {
|
|
115
|
+
const rval = await dr.simplePutWithCollisionAvoidance('cwtest', val, ['k1', 'k2'], (v) => {
|
|
116
|
+
v.k2++;
|
|
117
|
+
return v;
|
|
118
|
+
}, null, 3);
|
|
119
|
+
Logger.info('output was : %j', rval);
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
xit('should do a simple get with counter decrement', async () => {
|
|
123
|
+
const dr = new DynamoRatchet(mockDynamo);
|
|
124
|
+
Logger.setLevel(LoggerLevelName.debug);
|
|
125
|
+
const v = await dr.simpleGetWithCounterDecrement('cwtest', { k1: 'abc', k2: 11 }, 'counter', true);
|
|
126
|
+
Logger.info('Got : %j', v);
|
|
127
|
+
});
|
|
128
|
+
xit('should do a full query', async () => {
|
|
129
|
+
const dr = new DynamoRatchet(mockDynamo);
|
|
130
|
+
Logger.setLevel(LoggerLevelName.debug);
|
|
131
|
+
const input = {
|
|
132
|
+
TableName: 'some-table',
|
|
133
|
+
KeyConditionExpression: 'groupId = :g',
|
|
134
|
+
ExpressionAttributeValues: {
|
|
135
|
+
':g': 'NeonBatch',
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
const res = await dr.fullyExecuteQuery(input);
|
|
139
|
+
Logger.info('Got : %j', res);
|
|
140
|
+
});
|
|
141
|
+
xit('should do a process over full query', async () => {
|
|
142
|
+
const dr = new DynamoRatchet(mockDynamo);
|
|
143
|
+
Logger.setLevel(LoggerLevelName.debug);
|
|
144
|
+
const input = {
|
|
145
|
+
TableName: 'some-table',
|
|
146
|
+
KeyConditionExpression: 'groupId = :g',
|
|
147
|
+
ExpressionAttributeValues: {
|
|
148
|
+
':g': 'NeonBatch',
|
|
149
|
+
},
|
|
150
|
+
};
|
|
151
|
+
const res = await dr.fullyExecuteProcessOverQuery(input, async (v) => {
|
|
152
|
+
Logger.info('Proc %j', v);
|
|
153
|
+
});
|
|
154
|
+
Logger.info('Got : %j', res);
|
|
155
|
+
});
|
|
156
|
+
});
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { CreateTableCommand, DeleteTableCommand, DescribeTableCommand, } from '@aws-sdk/client-dynamodb';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { ErrorRatchet } from '@bitblit/ratchet-common/lib/lang/error-ratchet.js';
|
|
3
|
+
import { Logger } from '@bitblit/ratchet-common/lib/logger/logger.js';
|
|
4
|
+
import { RequireRatchet } from '@bitblit/ratchet-common/lib/lang/require-ratchet.js';
|
|
5
|
+
import { PromiseRatchet } from '@bitblit/ratchet-common/lib/lang/promise-ratchet.js';
|
|
6
6
|
export class DynamoTableRatchet {
|
|
7
|
+
awsDDB;
|
|
7
8
|
constructor(awsDDB) {
|
|
8
9
|
this.awsDDB = awsDDB;
|
|
9
10
|
if (!awsDDB) {
|
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
import { ErrorRatchet
|
|
1
|
+
import { ErrorRatchet } from '@bitblit/ratchet-common/lib/lang/error-ratchet.js';
|
|
2
|
+
import { RequireRatchet } from '@bitblit/ratchet-common/lib/lang/require-ratchet.js';
|
|
3
|
+
import { StringRatchet } from '@bitblit/ratchet-common/lib/lang/string-ratchet.js';
|
|
2
4
|
export class HashSpreader {
|
|
5
|
+
spots;
|
|
6
|
+
buckets;
|
|
7
|
+
separator;
|
|
8
|
+
alphabet;
|
|
9
|
+
_allSlots;
|
|
3
10
|
constructor(spots = 3, buckets = 16, separator = '_', alphabet = '0123456789ABCDEF') {
|
|
4
11
|
this.spots = spots;
|
|
5
12
|
this.buckets = buckets;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { HashSpreader } from './hash-spreader.js';
|
|
2
|
+
describe('#hashSpreader', function () {
|
|
3
|
+
it('should enumerate spread', async () => {
|
|
4
|
+
const spread = new HashSpreader(3, 16);
|
|
5
|
+
expect(spread.allBuckets.length).toEqual(16);
|
|
6
|
+
const spread2 = new HashSpreader(3, 19);
|
|
7
|
+
expect(spread2.allBuckets.length).toEqual(19);
|
|
8
|
+
});
|
|
9
|
+
it('should spread1', async () => {
|
|
10
|
+
const spread = new HashSpreader(3, 16);
|
|
11
|
+
expect(spread.allSpreadValues('x').length).toEqual(16);
|
|
12
|
+
});
|
|
13
|
+
it('should spread multi', async () => {
|
|
14
|
+
const spread = new HashSpreader(3, 16);
|
|
15
|
+
expect(spread.allSpreadValuesForArray(['x', 'y']).length).toEqual(32);
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -1,16 +1,5 @@
|
|
|
1
1
|
import { Instance } from '@aws-sdk/client-ec2';
|
|
2
2
|
import { SendSSHPublicKeyCommandOutput } from '@aws-sdk/client-ec2-instance-connect';
|
|
3
|
-
/**
|
|
4
|
-
* Service to simplify interacting with EC2 instances
|
|
5
|
-
*
|
|
6
|
-
* NOTE! If you are going to describe instances, you MUST use resource: '*' in your
|
|
7
|
-
* IAM priv - any other value will fail. See
|
|
8
|
-
* https://forums.aws.amazon.com/thread.jspa?threadID=142312 and
|
|
9
|
-
* https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-policies-for-amazon-ec2.html
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* Really should combine start and stop below
|
|
13
|
-
*/
|
|
14
3
|
export declare class Ec2Ratchet {
|
|
15
4
|
private region;
|
|
16
5
|
private availabilityZone;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { DescribeInstancesCommand, EC2Client, StartInstancesCommand, StopInstancesCommand, } from '@aws-sdk/client-ec2';
|
|
2
2
|
import { EC2InstanceConnectClient, SendSSHPublicKeyCommand, } from '@aws-sdk/client-ec2-instance-connect';
|
|
3
|
-
import { Logger } from '@bitblit/ratchet-common';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { Logger } from '@bitblit/ratchet-common/lib/logger/logger.js';
|
|
4
|
+
import { PromiseRatchet } from '@bitblit/ratchet-common/lib/lang/promise-ratchet.js';
|
|
5
|
+
import { DurationRatchet } from '@bitblit/ratchet-common/lib/lang/duration-ratchet.js';
|
|
6
6
|
export class Ec2Ratchet {
|
|
7
|
+
region;
|
|
8
|
+
availabilityZone;
|
|
9
|
+
ec2;
|
|
10
|
+
ec2InstanceConnect;
|
|
7
11
|
constructor(region = 'us-east-1', availabilityZone = 'us-east-1a') {
|
|
8
12
|
this.region = region;
|
|
9
13
|
this.availabilityZone = availabilityZone;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import os from 'os';
|
|
4
|
+
import { Logger } from '@bitblit/ratchet-common/lib/logger/logger.js';
|
|
5
|
+
import { Ec2Ratchet } from './ec2-ratchet.js';
|
|
6
|
+
describe('#EC2Ratchet', function () {
|
|
7
|
+
xit('should send a public key', async () => {
|
|
8
|
+
const ratchet = new Ec2Ratchet();
|
|
9
|
+
const instId = 'i-replace_me';
|
|
10
|
+
const pubKey = fs.readFileSync(path.join(os.homedir(), '.ssh/id_rsa.pub')).toString();
|
|
11
|
+
const res = await ratchet.sendPublicKeyToEc2Instance(instId, pubKey);
|
|
12
|
+
Logger.info('Got : %j', res);
|
|
13
|
+
expect(res).toBeTruthy();
|
|
14
|
+
});
|
|
15
|
+
xit('should list instances', async () => {
|
|
16
|
+
const ratchet = new Ec2Ratchet();
|
|
17
|
+
const res = await ratchet.listAllInstances();
|
|
18
|
+
Logger.info('Got : %j', res);
|
|
19
|
+
expect(res).toBeTruthy();
|
|
20
|
+
expect(res.length).toBeGreaterThan(1);
|
|
21
|
+
});
|
|
22
|
+
xit('should start and stop an instance', async () => {
|
|
23
|
+
const ratchet = new Ec2Ratchet();
|
|
24
|
+
const instId = 'i-replace_me';
|
|
25
|
+
Logger.info('First start');
|
|
26
|
+
await ratchet.launchInstance(instId, 1000 * 60);
|
|
27
|
+
Logger.info('Next stop');
|
|
28
|
+
await ratchet.stopInstance(instId, 1000 * 60);
|
|
29
|
+
Logger.info('Complete');
|
|
30
|
+
});
|
|
31
|
+
});
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import { EnvironmentServiceProvider } from './environment-service-provider';
|
|
2
|
-
/**
|
|
3
|
-
* Reads a series of providers, returning the first non-null, non-error
|
|
4
|
-
*/
|
|
1
|
+
import { EnvironmentServiceProvider } from './environment-service-provider.js';
|
|
5
2
|
export declare class CascadeEnvironmentServiceProvider<T> implements EnvironmentServiceProvider<T> {
|
|
6
3
|
private providers;
|
|
7
4
|
constructor(providers: EnvironmentServiceProvider<T>[]);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { Logger } from '@bitblit/ratchet-common';
|
|
2
|
-
import { RequireRatchet } from '@bitblit/ratchet-common';
|
|
1
|
+
import { Logger } from '@bitblit/ratchet-common/lib/logger/logger.js';
|
|
2
|
+
import { RequireRatchet } from '@bitblit/ratchet-common/lib/lang/require-ratchet.js';
|
|
3
3
|
export class CascadeEnvironmentServiceProvider {
|
|
4
|
+
providers;
|
|
4
5
|
constructor(providers) {
|
|
5
6
|
this.providers = providers;
|
|
6
7
|
RequireRatchet.notNullOrUndefined(providers);
|
|
@@ -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 servicess
|
|
5
|
-
*/
|
|
1
|
+
import { EnvironmentServiceProvider } from './environment-service-provider.js';
|
|
6
2
|
export declare class EnvVarEnvironmentServiceProvider<T> implements EnvironmentServiceProvider<T> {
|
|
7
3
|
private envVarName;
|
|
8
4
|
constructor(envVarName: string);
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { StringRatchet } from '@bitblit/ratchet-common';
|
|
1
|
+
import { ErrorRatchet } from '@bitblit/ratchet-common/lib/lang/error-ratchet.js';
|
|
2
|
+
import { Logger } from '@bitblit/ratchet-common/lib/logger/logger.js';
|
|
3
|
+
import { RequireRatchet } from '@bitblit/ratchet-common/lib/lang/require-ratchet.js';
|
|
4
|
+
import { StringRatchet } from '@bitblit/ratchet-common/lib/lang/string-ratchet.js';
|
|
5
5
|
export class EnvVarEnvironmentServiceProvider {
|
|
6
|
+
envVarName;
|
|
6
7
|
constructor(envVarName) {
|
|
7
8
|
this.envVarName = envVarName;
|
|
8
9
|
RequireRatchet.notNullOrUndefined(envVarName);
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import { EnvironmentServiceProvider } from './environment-service-provider';
|
|
2
|
-
import { EnvironmentServiceConfig } from './environment-service-config';
|
|
3
|
-
/**
|
|
4
|
-
* Wraps up a EnvironmentServiceProvider and provides caching and retry-on-failure logic
|
|
5
|
-
*/
|
|
1
|
+
import { EnvironmentServiceProvider } from './environment-service-provider.js';
|
|
2
|
+
import { EnvironmentServiceConfig } from './environment-service-config.js';
|
|
6
3
|
export declare class EnvironmentService<T> {
|
|
7
4
|
private provider;
|
|
8
5
|
private cfg;
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { RequireRatchet } from '@bitblit/ratchet-common';
|
|
4
|
-
import {
|
|
1
|
+
import { ErrorRatchet } from '@bitblit/ratchet-common/lib/lang/error-ratchet.js';
|
|
2
|
+
import { Logger } from '@bitblit/ratchet-common/lib/logger/logger.js';
|
|
3
|
+
import { RequireRatchet } from '@bitblit/ratchet-common/lib/lang/require-ratchet.js';
|
|
4
|
+
import { PromiseRatchet } from '@bitblit/ratchet-common/lib/lang/promise-ratchet.js';
|
|
5
5
|
export class EnvironmentService {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
this.readPromiseCache = new Map();
|
|
10
|
-
RequireRatchet.notNullOrUndefined(provider);
|
|
11
|
-
RequireRatchet.notNullOrUndefined(cfg);
|
|
12
|
-
}
|
|
6
|
+
provider;
|
|
7
|
+
cfg;
|
|
8
|
+
readPromiseCache = new Map();
|
|
13
9
|
static defaultEnvironmentServiceConfig() {
|
|
14
10
|
const rval = {
|
|
15
11
|
maxRetries: 3,
|
|
@@ -17,6 +13,12 @@ export class EnvironmentService {
|
|
|
17
13
|
};
|
|
18
14
|
return rval;
|
|
19
15
|
}
|
|
16
|
+
constructor(provider, cfg = EnvironmentService.defaultEnvironmentServiceConfig()) {
|
|
17
|
+
this.provider = provider;
|
|
18
|
+
this.cfg = cfg;
|
|
19
|
+
RequireRatchet.notNullOrUndefined(provider);
|
|
20
|
+
RequireRatchet.notNullOrUndefined(cfg);
|
|
21
|
+
}
|
|
20
22
|
async getConfig(name) {
|
|
21
23
|
Logger.silly('EnvService:Request to read config %s', name);
|
|
22
24
|
if (!this.readPromiseCache.has(name)) {
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { EnvironmentService } from './environment-service.js';
|
|
2
|
+
import { Logger } from '@bitblit/ratchet-common/lib/logger/logger.js';
|
|
3
|
+
import { FixedEnvironmentServiceProvider } from './fixed-environment-service-provider.js';
|
|
4
|
+
const fixed = FixedEnvironmentServiceProvider.fromRecord({ a: 'b', c: 5 });
|
|
5
|
+
describe('#environmentService', function () {
|
|
6
|
+
it('should throw exception on missing environment values', async () => {
|
|
7
|
+
try {
|
|
8
|
+
const es = new EnvironmentService(fixed);
|
|
9
|
+
const vals = await es.getConfig('i_do_not_exist');
|
|
10
|
+
this.bail('Should not have returned a value');
|
|
11
|
+
}
|
|
12
|
+
catch (err) {
|
|
13
|
+
expect(err).toBeTruthy();
|
|
14
|
+
Logger.info('Success - threw %s', err);
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
it('should find a valid value', async () => {
|
|
18
|
+
const es = new EnvironmentService(fixed);
|
|
19
|
+
const vals = await es.getConfig('c');
|
|
20
|
+
expect(vals).toBeTruthy();
|
|
21
|
+
});
|
|
22
|
+
});
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import { EnvironmentServiceProvider } from './environment-service-provider';
|
|
2
|
-
/**
|
|
3
|
-
* Forces in a single object as the environment
|
|
4
|
-
*/
|
|
1
|
+
import { EnvironmentServiceProvider } from './environment-service-provider.js';
|
|
5
2
|
export declare class FixedEnvironmentServiceProvider<T> implements EnvironmentServiceProvider<T> {
|
|
6
3
|
private value;
|
|
7
4
|
constructor(value: Map<string, T>);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { Logger } from '@bitblit/ratchet-common';
|
|
2
|
-
import { RequireRatchet } from '@bitblit/ratchet-common';
|
|
1
|
+
import { Logger } from '@bitblit/ratchet-common/lib/logger/logger.js';
|
|
2
|
+
import { RequireRatchet } from '@bitblit/ratchet-common/lib/lang/require-ratchet.js';
|
|
3
3
|
export class FixedEnvironmentServiceProvider {
|
|
4
|
+
value;
|
|
4
5
|
constructor(value) {
|
|
5
6
|
this.value = value;
|
|
6
7
|
RequireRatchet.notNullOrUndefined(value);
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import { EnvironmentServiceProvider } from './environment-service-provider';
|
|
1
|
+
import { EnvironmentServiceProvider } from './environment-service-provider.js';
|
|
2
2
|
import { S3Client } from '@aws-sdk/client-s3';
|
|
3
|
-
/**
|
|
4
|
-
* Service for reading environmental variables from S3
|
|
5
|
-
*/
|
|
6
3
|
export declare class S3EnvironmentServiceProvider<T> implements EnvironmentServiceProvider<T> {
|
|
7
4
|
private cfg;
|
|
8
5
|
private ratchet;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { S3CacheRatchet } from '../s3/s3-cache-ratchet';
|
|
2
|
-
import { RequireRatchet } from '@bitblit/ratchet-common';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { S3CacheRatchet } from '../s3/s3-cache-ratchet.js';
|
|
2
|
+
import { RequireRatchet } from '@bitblit/ratchet-common/lib/lang/require-ratchet.js';
|
|
3
|
+
import { Logger } from '@bitblit/ratchet-common/lib/logger/logger.js';
|
|
4
|
+
import { StringRatchet } from '@bitblit/ratchet-common/lib/lang/string-ratchet.js';
|
|
5
|
+
import { StopWatch } from '@bitblit/ratchet-common/lib/lang/stop-watch.js';
|
|
6
6
|
import { S3Client } from '@aws-sdk/client-s3';
|
|
7
7
|
export class S3EnvironmentServiceProvider {
|
|
8
|
+
cfg;
|
|
9
|
+
ratchet;
|
|
8
10
|
constructor(cfg) {
|
|
9
11
|
this.cfg = cfg;
|
|
10
12
|
RequireRatchet.notNullOrUndefined(cfg);
|