@kensio/yulin 0.0.1 → 0.1.0

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.
Files changed (129) hide show
  1. package/.github/workflows/pr.yml +54 -0
  2. package/.idea/codeStyles/codeStyleConfig.xml +5 -0
  3. package/.nvmrc +1 -1
  4. package/README.md +44 -1
  5. package/dist/command/command-handler.d.ts +4 -0
  6. package/dist/command/command-handler.d.ts.map +1 -0
  7. package/dist/command/command-handler.js +2 -0
  8. package/dist/command/command-handler.js.map +1 -0
  9. package/dist/index.d.ts +2 -0
  10. package/dist/index.d.ts.map +1 -0
  11. package/dist/index.js +2 -0
  12. package/dist/index.js.map +1 -0
  13. package/dist/service/cloudfront/factory/cloudfront-functions.factory.d.ts +7 -0
  14. package/dist/service/cloudfront/factory/cloudfront-functions.factory.d.ts.map +1 -0
  15. package/dist/service/cloudfront/factory/cloudfront-functions.factory.js +33 -0
  16. package/dist/service/cloudfront/factory/cloudfront-functions.factory.js.map +1 -0
  17. package/dist/service/cloudfront/index.d.ts +3 -0
  18. package/dist/service/cloudfront/index.d.ts.map +1 -0
  19. package/dist/service/cloudfront/index.js +2 -0
  20. package/dist/service/cloudfront/index.js.map +1 -0
  21. package/dist/service/cloudfront/typings/cloudfront-functions.d.ts +37 -0
  22. package/dist/service/cloudfront/typings/cloudfront-functions.d.ts.map +1 -0
  23. package/dist/service/cloudfront/typings/cloudfront-functions.js +2 -0
  24. package/dist/service/cloudfront/typings/cloudfront-functions.js.map +1 -0
  25. package/dist/service/dynamodb/command/create-table/create-table.handler.d.ts +20 -0
  26. package/dist/service/dynamodb/command/create-table/create-table.handler.d.ts.map +1 -0
  27. package/dist/service/dynamodb/command/create-table/create-table.handler.js +47 -0
  28. package/dist/service/dynamodb/command/create-table/create-table.handler.js.map +1 -0
  29. package/dist/service/dynamodb/command/describe-table/describe-table.handler.d.ts +17 -0
  30. package/dist/service/dynamodb/command/describe-table/describe-table.handler.d.ts.map +1 -0
  31. package/dist/service/dynamodb/command/describe-table/describe-table.handler.js +37 -0
  32. package/dist/service/dynamodb/command/describe-table/describe-table.handler.js.map +1 -0
  33. package/dist/service/dynamodb/command/list-tables/list-tables.handler.d.ts +17 -0
  34. package/dist/service/dynamodb/command/list-tables/list-tables.handler.d.ts.map +1 -0
  35. package/dist/service/dynamodb/command/list-tables/list-tables.handler.js +32 -0
  36. package/dist/service/dynamodb/command/list-tables/list-tables.handler.js.map +1 -0
  37. package/dist/service/dynamodb/command/put-item/put-item.handler.d.ts +17 -0
  38. package/dist/service/dynamodb/command/put-item/put-item.handler.d.ts.map +1 -0
  39. package/dist/service/dynamodb/command/put-item/put-item.handler.js +39 -0
  40. package/dist/service/dynamodb/command/put-item/put-item.handler.js.map +1 -0
  41. package/dist/service/dynamodb/dynamodb.d.ts +27 -0
  42. package/dist/service/dynamodb/dynamodb.d.ts.map +1 -0
  43. package/dist/service/dynamodb/dynamodb.js +43 -0
  44. package/dist/service/dynamodb/dynamodb.js.map +1 -0
  45. package/dist/service/dynamodb/index.d.ts +2 -0
  46. package/dist/service/dynamodb/index.d.ts.map +1 -0
  47. package/dist/service/dynamodb/index.js +2 -0
  48. package/dist/service/dynamodb/index.js.map +1 -0
  49. package/dist/service/dynamodb/item/dynamodb-item-attribute.d.ts +21 -0
  50. package/dist/service/dynamodb/item/dynamodb-item-attribute.d.ts.map +1 -0
  51. package/dist/service/dynamodb/item/dynamodb-item-attribute.js +92 -0
  52. package/dist/service/dynamodb/item/dynamodb-item-attribute.js.map +1 -0
  53. package/dist/service/dynamodb/item/dynamodb-item.d.ts +18 -0
  54. package/dist/service/dynamodb/item/dynamodb-item.d.ts.map +1 -0
  55. package/dist/service/dynamodb/item/dynamodb-item.js +29 -0
  56. package/dist/service/dynamodb/item/dynamodb-item.js.map +1 -0
  57. package/dist/service/dynamodb/table/dynamodb-key-schema.d.ts +30 -0
  58. package/dist/service/dynamodb/table/dynamodb-key-schema.d.ts.map +1 -0
  59. package/dist/service/dynamodb/table/dynamodb-key-schema.js +61 -0
  60. package/dist/service/dynamodb/table/dynamodb-key-schema.js.map +1 -0
  61. package/dist/service/dynamodb/table/dynamodb-table.d.ts +34 -0
  62. package/dist/service/dynamodb/table/dynamodb-table.d.ts.map +1 -0
  63. package/dist/service/dynamodb/table/dynamodb-table.js +55 -0
  64. package/dist/service/dynamodb/table/dynamodb-table.js.map +1 -0
  65. package/dist/service/organizations/index.d.ts +2 -0
  66. package/dist/service/organizations/index.d.ts.map +1 -0
  67. package/dist/service/organizations/index.js +2 -0
  68. package/dist/service/organizations/index.js.map +1 -0
  69. package/dist/service/organizations/sim-aws-account.d.ts +19 -0
  70. package/dist/service/organizations/sim-aws-account.d.ts.map +1 -0
  71. package/dist/service/organizations/sim-aws-account.js +26 -0
  72. package/dist/service/organizations/sim-aws-account.js.map +1 -0
  73. package/dist/service/s3/index.d.ts +2 -0
  74. package/dist/service/s3/index.d.ts.map +1 -0
  75. package/dist/service/s3/index.js +3 -0
  76. package/dist/service/s3/index.js.map +1 -0
  77. package/dist/util/background/background.d.ts +28 -0
  78. package/dist/util/background/background.d.ts.map +1 -0
  79. package/dist/util/background/background.js +44 -0
  80. package/dist/util/background/background.js.map +1 -0
  81. package/dist/util/brand.type.d.ts +8 -0
  82. package/dist/util/brand.type.d.ts.map +1 -0
  83. package/dist/util/brand.type.js +2 -0
  84. package/dist/util/brand.type.js.map +1 -0
  85. package/dist/util/defined.d.ts +5 -0
  86. package/dist/util/defined.d.ts.map +1 -0
  87. package/dist/util/defined.js +11 -0
  88. package/dist/util/defined.js.map +1 -0
  89. package/dist/util/memo/memo.d.ts +15 -0
  90. package/dist/util/memo/memo.d.ts.map +1 -0
  91. package/dist/util/memo/memo.js +24 -0
  92. package/dist/util/memo/memo.js.map +1 -0
  93. package/dist/util/sleep.d.ts +10 -0
  94. package/dist/util/sleep.d.ts.map +1 -0
  95. package/dist/util/sleep.js +16 -0
  96. package/dist/util/sleep.js.map +1 -0
  97. package/eslint.config.ts +18 -4
  98. package/package.json +32 -19
  99. package/pnpm-workspace.yaml +23 -1
  100. package/scripts/publish.sh +14 -0
  101. package/src/index.ts +0 -0
  102. package/src/service/cloudfront/factory/cloudfront-functions.factory.iso.test.ts +10 -0
  103. package/src/service/cloudfront/factory/cloudfront-functions.factory.ts +34 -0
  104. package/src/service/cloudfront/index.ts +13 -0
  105. package/src/service/cloudfront/typings/cloudfront-functions.ts +48 -0
  106. package/src/service/dynamodb/command/create-table/create-table.handler.ts +5 -3
  107. package/src/service/dynamodb/command/create-table/create-table.iso.test.ts +36 -4
  108. package/src/service/dynamodb/command/describe-table/describe-table.handler.ts +3 -1
  109. package/src/service/dynamodb/command/describe-table/describe-table.iso.test.ts +18 -3
  110. package/src/service/dynamodb/command/list-tables/list-tables.handler.ts +3 -1
  111. package/src/service/dynamodb/command/list-tables/list-tables.iso.test.ts +54 -9
  112. package/src/service/dynamodb/command/put-item/put-item.handler.ts +56 -0
  113. package/src/service/dynamodb/command/put-item/put-item.iso.test.ts +354 -0
  114. package/src/service/dynamodb/dynamodb.ts +15 -1
  115. package/src/service/dynamodb/index.ts +0 -0
  116. package/src/service/dynamodb/item/dynamodb-item-attribute.iso.test.ts +19 -0
  117. package/src/service/dynamodb/item/dynamodb-item-attribute.ts +116 -0
  118. package/src/service/dynamodb/item/dynamodb-item.ts +39 -0
  119. package/src/service/dynamodb/table/dynamodb-key-schema.ts +94 -0
  120. package/src/service/dynamodb/{dynamodb-table.iso.test.ts → table/dynamodb-table.iso.test.ts} +8 -3
  121. package/src/service/dynamodb/table/dynamodb-table.ts +75 -0
  122. package/src/service/organizations/index.ts +0 -0
  123. package/src/service/s3/index.ts +1 -0
  124. package/src/util/background/background.ts +1 -1
  125. package/src/util/defined.ts +15 -0
  126. package/src/util/sleep.ts +1 -1
  127. package/tsconfig.json +11 -8
  128. package/src/service/dynamodb/dynamodb-table.ts +0 -46
  129. package/typings/eslint-plugin-promise.d.ts +0 -11
