@kensio/yulin 1.10.5 → 1.11.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 (120) hide show
  1. package/dist/config/lint/cff-js2-lint.fixture.d.ts.map +1 -1
  2. package/dist/config/lint/cff-js2-lint.fixture.js +23 -0
  3. package/dist/config/lint/cff-js2-lint.fixture.js.map +1 -1
  4. package/dist/config/lint/cff-js2-restriction.d.ts +5 -5
  5. package/dist/config/lint/cff-js2-restriction.d.ts.map +1 -1
  6. package/dist/config/lint/cff-js2-restriction.js +11 -5
  7. package/dist/config/lint/cff-js2-restriction.js.map +1 -1
  8. package/dist/sdk/router/resolve-sim-sdk-command-router.d.ts.map +1 -1
  9. package/dist/sdk/router/resolve-sim-sdk-command-router.js +3 -0
  10. package/dist/sdk/router/resolve-sim-sdk-command-router.js.map +1 -1
  11. package/dist/service/aws/sim-aws-account-region-scope.d.ts +9 -0
  12. package/dist/service/aws/sim-aws-account-region-scope.d.ts.map +1 -1
  13. package/dist/service/aws/sim-aws-account-region-scope.js +10 -0
  14. package/dist/service/aws/sim-aws-account-region-scope.js.map +1 -1
  15. package/dist/service/aws/sim-aws-account.d.ts +5 -0
  16. package/dist/service/aws/sim-aws-account.d.ts.map +1 -1
  17. package/dist/service/aws/sim-aws-account.js +6 -0
  18. package/dist/service/aws/sim-aws-account.js.map +1 -1
  19. package/dist/service/aws/sim-aws-region.d.ts +5 -0
  20. package/dist/service/aws/sim-aws-region.d.ts.map +1 -1
  21. package/dist/service/aws/sim-aws-region.js +6 -0
  22. package/dist/service/aws/sim-aws-region.js.map +1 -1
  23. package/dist/service/aws/sim-aws-service-accessors.d.ts +5 -0
  24. package/dist/service/aws/sim-aws-service-accessors.d.ts.map +1 -1
  25. package/dist/service/aws/sim-aws-service-accessors.js +6 -0
  26. package/dist/service/aws/sim-aws-service-accessors.js.map +1 -1
  27. package/dist/service/cloudfront/command/key-value-store/sim-cf-create-key-value-store.d.ts +24 -0
  28. package/dist/service/cloudfront/command/key-value-store/sim-cf-create-key-value-store.d.ts.map +1 -0
  29. package/dist/service/cloudfront/command/key-value-store/sim-cf-create-key-value-store.js +43 -0
  30. package/dist/service/cloudfront/command/key-value-store/sim-cf-create-key-value-store.js.map +1 -0
  31. package/dist/service/cloudfront/command/key-value-store/sim-cf-delete-key-value-store.d.ts +26 -0
  32. package/dist/service/cloudfront/command/key-value-store/sim-cf-delete-key-value-store.d.ts.map +1 -0
  33. package/dist/service/cloudfront/command/key-value-store/sim-cf-delete-key-value-store.js +40 -0
  34. package/dist/service/cloudfront/command/key-value-store/sim-cf-delete-key-value-store.js.map +1 -0
  35. package/dist/service/cloudfront/command/key-value-store/sim-cf-describe-key-value-store.d.ts +24 -0
  36. package/dist/service/cloudfront/command/key-value-store/sim-cf-describe-key-value-store.d.ts.map +1 -0
  37. package/dist/service/cloudfront/command/key-value-store/sim-cf-describe-key-value-store.js +32 -0
  38. package/dist/service/cloudfront/command/key-value-store/sim-cf-describe-key-value-store.js.map +1 -0
  39. package/dist/service/cloudfront/command/key-value-store/sim-cf-key-value-store-command.types.d.ts +109 -0
  40. package/dist/service/cloudfront/command/key-value-store/sim-cf-key-value-store-command.types.d.ts.map +1 -0
  41. package/dist/service/cloudfront/command/key-value-store/sim-cf-key-value-store-command.types.js +12 -0
  42. package/dist/service/cloudfront/command/key-value-store/sim-cf-key-value-store-command.types.js.map +1 -0
  43. package/dist/service/cloudfront/command/key-value-store/sim-cf-key-value-store-summary.d.ts +10 -0
  44. package/dist/service/cloudfront/command/key-value-store/sim-cf-key-value-store-summary.d.ts.map +1 -0
  45. package/dist/service/cloudfront/command/key-value-store/sim-cf-key-value-store-summary.js +17 -0
  46. package/dist/service/cloudfront/command/key-value-store/sim-cf-key-value-store-summary.js.map +1 -0
  47. package/dist/service/cloudfront/command/key-value-store/sim-cf-list-key-value-stores.d.ts +20 -0
  48. package/dist/service/cloudfront/command/key-value-store/sim-cf-list-key-value-stores.d.ts.map +1 -0
  49. package/dist/service/cloudfront/command/key-value-store/sim-cf-list-key-value-stores.js +34 -0
  50. package/dist/service/cloudfront/command/key-value-store/sim-cf-list-key-value-stores.js.map +1 -0
  51. package/dist/service/cloudfront/command/key-value-store/sim-cf-update-key-value-store.d.ts +24 -0
  52. package/dist/service/cloudfront/command/key-value-store/sim-cf-update-key-value-store.d.ts.map +1 -0
  53. package/dist/service/cloudfront/command/key-value-store/sim-cf-update-key-value-store.js +35 -0
  54. package/dist/service/cloudfront/command/key-value-store/sim-cf-update-key-value-store.js.map +1 -0
  55. package/dist/service/cloudfront/command/key-value-store-data/sim-cf-key-value-store-data-command.types.d.ts +116 -0
  56. package/dist/service/cloudfront/command/key-value-store-data/sim-cf-key-value-store-data-command.types.d.ts.map +1 -0
  57. package/dist/service/cloudfront/command/key-value-store-data/sim-cf-key-value-store-data-command.types.js +12 -0
  58. package/dist/service/cloudfront/command/key-value-store-data/sim-cf-key-value-store-data-command.types.js.map +1 -0
  59. package/dist/service/cloudfront/command/key-value-store-data/sim-kvs-batch.d.ts +22 -0
  60. package/dist/service/cloudfront/command/key-value-store-data/sim-kvs-batch.d.ts.map +1 -0
  61. package/dist/service/cloudfront/command/key-value-store-data/sim-kvs-batch.js +26 -0
  62. package/dist/service/cloudfront/command/key-value-store-data/sim-kvs-batch.js.map +1 -0
  63. package/dist/service/cloudfront/command/key-value-store-data/sim-kvs-key-reads.d.ts +37 -0
  64. package/dist/service/cloudfront/command/key-value-store-data/sim-kvs-key-reads.d.ts.map +1 -0
  65. package/dist/service/cloudfront/command/key-value-store-data/sim-kvs-key-reads.js +67 -0
  66. package/dist/service/cloudfront/command/key-value-store-data/sim-kvs-key-reads.js.map +1 -0
  67. package/dist/service/cloudfront/command/key-value-store-data/sim-kvs-key-writes.d.ts +43 -0
  68. package/dist/service/cloudfront/command/key-value-store-data/sim-kvs-key-writes.d.ts.map +1 -0
  69. package/dist/service/cloudfront/command/key-value-store-data/sim-kvs-key-writes.js +81 -0
  70. package/dist/service/cloudfront/command/key-value-store-data/sim-kvs-key-writes.js.map +1 -0
  71. package/dist/service/cloudfront/error/sim-cloudfront.error.d.ts +63 -0
  72. package/dist/service/cloudfront/error/sim-cloudfront.error.d.ts.map +1 -1
  73. package/dist/service/cloudfront/error/sim-cloudfront.error.js +75 -0
  74. package/dist/service/cloudfront/error/sim-cloudfront.error.js.map +1 -1
  75. package/dist/service/cloudfront/index.d.ts +3 -0
  76. package/dist/service/cloudfront/index.d.ts.map +1 -1
  77. package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store-access.d.ts +57 -0
  78. package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store-access.d.ts.map +1 -0
  79. package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store-access.js +72 -0
  80. package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store-access.js.map +1 -0
  81. package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store-commands.d.ts +51 -0
  82. package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store-commands.d.ts.map +1 -0
  83. package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store-commands.js +65 -0
  84. package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store-commands.js.map +1 -0
  85. package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store-keys.d.ts +72 -0
  86. package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store-keys.d.ts.map +1 -0
  87. package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store-keys.js +94 -0
  88. package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store-keys.js.map +1 -0
  89. package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store-registry.d.ts +59 -0
  90. package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store-registry.d.ts.map +1 -0
  91. package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store-registry.js +92 -0
  92. package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store-registry.js.map +1 -0
  93. package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store-users.d.ts +22 -0
  94. package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store-users.d.ts.map +1 -0
  95. package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store-users.js +7 -0
  96. package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store-users.js.map +1 -0
  97. package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store.d.ts +141 -0
  98. package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store.d.ts.map +1 -0
  99. package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store.js +180 -0
  100. package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store.js.map +1 -0
  101. package/dist/service/cloudfront/sdk/sim-cf-key-value-store-sdk-command-router.d.ts +24 -0
  102. package/dist/service/cloudfront/sdk/sim-cf-key-value-store-sdk-command-router.d.ts.map +1 -0
  103. package/dist/service/cloudfront/sdk/sim-cf-key-value-store-sdk-command-router.js +54 -0
  104. package/dist/service/cloudfront/sdk/sim-cf-key-value-store-sdk-command-router.js.map +1 -0
  105. package/dist/service/cloudfront/sdk/sim-cloudfront-sdk-command-router.d.ts.map +1 -1
  106. package/dist/service/cloudfront/sdk/sim-cloudfront-sdk-command-router.js +30 -0
  107. package/dist/service/cloudfront/sdk/sim-cloudfront-sdk-command-router.js.map +1 -1
  108. package/dist/service/cloudfront/sim-cloudfront-commands.d.ts +10 -0
  109. package/dist/service/cloudfront/sim-cloudfront-commands.d.ts.map +1 -1
  110. package/dist/service/cloudfront/sim-cloudfront-commands.js +22 -0
  111. package/dist/service/cloudfront/sim-cloudfront-commands.js.map +1 -1
  112. package/dist/service/cloudfront/sim-cloudfront-key-value-store.d.ts +58 -0
  113. package/dist/service/cloudfront/sim-cloudfront-key-value-store.d.ts.map +1 -0
  114. package/dist/service/cloudfront/sim-cloudfront-key-value-store.js +68 -0
  115. package/dist/service/cloudfront/sim-cloudfront-key-value-store.js.map +1 -0
  116. package/dist/service/cloudfront/sim-cloudfront.d.ts +13 -0
  117. package/dist/service/cloudfront/sim-cloudfront.d.ts.map +1 -1
  118. package/dist/service/cloudfront/sim-cloudfront.js +15 -0
  119. package/dist/service/cloudfront/sim-cloudfront.js.map +1 -1
  120. package/package.json +2 -1
