@bitblit/ratchet-aws 4.0.80-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/cjs/batch/aws-batch-background-processor.js +44 -0
- package/dist/cjs/batch/aws-batch-ratchet.js +55 -0
- package/dist/cjs/build/ratchet-aws-info.js +18 -0
- package/dist/cjs/cache/dynamo-db-storage-provider.js +111 -0
- package/dist/cjs/cache/s3-storage-provider.js +44 -0
- package/dist/cjs/cache/simple-cache-object-wrapper.js +2 -0
- package/dist/cjs/cache/simple-cache-read-options.js +2 -0
- package/dist/cjs/cache/simple-cache-storage-provider.js +2 -0
- package/dist/cjs/cache/simple-cache.js +66 -0
- package/dist/cjs/cloudwatch/cloud-watch-log-group-ratchet.js +73 -0
- package/dist/cjs/cloudwatch/cloud-watch-logs-ratchet.js +173 -0
- package/dist/cjs/cloudwatch/cloud-watch-metrics-ratchet.js +57 -0
- package/dist/cjs/daemon/daemon-like.js +2 -0
- package/dist/cjs/daemon/daemon-process-create-options.js +2 -0
- package/dist/cjs/daemon/daemon-process-state-public-token.js +2 -0
- package/dist/cjs/daemon/daemon-process-state.js +2 -0
- package/dist/cjs/daemon/daemon-util.js +152 -0
- package/dist/cjs/daemon/daemon.js +126 -0
- package/dist/cjs/dao/prototype-dao-config.js +2 -0
- package/dist/cjs/dao/prototype-dao-db.js +2 -0
- package/dist/cjs/dao/prototype-dao-provider.js +2 -0
- package/dist/cjs/dao/prototype-dao.js +88 -0
- package/dist/cjs/dao/s3-prototype-dao-provider.js +28 -0
- package/dist/cjs/dao/s3-simple-dao.js +78 -0
- package/dist/cjs/dao/simple-dao-item.js +2 -0
- package/dist/cjs/dynamodb/dynamo-ratchet-like.js +2 -0
- package/dist/cjs/dynamodb/dynamo-ratchet.js +667 -0
- package/dist/cjs/dynamodb/dynamo-table-ratchet.js +91 -0
- package/dist/cjs/dynamodb/hash-spreader.js +62 -0
- package/dist/cjs/ec2/ec2-ratchet.js +107 -0
- package/dist/cjs/environment/cascade-environment-service-provider.js +27 -0
- package/dist/cjs/environment/env-var-environment-service-provider.js +33 -0
- package/dist/cjs/environment/environment-service-config.js +2 -0
- package/dist/cjs/environment/environment-service-provider.js +2 -0
- package/dist/cjs/environment/environment-service.js +52 -0
- package/dist/cjs/environment/fixed-environment-service-provider.js +24 -0
- package/dist/cjs/environment/s3-environment-service-provider.js +29 -0
- package/dist/cjs/environment/ssm-environment-service-provider.js +61 -0
- package/dist/cjs/expiring-code/dynamo-expiring-code-provider.js +26 -0
- package/dist/cjs/expiring-code/expiring-code-params.js +2 -0
- package/dist/cjs/expiring-code/expiring-code-provider.js +2 -0
- package/dist/cjs/expiring-code/expiring-code-ratchet.js +37 -0
- package/dist/cjs/expiring-code/expiring-code.js +2 -0
- package/dist/cjs/expiring-code/s3-expiring-code-provider.js +49 -0
- package/dist/cjs/iam/aws-credentials-ratchet.js +21 -0
- package/dist/cjs/index.js +81 -0
- package/dist/cjs/lambda/lambda-event-detector.js +42 -0
- package/dist/cjs/lambda/lambda-event-type-guards.js +28 -0
- package/dist/cjs/model/cloud-watch-metrics-minute-level-dynamo-count-request.js +2 -0
- package/dist/cjs/model/cloud-watch-metrics-unit.js +33 -0
- package/dist/cjs/model/dynamo/doc-put-item-command-input.js +2 -0
- package/dist/cjs/model/dynamo/doc-query-command-input.js +2 -0
- package/dist/cjs/model/dynamo/doc-scan-command-input.js +2 -0
- package/dist/cjs/model/dynamo/doc-update-item-command-input.js +2 -0
- package/dist/cjs/model/dynamo-count-result.js +2 -0
- package/dist/cjs/route53/route-53-ratchet.js +57 -0
- package/dist/cjs/runtime-parameter/cached-stored-runtime-parameter.js +2 -0
- package/dist/cjs/runtime-parameter/dynamo-runtime-parameter-provider.js +38 -0
- package/dist/cjs/runtime-parameter/global-variable-override-runtime-parameter-provider.js +54 -0
- package/dist/cjs/runtime-parameter/memory-runtime-parameter-provider.js +30 -0
- package/dist/cjs/runtime-parameter/runtime-parameter-provider.js +2 -0
- package/dist/cjs/runtime-parameter/runtime-parameter-ratchet.js +74 -0
- package/dist/cjs/runtime-parameter/stored-runtime-parameter.js +2 -0
- package/dist/cjs/s3/s3-cache-ratchet.js +332 -0
- package/dist/cjs/s3/s3-cache-to-local-disk-ratchet.js +105 -0
- package/dist/cjs/s3/s3-location-sync-ratchet.js +142 -0
- package/dist/cjs/s3/s3-ratchet.js +26 -0
- package/dist/cjs/ses/email-attachment.js +2 -0
- package/dist/cjs/ses/mailer-config.js +2 -0
- package/dist/cjs/ses/mailer-like.js +2 -0
- package/dist/cjs/ses/mailer.js +208 -0
- package/dist/cjs/ses/ratchet-template-renderer.js +2 -0
- package/dist/cjs/ses/ready-to-send-email.js +2 -0
- package/dist/cjs/ses/remote-handlebars-template-renderer.js +79 -0
- package/dist/cjs/ses/resolved-ready-to-send-email.js +2 -0
- package/dist/cjs/sns/sns-ratchet.js +47 -0
- package/dist/cjs/sync-lock/dynamo-db-sync-lock.js +69 -0
- package/dist/cjs/sync-lock/memory-sync-lock.js +40 -0
- package/dist/cjs/sync-lock/sync-lock-provider.js +2 -0
- package/dist/es/batch/aws-batch-background-processor.js +40 -0
- package/dist/es/batch/aws-batch-ratchet.js +51 -0
- package/dist/es/build/ratchet-aws-info.js +14 -0
- package/dist/es/cache/dynamo-db-storage-provider.js +107 -0
- package/dist/es/cache/s3-storage-provider.js +40 -0
- package/dist/es/cache/simple-cache-object-wrapper.js +1 -0
- package/dist/es/cache/simple-cache-read-options.js +1 -0
- package/dist/es/cache/simple-cache-storage-provider.js +1 -0
- package/dist/es/cache/simple-cache.js +62 -0
- package/dist/es/cloudwatch/cloud-watch-log-group-ratchet.js +69 -0
- package/dist/es/cloudwatch/cloud-watch-logs-ratchet.js +169 -0
- package/dist/es/cloudwatch/cloud-watch-metrics-ratchet.js +53 -0
- package/dist/es/daemon/daemon-like.js +1 -0
- package/dist/es/daemon/daemon-process-create-options.js +1 -0
- package/dist/es/daemon/daemon-process-state-public-token.js +1 -0
- package/dist/es/daemon/daemon-process-state.js +1 -0
- package/dist/es/daemon/daemon-util.js +148 -0
- package/dist/es/daemon/daemon.js +122 -0
- package/dist/es/dao/prototype-dao-config.js +1 -0
- package/dist/es/dao/prototype-dao-db.js +1 -0
- package/dist/es/dao/prototype-dao-provider.js +1 -0
- package/dist/es/dao/prototype-dao.js +84 -0
- package/dist/es/dao/s3-prototype-dao-provider.js +24 -0
- package/dist/es/dao/s3-simple-dao.js +74 -0
- package/dist/es/dao/simple-dao-item.js +1 -0
- package/dist/es/dynamodb/dynamo-ratchet-like.js +1 -0
- package/dist/es/dynamodb/dynamo-ratchet.js +663 -0
- package/dist/es/dynamodb/dynamo-table-ratchet.js +87 -0
- package/dist/es/dynamodb/hash-spreader.js +58 -0
- package/dist/es/ec2/ec2-ratchet.js +103 -0
- package/dist/es/environment/cascade-environment-service-provider.js +23 -0
- package/dist/es/environment/env-var-environment-service-provider.js +29 -0
- package/dist/es/environment/environment-service-config.js +1 -0
- package/dist/es/environment/environment-service-provider.js +1 -0
- package/dist/es/environment/environment-service.js +48 -0
- package/dist/es/environment/fixed-environment-service-provider.js +20 -0
- package/dist/es/environment/s3-environment-service-provider.js +25 -0
- package/dist/es/environment/ssm-environment-service-provider.js +56 -0
- package/dist/es/expiring-code/dynamo-expiring-code-provider.js +22 -0
- package/dist/es/expiring-code/expiring-code-params.js +1 -0
- package/dist/es/expiring-code/expiring-code-provider.js +1 -0
- package/dist/es/expiring-code/expiring-code-ratchet.js +33 -0
- package/dist/es/expiring-code/expiring-code.js +1 -0
- package/dist/es/expiring-code/s3-expiring-code-provider.js +45 -0
- package/dist/es/iam/aws-credentials-ratchet.js +17 -0
- package/dist/es/index.js +78 -0
- package/dist/es/lambda/lambda-event-detector.js +38 -0
- package/dist/es/lambda/lambda-event-type-guards.js +24 -0
- package/dist/es/model/cloud-watch-metrics-minute-level-dynamo-count-request.js +1 -0
- package/dist/es/model/cloud-watch-metrics-unit.js +30 -0
- package/dist/es/model/dynamo/doc-put-item-command-input.js +1 -0
- package/dist/es/model/dynamo/doc-query-command-input.js +1 -0
- package/dist/es/model/dynamo/doc-scan-command-input.js +1 -0
- package/dist/es/model/dynamo/doc-update-item-command-input.js +1 -0
- package/dist/es/model/dynamo-count-result.js +1 -0
- package/dist/es/route53/route-53-ratchet.js +53 -0
- package/dist/es/runtime-parameter/cached-stored-runtime-parameter.js +1 -0
- package/dist/es/runtime-parameter/dynamo-runtime-parameter-provider.js +34 -0
- package/dist/es/runtime-parameter/global-variable-override-runtime-parameter-provider.js +49 -0
- package/dist/es/runtime-parameter/memory-runtime-parameter-provider.js +26 -0
- package/dist/es/runtime-parameter/runtime-parameter-provider.js +1 -0
- package/dist/es/runtime-parameter/runtime-parameter-ratchet.js +70 -0
- package/dist/es/runtime-parameter/stored-runtime-parameter.js +1 -0
- package/dist/es/s3/s3-cache-ratchet.js +328 -0
- package/dist/es/s3/s3-cache-to-local-disk-ratchet.js +100 -0
- package/dist/es/s3/s3-location-sync-ratchet.js +137 -0
- package/dist/es/s3/s3-ratchet.js +22 -0
- package/dist/es/ses/email-attachment.js +1 -0
- package/dist/es/ses/mailer-config.js +1 -0
- package/dist/es/ses/mailer-like.js +1 -0
- package/dist/es/ses/mailer.js +204 -0
- package/dist/es/ses/ratchet-template-renderer.js +1 -0
- package/dist/es/ses/ready-to-send-email.js +1 -0
- package/dist/es/ses/remote-handlebars-template-renderer.js +74 -0
- package/dist/es/ses/resolved-ready-to-send-email.js +1 -0
- package/dist/es/sns/sns-ratchet.js +43 -0
- package/dist/es/sync-lock/dynamo-db-sync-lock.js +65 -0
- package/dist/es/sync-lock/memory-sync-lock.js +36 -0
- package/dist/es/sync-lock/sync-lock-provider.js +1 -0
- package/dist/tsconfig.cjs.tsbuildinfo +1 -0
- package/dist/tsconfig.es.tsbuildinfo +1 -0
- package/dist/tsconfig.types.tsbuildinfo +1 -0
- package/dist/types/batch/aws-batch-background-processor.d.ts +12 -0
- package/dist/types/batch/aws-batch-ratchet.d.ts +16 -0
- package/dist/types/build/ratchet-aws-info.d.ts +5 -0
- package/dist/types/cache/dynamo-db-storage-provider.d.ts +25 -0
- package/dist/types/cache/s3-storage-provider.d.ts +14 -0
- package/dist/types/cache/simple-cache-object-wrapper.d.ts +7 -0
- package/dist/types/cache/simple-cache-read-options.d.ts +5 -0
- package/dist/types/cache/simple-cache-storage-provider.d.ts +8 -0
- package/dist/types/cache/simple-cache.d.ts +14 -0
- package/dist/types/cloudwatch/cloud-watch-log-group-ratchet.d.ts +9 -0
- package/dist/types/cloudwatch/cloud-watch-logs-ratchet.d.ts +14 -0
- package/dist/types/cloudwatch/cloud-watch-metrics-ratchet.d.ts +10 -0
- package/dist/types/daemon/daemon-like.d.ts +17 -0
- package/dist/types/daemon/daemon-process-create-options.d.ts +7 -0
- package/dist/types/daemon/daemon-process-state-public-token.d.ts +4 -0
- package/dist/types/daemon/daemon-process-state.d.ts +13 -0
- package/dist/types/daemon/daemon-util.d.ts +24 -0
- package/dist/types/daemon/daemon.d.ts +33 -0
- package/dist/types/dao/prototype-dao-config.d.ts +8 -0
- package/dist/types/dao/prototype-dao-db.d.ts +4 -0
- package/dist/types/dao/prototype-dao-provider.d.ts +5 -0
- package/dist/types/dao/prototype-dao.d.ts +15 -0
- package/dist/types/dao/s3-prototype-dao-provider.d.ts +10 -0
- package/dist/types/dao/s3-simple-dao.d.ts +15 -0
- package/dist/types/dao/simple-dao-item.d.ts +5 -0
- package/dist/types/dynamodb/dynamo-ratchet-like.d.ts +27 -0
- package/dist/types/dynamodb/dynamo-ratchet.d.ts +36 -0
- package/dist/types/dynamodb/dynamo-table-ratchet.d.ts +11 -0
- package/dist/types/dynamodb/hash-spreader.d.ts +15 -0
- package/dist/types/ec2/ec2-ratchet.d.ts +25 -0
- package/dist/types/environment/cascade-environment-service-provider.d.ts +9 -0
- package/dist/types/environment/env-var-environment-service-provider.d.ts +10 -0
- package/dist/types/environment/environment-service-config.d.ts +7 -0
- package/dist/types/environment/environment-service-provider.d.ts +7 -0
- package/dist/types/environment/environment-service.d.ts +14 -0
- package/dist/types/environment/fixed-environment-service-provider.d.ts +10 -0
- package/dist/types/environment/s3-environment-service-provider.d.ts +18 -0
- package/dist/types/environment/ssm-environment-service-provider.d.ts +12 -0
- package/dist/types/expiring-code/dynamo-expiring-code-provider.d.ts +12 -0
- package/dist/types/expiring-code/expiring-code-params.d.ts +7 -0
- package/dist/types/expiring-code/expiring-code-provider.d.ts +5 -0
- package/dist/types/expiring-code/expiring-code-ratchet.d.ts +13 -0
- package/dist/types/expiring-code/expiring-code.d.ts +6 -0
- package/dist/types/expiring-code/s3-expiring-code-provider.d.ts +17 -0
- package/dist/types/iam/aws-credentials-ratchet.d.ts +9 -0
- package/dist/types/index.d.ts +81 -0
- package/dist/types/lambda/lambda-event-detector.d.ts +14 -0
- package/dist/types/lambda/lambda-event-type-guards.d.ts +10 -0
- package/dist/types/model/cloud-watch-metrics-minute-level-dynamo-count-request.d.ts +12 -0
- package/dist/types/model/cloud-watch-metrics-unit.d.ts +29 -0
- package/dist/types/model/dynamo/doc-put-item-command-input.d.ts +4 -0
- package/dist/types/model/dynamo/doc-query-command-input.d.ts +5 -0
- package/dist/types/model/dynamo/doc-scan-command-input.d.ts +5 -0
- package/dist/types/model/dynamo/doc-update-item-command-input.d.ts +5 -0
- package/dist/types/model/dynamo-count-result.d.ts +5 -0
- package/dist/types/route53/route-53-ratchet.d.ts +7 -0
- package/dist/types/runtime-parameter/cached-stored-runtime-parameter.d.ts +4 -0
- package/dist/types/runtime-parameter/dynamo-runtime-parameter-provider.d.ts +11 -0
- package/dist/types/runtime-parameter/global-variable-override-runtime-parameter-provider.d.ts +24 -0
- package/dist/types/runtime-parameter/memory-runtime-parameter-provider.d.ts +13 -0
- package/dist/types/runtime-parameter/runtime-parameter-provider.d.ts +11 -0
- package/dist/types/runtime-parameter/runtime-parameter-ratchet.d.ts +15 -0
- package/dist/types/runtime-parameter/stored-runtime-parameter.d.ts +6 -0
- package/dist/types/s3/s3-cache-ratchet.d.ts +38 -0
- package/dist/types/s3/s3-cache-to-local-disk-ratchet.d.ts +21 -0
- package/dist/types/s3/s3-location-sync-ratchet.d.ts +21 -0
- package/dist/types/s3/s3-ratchet.d.ts +5 -0
- package/dist/types/ses/email-attachment.d.ts +23 -0
- package/dist/types/ses/mailer-config.d.ts +15 -0
- package/dist/types/ses/mailer-like.d.ts +18 -0
- package/dist/types/ses/mailer.d.ts +26 -0
- package/dist/types/ses/ratchet-template-renderer.d.ts +8 -0
- package/dist/types/ses/ready-to-send-email.d.ts +66 -0
- package/dist/types/ses/remote-handlebars-template-renderer.d.ts +15 -0
- package/dist/types/ses/resolved-ready-to-send-email.d.ts +16 -0
- package/dist/types/sns/sns-ratchet.d.ts +8 -0
- package/dist/types/sync-lock/dynamo-db-sync-lock.d.ts +10 -0
- package/dist/types/sync-lock/memory-sync-lock.d.ts +11 -0
- package/dist/types/sync-lock/sync-lock-provider.d.ts +5 -0
- package/package.json +112 -0
package/dist/es/index.js
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
export * from './batch/aws-batch-background-processor';
|
|
2
|
+
export * from './batch/aws-batch-ratchet';
|
|
3
|
+
export * from './build/ratchet-aws-info';
|
|
4
|
+
export * from './cache/dynamo-db-storage-provider';
|
|
5
|
+
export * from './cache/s3-storage-provider';
|
|
6
|
+
export * from './cache/simple-cache-object-wrapper';
|
|
7
|
+
export * from './cache/simple-cache-read-options';
|
|
8
|
+
export * from './cache/simple-cache-storage-provider';
|
|
9
|
+
export * from './cache/simple-cache';
|
|
10
|
+
export * from './cloudwatch/cloud-watch-log-group-ratchet';
|
|
11
|
+
export * from './cloudwatch/cloud-watch-logs-ratchet';
|
|
12
|
+
export * from './cloudwatch/cloud-watch-metrics-ratchet';
|
|
13
|
+
export * from './daemon/daemon-like';
|
|
14
|
+
export * from './daemon/daemon-process-create-options';
|
|
15
|
+
export * from './daemon/daemon-process-state-public-token';
|
|
16
|
+
export * from './daemon/daemon-process-state';
|
|
17
|
+
export * from './daemon/daemon-util';
|
|
18
|
+
export * from './daemon/daemon';
|
|
19
|
+
export * from './dao/prototype-dao-config';
|
|
20
|
+
export * from './dao/prototype-dao-db';
|
|
21
|
+
export * from './dao/prototype-dao-provider';
|
|
22
|
+
export * from './dao/prototype-dao';
|
|
23
|
+
export * from './dao/s3-prototype-dao-provider';
|
|
24
|
+
export * from './dao/s3-simple-dao';
|
|
25
|
+
export * from './dao/simple-dao-item';
|
|
26
|
+
export * from './dynamodb/dynamo-ratchet-like';
|
|
27
|
+
export * from './dynamodb/dynamo-ratchet';
|
|
28
|
+
export * from './dynamodb/dynamo-table-ratchet';
|
|
29
|
+
export * from './dynamodb/hash-spreader';
|
|
30
|
+
export * from './ec2/ec2-ratchet';
|
|
31
|
+
export * from './environment/cascade-environment-service-provider';
|
|
32
|
+
export * from './environment/env-var-environment-service-provider';
|
|
33
|
+
export * from './environment/environment-service-config';
|
|
34
|
+
export * from './environment/environment-service-provider';
|
|
35
|
+
export * from './environment/environment-service';
|
|
36
|
+
export * from './environment/fixed-environment-service-provider';
|
|
37
|
+
export * from './environment/s3-environment-service-provider';
|
|
38
|
+
export * from './environment/ssm-environment-service-provider';
|
|
39
|
+
export * from './expiring-code/dynamo-expiring-code-provider';
|
|
40
|
+
export * from './expiring-code/expiring-code-params';
|
|
41
|
+
export * from './expiring-code/expiring-code-provider';
|
|
42
|
+
export * from './expiring-code/expiring-code-ratchet';
|
|
43
|
+
export * from './expiring-code/expiring-code';
|
|
44
|
+
export * from './expiring-code/s3-expiring-code-provider';
|
|
45
|
+
export * from './iam/aws-credentials-ratchet';
|
|
46
|
+
export * from './lambda/lambda-event-detector';
|
|
47
|
+
export * from './lambda/lambda-event-type-guards';
|
|
48
|
+
export * from './model/cloud-watch-metrics-minute-level-dynamo-count-request';
|
|
49
|
+
export * from './model/cloud-watch-metrics-unit';
|
|
50
|
+
export * from './model/dynamo-count-result';
|
|
51
|
+
export * from './model/dynamo/doc-put-item-command-input';
|
|
52
|
+
export * from './model/dynamo/doc-query-command-input';
|
|
53
|
+
export * from './model/dynamo/doc-scan-command-input';
|
|
54
|
+
export * from './model/dynamo/doc-update-item-command-input';
|
|
55
|
+
export * from './route53/route-53-ratchet';
|
|
56
|
+
export * from './runtime-parameter/cached-stored-runtime-parameter';
|
|
57
|
+
export * from './runtime-parameter/dynamo-runtime-parameter-provider';
|
|
58
|
+
export * from './runtime-parameter/global-variable-override-runtime-parameter-provider';
|
|
59
|
+
export * from './runtime-parameter/memory-runtime-parameter-provider';
|
|
60
|
+
export * from './runtime-parameter/runtime-parameter-provider';
|
|
61
|
+
export * from './runtime-parameter/runtime-parameter-ratchet';
|
|
62
|
+
export * from './runtime-parameter/stored-runtime-parameter';
|
|
63
|
+
export * from './s3/s3-cache-ratchet';
|
|
64
|
+
export * from './s3/s3-cache-to-local-disk-ratchet';
|
|
65
|
+
export * from './s3/s3-location-sync-ratchet';
|
|
66
|
+
export * from './s3/s3-ratchet';
|
|
67
|
+
export * from './ses/email-attachment';
|
|
68
|
+
export * from './ses/mailer-config';
|
|
69
|
+
export * from './ses/mailer-like';
|
|
70
|
+
export * from './ses/mailer';
|
|
71
|
+
export * from './ses/ratchet-template-renderer';
|
|
72
|
+
export * from './ses/ready-to-send-email';
|
|
73
|
+
export * from './ses/remote-handlebars-template-renderer';
|
|
74
|
+
export * from './ses/resolved-ready-to-send-email';
|
|
75
|
+
export * from './sns/sns-ratchet';
|
|
76
|
+
export * from './sync-lock/dynamo-db-sync-lock';
|
|
77
|
+
export * from './sync-lock/memory-sync-lock';
|
|
78
|
+
export * from './sync-lock/sync-lock-provider';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export class LambdaEventDetector {
|
|
2
|
+
static isValidCronEvent(event) {
|
|
3
|
+
return event && event.source == 'aws.events' && event.resources && event.resources.length > 0;
|
|
4
|
+
}
|
|
5
|
+
static isValidSnsEvent(event) {
|
|
6
|
+
return event && event.Records && event.Records.length > 0 && event.Records[0].EventSource == 'aws:sns';
|
|
7
|
+
}
|
|
8
|
+
static isValidDynamoDBEvent(event) {
|
|
9
|
+
return event && event.Records && event.Records.length > 0 && event.Records[0].eventSource == 'aws:dynamodb';
|
|
10
|
+
}
|
|
11
|
+
static isValidS3Event(event) {
|
|
12
|
+
return event && event.Records && event.Records.length > 0 && event.Records[0].eventSource == 'aws:s3';
|
|
13
|
+
}
|
|
14
|
+
static isValidApiGatewayV2WithRequestContextEvent(event) {
|
|
15
|
+
return event && event.rawPath && event.requestContext && event.routeKey;
|
|
16
|
+
}
|
|
17
|
+
static isValidApiGatewayEvent(event) {
|
|
18
|
+
return event && event.httpMethod && event.path && event.requestContext;
|
|
19
|
+
}
|
|
20
|
+
static isValidApiGatewayAuthorizerEvent(event) {
|
|
21
|
+
return event && event.authorizationToken && event.methodArn;
|
|
22
|
+
}
|
|
23
|
+
static isSingleCronEvent(event) {
|
|
24
|
+
return this.isValidCronEvent(event) && LambdaEventDetector.isSingleEntryEvent(event, 'resources');
|
|
25
|
+
}
|
|
26
|
+
static isSingleSnsEvent(event) {
|
|
27
|
+
return this.isValidSnsEvent(event) && LambdaEventDetector.isSingleEntryEvent(event);
|
|
28
|
+
}
|
|
29
|
+
static isSingleDynamoDBEvent(event) {
|
|
30
|
+
return this.isValidDynamoDBEvent(event) && LambdaEventDetector.isSingleEntryEvent(event);
|
|
31
|
+
}
|
|
32
|
+
static isSingleS3Event(event) {
|
|
33
|
+
return this.isValidS3Event(event) && LambdaEventDetector.isSingleEntryEvent(event);
|
|
34
|
+
}
|
|
35
|
+
static isSingleEntryEvent(event, entryName = 'Records') {
|
|
36
|
+
return event && event[entryName] && event[entryName] instanceof Array && event[entryName].length === 1;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { LambdaEventDetector } from './lambda-event-detector';
|
|
2
|
+
export class LambdaEventTypeGuards {
|
|
3
|
+
static isValidCronEvent(event) {
|
|
4
|
+
return LambdaEventDetector.isValidCronEvent(event);
|
|
5
|
+
}
|
|
6
|
+
static isValidSnsEvent(event) {
|
|
7
|
+
return LambdaEventDetector.isValidSnsEvent(event);
|
|
8
|
+
}
|
|
9
|
+
static isValidDynamoDBEvent(event) {
|
|
10
|
+
return LambdaEventDetector.isValidDynamoDBEvent(event);
|
|
11
|
+
}
|
|
12
|
+
static isValidS3Event(event) {
|
|
13
|
+
return LambdaEventDetector.isValidS3Event(event);
|
|
14
|
+
}
|
|
15
|
+
static isValidApiGatewayV2WithRequestContextEvent(event) {
|
|
16
|
+
return LambdaEventDetector.isValidApiGatewayV2WithRequestContextEvent(event);
|
|
17
|
+
}
|
|
18
|
+
static isValidApiGatewayEvent(event) {
|
|
19
|
+
return LambdaEventDetector.isValidApiGatewayEvent(event);
|
|
20
|
+
}
|
|
21
|
+
static isValidApiGatewayAuthorizerEvent(event) {
|
|
22
|
+
return LambdaEventDetector.isValidApiGatewayAuthorizerEvent(event);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export var CloudWatchMetricsUnit;
|
|
2
|
+
(function (CloudWatchMetricsUnit) {
|
|
3
|
+
CloudWatchMetricsUnit["Seconds"] = "Seconds";
|
|
4
|
+
CloudWatchMetricsUnit["Microseconds"] = "Microseconds";
|
|
5
|
+
CloudWatchMetricsUnit["Milliseconds"] = "Milliseconds";
|
|
6
|
+
CloudWatchMetricsUnit["Bytes"] = "Bytes";
|
|
7
|
+
CloudWatchMetricsUnit["Kilobytes"] = "Kilobytes";
|
|
8
|
+
CloudWatchMetricsUnit["Megabytes"] = "Megabytes";
|
|
9
|
+
CloudWatchMetricsUnit["Gigabytes"] = "Gigabytes";
|
|
10
|
+
CloudWatchMetricsUnit["Terabytes"] = "Terabytes";
|
|
11
|
+
CloudWatchMetricsUnit["Bits"] = "Bits";
|
|
12
|
+
CloudWatchMetricsUnit["Kilobits"] = "Kilobits";
|
|
13
|
+
CloudWatchMetricsUnit["Megabits"] = "Megabits";
|
|
14
|
+
CloudWatchMetricsUnit["Gigabits"] = "Gigabits";
|
|
15
|
+
CloudWatchMetricsUnit["Terabits"] = "Terabits";
|
|
16
|
+
CloudWatchMetricsUnit["Percent"] = "Percent";
|
|
17
|
+
CloudWatchMetricsUnit["Count"] = "Count";
|
|
18
|
+
CloudWatchMetricsUnit["BytesPerSecond"] = "Bytes/Second";
|
|
19
|
+
CloudWatchMetricsUnit["KilobytesPerSecond"] = "Kilobytes/Second";
|
|
20
|
+
CloudWatchMetricsUnit["MegabytesPerSecond"] = "Megabytes/Second";
|
|
21
|
+
CloudWatchMetricsUnit["GigabytesPerSecond"] = "Gigabytes/Second";
|
|
22
|
+
CloudWatchMetricsUnit["TerabytesPerSecond"] = "Terabytes/Second";
|
|
23
|
+
CloudWatchMetricsUnit["BitsPerSecond"] = "Terabytes/Second";
|
|
24
|
+
CloudWatchMetricsUnit["KilobitsPerSecond"] = "Kilobits/Second";
|
|
25
|
+
CloudWatchMetricsUnit["MegabitsPerSecond"] = "Megabits/Second";
|
|
26
|
+
CloudWatchMetricsUnit["GigabitsPerSecond"] = "Gigabits/Second";
|
|
27
|
+
CloudWatchMetricsUnit["TerabitsPerSecond"] = "Terabits/Second";
|
|
28
|
+
CloudWatchMetricsUnit["CountPerSecond"] = "Count/Second";
|
|
29
|
+
CloudWatchMetricsUnit["None"] = "None";
|
|
30
|
+
})(CloudWatchMetricsUnit || (CloudWatchMetricsUnit = {}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Logger } from '@bitblit/ratchet-common';
|
|
2
|
+
import { ChangeResourceRecordSetsCommand, waitUntilResourceRecordSetsChanged, } from '@aws-sdk/client-route-53';
|
|
3
|
+
import { WaiterState } from '@aws-sdk/util-waiter';
|
|
4
|
+
export class Route53Ratchet {
|
|
5
|
+
constructor(route53, hostedZoneId) {
|
|
6
|
+
this.route53 = route53;
|
|
7
|
+
this.hostedZoneId = hostedZoneId;
|
|
8
|
+
if (!this.route53) {
|
|
9
|
+
throw 'route53 may not be null';
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
async changeCnameRecordTarget(domainName, target, hostedZoneId = this.hostedZoneId, ttlSeconds = 600) {
|
|
13
|
+
Logger.info('Updating %s to point to %s', domainName, target);
|
|
14
|
+
try {
|
|
15
|
+
const params = {
|
|
16
|
+
ChangeBatch: {
|
|
17
|
+
Changes: [
|
|
18
|
+
{
|
|
19
|
+
Action: 'UPSERT',
|
|
20
|
+
ResourceRecordSet: {
|
|
21
|
+
Name: domainName,
|
|
22
|
+
ResourceRecords: [
|
|
23
|
+
{
|
|
24
|
+
Value: target,
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
TTL: ttlSeconds,
|
|
28
|
+
Type: 'CNAME',
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
},
|
|
33
|
+
HostedZoneId: hostedZoneId,
|
|
34
|
+
};
|
|
35
|
+
const result = await this.route53.send(new ChangeResourceRecordSetsCommand(params));
|
|
36
|
+
Logger.debug('Updated domain result: %j', result);
|
|
37
|
+
const waitParams = {
|
|
38
|
+
Id: result.ChangeInfo.Id,
|
|
39
|
+
};
|
|
40
|
+
const waitResult = await waitUntilResourceRecordSetsChanged({ client: this.route53, maxWaitTime: 300 }, waitParams);
|
|
41
|
+
Logger.debug('Wait responsed: %j', waitResult);
|
|
42
|
+
if (waitResult.state === WaiterState.SUCCESS) {
|
|
43
|
+
Logger.info('Updated %s to point to %s', domainName, hostedZoneId);
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
catch (err) {
|
|
48
|
+
Logger.warn('Error update CName for %s with value %s: %j', domainName, target, err);
|
|
49
|
+
}
|
|
50
|
+
Logger.info('Cannot update %s to point to %s', domainName, target);
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { RequireRatchet } from '@bitblit/ratchet-common';
|
|
2
|
+
import { Logger } from '@bitblit/ratchet-common';
|
|
3
|
+
export class DynamoRuntimeParameterProvider {
|
|
4
|
+
constructor(dynamo, tableName) {
|
|
5
|
+
this.dynamo = dynamo;
|
|
6
|
+
this.tableName = tableName;
|
|
7
|
+
RequireRatchet.notNullOrUndefined(this.dynamo);
|
|
8
|
+
RequireRatchet.notNullOrUndefined(this.tableName);
|
|
9
|
+
}
|
|
10
|
+
async readParameter(groupId, paramKey) {
|
|
11
|
+
Logger.silly('Reading %s / %s from underlying db', groupId, paramKey);
|
|
12
|
+
const req = {
|
|
13
|
+
groupId: groupId,
|
|
14
|
+
paramKey: paramKey,
|
|
15
|
+
};
|
|
16
|
+
const rval = await this.dynamo.simpleGet(this.tableName, req);
|
|
17
|
+
return rval;
|
|
18
|
+
}
|
|
19
|
+
async readAllParametersForGroup(groupId) {
|
|
20
|
+
const qry = {
|
|
21
|
+
TableName: this.tableName,
|
|
22
|
+
KeyConditionExpression: 'groupId = :groupId',
|
|
23
|
+
ExpressionAttributeValues: {
|
|
24
|
+
':groupId': groupId,
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
const all = await this.dynamo.fullyExecuteQuery(qry);
|
|
28
|
+
return all;
|
|
29
|
+
}
|
|
30
|
+
async writeParameter(toStore) {
|
|
31
|
+
const rval = await this.dynamo.simplePut(this.tableName, toStore);
|
|
32
|
+
return !!rval;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { RequireRatchet } from '@bitblit/ratchet-common';
|
|
2
|
+
import { ErrorRatchet, StringRatchet } from '@bitblit/ratchet-common';
|
|
3
|
+
export class GlobalVariableOverrideRuntimeParameterProvider {
|
|
4
|
+
constructor(wrapped, opts) {
|
|
5
|
+
this.wrapped = wrapped;
|
|
6
|
+
this.options = {
|
|
7
|
+
globalTTL: 1,
|
|
8
|
+
separator: '.',
|
|
9
|
+
prefix: 'RuntimeEnv-',
|
|
10
|
+
suffix: '',
|
|
11
|
+
};
|
|
12
|
+
RequireRatchet.notNullOrUndefined(this.wrapped, 'wrapped');
|
|
13
|
+
RequireRatchet.notNullOrUndefined(global?.process?.env, '"process" not found - this only runs in Node, not the browser');
|
|
14
|
+
if (opts) {
|
|
15
|
+
this.options = opts;
|
|
16
|
+
}
|
|
17
|
+
RequireRatchet.notNullOrUndefined(this.options.globalTTL, 'this.options.globalTTL');
|
|
18
|
+
RequireRatchet.notNullOrUndefined(this.options.separator, 'this.options.separator');
|
|
19
|
+
RequireRatchet.true(this.options.globalTTL > 0, 'this.options.globalTTL must be larger than 0');
|
|
20
|
+
}
|
|
21
|
+
generateName(groupId, paramKey) {
|
|
22
|
+
return (StringRatchet.trimToEmpty(this.options.prefix) +
|
|
23
|
+
groupId +
|
|
24
|
+
StringRatchet.trimToEmpty(this.options.separator) +
|
|
25
|
+
paramKey +
|
|
26
|
+
StringRatchet.trimToEmpty(this.options.suffix));
|
|
27
|
+
}
|
|
28
|
+
async readParameter(groupId, paramKey) {
|
|
29
|
+
const asString = StringRatchet.trimToNull(process.env[this.generateName(groupId, paramKey)]);
|
|
30
|
+
if (asString && !StringRatchet.canParseAsJson(asString)) {
|
|
31
|
+
ErrorRatchet.throwFormattedErr('Cannot parse ENV override (%s / %s) as JSON - did you forget the quotes on a string?', groupId, paramKey);
|
|
32
|
+
}
|
|
33
|
+
const rval = asString
|
|
34
|
+
? {
|
|
35
|
+
groupId: groupId,
|
|
36
|
+
paramKey: paramKey,
|
|
37
|
+
paramValue: asString,
|
|
38
|
+
ttlSeconds: this.options.globalTTL,
|
|
39
|
+
}
|
|
40
|
+
: await this.wrapped.readParameter(groupId, paramKey);
|
|
41
|
+
return rval;
|
|
42
|
+
}
|
|
43
|
+
async readAllParametersForGroup(groupId) {
|
|
44
|
+
return this.wrapped.readAllParametersForGroup(groupId);
|
|
45
|
+
}
|
|
46
|
+
async writeParameter(toStore) {
|
|
47
|
+
return this.wrapped.writeParameter(toStore);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Logger } from '@bitblit/ratchet-common';
|
|
2
|
+
export class MemoryRuntimeParameterProvider {
|
|
3
|
+
constructor(data = Promise.resolve({})) {
|
|
4
|
+
this.data = data;
|
|
5
|
+
}
|
|
6
|
+
async readParameter(groupId, paramKey) {
|
|
7
|
+
Logger.silly('Reading %s / %s from underlying db', groupId, paramKey);
|
|
8
|
+
const d = await this.data;
|
|
9
|
+
return d[groupId + '::' + paramKey];
|
|
10
|
+
}
|
|
11
|
+
async readAllParametersForGroup(groupId) {
|
|
12
|
+
const d = await this.data;
|
|
13
|
+
const out = [];
|
|
14
|
+
Object.keys(d).forEach((k) => {
|
|
15
|
+
if (k.startsWith(groupId)) {
|
|
16
|
+
out.push(d[k]);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
return out;
|
|
20
|
+
}
|
|
21
|
+
async writeParameter(toStore) {
|
|
22
|
+
const d = await this.data;
|
|
23
|
+
d[toStore.groupId + '::' + toStore.paramKey] = toStore;
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Logger } from '@bitblit/ratchet-common';
|
|
2
|
+
import { RequireRatchet } from '@bitblit/ratchet-common';
|
|
3
|
+
export class RuntimeParameterRatchet {
|
|
4
|
+
constructor(provider) {
|
|
5
|
+
this.provider = provider;
|
|
6
|
+
this.cache = new Map();
|
|
7
|
+
RequireRatchet.notNullOrUndefined(this.provider);
|
|
8
|
+
}
|
|
9
|
+
async fetchParameter(groupId, paramKey, defaultValue = null, forceFreshRead = false) {
|
|
10
|
+
Logger.debug('Reading parameter %s / %s / Force : %s', groupId, paramKey, forceFreshRead);
|
|
11
|
+
const cached = this.cache.get(RuntimeParameterRatchet.toCacheStoreKey(groupId, paramKey));
|
|
12
|
+
let rval = null;
|
|
13
|
+
const now = new Date().getTime();
|
|
14
|
+
if (!forceFreshRead && !!cached) {
|
|
15
|
+
const oldest = !!cached.ttlSeconds ? now - cached.ttlSeconds * 1000 : 0;
|
|
16
|
+
if (cached.storedEpochMS > oldest) {
|
|
17
|
+
Logger.silly('Fetched %s / %s from cache', groupId, paramKey);
|
|
18
|
+
rval = JSON.parse(cached.paramValue);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
if (!rval) {
|
|
22
|
+
const temp = await this.readUnderlyingEntry(groupId, paramKey);
|
|
23
|
+
if (!!temp) {
|
|
24
|
+
this.addToCache(temp);
|
|
25
|
+
rval = JSON.parse(temp.paramValue);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
rval = rval || defaultValue;
|
|
29
|
+
return rval;
|
|
30
|
+
}
|
|
31
|
+
async fetchAllParametersForGroup(groupId) {
|
|
32
|
+
const all = await this.readUnderlyingEntries(groupId);
|
|
33
|
+
const rval = new Map();
|
|
34
|
+
all.forEach((t) => {
|
|
35
|
+
rval.set(t.paramKey, JSON.parse(t.paramValue));
|
|
36
|
+
this.addToCache(t);
|
|
37
|
+
});
|
|
38
|
+
return rval;
|
|
39
|
+
}
|
|
40
|
+
async readUnderlyingEntry(groupId, paramKey) {
|
|
41
|
+
return this.provider.readParameter(groupId, paramKey);
|
|
42
|
+
}
|
|
43
|
+
async readUnderlyingEntries(groupId) {
|
|
44
|
+
return this.provider.readAllParametersForGroup(groupId);
|
|
45
|
+
}
|
|
46
|
+
async storeParameter(groupId, paramKey, paramValue, ttlSeconds) {
|
|
47
|
+
const toStore = {
|
|
48
|
+
groupId: groupId,
|
|
49
|
+
paramKey: paramKey,
|
|
50
|
+
paramValue: JSON.stringify(paramValue),
|
|
51
|
+
ttlSeconds: ttlSeconds,
|
|
52
|
+
};
|
|
53
|
+
const wrote = await this.provider.writeParameter(toStore);
|
|
54
|
+
return this.provider.readParameter(groupId, paramKey);
|
|
55
|
+
}
|
|
56
|
+
static toCacheStoreKey(groupId, paramKey) {
|
|
57
|
+
return groupId + ':::' + paramKey;
|
|
58
|
+
}
|
|
59
|
+
addToCache(temp) {
|
|
60
|
+
if (!!temp) {
|
|
61
|
+
const now = new Date().getTime();
|
|
62
|
+
const toStore = Object.assign({ storedEpochMS: now }, temp);
|
|
63
|
+
this.cache.set(RuntimeParameterRatchet.toCacheStoreKey(temp.groupId, temp.paramKey), toStore);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
clearCache() {
|
|
67
|
+
Logger.debug('Clearing runtime parameter cache');
|
|
68
|
+
this.cache = new Map();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|