@kensio/yulin 0.13.0 → 0.15.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/README.md +21 -19
- package/dist/config/eslint/cffjs2.eslint.config.d.ts +3 -0
- package/dist/config/eslint/cffjs2.eslint.config.d.ts.map +1 -0
- package/dist/config/eslint/cffjs2.eslint.config.js +119 -0
- package/dist/config/eslint/cffjs2.eslint.config.js.map +1 -0
- package/dist/config/eslint/index.d.ts +2 -0
- package/dist/config/eslint/index.d.ts.map +1 -0
- package/dist/config/eslint/index.js +2 -0
- package/dist/config/eslint/index.js.map +1 -0
- package/dist/serve/controller/sim-aws-service-controller-container.d.ts +6 -2
- package/dist/serve/controller/sim-aws-service-controller-container.d.ts.map +1 -1
- package/dist/serve/controller/sim-aws-service-controller-container.js +4 -2
- package/dist/serve/controller/sim-aws-service-controller-container.js.map +1 -1
- package/dist/serve/http/sim-aws-http.d.ts +5 -2
- package/dist/serve/http/sim-aws-http.d.ts.map +1 -1
- package/dist/serve/http/sim-aws-http.js +3 -4
- package/dist/serve/http/sim-aws-http.js.map +1 -1
- package/dist/serve/http/sim-aws-local-server.d.ts +10 -3
- package/dist/serve/http/sim-aws-local-server.d.ts.map +1 -1
- package/dist/serve/http/sim-aws-local-server.js +7 -7
- package/dist/serve/http/sim-aws-local-server.js.map +1 -1
- package/dist/serve/http/sim-aws-local-url.d.ts +6 -1
- package/dist/serve/http/sim-aws-local-url.d.ts.map +1 -1
- package/dist/serve/http/sim-aws-local-url.js +4 -4
- package/dist/serve/http/sim-aws-local-url.js.map +1 -1
- package/dist/service/aws/arn.d.ts +1 -1
- package/dist/service/aws/arn.d.ts.map +1 -1
- package/dist/service/aws/arn.js +1 -1
- package/dist/service/aws/arn.js.map +1 -1
- package/dist/service/aws/sim-aws-account-region-scope.d.ts +7 -1
- package/dist/service/aws/sim-aws-account-region-scope.d.ts.map +1 -1
- package/dist/service/aws/sim-aws-account-region-scope.js +11 -6
- package/dist/service/aws/sim-aws-account-region-scope.js.map +1 -1
- package/dist/service/aws/sim-aws-account.d.ts +8 -3
- package/dist/service/aws/sim-aws-account.d.ts.map +1 -1
- package/dist/service/aws/sim-aws-account.js +3 -1
- package/dist/service/aws/sim-aws-account.js.map +1 -1
- package/dist/service/aws/sim-aws-region.d.ts +8 -3
- package/dist/service/aws/sim-aws-region.d.ts.map +1 -1
- package/dist/service/aws/sim-aws-region.js +6 -4
- package/dist/service/aws/sim-aws-region.js.map +1 -1
- package/dist/service/aws/sim-aws.d.ts +21 -7
- package/dist/service/aws/sim-aws.d.ts.map +1 -1
- package/dist/service/aws/sim-aws.js +46 -13
- package/dist/service/aws/sim-aws.js.map +1 -1
- package/dist/service/cloudfront/behaviour/sim-cloud-front-behavior.d.ts +5 -0
- package/dist/service/cloudfront/behaviour/sim-cloud-front-behavior.d.ts.map +1 -1
- package/dist/service/cloudfront/behaviour/sim-cloud-front-behavior.js.map +1 -1
- package/dist/service/cloudfront/cff/adapter/sim-cff-event-adapter.d.ts +36 -0
- package/dist/service/cloudfront/cff/adapter/sim-cff-event-adapter.d.ts.map +1 -0
- package/dist/service/cloudfront/cff/adapter/sim-cff-event-adapter.js +177 -0
- package/dist/service/cloudfront/cff/adapter/sim-cff-event-adapter.js.map +1 -0
- package/dist/service/cloudfront/cff/function-code-input/cff-function-code-input.d.ts +38 -0
- package/dist/service/cloudfront/cff/function-code-input/cff-function-code-input.d.ts.map +1 -0
- package/dist/service/cloudfront/cff/function-code-input/cff-function-code-input.js +69 -0
- package/dist/service/cloudfront/cff/function-code-input/cff-function-code-input.js.map +1 -0
- package/dist/service/cloudfront/cff/sim-cloudfront-function.d.ts +48 -0
- package/dist/service/cloudfront/cff/sim-cloudfront-function.d.ts.map +1 -0
- package/dist/service/cloudfront/cff/sim-cloudfront-function.js +66 -0
- package/dist/service/cloudfront/cff/sim-cloudfront-function.js.map +1 -0
- package/dist/service/cloudfront/command/create-distribution/create-distribution.cmd.d.ts +44 -28
- package/dist/service/cloudfront/command/create-distribution/create-distribution.cmd.d.ts.map +1 -1
- package/dist/service/cloudfront/command/create-distribution/create-distribution.handler.d.ts +13 -9
- package/dist/service/cloudfront/command/create-distribution/create-distribution.handler.d.ts.map +1 -1
- package/dist/service/cloudfront/command/create-distribution/create-distribution.handler.js +23 -78
- package/dist/service/cloudfront/command/create-distribution/create-distribution.handler.js.map +1 -1
- package/dist/service/cloudfront/command/create-function/create-function.cmd.d.ts +43 -0
- package/dist/service/cloudfront/command/create-function/create-function.cmd.d.ts.map +1 -0
- package/dist/service/cloudfront/command/create-function/create-function.cmd.js +5 -0
- package/dist/service/cloudfront/command/create-function/create-function.cmd.js.map +1 -0
- package/dist/service/cloudfront/command/create-function/create-function.handler.d.ts +28 -0
- package/dist/service/cloudfront/command/create-function/create-function.handler.d.ts.map +1 -0
- package/dist/service/cloudfront/command/create-function/create-function.handler.js +49 -0
- package/dist/service/cloudfront/command/create-function/create-function.handler.js.map +1 -0
- package/dist/service/cloudfront/command/get-distribution/get-distribution.cmd.d.ts +29 -0
- package/dist/service/cloudfront/command/get-distribution/get-distribution.cmd.d.ts.map +1 -0
- package/dist/service/cloudfront/command/get-distribution/get-distribution.cmd.js +2 -0
- package/dist/service/cloudfront/command/get-distribution/get-distribution.cmd.js.map +1 -0
- package/dist/service/cloudfront/command/get-distribution/get-distribution.handler.d.ts +21 -0
- package/dist/service/cloudfront/command/get-distribution/get-distribution.handler.d.ts.map +1 -0
- package/dist/service/cloudfront/command/get-distribution/get-distribution.handler.js +40 -0
- package/dist/service/cloudfront/command/get-distribution/get-distribution.handler.js.map +1 -0
- package/dist/service/cloudfront/controller/sim-cloudfront-controller.d.ts +20 -4
- package/dist/service/cloudfront/controller/sim-cloudfront-controller.d.ts.map +1 -1
- package/dist/service/cloudfront/controller/sim-cloudfront-controller.js +52 -7
- package/dist/service/cloudfront/controller/sim-cloudfront-controller.js.map +1 -1
- package/dist/service/cloudfront/distribution/configurator/sim-cloud-front-behavior-configurator.d.ts +21 -0
- package/dist/service/cloudfront/distribution/configurator/sim-cloud-front-behavior-configurator.d.ts.map +1 -0
- package/dist/service/cloudfront/distribution/configurator/sim-cloud-front-behavior-configurator.js +90 -0
- package/dist/service/cloudfront/distribution/configurator/sim-cloud-front-behavior-configurator.js.map +1 -0
- package/dist/service/cloudfront/distribution/configurator/sim-cloud-front-distribution-configurator.d.ts +17 -0
- package/dist/service/cloudfront/distribution/configurator/sim-cloud-front-distribution-configurator.d.ts.map +1 -0
- package/dist/service/cloudfront/distribution/configurator/sim-cloud-front-distribution-configurator.js +28 -0
- package/dist/service/cloudfront/distribution/configurator/sim-cloud-front-distribution-configurator.js.map +1 -0
- package/dist/service/cloudfront/distribution/configurator/sim-cloud-front-origin-configurator.d.ts +15 -0
- package/dist/service/cloudfront/distribution/configurator/sim-cloud-front-origin-configurator.d.ts.map +1 -0
- package/dist/service/cloudfront/distribution/configurator/sim-cloud-front-origin-configurator.js +26 -0
- package/dist/service/cloudfront/distribution/configurator/sim-cloud-front-origin-configurator.js.map +1 -0
- package/dist/service/cloudfront/distribution/sim-cloudfront-distribution.d.ts +23 -1
- package/dist/service/cloudfront/distribution/sim-cloudfront-distribution.d.ts.map +1 -1
- package/dist/service/cloudfront/distribution/sim-cloudfront-distribution.js +23 -1
- package/dist/service/cloudfront/distribution/sim-cloudfront-distribution.js.map +1 -1
- package/dist/service/cloudfront/error/sim-cloudfront.error.d.ts +21 -0
- package/dist/service/cloudfront/error/sim-cloudfront.error.d.ts.map +1 -0
- package/dist/service/cloudfront/error/sim-cloudfront.error.js +20 -0
- package/dist/service/cloudfront/error/sim-cloudfront.error.js.map +1 -0
- package/dist/service/cloudfront/factory/cloudfront-functions.factory.d.ts +15 -2
- package/dist/service/cloudfront/factory/cloudfront-functions.factory.d.ts.map +1 -1
- package/dist/service/cloudfront/factory/cloudfront-functions.factory.js +22 -12
- package/dist/service/cloudfront/factory/cloudfront-functions.factory.js.map +1 -1
- package/dist/service/cloudfront/index.d.ts +1 -0
- package/dist/service/cloudfront/index.d.ts.map +1 -1
- package/dist/service/cloudfront/index.js +1 -0
- package/dist/service/cloudfront/index.js.map +1 -1
- package/dist/service/cloudfront/origin/sim-cloudfront-s3-origin.d.ts +6 -1
- package/dist/service/cloudfront/origin/sim-cloudfront-s3-origin.d.ts.map +1 -1
- package/dist/service/cloudfront/origin/sim-cloudfront-s3-origin.js +3 -3
- package/dist/service/cloudfront/origin/sim-cloudfront-s3-origin.js.map +1 -1
- package/dist/service/cloudfront/resolver/sim-cloud-front-behavior-resolver.js +2 -2
- package/dist/service/cloudfront/resolver/sim-cloud-front-behavior-resolver.js.map +1 -1
- package/dist/service/cloudfront/resolver/sim-cloudfront-path-pattern.d.ts +6 -2
- package/dist/service/cloudfront/resolver/sim-cloudfront-path-pattern.d.ts.map +1 -1
- package/dist/service/cloudfront/resolver/sim-cloudfront-path-pattern.js +3 -3
- package/dist/service/cloudfront/resolver/sim-cloudfront-path-pattern.js.map +1 -1
- package/dist/service/cloudfront/router/sim-cloud-front-distro-router.d.ts +24 -2
- package/dist/service/cloudfront/router/sim-cloud-front-distro-router.d.ts.map +1 -1
- package/dist/service/cloudfront/router/sim-cloud-front-distro-router.js +61 -10
- package/dist/service/cloudfront/router/sim-cloud-front-distro-router.js.map +1 -1
- package/dist/service/cloudfront/sim-cloud-front-registry.d.ts +8 -0
- package/dist/service/cloudfront/sim-cloud-front-registry.d.ts.map +1 -1
- package/dist/service/cloudfront/sim-cloud-front-registry.js +12 -0
- package/dist/service/cloudfront/sim-cloud-front-registry.js.map +1 -1
- package/dist/service/cloudfront/sim-cloudfront.d.ts +32 -2
- package/dist/service/cloudfront/sim-cloudfront.d.ts.map +1 -1
- package/dist/service/cloudfront/sim-cloudfront.js +55 -3
- package/dist/service/cloudfront/sim-cloudfront.js.map +1 -1
- package/dist/service/cloudfront/typings/cloudfront-functions.namespace.d.ts +22 -3
- package/dist/service/cloudfront/typings/cloudfront-functions.namespace.d.ts.map +1 -1
- package/dist/service/dynamodb/command/create-table/create-table.handler.d.ts +7 -1
- package/dist/service/dynamodb/command/create-table/create-table.handler.d.ts.map +1 -1
- package/dist/service/dynamodb/command/create-table/create-table.handler.js +10 -6
- package/dist/service/dynamodb/command/create-table/create-table.handler.js.map +1 -1
- package/dist/service/dynamodb/command/describe-table/describe-table.handler.d.ts +5 -1
- package/dist/service/dynamodb/command/describe-table/describe-table.handler.d.ts.map +1 -1
- package/dist/service/dynamodb/command/describe-table/describe-table.handler.js +2 -2
- package/dist/service/dynamodb/command/describe-table/describe-table.handler.js.map +1 -1
- package/dist/service/dynamodb/command/list-tables/list-tables.handler.d.ts +5 -1
- package/dist/service/dynamodb/command/list-tables/list-tables.handler.d.ts.map +1 -1
- package/dist/service/dynamodb/command/list-tables/list-tables.handler.js +2 -2
- package/dist/service/dynamodb/command/list-tables/list-tables.handler.js.map +1 -1
- package/dist/service/dynamodb/command/put-item/put-item.cmd.d.ts +93 -3
- package/dist/service/dynamodb/command/put-item/put-item.cmd.d.ts.map +1 -1
- package/dist/service/dynamodb/command/put-item/put-item.handler.d.ts +5 -1
- package/dist/service/dynamodb/command/put-item/put-item.handler.d.ts.map +1 -1
- package/dist/service/dynamodb/command/put-item/put-item.handler.js +2 -2
- package/dist/service/dynamodb/command/put-item/put-item.handler.js.map +1 -1
- package/dist/service/dynamodb/sim-dynamodb.d.ts +7 -2
- package/dist/service/dynamodb/sim-dynamodb.d.ts.map +1 -1
- package/dist/service/dynamodb/sim-dynamodb.js +11 -6
- package/dist/service/dynamodb/sim-dynamodb.js.map +1 -1
- package/dist/service/dynamodb/table/dynamodb-table.d.ts +10 -4
- package/dist/service/dynamodb/table/dynamodb-table.d.ts.map +1 -1
- package/dist/service/dynamodb/table/dynamodb-table.js +6 -4
- package/dist/service/dynamodb/table/dynamodb-table.js.map +1 -1
- package/dist/service/s3/bucket/sim-s3-bucket.d.ts +9 -6
- package/dist/service/s3/bucket/sim-s3-bucket.d.ts.map +1 -1
- package/dist/service/s3/bucket/sim-s3-bucket.js +4 -5
- package/dist/service/s3/bucket/sim-s3-bucket.js.map +1 -1
- package/dist/service/s3/command/create-bucket/create-bucket.handler.d.ts +7 -1
- package/dist/service/s3/command/create-bucket/create-bucket.handler.d.ts.map +1 -1
- package/dist/service/s3/command/create-bucket/create-bucket.handler.js +8 -5
- package/dist/service/s3/command/create-bucket/create-bucket.handler.js.map +1 -1
- package/dist/service/s3/command/get-object/get-object.cmd.d.ts +2 -2
- package/dist/service/s3/command/get-object/get-object.cmd.d.ts.map +1 -1
- package/dist/service/s3/command/get-object/get-object.handler.d.ts +5 -1
- package/dist/service/s3/command/get-object/get-object.handler.d.ts.map +1 -1
- package/dist/service/s3/command/get-object/get-object.handler.js +2 -2
- package/dist/service/s3/command/get-object/get-object.handler.js.map +1 -1
- package/dist/service/s3/command/list-buckets/list-buckets.handler.d.ts +5 -1
- package/dist/service/s3/command/list-buckets/list-buckets.handler.d.ts.map +1 -1
- package/dist/service/s3/command/list-buckets/list-buckets.handler.js +2 -2
- package/dist/service/s3/command/list-buckets/list-buckets.handler.js.map +1 -1
- package/dist/service/s3/command/list-objects/list-objects.cmd.d.ts +4 -4
- package/dist/service/s3/command/list-objects/list-objects.cmd.d.ts.map +1 -1
- package/dist/service/s3/command/list-objects/list-objects.handler.d.ts +5 -1
- package/dist/service/s3/command/list-objects/list-objects.handler.d.ts.map +1 -1
- package/dist/service/s3/command/list-objects/list-objects.handler.js +2 -2
- package/dist/service/s3/command/list-objects/list-objects.handler.js.map +1 -1
- package/dist/service/s3/command/put-bucket-website/put-bucket-website.handler.d.ts +5 -1
- package/dist/service/s3/command/put-bucket-website/put-bucket-website.handler.d.ts.map +1 -1
- package/dist/service/s3/command/put-bucket-website/put-bucket-website.handler.js +2 -2
- package/dist/service/s3/command/put-bucket-website/put-bucket-website.handler.js.map +1 -1
- package/dist/service/s3/command/put-object/put-object.cmd.d.ts +8 -5
- package/dist/service/s3/command/put-object/put-object.cmd.d.ts.map +1 -1
- package/dist/service/s3/command/put-object/put-object.handler.d.ts +5 -1
- package/dist/service/s3/command/put-object/put-object.handler.d.ts.map +1 -1
- package/dist/service/s3/command/put-object/put-object.handler.js +7 -3
- package/dist/service/s3/command/put-object/put-object.handler.js.map +1 -1
- package/dist/service/s3/object/s3-object.d.ts +7 -1
- package/dist/service/s3/object/s3-object.d.ts.map +1 -1
- package/dist/service/s3/object/s3-object.js +2 -1
- package/dist/service/s3/object/s3-object.js.map +1 -1
- package/dist/service/s3/serve/sim-s3-controller.d.ts +6 -2
- package/dist/service/s3/serve/sim-s3-controller.d.ts.map +1 -1
- package/dist/service/s3/serve/sim-s3-controller.js +4 -2
- package/dist/service/s3/serve/sim-s3-controller.js.map +1 -1
- package/dist/service/s3/serve/sim-s3-req-router.d.ts +6 -2
- package/dist/service/s3/serve/sim-s3-req-router.d.ts.map +1 -1
- package/dist/service/s3/serve/sim-s3-req-router.js +3 -1
- package/dist/service/s3/serve/sim-s3-req-router.js.map +1 -1
- package/dist/service/s3/sim-s3.d.ts +7 -2
- package/dist/service/s3/sim-s3.d.ts.map +1 -1
- package/dist/service/s3/sim-s3.js +16 -9
- package/dist/service/s3/sim-s3.js.map +1 -1
- package/dist/service/s3/storage/s3-filesystem-storage.d.ts +6 -1
- package/dist/service/s3/storage/s3-filesystem-storage.d.ts.map +1 -1
- package/dist/service/s3/storage/s3-filesystem-storage.js +10 -6
- package/dist/service/s3/storage/s3-filesystem-storage.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +25 -24
package/README.md
CHANGED
|
@@ -71,18 +71,20 @@ import {
|
|
|
71
71
|
} from "@aws-sdk/client-s3";
|
|
72
72
|
|
|
73
73
|
const simAws = new SimAws();
|
|
74
|
-
const srv = await serveSimAws(simAws); // Chooses available port on localhost.
|
|
74
|
+
const srv = await serveSimAws({ simAws }); // Chooses available port on localhost.
|
|
75
75
|
|
|
76
76
|
const simS3 = simAws.region("eu-west-2").s3();
|
|
77
77
|
await simS3.createBucket(new CreateBucketCommand({ Bucket: "foo-site" }));
|
|
78
|
-
await simS3.putBucketWebsite(
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
78
|
+
await simS3.putBucketWebsite(
|
|
79
|
+
new PutBucketWebsiteCommand({
|
|
80
|
+
Bucket: "foo-site",
|
|
81
|
+
WebsiteConfiguration: {
|
|
82
|
+
IndexDocument: {
|
|
83
|
+
Suffix: "index.html",
|
|
84
|
+
},
|
|
83
85
|
},
|
|
84
|
-
},
|
|
85
|
-
|
|
86
|
+
}),
|
|
87
|
+
);
|
|
86
88
|
await simS3.putObject(
|
|
87
89
|
new PutObjectCommand({
|
|
88
90
|
Bucket: "foo-site",
|
|
@@ -111,17 +113,17 @@ involved. This is what "isolated" refers to.
|
|
|
111
113
|
|
|
112
114
|
This "isolated system" approach to testing has a few advantages:
|
|
113
115
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
116
|
+
- Tests run fast as everything is in memory with no real networking.
|
|
117
|
+
- Test set-up is fast and uncomplicated, as there are no containers or extra
|
|
118
|
+
dependencies to manage.
|
|
119
|
+
- It's straightforward to use multiple other mocks and simulators alongside
|
|
120
|
+
yulin, such as [nock](https://github.com/nock/nock), as yulin makes no
|
|
121
|
+
assumptions about the environment.
|
|
122
|
+
- You can control everything in each isolated test process, such as controlling
|
|
123
|
+
the current time, even when multiple different AWS services are simulated.
|
|
124
|
+
- One test can cover **meaningful system behaviour** across multiple AWS
|
|
125
|
+
services and applications, such as Lambdas sending events to SQS queues to be
|
|
126
|
+
picked up by other Lambdas, or DynamoDB streams triggering Lambdas.
|
|
125
127
|
|
|
126
128
|
That last point is the most important. The motivation behind yulin is to enable
|
|
127
129
|
efficient tests that cover the logical behaviour of a system. That is in
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cffjs2.eslint.config.d.ts","sourceRoot":"","sources":["../../../src/config/eslint/cffjs2.eslint.config.ts"],"names":[],"mappings":";AAGA,wBA8HG"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { defineConfig } from "eslint/config";
|
|
2
|
+
import tseslint from "typescript-eslint";
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
// ── CloudFront Functions JS2
|
|
5
|
+
files: ["**/*.cff.js"],
|
|
6
|
+
extends: [tseslint.configs.disableTypeChecked],
|
|
7
|
+
languageOptions: {
|
|
8
|
+
parserOptions: {
|
|
9
|
+
projectService: false,
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
rules: {
|
|
13
|
+
"no-var": "off",
|
|
14
|
+
"prefer-const": "off",
|
|
15
|
+
"object-shorthand": "off",
|
|
16
|
+
"prefer-template": "off",
|
|
17
|
+
"@typescript-eslint/explicit-function-return-type": "off",
|
|
18
|
+
"@typescript-eslint/explicit-module-boundary-types": "off",
|
|
19
|
+
"no-eval": "error",
|
|
20
|
+
"no-new-func": "error",
|
|
21
|
+
"no-implied-eval": "error",
|
|
22
|
+
"no-restricted-globals": [
|
|
23
|
+
"error",
|
|
24
|
+
{
|
|
25
|
+
name: "fetch",
|
|
26
|
+
message: "CloudFront Functions cannot make network requests.",
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: "XMLHttpRequest",
|
|
30
|
+
message: "CloudFront Functions cannot make network requests.",
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: "WebSocket",
|
|
34
|
+
message: "CloudFront Functions cannot open network connections.",
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: "require",
|
|
38
|
+
message: "CloudFront Functions must be self-contained and cannot require modules.",
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: "process",
|
|
42
|
+
message: "CloudFront Functions do not have access to Node.js process APIs.",
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: "Buffer",
|
|
46
|
+
message: "CloudFront Functions do not have access to Node.js Buffer.",
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: "setTimeout",
|
|
50
|
+
message: "CloudFront Functions do not support timers.",
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: "setInterval",
|
|
54
|
+
message: "CloudFront Functions do not support timers.",
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: "setImmediate",
|
|
58
|
+
message: "CloudFront Functions do not support timers.",
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: "Promise",
|
|
62
|
+
message: "Avoid Promise usage in CloudFront Functions.",
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
"no-restricted-syntax": [
|
|
66
|
+
"error",
|
|
67
|
+
{
|
|
68
|
+
selector: "TemplateLiteral",
|
|
69
|
+
message: "CloudFront Functions JS2 does not support template literals. Use string concatenation instead.",
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
selector: "ImportDeclaration",
|
|
73
|
+
message: "CloudFront Functions must be self-contained and should not use import syntax.",
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
selector: "ExportNamedDeclaration:not([declaration.type='FunctionDeclaration'][declaration.id.name='handler'])",
|
|
77
|
+
message: "CloudFront Function files may only export the handler as `export function handler(...)`.",
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
selector: "ExportDefaultDeclaration, ExportAllDeclaration",
|
|
81
|
+
message: "CloudFront Function files may only export the handler as `export function handler(...)`.",
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
selector: "ClassDeclaration, ClassExpression",
|
|
85
|
+
message: "Avoid class syntax in CloudFront Functions JS2 files.",
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
selector: "ArrowFunctionExpression",
|
|
89
|
+
message: "Avoid arrow functions in CloudFront Functions JS2 files. Use function declarations/expressions instead.",
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
selector: "AwaitExpression, FunctionDeclaration[async=true], FunctionExpression[async=true], ArrowFunctionExpression[async=true]",
|
|
93
|
+
message: "CloudFront Functions should not use async/await.",
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
selector: "YieldExpression, FunctionDeclaration[generator=true], FunctionExpression[generator=true]",
|
|
97
|
+
message: "CloudFront Functions should not use generators.",
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
selector: "ObjectPattern, ArrayPattern",
|
|
101
|
+
message: "Avoid destructuring in CloudFront Functions JS2 files.",
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
selector: "SpreadElement, RestElement",
|
|
105
|
+
message: "Avoid spread/rest syntax in CloudFront Functions JS2 files.",
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
selector: "ForOfStatement",
|
|
109
|
+
message: "Avoid for...of in CloudFront Functions JS2 files. Use index-based loops instead.",
|
|
110
|
+
},
|
|
111
|
+
],
|
|
112
|
+
"no-unused-vars": ["error", { varsIgnorePattern: "^handler$" }],
|
|
113
|
+
"@typescript-eslint/no-unused-vars": [
|
|
114
|
+
"error",
|
|
115
|
+
{ varsIgnorePattern: "^handler$" },
|
|
116
|
+
],
|
|
117
|
+
},
|
|
118
|
+
});
|
|
119
|
+
//# sourceMappingURL=cffjs2.eslint.config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cffjs2.eslint.config.js","sourceRoot":"","sources":["../../../src/config/eslint/cffjs2.eslint.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,QAAQ,MAAM,mBAAmB,CAAC;AAEzC,eAAe,YAAY,CAAC;IAC1B,8BAA8B;IAC9B,KAAK,EAAE,CAAC,aAAa,CAAC;IACtB,OAAO,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,kBAAkB,CAAC;IAC9C,eAAe,EAAE;QACf,aAAa,EAAE;YACb,cAAc,EAAE,KAAK;SACtB;KACF;IACD,KAAK,EAAE;QACL,QAAQ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DAAuD;aACjE;YACD;gBACE,QAAQ,EAAE,yBAAyB;gBACnC,OAAO,EACL,yGAAyG;aAC5G;YACD;gBACE,QAAQ,EACN,uHAAuH;gBACzH,OAAO,EAAE,kDAAkD;aAC5D;YACD;gBACE,QAAQ,EACN,0FAA0F;gBAC5F,OAAO,EAAE,iDAAiD;aAC3D;YACD;gBACE,QAAQ,EAAE,6BAA6B;gBACvC,OAAO,EAAE,wDAAwD;aAClE;YACD;gBACE,QAAQ,EAAE,4BAA4B;gBACtC,OAAO,EAAE,6DAA6D;aACvE;YACD;gBACE,QAAQ,EAAE,gBAAgB;gBAC1B,OAAO,EACL,kFAAkF;aACrF;SACF;QACD,gBAAgB,EAAE,CAAC,OAAO,EAAE,EAAE,iBAAiB,EAAE,WAAW,EAAE,CAAC;QAC/D,mCAAmC,EAAE;YACnC,OAAO;YACP,EAAE,iBAAiB,EAAE,WAAW,EAAE;SACnC;KACF;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/config/eslint/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/config/eslint/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { SimAws } from "../../service/aws/sim-aws.js";
|
|
2
2
|
import type { SimAwsServiceController } from "./sim-service-controller.js";
|
|
3
|
+
interface SimAwsServiceControllerContainerProps {
|
|
4
|
+
readonly simAws?: SimAws;
|
|
5
|
+
}
|
|
3
6
|
/**
|
|
4
7
|
* Registry for simulated AWS localhost service controllers.
|
|
5
8
|
*/
|
|
6
9
|
export declare class SimAwsServiceControllerContainer {
|
|
7
10
|
private readonly simAws;
|
|
8
11
|
private readonly controllers;
|
|
9
|
-
constructor(
|
|
12
|
+
constructor(props?: SimAwsServiceControllerContainerProps);
|
|
10
13
|
/**
|
|
11
14
|
* Get the singleton controller for a simulated AWS service.
|
|
12
15
|
*/
|
|
13
16
|
controllerForService(service: string): SimAwsServiceController;
|
|
14
17
|
}
|
|
18
|
+
export {};
|
|
15
19
|
//# sourceMappingURL=sim-aws-service-controller-container.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sim-aws-service-controller-container.d.ts","sourceRoot":"","sources":["../../../src/serve/controller/sim-aws-service-controller-container.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"sim-aws-service-controller-container.d.ts","sourceRoot":"","sources":["../../../src/serve/controller/sim-aws-service-controller-container.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAEtD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAE3E,UAAU,qCAAqC;IAC7C,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,qBAAa,gCAAgC;IAC3C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAuC;gBAEvD,KAAK,GAAE,qCAA0C;IAK7D;;OAEG;IACH,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,uBAAuB;CAK/D"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SimAws } from "../../service/aws/sim-aws.js";
|
|
1
2
|
import { Memo } from "../../util/memo/memo.js";
|
|
2
3
|
/**
|
|
3
4
|
* Registry for simulated AWS localhost service controllers.
|
|
@@ -5,14 +6,15 @@ import { Memo } from "../../util/memo/memo.js";
|
|
|
5
6
|
export class SimAwsServiceControllerContainer {
|
|
6
7
|
simAws;
|
|
7
8
|
controllers = new Memo();
|
|
8
|
-
constructor(
|
|
9
|
+
constructor(props = {}) {
|
|
10
|
+
const { simAws = new SimAws() } = props;
|
|
9
11
|
this.simAws = simAws;
|
|
10
12
|
}
|
|
11
13
|
/**
|
|
12
14
|
* Get the singleton controller for a simulated AWS service.
|
|
13
15
|
*/
|
|
14
16
|
controllerForService(service) {
|
|
15
|
-
return this.controllers.getOrCreate(service, () => this.simAws.
|
|
17
|
+
return this.controllers.getOrCreate(service, () => this.simAws._createServiceController(service));
|
|
16
18
|
}
|
|
17
19
|
}
|
|
18
20
|
//# sourceMappingURL=sim-aws-service-controller-container.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sim-aws-service-controller-container.js","sourceRoot":"","sources":["../../../src/serve/controller/sim-aws-service-controller-container.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sim-aws-service-controller-container.js","sourceRoot":"","sources":["../../../src/serve/controller/sim-aws-service-controller-container.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAO/C;;GAEG;AACH,MAAM,OAAO,gCAAgC;IAC1B,MAAM,CAAS;IACf,WAAW,GAAG,IAAI,IAAI,EAA2B,CAAC;IAEnE,YAAY,QAA+C,EAAE;QAC3D,MAAM,EAAE,MAAM,GAAG,IAAI,MAAM,EAAE,EAAE,GAAG,KAAK,CAAC;QACxC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,oBAAoB,CAAC,OAAe;QAClC,OAAO,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,OAAO,EAAE,GAAG,EAAE,CAChD,IAAI,CAAC,MAAM,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAC9C,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { SimAws } from "../../service/aws/sim-aws.js";
|
|
2
|
+
interface SimAwsHttpProps {
|
|
3
|
+
readonly simAws?: SimAws;
|
|
4
|
+
}
|
|
2
5
|
/**
|
|
3
6
|
* HTTP interface for sending requests into a simulated AWS environment.
|
|
4
7
|
*/
|
|
5
8
|
export declare class SimAwsHttp {
|
|
6
|
-
readonly simAws: SimAws;
|
|
7
9
|
private readonly serviceResolver;
|
|
8
10
|
private readonly controllers;
|
|
9
|
-
constructor(
|
|
11
|
+
constructor(props?: SimAwsHttpProps);
|
|
10
12
|
/**
|
|
11
13
|
* Send a Fetch API request to simulated AWS.
|
|
12
14
|
*/
|
|
@@ -17,4 +19,5 @@ export declare class SimAwsHttp {
|
|
|
17
19
|
handleRequest(request: Request): Promise<Response>;
|
|
18
20
|
private hostnameFromRequest;
|
|
19
21
|
}
|
|
22
|
+
export {};
|
|
20
23
|
//# sourceMappingURL=sim-aws-http.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sim-aws-http.d.ts","sourceRoot":"","sources":["../../../src/serve/http/sim-aws-http.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAEtD
|
|
1
|
+
{"version":3,"file":"sim-aws-http.d.ts","sourceRoot":"","sources":["../../../src/serve/http/sim-aws-http.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAEtD,UAAU,eAAe;IACvB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAoC;IACpE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAmC;gBAEnD,KAAK,GAAE,eAAoB;IAKvC;;OAEG;IACG,KAAK,CACT,KAAK,EAAE,MAAM,GAAG,GAAG,GAAG,OAAO,EAC7B,IAAI,CAAC,EAAE,WAAW,GACjB,OAAO,CAAC,QAAQ,CAAC;IAIpB;;OAEG;IACG,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC;IA8BxD,OAAO,CAAC,mBAAmB;CAS5B"}
|
|
@@ -5,12 +5,11 @@ import { SimAws } from "../../service/aws/sim-aws.js";
|
|
|
5
5
|
* HTTP interface for sending requests into a simulated AWS environment.
|
|
6
6
|
*/
|
|
7
7
|
export class SimAwsHttp {
|
|
8
|
-
simAws;
|
|
9
8
|
serviceResolver = new SimAwsLocalServiceResolver();
|
|
10
9
|
controllers;
|
|
11
|
-
constructor(
|
|
12
|
-
|
|
13
|
-
this.controllers = new SimAwsServiceControllerContainer(simAws);
|
|
10
|
+
constructor(props = {}) {
|
|
11
|
+
const { simAws = new SimAws() } = props;
|
|
12
|
+
this.controllers = new SimAwsServiceControllerContainer({ simAws });
|
|
14
13
|
}
|
|
15
14
|
/**
|
|
16
15
|
* Send a Fetch API request to simulated AWS.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sim-aws-http.js","sourceRoot":"","sources":["../../../src/serve/http/sim-aws-http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,8CAA8C,CAAC;AAC1F,OAAO,EAAE,gCAAgC,EAAE,MAAM,uDAAuD,CAAC;AACzG,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"sim-aws-http.js","sourceRoot":"","sources":["../../../src/serve/http/sim-aws-http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,8CAA8C,CAAC;AAC1F,OAAO,EAAE,gCAAgC,EAAE,MAAM,uDAAuD,CAAC;AACzG,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAMtD;;GAEG;AACH,MAAM,OAAO,UAAU;IACJ,eAAe,GAAG,IAAI,0BAA0B,EAAE,CAAC;IACnD,WAAW,CAAmC;IAE/D,YAA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gBACtB,CAAC,CAAC,yBAAyB,EAC7B,EAAE,MAAM,EAAE,GAAG,EAAE,CAChB,CAAC;QACJ,CAAC;IACH,CAAC;IAEO,mBAAmB,CAAC,OAAgB;QAC1C,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC;QAE7D,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC1B,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF"}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { SimAws } from "../../service/aws/sim-aws.js";
|
|
2
|
+
interface SimAwsLocalServerProps {
|
|
3
|
+
readonly simAws?: SimAws;
|
|
4
|
+
}
|
|
2
5
|
/**
|
|
3
6
|
* Local HTTP server for a simulated AWS environment.
|
|
4
7
|
* Useful for local integration testing and local development.
|
|
5
8
|
*/
|
|
6
9
|
export declare class SimAwsLocalServer {
|
|
7
|
-
readonly simAws: SimAws;
|
|
8
10
|
private readonly simAwsHttp;
|
|
9
11
|
private readonly server;
|
|
10
|
-
constructor(
|
|
12
|
+
constructor(props?: SimAwsLocalServerProps);
|
|
11
13
|
/**
|
|
12
14
|
* Start serving simulated AWS services on localhost.
|
|
13
15
|
*/
|
|
@@ -34,8 +36,13 @@ export declare class SimAwsLocalServer {
|
|
|
34
36
|
private nodeRequestHeaders;
|
|
35
37
|
private sendFetchResponse;
|
|
36
38
|
}
|
|
39
|
+
interface ServeSimAwsProps {
|
|
40
|
+
readonly simAws?: SimAws;
|
|
41
|
+
readonly port?: number;
|
|
42
|
+
}
|
|
37
43
|
/**
|
|
38
44
|
* Serve a simulated AWS environment on localhost.
|
|
39
45
|
*/
|
|
40
|
-
export declare function serveSimAws(
|
|
46
|
+
export declare function serveSimAws(props?: ServeSimAwsProps): Promise<SimAwsLocalServer>;
|
|
47
|
+
export {};
|
|
41
48
|
//# sourceMappingURL=sim-aws-local-server.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sim-aws-local-server.d.ts","sourceRoot":"","sources":["../../../src/serve/http/sim-aws-local-server.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"sim-aws-local-server.d.ts","sourceRoot":"","sources":["../../../src/serve/http/sim-aws-local-server.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAMtD,UAAU,sBAAsB;IAC9B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;GAGG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IACxC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;gBAEpB,KAAK,GAAE,sBAA2B;IAQ9C;;OAEG;IACG,MAAM,CAAC,IAAI,GAAE,MAAoC,GAAG,OAAO,CAAC,IAAI,CAAC;IAMvE;;OAEG;IACH,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED;;OAEG;IACH,IAAI,IAAI,IAAI,MAAM,CAYjB;IAED;;OAEG;IACH,KAAK,IAAI,IAAI;IAIb;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,GAAG,GAAG;YAIpB,gBAAgB;YA4BhB,aAAa;IAU3B,OAAO,CAAC,yBAAyB;IAmBjC,OAAO,CAAC,kBAAkB;YAsBZ,iBAAiB;CAiBhC;AAED,UAAU,gBAAgB;IACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,wBAAsB,WAAW,CAC/B,KAAK,GAAE,gBAAqB,GAC3B,OAAO,CAAC,iBAAiB,CAAC,CAI5B"}
|
|
@@ -9,12 +9,11 @@ import { SimAwsLocalUrl } from "./sim-aws-local-url.js";
|
|
|
9
9
|
* Useful for local integration testing and local development.
|
|
10
10
|
*/
|
|
11
11
|
export class SimAwsLocalServer {
|
|
12
|
-
simAws;
|
|
13
12
|
simAwsHttp;
|
|
14
13
|
server;
|
|
15
|
-
constructor(
|
|
16
|
-
|
|
17
|
-
this.simAwsHttp = new SimAwsHttp(simAws);
|
|
14
|
+
constructor(props = {}) {
|
|
15
|
+
const { simAws = new SimAws() } = props;
|
|
16
|
+
this.simAwsHttp = new SimAwsHttp({ simAws });
|
|
18
17
|
this.server = http.createServer((request, response) => {
|
|
19
18
|
void this.handleRequest(request, response);
|
|
20
19
|
});
|
|
@@ -57,7 +56,7 @@ export class SimAwsLocalServer {
|
|
|
57
56
|
* Adapt a simulated AWS URL for this local server instance.
|
|
58
57
|
*/
|
|
59
58
|
localUrl(input) {
|
|
60
|
-
return new SimAwsLocalUrl(input, this.port).toURL();
|
|
59
|
+
return new SimAwsLocalUrl({ input, port: this.port }).toURL();
|
|
61
60
|
}
|
|
62
61
|
async waitForListening() {
|
|
63
62
|
/* v8 ignore if -- cannot happen in practice */
|
|
@@ -132,8 +131,9 @@ export class SimAwsLocalServer {
|
|
|
132
131
|
/**
|
|
133
132
|
* Serve a simulated AWS environment on localhost.
|
|
134
133
|
*/
|
|
135
|
-
export async function serveSimAws(
|
|
136
|
-
const
|
|
134
|
+
export async function serveSimAws(props = {}) {
|
|
135
|
+
const { simAws = new SimAws(), port = simAwsLocalConf.defaultPort } = props;
|
|
136
|
+
const server = new SimAwsLocalServer({ simAws });
|
|
137
137
|
return server.listen(port);
|
|
138
138
|
}
|
|
139
139
|
//# sourceMappingURL=sim-aws-local-server.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sim-aws-local-server.js","sourceRoot":"","sources":["../../../src/serve/http/sim-aws-local-server.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,EAAE,EAIZ,MAAM,WAAW,CAAC;AACnB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AC/B,QAA0B,EAAE;IAE5B,MAAM,EAAE,MAAM,GAAG,IAAI,MAAM,EAAE,EAAE,IAAI,GAAG,eAAe,CAAC,WAAW,EAAE,GAAG,KAAK,CAAC;IAC5E,MAAM,MAAM,GAAG,IAAI,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;IACjD,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
+
interface SimAwsLocalUrlProps {
|
|
2
|
+
readonly input: string | URL;
|
|
3
|
+
readonly port?: string;
|
|
4
|
+
}
|
|
1
5
|
/**
|
|
2
6
|
* Local URL for a simulated AWS service.
|
|
3
7
|
*/
|
|
4
8
|
export declare class SimAwsLocalUrl {
|
|
5
9
|
static readonly localhostSuffix: string;
|
|
6
10
|
private readonly url;
|
|
7
|
-
constructor(
|
|
11
|
+
constructor(props: SimAwsLocalUrlProps);
|
|
8
12
|
/**
|
|
9
13
|
* Convert to a URL instance.
|
|
10
14
|
*/
|
|
@@ -19,4 +23,5 @@ export declare class SimAwsLocalUrl {
|
|
|
19
23
|
withoutLocalhostSuffix(): URL;
|
|
20
24
|
private localHostname;
|
|
21
25
|
}
|
|
26
|
+
export {};
|
|
22
27
|
//# sourceMappingURL=sim-aws-local-url.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sim-aws-local-url.d.ts","sourceRoot":"","sources":["../../../src/serve/http/sim-aws-local-url.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,qBAAa,cAAc;IACzB,gBAAuB,eAAe,SAAkC;IAExE,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAM;gBAEd,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"sim-aws-local-url.d.ts","sourceRoot":"","sources":["../../../src/serve/http/sim-aws-local-url.ts"],"names":[],"mappings":"AAEA,UAAU,mBAAmB;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,CAAC;IAC7B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,qBAAa,cAAc;IACzB,gBAAuB,eAAe,SAAkC;IAExE,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAM;gBAEd,KAAK,EAAE,mBAAmB;IAStC;;OAEG;IACH,KAAK,IAAI,GAAG;IAIZ;;OAEG;IACH,QAAQ,IAAI,MAAM;IAIlB;;OAEG;IACH,sBAAsB,IAAI,GAAG;IAM7B,OAAO,CAAC,aAAa;CAgBtB"}
|
|
@@ -5,12 +5,12 @@ import { simAwsLocalConf } from "./sim-aws-local.conf.js";
|
|
|
5
5
|
export class SimAwsLocalUrl {
|
|
6
6
|
static localhostSuffix = `.${simAwsLocalConf.hostname}`;
|
|
7
7
|
url;
|
|
8
|
-
constructor(
|
|
9
|
-
this.url = new URL(input);
|
|
8
|
+
constructor(props) {
|
|
9
|
+
this.url = new URL(props.input);
|
|
10
10
|
this.url.protocol = "http:";
|
|
11
11
|
this.url.hostname = this.localHostname(this.url.hostname);
|
|
12
|
-
if (port !== undefined) {
|
|
13
|
-
this.url.port = port;
|
|
12
|
+
if (props.port !== undefined) {
|
|
13
|
+
this.url.port = props.port;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sim-aws-local-url.js","sourceRoot":"","sources":["../../../src/serve/http/sim-aws-local-url.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"sim-aws-local-url.js","sourceRoot":"","sources":["../../../src/serve/http/sim-aws-local-url.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAO1D;;GAEG;AACH,MAAM,OAAO,cAAc;IAClB,MAAM,CAAU,eAAe,GAAG,IAAI,eAAe,CAAC,QAAQ,EAAE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e,EAAE,CAAC;QAC9E,CAAC;QAED,OAAO,GAAG,QAAQ,GAAG,cAAc,CAAC,eAAe,EAAE,CAAC;IACxD,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type AwsRegionName } from "./sim-aws-region.js";
|
|
2
2
|
import { type SimAwsAccountId } from "./sim-aws-account.js";
|
|
3
3
|
export type SimArnServiceName = string;
|
|
4
|
-
export type SimArn = `arn:aws:${SimArnServiceName}:${AwsRegionName}:${SimAwsAccountId}:${string}/${string}`;
|
|
4
|
+
export type SimArn = `arn:aws:${SimArnServiceName}:${AwsRegionName | ""}:${SimAwsAccountId}:${string}/${string}`;
|
|
5
5
|
export interface SimArnComponents {
|
|
6
6
|
partition: "aws";
|
|
7
7
|
service: SimArnServiceName;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arn.d.ts","sourceRoot":"","sources":["../../../src/service/aws/arn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAqB,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAEL,KAAK,eAAe,EACrB,MAAM,sBAAsB,CAAC;AAI9B,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC;AAEvC,MAAM,MAAM,MAAM,GAChB,WAAW,iBAAiB,IAAI,aAAa,IAAI,eAAe,IAAI,MAAM,IAAI,MAAM,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"arn.d.ts","sourceRoot":"","sources":["../../../src/service/aws/arn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAqB,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAEL,KAAK,eAAe,EACrB,MAAM,sBAAsB,CAAC;AAI9B,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC;AAEvC,MAAM,MAAM,MAAM,GAChB,WAAW,iBAAiB,IAAI,aAAa,GAAG,EAAE,IAAI,eAAe,IAAI,MAAM,IAAI,MAAM,EAAE,CAAC;AAE9F,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,KAAK,CAAC;IACjB,OAAO,EAAE,iBAAiB,CAAC;IAC3B,MAAM,EAAE,aAAa,CAAC;IACtB,SAAS,EAAE,eAAe,CAAC;IAC3B,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;CACpB;AAaD;;GAEG;AACH,wBAAgB,UAAU,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,GAAG,MAAM,CAGxE"}
|
package/dist/service/aws/arn.js
CHANGED
|
@@ -2,7 +2,7 @@ import { makeAwsRegionName } from "./sim-aws-region.js";
|
|
|
2
2
|
import { makeSimAwsAccountId, } from "./sim-aws-account.js";
|
|
3
3
|
import { DynamicFactory } from "@kensio/part-factory";
|
|
4
4
|
import { faker } from "@faker-js/faker";
|
|
5
|
-
const defaultSimArnServiceNames = ["
|
|
5
|
+
const defaultSimArnServiceNames = ["cloudfront", "dynamodb", "s3"];
|
|
6
6
|
const simArnComponentsFactory = new DynamicFactory(() => ({
|
|
7
7
|
partition: "aws",
|
|
8
8
|
service: faker.helpers.arrayElement(defaultSimArnServiceNames),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arn.js","sourceRoot":"","sources":["../../../src/service/aws/arn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EACL,mBAAmB,GAEpB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAgBxC,MAAM,yBAAyB,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"arn.js","sourceRoot":"","sources":["../../../src/service/aws/arn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EACL,mBAAmB,GAEpB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAgBxC,MAAM,yBAAyB,GAAG,CAAC,YAAY,EAAE,UAAU,EAAE,IAAI,CAAU,CAAC;AAE5E,MAAM,uBAAuB,GAAG,IAAI,cAAc,CAAmB,GAAG,EAAE,CAAC,CAAC;IAC1E,SAAS,EAAE,KAAK;IAChB,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,yBAAyB,CAAC;IAC9D,MAAM,EAAE,iBAAiB,EAAE;IAC3B,SAAS,EAAE,mBAAmB,EAAE;IAChC,YAAY,EAAE,UAAU;IACxB,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;CACtD,CAAC,CAAC,CAAC;AAEJ;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,SAAqC;IAC9D,MAAM,UAAU,GAAG,uBAAuB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC3D,OAAO,OAAO,UAAU,CAAC,SAAS,IAAI,UAAU,CAAC,OAAO,IAAI,UAAU,CAAC,MAAM,IAAI,UAAU,CAAC,SAAS,IAAI,UAAU,CAAC,YAAY,IAAI,UAAU,CAAC,UAAU,EAAE,CAAC;AAC9J,CAAC"}
|
|
@@ -6,6 +6,11 @@ import type { SimS3 } from "../s3/sim-s3.js";
|
|
|
6
6
|
import type { SimCloudFront } from "../cloudfront/sim-cloudfront.js";
|
|
7
7
|
import type { SimDynamoDb } from "../dynamodb/index.js";
|
|
8
8
|
export type SimAccountRegionScopeKey = `${SimAwsAccountId}:${AwsRegionName}`;
|
|
9
|
+
interface SimAwsAccountRegionContainerProps {
|
|
10
|
+
readonly simAws?: SimAws;
|
|
11
|
+
readonly account?: SimAwsAccount;
|
|
12
|
+
readonly region?: SimAwsRegion;
|
|
13
|
+
}
|
|
9
14
|
/**
|
|
10
15
|
* Combined simulated AWS Account and Region scope.
|
|
11
16
|
* This is the real Account/Region scope container for simulated services.
|
|
@@ -16,7 +21,7 @@ export declare class SimAwsAccountRegionContainer {
|
|
|
16
21
|
readonly region: SimAwsRegion;
|
|
17
22
|
private readonly memo;
|
|
18
23
|
readonly accountRegionScope: SimAwsAccountRegionScope;
|
|
19
|
-
constructor(
|
|
24
|
+
constructor(props?: SimAwsAccountRegionContainerProps);
|
|
20
25
|
/**
|
|
21
26
|
* Get simulated S3 for this account and region.
|
|
22
27
|
*/
|
|
@@ -38,4 +43,5 @@ export interface SimAwsAccountRegionScope {
|
|
|
38
43
|
* Generates fake simulated AWS resource scopes.
|
|
39
44
|
*/
|
|
40
45
|
export declare const simAwsAccountRegionScopeFactory: DynamicFactory<SimAwsAccountRegionScope>;
|
|
46
|
+
export {};
|
|
41
47
|
//# 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,EAEL,KAAK,aAAa,EAClB,KAAK,eAAe,EACrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,KAAK,aAAa,EAElB,KAAK,YAAY,EAClB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,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;AAExD,MAAM,MAAM,wBAAwB,GAAG,GAAG,eAAe,IAAI,aAAa,EAAE,CAAC;AAE7E;;;GAGG;AACH,qBAAa,4BAA4B;
|
|
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,EAEL,KAAK,aAAa,EAClB,KAAK,eAAe,EACrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,KAAK,aAAa,EAElB,KAAK,YAAY,EAClB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,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;AAExD,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,CAAuB;IAE5C,SAAgB,kBAAkB,EAAE,wBAAwB,CAAC;gBAEjD,KAAK,GAAE,iCAAsC;IAiBzD;;OAEG;IACH,EAAE,IAAI,KAAK;IAIX;;OAEG;IACH,UAAU,IAAI,aAAa;IAM3B;;OAEG;IACH,QAAQ,IAAI,WAAW;CAKxB;AAED,MAAM,WAAW,wBAAwB;IACvC,SAAS,EAAE,eAAe,CAAC;IAC3B,UAAU,EAAE,aAAa,CAAC;CAC3B;AAED;;GAEG;AACH,eAAO,MAAM,+BAA+B,0CAIvC,CAAC"}
|
|
@@ -13,10 +13,15 @@ export class SimAwsAccountRegionContainer {
|
|
|
13
13
|
region;
|
|
14
14
|
memo = new Memo();
|
|
15
15
|
accountRegionScope;
|
|
16
|
-
constructor(
|
|
16
|
+
constructor(props = {}) {
|
|
17
|
+
const { simAws = new SimAws(), account, region } = props;
|
|
17
18
|
this.simAws = simAws;
|
|
18
|
-
this.account =
|
|
19
|
-
|
|
19
|
+
this.account =
|
|
20
|
+
account ??
|
|
21
|
+
this.simAws.account(account?.accountId);
|
|
22
|
+
this.region =
|
|
23
|
+
region ??
|
|
24
|
+
this.simAws.region(region?.regionName);
|
|
20
25
|
this.accountRegionScope = {
|
|
21
26
|
accountId: this.account.accountId,
|
|
22
27
|
regionName: this.region.regionName,
|
|
@@ -26,19 +31,19 @@ export class SimAwsAccountRegionContainer {
|
|
|
26
31
|
* Get simulated S3 for this account and region.
|
|
27
32
|
*/
|
|
28
33
|
s3() {
|
|
29
|
-
return this.memo.getOrCreate("s3", () => this.simAws.
|
|
34
|
+
return this.memo.getOrCreate("s3", () => this.simAws._createS3(this));
|
|
30
35
|
}
|
|
31
36
|
/**
|
|
32
37
|
* Get simulated CloudFront for this account.
|
|
33
38
|
*/
|
|
34
39
|
cloudFront() {
|
|
35
|
-
return this.memo.getOrCreate("cloudFront", () => this.simAws.
|
|
40
|
+
return this.memo.getOrCreate("cloudFront", () => this.simAws._createCloudFront(this));
|
|
36
41
|
}
|
|
37
42
|
/**
|
|
38
43
|
* Get simulated DynamoDB for this account and region.
|
|
39
44
|
*/
|
|
40
45
|
dynamoDb() {
|
|
41
|
-
return this.memo.getOrCreate("dynamoDb", () => this.simAws.
|
|
46
|
+
return this.memo.getOrCreate("dynamoDb", () => this.simAws._createDynamoDb(this));
|
|
42
47
|
}
|
|
43
48
|
}
|
|
44
49
|
/**
|
|
@@ -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":"AAAA,OAAO,EACL,mBAAmB,GAGpB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAEL,iBAAiB,GAElB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"sim-aws-account-region-scope.js","sourceRoot":"","sources":["../../../src/service/aws/sim-aws-account-region-scope.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,GAGpB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAEL,iBAAiB,GAElB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAatD;;;GAGG;AACH,MAAM,OAAO,4BAA4B;IACtB,MAAM,CAAS;IAChB,OAAO,CAAgB;IACvB,MAAM,CAAe;IACpB,IAAI,GAAG,IAAI,IAAI,EAAW,CAAC;IAE5B,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,EAA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