@kensio/yulin 0.28.0 → 0.30.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/docs/tsconfig.tsbuildinfo +1 -1
- package/dist/service/acm/sim-acm.d.ts +1 -1
- package/dist/service/acm/sim-acm.d.ts.map +1 -1
- package/dist/service/acm/sim-acm.js +1 -1
- package/dist/service/acm/sim-acm.js.map +1 -1
- package/dist/service/aws/sim-aws-account-region-scope.d.ts +2 -7
- package/dist/service/aws/sim-aws-account-region-scope.d.ts.map +1 -1
- package/dist/service/aws/sim-aws-account-region-scope.factory.d.ts +7 -0
- package/dist/service/aws/sim-aws-account-region-scope.factory.d.ts.map +1 -0
- package/dist/service/aws/sim-aws-account-region-scope.factory.js +11 -0
- package/dist/service/aws/sim-aws-account-region-scope.factory.js.map +1 -0
- package/dist/service/aws/sim-aws-account-region-scope.js +0 -10
- package/dist/service/aws/sim-aws-account-region-scope.js.map +1 -1
- package/dist/service/cloudformation/bind/validate/sim-cfn-exec-binding-finder.d.ts +69 -0
- package/dist/service/cloudformation/bind/validate/sim-cfn-exec-binding-finder.d.ts.map +1 -0
- package/dist/service/cloudformation/bind/validate/sim-cfn-exec-binding-finder.js +106 -0
- package/dist/service/cloudformation/bind/validate/sim-cfn-exec-binding-finder.js.map +1 -0
- package/dist/service/cloudformation/bind/validate/sim-cfn-exec-binding-matcher.d.ts +35 -0
- package/dist/service/cloudformation/bind/validate/sim-cfn-exec-binding-matcher.d.ts.map +1 -0
- package/dist/service/cloudformation/bind/validate/sim-cfn-exec-binding-matcher.js +126 -0
- package/dist/service/cloudformation/bind/validate/sim-cfn-exec-binding-matcher.js.map +1 -0
- package/dist/service/cloudformation/bind/validate/sim-cfn-exec-binding-validator.d.ts +5 -0
- package/dist/service/cloudformation/bind/validate/sim-cfn-exec-binding-validator.d.ts.map +1 -1
- package/dist/service/cloudformation/bind/validate/sim-cfn-exec-binding-validator.js +8 -52
- package/dist/service/cloudformation/bind/validate/sim-cfn-exec-binding-validator.js.map +1 -1
- package/dist/service/cloudformation/resource/cfn/cloudfront/sim-cff-cfn.factory.d.ts +14 -0
- package/dist/service/cloudformation/resource/cfn/cloudfront/sim-cff-cfn.factory.d.ts.map +1 -0
- package/dist/service/cloudformation/resource/cfn/cloudfront/sim-cff-cfn.factory.js +23 -0
- package/dist/service/cloudformation/resource/cfn/cloudfront/sim-cff-cfn.factory.js.map +1 -0
- package/dist/service/cloudformation/resource/sim-cfn-resource.d.ts +2 -3
- package/dist/service/cloudformation/resource/sim-cfn-resource.d.ts.map +1 -1
- package/dist/service/cloudformation/resource/sim-cfn-resource.factory.d.ts +7 -0
- package/dist/service/cloudformation/resource/sim-cfn-resource.factory.d.ts.map +1 -0
- package/dist/service/cloudformation/resource/sim-cfn-resource.factory.js +12 -0
- package/dist/service/cloudformation/resource/sim-cfn-resource.factory.js.map +1 -0
- package/dist/service/cloudformation/resource/sim-cfn-resource.js +1 -1
- package/dist/service/cloudformation/resource/sim-cfn-resource.js.map +1 -1
- package/dist/service/cloudformation/sim-cloudformation.d.ts +1 -1
- package/dist/service/cloudformation/sim-cloudformation.d.ts.map +1 -1
- package/dist/service/cloudformation/sim-cloudformation.js +1 -1
- package/dist/service/cloudformation/sim-cloudformation.js.map +1 -1
- package/dist/service/cloudfront/cfn/cff/sim-cfn-cff-create-input-builder.d.ts +1 -10
- package/dist/service/cloudfront/cfn/cff/sim-cfn-cff-create-input-builder.d.ts.map +1 -1
- package/dist/service/cloudfront/cfn/cff/sim-cfn-cff-create-input-builder.js +8 -24
- package/dist/service/cloudfront/cfn/cff/sim-cfn-cff-create-input-builder.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 +1 -1
- package/dist/service/cloudfront/sim-cloudfront.js.map +1 -1
- package/dist/service/dynamodb/sim-dynamodb.d.ts +1 -1
- package/dist/service/dynamodb/sim-dynamodb.d.ts.map +1 -1
- package/dist/service/dynamodb/sim-dynamodb.js +1 -1
- package/dist/service/dynamodb/sim-dynamodb.js.map +1 -1
- package/dist/service/s3/bucket/sim-s3-bucket.d.ts +1 -1
- package/dist/service/s3/bucket/sim-s3-bucket.d.ts.map +1 -1
- package/dist/service/s3/bucket/sim-s3-bucket.js +1 -1
- package/dist/service/s3/bucket/sim-s3-bucket.js.map +1 -1
- package/dist/service/s3/sim-s3.d.ts +1 -1
- package/dist/service/s3/sim-s3.d.ts.map +1 -1
- package/dist/service/s3/sim-s3.js +1 -1
- package/dist/service/s3/sim-s3.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +12 -11
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type BackgroundScheduler } from "../../util/background/background.js";
|
|
2
|
-
import {
|
|
2
|
+
import type { SimAwsAccountRegionScope } from "../aws/sim-aws-account-region-scope.js";
|
|
3
3
|
import type { SimRequestCertificateCommand, SimRequestCertificateCommandOutput } from "./command/request-certificate/request-certificate.cmd.js";
|
|
4
4
|
import type { SimAcmCertificate } from "./certificate/sim-acm-certificate.js";
|
|
5
5
|
import type { SimDescribeCertificateCommand, SimDescribeCertificateCommandOutput } from "./command/describe-certificate/describe-certificate.cmd.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sim-acm.d.ts","sourceRoot":"","sources":["../../../src/service/acm/sim-acm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,mBAAmB,EAEzB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,
|
|
1
|
+
{"version":3,"file":"sim-acm.d.ts","sourceRoot":"","sources":["../../../src/service/acm/sim-acm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,mBAAmB,EAEzB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAEvF,OAAO,KAAK,EACV,4BAA4B,EAC5B,kCAAkC,EACnC,MAAM,0DAA0D,CAAC;AAElE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAC9E,OAAO,KAAK,EACV,6BAA6B,EAC7B,mCAAmC,EACpC,MAAM,4DAA4D,CAAC;AAEpE,OAAO,KAAK,EACV,0BAA0B,EAC1B,gCAAgC,EACjC,MAAM,sDAAsD,CAAC;AAE9D,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AAGjF,UAAU,WAAW;IACnB,QAAQ,CAAC,kBAAkB,CAAC,EAAE,wBAAwB,CAAC;IACvD,QAAQ,CAAC,UAAU,CAAC,EAAE,mBAAmB,CAAC;CAC3C;AAED;;GAEG;AACH,qBAAa,MAAM;IACjB,SAAgB,YAAY,sFAAwC;IAEpE,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAA2B;IAC9D,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAsB;IACjD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAExB;gBAES,KAAK,GAAE,WAAgB;IAUnC;;OAEG;IACG,mBAAmB,CACvB,GAAG,EAAE,6BAA6B,GACjC,OAAO,CAAC,mCAAmC,CAAC;IAQ/C;;OAEG;IACG,gBAAgB,CACpB,GAAG,EAAE,0BAA0B,GAC9B,OAAO,CAAC,gCAAgC,CAAC;IAQ5C;;OAEG;IACG,kBAAkB,CACtB,GAAG,EAAE,4BAA4B,GAChC,OAAO,CAAC,kCAAkC,CAAC;IAS9C;;OAEG;IACH,kBAAkB,IAAI,wBAAwB;CAG/C"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BackgroundTasks, } from "../../util/background/background.js";
|
|
2
|
-
import { simAwsAccountRegionScopeFactory, } from "../aws/sim-aws-account-region-scope.js";
|
|
3
2
|
import { RequestCertificateCommandHandler } from "./command/request-certificate/request-certificate.handler.js";
|
|
4
3
|
import { DescribeCertificateCommandHandler } from "./command/describe-certificate/describe-certificate.handler.js";
|
|
5
4
|
import { ListCertificatesCommandHandler } from "./command/list-certificates/list-certificates.handler.js";
|
|
6
5
|
import { SimAcmCfnResourceFactory } from "./cfn/sim-cfn-acm-resource-factory.js";
|
|
6
|
+
import { simAwsAccountRegionScopeFactory } from "../aws/sim-aws-account-region-scope.factory.js";
|
|
7
7
|
/**
|
|
8
8
|
* Simulated ACM. Handles SDK commands. Emulates AWS behaviour and state.
|
|
9
9
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sim-acm.js","sourceRoot":"","sources":["../../../src/service/acm/sim-acm.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,GAChB,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"sim-acm.js","sourceRoot":"","sources":["../../../src/service/acm/sim-acm.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,GAChB,MAAM,qCAAqC,CAAC;AAO7C,OAAO,EAAE,gCAAgC,EAAE,MAAM,8DAA8D,CAAC;AAMhH,OAAO,EAAE,iCAAiC,EAAE,MAAM,gEAAgE,CAAC;AAKnH,OAAO,EAAE,8BAA8B,EAAE,MAAM,0DAA0D,CAAC;AAC1G,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AACjF,OAAO,EAAE,+BAA+B,EAAE,MAAM,gDAAgD,CAAC;AAOjG;;GAEG;AACH,MAAM,OAAO,MAAM;IACD,YAAY,GAAG,IAAI,GAAG,EAA6B,CAAC;IAEnD,kBAAkB,CAA2B;IAC7C,UAAU,CAAsB;IAChC,UAAU,GAAG,IAAI,wBAAwB,CAAC;QACzD,GAAG,EAAE,IAAI;KACV,CAAC,CAAC;IAEH,YAAY,QAAqB,EAAE;QACjC,MAAM,EACJ,kBAAkB,GAAG,+BAA+B,CAAC,IAAI,EAAE,EAC3D,UAAU,GAAG,IAAI,eAAe,EAAE,GACnC,GAAG,KAAK,CAAC;QAEV,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;QAC7C,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,mBAAmB,CACvB,GAAkC;QAElC,MAAM,OAAO,GAAG,IAAI,iCAAiC,CAAC;YACpD,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,UAAU,EAAE,IAAI,CAAC,UAAU;SAC5B,CAAC,CAAC;QACH,OAAO,MAAM,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACnC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,gBAAgB,CACpB,GAA+B;QAE/B,MAAM,OAAO,GAAG,IAAI,8BAA8B,CAAC;YACjD,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,UAAU,EAAE,IAAI,CAAC,UAAU;SAC5B,CAAC,CAAC;QACH,OAAO,MAAM,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACnC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,kBAAkB,CACtB,GAAiC;QAEjC,MAAM,OAAO,GAAG,IAAI,gCAAgC,CAAC;YACnD,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;YAC3C,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,UAAU,EAAE,IAAI,CAAC,UAAU;SAC5B,CAAC,CAAC;QACH,OAAO,MAAM,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACnC,CAAC;IAED;;OAEG;IACH,kBAAkB;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;CACF"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { SimAwsAccount, SimAwsAccountId } from "./sim-aws-account.js";
|
|
2
|
+
import type { AwsRegionName, SimAwsRegion } from "./sim-aws-region.js";
|
|
3
3
|
import { SimAws } from "./sim-aws.js";
|
|
4
|
-
import { DynamicFactory } from "@kensio/part-factory";
|
|
5
4
|
import type { SimS3 } from "../s3/sim-s3.js";
|
|
6
5
|
import type { SimCloudFront } from "../cloudfront/sim-cloudfront.js";
|
|
7
6
|
import type { SimDynamoDb } from "../dynamodb/index.js";
|
|
@@ -54,9 +53,5 @@ export interface SimAwsAccountRegionScope {
|
|
|
54
53
|
accountId: SimAwsAccountId;
|
|
55
54
|
regionName: AwsRegionName;
|
|
56
55
|
}
|
|
57
|
-
/**
|
|
58
|
-
* Generates fake simulated AWS resource scopes.
|
|
59
|
-
*/
|
|
60
|
-
export declare const simAwsAccountRegionScopeFactory: DynamicFactory<SimAwsAccountRegionScope>;
|
|
61
56
|
export {};
|
|
62
57
|
//# sourceMappingURL=sim-aws-account-region-scope.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sim-aws-account-region-scope.d.ts","sourceRoot":"","sources":["../../../src/service/aws/sim-aws-account-region-scope.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"sim-aws-account-region-scope.d.ts","sourceRoot":"","sources":["../../../src/service/aws/sim-aws-account-region-scope.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC3E,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEvE,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,MAAM,wBAAwB,GAAG,GAAG,eAAe,IAAI,aAAa,EAAE,CAAC;AAE7E,UAAU,iCAAiC;IACzC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,CAAC,EAAE,aAAa,CAAC;IACjC,QAAQ,CAAC,MAAM,CAAC,EAAE,YAAY,CAAC;CAChC;AAED;;;GAGG;AACH,qBAAa,4BAA4B;IACvC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,SAAgB,OAAO,EAAE,aAAa,CAAC;IACvC,SAAgB,MAAM,EAAE,YAAY,CAAC;IACrC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAsB;IAE3C,SAAgB,kBAAkB,EAAE,wBAAwB,CAAC;gBAEjD,KAAK,GAAE,iCAAsC;IAiBzD;;OAEG;IACH,GAAG,IAAI,MAAM;IAMb;;OAEG;IACH,cAAc,IAAI,iBAAiB;IAMnC;;OAEG;IACH,UAAU,IAAI,aAAa;IAM3B;;OAEG;IACH,QAAQ,IAAI,WAAW;IAMvB;;OAEG;IACH,OAAO,IAAI,UAAU;IAMrB;;OAEG;IACH,EAAE,IAAI,KAAK;CAKZ;AAED,MAAM,WAAW,wBAAwB;IACvC,SAAS,EAAE,eAAe,CAAC;IAC3B,UAAU,EAAE,aAAa,CAAC;CAC3B"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { DynamicFactory } from "@kensio/part-factory";
|
|
2
|
+
import type { SimAwsAccountRegionScope } from "./sim-aws-account-region-scope.js";
|
|
3
|
+
/**
|
|
4
|
+
* Generates fake simulated AWS resource scopes.
|
|
5
|
+
*/
|
|
6
|
+
export declare const simAwsAccountRegionScopeFactory: DynamicFactory<SimAwsAccountRegionScope>;
|
|
7
|
+
//# sourceMappingURL=sim-aws-account-region-scope.factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-aws-account-region-scope.factory.d.ts","sourceRoot":"","sources":["../../../src/service/aws/sim-aws-account-region-scope.factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAGtD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAElF;;GAEG;AACH,eAAO,MAAM,+BAA+B,0CAIvC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DynamicFactory } from "@kensio/part-factory";
|
|
2
|
+
import { makeSimAwsAccountId } from "./sim-aws-account.js";
|
|
3
|
+
import { makeAwsRegionName } from "./sim-aws-region.js";
|
|
4
|
+
/**
|
|
5
|
+
* Generates fake simulated AWS resource scopes.
|
|
6
|
+
*/
|
|
7
|
+
export const simAwsAccountRegionScopeFactory = new DynamicFactory(() => ({
|
|
8
|
+
accountId: makeSimAwsAccountId(),
|
|
9
|
+
regionName: makeAwsRegionName(),
|
|
10
|
+
}));
|
|
11
|
+
//# sourceMappingURL=sim-aws-account-region-scope.factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-aws-account-region-scope.factory.js","sourceRoot":"","sources":["../../../src/service/aws/sim-aws-account-region-scope.factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAGxD;;GAEG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAC1C,IAAI,cAAc,CAA2B,GAAG,EAAE,CAAC,CAAC;IAClD,SAAS,EAAE,mBAAmB,EAAE;IAChC,UAAU,EAAE,iBAAiB,EAAE;CAChC,CAAC,CAAC,CAAC"}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import { makeSimAwsAccountId, } from "./sim-aws-account.js";
|
|
2
|
-
import { makeAwsRegionName, } from "./sim-aws-region.js";
|
|
3
1
|
import { Memo } from "../../util/memo/memo.js";
|
|
4
2
|
import { SimAws } from "./sim-aws.js";
|
|
5
|
-
import { DynamicFactory } from "@kensio/part-factory";
|
|
6
3
|
/**
|
|
7
4
|
* Combined simulated AWS Account and Region scope.
|
|
8
5
|
* This is the real Account/Region scope container for simulated services.
|
|
@@ -64,11 +61,4 @@ export class SimAwsAccountRegionContainer {
|
|
|
64
61
|
return this.memo.getOrCreate("s3", () => this.simAws.serviceFactory.createS3(this));
|
|
65
62
|
}
|
|
66
63
|
}
|
|
67
|
-
/**
|
|
68
|
-
* Generates fake simulated AWS resource scopes.
|
|
69
|
-
*/
|
|
70
|
-
export const simAwsAccountRegionScopeFactory = new DynamicFactory(() => ({
|
|
71
|
-
accountId: makeSimAwsAccountId(),
|
|
72
|
-
regionName: makeAwsRegionName(),
|
|
73
|
-
}));
|
|
74
64
|
//# sourceMappingURL=sim-aws-account-region-scope.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sim-aws-account-region-scope.js","sourceRoot":"","sources":["../../../src/service/aws/sim-aws-account-region-scope.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sim-aws-account-region-scope.js","sourceRoot":"","sources":["../../../src/service/aws/sim-aws-account-region-scope.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAgBtC;;;GAGG;AACH,MAAM,OAAO,4BAA4B;IACtB,MAAM,CAAS;IAChB,OAAO,CAAgB;IACvB,MAAM,CAAe;IACpB,IAAI,GAAG,IAAI,IAAI,EAAU,CAAC;IAE3B,kBAAkB,CAA2B;IAE7D,YAAY,QAA2C,EAAE;QACvD,MAAM,EAAE,MAAM,GAAG,IAAI,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;QAEzD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO;YACV,OAAO;gBACP,IAAI,CAAC,MAAM,CAAC,OAAO,CAAE,OAAqC,EAAE,SAAS,CAAC,CAAC;QACzE,IAAI,CAAC,MAAM;YACT,MAAM;gBACN,IAAI,CAAC,MAAM,CAAC,MAAM,CAAE,MAAmC,EAAE,UAAU,CAAC,CAAC;QAEvE,IAAI,CAAC,kBAAkB,GAAG;YACxB,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS;YACjC,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU;SACnC,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,GAAG;QACD,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,GAAG,EAAE,CACvC,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,SAAS,CAAC,IAAI,CAAC,CAC3C,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,cAAc;QACZ,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,gBAAgB,EAAE,GAAG,EAAE,CAClD,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,oBAAoB,CAAC,IAAI,CAAC,CACtD,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,UAAU;QACR,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,YAAY,EAAE,GAAG,EAAE,CAC9C,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAClD,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,QAAQ;QACN,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,EAAE,GAAG,EAAE,CAC5C,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,cAAc,CAAC,IAAI,CAAC,CAChD,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,OAAO;QACL,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,SAAS,EAAE,GAAG,EAAE,CAC3C,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,aAAa,CAAC,IAAI,CAAC,CAC/C,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,EAAE;QACA,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,GAAG,EAAE,CACtC,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,CAAC,CAC1C,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { SimCfnCfBinding, SimCfnExecutableResourceBinding } from "../sim-cfn-exec-binding.type.js";
|
|
2
|
+
import type { SimCfnResource } from "../../resource/sim-cfn-resource.js";
|
|
3
|
+
interface SimCfnCffBindingFinderProps {
|
|
4
|
+
readonly resource: SimCfnResource;
|
|
5
|
+
readonly bindings?: readonly SimCfnExecutableResourceBinding[] | undefined;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Finds the executable binding that should replace CloudFormation FunctionCode.
|
|
9
|
+
*
|
|
10
|
+
* A CloudFront Function can be declared in a synthesized CloudFormation template,
|
|
11
|
+
* while test code may provide an executable JavaScript handler through a binding.
|
|
12
|
+
* This class keeps the matching rules in one place so the CreateFunction input
|
|
13
|
+
* builder can stay focused on validating Resource properties and building the
|
|
14
|
+
* command input.
|
|
15
|
+
*
|
|
16
|
+
* Supported binding targets:
|
|
17
|
+
*
|
|
18
|
+
* - CloudFormation logical ID, for templates written directly or synthesized by CDK
|
|
19
|
+
* - CDK construct ID, recovered from Resource Metadata path values
|
|
20
|
+
* - resolved CloudFront Function name, for name-based bindings
|
|
21
|
+
*/
|
|
22
|
+
export declare class SimCfnCffBindingFinder {
|
|
23
|
+
private readonly resource;
|
|
24
|
+
private readonly bindings;
|
|
25
|
+
constructor(props: SimCfnCffBindingFinderProps);
|
|
26
|
+
/**
|
|
27
|
+
* Return the first binding that targets this CloudFront Function Resource.
|
|
28
|
+
*
|
|
29
|
+
* Logical ID matching is evaluated before function-name matching because the
|
|
30
|
+
* logical ID is stable even when the template omits the Function Name property
|
|
31
|
+
* and the simulator falls back to the Resource logical ID as the local name.
|
|
32
|
+
*/
|
|
33
|
+
findBinding(functionName: string): SimCfnCfBinding | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Decide whether a binding targets this Resource.
|
|
36
|
+
*
|
|
37
|
+
* The union uses distinct target fields, so checking property presence is enough
|
|
38
|
+
* to choose the matching strategy. The final false branch protects future binding
|
|
39
|
+
* shapes from being treated as matches before explicit support is added.
|
|
40
|
+
*/
|
|
41
|
+
private matchesBinding;
|
|
42
|
+
/**
|
|
43
|
+
* Match either the synthesized Resource logical ID or the original CDK construct
|
|
44
|
+
* ID extracted from metadata.
|
|
45
|
+
*
|
|
46
|
+
* CDK commonly synthesizes logical IDs with hashes. The metadata path preserves
|
|
47
|
+
* the construct path, which lets tests bind to the readable construct ID instead
|
|
48
|
+
* of the generated logical ID.
|
|
49
|
+
*/
|
|
50
|
+
private resourceMatchesLogicalIdBinding;
|
|
51
|
+
/**
|
|
52
|
+
* Extract the construct ID from a CDK metadata path.
|
|
53
|
+
*
|
|
54
|
+
* CDK paths for low-level resources often end with `/Resource`. In that case,
|
|
55
|
+
* the construct ID is the previous path segment. If the path does not end with
|
|
56
|
+
* `Resource`, the last path segment is the best available construct identifier.
|
|
57
|
+
*/
|
|
58
|
+
private cdkConstructIdFromPath;
|
|
59
|
+
/**
|
|
60
|
+
* Read a CDK path value from Resource Metadata.
|
|
61
|
+
*
|
|
62
|
+
* CDK has used more than one metadata key for construct paths over time. The
|
|
63
|
+
* shared `cdkPathMetadataKeys` list captures those supported keys, and the first
|
|
64
|
+
* string value found is treated as the path for this Resource.
|
|
65
|
+
*/
|
|
66
|
+
private cdkPath;
|
|
67
|
+
}
|
|
68
|
+
export {};
|
|
69
|
+
//# sourceMappingURL=sim-cfn-exec-binding-finder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-cfn-exec-binding-finder.d.ts","sourceRoot":"","sources":["../../../../../src/service/cloudformation/bind/validate/sim-cfn-exec-binding-finder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,+BAA+B,EAChC,MAAM,iCAAiC,CAAC;AAEzC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAEzE,UAAU,2BAA2B;IACnC,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,+BAA+B,EAAE,GAAG,SAAS,CAAC;CAC5E;AAED;;;;;;;;;;;;;;GAcG;AACH,qBAAa,sBAAsB;IACjC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAiB;IAC1C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CACgC;gBAE7C,KAAK,EAAE,2BAA2B;IAK9C;;;;;;OAMG;IACH,WAAW,CAAC,YAAY,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS;IAM9D;;;;;;OAMG;IACH,OAAO,CAAC,cAAc;IAgBtB;;;;;;;OAOG;IACH,OAAO,CAAC,+BAA+B;IAOvC;;;;;;OAMG;IACH,OAAO,CAAC,sBAAsB;IAiB9B;;;;;;OAMG;IACH,OAAO,CAAC,OAAO;CAsBhB"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { cdkPathMetadataKeys } from "./sim-cfn-exec-binding-matcher.js";
|
|
2
|
+
/**
|
|
3
|
+
* Finds the executable binding that should replace CloudFormation FunctionCode.
|
|
4
|
+
*
|
|
5
|
+
* A CloudFront Function can be declared in a synthesized CloudFormation template,
|
|
6
|
+
* while test code may provide an executable JavaScript handler through a binding.
|
|
7
|
+
* This class keeps the matching rules in one place so the CreateFunction input
|
|
8
|
+
* builder can stay focused on validating Resource properties and building the
|
|
9
|
+
* command input.
|
|
10
|
+
*
|
|
11
|
+
* Supported binding targets:
|
|
12
|
+
*
|
|
13
|
+
* - CloudFormation logical ID, for templates written directly or synthesized by CDK
|
|
14
|
+
* - CDK construct ID, recovered from Resource Metadata path values
|
|
15
|
+
* - resolved CloudFront Function name, for name-based bindings
|
|
16
|
+
*/
|
|
17
|
+
export class SimCfnCffBindingFinder {
|
|
18
|
+
resource;
|
|
19
|
+
bindings;
|
|
20
|
+
constructor(props) {
|
|
21
|
+
this.resource = props.resource;
|
|
22
|
+
this.bindings = props.bindings;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Return the first binding that targets this CloudFront Function Resource.
|
|
26
|
+
*
|
|
27
|
+
* Logical ID matching is evaluated before function-name matching because the
|
|
28
|
+
* logical ID is stable even when the template omits the Function Name property
|
|
29
|
+
* and the simulator falls back to the Resource logical ID as the local name.
|
|
30
|
+
*/
|
|
31
|
+
findBinding(functionName) {
|
|
32
|
+
return this.bindings?.find((binding) => this.matchesBinding(binding, functionName));
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Decide whether a binding targets this Resource.
|
|
36
|
+
*
|
|
37
|
+
* The union uses distinct target fields, so checking property presence is enough
|
|
38
|
+
* to choose the matching strategy. The final false branch protects future binding
|
|
39
|
+
* shapes from being treated as matches before explicit support is added.
|
|
40
|
+
*/
|
|
41
|
+
matchesBinding(binding, functionName) {
|
|
42
|
+
if ("logicalId" in binding) {
|
|
43
|
+
return this.resourceMatchesLogicalIdBinding(binding.logicalId);
|
|
44
|
+
}
|
|
45
|
+
if ("functionName" in binding) {
|
|
46
|
+
return binding.functionName === functionName;
|
|
47
|
+
}
|
|
48
|
+
/* v8 ignore next */
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Match either the synthesized Resource logical ID or the original CDK construct
|
|
53
|
+
* ID extracted from metadata.
|
|
54
|
+
*
|
|
55
|
+
* CDK commonly synthesizes logical IDs with hashes. The metadata path preserves
|
|
56
|
+
* the construct path, which lets tests bind to the readable construct ID instead
|
|
57
|
+
* of the generated logical ID.
|
|
58
|
+
*/
|
|
59
|
+
resourceMatchesLogicalIdBinding(logicalId) {
|
|
60
|
+
return (this.resource.logicalId === logicalId ||
|
|
61
|
+
this.cdkConstructIdFromPath() === logicalId);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Extract the construct ID from a CDK metadata path.
|
|
65
|
+
*
|
|
66
|
+
* CDK paths for low-level resources often end with `/Resource`. In that case,
|
|
67
|
+
* the construct ID is the previous path segment. If the path does not end with
|
|
68
|
+
* `Resource`, the last path segment is the best available construct identifier.
|
|
69
|
+
*/
|
|
70
|
+
cdkConstructIdFromPath() {
|
|
71
|
+
const path = this.cdkPath();
|
|
72
|
+
if (path === undefined) {
|
|
73
|
+
return undefined;
|
|
74
|
+
}
|
|
75
|
+
const parts = path.split("/").filter((part) => part.length > 0);
|
|
76
|
+
const resourceIndex = parts.lastIndexOf("Resource");
|
|
77
|
+
if (resourceIndex > 0) {
|
|
78
|
+
return parts[resourceIndex - 1];
|
|
79
|
+
}
|
|
80
|
+
return parts.at(-1);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Read a CDK path value from Resource Metadata.
|
|
84
|
+
*
|
|
85
|
+
* CDK has used more than one metadata key for construct paths over time. The
|
|
86
|
+
* shared `cdkPathMetadataKeys` list captures those supported keys, and the first
|
|
87
|
+
* string value found is treated as the path for this Resource.
|
|
88
|
+
*/
|
|
89
|
+
cdkPath() {
|
|
90
|
+
const metadata = this.resource.template["Metadata"];
|
|
91
|
+
if (metadata === null ||
|
|
92
|
+
typeof metadata !== "object" ||
|
|
93
|
+
Array.isArray(metadata)) {
|
|
94
|
+
return undefined;
|
|
95
|
+
}
|
|
96
|
+
for (const metadataKey of cdkPathMetadataKeys) {
|
|
97
|
+
// eslint-disable-next-line security/detect-object-injection
|
|
98
|
+
const value = metadata[metadataKey];
|
|
99
|
+
if (typeof value === "string") {
|
|
100
|
+
return value;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return undefined;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=sim-cfn-exec-binding-finder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-cfn-exec-binding-finder.js","sourceRoot":"","sources":["../../../../../src/service/cloudformation/bind/validate/sim-cfn-exec-binding-finder.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAQxE;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,sBAAsB;IAChB,QAAQ,CAAiB;IACzB,QAAQ,CACgC;IAEzD,YAAY,KAAkC;QAC5C,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAC/B,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;IACjC,CAAC;IAED;;;;;;OAMG;IACH,WAAW,CAAC,YAAoB;QAC9B,OAAO,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CACrC,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,CAAC,CACZ,CAAC;IACnC,CAAC;IAED;;;;;;OAMG;IACK,cAAc,CACpB,OAAwC,EACxC,YAAoB;QAEpB,IAAI,WAAW,IAAI,OAAO,EAAE,CAAC;YAC3B,OAAO,IAAI,CAAC,+BAA+B,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QACjE,CAAC;QAED,IAAI,cAAc,IAAI,OAAO,EAAE,CAAC;YAC9B,OAAO,OAAO,CAAC,YAAY,KAAK,YAAY,CAAC;QAC/C,CAAC;QAED,oBAAoB;QACpB,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;;;;OAOG;IACK,+BAA+B,CAAC,SAAiB;QACvD,OAAO,CACL,IAAI,CAAC,QAAQ,CAAC,SAAS,KAAK,SAAS;YACrC,IAAI,CAAC,sBAAsB,EAAE,KAAK,SAAS,CAC5C,CAAC;IACJ,CAAC;IAED;;;;;;OAMG;IACK,sBAAsB;QAC5B,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;QAE5B,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACvB,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAChE,MAAM,aAAa,GAAG,KAAK,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;QAEpD,IAAI,aAAa,GAAG,CAAC,EAAE,CAAC;YACtB,OAAO,KAAK,CAAC,aAAa,GAAG,CAAC,CAAC,CAAC;QAClC,CAAC;QAED,OAAO,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACtB,CAAC;IAED;;;;;;OAMG;IACK,OAAO;QACb,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;QAEpD,IACE,QAAQ,KAAK,IAAI;YACjB,OAAO,QAAQ,KAAK,QAAQ;YAC5B,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EACvB,CAAC;YACD,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,KAAK,MAAM,WAAW,IAAI,mBAAmB,EAAE,CAAC;YAC9C,4DAA4D;YAC5D,MAAM,KAAK,GAAG,QAAQ,CAAC,WAAW,CAAC,CAAC;YAEpC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;gBAC9B,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;CACF"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { SimCfnResource } from "../../resource/sim-cfn-resource.js";
|
|
2
|
+
import type { SimCfnExecutableResourceBinding } from "../sim-cfn-exec-binding.type.js";
|
|
3
|
+
/**
|
|
4
|
+
* CDK metadata paths for identifying resources corresponding to bindings.
|
|
5
|
+
*
|
|
6
|
+
* CDK templates commonly store construct path information under `aws:cdk:path`.
|
|
7
|
+
* Some synthesized templates also expose `aws:cdk:logicalId`. Both values can
|
|
8
|
+
* help map a user-facing executable binding back to the synthesized Resource.
|
|
9
|
+
*/
|
|
10
|
+
export declare const cdkPathMetadataKeys: string[];
|
|
11
|
+
/**
|
|
12
|
+
* Matches executable-resource bindings against synthesized CloudFormation
|
|
13
|
+
* Resources.
|
|
14
|
+
*
|
|
15
|
+
* This class keeps the matching rules separate from validation flow. The
|
|
16
|
+
* validator only needs to decide whether every binding resolves; this matcher
|
|
17
|
+
* explains what "resolves" means for each supported binding shape.
|
|
18
|
+
*/
|
|
19
|
+
export declare class SimCfnExecutableResourceBindingMatcher {
|
|
20
|
+
#private;
|
|
21
|
+
constructor(resources: ReadonlyMap<string, SimCfnResource>);
|
|
22
|
+
/**
|
|
23
|
+
* Return true when the binding points at a Resource in the Stack.
|
|
24
|
+
*
|
|
25
|
+
* Each binding variant uses the most natural identifier available:
|
|
26
|
+
*
|
|
27
|
+
* - `logicalId` checks the synthesized logical ID and the CDK construct ID.
|
|
28
|
+
* - `functionName` checks the CloudFront Function Name property, falling
|
|
29
|
+
* back to the logical ID because CloudFront Functions can omit Name.
|
|
30
|
+
* - `arn` reconstructs the simulator's CloudFront Function ARN format.
|
|
31
|
+
* - `cdkPath` checks CDK metadata emitted into the synthesized template.
|
|
32
|
+
*/
|
|
33
|
+
matches(binding: SimCfnExecutableResourceBinding): boolean;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=sim-cfn-exec-binding-matcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-cfn-exec-binding-matcher.d.ts","sourceRoot":"","sources":["../../../../../src/service/cloudformation/bind/validate/sim-cfn-exec-binding-matcher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,iCAAiC,CAAC;AAEvF;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,UAAwC,CAAC;AAEzE;;;;;;;GAOG;AACH,qBAAa,sCAAsC;;gBAGrC,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,cAAc,CAAC;IAQ1D;;;;;;;;;;OAUG;IACH,OAAO,CAAC,OAAO,EAAE,+BAA+B,GAAG,OAAO;CA6H3D"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CDK metadata paths for identifying resources corresponding to bindings.
|
|
3
|
+
*
|
|
4
|
+
* CDK templates commonly store construct path information under `aws:cdk:path`.
|
|
5
|
+
* Some synthesized templates also expose `aws:cdk:logicalId`. Both values can
|
|
6
|
+
* help map a user-facing executable binding back to the synthesized Resource.
|
|
7
|
+
*/
|
|
8
|
+
export const cdkPathMetadataKeys = ["aws:cdk:path", "aws:cdk:logicalId"];
|
|
9
|
+
/**
|
|
10
|
+
* Matches executable-resource bindings against synthesized CloudFormation
|
|
11
|
+
* Resources.
|
|
12
|
+
*
|
|
13
|
+
* This class keeps the matching rules separate from validation flow. The
|
|
14
|
+
* validator only needs to decide whether every binding resolves; this matcher
|
|
15
|
+
* explains what "resolves" means for each supported binding shape.
|
|
16
|
+
*/
|
|
17
|
+
export class SimCfnExecutableResourceBindingMatcher {
|
|
18
|
+
#resources;
|
|
19
|
+
constructor(resources) {
|
|
20
|
+
/*
|
|
21
|
+
* Convert the map values once so each matching branch can scan a stable
|
|
22
|
+
* resource list without repeating `[...resources.values()]`.
|
|
23
|
+
*/
|
|
24
|
+
this.#resources = [...resources.values()];
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Return true when the binding points at a Resource in the Stack.
|
|
28
|
+
*
|
|
29
|
+
* Each binding variant uses the most natural identifier available:
|
|
30
|
+
*
|
|
31
|
+
* - `logicalId` checks the synthesized logical ID and the CDK construct ID.
|
|
32
|
+
* - `functionName` checks the CloudFront Function Name property, falling
|
|
33
|
+
* back to the logical ID because CloudFront Functions can omit Name.
|
|
34
|
+
* - `arn` reconstructs the simulator's CloudFront Function ARN format.
|
|
35
|
+
* - `cdkPath` checks CDK metadata emitted into the synthesized template.
|
|
36
|
+
*/
|
|
37
|
+
matches(binding) {
|
|
38
|
+
if ("logicalId" in binding) {
|
|
39
|
+
return this.#resources.some((resource) => this.#resourceMatchesLogicalIdBinding(resource, binding.logicalId));
|
|
40
|
+
}
|
|
41
|
+
if ("functionName" in binding) {
|
|
42
|
+
return this.#resources.some((resource) => this.#cloudFrontFunctionName(resource) === binding.functionName);
|
|
43
|
+
}
|
|
44
|
+
if ("arn" in binding) {
|
|
45
|
+
return this.#resources.some((resource) => this.#cloudFrontFunctionArn(resource) === binding.arn);
|
|
46
|
+
}
|
|
47
|
+
if ("cdkPath" in binding) {
|
|
48
|
+
return this.#resources.some((resource) => this.#cdkPath(resource) === binding.cdkPath);
|
|
49
|
+
}
|
|
50
|
+
/* v8 ignore next -- compile-time exhaustive guard */
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
#resourceMatchesLogicalIdBinding(resource, logicalId) {
|
|
54
|
+
/*
|
|
55
|
+
* CDK-generated logical IDs are not always pleasant to author by hand.
|
|
56
|
+
* Accepting the construct ID from the CDK path lets binding config refer to
|
|
57
|
+
* the original construct name while still validating against the synthesized
|
|
58
|
+
* template.
|
|
59
|
+
*/
|
|
60
|
+
return (resource.logicalId === logicalId ||
|
|
61
|
+
this.#cdkConstructIdFromPath(resource) === logicalId);
|
|
62
|
+
}
|
|
63
|
+
#cloudFrontFunctionName(resource) {
|
|
64
|
+
if (resource.type !== "AWS::CloudFront::Function") {
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
67
|
+
const name = resource.properties["Name"];
|
|
68
|
+
/*
|
|
69
|
+
* CloudFront Function Name is optional in CDK output. When no explicit name
|
|
70
|
+
* is present, the simulator identifies the function using its logical ID,
|
|
71
|
+
* matching the fallback used when the sim Function resource is created.
|
|
72
|
+
*/
|
|
73
|
+
return typeof name === "string" && name.length > 0
|
|
74
|
+
? name
|
|
75
|
+
: resource.logicalId;
|
|
76
|
+
}
|
|
77
|
+
#cloudFrontFunctionArn(resource) {
|
|
78
|
+
const functionName = this.#cloudFrontFunctionName(resource);
|
|
79
|
+
/* v8 ignore if */
|
|
80
|
+
if (functionName === undefined) {
|
|
81
|
+
return undefined;
|
|
82
|
+
}
|
|
83
|
+
/*
|
|
84
|
+
* CloudFront Function ARNs do not contain a region component. The account
|
|
85
|
+
* still comes from the resource scope so bindings can validate exact ARNs
|
|
86
|
+
* when CDK associations use ARN-based references.
|
|
87
|
+
*/
|
|
88
|
+
return `arn:aws:cloudfront::${resource.accountRegionScope.accountId}:function/${functionName}`;
|
|
89
|
+
}
|
|
90
|
+
#cdkPath(resource) {
|
|
91
|
+
const metadata = resource.template["Metadata"];
|
|
92
|
+
if (metadata === null ||
|
|
93
|
+
typeof metadata !== "object" ||
|
|
94
|
+
Array.isArray(metadata)) {
|
|
95
|
+
return undefined;
|
|
96
|
+
}
|
|
97
|
+
for (const metadataKey of cdkPathMetadataKeys) {
|
|
98
|
+
// eslint-disable-next-line security/detect-object-injection
|
|
99
|
+
const value = metadata[metadataKey];
|
|
100
|
+
if (typeof value === "string") {
|
|
101
|
+
return value;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
/* v8 ignore next */
|
|
105
|
+
return undefined;
|
|
106
|
+
}
|
|
107
|
+
#cdkConstructIdFromPath(resource) {
|
|
108
|
+
const path = this.#cdkPath(resource);
|
|
109
|
+
if (path === undefined) {
|
|
110
|
+
return undefined;
|
|
111
|
+
}
|
|
112
|
+
const parts = path.split("/").filter((part) => part.length > 0);
|
|
113
|
+
const resourceIndex = parts.lastIndexOf("Resource");
|
|
114
|
+
/*
|
|
115
|
+
* L2 CDK constructs often synthesize a child named `Resource`, for example:
|
|
116
|
+
* `Stack/RedirectFunction/Resource`. In that case the meaningful construct
|
|
117
|
+
* ID is the path segment before `Resource`, not the generated child
|
|
118
|
+
* segment.
|
|
119
|
+
*/
|
|
120
|
+
if (resourceIndex > 0) {
|
|
121
|
+
return parts[resourceIndex - 1];
|
|
122
|
+
}
|
|
123
|
+
return parts.at(-1);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=sim-cfn-exec-binding-matcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-cfn-exec-binding-matcher.js","sourceRoot":"","sources":["../../../../../src/service/cloudformation/bind/validate/sim-cfn-exec-binding-matcher.ts"],"names":[],"mappings":"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"}
|
|
@@ -2,6 +2,11 @@ import type { SimCfnExecutableResourceBinding } from "../sim-cfn-exec-binding.ty
|
|
|
2
2
|
import type { SimCfnResource } from "../../resource/sim-cfn-resource.js";
|
|
3
3
|
/**
|
|
4
4
|
* Validate that every executable binding targets a Resource in the Stack.
|
|
5
|
+
*
|
|
6
|
+
* The validator owns the high-level validation contract: each supplied binding
|
|
7
|
+
* must resolve to a synthesized CloudFormation Resource. The detailed matching
|
|
8
|
+
* rules live in `SimCfnExecutableResourceBindingMatcher`, which keeps this file
|
|
9
|
+
* small and focused on reporting actionable validation errors.
|
|
5
10
|
*/
|
|
6
11
|
export declare function validateSimCfnExecutableResourceBindings(props: {
|
|
7
12
|
readonly stackName: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sim-cfn-exec-binding-validator.d.ts","sourceRoot":"","sources":["../../../../../src/service/cloudformation/bind/validate/sim-cfn-exec-binding-validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,iCAAiC,CAAC;AACvF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"sim-cfn-exec-binding-validator.d.ts","sourceRoot":"","sources":["../../../../../src/service/cloudformation/bind/validate/sim-cfn-exec-binding-validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,iCAAiC,CAAC;AACvF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAGzE;;;;;;;GAOG;AACH,wBAAgB,wCAAwC,CAAC,KAAK,EAAE;IAC9D,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IACxD,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,+BAA+B,EAAE,GAAG,SAAS,CAAC;CAC5E,GAAG,IAAI,CAaP"}
|
|
@@ -1,66 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
import { SimCfnExecutableResourceBindingMatcher } from "./sim-cfn-exec-binding-matcher.js";
|
|
2
2
|
/**
|
|
3
3
|
* Validate that every executable binding targets a Resource in the Stack.
|
|
4
|
+
*
|
|
5
|
+
* The validator owns the high-level validation contract: each supplied binding
|
|
6
|
+
* must resolve to a synthesized CloudFormation Resource. The detailed matching
|
|
7
|
+
* rules live in `SimCfnExecutableResourceBindingMatcher`, which keeps this file
|
|
8
|
+
* small and focused on reporting actionable validation errors.
|
|
4
9
|
*/
|
|
5
10
|
export function validateSimCfnExecutableResourceBindings(props) {
|
|
6
11
|
const bindings = props.bindings ?? [];
|
|
12
|
+
const matcher = new SimCfnExecutableResourceBindingMatcher(props.resources);
|
|
7
13
|
for (const binding of bindings) {
|
|
8
|
-
if (
|
|
14
|
+
if (matcher.matches(binding)) {
|
|
9
15
|
continue;
|
|
10
16
|
}
|
|
11
17
|
throw new Error(`Invalid sim CloudFormation executable binding in Stack ${props.stackName}: ${describeBinding(binding)} does not resolve to a Resource in the Stack`);
|
|
12
18
|
}
|
|
13
19
|
}
|
|
14
|
-
function bindingMatchesStackResource(binding, resources) {
|
|
15
|
-
if ("logicalId" in binding) {
|
|
16
|
-
return resources.has(binding.logicalId);
|
|
17
|
-
}
|
|
18
|
-
if ("functionName" in binding) {
|
|
19
|
-
return [...resources.values()].some((resource) => cloudFrontFunctionName(resource) === binding.functionName);
|
|
20
|
-
}
|
|
21
|
-
if ("arn" in binding) {
|
|
22
|
-
return [...resources.values()].some((resource) => cloudFrontFunctionArn(resource) === binding.arn);
|
|
23
|
-
}
|
|
24
|
-
if ("cdkPath" in binding) {
|
|
25
|
-
return [...resources.values()].some((resource) => cdkPath(resource) === binding.cdkPath);
|
|
26
|
-
}
|
|
27
|
-
/* v8 ignore next -- compile-time exhaustive guard */
|
|
28
|
-
return false;
|
|
29
|
-
}
|
|
30
|
-
function cloudFrontFunctionName(resource) {
|
|
31
|
-
if (resource.type !== "AWS::CloudFront::Function") {
|
|
32
|
-
return undefined;
|
|
33
|
-
}
|
|
34
|
-
const name = resource.properties["Name"];
|
|
35
|
-
return typeof name === "string" && name.length > 0
|
|
36
|
-
? name
|
|
37
|
-
: resource.logicalId;
|
|
38
|
-
}
|
|
39
|
-
function cloudFrontFunctionArn(resource) {
|
|
40
|
-
const functionName = cloudFrontFunctionName(resource);
|
|
41
|
-
/* v8 ignore if */
|
|
42
|
-
if (functionName === undefined) {
|
|
43
|
-
return undefined;
|
|
44
|
-
}
|
|
45
|
-
return `arn:aws:cloudfront::${resource.accountRegionScope.accountId}:function/${functionName}`;
|
|
46
|
-
}
|
|
47
|
-
function cdkPath(resource) {
|
|
48
|
-
const metadata = resource.template["Metadata"];
|
|
49
|
-
if (metadata === null ||
|
|
50
|
-
typeof metadata !== "object" ||
|
|
51
|
-
Array.isArray(metadata)) {
|
|
52
|
-
return undefined;
|
|
53
|
-
}
|
|
54
|
-
for (const metadataKey of cdkPathMetadataKeys) {
|
|
55
|
-
// eslint-disable-next-line security/detect-object-injection
|
|
56
|
-
const value = metadata[metadataKey];
|
|
57
|
-
if (typeof value === "string") {
|
|
58
|
-
return value;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
/* v8 ignore next */
|
|
62
|
-
return undefined;
|
|
63
|
-
}
|
|
64
20
|
function describeBinding(binding) {
|
|
65
21
|
if ("logicalId" in binding) {
|
|
66
22
|
return `logicalId ${JSON.stringify(binding.logicalId)}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sim-cfn-exec-binding-validator.js","sourceRoot":"","sources":["../../../../../src/service/cloudformation/bind/validate/sim-cfn-exec-binding-validator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sim-cfn-exec-binding-validator.js","sourceRoot":"","sources":["../../../../../src/service/cloudformation/bind/validate/sim-cfn-exec-binding-validator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sCAAsC,EAAE,MAAM,mCAAmC,CAAC;AAE3F;;;;;;;GAOG;AACH,MAAM,UAAU,wCAAwC,CAAC,KAIxD;IACC,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,IAAI,EAAE,CAAC;IACtC,MAAM,OAAO,GAAG,IAAI,sCAAsC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IAE5E,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,IAAI,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;YAC7B,SAAS;QACX,CAAC;QAED,MAAM,IAAI,KAAK,CACb,0DAA0D,KAAK,CAAC,SAAS,KAAK,eAAe,CAAC,OAAO,CAAC,8CAA8C,CACrJ,CAAC;IACJ,CAAC;AACH,CAAC;AAED,SAAS,eAAe,CAAC,OAAwC;IAC/D,IAAI,WAAW,IAAI,OAAO,EAAE,CAAC;QAC3B,OAAO,aAAa,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;IAC1D,CAAC;IAED,IAAI,cAAc,IAAI,OAAO,EAAE,CAAC;QAC9B,OAAO,gBAAgB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;IAChE,CAAC;IAED,IAAI,KAAK,IAAI,OAAO,EAAE,CAAC;QACrB,OAAO,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;IAC9C,CAAC;IAED,IAAI,SAAS,IAAI,OAAO,EAAE,CAAC;QACzB,OAAO,WAAW,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;IACtD,CAAC;IAED,qDAAqD;IACrD,OAAO,wBAAwB,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { MappedFactory } from "@kensio/part-factory";
|
|
2
|
+
import type { SimCfnResource } from "../../sim-cfn-resource.js";
|
|
3
|
+
import type { SimCfnTemplateValue, SimCfnTemplateValueRecord } from "../../../template/value/sim-cfn-template-value.js";
|
|
4
|
+
interface SimCfnCffResourceFactoryProps {
|
|
5
|
+
readonly logicalId: string;
|
|
6
|
+
readonly properties: SimCfnTemplateValueRecord;
|
|
7
|
+
readonly metadata?: SimCfnTemplateValue;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Generate fake AWS::CloudFront::Function SimCfnResource instances.
|
|
11
|
+
*/
|
|
12
|
+
export declare const simCfnCffResourceFactory: MappedFactory<SimCfnCffResourceFactoryProps, SimCfnResource<object>>;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=sim-cff-cfn.factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-cff-cfn.factory.d.ts","sourceRoot":"","sources":["../../../../../../src/service/cloudformation/resource/cfn/cloudfront/sim-cff-cfn.factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAEhE,OAAO,KAAK,EACV,mBAAmB,EACnB,yBAAyB,EAC1B,MAAM,mDAAmD,CAAC;AAE3D,UAAU,6BAA6B;IACrC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,yBAAyB,CAAC;IAC/C,QAAQ,CAAC,QAAQ,CAAC,EAAE,mBAAmB,CAAC;CACzC;AAED;;GAEG;AACH,eAAO,MAAM,wBAAwB,sEAuBpC,CAAC"}
|