@kensio/yulin 1.10.4 → 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.
- package/dist/config/lint/cff-js2-lint.fixture.d.ts.map +1 -1
- package/dist/config/lint/cff-js2-lint.fixture.js +23 -0
- package/dist/config/lint/cff-js2-lint.fixture.js.map +1 -1
- package/dist/config/lint/cff-js2-restriction.d.ts +5 -5
- package/dist/config/lint/cff-js2-restriction.d.ts.map +1 -1
- package/dist/config/lint/cff-js2-restriction.js +11 -5
- package/dist/config/lint/cff-js2-restriction.js.map +1 -1
- package/dist/sdk/router/resolve-sim-sdk-command-router.d.ts.map +1 -1
- package/dist/sdk/router/resolve-sim-sdk-command-router.js +3 -0
- package/dist/sdk/router/resolve-sim-sdk-command-router.js.map +1 -1
- package/dist/service/aws/sim-aws-account-region-scope.d.ts +9 -0
- package/dist/service/aws/sim-aws-account-region-scope.d.ts.map +1 -1
- package/dist/service/aws/sim-aws-account-region-scope.js +10 -0
- package/dist/service/aws/sim-aws-account-region-scope.js.map +1 -1
- package/dist/service/aws/sim-aws-account.d.ts +5 -0
- package/dist/service/aws/sim-aws-account.d.ts.map +1 -1
- package/dist/service/aws/sim-aws-account.js +6 -0
- package/dist/service/aws/sim-aws-account.js.map +1 -1
- package/dist/service/aws/sim-aws-region.d.ts +5 -0
- package/dist/service/aws/sim-aws-region.d.ts.map +1 -1
- package/dist/service/aws/sim-aws-region.js +6 -0
- package/dist/service/aws/sim-aws-region.js.map +1 -1
- package/dist/service/aws/sim-aws-service-accessors.d.ts +5 -0
- package/dist/service/aws/sim-aws-service-accessors.d.ts.map +1 -1
- package/dist/service/aws/sim-aws-service-accessors.js +6 -0
- package/dist/service/aws/sim-aws-service-accessors.js.map +1 -1
- package/dist/service/cloudfront/command/key-value-store/sim-cf-create-key-value-store.d.ts +24 -0
- package/dist/service/cloudfront/command/key-value-store/sim-cf-create-key-value-store.d.ts.map +1 -0
- package/dist/service/cloudfront/command/key-value-store/sim-cf-create-key-value-store.js +43 -0
- package/dist/service/cloudfront/command/key-value-store/sim-cf-create-key-value-store.js.map +1 -0
- package/dist/service/cloudfront/command/key-value-store/sim-cf-delete-key-value-store.d.ts +26 -0
- package/dist/service/cloudfront/command/key-value-store/sim-cf-delete-key-value-store.d.ts.map +1 -0
- package/dist/service/cloudfront/command/key-value-store/sim-cf-delete-key-value-store.js +40 -0
- package/dist/service/cloudfront/command/key-value-store/sim-cf-delete-key-value-store.js.map +1 -0
- package/dist/service/cloudfront/command/key-value-store/sim-cf-describe-key-value-store.d.ts +24 -0
- package/dist/service/cloudfront/command/key-value-store/sim-cf-describe-key-value-store.d.ts.map +1 -0
- package/dist/service/cloudfront/command/key-value-store/sim-cf-describe-key-value-store.js +32 -0
- package/dist/service/cloudfront/command/key-value-store/sim-cf-describe-key-value-store.js.map +1 -0
- package/dist/service/cloudfront/command/key-value-store/sim-cf-key-value-store-command.types.d.ts +109 -0
- package/dist/service/cloudfront/command/key-value-store/sim-cf-key-value-store-command.types.d.ts.map +1 -0
- package/dist/service/cloudfront/command/key-value-store/sim-cf-key-value-store-command.types.js +12 -0
- package/dist/service/cloudfront/command/key-value-store/sim-cf-key-value-store-command.types.js.map +1 -0
- package/dist/service/cloudfront/command/key-value-store/sim-cf-key-value-store-summary.d.ts +10 -0
- package/dist/service/cloudfront/command/key-value-store/sim-cf-key-value-store-summary.d.ts.map +1 -0
- package/dist/service/cloudfront/command/key-value-store/sim-cf-key-value-store-summary.js +17 -0
- package/dist/service/cloudfront/command/key-value-store/sim-cf-key-value-store-summary.js.map +1 -0
- package/dist/service/cloudfront/command/key-value-store/sim-cf-list-key-value-stores.d.ts +20 -0
- package/dist/service/cloudfront/command/key-value-store/sim-cf-list-key-value-stores.d.ts.map +1 -0
- package/dist/service/cloudfront/command/key-value-store/sim-cf-list-key-value-stores.js +34 -0
- package/dist/service/cloudfront/command/key-value-store/sim-cf-list-key-value-stores.js.map +1 -0
- package/dist/service/cloudfront/command/key-value-store/sim-cf-update-key-value-store.d.ts +24 -0
- package/dist/service/cloudfront/command/key-value-store/sim-cf-update-key-value-store.d.ts.map +1 -0
- package/dist/service/cloudfront/command/key-value-store/sim-cf-update-key-value-store.js +35 -0
- package/dist/service/cloudfront/command/key-value-store/sim-cf-update-key-value-store.js.map +1 -0
- package/dist/service/cloudfront/command/key-value-store-data/sim-cf-key-value-store-data-command.types.d.ts +116 -0
- package/dist/service/cloudfront/command/key-value-store-data/sim-cf-key-value-store-data-command.types.d.ts.map +1 -0
- package/dist/service/cloudfront/command/key-value-store-data/sim-cf-key-value-store-data-command.types.js +12 -0
- package/dist/service/cloudfront/command/key-value-store-data/sim-cf-key-value-store-data-command.types.js.map +1 -0
- package/dist/service/cloudfront/command/key-value-store-data/sim-kvs-batch.d.ts +22 -0
- package/dist/service/cloudfront/command/key-value-store-data/sim-kvs-batch.d.ts.map +1 -0
- package/dist/service/cloudfront/command/key-value-store-data/sim-kvs-batch.js +26 -0
- package/dist/service/cloudfront/command/key-value-store-data/sim-kvs-batch.js.map +1 -0
- package/dist/service/cloudfront/command/key-value-store-data/sim-kvs-key-reads.d.ts +37 -0
- package/dist/service/cloudfront/command/key-value-store-data/sim-kvs-key-reads.d.ts.map +1 -0
- package/dist/service/cloudfront/command/key-value-store-data/sim-kvs-key-reads.js +67 -0
- package/dist/service/cloudfront/command/key-value-store-data/sim-kvs-key-reads.js.map +1 -0
- package/dist/service/cloudfront/command/key-value-store-data/sim-kvs-key-writes.d.ts +43 -0
- package/dist/service/cloudfront/command/key-value-store-data/sim-kvs-key-writes.d.ts.map +1 -0
- package/dist/service/cloudfront/command/key-value-store-data/sim-kvs-key-writes.js +81 -0
- package/dist/service/cloudfront/command/key-value-store-data/sim-kvs-key-writes.js.map +1 -0
- package/dist/service/cloudfront/error/sim-cloudfront.error.d.ts +63 -0
- package/dist/service/cloudfront/error/sim-cloudfront.error.d.ts.map +1 -1
- package/dist/service/cloudfront/error/sim-cloudfront.error.js +75 -0
- package/dist/service/cloudfront/error/sim-cloudfront.error.js.map +1 -1
- package/dist/service/cloudfront/index.d.ts +3 -0
- package/dist/service/cloudfront/index.d.ts.map +1 -1
- package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store-access.d.ts +57 -0
- package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store-access.d.ts.map +1 -0
- package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store-access.js +72 -0
- package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store-access.js.map +1 -0
- package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store-commands.d.ts +51 -0
- package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store-commands.d.ts.map +1 -0
- package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store-commands.js +65 -0
- package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store-commands.js.map +1 -0
- package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store-keys.d.ts +72 -0
- package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store-keys.d.ts.map +1 -0
- package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store-keys.js +94 -0
- package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store-keys.js.map +1 -0
- package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store-registry.d.ts +59 -0
- package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store-registry.d.ts.map +1 -0
- package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store-registry.js +92 -0
- package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store-registry.js.map +1 -0
- package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store-users.d.ts +22 -0
- package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store-users.d.ts.map +1 -0
- package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store-users.js +7 -0
- package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store-users.js.map +1 -0
- package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store.d.ts +141 -0
- package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store.d.ts.map +1 -0
- package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store.js +180 -0
- package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store.js.map +1 -0
- package/dist/service/cloudfront/sdk/sim-cf-key-value-store-sdk-command-router.d.ts +24 -0
- package/dist/service/cloudfront/sdk/sim-cf-key-value-store-sdk-command-router.d.ts.map +1 -0
- package/dist/service/cloudfront/sdk/sim-cf-key-value-store-sdk-command-router.js +54 -0
- package/dist/service/cloudfront/sdk/sim-cf-key-value-store-sdk-command-router.js.map +1 -0
- package/dist/service/cloudfront/sdk/sim-cloudfront-sdk-command-router.d.ts.map +1 -1
- package/dist/service/cloudfront/sdk/sim-cloudfront-sdk-command-router.js +30 -0
- package/dist/service/cloudfront/sdk/sim-cloudfront-sdk-command-router.js.map +1 -1
- package/dist/service/cloudfront/sim-cloudfront-commands.d.ts +10 -0
- package/dist/service/cloudfront/sim-cloudfront-commands.d.ts.map +1 -1
- package/dist/service/cloudfront/sim-cloudfront-commands.js +22 -0
- package/dist/service/cloudfront/sim-cloudfront-commands.js.map +1 -1
- package/dist/service/cloudfront/sim-cloudfront-key-value-store.d.ts +58 -0
- package/dist/service/cloudfront/sim-cloudfront-key-value-store.d.ts.map +1 -0
- package/dist/service/cloudfront/sim-cloudfront-key-value-store.js +68 -0
- package/dist/service/cloudfront/sim-cloudfront-key-value-store.js.map +1 -0
- package/dist/service/cloudfront/sim-cloudfront.d.ts +13 -0
- package/dist/service/cloudfront/sim-cloudfront.d.ts.map +1 -1
- package/dist/service/cloudfront/sim-cloudfront.js +15 -0
- package/dist/service/cloudfront/sim-cloudfront.js.map +1 -1
- package/package.json +3 -2
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { assertDefined } from "../../../../util/type-guard/defined.js";
|
|
2
|
+
/**
|
|
3
|
+
* The commands that read a key value store without changing it.
|
|
4
|
+
*
|
|
5
|
+
* None of them take an IfMatch, since nothing is being overwritten.
|
|
6
|
+
*
|
|
7
|
+
* https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/cloudfront-keyvaluestore/
|
|
8
|
+
*/
|
|
9
|
+
export class SimKvsKeyReads {
|
|
10
|
+
access;
|
|
11
|
+
static getAction = "cloudfront-keyvaluestore:GetKey";
|
|
12
|
+
static listAction = "cloudfront-keyvaluestore:ListKeys";
|
|
13
|
+
static describeAction = "cloudfront-keyvaluestore:DescribeKeyValueStore";
|
|
14
|
+
constructor(access) {
|
|
15
|
+
this.access = access;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Read one key, refusing one the store does not hold.
|
|
19
|
+
*/
|
|
20
|
+
async getKey(command, options) {
|
|
21
|
+
assertDefined(command.input.KvsARN, "GetKeyCommand.input.KvsARN");
|
|
22
|
+
assertDefined(command.input.Key, "GetKeyCommand.input.Key");
|
|
23
|
+
await this.access.background.sequence();
|
|
24
|
+
const store = this.access.authorizedByArn(SimKvsKeyReads.getAction, command.input.KvsARN, options?.caller);
|
|
25
|
+
return {
|
|
26
|
+
$metadata: {},
|
|
27
|
+
Key: command.input.Key,
|
|
28
|
+
Value: store.keys.get(command.input.Key),
|
|
29
|
+
ItemCount: store.keys.itemCount,
|
|
30
|
+
TotalSizeInBytes: store.keys.totalSizeInBytes,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* List every key and value the store holds.
|
|
35
|
+
*/
|
|
36
|
+
async listKeys(command, options) {
|
|
37
|
+
assertDefined(command.input.KvsARN, "ListKeysCommand.input.KvsARN");
|
|
38
|
+
await this.access.background.sequence();
|
|
39
|
+
const store = this.access.authorizedByArn(SimKvsKeyReads.listAction, command.input.KvsARN, options?.caller);
|
|
40
|
+
return {
|
|
41
|
+
$metadata: {},
|
|
42
|
+
Items: store.listKeys().map((pair) => ({ ...pair })),
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Describe the store's data: how much of it there is, and its status.
|
|
47
|
+
*
|
|
48
|
+
* The CloudFront client has a command of this name too, answering with the
|
|
49
|
+
* resource rather than the data.
|
|
50
|
+
*/
|
|
51
|
+
async describeKeyValueStore(command, options) {
|
|
52
|
+
assertDefined(command.input.KvsARN, "DescribeKeyValueStoreCommand.input.KvsARN");
|
|
53
|
+
await this.access.background.sequence();
|
|
54
|
+
const store = this.access.authorizedByArn(SimKvsKeyReads.describeAction, command.input.KvsARN, options?.caller);
|
|
55
|
+
return {
|
|
56
|
+
$metadata: {},
|
|
57
|
+
KvsARN: store.arn,
|
|
58
|
+
Created: store.createdTime,
|
|
59
|
+
LastModified: store.lastModifiedTime,
|
|
60
|
+
Status: store.status,
|
|
61
|
+
ItemCount: store.keys.itemCount,
|
|
62
|
+
TotalSizeInBytes: store.keys.totalSizeInBytes,
|
|
63
|
+
ETag: store.dataETag,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=sim-kvs-key-reads.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-kvs-key-reads.js","sourceRoot":"","sources":["../../../../../src/service/cloudfront/command/key-value-store-data/sim-kvs-key-reads.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAgBvE;;;;;;GAMG;AACH,MAAM,OAAO,cAAc;IAMI,MAAM;IAL3B,MAAM,CAAU,SAAS,GAAG,iCAAiC,CAAC;IAC9D,MAAM,CAAU,UAAU,GAAG,mCAAmC,CAAC;IACjE,MAAM,CAAU,cAAc,GACpC,gDAAgD,CAAC;IAEnD,YAA6B,MAAgC;sBAAhC,MAAM;IAA6B,CAAC;IAEjE;;OAEG;IACH,KAAK,CAAC,MAAM,CACV,OAA4B,EAC5B,OAAqB;QAErB,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,4BAA4B,CAAC,CAAC;QAClE,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,yBAA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MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC;QAExC,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,eAAe,CACvC,cAAc,CAAC,cAAc,EAC7B,OAAO,CAAC,KAAK,CAAC,MAAM,EACpB,OAAO,EAAE,MAAM,CAChB,CAAC;QAEF,OAAO;YACL,SAAS,EAAE,EAAE;YACb,MAAM,EAAE,KAAK,CAAC,GAAG;YACjB,OAAO,EAAE,KAAK,CAAC,WAAW;YAC1B,YAAY,EAAE,KAAK,CAAC,gBAAgB;YACpC,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,SAAS;YAC/B,gBAAgB,EAAE,KAAK,CAAC,IAAI,CAAC,gBAAgB;YAC7C,IAAI,EAAE,KAAK,CAAC,QAAQ;SACrB,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { SimAwsCaller } from "../../../aws/caller/sim-aws-caller.js";
|
|
2
|
+
import type { SimCfKeyValueStoreAccess } from "../../key-value-store/sim-cf-key-value-store-access.js";
|
|
3
|
+
import type { SimCfKeyValueStoreWriteOutput, SimKvsDeleteKeyCommand, SimKvsPutKeyCommand, SimKvsUpdateKeysCommand } from "./sim-cf-key-value-store-data-command.types.js";
|
|
4
|
+
interface WriteOptions {
|
|
5
|
+
readonly caller?: SimAwsCaller;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* The three commands that write keys: PutKey, DeleteKey and UpdateKeys.
|
|
9
|
+
*
|
|
10
|
+
* They are one class because they are the same operation three ways: a batch
|
|
11
|
+
* of puts and deletes against a store, checked against its ETag. PutKey is a
|
|
12
|
+
* batch of one put and DeleteKey a batch of one delete, so each only has to say
|
|
13
|
+
* what its batch is.
|
|
14
|
+
*
|
|
15
|
+
* IfMatch is required on all three, as it is in the real data API, and a stale
|
|
16
|
+
* one is refused rather than accepted. A caller therefore has to read the
|
|
17
|
+
* current ETag before each write, which is what writing against CloudFront
|
|
18
|
+
* involves.
|
|
19
|
+
*
|
|
20
|
+
* https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/cloudfront-keyvaluestore/
|
|
21
|
+
*/
|
|
22
|
+
export declare class SimKvsKeyWrites {
|
|
23
|
+
private readonly access;
|
|
24
|
+
constructor(access: SimCfKeyValueStoreAccess);
|
|
25
|
+
/**
|
|
26
|
+
* Write one key.
|
|
27
|
+
*/
|
|
28
|
+
putKey(command: SimKvsPutKeyCommand, options?: WriteOptions): Promise<SimCfKeyValueStoreWriteOutput>;
|
|
29
|
+
/**
|
|
30
|
+
* Forget one key.
|
|
31
|
+
*/
|
|
32
|
+
deleteKey(command: SimKvsDeleteKeyCommand, options?: WriteOptions): Promise<SimCfKeyValueStoreWriteOutput>;
|
|
33
|
+
/**
|
|
34
|
+
* Apply a batch of puts and deletes together.
|
|
35
|
+
*/
|
|
36
|
+
updateKeys(command: SimKvsUpdateKeysCommand, options?: WriteOptions): Promise<SimCfKeyValueStoreWriteOutput>;
|
|
37
|
+
/**
|
|
38
|
+
* Resolve, authorize, check the ETag, apply the batch and report the size.
|
|
39
|
+
*/
|
|
40
|
+
private write;
|
|
41
|
+
}
|
|
42
|
+
export {};
|
|
43
|
+
//# sourceMappingURL=sim-kvs-key-writes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-kvs-key-writes.d.ts","sourceRoot":"","sources":["../../../../../src/service/cloudfront/command/key-value-store-data/sim-kvs-key-writes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,wDAAwD,CAAC;AACvG,OAAO,KAAK,EACV,6BAA6B,EAC7B,sBAAsB,EACtB,mBAAmB,EACnB,uBAAuB,EACxB,MAAM,gDAAgD,CAAC;AAGxD,UAAU,YAAY;IACpB,QAAQ,CAAC,MAAM,CAAC,EAAE,YAAY,CAAC;CAChC;AAaD;;;;;;;;;;;;;;GAcG;AACH,qBAAa,eAAe;IACd,OAAO,CAAC,QAAQ,CAAC,MAAM;IAAnC,YAA6B,MAAM,EAAE,wBAAwB,EAAI;IAEjE;;OAEG;IACG,MAAM,CACV,OAAO,EAAE,mBAAmB,EAC5B,OAAO,CAAC,EAAE,YAAY,GACrB,OAAO,CAAC,6BAA6B,CAAC,CAcxC;IAED;;OAEG;IACG,SAAS,CACb,OAAO,EAAE,sBAAsB,EAC/B,OAAO,CAAC,EAAE,YAAY,GACrB,OAAO,CAAC,6BAA6B,CAAC,CAaxC;IAED;;OAEG;IACG,UAAU,CACd,OAAO,EAAE,uBAAuB,EAChC,OAAO,CAAC,EAAE,YAAY,GACrB,OAAO,CAAC,6BAA6B,CAAC,CAWxC;IAED;;OAEG;YACW,KAAK;CA2BpB"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { assertDefined } from "../../../../util/type-guard/defined.js";
|
|
2
|
+
import { kvsBatchDeletes, kvsBatchPuts } from "./sim-kvs-batch.js";
|
|
3
|
+
/**
|
|
4
|
+
* The three commands that write keys: PutKey, DeleteKey and UpdateKeys.
|
|
5
|
+
*
|
|
6
|
+
* They are one class because they are the same operation three ways: a batch
|
|
7
|
+
* of puts and deletes against a store, checked against its ETag. PutKey is a
|
|
8
|
+
* batch of one put and DeleteKey a batch of one delete, so each only has to say
|
|
9
|
+
* what its batch is.
|
|
10
|
+
*
|
|
11
|
+
* IfMatch is required on all three, as it is in the real data API, and a stale
|
|
12
|
+
* one is refused rather than accepted. A caller therefore has to read the
|
|
13
|
+
* current ETag before each write, which is what writing against CloudFront
|
|
14
|
+
* involves.
|
|
15
|
+
*
|
|
16
|
+
* https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/cloudfront-keyvaluestore/
|
|
17
|
+
*/
|
|
18
|
+
export class SimKvsKeyWrites {
|
|
19
|
+
access;
|
|
20
|
+
constructor(access) {
|
|
21
|
+
this.access = access;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Write one key.
|
|
25
|
+
*/
|
|
26
|
+
async putKey(command, options) {
|
|
27
|
+
assertDefined(command.input.Key, "PutKeyCommand.input.Key");
|
|
28
|
+
assertDefined(command.input.Value, "PutKeyCommand.input.Value");
|
|
29
|
+
return await this.write({
|
|
30
|
+
action: "cloudfront-keyvaluestore:PutKey",
|
|
31
|
+
KvsARN: command.input.KvsARN,
|
|
32
|
+
IfMatch: command.input.IfMatch,
|
|
33
|
+
puts: [{ Key: command.input.Key, Value: command.input.Value }],
|
|
34
|
+
deletes: [],
|
|
35
|
+
}, options);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Forget one key.
|
|
39
|
+
*/
|
|
40
|
+
async deleteKey(command, options) {
|
|
41
|
+
assertDefined(command.input.Key, "DeleteKeyCommand.input.Key");
|
|
42
|
+
return await this.write({
|
|
43
|
+
action: "cloudfront-keyvaluestore:DeleteKey",
|
|
44
|
+
KvsARN: command.input.KvsARN,
|
|
45
|
+
IfMatch: command.input.IfMatch,
|
|
46
|
+
puts: [],
|
|
47
|
+
deletes: [{ Key: command.input.Key }],
|
|
48
|
+
}, options);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Apply a batch of puts and deletes together.
|
|
52
|
+
*/
|
|
53
|
+
async updateKeys(command, options) {
|
|
54
|
+
return await this.write({
|
|
55
|
+
action: "cloudfront-keyvaluestore:UpdateKeys",
|
|
56
|
+
KvsARN: command.input.KvsARN,
|
|
57
|
+
IfMatch: command.input.IfMatch,
|
|
58
|
+
puts: kvsBatchPuts(command.input),
|
|
59
|
+
deletes: kvsBatchDeletes(command.input),
|
|
60
|
+
}, options);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Resolve, authorize, check the ETag, apply the batch and report the size.
|
|
64
|
+
*/
|
|
65
|
+
async write(write, options) {
|
|
66
|
+
assertDefined(write.KvsARN, "key value store write input KvsARN");
|
|
67
|
+
assertDefined(write.IfMatch, "key value store write input IfMatch");
|
|
68
|
+
await this.access.background.sequence();
|
|
69
|
+
const store = this.access.authorizedByArn(write.action, write.KvsARN, options?.caller);
|
|
70
|
+
store.assertDataETag(write.IfMatch);
|
|
71
|
+
store.keys.applyBatch(write.puts, write.deletes);
|
|
72
|
+
store.touchData(this.access.background.now());
|
|
73
|
+
return {
|
|
74
|
+
$metadata: {},
|
|
75
|
+
ItemCount: store.keys.itemCount,
|
|
76
|
+
TotalSizeInBytes: store.keys.totalSizeInBytes,
|
|
77
|
+
ETag: store.dataETag,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=sim-kvs-key-writes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-kvs-key-writes.js","sourceRoot":"","sources":["../../../../../src/service/cloudfront/command/key-value-store-data/sim-kvs-key-writes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AASvE,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAiBnE;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,eAAe;IACG,MAAM;IAAnC,YAA6B,MAAgC;sBAAhC,MAAM;IAA6B,CAAC;IAEjE;;OAEG;IACH,KAAK,CAAC,MAAM,CACV,OAA4B,EAC5B,OAAsB;QAEtB,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,yBAAyB,CAAC,CAAC;QAC5D,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,2BAA2B,CAAC,CAAC;QAEhE,OAAO,MAAM,IAAI,CAAC,KAAK,CACrB;YACE,MAAM,EAAE,iCAAiC;YACzC,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM;YAC5B,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,OAAO;YAC9B,IA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AAM,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC;QAExC,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,eAAe,CACvC,KAAK,CAAC,MAAM,EACZ,KAAK,CAAC,MAAM,EACZ,OAAO,EAAE,MAAM,CAChB,CAAC;QAEF,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAEpC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QACjD,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,CAAC;QAE9C,OAAO;YACL,SAAS,EAAE,EAAE;YACb,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,SAAS;YAC/B,gBAAgB,EAAE,KAAK,CAAC,IAAI,CAAC,gBAAgB;YAC7C,IAAI,EAAE,KAAK,CAAC,QAAQ;SACrB,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -131,4 +131,67 @@ export declare class SimCloudFrontDistributionNotDisabled extends SimCloudFrontE
|
|
|
131
131
|
readonly name = "DistributionNotDisabled";
|
|
132
132
|
constructor(message: string);
|
|
133
133
|
}
|
|
134
|
+
/**
|
|
135
|
+
* Simulated CloudFront EntityAlreadyExists error.
|
|
136
|
+
*
|
|
137
|
+
* CloudFront requires a key value store name to be unique within an account,
|
|
138
|
+
* so a second store claiming a name is refused rather than created.
|
|
139
|
+
*/
|
|
140
|
+
export declare class SimCloudFrontEntityAlreadyExists extends SimCloudFrontError {
|
|
141
|
+
readonly name = "EntityAlreadyExists";
|
|
142
|
+
constructor(message: string);
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Simulated CloudFront EntityNotFound error.
|
|
146
|
+
*
|
|
147
|
+
* What CloudFront answers when a key value store name, ID or ARN names
|
|
148
|
+
* nothing the account holds.
|
|
149
|
+
*/
|
|
150
|
+
export declare class SimCloudFrontEntityNotFound extends SimCloudFrontError {
|
|
151
|
+
readonly name = "EntityNotFound";
|
|
152
|
+
constructor(message: string);
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Simulated CloudFront CannotDeleteEntityWhileInUse error.
|
|
156
|
+
*
|
|
157
|
+
* CloudFront will not delete a key value store a Function is still associated
|
|
158
|
+
* with. The caller updates the Function to drop the association first.
|
|
159
|
+
*/
|
|
160
|
+
export declare class SimCloudFrontCannotDeleteEntityWhileInUse extends SimCloudFrontError {
|
|
161
|
+
readonly name = "CannotDeleteEntityWhileInUse";
|
|
162
|
+
constructor(message: string);
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Simulated CloudFront PreconditionFailed error.
|
|
166
|
+
*
|
|
167
|
+
* What CloudFront answers when a write carries an IfMatch ETag that is not the
|
|
168
|
+
* resource's current one, which is how it stops two writers overwriting each
|
|
169
|
+
* other.
|
|
170
|
+
*/
|
|
171
|
+
export declare class SimCloudFrontPreconditionFailed extends SimCloudFrontError {
|
|
172
|
+
readonly name = "PreconditionFailed";
|
|
173
|
+
constructor(message: string);
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Simulated CloudFront key value store ResourceNotFoundException error.
|
|
177
|
+
*
|
|
178
|
+
* What the key value store data API answers for a key that is not stored. It
|
|
179
|
+
* is the data API's own error rather than one of CloudFront's, which is why it
|
|
180
|
+
* is named in the exception style that API uses.
|
|
181
|
+
*/
|
|
182
|
+
export declare class SimCloudFrontKeyValueStoreKeyNotFound extends SimCloudFrontError {
|
|
183
|
+
readonly name = "ResourceNotFoundException";
|
|
184
|
+
constructor(message: string);
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Simulated key value store data API ResourceNotFoundException error.
|
|
188
|
+
*
|
|
189
|
+
* What that API answers for a `KvsARN` naming no store. The two clients have
|
|
190
|
+
* separate error sets, so this is not CloudFront's `EntityNotFound` even
|
|
191
|
+
* though both mean the store was not found.
|
|
192
|
+
*/
|
|
193
|
+
export declare class SimCloudFrontKeyValueStoreNotFound extends SimCloudFrontError {
|
|
194
|
+
readonly name = "ResourceNotFoundException";
|
|
195
|
+
constructor(message: string);
|
|
196
|
+
}
|
|
134
197
|
//# sourceMappingURL=sim-cloudfront.error.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sim-cloudfront.error.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudfront/error/sim-cloudfront.error.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;CAClC;AAED;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;aAGzB,SAAS,EAAE,0BAA0B;IAFvD,YACE,OAAO,EAAE,MAAM,EACC,SAAS,GAAE,0BAA+B,EAG3D;CACF;AAED;;;;;;GAMG;AACH,qBAAa,qCAAsC,SAAQ,kBAAkB;IAC3E,SAAyB,IAAI,8BAA8B;IAE3D,YAAY,OAAO,EAAE,MAAM,EAE1B;CACF;AAED;;;;;GAKG;AACH,qBAAa,qCAAsC,SAAQ,kBAAkB;IAC3E,SAAyB,IAAI,8BAA8B;IAE3D,YAAY,OAAO,EAAE,MAAM,EAE1B;CACF;AAED;;GAEG;AACH,qBAAa,6BAA8B,SAAQ,kBAAkB;IACnE,SAAyB,IAAI,sBAAsB;IAEnD,YAAY,OAAO,EAAE,MAAM,EAE1B;CACF;AAED;;GAEG;AACH,qBAAa,gCAAiC,SAAQ,kBAAkB;IACtE,SAAyB,IAAI,yBAAyB;IAEtD,YAAY,OAAO,EAAE,MAAM,EAE1B;CACF;AAED;;GAEG;AACH,qBAAa,4BAA6B,SAAQ,kBAAkB;IAClE,SAAyB,IAAI,qBAAqB;IAElD,YAAY,OAAO,EAAE,MAAM,EAE1B;CACF;AAED;;;;GAIG;AACH,qBAAa,+BAAgC,SAAQ,kBAAkB;IACrE,SAAyB,IAAI,wBAAwB;IAErD,YAAY,OAAO,EAAE,MAAM,EAE1B;CACF;AAED;;;;GAIG;AACH,qBAAa,iCAAkC,SAAQ,kBAAkB;IACvE,SAAyB,IAAI,0BAA0B;IAEvD,YAAY,OAAO,EAAE,MAAM,EAE1B;CACF;AAED;;;;GAIG;AACH,qBAAa,wCAAyC,SAAQ,kBAAkB;IAC9E,SAAyB,IAAI,iCAAiC;IAE9D,YAAY,OAAO,EAAE,MAAM,EAE1B;CACF;AAED;;;;;;GAMG;AACH,qBAAa,2CAA4C,SAAQ,kBAAkB;IACjF,SAAyB,IAAI,oCAAoC;IAEjE,YAAY,OAAO,EAAE,MAAM,EAE1B;CACF;AAED;;;;;GAKG;AACH,qBAAa,+CAAgD,SAAQ,kBAAkB;IACrF,SAAyB,IAAI,wCAAwC;IAErE,YAAY,OAAO,EAAE,MAAM,EAE1B;CACF;AAED;;;;;GAKG;AACH,qBAAa,uCAAwC,SAAQ,kBAAkB;IAC7E,SAAyB,IAAI,gCAAgC;IAE7D,YAAY,OAAO,EAAE,MAAM,EAE1B;CACF;AAED;;;;;GAKG;AACH,qBAAa,6CAA8C,SAAQ,kBAAkB;IACnF,SAAyB,IAAI,sCAAsC;IAEnE,YAAY,OAAO,EAAE,MAAM,EAE1B;CACF;AAED;;;;;GAKG;AACH,qBAAa,oCAAqC,SAAQ,kBAAkB;IAC1E,SAAyB,IAAI,6BAA6B;IAE1D,YAAY,OAAO,EAAE,MAAM,EAE1B;CACF"}
|
|
1
|
+
{"version":3,"file":"sim-cloudfront.error.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudfront/error/sim-cloudfront.error.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;CAClC;AAED;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;aAGzB,SAAS,EAAE,0BAA0B;IAFvD,YACE,OAAO,EAAE,MAAM,EACC,SAAS,GAAE,0BAA+B,EAG3D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AKG;AACH,qBAAa,uCAAwC,SAAQ,kBAAkB;IAC7E,SAAyB,IAAI,gCAAgC;IAE7D,YAAY,OAAO,EAAE,MAAM,EAE1B;CACF;AAED;;;;;GAKG;AACH,qBAAa,6CAA8C,SAAQ,kBAAkB;IACnF,SAAyB,IAAI,sCAAsC;IAEnE,YAAY,OAAO,EAAE,MAAM,EAE1B;CACF;AAED;;;;;GAKG;AACH,qBAAa,oCAAqC,SAAQ,kBAAkB;IAC1E,SAAyB,IAAI,6BAA6B;IAE1D,YAAY,OAAO,EAAE,MAAM,EAE1B;CACF;AAED;;;;;GAKG;AACH,qBAAa,gCAAiC,SAAQ,kBAAkB;IACtE,SAAyB,IAAI,yBAAyB;IAEtD,YAAY,OAAO,EAAE,MAAM,EAE1B;CACF;AAED;;;;;GAKG;AACH,qBAAa,2BAA4B,SAAQ,kBAAkB;IACjE,SAAyB,IAAI,oBAAoB;IAEjD,YAAY,OAAO,EAAE,MAAM,EAE1B;CACF;AAED;;;;;GAKG;AACH,qBAAa,yCAA0C,SAAQ,kBAAkB;IAC/E,SAAyB,IAAI,kCAAkC;IAE/D,YAAY,OAAO,EAAE,MAAM,EAE1B;CACF;AAED;;;;;;GAMG;AACH,qBAAa,+BAAgC,SAAQ,kBAAkB;IACrE,SAAyB,IAAI,wBAAwB;IAErD,YAAY,OAAO,EAAE,MAAM,EAE1B;CACF;AAED;;;;;;GAMG;AACH,qBAAa,qCAAsC,SAAQ,kBAAkB;IAC3E,SAAyB,IAAI,+BAA+B;IAE5D,YAAY,OAAO,EAAE,MAAM,EAE1B;CACF;AAED;;;;;;GAMG;AACH,qBAAa,kCAAmC,SAAQ,kBAAkB;IACxE,SAAyB,IAAI,+BAA+B;IAE5D,YAAY,OAAO,EAAE,MAAM,EAE1B;CACF"}
|
|
@@ -154,4 +154,79 @@ export class SimCloudFrontDistributionNotDisabled extends SimCloudFrontError {
|
|
|
154
154
|
super(message, { httpStatusCode: 409 });
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
|
+
/**
|
|
158
|
+
* Simulated CloudFront EntityAlreadyExists error.
|
|
159
|
+
*
|
|
160
|
+
* CloudFront requires a key value store name to be unique within an account,
|
|
161
|
+
* so a second store claiming a name is refused rather than created.
|
|
162
|
+
*/
|
|
163
|
+
export class SimCloudFrontEntityAlreadyExists extends SimCloudFrontError {
|
|
164
|
+
name = "EntityAlreadyExists";
|
|
165
|
+
constructor(message) {
|
|
166
|
+
super(message, { httpStatusCode: 409 });
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Simulated CloudFront EntityNotFound error.
|
|
171
|
+
*
|
|
172
|
+
* What CloudFront answers when a key value store name, ID or ARN names
|
|
173
|
+
* nothing the account holds.
|
|
174
|
+
*/
|
|
175
|
+
export class SimCloudFrontEntityNotFound extends SimCloudFrontError {
|
|
176
|
+
name = "EntityNotFound";
|
|
177
|
+
constructor(message) {
|
|
178
|
+
super(message, { httpStatusCode: 404 });
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Simulated CloudFront CannotDeleteEntityWhileInUse error.
|
|
183
|
+
*
|
|
184
|
+
* CloudFront will not delete a key value store a Function is still associated
|
|
185
|
+
* with. The caller updates the Function to drop the association first.
|
|
186
|
+
*/
|
|
187
|
+
export class SimCloudFrontCannotDeleteEntityWhileInUse extends SimCloudFrontError {
|
|
188
|
+
name = "CannotDeleteEntityWhileInUse";
|
|
189
|
+
constructor(message) {
|
|
190
|
+
super(message, { httpStatusCode: 409 });
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Simulated CloudFront PreconditionFailed error.
|
|
195
|
+
*
|
|
196
|
+
* What CloudFront answers when a write carries an IfMatch ETag that is not the
|
|
197
|
+
* resource's current one, which is how it stops two writers overwriting each
|
|
198
|
+
* other.
|
|
199
|
+
*/
|
|
200
|
+
export class SimCloudFrontPreconditionFailed extends SimCloudFrontError {
|
|
201
|
+
name = "PreconditionFailed";
|
|
202
|
+
constructor(message) {
|
|
203
|
+
super(message, { httpStatusCode: 412 });
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Simulated CloudFront key value store ResourceNotFoundException error.
|
|
208
|
+
*
|
|
209
|
+
* What the key value store data API answers for a key that is not stored. It
|
|
210
|
+
* is the data API's own error rather than one of CloudFront's, which is why it
|
|
211
|
+
* is named in the exception style that API uses.
|
|
212
|
+
*/
|
|
213
|
+
export class SimCloudFrontKeyValueStoreKeyNotFound extends SimCloudFrontError {
|
|
214
|
+
name = "ResourceNotFoundException";
|
|
215
|
+
constructor(message) {
|
|
216
|
+
super(message, { httpStatusCode: 404 });
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Simulated key value store data API ResourceNotFoundException error.
|
|
221
|
+
*
|
|
222
|
+
* What that API answers for a `KvsARN` naming no store. The two clients have
|
|
223
|
+
* separate error sets, so this is not CloudFront's `EntityNotFound` even
|
|
224
|
+
* though both mean the store was not found.
|
|
225
|
+
*/
|
|
226
|
+
export class SimCloudFrontKeyValueStoreNotFound extends SimCloudFrontError {
|
|
227
|
+
name = "ResourceNotFoundException";
|
|
228
|
+
constructor(message) {
|
|
229
|
+
super(message, { httpStatusCode: 404 });
|
|
230
|
+
}
|
|
231
|
+
}
|
|
157
232
|
//# sourceMappingURL=sim-cloudfront.error.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sim-cloudfront.error.js","sourceRoot":"","sources":["../../../../src/service/cloudfront/error/sim-cloudfront.error.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAGzB,SAAS;IAF3B,YACE,OAAe,EACC,SAAS,GAA+B,EAAE;QAE1D,KAAK,CAAC,OAAO,CAAC,CAAC;yBAFC,SAAS;IAG3B,CAAC;CACF;AAED;;;;;;GAMG;AACH,MAAM,OAAO,qCAAsC,SAAQ,kBAAkB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Ac,EAAE,GAAG,EAAE,CAAC,CAAC;IAC1C,CAAC;CACF"}
|
|
1
|
+
{"version":3,"file":"sim-cloudfront.error.js","sourceRoot":"","sources":["../../../../src/service/cloudfront/error/sim-cloudfront.error.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAGzB,SAAS;IAF3B,YACE,OAAe,EACC,SAAS,GAA+B,EAAE;QAE1D,KAAK,CAAC,OAAO,CAAC,CAAC;yBAFC,SAAS;IAG3B,CAAC;CACF;AAED;;;;;;GAMG;AACH,MAAM,OAAO,qCAAsC,SAAQ,kBAAkB;IAClD,IAAI,GAAG,0BAA0B,CAAC;IAE3D,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,EAAE,EAAE,cAAc,EAAE,GAAG,EAAE,CAAC,CAAC;IAC1C,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,OAAO,qCAAsC,SAAQ,kBAAkB;IAClD,IAAI,GAAG,0BAA0B,CAAC;IAE3D,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,EAAE,EAAE,cAAc,EAAE,GAAG,EAAE,CAAC,CAAC;IAC1C,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,6BAA8B,SAAQ,kBAAkB;IAC1C,IAAI,GAAG,kBAAkB,CAAC;IAEnD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,EAAE,EAAE,cAAc,EAAE,GAAG,EAAE,CAAC,CAAC;IAC1C,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,gCAAiC,SAAQ,kBAAkB;IAC7C,IAAI,GAAG,qBAAqB,CAAC;IAEtD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,EAAE,EAAE,cAAc,EAAE,GAAG,EAAE,CAAC,CAAC;IAC1C,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,4BAA6B,SAAQ,kBAAkB;IACzC,IAAI,GAAG,iBAAiB,CAAC;IAElD,YAAY,OAAe;QAC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AC;CACF;AAED;;;;;;GAMG;AACH,MAAM,OAAO,qCAAsC,SAAQ,kBAAkB;IAClD,IAAI,GAAG,2BAA2B,CAAC;IAE5D,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,EAAE,EAAE,cAAc,EAAE,GAAG,EAAE,CAAC,CAAC;IAC1C,CAAC;CACF;AAED;;;;;;GAMG;AACH,MAAM,OAAO,kCAAmC,SAAQ,kBAAkB;IAC/C,IAAI,GAAG,2BAA2B,CAAC;IAE5D,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,EAAE,EAAE,cAAc,EAAE,GAAG,EAAE,CAAC,CAAC;IAC1C,CAAC;CACF"}
|
|
@@ -2,4 +2,7 @@ export { makeCffFunctionCodeInput } from "./cff/function-code-input/cff-function
|
|
|
2
2
|
export { cloudFrontViewerRequestEventFactory } from "./factory/cloudfront-functions.factory.js";
|
|
3
3
|
export { cloudFrontFunctionSourceFromModule } from "./cff/function-code-module/cff-code-module-file.js";
|
|
4
4
|
export type { CloudFrontFunction } from "./typings/cloudfront-functions.namespace.js";
|
|
5
|
+
export type { SimCloudFrontKeyValueStoreApi } from "./sim-cloudfront-key-value-store.js";
|
|
6
|
+
export type { SimCfKeyValueStoreCommands } from "./key-value-store/sim-cf-key-value-store-commands.js";
|
|
7
|
+
export type { SimCloudFrontKeyValueStore, SimCloudFrontKeyValueStoreId, SimCloudFrontKeyValueStoreStatus, } from "./key-value-store/sim-cf-key-value-store.js";
|
|
5
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/service/cloudfront/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,sDAAsD,CAAC;AAChG,OAAO,EAAE,mCAAmC,EAAE,MAAM,2CAA2C,CAAC;AAChG,OAAO,EAAE,kCAAkC,EAAE,MAAM,oDAAoD,CAAC;AACxG,YAAY,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/service/cloudfront/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,sDAAsD,CAAC;AAChG,OAAO,EAAE,mCAAmC,EAAE,MAAM,2CAA2C,CAAC;AAChG,OAAO,EAAE,kCAAkC,EAAE,MAAM,oDAAoD,CAAC;AACxG,YAAY,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AACtF,YAAY,EAAE,6BAA6B,EAAE,MAAM,qCAAqC,CAAC;AACzF,YAAY,EAAE,0BAA0B,EAAE,MAAM,sDAAsD,CAAC;AACvG,YAAY,EACV,0BAA0B,EAC1B,4BAA4B,EAC5B,gCAAgC,GACjC,MAAM,6CAA6C,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { BackgroundScheduler } from "../../../util/background/background.js";
|
|
2
|
+
import type { SimAwsCaller } from "../../aws/caller/sim-aws-caller.js";
|
|
3
|
+
import type { SimAwsAccountId } from "../../aws/sim-aws-account.js";
|
|
4
|
+
import type { SimIamInterServiceAuthZ } from "../../iam/authorize/sim-iam-inter-service-auth-z.js";
|
|
5
|
+
import type { SimCloudFrontKeyValueStore } from "./sim-cf-key-value-store.js";
|
|
6
|
+
import type { SimCloudFrontKeyValueStoreRegistry } from "./sim-cf-key-value-store-registry.js";
|
|
7
|
+
interface SimCfKeyValueStoreAccessProperties {
|
|
8
|
+
readonly accountId: SimAwsAccountId;
|
|
9
|
+
readonly stores: SimCloudFrontKeyValueStoreRegistry;
|
|
10
|
+
readonly iam: SimIamInterServiceAuthZ;
|
|
11
|
+
readonly background: BackgroundScheduler;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* What every key value store command needs: the stores, IAM, and the clock.
|
|
15
|
+
*
|
|
16
|
+
* The commands across the two clients all authorize the same way and work on
|
|
17
|
+
* the same registry, so the wiring is here once rather than repeated in each
|
|
18
|
+
* of them. Each command class is then only its own AWS behaviour.
|
|
19
|
+
*/
|
|
20
|
+
export declare class SimCfKeyValueStoreAccess {
|
|
21
|
+
readonly accountId: SimAwsAccountId;
|
|
22
|
+
readonly stores: SimCloudFrontKeyValueStoreRegistry;
|
|
23
|
+
readonly background: BackgroundScheduler;
|
|
24
|
+
private readonly iam;
|
|
25
|
+
constructor(properties: SimCfKeyValueStoreAccessProperties);
|
|
26
|
+
/**
|
|
27
|
+
* Ensure the caller may take an action on a key value store ARN.
|
|
28
|
+
*/
|
|
29
|
+
authorize(action: string, resource: string, caller?: SimAwsCaller): void;
|
|
30
|
+
/**
|
|
31
|
+
* Ensure the caller may take an action on any key value store.
|
|
32
|
+
*
|
|
33
|
+
* CreateKeyValueStore has no store to name yet, and a command naming a store
|
|
34
|
+
* that does not exist has no ARN to authorize against either, so both go
|
|
35
|
+
* through the wildcard. A policy granting these actions has to use one too.
|
|
36
|
+
*/
|
|
37
|
+
authorizeAnyStore(action: string, caller?: SimAwsCaller): void;
|
|
38
|
+
/**
|
|
39
|
+
* Resolve a store by name, having authorized the action against it.
|
|
40
|
+
*
|
|
41
|
+
* The ARN carries the store's ID rather than its name, so the store has to be
|
|
42
|
+
* found before the action can be authorized on it. A name that resolves to
|
|
43
|
+
* nothing is authorized against the wildcard first, so a caller without
|
|
44
|
+
* permission is refused either way rather than learning which names exist.
|
|
45
|
+
*/
|
|
46
|
+
authorizedByName(action: string, storeName: string, caller?: SimAwsCaller): SimCloudFrontKeyValueStore;
|
|
47
|
+
/**
|
|
48
|
+
* Resolve a store by ARN, having authorized the action against it.
|
|
49
|
+
*
|
|
50
|
+
* This is the data API's way in. The ARN it was given is the resource the
|
|
51
|
+
* action is authorized on whether or not it resolves, so an unknown ARN is
|
|
52
|
+
* authorized before it is refused.
|
|
53
|
+
*/
|
|
54
|
+
authorizedByArn(action: string, storeArn: string, caller?: SimAwsCaller): SimCloudFrontKeyValueStore;
|
|
55
|
+
}
|
|
56
|
+
export {};
|
|
57
|
+
//# sourceMappingURL=sim-cf-key-value-store-access.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-cf-key-value-store-access.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudfront/key-value-store/sim-cf-key-value-store-access.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAClF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qDAAqD,CAAC;AAEnG,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AAC9E,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,sCAAsC,CAAC;AAE/F,UAAU,kCAAkC;IAC1C,QAAQ,CAAC,SAAS,EAAE,eAAe,CAAC;IACpC,QAAQ,CAAC,MAAM,EAAE,kCAAkC,CAAC;IACpD,QAAQ,CAAC,GAAG,EAAE,uBAAuB,CAAC;IACtC,QAAQ,CAAC,UAAU,EAAE,mBAAmB,CAAC;CAC1C;AAED;;;;;;GAMG;AACH,qBAAa,wBAAwB;IACnC,SAAgB,SAAS,EAAE,eAAe,CAAC;IAC3C,SAAgB,MAAM,EAAE,kCAAkC,CAAC;IAC3D,SAAgB,UAAU,EAAE,mBAAmB,CAAC;IAEhD,OAAO,CAAC,QAAQ,CAAC,GAAG,CAA0B;IAE9C,YAAY,UAAU,EAAE,kCAAkC,EAKzD;IAED;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,YAAY,GAAG,IAAI,CAUvE;IAED;;;;;;OAMG;IACH,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,YAAY,GAAG,IAAI,CAM7D;IAED;;;;;;;OAOG;IACH,gBAAgB,CACd,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,YAAY,GACpB,0BAA0B,CAY5B;IAED;;;;;;OAMG;IACH,eAAe,CACb,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,YAAY,GACpB,0BAA0B,CAI5B;CACF"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { SimIamAccessDenied } from "../../iam/error/sim-iam.error.js";
|
|
2
|
+
/**
|
|
3
|
+
* What every key value store command needs: the stores, IAM, and the clock.
|
|
4
|
+
*
|
|
5
|
+
* The commands across the two clients all authorize the same way and work on
|
|
6
|
+
* the same registry, so the wiring is here once rather than repeated in each
|
|
7
|
+
* of them. Each command class is then only its own AWS behaviour.
|
|
8
|
+
*/
|
|
9
|
+
export class SimCfKeyValueStoreAccess {
|
|
10
|
+
accountId;
|
|
11
|
+
stores;
|
|
12
|
+
background;
|
|
13
|
+
iam;
|
|
14
|
+
constructor(properties) {
|
|
15
|
+
this.accountId = properties.accountId;
|
|
16
|
+
this.stores = properties.stores;
|
|
17
|
+
this.iam = properties.iam;
|
|
18
|
+
this.background = properties.background;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Ensure the caller may take an action on a key value store ARN.
|
|
22
|
+
*/
|
|
23
|
+
authorize(action, resource, caller) {
|
|
24
|
+
const decision = this.iam.authorize({ action, resource, caller });
|
|
25
|
+
if (decision.isDenied) {
|
|
26
|
+
throw new SimIamAccessDenied({
|
|
27
|
+
principal: decision.caller.principal,
|
|
28
|
+
action,
|
|
29
|
+
resource,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Ensure the caller may take an action on any key value store.
|
|
35
|
+
*
|
|
36
|
+
* CreateKeyValueStore has no store to name yet, and a command naming a store
|
|
37
|
+
* that does not exist has no ARN to authorize against either, so both go
|
|
38
|
+
* through the wildcard. A policy granting these actions has to use one too.
|
|
39
|
+
*/
|
|
40
|
+
authorizeAnyStore(action, caller) {
|
|
41
|
+
this.authorize(action, `arn:aws:cloudfront::${this.accountId}:key-value-store/*`, caller);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Resolve a store by name, having authorized the action against it.
|
|
45
|
+
*
|
|
46
|
+
* The ARN carries the store's ID rather than its name, so the store has to be
|
|
47
|
+
* found before the action can be authorized on it. A name that resolves to
|
|
48
|
+
* nothing is authorized against the wildcard first, so a caller without
|
|
49
|
+
* permission is refused either way rather than learning which names exist.
|
|
50
|
+
*/
|
|
51
|
+
authorizedByName(action, storeName, caller) {
|
|
52
|
+
const store = this.stores.byName(storeName);
|
|
53
|
+
if (store === undefined) {
|
|
54
|
+
this.authorizeAnyStore(action, caller);
|
|
55
|
+
return this.stores.requireByName(storeName);
|
|
56
|
+
}
|
|
57
|
+
this.authorize(action, store.arn, caller);
|
|
58
|
+
return store;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Resolve a store by ARN, having authorized the action against it.
|
|
62
|
+
*
|
|
63
|
+
* This is the data API's way in. The ARN it was given is the resource the
|
|
64
|
+
* action is authorized on whether or not it resolves, so an unknown ARN is
|
|
65
|
+
* authorized before it is refused.
|
|
66
|
+
*/
|
|
67
|
+
authorizedByArn(action, storeArn, caller) {
|
|
68
|
+
this.authorize(action, storeArn, caller);
|
|
69
|
+
return this.stores.requireByArn(storeArn);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=sim-cf-key-value-store-access.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-cf-key-value-store-access.js","sourceRoot":"","sources":["../../../../src/service/cloudfront/key-value-store/sim-cf-key-value-store-access.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAWtE;;;;;;GAMG;AACH,MAAM,OAAO,wBAAwB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,MAAM,EAAE,KAAK,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QAE1C,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;;;OAMG;IACH,eAAe,CACb,MAAc,EACd,QAAgB,EAChB,MAAqB;QAErB,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;QAEzC,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IAC5C,CAAC;CACF"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { SimAwsCaller } from "../../aws/caller/sim-aws-caller.js";
|
|
2
|
+
import type { SimCreateKeyValueStoreCommand, SimCreateKeyValueStoreCommandOutput, SimDeleteKeyValueStoreCommand, SimDeleteKeyValueStoreCommandOutput, SimDescribeKeyValueStoreCommand, SimDescribeKeyValueStoreCommandOutput, SimListKeyValueStoresCommand, SimListKeyValueStoresCommandOutput, SimUpdateKeyValueStoreCommand, SimUpdateKeyValueStoreCommandOutput } from "../command/key-value-store/sim-cf-key-value-store-command.types.js";
|
|
3
|
+
import type { SimCfKeyValueStoreAccess } from "./sim-cf-key-value-store-access.js";
|
|
4
|
+
import type { SimCloudFrontKeyValueStore, SimCloudFrontKeyValueStoreId } from "./sim-cf-key-value-store.js";
|
|
5
|
+
import { type SimCfKeyValueStoreUsers } from "./sim-cf-key-value-store-users.js";
|
|
6
|
+
interface KeyValueStoreRequestOptions {
|
|
7
|
+
readonly caller?: SimAwsCaller;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The key value store commands on the CloudFront client.
|
|
11
|
+
*
|
|
12
|
+
* These are the five that own the resource. They are grouped here rather than
|
|
13
|
+
* on SimCloudFrontCommands beside the Distribution and Function commands
|
|
14
|
+
* because they share a collaborator none of those need, and because there are
|
|
15
|
+
* enough of them to be their own thing.
|
|
16
|
+
*/
|
|
17
|
+
export declare class SimCfKeyValueStoreCommands {
|
|
18
|
+
private readonly access;
|
|
19
|
+
private readonly users;
|
|
20
|
+
constructor(access: SimCfKeyValueStoreAccess, users?: SimCfKeyValueStoreUsers);
|
|
21
|
+
/**
|
|
22
|
+
* Get a key value store by name, for asserting on its state directly.
|
|
23
|
+
*/
|
|
24
|
+
byName(storeName: string): SimCloudFrontKeyValueStore | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Get a key value store by ID.
|
|
27
|
+
*/
|
|
28
|
+
byId(storeId: SimCloudFrontKeyValueStoreId | string): SimCloudFrontKeyValueStore | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Handle a Create Key Value Store Command from the SDK.
|
|
31
|
+
*/
|
|
32
|
+
createKeyValueStore(command: SimCreateKeyValueStoreCommand, options?: KeyValueStoreRequestOptions): Promise<SimCreateKeyValueStoreCommandOutput>;
|
|
33
|
+
/**
|
|
34
|
+
* Handle a Describe Key Value Store Command from the SDK.
|
|
35
|
+
*/
|
|
36
|
+
describeKeyValueStore(command: SimDescribeKeyValueStoreCommand, options?: KeyValueStoreRequestOptions): Promise<SimDescribeKeyValueStoreCommandOutput>;
|
|
37
|
+
/**
|
|
38
|
+
* Handle a List Key Value Stores Command from the SDK.
|
|
39
|
+
*/
|
|
40
|
+
listKeyValueStores(command: SimListKeyValueStoresCommand, options?: KeyValueStoreRequestOptions): Promise<SimListKeyValueStoresCommandOutput>;
|
|
41
|
+
/**
|
|
42
|
+
* Handle an Update Key Value Store Command from the SDK.
|
|
43
|
+
*/
|
|
44
|
+
updateKeyValueStore(command: SimUpdateKeyValueStoreCommand, options?: KeyValueStoreRequestOptions): Promise<SimUpdateKeyValueStoreCommandOutput>;
|
|
45
|
+
/**
|
|
46
|
+
* Handle a Delete Key Value Store Command from the SDK.
|
|
47
|
+
*/
|
|
48
|
+
deleteKeyValueStore(command: SimDeleteKeyValueStoreCommand, options?: KeyValueStoreRequestOptions): Promise<SimDeleteKeyValueStoreCommandOutput>;
|
|
49
|
+
}
|
|
50
|
+
export {};
|
|
51
|
+
//# sourceMappingURL=sim-cf-key-value-store-commands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-cf-key-value-store-commands.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudfront/key-value-store/sim-cf-key-value-store-commands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAMvE,OAAO,KAAK,EACV,6BAA6B,EAC7B,mCAAmC,EACnC,6BAA6B,EAC7B,mCAAmC,EACnC,+BAA+B,EAC/B,qCAAqC,EACrC,4BAA4B,EAC5B,kCAAkC,EAClC,6BAA6B,EAC7B,mCAAmC,EACpC,MAAM,oEAAoE,CAAC;AAC5E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AACnF,OAAO,KAAK,EACV,0BAA0B,EAC1B,4BAA4B,EAC7B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,mCAAmC,CAAC;AAE3C,UAAU,2BAA2B;IACnC,QAAQ,CAAC,MAAM,CAAC,EAAE,YAAY,CAAC;CAChC;AAED;;;;;;;GAOG;AACH,qBAAa,0BAA0B;IAInC,OAAO,CAAC,QAAQ,CAAC,MAAM;IAHzB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA0B;IAEhD,YACmB,MAAM,EAAE,wBAAwB,EACjD,KAAK,GAAE,uBAA8C,EAGtD;IAED;;OAEG;IACH,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,0BAA0B,GAAG,SAAS,CAEhE;IAED;;OAEG;IACH,IAAI,CACF,OAAO,EAAE,4BAA4B,GAAG,MAAM,GAC7C,0BAA0B,GAAG,SAAS,CAExC;IAED;;OAEG;IACG,mBAAmB,CACvB,OAAO,EAAE,6BAA6B,EACtC,OAAO,CAAC,EAAE,2BAA2B,GACpC,OAAO,CAAC,mCAAmC,CAAC,CAK9C;IAED;;OAEG;IACG,qBAAqB,CACzB,OAAO,EAAE,+B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