@@ -0,0 +1,54 @@
1
+ ---
2
+ name: PR
3
+
4
+ on:
5
+ pull_request:
6
+ branches:
7
+ - main
8
+
9
+ defaults:
10
+ run:
11
+ shell: bash
12
+
13
+ env:
14
+ CI: true
15
+
16
+ jobs:
17
+ lint:
18
+ name: Lint
19
+ runs-on: blacksmith-4vcpu-ubuntu-2404
20
+ steps:
21
+ - uses: actions/checkout@v6
22
+ - uses: pnpm/action-setup@v4
23
+ - uses: actions/setup-node@v6
24
+ with:
25
+ node-version-file: .nvmrc
26
+ cache: pnpm
27
+ - run: pnpm install --frozen-lockfile
28
+ - run: pnpm lint
29
+
30
+ test:
31
+ name: Test
32
+ runs-on: blacksmith-4vcpu-ubuntu-2404
33
+ steps:
34
+ - uses: actions/checkout@v6
35
+ - uses: pnpm/action-setup@v4
36
+ - uses: actions/setup-node@v6
37
+ with:
38
+ node-version-file: .nvmrc
39
+ cache: pnpm
40
+ - run: pnpm install --frozen-lockfile
41
+ - run: pnpm test:coverage
42
+
43
+ build:
44
+ name: Build
45
+ runs-on: blacksmith-4vcpu-ubuntu-2404
46
+ steps:
47
+ - uses: actions/checkout@v6
48
+ - uses: pnpm/action-setup@v4
49
+ - uses: actions/setup-node@v6
50
+ with:
51
+ node-version-file: .nvmrc
52
+ cache: pnpm
53
+ - run: pnpm install --frozen-lockfile
54
+ - run: pnpm build
@@ -0,0 +1,5 @@
1
+ <component name="ProjectCodeStyleConfiguration">
2
+ <state>
3
+ <option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
4
+ </state>
5
+ </component>
package/.nvmrc CHANGED
@@ -1 +1 @@
1
- v24.13.1
1
+ v24.16.0
package/README.md CHANGED
@@ -1,6 +1,49 @@
1
1
  # yulin
