@kensio/yulin 1.11.0 → 1.11.1
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/service/cloudformation/resource/cfn/cloudfront/sim-cloudfront-cfn-value-adapter.d.ts.map +1 -1
- package/dist/service/cloudformation/resource/cfn/cloudfront/sim-cloudfront-cfn-value-adapter.js +8 -0
- package/dist/service/cloudformation/resource/cfn/cloudfront/sim-cloudfront-cfn-value-adapter.js.map +1 -1
- package/dist/service/cloudformation/resource/cfn/cloudfront/sim-cloudfront-kvs-cfn.d.ts +28 -0
- package/dist/service/cloudformation/resource/cfn/cloudfront/sim-cloudfront-kvs-cfn.d.ts.map +1 -0
- package/dist/service/cloudformation/resource/cfn/cloudfront/sim-cloudfront-kvs-cfn.js +41 -0
- package/dist/service/cloudformation/resource/cfn/cloudfront/sim-cloudfront-kvs-cfn.js.map +1 -0
- package/dist/service/cloudfront/cff/function-code-input/cff-cloudfront-import.d.ts +21 -0
- package/dist/service/cloudfront/cff/function-code-input/cff-cloudfront-import.d.ts.map +1 -0
- package/dist/service/cloudfront/cff/function-code-input/cff-cloudfront-import.js +30 -0
- package/dist/service/cloudfront/cff/function-code-input/cff-cloudfront-import.js.map +1 -0
- package/dist/service/cloudfront/cff/function-code-input/cff-function-code-input.d.ts +3 -1
- package/dist/service/cloudfront/cff/function-code-input/cff-function-code-input.d.ts.map +1 -1
- package/dist/service/cloudfront/cff/function-code-input/cff-function-code-input.js +5 -17
- package/dist/service/cloudfront/cff/function-code-input/cff-function-code-input.js.map +1 -1
- package/dist/service/cloudfront/cff/function-code-input/cff-vm-source-handler.d.ts +13 -0
- package/dist/service/cloudfront/cff/function-code-input/cff-vm-source-handler.d.ts.map +1 -0
- package/dist/service/cloudfront/cff/function-code-input/cff-vm-source-handler.js +28 -0
- package/dist/service/cloudfront/cff/function-code-input/cff-vm-source-handler.js.map +1 -0
- package/dist/service/cloudfront/cff/kvs/cff-cloudfront-module.d.ts +28 -0
- package/dist/service/cloudfront/cff/kvs/cff-cloudfront-module.d.ts.map +1 -0
- package/dist/service/cloudfront/cff/kvs/cff-cloudfront-module.js +30 -0
- package/dist/service/cloudfront/cff/kvs/cff-cloudfront-module.js.map +1 -0
- package/dist/service/cloudfront/cff/kvs/cff-kvs-handle.d.ts +46 -0
- package/dist/service/cloudfront/cff/kvs/cff-kvs-handle.d.ts.map +1 -0
- package/dist/service/cloudfront/cff/kvs/cff-kvs-handle.js +60 -0
- package/dist/service/cloudfront/cff/kvs/cff-kvs-handle.js.map +1 -0
- package/dist/service/cloudfront/cff/kvs/sim-cff-cloudfront-global.d.ts +43 -0
- package/dist/service/cloudfront/cff/kvs/sim-cff-cloudfront-global.d.ts.map +1 -0
- package/dist/service/cloudfront/cff/kvs/sim-cff-cloudfront-global.js +66 -0
- package/dist/service/cloudfront/cff/kvs/sim-cff-cloudfront-global.js.map +1 -0
- package/dist/service/cloudfront/cff/kvs/sim-cff-key-value-store-users.d.ts +20 -0
- package/dist/service/cloudfront/cff/kvs/sim-cff-key-value-store-users.d.ts.map +1 -0
- package/dist/service/cloudfront/cff/kvs/sim-cff-key-value-store-users.js +25 -0
- package/dist/service/cloudfront/cff/kvs/sim-cff-key-value-store-users.js.map +1 -0
- package/dist/service/cloudfront/cff/sim-cloudfront-function.d.ts +23 -2
- package/dist/service/cloudfront/cff/sim-cloudfront-function.d.ts.map +1 -1
- package/dist/service/cloudfront/cff/sim-cloudfront-function.js +30 -4
- package/dist/service/cloudfront/cff/sim-cloudfront-function.js.map +1 -1
- package/dist/service/cloudfront/cfn/cff/sim-cfn-cff-function-config.d.ts +6 -0
- package/dist/service/cloudfront/cfn/cff/sim-cfn-cff-function-config.d.ts.map +1 -1
- package/dist/service/cloudfront/cfn/cff/sim-cfn-cff-function-config.js +43 -0
- package/dist/service/cloudfront/cfn/cff/sim-cfn-cff-function-config.js.map +1 -1
- package/dist/service/cloudfront/cfn/key-value-store/sim-cfn-cf-kvs-config.d.ts +38 -0
- package/dist/service/cloudfront/cfn/key-value-store/sim-cfn-cf-kvs-config.d.ts.map +1 -0
- package/dist/service/cloudfront/cfn/key-value-store/sim-cfn-cf-kvs-config.js +49 -0
- package/dist/service/cloudfront/cfn/key-value-store/sim-cfn-cf-kvs-config.js.map +1 -0
- package/dist/service/cloudfront/cfn/key-value-store/sim-cfn-cf-kvs-creator.d.ts +33 -0
- package/dist/service/cloudfront/cfn/key-value-store/sim-cfn-cf-kvs-creator.d.ts.map +1 -0
- package/dist/service/cloudfront/cfn/key-value-store/sim-cfn-cf-kvs-creator.js +54 -0
- package/dist/service/cloudfront/cfn/key-value-store/sim-cfn-cf-kvs-creator.js.map +1 -0
- package/dist/service/cloudfront/cfn/sim-cfn-cloudfront-resource-factory.d.ts +1 -0
- package/dist/service/cloudfront/cfn/sim-cfn-cloudfront-resource-factory.d.ts.map +1 -1
- package/dist/service/cloudfront/cfn/sim-cfn-cloudfront-resource-factory.js +12 -0
- package/dist/service/cloudfront/cfn/sim-cfn-cloudfront-resource-factory.js.map +1 -1
- package/dist/service/cloudfront/command/create-distribution/create-distribution.command.d.ts +6 -0
- package/dist/service/cloudfront/command/create-distribution/create-distribution.command.d.ts.map +1 -1
- package/dist/service/cloudfront/command/create-distribution/sim-cf-distro-config-normalizer.d.ts.map +1 -1
- package/dist/service/cloudfront/command/create-distribution/sim-cf-distro-config-normalizer.js +8 -6
- package/dist/service/cloudfront/command/create-distribution/sim-cf-distro-config-normalizer.js.map +1 -1
- package/dist/service/cloudfront/command/create-function/create-function-kvs-association.d.ts +24 -0
- package/dist/service/cloudfront/command/create-function/create-function-kvs-association.d.ts.map +1 -0
- package/dist/service/cloudfront/command/create-function/create-function-kvs-association.js +50 -0
- package/dist/service/cloudfront/command/create-function/create-function-kvs-association.js.map +1 -0
- package/dist/service/cloudfront/command/create-function/create-function.command.d.ts +6 -0
- package/dist/service/cloudfront/command/create-function/create-function.command.d.ts.map +1 -1
- package/dist/service/cloudfront/command/create-function/create-function.handler.d.ts +3 -0
- package/dist/service/cloudfront/command/create-function/create-function.handler.d.ts.map +1 -1
- package/dist/service/cloudfront/command/create-function/create-function.handler.js +11 -2
- package/dist/service/cloudfront/command/create-function/create-function.handler.js.map +1 -1
- package/dist/service/cloudfront/command/key-value-store/sim-cf-delete-key-value-store.js +1 -1
- package/dist/service/cloudfront/command/key-value-store/sim-cf-delete-key-value-store.js.map +1 -1
- package/dist/service/cloudfront/command/sim-cf-list-quantity.d.ts +20 -0
- package/dist/service/cloudfront/command/sim-cf-list-quantity.d.ts.map +1 -0
- package/dist/service/cloudfront/command/sim-cf-list-quantity.js +36 -0
- package/dist/service/cloudfront/command/sim-cf-list-quantity.js.map +1 -0
- package/dist/service/cloudfront/controller/cff/sim-cff-applicator.d.ts +2 -2
- package/dist/service/cloudfront/controller/cff/sim-cff-applicator.d.ts.map +1 -1
- package/dist/service/cloudfront/controller/cff/sim-cff-applicator.js +6 -6
- package/dist/service/cloudfront/controller/cff/sim-cff-applicator.js.map +1 -1
- package/dist/service/cloudfront/controller/sim-cloudfront-request-pipeline.js +2 -2
- package/dist/service/cloudfront/controller/sim-cloudfront-request-pipeline.js.map +1 -1
- package/dist/service/cloudfront/distribution/configurator/sim-cf-behavior-properties.d.ts.map +1 -1
- package/dist/service/cloudfront/distribution/configurator/sim-cf-behavior-properties.js +5 -3
- package/dist/service/cloudfront/distribution/configurator/sim-cf-behavior-properties.js.map +1 -1
- package/dist/service/cloudfront/error/sim-cf-key-value-store.error.d.ts +88 -0
- package/dist/service/cloudfront/error/sim-cf-key-value-store.error.d.ts.map +1 -0
- package/dist/service/cloudfront/error/sim-cf-key-value-store.error.js +104 -0
- package/dist/service/cloudfront/error/sim-cf-key-value-store.error.js.map +1 -0
- package/dist/service/cloudfront/error/sim-cloudfront.error.d.ts +10 -63
- package/dist/service/cloudfront/error/sim-cloudfront.error.d.ts.map +1 -1
- package/dist/service/cloudfront/error/sim-cloudfront.error.js +11 -74
- package/dist/service/cloudfront/error/sim-cloudfront.error.js.map +1 -1
- package/dist/service/cloudfront/globals.d.ts +12 -0
- package/dist/service/cloudfront/globals.d.ts.map +1 -1
- package/dist/service/cloudfront/globals.js.map +1 -1
- package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store-keys.js +1 -1
- package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store-keys.js.map +1 -1
- package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store-registry.js +1 -1
- package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store-registry.js.map +1 -1
- package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store-users.d.ts +7 -5
- package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store-users.d.ts.map +1 -1
- package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store-users.js.map +1 -1
- package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store.js +1 -1
- package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store.js.map +1 -1
- package/dist/service/cloudfront/sim-cloudfront-commands.d.ts.map +1 -1
- package/dist/service/cloudfront/sim-cloudfront-commands.js +7 -4
- package/dist/service/cloudfront/sim-cloudfront-commands.js.map +1 -1
- package/dist/service/cloudfront/sim-cloudfront.d.ts +1 -1
- package/dist/service/cloudfront/sim-cloudfront.d.ts.map +1 -1
- package/dist/service/cloudfront/sim-cloudfront.js.map +1 -1
- package/dist/service/cloudfront/typings/cloudfront-functions.namespace.d.ts +9 -2
- package/dist/service/cloudfront/typings/cloudfront-functions.namespace.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/service/cloudfront/command/create-distribution/sim-cf-distro-config-normalizer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sim-cf-distro-config-normalizer.d.ts","sourceRoot":"","sources":["../../../../../src/service/cloudfront/command/create-distribution/sim-cf-distro-config-normalizer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIV,+BAA+B,EAGhC,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"sim-cf-distro-config-normalizer.d.ts","sourceRoot":"","sources":["../../../../../src/service/cloudfront/command/create-distribution/sim-cf-distro-config-normalizer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIV,+BAA+B,EAGhC,MAAM,kCAAkC,CAAC;AAY1C;;;;;;;GAOG;AACH,qBAAa,yCAAyC;IAElD,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IADrC,YACmB,kBAAkB,EAAE,+BAA+B,EAClE;IAEJ;;OAEG;IACH,SAAS,IAAI,+BAA+B,CAyC3C;IAED,OAAO,CAAC,sBAAsB;IAe9B,OAAO,CAAC,aAAa;CA6BtB"}
|
package/dist/service/cloudfront/command/create-distribution/sim-cf-distro-config-normalizer.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isRecord } from "../../../../util/type-guard/record.js";
|
|
2
|
+
import { assertConsistentQuantity } from "../sim-cf-list-quantity.js";
|
|
2
3
|
/**
|
|
3
4
|
* Normalizes tolerated CloudFront DistributionConfig input shapes into the
|
|
4
5
|
* simulator's internal CreateDistribution shape.
|
|
@@ -17,12 +18,12 @@ export class SimCloudFrontDistributionConfigNormalizer {
|
|
|
17
18
|
*/
|
|
18
19
|
normalize() {
|
|
19
20
|
const distributionConfig = this.distributionConfig;
|
|
20
|
-
const cacheBehaviors = this.normalizeList(distributionConfig["CacheBehaviors"]);
|
|
21
|
+
const cacheBehaviors = this.normalizeList("CacheBehaviors", distributionConfig["CacheBehaviors"]);
|
|
21
22
|
return {
|
|
22
23
|
...this.distributionConfig,
|
|
23
|
-
Aliases: this.normalizeList(distributionConfig["Aliases"]),
|
|
24
|
-
Origins: this.normalizeList(distributionConfig["Origins"]),
|
|
25
|
-
CustomErrorResponses: this.normalizeList(distributionConfig["CustomErrorResponses"]),
|
|
24
|
+
Aliases: this.normalizeList("Aliases", distributionConfig["Aliases"]),
|
|
25
|
+
Origins: this.normalizeList("Origins", distributionConfig["Origins"]),
|
|
26
|
+
CustomErrorResponses: this.normalizeList("CustomErrorResponses", distributionConfig["CustomErrorResponses"]),
|
|
26
27
|
DefaultCacheBehavior: this.distributionConfig.DefaultCacheBehavior === undefined
|
|
27
28
|
? undefined
|
|
28
29
|
: this.normalizeCacheBehavior(this.distributionConfig.DefaultCacheBehavior),
|
|
@@ -38,13 +39,14 @@ export class SimCloudFrontDistributionConfigNormalizer {
|
|
|
38
39
|
const cacheBehaviorRecord = cacheBehavior;
|
|
39
40
|
return {
|
|
40
41
|
...cacheBehavior,
|
|
41
|
-
FunctionAssociations: this.normalizeList(cacheBehaviorRecord["FunctionAssociations"]),
|
|
42
|
+
FunctionAssociations: this.normalizeList("FunctionAssociations", cacheBehaviorRecord["FunctionAssociations"]),
|
|
42
43
|
};
|
|
43
44
|
}
|
|
44
|
-
normalizeList(value) {
|
|
45
|
+
normalizeList(listName, value) {
|
|
45
46
|
if (value === undefined) {
|
|
46
47
|
return undefined;
|
|
47
48
|
}
|
|
49
|
+
assertConsistentQuantity(listName, value);
|
|
48
50
|
if (Array.isArray(value)) {
|
|
49
51
|
return {
|
|
50
52
|
Items: value,
|
package/dist/service/cloudfront/command/create-distribution/sim-cf-distro-config-normalizer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sim-cf-distro-config-normalizer.js","sourceRoot":"","sources":["../../../../../src/service/cloudfront/command/create-distribution/sim-cf-distro-config-normalizer.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,QAAQ,EAAE,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"sim-cf-distro-config-normalizer.js","sourceRoot":"","sources":["../../../../../src/service/cloudfront/command/create-distribution/sim-cf-distro-config-normalizer.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,QAAQ,EAAE,MAAM,uCAAuC,CAAC;AACjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAUtE;;;;;;;GAOG;AACH,MAAM,OAAO,yCAAyC;IAEjC,kBAAkB;IADrC,YACmB,kBAAmD;kCAAnD,kBAAkB;IAClC,CAAC;IAEJ;;OAEG;IACH,SAAS;QACP,MAAM,kBAAkB,GAAG,IAAI,CAAC,kBAG/B,CAAC;QACF,MAAM,cAAc,GAAG,IAAI,CAAC,aAAa,CACvC,gBAAgB,EAChB,kBAAkB,CAAC,gBAAgB,CAAC,CACrC,CAAC;QAEF,OAAO;YACL,GAAG,IAAI,CAAC,kBAAkB;YAC1B,OAAO,EAAE,IAAI,CAAC,aAAa,CACzB,SAAS,EACT,kBAAkB,CAAC,SAAS,CAAC,CAC9B;YACD,OAAO,EAAE,IAAI,CAAC,aAAa,CACzB,SAAS,EACT,kBAAkB,CAAC,SAAS,CAAC,CAC9B;YACD,oBAAoB,EAClB,IAAI,CAAC,aAAa,CAChB,sBAAsB,EACtB,kBAAkB,CAAC,sBAAsB,CAAC,CAC3C;YACH,oBAAoB,EAClB,IAAI,CAAC,kBAAkB,CAAC,oBAAoB,KAAK,SAAS;gBACxD,CAAC,CAAC,SAAS;gBACX,CAAC,CAAC,IAAI,CAAC,sBAAsB,CACzB,IAAI,CAAC,kBAAkB,CAAC,oBAAoB,CAC7C;YACP,cAAc,EACZ,cAAc,KAAK,SAAS;gBAC1B,CAAC,CAAC,SAAS;gBACX,CAAC,CAAC;oBACE,GAAG,cAAc;oBACjB,KAAK,EAAE,cAAc,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,aAAa,EAAE,EAAE,CACjD,IAAI,CAAC,sBAAsB,CAAC,aAAa,CAAC,CAC3C;iBACF;SACR,CAAC;IACJ,CAAC;IAEO,sBAAsB,CAC5B,aAAgB;QAEhB,MAAM,mBAAmB,GAAG,aAAuC,CAAC;QAEpE,OAAO;YACL,GAAG,aAAa;YAChB,oBAAoB,EAClB,IAAI,CAAC,aAAa,CAChB,sBAAsB,EACtB,mBAAmB,CAAC,sBAAsB,CAAC,CAC5C;SACJ,CAAC;IACJ,CAAC;IAEO,aAAa,CACnB,QAAgB,EAChB,KAAc;QAEd,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,wBAAwB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QAE1C,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YACzB,OAAO;gBACL,KAAK,EAAE,KAAqB;aAC7B,CAAC;QACJ,CAAC;QAED,IAAI,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YACpB,OAAO;gBACL,GAAG,KAAK;gBACR,kEAAkE;gBAClE,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;oBAClC,CAAC,CAAE,KAAK,CAAC,OAAO,CAAkB;oBAClC,CAAC,CAAC,SAAS;aACd,CAAC;QACJ,CAAC;QAED,0CAA0C;QAC1C,OAAO,SAAS,CAAC;IACnB,CAAC;CACF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { SimCloudFrontKeyValueStore } from "../../key-value-store/sim-cf-key-value-store.js";
|
|
2
|
+
import type { SimCloudFrontKeyValueStoreRegistry } from "../../key-value-store/sim-cf-key-value-store-registry.js";
|
|
3
|
+
import type { SimCreateFunctionCommandInput } from "./create-function.command.js";
|
|
4
|
+
type FunctionConfig = SimCreateFunctionCommandInput["FunctionConfig"];
|
|
5
|
+
/**
|
|
6
|
+
* Resolve the key value store a new Function is associated with.
|
|
7
|
+
*
|
|
8
|
+
* CloudFront takes at most one association, and only on the 2.0 runtime: 1.0
|
|
9
|
+
* has no `cf` module to reach a store through, so an association on it would
|
|
10
|
+
* deploy and then fail at the edge. Both are refused here rather than being
|
|
11
|
+
* accepted and quietly doing nothing.
|
|
12
|
+
*
|
|
13
|
+
* https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/kvs-with-functions-associate.html
|
|
14
|
+
*/
|
|
15
|
+
export declare class CreateFunctionKeyValueStoreAssociation {
|
|
16
|
+
private readonly stores;
|
|
17
|
+
constructor(stores: SimCloudFrontKeyValueStoreRegistry);
|
|
18
|
+
/**
|
|
19
|
+
* The store the Function may read, or nothing if it names none.
|
|
20
|
+
*/
|
|
21
|
+
resolve(functionName: string, config: FunctionConfig): SimCloudFrontKeyValueStore | undefined;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=create-function-kvs-association.d.ts.map
|
package/dist/service/cloudfront/command/create-function/create-function-kvs-association.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-function-kvs-association.d.ts","sourceRoot":"","sources":["../../../../../src/service/cloudfront/command/create-function/create-function-kvs-association.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iDAAiD,CAAC;AAClG,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,0DAA0D,CAAC;AACnH,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,8BAA8B,CAAC;AAElF,KAAK,cAAc,GAAG,6BAA6B,CAAC,gBAAgB,CAAC,CAAC;AAEtE;;;;;;;;;GASG;AACH,qBAAa,sCAAsC;IACrC,OAAO,CAAC,QAAQ,CAAC,MAAM;IAAnC,YAA6B,MAAM,EAAE,kCAAkC,EAAI;IAE3E;;OAEG;IACH,OAAO,CACL,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,cAAc,GACrB,0BAA0B,GAAG,SAAS,CA+CxC;CACF"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { SimCloudFrontInvalidKeyValueStoreAssociation } from "../../error/sim-cf-key-value-store.error.js";
|
|
2
|
+
import { assertConsistentQuantity } from "../sim-cf-list-quantity.js";
|
|
3
|
+
/**
|
|
4
|
+
* Resolve the key value store a new Function is associated with.
|
|
5
|
+
*
|
|
6
|
+
* CloudFront takes at most one association, and only on the 2.0 runtime: 1.0
|
|
7
|
+
* has no `cf` module to reach a store through, so an association on it would
|
|
8
|
+
* deploy and then fail at the edge. Both are refused here rather than being
|
|
9
|
+
* accepted and quietly doing nothing.
|
|
10
|
+
*
|
|
11
|
+
* https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/kvs-with-functions-associate.html
|
|
12
|
+
*/
|
|
13
|
+
export class CreateFunctionKeyValueStoreAssociation {
|
|
14
|
+
stores;
|
|
15
|
+
constructor(stores) {
|
|
16
|
+
this.stores = stores;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The store the Function may read, or nothing if it names none.
|
|
20
|
+
*/
|
|
21
|
+
resolve(functionName, config) {
|
|
22
|
+
assertConsistentQuantity("KeyValueStoreAssociations", config?.KeyValueStoreAssociations);
|
|
23
|
+
const items = config?.KeyValueStoreAssociations?.Items ?? [];
|
|
24
|
+
if (items.length === 0) {
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
if (items.length > 1) {
|
|
28
|
+
throw new SimCloudFrontInvalidKeyValueStoreAssociation(`CloudFront Function ${functionName} associates ` +
|
|
29
|
+
`${String(items.length)} key value stores, and CloudFront takes at ` +
|
|
30
|
+
`most one`);
|
|
31
|
+
}
|
|
32
|
+
if (config?.Runtime === "cloudfront-js-1.0") {
|
|
33
|
+
throw new SimCloudFrontInvalidKeyValueStoreAssociation(`CloudFront Function ${functionName} associates a key value store on ` +
|
|
34
|
+
`the cloudfront-js-1.0 runtime, which cannot read one. Use ` +
|
|
35
|
+
`cloudfront-js-2.0.`);
|
|
36
|
+
}
|
|
37
|
+
const storeArn = items[0]?.KeyValueStoreARN;
|
|
38
|
+
if (storeArn === undefined) {
|
|
39
|
+
throw new SimCloudFrontInvalidKeyValueStoreAssociation(`CloudFront Function ${functionName} has a key value store ` +
|
|
40
|
+
`association with no KeyValueStoreARN`);
|
|
41
|
+
}
|
|
42
|
+
const store = this.stores.byArn(storeArn);
|
|
43
|
+
if (store === undefined) {
|
|
44
|
+
throw new SimCloudFrontInvalidKeyValueStoreAssociation(`CloudFront Function ${functionName} associates key value store ` +
|
|
45
|
+
`${storeArn}, which this Account does not hold`);
|
|
46
|
+
}
|
|
47
|
+
return store;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=create-function-kvs-association.js.map
|
package/dist/service/cloudfront/command/create-function/create-function-kvs-association.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-function-kvs-association.js","sourceRoot":"","sources":["../../../../../src/service/cloudfront/command/create-function/create-function-kvs-association.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4CAA4C,EAAE,MAAM,6CAA6C,CAAC;AAC3G,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAOtE;;;;;;;;;GASG;AACH,MAAM,OAAO,sCAAsC;IACpB,MAAM;IAAnC,YAA6B,MAA0C;sBAA1C,MAAM;IAAuC,CAAC;IAE3E;;OAEG;IACH,OAAO,CACL,YAAoB,EACpB,MAAsB;QAEtB,wBAAwB,CACtB,2BAA2B,EAC3B,MAAM,EAAE,yBAAyB,CAClC,CAAC;QAEF,MAAM,KAAK,GAAG,MAAM,EAAE,yBAAyB,EAAE,KAAK,IAAI,EAAE,CAAC;QAE7D,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACvB,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACrB,MAAM,IAAI,4CAA4C,CACpD,uBAAuB,YAAY,cAAc;gBAC/C,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,6CAA6C;gBACpE,UAAU,CACb,CAAC;QACJ,CAAC;QAED,IAAI,MAAM,EAAE,OAAO,KAAK,mBAAmB,EAAE,CAAC;YAC5C,MAAM,IAAI,4CAA4C,CACpD,uBAAuB,YAAY,mCAAmC;gBACpE,4DAA4D;gBAC5D,oBAAoB,CACvB,CAAC;QACJ,CAAC;QAED,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE,gBAAgB,CAAC;QAE5C,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC3B,MAAM,IAAI,4CAA4C,CACpD,uBAAuB,YAAY,yBAAyB;gBAC1D,sCAAsC,CACzC,CAAC;QACJ,CAAC;QAED,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAE1C,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,MAAM,IAAI,4CAA4C,CACpD,uBAAuB,YAAY,8BAA8B;gBAC/D,GAAG,QAAQ,oCAAoC,CAClD,CAAC;QACJ,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;CACF"}
|
|
@@ -17,6 +17,12 @@ export interface SimCreateFunctionCommandInput {
|
|
|
17
17
|
FunctionConfig?: undefined | {
|
|
18
18
|
Comment?: string | undefined;
|
|
19
19
|
Runtime?: "cloudfront-js-1.0" | "cloudfront-js-2.0" | undefined;
|
|
20
|
+
KeyValueStoreAssociations?: undefined | {
|
|
21
|
+
Quantity?: number | undefined;
|
|
22
|
+
Items?: readonly {
|
|
23
|
+
KeyValueStoreARN?: string | undefined;
|
|
24
|
+
}[] | undefined;
|
|
25
|
+
};
|
|
20
26
|
};
|
|
21
27
|
FunctionCode?: Uint8Array | undefined;
|
|
22
28
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-function.command.d.ts","sourceRoot":"","sources":["../../../../../src/service/cloudfront/command/create-function/create-function.command.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iDAAiD,CAAC;AAE3F;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,KAAK,EAAE,6BAA6B,CAAC;CAC/C;AAED;;GAEG;AACH,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,cAAc,CAAC,EACX,SAAS,GACT;QACE,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAC7B,OAAO,CAAC,EAAE,mBAAmB,GAAG,mBAAmB,GAAG,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"create-function.command.d.ts","sourceRoot":"","sources":["../../../../../src/service/cloudfront/command/create-function/create-function.command.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iDAAiD,CAAC;AAE3F;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,KAAK,EAAE,6BAA6B,CAAC;CAC/C;AAED;;GAEG;AACH,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,cAAc,CAAC,EACX,SAAS,GACT;QACE,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAC7B,OAAO,CAAC,EAAE,mBAAmB,GAAG,mBAAmB,GAAG,SAAS,CAAC;QAChE,yBAAyB,CAAC,EACtB,SAAS,GACT;YACE,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;YAC9B,KAAK,CAAC,EACF,SAAS;gBAAE,gBAAgB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;aAAE,EAAE,GACpD,SAAS,CAAC;SACf,CAAC;KACP,CAAC;IACN,YAAY,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;CACvC;AAED;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,CAAC,SAAS,EAAE,mBAAmB,CAAC;IACxC,eAAe,EAAE,4BAA4B,CAAC;IAC9C,gBAAgB,EAAE,6BAA6B,CAAC;CACjD;AAED;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,6BAA6B;IAC5C,WAAW,EAAE,MAAM,CAAC;CACrB"}
|
|
@@ -5,12 +5,14 @@ import { type BackgroundScheduler } from "../../../../util/background/background
|
|
|
5
5
|
import type { SimAwsAccountId } from "../../../aws/sim-aws-account.js";
|
|
6
6
|
import { type SimIamInterServiceAuthZ } from "../../../iam/authorize/sim-iam-inter-service-auth-z.js";
|
|
7
7
|
import type { SimAwsCaller } from "../../../aws/caller/sim-aws-caller.js";
|
|
8
|
+
import { SimCloudFrontKeyValueStoreRegistry } from "../../key-value-store/sim-cf-key-value-store-registry.js";
|
|
8
9
|
export type SimCloudFrontFunctionMap = Map<SimCloudFrontFunctionName, SimCloudFrontFunction>;
|
|
9
10
|
interface CreateFunctionCommandHandlerProperties {
|
|
10
11
|
accountId: SimAwsAccountId;
|
|
11
12
|
cloudFrontFunctions?: SimCloudFrontFunctionMap;
|
|
12
13
|
iam?: SimIamInterServiceAuthZ;
|
|
13
14
|
background?: BackgroundScheduler;
|
|
15
|
+
keyValueStores?: SimCloudFrontKeyValueStoreRegistry;
|
|
14
16
|
}
|
|
15
17
|
interface CreateFunctionCommandHandlerOptions {
|
|
16
18
|
readonly caller?: SimAwsCaller;
|
|
@@ -25,6 +27,7 @@ export declare class CreateFunctionCommandHandler implements CommandHandler<SimC
|
|
|
25
27
|
private readonly cloudFrontFunctions;
|
|
26
28
|
private readonly authorizer;
|
|
27
29
|
private readonly background;
|
|
30
|
+
private readonly keyValueStoreAssociation;
|
|
28
31
|
constructor(properties: CreateFunctionCommandHandlerProperties);
|
|
29
32
|
/**
|
|
30
33
|
* Create a sim CloudFront Function.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-function.handler.d.ts","sourceRoot":"","sources":["../../../../../src/service/cloudfront/command/create-function/create-function.handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,KAAK,EACV,wBAAwB,EACxB,8BAA8B,EAC/B,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EACL,qBAAqB,EACrB,KAAK,yBAAyB,EAC/B,MAAM,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"create-function.handler.d.ts","sourceRoot":"","sources":["../../../../../src/service/cloudfront/command/create-function/create-function.handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,KAAK,EACV,wBAAwB,EACxB,8BAA8B,EAC/B,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EACL,qBAAqB,EACrB,KAAK,yBAAyB,EAC/B,MAAM,sCAAsC,CAAC;AAG9C,OAAO,EACL,KAAK,mBAAmB,EAEzB,MAAM,2CAA2C,CAAC;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,wDAAwD,CAAC;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAG1E,OAAO,EAAE,kCAAkC,EAAE,MAAM,0DAA0D,CAAC;AAE9G,MAAM,MAAM,wBAAwB,GAAG,GAAG,CACxC,yBAAyB,EACzB,qBAAqB,CACtB,CAAC;AAEF,UAAU,sCAAsC;IAC9C,SAAS,EAAE,eAAe,CAAC;IAC3B,mBAAmB,CAAC,EAAE,wBAAwB,CAAC;IAC/C,GAAG,CAAC,EAAE,uBAAuB,CAAC;IAC9B,UAAU,CAAC,EAAE,mBAAmB,CAAC;IACjC,cAAc,CAAC,EAAE,kCAAkC,CAAC;CACrD;AAED,UAAU,mCAAmC;IAC3C,QAAQ,CAAC,MAAM,CAAC,EAAE,YAAY,CAAC;CAChC;AAED;;;;GAIG;AACH,qBAAa,4BAA6B,YAAW,cAAc,CACjE,wBAAwB,EACxB,8BAA8B,CAC/B;IACC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAkB;IAC5C,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAA2B;IAC/D,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA2B;IACtD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAsB;IACjD,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAAyC;IAElF,YAAY,UAAU,EAAE,sCAAsC,EAkB7D;IAED;;OAEG;IACG,MAAM,CACV,OAAO,EAAE,wBAAwB,EACjC,OAAO,CAAC,EAAE,mCAAmC,GAC5C,OAAO,CAAC,8BAA8B,CAAC,CA8CzC;CACF"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { assertDefined } from "../../../../util/type-guard/defined.js";
|
|
2
2
|
import { SimCloudFrontFunction, } from "../../cff/sim-cloudfront-function.js";
|
|
3
3
|
import { CffUint8ArrayFunctionCodeExtractor } from "../../cff/function-code-input/cff-function-code-input.js";
|
|
4
|
+
import { cffCloudFrontModule } from "../../cff/kvs/cff-cloudfront-module.js";
|
|
4
5
|
import { BackgroundTasks, } from "../../../../util/background/background.js";
|
|
5
6
|
import { SimIamAllowAllAuth, } from "../../../iam/authorize/sim-iam-inter-service-auth-z.js";
|
|
6
7
|
import { CreateFunctionAuthorizer } from "./create-function-authorizer.js";
|
|
8
|
+
import { CreateFunctionKeyValueStoreAssociation } from "./create-function-kvs-association.js";
|
|
9
|
+
import { SimCloudFrontKeyValueStoreRegistry } from "../../key-value-store/sim-cf-key-value-store-registry.js";
|
|
7
10
|
/**
|
|
8
11
|
* Simulated CloudFront CreateFunctionCommand handler.
|
|
9
12
|
*
|
|
@@ -14,8 +17,9 @@ export class CreateFunctionCommandHandler {
|
|
|
14
17
|
cloudFrontFunctions;
|
|
15
18
|
authorizer;
|
|
16
19
|
background;
|
|
20
|
+
keyValueStoreAssociation;
|
|
17
21
|
constructor(properties) {
|
|
18
|
-
const { accountId, cloudFrontFunctions = new Map(), iam = new SimIamAllowAllAuth(), background = new BackgroundTasks(), } = properties;
|
|
22
|
+
const { accountId, cloudFrontFunctions = new Map(), iam = new SimIamAllowAllAuth(), background = new BackgroundTasks(), keyValueStores = new SimCloudFrontKeyValueStoreRegistry(), } = properties;
|
|
19
23
|
this.accountId = accountId;
|
|
20
24
|
this.cloudFrontFunctions = cloudFrontFunctions;
|
|
21
25
|
this.authorizer = new CreateFunctionAuthorizer({
|
|
@@ -23,6 +27,7 @@ export class CreateFunctionCommandHandler {
|
|
|
23
27
|
iam,
|
|
24
28
|
});
|
|
25
29
|
this.background = background;
|
|
30
|
+
this.keyValueStoreAssociation = new CreateFunctionKeyValueStoreAssociation(keyValueStores);
|
|
26
31
|
}
|
|
27
32
|
/**
|
|
28
33
|
* Create a sim CloudFront Function.
|
|
@@ -33,12 +38,16 @@ export class CreateFunctionCommandHandler {
|
|
|
33
38
|
// Allow for potential non-deterministic sequencing of async events.
|
|
34
39
|
await this.background.sequence();
|
|
35
40
|
this.authorizer.authorize(command.input.Name, options?.caller);
|
|
36
|
-
const
|
|
41
|
+
const keyValueStore = this.keyValueStoreAssociation.resolve(command.input.Name, command.input.FunctionConfig);
|
|
42
|
+
// The extractor is given the store so that source code running in the vm
|
|
43
|
+
// sandbox gets a `cf` bound to this Function's own association.
|
|
44
|
+
const extractor = new CffUint8ArrayFunctionCodeExtractor(command.input.FunctionCode, cffCloudFrontModule(keyValueStore));
|
|
37
45
|
const handlerFunction = extractor.extractHandlerFunction();
|
|
38
46
|
const simCff = new SimCloudFrontFunction({
|
|
39
47
|
name: command.input.Name,
|
|
40
48
|
accountId: this.accountId,
|
|
41
49
|
handlerFunction,
|
|
50
|
+
keyValueStore,
|
|
42
51
|
});
|
|
43
52
|
this.cloudFrontFunctions.set(simCff.name, simCff);
|
|
44
53
|
// New CFF becomes available async in background.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-function.handler.js","sourceRoot":"","sources":["../../../../../src/service/cloudfront/command/create-function/create-function.handler.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AACvE,OAAO,EACL,qBAAqB,GAEtB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,kCAAkC,EAAE,MAAM,0DAA0D,CAAC;AAC9G,OAAO,EAEL,eAAe,GAChB,MAAM,2CAA2C,CAAC;AAEnD,OAAO,EACL,kBAAkB,GAEnB,MAAM,wDAAwD,CAAC;AAEhE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"create-function.handler.js","sourceRoot":"","sources":["../../../../../src/service/cloudfront/command/create-function/create-function.handler.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AACvE,OAAO,EACL,qBAAqB,GAEtB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,kCAAkC,EAAE,MAAM,0DAA0D,CAAC;AAC9G,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAEL,eAAe,GAChB,MAAM,2CAA2C,CAAC;AAEnD,OAAO,EACL,kBAAkB,GAEnB,MAAM,wDAAwD,CAAC;AAEhE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAAE,sCAAsC,EAAE,MAAM,sCAAsC,CAAC;AAC9F,OAAO,EAAE,kCAAkC,EAAE,MAAM,0DAA0D,CAAC;AAmB9G;;;;GAIG;AACH,MAAM,OAAO,4BAA4B;IAItB,SAAS,CAAkB;IAC3B,mBAAmB,CAA2B;IAC9C,UAAU,CAA2B;IACrC,UAAU,CAAsB;IAChC,wBAAwB,CAAyC;IAElF,YAAY,UAAkD;QAC5D,MAAM,EACJ,SAAS,EACT,mBAAmB,GAAG,IAAI,GAAG,EAA8B,EAC3D,GAAG,GAAG,IAAI,kBAAkB,EAAE,EAC9B,UAAU,GAAG,IAAI,eAAe,EAAE,EAClC,cAAc,GAAG,IAAI,kCAAkC,EAAE,GAC1D,GAAG,UAAU,CAAC;QACf,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,mBAAmB,GAAG,mBAAmB,CAAC;QAC/C,IAAI,CAAC,UAAU,GAAG,IAAI,wBAAwB,CAAC;YAC7C,SAAS;YACT,GAAG;SACJ,CAAC,CAAC;QACH,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,wBAAwB,GAAG,IAAI,sCAAsC,CACxE,cAAc,CACf,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM,CACV,OAAiC,EACjC,OAA6C;QAE7C,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,kCAAkC,CAAC,CAAC;QACtE,aAAa,CACX,OAAO,CAAC,KAAK,CAAC,YAAY,EAC1B,0CAA0C,CAC3C,CAAC;QAEF,oEAAoE;QACpE,MAAM,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC;QAEjC,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QAE/D,MAAM,aAAa,GAAG,IAAI,CAAC,wBAAwB,CAAC,OAAO,CACzD,OAAO,CAAC,KAAK,CAAC,IAAI,EAClB,OAAO,CAAC,KAAK,CAAC,cAAc,CAC7B,CAAC;QAEF,yEAAyE;QACzE,gEAAgE;QAChE,MAAM,SAAS,GAAG,IAAI,kCAAkC,CACtD,OAAO,CAAC,KAAK,CAAC,YAAY,EAC1B,mBAAmB,CAAC,aAAa,CAAC,CACnC,CAAC;QACF,MAAM,eAAe,GAAG,SAAS,CAAC,sBAAsB,EAAE,CAAC;QAC3D,MAAM,MAAM,GAAG,IAAI,qBAAqB,CAAC;YACvC,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI;YACxB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,eAAe;YACf,aAAa;SACd,CAAC,CAAC;QAEH,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAElD,iDAAiD;QACjD,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;QAEjD,OAAO;YACL,SAAS,EAAE,EAAE;YACb,eAAe,EAAE;gBACf,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,MAAM,EAAE,MAAM,CAAC,MAAM;aACtB;YACD,gBAAgB,EAAE;gBAChB,WAAW,EAAE,MAAM,CAAC,GAAG;aACxB;SACF,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { assertDefined } from "../../../../util/type-guard/defined.js";
|
|
2
|
-
import { SimCloudFrontCannotDeleteEntityWhileInUse } from "../../error/sim-
|
|
2
|
+
import { SimCloudFrontCannotDeleteEntityWhileInUse } from "../../error/sim-cf-key-value-store.error.js";
|
|
3
3
|
/**
|
|
4
4
|
* Simulated CloudFront DeleteKeyValueStore command.
|
|
5
5
|
*
|
package/dist/service/cloudfront/command/key-value-store/sim-cf-delete-key-value-store.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sim-cf-delete-key-value-store.js","sourceRoot":"","sources":["../../../../../src/service/cloudfront/command/key-value-store/sim-cf-delete-key-value-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAEvE,OAAO,EAAE,yCAAyC,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"sim-cf-delete-key-value-store.js","sourceRoot":"","sources":["../../../../../src/service/cloudfront/command/key-value-store/sim-cf-delete-key-value-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAEvE,OAAO,EAAE,yCAAyC,EAAE,MAAM,6CAA6C,CAAC;AASxG;;;;GAIG;AACH,MAAM,OAAO,wBAAwB;IAIhB,MAAM;IACN,KAAK;IAJhB,MAAM,CAAU,MAAM,GAAG,gCAAgC,CAAC;IAElE,YACmB,MAAgC,EAChC,KAA8B;sBAD9B,MAAM;qBACN,KAAK;IACrB,CAAC;IAEJ;;OAEG;IACH,KAAK,CAAC,MAAM,CACV,OAAsC,EACtC,OAA4C;QAE5C,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,uCAAuC,CAAC,CAAC;QAC3E,aAAa,CACX,OAAO,CAAC,KAAK,CAAC,OAAO,EACrB,0CAA0C,CAC3C,CAAC;QAEF,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC;QAExC,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,gBAAgB,CACxC,wBAAwB,CAAC,MAAM,EAC/B,OAAO,CAAC,KAAK,CAAC,IAAI,EAClB,OAAO,EAAE,MAAM,CAChB,CAAC;QAEF,KAAK,CAAC,kBAAkB,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAChD,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;QAE1C,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAEpC,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;IAC3B,CAAC;IAED;;OAEG;IACK,cAAc,CACpB,OAAqC,EACrC,SAAiB;QAEjB,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;QAErD,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACzB,MAAM,IAAI,yCAAyC,CACjD,kCAAkC,SAAS,4BAA4B;gBACrE,uBAAuB,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAChD,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Refuse a CloudFront list whose `Quantity` disagrees with its `Items`.
|
|
3
|
+
*
|
|
4
|
+
* Every CloudFront list carries both a count and the items, and CloudFront
|
|
5
|
+
* refuses a request where they disagree. The count is easy to get wrong by hand
|
|
6
|
+
* and nothing else catches it: a `Quantity` of 0 alongside one item would
|
|
7
|
+
* otherwise create the item, and a `Quantity` of 1 alongside none would create
|
|
8
|
+
* nothing, either way deploying something the caller did not describe.
|
|
9
|
+
*
|
|
10
|
+
* A list arriving as a plain array carries no count to disagree with. That is
|
|
11
|
+
* the CloudFormation shape, where the property is an array rather than the pair,
|
|
12
|
+
* so there is nothing to check.
|
|
13
|
+
*
|
|
14
|
+
* A record with no `Quantity` at all is accepted rather than refused. The AWS
|
|
15
|
+
* SDK types make omitting it a compile error, so what reaches here without one
|
|
16
|
+
* is a hand-written `{ Items: [...] }`, and refusing that would be stricter
|
|
17
|
+
* than the mistake is worth.
|
|
18
|
+
*/
|
|
19
|
+
export declare function assertConsistentQuantity(listName: string, value: unknown): void;
|
|
20
|
+
//# sourceMappingURL=sim-cf-list-quantity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-cf-list-quantity.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudfront/command/sim-cf-list-quantity.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,OAAO,GACb,IAAI,CAoBN"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { isRecord } from "../../../util/type-guard/record.js";
|
|
2
|
+
import { SimCloudFrontInconsistentQuantities } from "../error/sim-cloudfront.error.js";
|
|
3
|
+
/**
|
|
4
|
+
* Refuse a CloudFront list whose `Quantity` disagrees with its `Items`.
|
|
5
|
+
*
|
|
6
|
+
* Every CloudFront list carries both a count and the items, and CloudFront
|
|
7
|
+
* refuses a request where they disagree. The count is easy to get wrong by hand
|
|
8
|
+
* and nothing else catches it: a `Quantity` of 0 alongside one item would
|
|
9
|
+
* otherwise create the item, and a `Quantity` of 1 alongside none would create
|
|
10
|
+
* nothing, either way deploying something the caller did not describe.
|
|
11
|
+
*
|
|
12
|
+
* A list arriving as a plain array carries no count to disagree with. That is
|
|
13
|
+
* the CloudFormation shape, where the property is an array rather than the pair,
|
|
14
|
+
* so there is nothing to check.
|
|
15
|
+
*
|
|
16
|
+
* A record with no `Quantity` at all is accepted rather than refused. The AWS
|
|
17
|
+
* SDK types make omitting it a compile error, so what reaches here without one
|
|
18
|
+
* is a hand-written `{ Items: [...] }`, and refusing that would be stricter
|
|
19
|
+
* than the mistake is worth.
|
|
20
|
+
*/
|
|
21
|
+
export function assertConsistentQuantity(listName, value) {
|
|
22
|
+
if (!isRecord(value)) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const quantity = value["Quantity"];
|
|
26
|
+
if (typeof quantity !== "number") {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const items = value["Items"];
|
|
30
|
+
const itemCount = Array.isArray(items) ? items.length : 0;
|
|
31
|
+
if (quantity !== itemCount) {
|
|
32
|
+
throw new SimCloudFrontInconsistentQuantities(`CloudFront ${listName} has Quantity ${String(quantity)} and ` +
|
|
33
|
+
`${String(itemCount)} Items`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=sim-cf-list-quantity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-cf-list-quantity.js","sourceRoot":"","sources":["../../../../src/service/cloudfront/command/sim-cf-list-quantity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAC9D,OAAO,EAAE,mCAAmC,EAAE,MAAM,kCAAkC,CAAC;AAEvF;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,wBAAwB,CACtC,QAAgB,EAChB,KAAc;IAEd,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACrB,OAAO;IACT,CAAC;IAED,MAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC;IAEnC,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;QACjC,OAAO;IACT,CAAC;IAED,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC;IAC7B,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAE1D,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,MAAM,IAAI,mCAAmC,CAC3C,cAAc,QAAQ,iBAAiB,MAAM,CAAC,QAAQ,CAAC,OAAO;YAC5D,GAAG,MAAM,CAAC,SAAS,CAAC,QAAQ,CAC/B,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -7,10 +7,10 @@ export declare class SimCffApplicator {
|
|
|
7
7
|
/**
|
|
8
8
|
* Apply viewer request CloudFront Function if configured.
|
|
9
9
|
*/
|
|
10
|
-
applyViewerRequest(cloudFront: SimCloudFront, request: Request, behaviour: SimCloudFrontBehavior): Request | Response
|
|
10
|
+
applyViewerRequest(cloudFront: SimCloudFront, request: Request, behaviour: SimCloudFrontBehavior): Promise<Request | Response>;
|
|
11
11
|
/**
|
|
12
12
|
* Apply viewer response CloudFront Function if configured.
|
|
13
13
|
*/
|
|
14
|
-
applyViewerResponse(cloudFront: SimCloudFront, request: Request, response: Response, behaviour: SimCloudFrontBehavior): Response
|
|
14
|
+
applyViewerResponse(cloudFront: SimCloudFront, request: Request, response: Response, behaviour: SimCloudFrontBehavior): Promise<Response>;
|
|
15
15
|
}
|
|
16
16
|
//# sourceMappingURL=sim-cff-applicator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sim-cff-applicator.d.ts","sourceRoot":"","sources":["../../../../../src/service/cloudfront/controller/cff/sim-cff-applicator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AAGzF;;GAEG;AACH,qBAAa,gBAAgB;IAC3B;;OAEG;
|
|
1
|
+
{"version":3,"file":"sim-cff-applicator.d.ts","sourceRoot":"","sources":["../../../../../src/service/cloudfront/controller/cff/sim-cff-applicator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AAGzF;;GAEG;AACH,qBAAa,gBAAgB;IAC3B;;OAEG;IACG,kBAAkB,CACtB,UAAU,EAAE,aAAa,EACzB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,qBAAqB,GAC/B,OAAO,CAAC,OAAO,GAAG,QAAQ,CAAC,CAc7B;IAED;;OAEG;IACG,mBAAmB,CACvB,UAAU,EAAE,aAAa,EACzB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,qBAAqB,GAC/B,OAAO,CAAC,QAAQ,CAAC,CAcnB;CACF"}
|
|
@@ -6,26 +6,26 @@ export class SimCffApplicator {
|
|
|
6
6
|
/**
|
|
7
7
|
* Apply viewer request CloudFront Function if configured.
|
|
8
8
|
*/
|
|
9
|
-
applyViewerRequest(cloudFront, request, behaviour) {
|
|
9
|
+
async applyViewerRequest(cloudFront, request, behaviour) {
|
|
10
10
|
const viewerRequestCffArn = behaviour.functionAssociations?.viewerRequest;
|
|
11
11
|
if (viewerRequestCffArn === undefined) {
|
|
12
|
-
return request;
|
|
12
|
+
return await Promise.resolve(request);
|
|
13
13
|
}
|
|
14
14
|
const viewerRequestCff = cloudFront.getCloudFrontFunctionByArn(viewerRequestCffArn);
|
|
15
15
|
assertDefined(viewerRequestCff, `CloudFront Function ${viewerRequestCffArn} for viewer-request`);
|
|
16
|
-
return viewerRequestCff.handleViewerRequest(request);
|
|
16
|
+
return await viewerRequestCff.handleViewerRequest(request);
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
19
|
* Apply viewer response CloudFront Function if configured.
|
|
20
20
|
*/
|
|
21
|
-
applyViewerResponse(cloudFront, request, response, behaviour) {
|
|
21
|
+
async applyViewerResponse(cloudFront, request, response, behaviour) {
|
|
22
22
|
const viewerResponseCffArn = behaviour.functionAssociations?.viewerResponse;
|
|
23
23
|
if (viewerResponseCffArn === undefined) {
|
|
24
|
-
return response;
|
|
24
|
+
return await Promise.resolve(response);
|
|
25
25
|
}
|
|
26
26
|
const viewerResponseCff = cloudFront.getCloudFrontFunctionByArn(viewerResponseCffArn);
|
|
27
27
|
assertDefined(viewerResponseCff, `CloudFront Function ${viewerResponseCffArn} for viewer-response`);
|
|
28
|
-
return viewerResponseCff.handleViewerResponse(request, response);
|
|
28
|
+
return await viewerResponseCff.handleViewerResponse(request, response);
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
//# sourceMappingURL=sim-cff-applicator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sim-cff-applicator.js","sourceRoot":"","sources":["../../../../../src/service/cloudfront/controller/cff/sim-cff-applicator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAEvE;;GAEG;AACH,MAAM,OAAO,gBAAgB;IAC3B;;OAEG;IACH,kBAAkB,
|
|
1
|
+
{"version":3,"file":"sim-cff-applicator.js","sourceRoot":"","sources":["../../../../../src/service/cloudfront/controller/cff/sim-cff-applicator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAEvE;;GAEG;AACH,MAAM,OAAO,gBAAgB;IAC3B;;OAEG;IACH,KAAK,CAAC,kBAAkB,CACtB,UAAyB,EACzB,OAAgB,EAChB,SAAgC;QAEhC,MAAM,mBAAmB,GAAG,SAAS,CAAC,oBAAoB,EAAE,aAAa,CAAC;QAC1E,IAAI,mBAAmB,KAAK,SAAS,EAAE,CAAC;YACtC,OAAO,MAAM,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACxC,CAAC;QAED,MAAM,gBAAgB,GACpB,UAAU,CAAC,0BAA0B,CAAC,mBAAmB,CAAC,CAAC;QAC7D,aAAa,CACX,gBAAgB,EAChB,uBAAuB,mBAAmB,qBAAqB,CAChE,CAAC;QAEF,OAAO,MAAM,gBAAgB,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;IAC7D,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,mBAAmB,CACvB,UAAyB,EACzB,OAAgB,EAChB,QAAkB,EAClB,SAAgC;QAEhC,MAAM,oBAAoB,GAAG,SAAS,CAAC,oBAAoB,EAAE,cAAc,CAAC;QAC5E,IAAI,oBAAoB,KAAK,SAAS,EAAE,CAAC;YACvC,OAAO,MAAM,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QACzC,CAAC;QAED,MAAM,iBAAiB,GACrB,UAAU,CAAC,0BAA0B,CAAC,oBAAoB,CAAC,CAAC;QAC9D,aAAa,CACX,iBAAiB,EACjB,uBAAuB,oBAAoB,sBAAsB,CAClE,CAAC;QAEF,OAAO,MAAM,iBAAiB,CAAC,oBAAoB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IACzE,CAAC;CACF"}
|
|
@@ -33,7 +33,7 @@ export class SimCloudFrontRequestPipeline {
|
|
|
33
33
|
// Handle viewer-request CFF, if any.
|
|
34
34
|
// A viewer-request CFF can either rewrite the Request that continues to the
|
|
35
35
|
// Origin or short-circuit the request by returning a Response.
|
|
36
|
-
const cffResult = this.stages.cffApplicator.applyViewerRequest(cloudFront, requestReference, behaviour);
|
|
36
|
+
const cffResult = await this.stages.cffApplicator.applyViewerRequest(cloudFront, requestReference, behaviour);
|
|
37
37
|
if (cffResult instanceof Response) {
|
|
38
38
|
return cffResult;
|
|
39
39
|
}
|
|
@@ -51,7 +51,7 @@ export class SimCloudFrontRequestPipeline {
|
|
|
51
51
|
// Handle viewer-response CFF, if any.
|
|
52
52
|
// A viewer-response CFF can inspect the original request and replace or
|
|
53
53
|
// modify the Origin response before it is returned to the caller.
|
|
54
|
-
return this.stages.cffApplicator.applyViewerResponse(cloudFront, requestReference, response, behaviour);
|
|
54
|
+
return await this.stages.cffApplicator.applyViewerResponse(cloudFront, requestReference, response, behaviour);
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
//# sourceMappingURL=sim-cloudfront-request-pipeline.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sim-cloudfront-request-pipeline.js","sourceRoot":"","sources":["../../../../src/service/cloudfront/controller/sim-cloudfront-request-pipeline.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,6BAA6B,EAAE,MAAM,qDAAqD,CAAC;AAEpG;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,4BAA4B;IACV,MAAM;IAAnC,YAA6B,MAA2C;sBAA3C,MAAM;IAAwC,CAAC;IAE5E;;OAEG;IACH,KAAK,CAAC,MAAM,CAAC,OAAgB;QAC3B,IAAI,gBAAgB,GAAG,OAAO,CAAC;QAE/B,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,eAAe,CAAC,gBAAgB,CAAC,CAAC;QAEzE,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,OAAO,IAAI,QAAQ,CAAC,gDAAgD,EAAE;gBACpE,MAAM,EAAE,GAAG;aACZ,CAAC,CAAC;QACL,CAAC;QAED,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;QAEnD,gBAAgB,GAAG,6BAA6B,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;QAE3E,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,OAAO,CACrD,gBAAgB,EAChB,MAAM,CACP,CAAC;QAEF,qCAAqC;QACrC,4EAA4E;QAC5E,+DAA+D;QAC/D,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,kBAAkB,
|
|
1
|
+
{"version":3,"file":"sim-cloudfront-request-pipeline.js","sourceRoot":"","sources":["../../../../src/service/cloudfront/controller/sim-cloudfront-request-pipeline.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,6BAA6B,EAAE,MAAM,qDAAqD,CAAC;AAEpG;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,4BAA4B;IACV,MAAM;IAAnC,YAA6B,MAA2C;sBAA3C,MAAM;IAAwC,CAAC;IAE5E;;OAEG;IACH,KAAK,CAAC,MAAM,CAAC,OAAgB;QAC3B,IAAI,gBAAgB,GAAG,OAAO,CAAC;QAE/B,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,eAAe,CAAC,gBAAgB,CAAC,CAAC;QAEzE,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,OAAO,IAAI,QAAQ,CAAC,gDAAgD,EAAE;gBACpE,MAAM,EAAE,GAAG;aACZ,CAAC,CAAC;QACL,CAAC;QAED,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;QAEnD,gBAAgB,GAAG,6BAA6B,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;QAE3E,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,OAAO,CACrD,gBAAgB,EAChB,MAAM,CACP,CAAC;QAEF,qCAAqC;QACrC,4EAA4E;QAC5E,+DAA+D;QAC/D,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,kBAAkB,CAClE,UAAU,EACV,gBAAgB,EAChB,SAAS,CACV,CAAC;QACF,IAAI,SAAS,YAAY,QAAQ,EAAE,CAAC;YAClC,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,gBAAgB,GAAG,SAAS,CAAC;QAE7B,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAC1D,gBAAgB,EAChB,MAAM,EACN,SAAS,CACV,CAAC;QAEF,2EAA2E;QAC3E,0EAA0E;QAC1E,uEAAuE;QACvE,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC,KAAK,CAChE,gBAAgB,EAChB,MAAM,EACN,cAAc,CACf,CAAC;QAEF,4EAA4E;QAC5E,+DAA+D;QAC/D,oEAAoE;QACpE,6DAA6D;QAC7D,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,yBAAyB,CAAC,KAAK,CAC1D,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,SAAS,CACV,CAAC;QAEF,sCAAsC;QACtC,wEAAwE;QACxE,kEAAkE;QAClE,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,mBAAmB,CACxD,UAAU,EACV,gBAAgB,EAChB,QAAQ,EACR,SAAS,CACV,CAAC;IACJ,CAAC;CACF"}
|
package/dist/service/cloudfront/distribution/configurator/sim-cf-behavior-properties.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sim-cf-behavior-properties.d.ts","sourceRoot":"","sources":["../../../../../src/service/cloudfront/distribution/configurator/sim-cf-behavior-properties.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gCAAgC,EAChC,uCAAuC,EAExC,MAAM,kEAAkE,CAAC;AAC1E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AAEzF,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,8CAA8C,CAAC;
|
|
1
|
+
{"version":3,"file":"sim-cf-behavior-properties.d.ts","sourceRoot":"","sources":["../../../../../src/service/cloudfront/distribution/configurator/sim-cf-behavior-properties.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gCAAgC,EAChC,uCAAuC,EAExC,MAAM,kEAAkE,CAAC;AAC1E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AAEzF,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,8CAA8C,CAAC;AAIvG;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,aAAa,EACT,uCAAuC,GACvC,gCAAgC,EACpC,qBAAqB,EAAE,kCAAkC,GACxD,qBAAqB,CA0BvB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { assertDefined } from "../../../../util/type-guard/defined.js";
|
|
2
2
|
import { configureCffAssociations } from "./sim-cff-associations-configure.js";
|
|
3
|
+
import { assertConsistentQuantity } from "../../command/sim-cf-list-quantity.js";
|
|
3
4
|
/**
|
|
4
5
|
* Build the Behavior properties common to both the default Cache Behavior and
|
|
5
6
|
* a named one. Callers add their own fields, such as the path pattern, on top.
|
|
@@ -10,11 +11,11 @@ export function simCfBehaviorProperties(cacheBehavior, responseHeadersPolicy) {
|
|
|
10
11
|
responseHeadersPolicy.assertExists(TargetOriginId, ResponseHeadersPolicyId);
|
|
11
12
|
return {
|
|
12
13
|
targetOriginName: TargetOriginId,
|
|
13
|
-
allowedMethods: methodsSet(cacheBehavior.AllowedMethods, [
|
|
14
|
-
cachedMethods: methodsSet(cacheBehavior.AllowedMethods?.CachedMethods, [
|
|
14
|
+
allowedMethods: methodsSet("AllowedMethods", cacheBehavior.AllowedMethods, [
|
|
15
15
|
"GET",
|
|
16
16
|
"HEAD",
|
|
17
17
|
]),
|
|
18
|
+
cachedMethods: methodsSet("CachedMethods", cacheBehavior.AllowedMethods?.CachedMethods, ["GET", "HEAD"]),
|
|
18
19
|
...(cacheBehavior.ViewerProtocolPolicy !== undefined && {
|
|
19
20
|
viewerProtocolPolicy: cacheBehavior.ViewerProtocolPolicy,
|
|
20
21
|
}),
|
|
@@ -28,7 +29,8 @@ export function simCfBehaviorProperties(cacheBehavior, responseHeadersPolicy) {
|
|
|
28
29
|
* Build a Set of HTTP methods from a method list config, falling back to the
|
|
29
30
|
* provided defaults when no items are configured.
|
|
30
31
|
*/
|
|
31
|
-
function methodsSet(methods, fallback) {
|
|
32
|
+
function methodsSet(listName, methods, fallback) {
|
|
33
|
+
assertConsistentQuantity(listName, methods);
|
|
32
34
|
return new Set(methods?.Items ?? fallback);
|
|
33
35
|
}
|
|
34
36
|
//# sourceMappingURL=sim-cf-behavior-properties.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sim-cf-behavior-properties.js","sourceRoot":"","sources":["../../../../../src/service/cloudfront/distribution/configurator/sim-cf-behavior-properties.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAEvE,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"sim-cf-behavior-properties.js","sourceRoot":"","sources":["../../../../../src/service/cloudfront/distribution/configurator/sim-cf-behavior-properties.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAEvE,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAC/E,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AAEjF;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CACrC,aAEoC,EACpC,qBAAyD;IAEzD,MAAM,EAAE,cAAc,EAAE,uBAAuB,EAAE,GAAG,aAAa,CAAC;IAElE,aAAa,CAAC,cAAc,EAAE,yCAAyC,CAAC,CAAC;IAEzE,qBAAqB,CAAC,YAAY,CAAC,cAAc,EAAE,uBAAuB,CAAC,CAAC;IAE5E,OAAO;QACL,gBAAgB,EAAE,cAAc;QAChC,cAAc,EAAE,UAAU,CAAC,gBAAgB,EAAE,aAAa,CAAC,cAAc,EAAE;YACzE,KAAK;YACL,MAAM;SACP,CAAC;QACF,aAAa,EAAE,UAAU,CACvB,eAAe,EACf,aAAa,CAAC,cAAc,EAAE,aAAa,EAC3C,CAAC,KAAK,EAAE,MAAM,CAAC,CAChB;QACD,GAAG,CAAC,aAAa,CAAC,oBAAoB,KAAK,SAAS,IAAI;YACtD,oBAAoB,EAAE,aAAa,CAAC,oBAAoB;SACzD,CAAC;QACF,GAAG,CAAC,uBAAuB,KAAK,SAAS,IAAI;YAC3C,uBAAuB,EAAE,uBAAuB;SACjD,CAAC;QACF,oBAAoB,EAAE,wBAAwB,CAAC,aAAa,CAAC;KAC9D,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,SAAS,UAAU,CACjB,QAAgB,EAChB,OAA4C,EAC5C,QAAkB;IAElB,wBAAwB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAE5C,OAAO,IAAI,GAAG,CAAC,OAAO,EAAE,KAAK,IAAI,QAAQ,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { SimCloudFrontError } from "./sim-cloudfront.error.js";
|
|
2
|
+
/**
|
|
3
|
+
* Simulated CloudFront EntityAlreadyExists error.
|
|
4
|
+
*
|
|
5
|
+
* CloudFront requires a key value store name to be unique within an account,
|
|
6
|
+
* so a second store claiming a name is refused rather than created.
|
|
7
|
+
*/
|
|
8
|
+
export declare class SimCloudFrontEntityAlreadyExists extends SimCloudFrontError {
|
|
9
|
+
readonly name = "EntityAlreadyExists";
|
|
10
|
+
constructor(message: string);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Simulated CloudFront EntityNotFound error.
|
|
14
|
+
*
|
|
15
|
+
* What CloudFront answers when a key value store name, ID or ARN names
|
|
16
|
+
* nothing the account holds.
|
|
17
|
+
*/
|
|
18
|
+
export declare class SimCloudFrontEntityNotFound extends SimCloudFrontError {
|
|
19
|
+
readonly name = "EntityNotFound";
|
|
20
|
+
constructor(message: string);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Simulated CloudFront CannotDeleteEntityWhileInUse error.
|
|
24
|
+
*
|
|
25
|
+
* CloudFront will not delete a key value store a Function is still associated
|
|
26
|
+
* with. The caller updates the Function to drop the association first.
|
|
27
|
+
*/
|
|
28
|
+
export declare class SimCloudFrontCannotDeleteEntityWhileInUse extends SimCloudFrontError {
|
|
29
|
+
readonly name = "CannotDeleteEntityWhileInUse";
|
|
30
|
+
constructor(message: string);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Simulated CloudFront PreconditionFailed error.
|
|
34
|
+
*
|
|
35
|
+
* What CloudFront answers when a write carries an IfMatch ETag that is not the
|
|
36
|
+
* resource's current one, which is how it stops two writers overwriting each
|
|
37
|
+
* other.
|
|
38
|
+
*/
|
|
39
|
+
export declare class SimCloudFrontPreconditionFailed extends SimCloudFrontError {
|
|
40
|
+
readonly name = "PreconditionFailed";
|
|
41
|
+
constructor(message: string);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Simulated CloudFront key value store ResourceNotFoundException error.
|
|
45
|
+
*
|
|
46
|
+
* What the key value store data API answers for a key that is not stored. It
|
|
47
|
+
* is the data API's own error rather than one of CloudFront's, which is why it
|
|
48
|
+
* is named in the exception style that API uses.
|
|
49
|
+
*/
|
|
50
|
+
export declare class SimCloudFrontKeyValueStoreKeyNotFound extends SimCloudFrontError {
|
|
51
|
+
readonly name = "ResourceNotFoundException";
|
|
52
|
+
constructor(message: string);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Simulated CloudFront Function key value store access error.
|
|
56
|
+
*
|
|
57
|
+
* What a Function gets from `cf.kvs()` when there is no store it may open: it
|
|
58
|
+
* has no association, or it asked for one other than the store it names. Real
|
|
59
|
+
* CloudFront fails the Function at that point too, so this refuses rather than
|
|
60
|
+
* handing back an empty store the Function would read every default from.
|
|
61
|
+
*/
|
|
62
|
+
export declare class SimCloudFrontCffKvsUnavailable extends SimCloudFrontError {
|
|
63
|
+
readonly name = "CffKeyValueStoreUnavailable";
|
|
64
|
+
constructor(message: string);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Simulated CloudFront InvalidKeyValueStoreAssociation error.
|
|
68
|
+
*
|
|
69
|
+
* What CloudFront answers for a Function association it will not take: more
|
|
70
|
+
* than one store, a store the Account does not hold, or any association at all
|
|
71
|
+
* on the 1.0 runtime, which cannot read one.
|
|
72
|
+
*/
|
|
73
|
+
export declare class SimCloudFrontInvalidKeyValueStoreAssociation extends SimCloudFrontError {
|
|
74
|
+
readonly name = "InvalidKeyValueStoreAssociation";
|
|
75
|
+
constructor(message: string);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Simulated key value store data API ResourceNotFoundException error.
|
|
79
|
+
*
|
|
80
|
+
* What that API answers for a `KvsARN` naming no store. The two clients have
|
|
81
|
+
* separate error sets, so this is not CloudFront's `EntityNotFound` even
|
|
82
|
+
* though both mean the store was not found.
|
|
83
|
+
*/
|
|
84
|
+
export declare class SimCloudFrontKeyValueStoreNotFound extends SimCloudFrontError {
|
|
85
|
+
readonly name = "ResourceNotFoundException";
|
|
86
|
+
constructor(message: string);
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=sim-cf-key-value-store.error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-cf-key-value-store.error.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudfront/error/sim-cf-key-value-store.error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D;;;;;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;;;;;;;GAOG;AACH,qBAAa,8BAA+B,SAAQ,kBAAkB;IACpE,SAAyB,IAAI,iCAAiC;IAE9D,YAAY,OAAO,EAAE,MAAM,EAE1B;CACF;AAED;;;;;;GAMG;AACH,qBAAa,4CAA6C,SAAQ,kBAAkB;IAClF,SAAyB,IAAI,qCAAqC;IAElE,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"}
|