@@ -0,0 +1,65 @@
1
+ import { SimCfCreateKeyValueStore } from "../command/key-value-store/sim-cf-create-key-value-store.js";
2
+ import { SimCfDeleteKeyValueStore } from "../command/key-value-store/sim-cf-delete-key-value-store.js";
3
+ import { SimCfDescribeKeyValueStore } from "../command/key-value-store/sim-cf-describe-key-value-store.js";
4
+ import { SimCfListKeyValueStores } from "../command/key-value-store/sim-cf-list-key-value-stores.js";
5
+ import { SimCfUpdateKeyValueStore } from "../command/key-value-store/sim-cf-update-key-value-store.js";
6
+ import { noKeyValueStoreUsers, } from "./sim-cf-key-value-store-users.js";
7
+ /**
8
+ * The key value store commands on the CloudFront client.
9
+ *
10
+ * These are the five that own the resource. They are grouped here rather than
11
+ * on SimCloudFrontCommands beside the Distribution and Function commands
12
+ * because they share a collaborator none of those need, and because there are
13
+ * enough of them to be their own thing.
14
+ */
15
+ export class SimCfKeyValueStoreCommands {
16
+ access;
17
+ users;
18
+ constructor(access, users = noKeyValueStoreUsers) {
19
+ this.access = access;
20
+ this.users = users;
21
+ }
22
+ /**
23
+ * Get a key value store by name, for asserting on its state directly.
24
+ */
25
+ byName(storeName) {
26
+ return this.access.stores.byName(storeName);
27
+ }
28
+ /**
29
+ * Get a key value store by ID.
30
+ */
31
+ byId(storeId) {
32
+ return this.access.stores.byId(storeId);
33
+ }
34
+ /**
35
+ * Handle a Create Key Value Store Command from the SDK.
36
+ */
37
+ async createKeyValueStore(command, options) {
38
+ return await new SimCfCreateKeyValueStore(this.access).handle(command, options);
39
+ }
40
+ /**
41
+ * Handle a Describe Key Value Store Command from the SDK.
42
+ */
43
+ async describeKeyValueStore(command, options) {
44
+ return await new SimCfDescribeKeyValueStore(this.access).handle(command, options);
45
+ }
46
+ /**
47
+ * Handle a List Key Value Stores Command from the SDK.
48
+ */
49
+ async listKeyValueStores(command, options) {
50
+ return await new SimCfListKeyValueStores(this.access).handle(command, options);
51
+ }
52
+ /**
53
+ * Handle an Update Key Value Store Command from the SDK.
54
+ */
55
+ async updateKeyValueStore(command, options) {
56
+ return await new SimCfUpdateKeyValueStore(this.access).handle(command, options);
57
+ }
58
+ /**
59
+ * Handle a Delete Key Value Store Command from the SDK.
60
+ */
61
+ async deleteKeyValueStore(command, options) {
62
+ return await new SimCfDeleteKeyValueStore(this.access, this.users).handle(command, options);
63
+ }
64
+ }
65
+ //# sourceMappingURL=sim-cf-key-value-store-commands.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-cf-key-value-store-commands.js","sourceRoot":"","sources":["../../../../src/service/cloudfront/key-value-store/sim-cf-key-value-store-commands.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,6DAA6D,CAAC;AACvG,OAAO,EAAE,wBAAwB,EAAE,MAAM,6DAA6D,CAAC;AACvG,OAAO,EAAE,0BAA0B,EAAE,MAAM,+DAA+D,CAAC;AAC3G,OAAO,EAAE,uBAAuB,EAAE,MAAM,4DAA4D,CAAC;AACrG,OAAO,EAAE,wBAAwB,EAAE,MAAM,6DAA6D,CAAC;AAkBvG,OAAO,EACL,oBAAoB,GAErB,MAAM,mCAAmC,CAAC;AAM3C;;;;;;;GAOG;AACH,MAAM,OAAO,0BAA0B;IAIlB,MAAM;IAHR,KAAK,CAA0B;IAEhD,YACmB,MAAgC,EACjD,KAAK,GAA4B,oBAAoB;sBADpC,MAAM;QAGvB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,SAAiB;QACtB,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAC9C,CAAC;IAED;;OAEG;IACH,IAAI,CACF,OAA8C;QAE9C,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC1C,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,mBAAmB,CACvB,OAAsC,EACtC,OAAqC;QAErC,OAAO,MAAM,IAAI,wBAAwB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,CAC3D,OAAO,EACP,OAAO,CACR,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,qBAAqB,CACzB,OAAwC,EACxC,OAAqC;QAErC,OAAO,MAAM,IAAI,0BAA0B,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,CAC7D,OAAO,EACP,OAAO,CACR,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,kBAAkB,CACtB,OAAqC,EACrC,OAAqC;QAErC,OAAO,MAAM,IAAI,uBAAuB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,CAC1D,OAAO,EACP,OAAO,CACR,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,mBAAmB,CACvB,OAAsC,EACtC,OAAqC;QAErC,OAAO,MAAM,IAAI,wBAAwB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,CAC3D,OAAO,EACP,OAAO,CACR,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,mBAAmB,CACvB,OAAsC,EACtC,OAAqC;QAErC,OAAO,MAAM,IAAI,wBAAwB,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CACvE,OAAO,EACP,OAAO,CACR,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,72 @@
1
+ /**
2
+ * One key and its value, as the key value store data API returns a pair.
3
+ */
4
+ export interface SimCloudFrontKeyValuePair {
5
+ readonly Key: string;
6
+ readonly Value: string;
7
+ }
8
+ /**
9
+ * The keys one simulated CloudFront key value store holds.
10
+ *
11
+ * Kept apart from the store itself because the store is an AWS resource with
12
+ * an identity, a status and an ETag, while this is the map underneath it. The
13
+ * two change for different reasons: a key write touches this, and a rename
14
+ * touches the store.
15
+ *
16
+ * Values are strings. The data API takes and returns strings, and the `json`
17
+ * and `bytes` formats a Function can ask for are parsings of the stored string
18
+ * rather than separate stored types.
19
+ */
20
+ export declare class SimCloudFrontKeyValueStoreKeys {
21
+ private readonly pairs;
22
+ /**
23
+ * Write a key, replacing a value already stored under it.
24
+ */
25
+ put(key: string, value: string): void;
26
+ /**
27
+ * Apply a batch of puts and then a batch of deletes.
28
+ *
29
+ * Every write in the data API is this: PutKey is one put, DeleteKey is one
30
+ * delete, and UpdateKeys is both. The deletes land last, so a key in both is
31
+ * deleted, which is what the data API does with a batch naming one twice.
32
+ */
33
+ applyBatch(puts: readonly SimCloudFrontKeyValuePair[], deletes: readonly {
34
+ readonly Key: string;
35
+ }[]): void;
36
+ /**
37
+ * Forget a key.
38
+ *
39
+ * Deleting a key that is not there is not an error, which is what the data
40
+ * API does: DeleteKey is idempotent.
41
+ */
42
+ delete(key: string): void;
43
+ /**
44
+ * Read a key, refusing one that is not stored.
45
+ *
46
+ * The data API answers a missing key with ResourceNotFoundException rather
47
+ * than an empty value, and a Function's `get` rejects for the same reason,
48
+ * so there is nothing here that should hand back undefined.
49
+ */
50
+ get(key: string): string;
51
+ /**
52
+ * Whether a key is stored.
53
+ */
54
+ has(key: string): boolean;
55
+ /**
56
+ * Every key and value, in the order they were first written.
57
+ */
58
+ list(): readonly SimCloudFrontKeyValuePair[];
59
+ /**
60
+ * How many keys are stored.
61
+ */
62
+ get itemCount(): number;
63
+ /**
64
+ * The size of the stored data in bytes.
65
+ *
66
+ * CloudFront counts a key value store against a size quota, and the data API
67
+ * reports this alongside the item count on every write. Both the key and the
68
+ * value count towards it.
69
+ */
70
+ get totalSizeInBytes(): number;
71
+ }
72
+ //# sourceMappingURL=sim-cf-key-value-store-keys.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-cf-key-value-store-keys.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudfront/key-value-store/sim-cf-key-value-store-keys.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;;;GAWG;AACH,qBAAa,8BAA8B;IACzC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA6B;IAEnD;;OAEG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAEpC;IAED;;;;;;OAMG;IACH,UAAU,CACR,IAAI,EAAE,SAAS,yBAAyB,EAAE,EAC1C,OAAO,EAAE,SAAS;QAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;KAAE,EAAE,GAC3C,IAAI,CAQN;IAED;;;;;OAKG;IACH,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAExB;IAED;;;;;;OAMG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAUvB;IAED;;OAEG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAExB;IAED;;OAEG;IACH,IAAI,IAAI,SAAS,yBAAyB,EAAE,CAK3C;IAED;;OAEG;IACH,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED;;;;;;OAMG;IACH,IAAI,gBAAgB,IAAI,MAAM,CAQ7B;CACF"}
@@ -0,0 +1,94 @@
1
+ import { SimCloudFrontKeyValueStoreKeyNotFound } from "../error/sim-cloudfront.error.js";
2
+ /**
3
+ * The keys one simulated CloudFront key value store holds.
4
+ *
5
+ * Kept apart from the store itself because the store is an AWS resource with
6
+ * an identity, a status and an ETag, while this is the map underneath it. The
7
+ * two change for different reasons: a key write touches this, and a rename
8
+ * touches the store.
9
+ *
10
+ * Values are strings. The data API takes and returns strings, and the `json`
11
+ * and `bytes` formats a Function can ask for are parsings of the stored string
12
+ * rather than separate stored types.
13
+ */
14
+ export class SimCloudFrontKeyValueStoreKeys {
15
+ pairs = new Map();
16
+ /**
17
+ * Write a key, replacing a value already stored under it.
18
+ */
19
+ put(key, value) {
20
+ this.pairs.set(key, value);
21
+ }
22
+ /**
23
+ * Apply a batch of puts and then a batch of deletes.
24
+ *
25
+ * Every write in the data API is this: PutKey is one put, DeleteKey is one
26
+ * delete, and UpdateKeys is both. The deletes land last, so a key in both is
27
+ * deleted, which is what the data API does with a batch naming one twice.
28
+ */
29
+ applyBatch(puts, deletes) {
30
+ for (const put of puts) {
31
+ this.put(put.Key, put.Value);
32
+ }
33
+ for (const remove of deletes) {
34
+ this.delete(remove.Key);
35
+ }
36
+ }
37
+ /**
38
+ * Forget a key.
39
+ *
40
+ * Deleting a key that is not there is not an error, which is what the data
41
+ * API does: DeleteKey is idempotent.
42
+ */
43
+ delete(key) {
44
+ this.pairs.delete(key);
45
+ }
46
+ /**
47
+ * Read a key, refusing one that is not stored.
48
+ *
49
+ * The data API answers a missing key with ResourceNotFoundException rather
50
+ * than an empty value, and a Function's `get` rejects for the same reason,
51
+ * so there is nothing here that should hand back undefined.
52
+ */
53
+ get(key) {
54
+ const value = this.pairs.get(key);
55
+ if (value === undefined) {
56
+ throw new SimCloudFrontKeyValueStoreKeyNotFound(`Sim CloudFront key value store has no key ${key}`);
57
+ }
58
+ return value;
59
+ }
60
+ /**
61
+ * Whether a key is stored.
62
+ */
63
+ has(key) {
64
+ return this.pairs.has(key);
65
+ }
66
+ /**
67
+ * Every key and value, in the order they were first written.
68
+ */
69
+ list() {
70
+ return this.pairs
71
+ .entries()
72
+ .map(([key, value]) => ({ Key: key, Value: value }))
73
+ .toArray();
74
+ }
75
+ /**
76
+ * How many keys are stored.
77
+ */
78
+ get itemCount() {
79
+ return this.pairs.size;
80
+ }
81
+ /**
82
+ * The size of the stored data in bytes.
83
+ *
84
+ * CloudFront counts a key value store against a size quota, and the data API
85
+ * reports this alongside the item count on every write. Both the key and the
86
+ * value count towards it.
87
+ */
88
+ get totalSizeInBytes() {
89
+ return this.pairs
90
+ .entries()
91
+ .reduce((total, [key, value]) => total + Buffer.byteLength(key) + Buffer.byteLength(value), 0);
92
+ }
93
+ }
94
+ //# sourceMappingURL=sim-cf-key-value-store-keys.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-cf-key-value-store-keys.js","sourceRoot":"","sources":["../../../../src/service/cloudfront/key-value-store/sim-cf-key-value-store-keys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qCAAqC,EAAE,MAAM,kCAAkC,CAAC;AAUzF;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,8BAA8B;IACxB,KAAK,GAAG,IAAI,GAAG,EAAkB,CAAC;IAEnD;;OAEG;IACH,GAAG,CAAC,GAAW,EAAE,KAAa;QAC5B,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAC7B,CAAC;IAED;;;;;;OAMG;IACH,UAAU,CACR,IAA0C,EAC1C,OAA4C;QAE5C,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;YACvB,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC;QAED,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC7B,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,GAAW;QAChB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC;IAED;;;;;;OAMG;IACH,GAAG,CAAC,GAAW;QACb,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAElC,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,MAAM,IAAI,qCAAqC,CAC7C,6CAA6C,GAAG,EAAE,CACnD,CAAC;QACJ,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;OAEG;IACH,GAAG,CAAC,GAAW;QACb,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;IAED;;OAEG;IACH,IAAI;QACF,OAAO,IAAI,CAAC,KAAK;aACd,OAAO,EAAE;aACT,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;aACnD,OAAO,EAAE,CAAC;IACf,CAAC;IAED;;OAEG;IACH,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;IACzB,CAAC;IAED;;;;;;OAMG;IACH,IAAI,gBAAgB;QAClB,OAAO,IAAI,CAAC,KAAK;aACd,OAAO,EAAE;aACT,MAAM,CACL,CAAC,KAAK,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CACtB,KAAK,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,EAC3D,CAAC,CACF,CAAC;IACN,CAAC;CACF"}
@@ -0,0 +1,59 @@
1
+ import type { SimCloudFrontKeyValueStore, SimCloudFrontKeyValueStoreId } from "./sim-cf-key-value-store.js";
2
+ /**
3
+ * The key value stores one simulated CloudFront holds.
4
+ *
5
+ * A store is found three ways, because each API reaches for a different one.
6
+ * The CloudFront client names a store by ID, the data API addresses it by ARN,
7
+ * and the name is what decides whether a new one may be stored.
8
+ */
9
+ export declare class SimCloudFrontKeyValueStoreRegistry {
10
+ private readonly stores;
11
+ /**
12
+ * Store a key value store, refusing a name another one already holds as
13
+ * CloudFront refuses it.
14
+ */
15
+ add(store: SimCloudFrontKeyValueStore): void;
16
+ /**
17
+ * Forget a key value store.
18
+ */
19
+ remove(storeId: SimCloudFrontKeyValueStoreId): void;
20
+ /**
21
+ * Get a key value store by ID.
22
+ */
23
+ byId(storeId: SimCloudFrontKeyValueStoreId | string): SimCloudFrontKeyValueStore | undefined;
24
+ /**
25
+ * Get a key value store by name.
26
+ */
27
+ byName(storeName: string): SimCloudFrontKeyValueStore | undefined;
28
+ /**
29
+ * Get a key value store by ARN.
30
+ */
31
+ byArn(storeArn: string): SimCloudFrontKeyValueStore | undefined;
32
+ /**
33
+ * Get a key value store by ID, refusing one this Account does not hold.
34
+ */
35
+ requireById(storeId: SimCloudFrontKeyValueStoreId | string): SimCloudFrontKeyValueStore;
36
+ /**
37
+ * Get a key value store by name, refusing one this Account does not hold.
38
+ *
39
+ * This is how the CloudFront client reaches a store: Describe, Update and
40
+ * Delete all take the name rather than the ID.
41
+ */
42
+ requireByName(storeName: string): SimCloudFrontKeyValueStore;
43
+ /**
44
+ * Get a key value store by ARN, refusing one this Account does not hold.
45
+ *
46
+ * This is the data API's way in, so the refusal is that API's own
47
+ * ResourceNotFoundException rather than CloudFront's EntityNotFound: the two
48
+ * clients have separate error sets, and EntityNotFound is not in this one.
49
+ *
50
+ * The ARN it was given is quoted back on a miss, because a store in another
51
+ * Account and a store that was deleted both arrive here.
52
+ */
53
+ requireByArn(storeArn: string): SimCloudFrontKeyValueStore;
54
+ /**
55
+ * Every key value store this Account holds.
56
+ */
57
+ all(): readonly SimCloudFrontKeyValueStore[];
58
+ }
59
+ //# sourceMappingURL=sim-cf-key-value-store-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-cf-key-value-store-registry.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudfront/key-value-store/sim-cf-key-value-store-registry.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,0BAA0B,EAC1B,4BAA4B,EAE7B,MAAM,6BAA6B,CAAC;AAErC;;;;;;GAMG;AACH,qBAAa,kCAAkC;IAC7C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA4C;IAEnE;;;OAGG;IACH,GAAG,CAAC,KAAK,EAAE,0BAA0B,GAAG,IAAI,CAQ3C;IAED;;OAEG;IACH,MAAM,CAAC,OAAO,EAAE,4BAA4B,GAAG,IAAI,CAElD;IAED;;OAEG;IACH,IAAI,CACF,OAAO,EAAE,4BAA4B,GAAG,MAAM,GAC7C,0BAA0B,GAAG,SAAS,CAExC;IAED;;OAEG;IACH,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,0BAA0B,GAAG,SAAS,CAEhE;IAED;;OAEG;IACH,KAAK,CAAC,QAAQ,EAAE,MAAM,GAAG,0BAA0B,GAAG,SAAS,CAE9D;IAED;;OAEG;IACH,WAAW,CACT,OAAO,EAAE,4BAA4B,GAAG,MAAM,GAC7C,0BAA0B,CAU5B;IAED;;;;;OAKG;IACH,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,0BAA0B,CAU3D;IAED;;;;;;;;;OASG;IACH,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,0BAA0B,CAUzD;IAED;;OAEG;IACH,GAAG,IAAI,SAAS,0BAA0B,EAAE,CAE3C;CACF"}
@@ -0,0 +1,92 @@
1
+ import { SimCloudFrontEntityAlreadyExists, SimCloudFrontEntityNotFound, SimCloudFrontKeyValueStoreNotFound, } from "../error/sim-cloudfront.error.js";
2
+ /**
3
+ * The key value stores one simulated CloudFront holds.
4
+ *
5
+ * A store is found three ways, because each API reaches for a different one.
6
+ * The CloudFront client names a store by ID, the data API addresses it by ARN,
7
+ * and the name is what decides whether a new one may be stored.
8
+ */
9
+ export class SimCloudFrontKeyValueStoreRegistry {
10
+ stores = new Map();
11
+ /**
12
+ * Store a key value store, refusing a name another one already holds as
13
+ * CloudFront refuses it.
14
+ */
15
+ add(store) {
16
+ if (this.byName(store.name) !== undefined) {
17
+ throw new SimCloudFrontEntityAlreadyExists(`Sim CloudFront key value store ${store.name} already exists`);
18
+ }
19
+ this.stores.set(store.id, store);
20
+ }
21
+ /**
22
+ * Forget a key value store.
23
+ */
24
+ remove(storeId) {
25
+ this.stores.delete(storeId);
26
+ }
27
+ /**
28
+ * Get a key value store by ID.
29
+ */
30
+ byId(storeId) {
31
+ return this.stores.get(storeId);
32
+ }
33
+ /**
34
+ * Get a key value store by name.
35
+ */
36
+ byName(storeName) {
37
+ return this.stores.values().find((store) => store.name === storeName);
38
+ }
39
+ /**
40
+ * Get a key value store by ARN.
41
+ */
42
+ byArn(storeArn) {
43
+ return this.stores.values().find((store) => store.arn === storeArn);
44
+ }
45
+ /**
46
+ * Get a key value store by ID, refusing one this Account does not hold.
47
+ */
48
+ requireById(storeId) {
49
+ const store = this.byId(storeId);
50
+ if (store === undefined) {
51
+ throw new SimCloudFrontEntityNotFound(`Sim CloudFront has no key value store with ID ${storeId}`);
52
+ }
53
+ return store;
54
+ }
55
+ /**
56
+ * Get a key value store by name, refusing one this Account does not hold.
57
+ *
58
+ * This is how the CloudFront client reaches a store: Describe, Update and
59
+ * Delete all take the name rather than the ID.
60
+ */
61
+ requireByName(storeName) {
62
+ const store = this.byName(storeName);
63
+ if (store === undefined) {
64
+ throw new SimCloudFrontEntityNotFound(`Sim CloudFront has no key value store named ${storeName}`);
65
+ }
66
+ return store;
67
+ }
68
+ /**
69
+ * Get a key value store by ARN, refusing one this Account does not hold.
70
+ *
71
+ * This is the data API's way in, so the refusal is that API's own
72
+ * ResourceNotFoundException rather than CloudFront's EntityNotFound: the two
73
+ * clients have separate error sets, and EntityNotFound is not in this one.
74
+ *
75
+ * The ARN it was given is quoted back on a miss, because a store in another
76
+ * Account and a store that was deleted both arrive here.
77
+ */
78
+ requireByArn(storeArn) {
79
+ const store = this.byArn(storeArn);
80
+ if (store === undefined) {
81
+ throw new SimCloudFrontKeyValueStoreNotFound(`Sim CloudFront has no key value store with ARN ${storeArn}`);
82
+ }
83
+ return store;
84
+ }
85
+ /**
86
+ * Every key value store this Account holds.
87
+ */
88
+ all() {
89
+ return this.stores.values().toArray();
90
+ }
91
+ }
92
+ //# sourceMappingURL=sim-cf-key-value-store-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-cf-key-value-store-registry.js","sourceRoot":"","sources":["../../../../src/service/cloudfront/key-value-store/sim-cf-key-value-store-registry.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gCAAgC,EAChC,2BAA2B,EAC3B,kCAAkC,GACnC,MAAM,kCAAkC,CAAC;AAO1C;;;;;;GAMG;AACH,MAAM,OAAO,kCAAkC;IAC5B,MAAM,GAAkC,IAAI,GAAG,EAAE,CAAC;IAEnE;;;OAGG;IACH,GAAG,CAAC,KAAiC;QACnC,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,SAAS,EAAE,CAAC;YAC1C,MAAM,IAAI,gCAAgC,CACxC,kCAAkC,KAAK,CAAC,IAAI,iBAAiB,CAC9D,CAAC;QACJ,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;IACnC,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,OAAqC;QAC1C,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;IAED;;OAEG;IACH,IAAI,CACF,OAA8C;QAE9C,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,OAAuC,CAAC,CAAC;IAClE,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,SAAiB;QACtB,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC;IACxE,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,QAAgB;QACpB,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,KAAK,QAAQ,CAAC,CAAC;IACtE,CAAC;IAED;;OAEG;IACH,WAAW,CACT,OAA8C;QAE9C,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAEjC,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,MAAM,IAAI,2BAA2B,CACnC,iDAAiD,OAAO,EAAE,CAC3D,CAAC;QACJ,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;;OAKG;IACH,aAAa,CAAC,SAAiB;QAC7B,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAErC,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,MAAM,IAAI,2BAA2B,CACnC,+CAA+C,SAAS,EAAE,CAC3D,CAAC;QACJ,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;;;;;;OASG;IACH,YAAY,CAAC,QAAgB;QAC3B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAEnC,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,MAAM,IAAI,kCAAkC,CAC1C,kDAAkD,QAAQ,EAAE,CAC7D,CAAC;QACJ,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;OAEG;IACH,GAAG;QACD,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,CAAC;IACxC,CAAC;CACF"}
@@ -0,0 +1,22 @@
1
+ import type { SimCloudFrontKeyValueStoreId } from "./sim-cf-key-value-store.js";
2
+ /**
3
+ * What still uses a key value store, which decides whether it can be deleted.
4
+ *
5
+ * CloudFront refuses to delete a store a Function is still associated with, so
6
+ * the delete command has to ask something what is using it. That something is
7
+ * the Function map, and a Function cannot be associated with a store yet: the
8
+ * association arrives with the runtime read path. Until then the answer is
9
+ * always nothing, and the guard is here so that wiring the real one in is a
10
+ * change of collaborator rather than a change to the delete command.
11
+ */
12
+ export interface SimCfKeyValueStoreUsers {
13
+ /**
14
+ * The names of the CloudFront Functions associated with a key value store.
15
+ */
16
+ functionsUsing(storeId: SimCloudFrontKeyValueStoreId): readonly string[];
17
+ }
18
+ /**
19
+ * Nothing uses any key value store.
20
+ */
21
+ export declare const noKeyValueStoreUsers: SimCfKeyValueStoreUsers;
22
+ //# sourceMappingURL=sim-cf-key-value-store-users.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-cf-key-value-store-users.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudfront/key-value-store/sim-cf-key-value-store-users.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAC;AAEhF;;;;;;;;;GASG;AACH,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,cAAc,CAAC,OAAO,EAAE,4BAA4B,GAAG,SAAS,MAAM,EAAE,CAAC;CAC1E;AAED;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,uBAElC,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Nothing uses any key value store.
3
+ */
4
+ export const noKeyValueStoreUsers = {
5
+ functionsUsing: () => [],
6
+ };
7
+ //# sourceMappingURL=sim-cf-key-value-store-users.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-cf-key-value-store-users.js","sourceRoot":"","sources":["../../../../src/service/cloudfront/key-value-store/sim-cf-key-value-store-users.ts"],"names":[],"mappings":"AAmBA;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAA4B;IAC3D,cAAc,EAAE,GAAsB,EAAE,CAAC,EAAE;CAC5C,CAAC"}
@@ -0,0 +1,141 @@
1
+ import type { Brand } from "../../../util/brand.type.js";
2
+ import type { SimArn } from "../../aws/arn.js";
3
+ import { type SimAwsAccountId } from "../../aws/sim-aws-account.js";
4
+ import { type SimCloudFrontKeyValuePair, SimCloudFrontKeyValueStoreKeys } from "./sim-cf-key-value-store-keys.js";
5
+ export type SimCloudFrontKeyValueStoreId = Brand<string, "SimCloudFrontKeyValueStoreId">;
6
+ /**
7
+ * A key value store is PROVISIONING until CloudFront has it ready to serve.
8
+ */
9
+ export type SimCloudFrontKeyValueStoreStatus = "PROVISIONING" | "READY";
10
+ interface SimCloudFrontKeyValueStoreProperties {
11
+ readonly id?: SimCloudFrontKeyValueStoreId;
12
+ readonly name: string;
13
+ readonly comment?: string | undefined;
14
+ readonly accountId?: SimAwsAccountId;
15
+ readonly status?: SimCloudFrontKeyValueStoreStatus;
16
+ readonly lastModifiedTime?: Date;
17
+ }
18
+ /**
19
+ * Simulated CloudFront key value store.
20
+ *
21
+ * A key value store holds data a CloudFront Function reads at request time,
22
+ * which is how a Function gets a redirect table or a feature flag without
23
+ * having the value baked into its code. The Function reads it and never writes
24
+ * to it: writes come from the separate key value store data API.
25
+ *
26
+ * The store is reached through two different SDK clients in AWS, and both are
27
+ * simulated. The CloudFront client owns the resource, so it creates, describes,
28
+ * renames and deletes the store. The key value store client owns the data, so
29
+ * it reads and writes the keys, addressing the store by ARN.
30
+ *
31
+ * https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/kvs-with-functions.html
32
+ */
33
+ export declare class SimCloudFrontKeyValueStore {
34
+ #private;
35
+ readonly id: SimCloudFrontKeyValueStoreId;
36
+ readonly accountId: SimAwsAccountId;
37
+ readonly keys: SimCloudFrontKeyValueStoreKeys;
38
+ /**
39
+ * When this key value store was created, which the data API reports and the
40
+ * CloudFront client does not.
41
+ */
42
+ readonly createdTime: Date;
43
+ constructor(properties: SimCloudFrontKeyValueStoreProperties);
44
+ /**
45
+ * The name this key value store is known by, which is unique per Account.
46
+ */
47
+ get name(): string;
48
+ /**
49
+ * The comment stored with this key value store, if it has one.
50
+ */
51
+ get comment(): string | undefined;
52
+ /**
53
+ * The current status of this key value store.
54
+ */
55
+ get status(): SimCloudFrontKeyValueStoreStatus;
56
+ /**
57
+ * When this key value store was last changed, by either API.
58
+ */
59
+ get lastModifiedTime(): Date;
60
+ /**
61
+ * The ETag of the resource, which the CloudFront client works against.
62
+ *
63
+ * A store has two ETags and they are not interchangeable, which is what AWS
64
+ * has: each of the two DescribeKeyValueStore operations returns its own, and
65
+ * a write has to carry the one belonging to the API it is calling. This one
66
+ * versions the store's configuration, so a key write does not move it and a
67
+ * comment change does.
68
+ *
69
+ * https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/kvs-with-functions-get-reference.html
70
+ */
71
+ get resourceETag(): string;
72
+ /**
73
+ * The ETag of the data, which the key value store client works against.
74
+ *
75
+ * This one versions the keys, so a key write moves it and a comment change
76
+ * does not. See resourceETag for why there are two.
77
+ */
78
+ get dataETag(): string;
79
+ /**
80
+ * The ARN for this key value store.
81
+ *
82
+ * CloudFront is a global service, so the Region is empty, the same way a
83
+ * Distribution and a Function ARN have no Region.
84
+ */
85
+ get arn(): SimArn;
86
+ /**
87
+ * Move this key value store to the READY status.
88
+ */
89
+ ready(): Promise<void>;
90
+ /**
91
+ * Rename this key value store, or change its comment.
92
+ */
93
+ update(properties: {
94
+ readonly name?: string | undefined;
95
+ readonly comment?: string | undefined;
96
+ }): void;
97
+ /**
98
+ * Refuse a CloudFront client write whose ETag is not the resource's.
99
+ *
100
+ * CloudFront takes IfMatch on every write and refuses a stale one, which is
101
+ * what stops two writers overwriting each other. Yulin enforces it here
102
+ * rather than accepting and ignoring it, so a caller that does not thread the
103
+ * ETag through fails the way it would fail against CloudFront.
104
+ */
105
+ assertResourceETag(ifMatch: string): void;
106
+ /**
107
+ * Refuse a data API write whose ETag is not the data's.
108
+ */
109
+ assertDataETag(ifMatch: string): void;
110
+ /**
111
+ * Record that this store's configuration changed.
112
+ */
113
+ touchResource(lastModifiedTime?: Date): void;
114
+ /**
115
+ * Record that this store's keys changed.
116
+ */
117
+ touchData(lastModifiedTime?: Date): void;
118
+ /**
119
+ * Every key and value this store holds.
120
+ */
121
+ listKeys(): readonly SimCloudFrontKeyValuePair[];
122
+ /**
123
+ * Refuse a write against the wrong version of one side of the store.
124
+ *
125
+ * The side is named in the message because the two ETags are not
126
+ * interchangeable, and reaching for the other API's ETag is the mistake this
127
+ * is most likely to be catching.
128
+ */
129
+ private assertETag;
130
+ }
131
+ export type SimCloudFrontKeyValueStoreMap = Map<SimCloudFrontKeyValueStoreId, SimCloudFrontKeyValueStore>;
132
+ /**
133
+ * Generate a fake key value store ID, in the shape CloudFront gives one.
134
+ */
135
+ export declare function makeKeyValueStoreId(): SimCloudFrontKeyValueStoreId;
136
+ /**
137
+ * Generate a fake ETag, in the shape CloudFront gives one.
138
+ */
139
+ export declare function makeKeyValueStoreETag(): string;
140
+ export {};
141
+ //# sourceMappingURL=sim-cf-key-value-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-cf-key-value-store.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudfront/key-value-store/sim-cf-key-value-store.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAEL,KAAK,eAAe,EACrB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EACL,KAAK,yBAAyB,EAC9B,8BAA8B,EAC/B,MAAM,kCAAkC,CAAC;AAE1C,MAAM,MAAM,4BAA4B,GAAG,KAAK,CAC9C,MAAM,EACN,8BAA8B,CAC/B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,gCAAgC,GAAG,cAAc,GAAG,OAAO,CAAC;AAExE,UAAU,oCAAoC;IAC5C,QAAQ,CAAC,EAAE,CAAC,EAAE,4BAA4B,CAAC;IAC3C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,QAAQ,CAAC,SAAS,CAAC,EAAE,eAAe,CAAC;IACrC,QAAQ,CAAC,MAAM,CAAC,EAAE,gCAAgC,CAAC;IACnD,QAAQ,CAAC,gBAAgB,CAAC,EAAE,IAAI,CAAC;CAClC;AAED;;;;;;;;;;;;;;GAcG;AACH,qBAAa,0BAA0B;;IACrC,SAAgB,EAAE,EAAE,4BAA4B,CAAC;IACjD,SAAgB,SAAS,EAAE,eAAe,CAAC;IAC3C,SAAgB,IAAI,iCAAwC;IAE5D;;;OAGG;IACH,SAAgB,WAAW,EAAE,IAAI,CAAC;IASlC,YAAY,UAAU,EAAE,oCAAoC,EAU3D;IAED;;OAEG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED;;OAEG;IACH,IAAI,OAAO,IAAI,MAAM,GAAG,SAAS,CAEhC;IAED;;OAEG;IACH,IAAI,MAAM,IAAI,gCAAgC,CAE7C;IAED;;OAEG;IACH,IAAI,gBAAgB,IAAI,IAAI,CAE3B;IAED;;;;;;;;;;OAUG;IACH,IAAI,YAAY,IAAI,MAAM,CAEzB;IAED;;;;;OAKG;IACH,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED;;;;;OAKG;IACH,IAAI,GAAG,IAAI,MAAM,CAEhB;IAED;;OAEG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAGrB;IAED;;OAEG;IACH,MAAM,CAAC,UAAU,EAAE;QACjB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QACnC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;KACvC,GAAG,IAAI,CAIP;IAED;;;;;;;OAOG;IACH,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAExC;IAED;;OAEG;IACH,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAEpC;IAED;;OAEG;IACH,aAAa,CAAC,gBAAgB,GAAE,IAAiB,GAAG,IAAI,CAGvD;IAED;;OAEG;IACH,SAAS,CAAC,gBAAgB,GAAE,IAAiB,GAAG,IAAI,CAGnD;IAED;;OAEG;IACH,QAAQ,IAAI,SAAS,yBAAyB,EAAE,CAE/C;IAED;;;;;;OAMG;IACH,OAAO,CAAC,UAAU;CAQnB;AAED,MAAM,MAAM,6BAA6B,GAAG,GAAG,CAC7C,4BAA4B,EAC5B,0BAA0B,CAC3B,CAAC;AAEF;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,4BAA4B,CAElE;AAED;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CAE9C"}