2
2
 
3
- AWS system behaviour simulation for isolated unit testing
3
+ AWS system behaviour simulation for isolated unit testing, local development and CI.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm i -D @kensio/yulin
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ Still in alpha!
14
+
15
+ ## What is yulin?
16
+
17
+ TLDR: yulin is an AWS simulator for testing Node.js applications.
18
+
19
+ The simulation is not only local to the machine, but in the same single process
20
+ with the test and application under test. No network or external i/o is
21
+ involved. This is what "isolated" refers to.
22
+
23
+ This "isolated system" approach to testing has a few advantages:
24
+
25
+ - Tests run fast as everything is in memory with no real networking.
26
+ - Test set-up is fast and uncomplicated, as there are no containers or extra
27
+ dependencies to manage.
28
+ - It's straightforward to use multiple other mocks and simulators alongside
29
+ yulin, such as [nock](https://github.com/nock/nock), as yulin makes no
30
+ assumptions about the environment.
31
+ - You can control everything in each isolated test process, such as controlling
32
+ the current time, even when multiple different AWS services are simulated.
33
+ - One test can cover **meaningful system behaviour** across multiple AWS
34
+ services and applications, such as Lambdas sending events to SQS queues to be
35
+ picked up by other Lambdas, or DynamoDB streams triggering Lambdas.
36
+
37
+ That last point is the most important. The motivation behind yulin is to enable
38
+ efficient tests that cover the logical behaviour of a system. That is in
39
+ contrast to less valuable microscopic unit tests with fiddly mocks and brittle
40
+ assertions. The goal of yulin is to allow you to test system behaviours that are
41
+ meaningful to users and stakeholders.
42
+
43
+ ## What's in a name?
44
+
45
+ The word yǔlín (雨林) is Chinese for "rainforest". This is a roundabout reference
46
+ to "Amazon" as in Amazon Web Services.
4
47
 
5
48
  ## Development
6
49
 
@@ -0,0 +1,4 @@
1
+ export interface CommandHandler<TCommand, TOutput> {
2
+ handle(cmd: TCommand): Promise<TOutput>;
3
+ }
4
+ //# sourceMappingURL=command-handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command-handler.d.ts","sourceRoot":"","sources":["../../src/command/command-handler.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc,CAAC,QAAQ,EAAE,OAAO;IAC/C,MAAM,CAAC,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACzC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=command-handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command-handler.js","sourceRoot":"","sources":["../../src/command/command-handler.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ import type { CloudFrontRequest } from "../typings/cloudfront-functions.js";
2
+ import { StaticFactory } from "@kensio/part-factory";
3
+ /**
4
+ * Makes instances of the CloudFrontRequest object structure.
5
+ */
6
+ export declare const cloudFrontRequestFactory: StaticFactory<CloudFrontRequest>;
7
+ //# sourceMappingURL=cloudfront-functions.factory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloudfront-functions.factory.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudfront/factory/cloudfront-functions.factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD;;GAEG;AACH,eAAO,MAAM,wBAAwB,kCA2BnC,CAAC"}
@@ -0,0 +1,33 @@
1
+ import { StaticFactory } from "@kensio/part-factory";
2
+ /**
3
+ * Makes instances of the CloudFrontRequest object structure.
4
+ */
5
+ export const cloudFrontRequestFactory = new StaticFactory({
6
+ cookies: {
7
+ sessionId: {
8
+ value: "test-session-id",
9
+ },
10
+ },
11
+ headers: {
12
+ accept: {
13
+ value: "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
14
+ },
15
+ "accept-language": {
16
+ value: "en-GB,en;q=0.9",
17
+ },
18
+ host: {
19
+ value: "yulin.test",
20
+ },
21
+ "user-agent": {
22
+ value: "Mozilla/5.0",
23
+ },
24
+ },
25
+ method: "GET",
26
+ querystring: {
27
+ page: {
28
+ value: "1",
29
+ },
30
+ },
31
+ uri: "/cloudfront/",
32
+ });
33
+ //# sourceMappingURL=cloudfront-functions.factory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloudfront-functions.factory.js","sourceRoot":"","sources":["../../../../src/service/cloudfront/factory/cloudfront-functions.factory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAI,aAAa,CAAoB;IAC3E,OAAO,EAAE;QACP,SAAS,EAAE;YACT,KAAK,EAAE,iBAAiB;SACzB;KACF;IACD,OAAO,EAAE;QACP,MAAM,EAAE;YACN,KAAK,EAAE,iEAAiE;SACzE;QACD,iBAAiB,EAAE;YACjB,KAAK,EAAE,gBAAgB;SACxB;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,YAAY;SACpB;QACD,YAAY,EAAE;YACZ,KAAK,EAAE,aAAa;SACrB;KACF;IACD,MAAM,EAAE,KAAK;IACb,WAAW,EAAE;QACX,IAAI,EAAE;YACJ,KAAK,EAAE,GAAG;SACX;KACF;IACD,GAAG,EAAE,cAAc;CACpB,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { cloudFrontRequestFactory } from "./factory/cloudfront-functions.factory.js";
2
+ export type { CloudFrontCookies, CloudFrontEvent, CloudFrontEventContext, CloudFrontHeaders, CloudFrontMultiValue, CloudFrontQueryString, CloudFrontRequest, CloudFrontResponse, CloudFrontValue, CloudFrontViewer, } from "./typings/cloudfront-functions.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/service/cloudfront/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AACrF,YAAY,EACV,iBAAiB,EACjB,eAAe,EACf,sBAAsB,EACtB,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,gBAAgB,GACjB,MAAM,mCAAmC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { cloudFrontRequestFactory } from "./factory/cloudfront-functions.factory.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/service/cloudfront/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC"}
@@ -0,0 +1,37 @@
1
+ export interface CloudFrontValue {
2
+ value: string;
3
+ }
4
+ export interface CloudFrontMultiValue {
5
+ multiValue: CloudFrontValue[];
6
+ }
7
+ export type CloudFrontHeaders = Record<string, CloudFrontValue>;
8
+ export type CloudFrontQueryString = Record<string, CloudFrontValue | CloudFrontMultiValue>;
9
+ export type CloudFrontCookies = Record<string, CloudFrontValue>;
10
+ export interface CloudFrontRequest {
11
+ method: string;
12
+ uri: string;
13
+ headers: CloudFrontHeaders;
14
+ querystring: CloudFrontQueryString;
15
+ cookies: CloudFrontCookies;
16
+ }
17
+ export interface CloudFrontResponse {
18
+ statusCode: number;
19
+ statusDescription?: string;
20
+ headers?: CloudFrontHeaders;
21
+ }
22
+ export interface CloudFrontEventContext {
23
+ distributionDomainName?: string;
24
+ endpoint?: string;
25
+ distributionId?: string;
26
+ eventType: "viewer-request" | "viewer-response";
27
+ requestId: string;
28
+ }
29
+ export interface CloudFrontViewer {
30
+ ip: string;
31
+ }
32
+ export interface CloudFrontEvent {
33
+ context: CloudFrontEventContext;
34
+ viewer: CloudFrontViewer;
35
+ request: CloudFrontRequest;
36
+ }
37
+ //# sourceMappingURL=cloudfront-functions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloudfront-functions.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudfront/typings/cloudfront-functions.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,eAAe,EAAE,CAAC;CAC/B;AAED,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;AAEhE,MAAM,MAAM,qBAAqB,GAAG,MAAM,CACxC,MAAM,EACN,eAAe,GAAG,oBAAoB,CACvC,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;AAEhE,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,iBAAiB,CAAC;IAC3B,WAAW,EAAE,qBAAqB,CAAC;IACnC,OAAO,EAAE,iBAAiB,CAAC;CAC5B;AAED,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,OAAO,CAAC,EAAE,iBAAiB,CAAC;CAC7B;AAED,MAAM,WAAW,sBAAsB;IACrC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,gBAAgB,GAAG,iBAAiB,CAAC;IAChD,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,sBAAsB,CAAC;IAChC,MAAM,EAAE,gBAAgB,CAAC;IACzB,OAAO,EAAE,iBAAiB,CAAC;CAC5B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=cloudfront-functions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloudfront-functions.js","sourceRoot":"","sources":["../../../../src/service/cloudfront/typings/cloudfront-functions.ts"],"names":[],"mappings":""}
@@ -0,0 +1,20 @@
1
+ import type { DynamoDbTableName } from "../../table/dynamodb-table.js";
2
+ import { SimDynamoDbTable } from "../../table/dynamodb-table.js";
3
+ import { type CreateTableCommand, type CreateTableCommandOutput } from "@aws-sdk/client-dynamodb";
4
+ import type { BackgroundScheduler } from "../../../../util/background/background.js";
5
+ import type { CommandHandler } from "../../../../command/command-handler.js";
6
+ /**
7
+ * DynamoDB CreateTableCommand handler.
8
+ *
9
+ * https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/dynamodb/command/CreateTableCommand/
10
+ */
11
+ export declare class CreateTableCommandHandler implements CommandHandler<CreateTableCommand, CreateTableCommandOutput> {
12
+ private readonly tables;
13
+ private readonly background;
14
+ constructor(tables: Map<DynamoDbTableName, SimDynamoDbTable>, background: BackgroundScheduler);
15
+ /**
16
+ * Handle creation of a new DynamoDB Table.
17
+ */
18
+ handle(cmd: CreateTableCommand): Promise<CreateTableCommandOutput>;
19
+ }
20
+ //# sourceMappingURL=create-table.handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-table.handler.d.ts","sourceRoot":"","sources":["../../../../../src/service/dynamodb/command/create-table/create-table.handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,wBAAwB,EAE9B,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AACrF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAG7E;;;;GAIG;AACH,qBAAa,yBAA0B,YAAW,cAAc,CAC9D,kBAAkB,EAClB,wBAAwB,CACzB;IAEG,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,UAAU;gBADV,MAAM,EAAE,GAAG,CAAC,iBAAiB,EAAE,gBAAgB,CAAC,EAChD,UAAU,EAAE,mBAAmB;IAGlD;;OAEG;IACG,MAAM,CAAC,GAAG,EAAE,kBAAkB,GAAG,OAAO,CAAC,wBAAwB,CAAC;CAgCzE"}
@@ -0,0 +1,47 @@
1
+ import { SimDynamoDbTable } from "../../table/dynamodb-table.js";
2
+ import { ResourceInUseException, } from "@aws-sdk/client-dynamodb";
3
+ import { jitter } from "../../../../util/sleep.js";
4
+ /**
5
+ * DynamoDB CreateTableCommand handler.
6
+ *
7
+ * https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/dynamodb/command/CreateTableCommand/
8
+ */
9
+ export class CreateTableCommandHandler {
10
+ tables;
11
+ background;
12
+ constructor(tables, background) {
13
+ this.tables = tables;
14
+ this.background = background;
15
+ }
16
+ /**
17
+ * Handle creation of a new DynamoDB Table.
18
+ */
19
+ async handle(cmd) {
20
+ if (cmd.input.TableName === undefined) {
21
+ throw new Error("CreateTableCommand.input.TableName is required");
22
+ }
23
+ const tableName = cmd.input.TableName;
24
+ if (this.tables.has(tableName)) {
25
+ throw new ResourceInUseException({
26
+ message: `DynamoDB Table ${tableName} already exists`,
27
+ $metadata: {},
28
+ });
29
+ }
30
+ await jitter();
31
+ const table = new SimDynamoDbTable(cmd, this.background);
32
+ this.tables.set(tableName, table);
33
+ this.background.schedule(() => table.activate());
34
+ return {
35
+ TableDescription: {
36
+ AttributeDefinitions: [],
37
+ TableName: tableName,
38
+ KeySchema: [],
39
+ TableStatus: table.status,
40
+ CreationDateTime: table.creationDateTime,
41
+ GlobalSecondaryIndexes: [],
42
+ },
43
+ $metadata: {},
44
+ };
45
+ }
46
+ }
47
+ //# sourceMappingURL=create-table.handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-table.handler.js","sourceRoot":"","sources":["../../../../../src/service/dynamodb/command/create-table/create-table.handler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAGL,sBAAsB,GACvB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAEnD;;;;GAIG;AACH,MAAM,OAAO,yBAAyB;IAKjB;IACA;IAFnB,YACmB,MAAgD,EAChD,UAA+B;QAD/B,WAAM,GAAN,MAAM,CAA0C;QAChD,eAAU,GAAV,UAAU,CAAqB;IAC/C,CAAC;IAEJ;;OAEG;IACH,KAAK,CAAC,MAAM,CAAC,GAAuB;QAClC,IAAI,GAAG,CAAC,KAAK,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;YACtC,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;QACpE,CAAC;QAED,MAAM,SAAS,GAAG,GAAG,CAAC,KAAK,CAAC,SAA8B,CAAC;QAC3D,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;YAC/B,MAAM,IAAI,sBAAsB,CAAC;gBAC/B,OAAO,EAAE,kBAAkB,SAAS,iBAAiB;gBACrD,SAAS,EAAE,EAAE;aACd,CAAC,CAAC;QACL,CAAC;QAED,MAAM,MAAM,EAAE,CAAC;QAEf,MAAM,KAAK,GAAG,IAAI,gBAAgB,CAAC,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QACzD,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;QAElC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;QAEjD,OAAO;YACL,gBAAgB,EAAE;gBAChB,oBAAoB,EAAE,EAAE;gBACxB,SAAS,EAAE,SAAS;gBACpB,SAAS,EAAE,EAAE;gBACb,WAAW,EAAE,KAAK,CAAC,MAAM;gBACzB,gBAAgB,EAAE,KAAK,CAAC,gBAAgB;gBACxC,sBAAsB,EAAE,EAAE;aAC3B;YACD,SAAS,EAAE,EAAE;SACd,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,17 @@
1
+ import { type DescribeTableCommand, type DescribeTableOutput } from "@aws-sdk/client-dynamodb";
2
+ import type { CommandHandler } from "../../../../command/command-handler.js";
3
+ import type { DynamoDbTableName, SimDynamoDbTable } from "../../table/dynamodb-table.js";
4
+ /**
5
+ * DynamoDB DescribeTableCommand handler.
6
+ *
7
+ * https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/dynamodb/command/DescribeTableCommand/
8
+ */
9
+ export declare class DescribeTableCommandHandler implements CommandHandler<DescribeTableCommand, DescribeTableOutput> {
10
+ private readonly tables;
11
+ constructor(tables: Map<DynamoDbTableName, SimDynamoDbTable>);
12
+ /**
13
+ * Simulate describing DynamoDB Table.
14
+ */
15
+ handle(cmd: DescribeTableCommand): Promise<DescribeTableOutput>;
16
+ }
17
+ //# sourceMappingURL=describe-table.handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"describe-table.handler.d.ts","sourceRoot":"","sources":["../../../../../src/service/dynamodb/command/describe-table/describe-table.handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACzB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,+BAA+B,CAAC;AAGvC;;;;GAIG;AACH,qBAAa,2BAA4B,YAAW,cAAc,CAChE,oBAAoB,EACpB,mBAAmB,CACpB;IAEG,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,GAAG,CAAC,iBAAiB,EAAE,gBAAgB,CAAC;IAGnE;;OAEG;IACG,MAAM,CAAC,GAAG,EAAE,oBAAoB,GAAG,OAAO,CAAC,mBAAmB,CAAC;CAuBtE"}
@@ -0,0 +1,37 @@
1
+ import { ResourceNotFoundException, } from "@aws-sdk/client-dynamodb";
2
+ import { jitter } from "../../../../util/sleep.js";
3
+ /**
4
+ * DynamoDB DescribeTableCommand handler.
5
+ *
6
+ * https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/dynamodb/command/DescribeTableCommand/
7
+ */
8
+ export class DescribeTableCommandHandler {
9
+ tables;
10
+ constructor(tables) {
11
+ this.tables = tables;
12
+ }
13
+ /**
14
+ * Simulate describing DynamoDB Table.
15
+ */
16
+ async handle(cmd) {
17
+ if (cmd.input.TableName === undefined) {
18
+ throw new Error("DescribeTableCommand.input.TableName is required");
19
+ }
20
+ const tableName = cmd.input.TableName;
21
+ await jitter();
22
+ const table = this.tables.get(tableName);
23
+ if (table === undefined) {
24
+ throw new ResourceNotFoundException({
25
+ message: `No DynamoDB Table named ${tableName}`,
26
+ $metadata: {},
27
+ });
28
+ }
29
+ return {
30
+ Table: {
31
+ TableName: table.tableName,
32
+ TableStatus: table.status,
33
+ },
34
+ };
35
+ }
36
+ }
37
+ //# sourceMappingURL=describe-table.handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"describe-table.handler.js","sourceRoot":"","sources":["../../../../../src/service/dynamodb/command/describe-table/describe-table.handler.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,GAG1B,MAAM,0BAA0B,CAAC;AAMlC,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAEnD;;;;GAIG;AACH,MAAM,OAAO,2BAA2B;IAKnB;IADnB,YACmB,MAAgD;QAAhD,WAAM,GAAN,MAAM,CAA0C;IAChE,CAAC;IAEJ;;OAEG;IACH,KAAK,CAAC,MAAM,CAAC,GAAyB;QACpC,IAAI,GAAG,CAAC,KAAK,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;YACtC,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;QACtE,CAAC;QACD,MAAM,SAAS,GAAG,GAAG,CAAC,KAAK,CAAC,SAA8B,CAAC;QAE3D,MAAM,MAAM,EAAE,CAAC;QAEf,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QACzC,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,MAAM,IAAI,yBAAyB,CAAC;gBAClC,OAAO,EAAE,2BAA2B,SAAS,EAAE;gBAC/C,SAAS,EAAE,EAAE;aACd,CAAC,CAAC;QACL,CAAC;QAED,OAAO;YACL,KAAK,EAAE;gBACL,SAAS,EAAE,KAAK,CAAC,SAAS;gBAC1B,WAAW,EAAE,KAAK,CAAC,MAAM;aAC1B;SACF,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,17 @@
1
+ import type { CommandHandler } from "../../../../command/command-handler.js";
2
+ import type { ListTablesCommand, ListTablesOutput } from "@aws-sdk/client-dynamodb";
3
+ import type { DynamoDbTableName, SimDynamoDbTable } from "../../table/dynamodb-table.js";
4
+ /**
5
+ * Simulated DynamoDB ListTablesCommand handler.
6
+ *
7
+ * https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/dynamodb/command/ListTablesCommand/
8
+ */
9
+ export declare class ListTablesCommandHandler implements CommandHandler<ListTablesCommand, ListTablesOutput> {
10
+ private readonly tables;
11
+ constructor(tables: Map<DynamoDbTableName, SimDynamoDbTable>);
12
+ /**
13
+ * Simulate listing DynamoDB Tables.
14
+ */
15
+ handle(cmd: ListTablesCommand): Promise<ListTablesOutput>;
16
+ }
17
+ //# sourceMappingURL=list-tables.handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-tables.handler.d.ts","sourceRoot":"","sources":["../../../../../src/service/dynamodb/command/list-tables/list-tables.handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,+BAA+B,CAAC;AAGvC;;;;GAIG;AACH,qBAAa,wBAAyB,YAAW,cAAc,CAC7D,iBAAiB,EACjB,gBAAgB,CACjB;IAEG,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,GAAG,CAAC,iBAAiB,EAAE,gBAAgB,CAAC;IAGnE;;OAEG;IACG,MAAM,CAAC,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAyBhE"}
@@ -0,0 +1,32 @@
1
+ import { jitter } from "../../../../util/sleep.js";
2
+ /**
3
+ * Simulated DynamoDB ListTablesCommand handler.
4
+ *
5
+ * https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/dynamodb/command/ListTablesCommand/
6
+ */
7
+ export class ListTablesCommandHandler {
8
+ tables;
9
+ constructor(tables) {
10
+ this.tables = tables;
11
+ }
12
+ /**
13
+ * Simulate listing DynamoDB Tables.
14
+ */
15
+ async handle(cmd) {
16
+ await jitter();
17
+ const tables = [...this.tables.values()];
18
+ tables.sort((a, b) => a.tableName.localeCompare(b.tableName));
19
+ const exclusiveStartTableName = cmd.input.ExclusiveStartTableName;
20
+ const limit = cmd.input.Limit ?? 100;
21
+ const startIndex = exclusiveStartTableName === undefined
22
+ ? 0
23
+ : Math.max(0, tables.findIndex((t) => t.tableName === exclusiveStartTableName) +
24
+ 1);
25
+ const page = tables.slice(startIndex, startIndex + limit);
26
+ return {
27
+ TableNames: page.map((table) => table.tableName),
28
+ LastEvaluatedTableName: page.at(-1)?.tableName,
29
+ };
30
+ }
31
+ }
32
+ //# sourceMappingURL=list-tables.handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-tables.handler.js","sourceRoot":"","sources":["../../../../../src/service/dynamodb/command/list-tables/list-tables.handler.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAEnD;;;;GAIG;AACH,MAAM,OAAO,wBAAwB;IAKhB;IADnB,YACmB,MAAgD;QAAhD,WAAM,GAAN,MAAM,CAA0C;IAChE,CAAC;IAEJ;;OAEG;IACH,KAAK,CAAC,MAAM,CAAC,GAAsB;QACjC,MAAM,MAAM,EAAE,CAAC;QAEf,MAAM,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;QACzC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;QAE9D,MAAM,uBAAuB,GAAG,GAAG,CAAC,KAAK,CAAC,uBAAuB,CAAC;QAClE,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,IAAI,GAAG,CAAC;QAErC,MAAM,UAAU,GACd,uBAAuB,KAAK,SAAS;YACnC,CAAC,CAAC,CAAC;YACH,CAAC,CAAC,IAAI,CAAC,GAAG,CACN,CAAC,EACD,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,KAAK,uBAAuB,CAAC;gBAC9D,CAAC,CACJ,CAAC;QAER,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,UAAU,EAAE,UAAU,GAAG,KAAK,CAAC,CAAC;QAE1D,OAAO;YACL,UAAU,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC;YAChD,sBAAsB,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,SAAS;SAC/C,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,17 @@
1
+ import type { CommandHandler } from "../../../../command/command-handler.js";
2
+ import { type PutItemCommand, type PutItemCommandOutput } from "@aws-sdk/client-dynamodb";
3
+ import type { DynamoDbTableName, SimDynamoDbTable } from "../../table/dynamodb-table.js";
4
+ /**
5
+ * DynamoDB PutItemCommand handler.
6
+ *
7
+ * https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/dynamodb/command/PutItemCommand/
8
+ */
9
+ export declare class PutItemCommandHandler implements CommandHandler<PutItemCommand, PutItemCommandOutput> {
10
+ private readonly tables;
11
+ constructor(tables: Map<DynamoDbTableName, SimDynamoDbTable>);
12
+ /**
13
+ * Put an Item into a DynamoDB Table.
14
+ */
15
+ handle(cmd: PutItemCommand): Promise<PutItemCommandOutput>;
16
+ }
17
+ //# sourceMappingURL=put-item.handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"put-item.handler.d.ts","sourceRoot":"","sources":["../../../../../src/service/dynamodb/command/put-item/put-item.handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,oBAAoB,EAE1B,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,+BAA+B,CAAC;AAGvC;;;;GAIG;AACH,qBAAa,qBAAsB,YAAW,cAAc,CAC1D,cAAc,EACd,oBAAoB,CACrB;IAEG,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,GAAG,CAAC,iBAAiB,EAAE,gBAAgB,CAAC;IAGnE;;OAEG;IACG,MAAM,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,oBAAoB,CAAC;CA2BjE"}
@@ -0,0 +1,39 @@
1
+ import { ResourceNotFoundException, } from "@aws-sdk/client-dynamodb";
2
+ import { DynamoDbItem } from "../../item/dynamodb-item.js";
3
+ /**
4
+ * DynamoDB PutItemCommand handler.
5
+ *
6
+ * https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/dynamodb/command/PutItemCommand/
7
+ */
8
+ export class PutItemCommandHandler {
9
+ tables;
10
+ constructor(tables) {
11
+ this.tables = tables;
12
+ }
13
+ /**
14
+ * Put an Item into a DynamoDB Table.
15
+ */
16
+ async handle(cmd) {
17
+ const tableName = cmd.input.TableName;
18
+ if (tableName === undefined) {
19
+ throw new Error("PutItemCommand.input.TableName is required");
20
+ }
21
+ const table = this.tables.get(tableName);
22
+ if (table === undefined) {
23
+ throw new ResourceNotFoundException({
24
+ message: `No DynamoDB Table named ${tableName}`,
25
+ $metadata: {},
26
+ });
27
+ }
28
+ if (cmd.input.Item === undefined) {
29
+ throw new Error("PutItemCommand.input.Item is required");
30
+ }
31
+ const item = DynamoDbItem.fromAttributeValues(cmd.input.Item);
32
+ await table.putItem(item);
33
+ return {
34
+ Attributes: item.toAttributeValues(),
35
+ $metadata: {},
36
+ };
37
+ }
38
+ }
39
+ //# sourceMappingURL=put-item.handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"put-item.handler.js","sourceRoot":"","sources":["../../../../../src/service/dynamodb/command/put-item/put-item.handler.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,yBAAyB,GAC1B,MAAM,0BAA0B,CAAC;AAKlC,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D;;;;GAIG;AACH,MAAM,OAAO,qBAAqB;IAKb;IADnB,YACmB,MAAgD;QAAhD,WAAM,GAAN,MAAM,CAA0C;IAChE,CAAC;IAEJ;;OAEG;IACH,KAAK,CAAC,MAAM,CAAC,GAAmB;QAC9B,MAAM,SAAS,GAAG,GAAG,CAAC,KAAK,CAAC,SAA0C,CAAC;QACvE,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;YAC5B,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;QAChE,CAAC;QAED,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QACzC,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,MAAM,IAAI,yBAAyB,CAAC;gBAClC,OAAO,EAAE,2BAA2B,SAAS,EAAE;gBAC/C,SAAS,EAAE,EAAE;aACd,CAAC,CAAC;QACL,CAAC;QAED,IAAI,GAAG,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YACjC,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;QAC3D,CAAC;QAED,MAAM,IAAI,GAAG,YAAY,CAAC,mBAAmB,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAE9D,MAAM,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAE1B,OAAO;YACL,UAAU,EAAE,IAAI,CAAC,iBAAiB,EAAE;YACpC,SAAS,EAAE,EAAE;SACd,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,27 @@
1
+ import type { CreateTableCommand, CreateTableOutput, DescribeTableCommand, DescribeTableOutput, ListTablesCommand, ListTablesOutput, PutItemCommand, PutItemCommandOutput } from "@aws-sdk/client-dynamodb";
2
+ import type { BackgroundScheduler } from "../../util/background/background.js";
3
+ /**
4
+ * Simulated DynamoDB. Handles SDK commands. Emulates AWS behaviour and state.
5
+ */
6
+ export declare class SimDynamoDb {
7
+ private readonly background;
8
+ private readonly tables;
9
+ constructor(background: BackgroundScheduler);
10
+ /**
11
+ * Handle a Create Table Command from the SDK.
12
+ */
13
+ createTable(cmd: CreateTableCommand): Promise<CreateTableOutput>;
14
+ /**
15
+ * Handle a List Tables Command from the SDK.
16
+ */
17
+ listTables(cmd: ListTablesCommand): Promise<ListTablesOutput>;
18
+ /**
19
+ * Handle a Describe Table Command from the SDK.
20
+ */
21
+ describeTable(cmd: DescribeTableCommand): Promise<DescribeTableOutput>;
22
+ /**
23
+ * Handle a Put Item Command from the SDK.
24
+ */
25
+ putItem(cmd: PutItemCommand): Promise<PutItemCommandOutput>;
26
+ }
27
+ //# sourceMappingURL=dynamodb.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dynamodb.d.ts","sourceRoot":"","sources":["../../../src/service/dynamodb/dynamodb.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,oBAAoB,EACrB,MAAM,0BAA0B,CAAC;AAMlC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAK/E;;GAEG;AACH,qBAAa,WAAW;IAGV,OAAO,CAAC,QAAQ,CAAC,UAAU;IAFvC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkD;gBAE5C,UAAU,EAAE,mBAAmB;IAE5D;;OAEG;IACG,WAAW,CAAC,GAAG,EAAE,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAKtE;;OAEG;IACG,UAAU,CAAC,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAKnE;;OAEG;IACG,aAAa,CAAC,GAAG,EAAE,oBAAoB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAK5E;;OAEG;IACG,OAAO,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,oBAAoB,CAAC;CAIlE"}
@@ -0,0 +1,43 @@
1
+ import { CreateTableCommandHandler } from "./command/create-table/create-table.handler.js";
2
+ import { ListTablesCommandHandler } from "./command/list-tables/list-tables.handler.js";
3
+ import { DescribeTableCommandHandler } from "./command/describe-table/describe-table.handler.js";
4
+ import { PutItemCommandHandler } from "./command/put-item/put-item.handler.js";
5
+ /**
6
+ * Simulated DynamoDB. Handles SDK commands. Emulates AWS behaviour and state.
7
+ */
8
+ export class SimDynamoDb {
9
+ background;
10
+ tables = new Map();
11
+ constructor(background) {
12
+ this.background = background;
13
+ }
14
+ /**
15
+ * Handle a Create Table Command from the SDK.
16
+ */
17
+ async createTable(cmd) {
18
+ const handler = new CreateTableCommandHandler(this.tables, this.background);
19
+ return await handler.handle(cmd);
20
+ }
21
+ /**
22
+ * Handle a List Tables Command from the SDK.
23
+ */
24
+ async listTables(cmd) {
25
+ const handler = new ListTablesCommandHandler(this.tables);
26
+ return await handler.handle(cmd);
27
+ }
28
+ /**
29
+ * Handle a Describe Table Command from the SDK.
30
+ */
31
+ async describeTable(cmd) {
32
+ const handler = new DescribeTableCommandHandler(this.tables);
33
+ return await handler.handle(cmd);
34
+ }
35
+ /**
36
+ * Handle a Put Item Command from the SDK.
37
+ */
38
+ async putItem(cmd) {
39
+ const handler = new PutItemCommandHandler(this.tables);
40
+ return await handler.handle(cmd);
41
+ }
42
+ }
43
+ //# sourceMappingURL=dynamodb.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dynamodb.js","sourceRoot":"","sources":["../../../src/service/dynamodb/dynamodb.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,yBAAyB,EAAE,MAAM,gDAAgD,CAAC;AAE3F,OAAO,EAAE,wBAAwB,EAAE,MAAM,8CAA8C,CAAC;AACxF,OAAO,EAAE,2BAA2B,EAAE,MAAM,oDAAoD,CAAC;AACjG,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAE/E;;GAEG;AACH,MAAM,OAAO,WAAW;IAGO;IAFZ,MAAM,GAAG,IAAI,GAAG,EAAuC,CAAC;IAEzE,YAA6B,UAA+B;QAA/B,eAAU,GAAV,UAAU,CAAqB;IAAG,CAAC;IAEhE;;OAEG;IACH,KAAK,CAAC,WAAW,CAAC,GAAuB;QACvC,MAAM,OAAO,GAAG,IAAI,yBAAyB,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QAC5E,OAAO,MAAM,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACnC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,UAAU,CAAC,GAAsB;QACrC,MAAM,OAAO,GAAG,IAAI,wBAAwB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC1D,OAAO,MAAM,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACnC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,aAAa,CAAC,GAAyB;QAC3C,MAAM,OAAO,GAAG,IAAI,2BAA2B,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC7D,OAAO,MAAM,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACnC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,OAAO,CAAC,GAAmB;QAC/B,MAAM,OAAO,GAAG,IAAI,qBAAqB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACvD,OAAO,MAAM,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACnC,CAAC;CACF"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/service/dynamodb/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.js.map