@kensio/yulin 1.20.1 → 1.20.2
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/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/service/apigateway/api/sim-rest-api-lambda-proxy.factory.d.ts +2 -5
- package/dist/service/apigateway/api/sim-rest-api-lambda-proxy.factory.d.ts.map +1 -1
- package/dist/service/apigateway/api/sim-rest-api-lambda-proxy.factory.js +3 -7
- package/dist/service/apigateway/api/sim-rest-api-lambda-proxy.factory.js.map +1 -1
- package/dist/service/apigateway/api/sim-rest-api-proxy-stage.d.ts +22 -0
- package/dist/service/apigateway/api/sim-rest-api-proxy-stage.d.ts.map +1 -0
- package/dist/service/apigateway/api/sim-rest-api-proxy-stage.js +31 -0
- package/dist/service/apigateway/api/sim-rest-api-proxy-stage.js.map +1 -0
- package/dist/service/apigateway/api/stage/settings/sim-rest-api-method-settings.type.d.ts +19 -0
- package/dist/service/apigateway/api/stage/settings/sim-rest-api-method-settings.type.d.ts.map +1 -0
- package/dist/service/apigateway/api/stage/settings/sim-rest-api-method-settings.type.js +2 -0
- package/dist/service/apigateway/api/stage/settings/sim-rest-api-method-settings.type.js.map +1 -0
- package/dist/service/apigateway/api/stage/settings/sim-rest-api-stage-method-settings.d.ts +43 -0
- package/dist/service/apigateway/api/stage/settings/sim-rest-api-stage-method-settings.d.ts.map +1 -0
- package/dist/service/apigateway/api/stage/settings/sim-rest-api-stage-method-settings.js +75 -0
- package/dist/service/apigateway/api/stage/settings/sim-rest-api-stage-method-settings.js.map +1 -0
- package/dist/service/apigateway/api/stage/sim-rest-api-stage.d.ts +19 -0
- package/dist/service/apigateway/api/stage/sim-rest-api-stage.d.ts.map +1 -1
- package/dist/service/apigateway/api/stage/sim-rest-api-stage.js +22 -0
- package/dist/service/apigateway/api/stage/sim-rest-api-stage.js.map +1 -1
- package/dist/service/apigateway/cfn/stage/sim-cfn-rest-api-method-settings-properties.d.ts +33 -0
- package/dist/service/apigateway/cfn/stage/sim-cfn-rest-api-method-settings-properties.d.ts.map +1 -0
- package/dist/service/apigateway/cfn/stage/sim-cfn-rest-api-method-settings-properties.js +69 -0
- package/dist/service/apigateway/cfn/stage/sim-cfn-rest-api-method-settings-properties.js.map +1 -0
- package/dist/service/apigateway/cfn/stage/sim-cfn-rest-api-stage-properties.d.ts +4 -1
- package/dist/service/apigateway/cfn/stage/sim-cfn-rest-api-stage-properties.d.ts.map +1 -1
- package/dist/service/apigateway/cfn/stage/sim-cfn-rest-api-stage-properties.js +13 -4
- package/dist/service/apigateway/cfn/stage/sim-cfn-rest-api-stage-properties.js.map +1 -1
- package/dist/service/apigateway/command/sim-api-gateway-unsimulated-input.d.ts +6 -1
- package/dist/service/apigateway/command/sim-api-gateway-unsimulated-input.d.ts.map +1 -1
- package/dist/service/apigateway/command/sim-api-gateway-unsimulated-input.js +8 -3
- package/dist/service/apigateway/command/sim-api-gateway-unsimulated-input.js.map +1 -1
- package/dist/service/apigateway/command/stage/sim-rest-api-stage-commands.d.ts.map +1 -1
- package/dist/service/apigateway/command/stage/sim-rest-api-stage-commands.js +4 -0
- package/dist/service/apigateway/command/stage/sim-rest-api-stage-commands.js.map +1 -1
- package/dist/service/apigateway/command/stage/sim-rest-api-stage-method-settings-input.d.ts +18 -0
- package/dist/service/apigateway/command/stage/sim-rest-api-stage-method-settings-input.d.ts.map +1 -0
- package/dist/service/apigateway/command/stage/sim-rest-api-stage-method-settings-input.js +42 -0
- package/dist/service/apigateway/command/stage/sim-rest-api-stage-method-settings-input.js.map +1 -0
- package/dist/service/apigateway/command/stage/sim-rest-api-stage-publisher.d.ts +9 -0
- package/dist/service/apigateway/command/stage/sim-rest-api-stage-publisher.d.ts.map +1 -1
- package/dist/service/apigateway/command/stage/sim-rest-api-stage-publisher.js +17 -0
- package/dist/service/apigateway/command/stage/sim-rest-api-stage-publisher.js.map +1 -1
- package/dist/service/apigateway/command/stage/stage.command.d.ts +11 -0
- package/dist/service/apigateway/command/stage/stage.command.d.ts.map +1 -1
- package/dist/service/apigateway/index.d.ts +2 -0
- package/dist/service/apigateway/index.d.ts.map +1 -1
- package/dist/service/apigateway/index.js +1 -0
- package/dist/service/apigateway/index.js.map +1 -1
- package/dist/service/apigateway/serve/sim-api-gateway-controller.d.ts +4 -1
- package/dist/service/apigateway/serve/sim-api-gateway-controller.d.ts.map +1 -1
- package/dist/service/apigateway/serve/sim-api-gateway-controller.js +10 -1
- package/dist/service/apigateway/serve/sim-api-gateway-controller.js.map +1 -1
- package/dist/service/apigateway/serve/sim-api-gateway-error-response.d.ts +8 -0
- package/dist/service/apigateway/serve/sim-api-gateway-error-response.d.ts.map +1 -1
- package/dist/service/apigateway/serve/sim-api-gateway-error-response.js +10 -0
- package/dist/service/apigateway/serve/sim-api-gateway-error-response.js.map +1 -1
- package/dist/service/apigatewayv2/api/sim-http-api-lambda-proxy.factory.d.ts +5 -0
- package/dist/service/apigatewayv2/api/sim-http-api-lambda-proxy.factory.d.ts.map +1 -1
- package/dist/service/apigatewayv2/api/sim-http-api-lambda-proxy.factory.js +4 -0
- package/dist/service/apigatewayv2/api/sim-http-api-lambda-proxy.factory.js.map +1 -1
- package/dist/service/apigatewayv2/api/stage/settings/sim-http-api-route-settings.type.d.ts +24 -0
- package/dist/service/apigatewayv2/api/stage/settings/sim-http-api-route-settings.type.d.ts.map +1 -0
- package/dist/service/apigatewayv2/api/stage/settings/sim-http-api-route-settings.type.js +2 -0
- package/dist/service/apigatewayv2/api/stage/settings/sim-http-api-route-settings.type.js.map +1 -0
- package/dist/service/apigatewayv2/api/stage/settings/sim-http-api-stage-route-settings.d.ts +39 -0
- package/dist/service/apigatewayv2/api/stage/settings/sim-http-api-stage-route-settings.d.ts.map +1 -0
- package/dist/service/apigatewayv2/api/stage/settings/sim-http-api-stage-route-settings.js +74 -0
- package/dist/service/apigatewayv2/api/stage/settings/sim-http-api-stage-route-settings.js.map +1 -0
- package/dist/service/apigatewayv2/api/stage/sim-http-api-stage.d.ts +16 -1
- package/dist/service/apigatewayv2/api/stage/sim-http-api-stage.d.ts.map +1 -1
- package/dist/service/apigatewayv2/api/stage/sim-http-api-stage.js +16 -0
- package/dist/service/apigatewayv2/api/stage/sim-http-api-stage.js.map +1 -1
- package/dist/service/apigatewayv2/cfn/stage/sim-cfn-http-api-route-settings-properties.d.ts +30 -0
- package/dist/service/apigatewayv2/cfn/stage/sim-cfn-http-api-route-settings-properties.d.ts.map +1 -0
- package/dist/service/apigatewayv2/cfn/stage/sim-cfn-http-api-route-settings-properties.js +67 -0
- package/dist/service/apigatewayv2/cfn/stage/sim-cfn-http-api-route-settings-properties.js.map +1 -0
- package/dist/service/apigatewayv2/cfn/stage/sim-cfn-http-api-stage-properties.d.ts +3 -1
- package/dist/service/apigatewayv2/cfn/stage/sim-cfn-http-api-stage-properties.d.ts.map +1 -1
- package/dist/service/apigatewayv2/cfn/stage/sim-cfn-http-api-stage-properties.js +16 -5
- package/dist/service/apigatewayv2/cfn/stage/sim-cfn-http-api-stage-properties.js.map +1 -1
- package/dist/service/apigatewayv2/command/sim-api-gateway-v2-unsimulated-input.d.ts +6 -1
- package/dist/service/apigatewayv2/command/sim-api-gateway-v2-unsimulated-input.d.ts.map +1 -1
- package/dist/service/apigatewayv2/command/sim-api-gateway-v2-unsimulated-input.js +8 -3
- package/dist/service/apigatewayv2/command/sim-api-gateway-v2-unsimulated-input.js.map +1 -1
- package/dist/service/apigatewayv2/command/stage/sim-http-api-stage-commands.d.ts.map +1 -1
- package/dist/service/apigatewayv2/command/stage/sim-http-api-stage-commands.js +8 -0
- package/dist/service/apigatewayv2/command/stage/sim-http-api-stage-commands.js.map +1 -1
- package/dist/service/apigatewayv2/command/stage/sim-http-api-stage-route-settings-input.d.ts +18 -0
- package/dist/service/apigatewayv2/command/stage/sim-http-api-stage-route-settings-input.d.ts.map +1 -0
- package/dist/service/apigatewayv2/command/stage/sim-http-api-stage-route-settings-input.js +32 -0
- package/dist/service/apigatewayv2/command/stage/sim-http-api-stage-route-settings-input.js.map +1 -0
- package/dist/service/apigatewayv2/command/stage/stage.command.d.ts +3 -0
- package/dist/service/apigatewayv2/command/stage/stage.command.d.ts.map +1 -1
- package/dist/service/apigatewayv2/index.d.ts +2 -0
- package/dist/service/apigatewayv2/index.d.ts.map +1 -1
- package/dist/service/apigatewayv2/index.js +1 -0
- package/dist/service/apigatewayv2/index.js.map +1 -1
- package/dist/service/apigatewayv2/serve/sim-api-gateway-v2-controller.d.ts +4 -1
- package/dist/service/apigatewayv2/serve/sim-api-gateway-v2-controller.d.ts.map +1 -1
- package/dist/service/apigatewayv2/serve/sim-api-gateway-v2-controller.js +11 -2
- package/dist/service/apigatewayv2/serve/sim-api-gateway-v2-controller.js.map +1 -1
- package/dist/service/apigatewayv2/serve/sim-api-gateway-v2-error-response.d.ts +8 -0
- package/dist/service/apigatewayv2/serve/sim-api-gateway-v2-error-response.d.ts.map +1 -1
- package/dist/service/apigatewayv2/serve/sim-api-gateway-v2-error-response.js +10 -0
- package/dist/service/apigatewayv2/serve/sim-api-gateway-v2-error-response.js.map +1 -1
- package/dist/service/aws/factory/sim-aws-account-service-cache.d.ts.map +1 -1
- package/dist/service/aws/factory/sim-aws-account-service-cache.js +5 -0
- package/dist/service/aws/factory/sim-aws-account-service-cache.js.map +1 -1
- package/dist/service/cloudformation/template/node/fn/join/sim-cfn-fn-join.d.ts +7 -0
- package/dist/service/cloudformation/template/node/fn/join/sim-cfn-fn-join.d.ts.map +1 -1
- package/dist/service/cloudformation/template/node/fn/join/sim-cfn-fn-join.js +9 -1
- package/dist/service/cloudformation/template/node/fn/join/sim-cfn-fn-join.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/sim-cff-arn.d.ts +13 -0
- package/dist/service/cloudfront/cff/sim-cff-arn.d.ts.map +1 -0
- package/dist/service/cloudfront/cff/sim-cff-arn.js +18 -0
- package/dist/service/cloudfront/cff/sim-cff-arn.js.map +1 -0
- package/dist/service/cloudfront/command/create-distribution/create-distribution.command.d.ts +16 -0
- package/dist/service/cloudfront/command/create-distribution/create-distribution.command.d.ts.map +1 -1
- package/dist/service/cloudfront/command/create-distribution/create-distribution.handler.d.ts +3 -0
- 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 +11 -4
- package/dist/service/cloudfront/command/create-distribution/create-distribution.handler.js.map +1 -1
- package/dist/service/cloudfront/command/create-distribution/sim-cf-distro-config-normalizer.d.ts.map +1 -1
- package/dist/service/cloudfront/command/create-distribution/sim-cf-distro-config-normalizer.js +1 -0
- package/dist/service/cloudfront/command/create-distribution/sim-cf-distro-config-normalizer.js.map +1 -1
- package/dist/service/cloudfront/command/update-distribution/update-distribution.handler.d.ts +3 -0
- package/dist/service/cloudfront/command/update-distribution/update-distribution.handler.d.ts.map +1 -1
- package/dist/service/cloudfront/command/update-distribution/update-distribution.handler.js +9 -2
- package/dist/service/cloudfront/command/update-distribution/update-distribution.handler.js.map +1 -1
- package/dist/service/cloudfront/controller/dependency/sim-cf-controller-dependency.d.ts +3 -0
- package/dist/service/cloudfront/controller/dependency/sim-cf-controller-dependency.d.ts.map +1 -1
- package/dist/service/cloudfront/controller/dependency/sim-cf-controller-dependency.js +6 -0
- package/dist/service/cloudfront/controller/dependency/sim-cf-controller-dependency.js.map +1 -1
- package/dist/service/cloudfront/controller/edge/sim-lambda-edge-applicator.d.ts +48 -0
- package/dist/service/cloudfront/controller/edge/sim-lambda-edge-applicator.d.ts.map +1 -0
- package/dist/service/cloudfront/controller/edge/sim-lambda-edge-applicator.js +66 -0
- package/dist/service/cloudfront/controller/edge/sim-lambda-edge-applicator.js.map +1 -0
- package/dist/service/cloudfront/controller/edge/sim-lambda-edge-distribution.d.ts +11 -0
- package/dist/service/cloudfront/controller/edge/sim-lambda-edge-distribution.d.ts.map +1 -0
- package/dist/service/cloudfront/controller/edge/sim-lambda-edge-distribution.js +14 -0
- package/dist/service/cloudfront/controller/edge/sim-lambda-edge-distribution.js.map +1 -0
- package/dist/service/cloudfront/controller/sim-cloudfront-request-pipeline.d.ts +5 -0
- package/dist/service/cloudfront/controller/sim-cloudfront-request-pipeline.d.ts.map +1 -1
- package/dist/service/cloudfront/controller/sim-cloudfront-request-pipeline.js +16 -1
- package/dist/service/cloudfront/controller/sim-cloudfront-request-pipeline.js.map +1 -1
- package/dist/service/cloudfront/distribution/configurator/sim-cf-behavior-properties.d.ts.map +1 -1
- package/dist/service/cloudfront/distribution/configurator/sim-cf-behavior-properties.js +2 -0
- package/dist/service/cloudfront/distribution/configurator/sim-cf-behavior-properties.js.map +1 -1
- package/dist/service/cloudfront/distribution/sim-cf-distribution-configuration-state.d.ts +5 -2
- package/dist/service/cloudfront/distribution/sim-cf-distribution-configuration-state.d.ts.map +1 -1
- package/dist/service/cloudfront/edge/adapter/sim-lambda-edge-body.d.ts +24 -0
- package/dist/service/cloudfront/edge/adapter/sim-lambda-edge-body.d.ts.map +1 -0
- package/dist/service/cloudfront/edge/adapter/sim-lambda-edge-body.js +51 -0
- package/dist/service/cloudfront/edge/adapter/sim-lambda-edge-body.js.map +1 -0
- package/dist/service/cloudfront/edge/adapter/sim-lambda-edge-event-adapter.d.ts +41 -0
- package/dist/service/cloudfront/edge/adapter/sim-lambda-edge-event-adapter.d.ts.map +1 -0
- package/dist/service/cloudfront/edge/adapter/sim-lambda-edge-event-adapter.js +78 -0
- package/dist/service/cloudfront/edge/adapter/sim-lambda-edge-event-adapter.js.map +1 -0
- package/dist/service/cloudfront/edge/adapter/sim-lambda-edge-headers.d.ts +20 -0
- package/dist/service/cloudfront/edge/adapter/sim-lambda-edge-headers.d.ts.map +1 -0
- package/dist/service/cloudfront/edge/adapter/sim-lambda-edge-headers.js +55 -0
- package/dist/service/cloudfront/edge/adapter/sim-lambda-edge-headers.js.map +1 -0
- package/dist/service/cloudfront/edge/adapter/sim-lambda-edge-request-adapter.d.ts +30 -0
- package/dist/service/cloudfront/edge/adapter/sim-lambda-edge-request-adapter.d.ts.map +1 -0
- package/dist/service/cloudfront/edge/adapter/sim-lambda-edge-request-adapter.js +90 -0
- package/dist/service/cloudfront/edge/adapter/sim-lambda-edge-request-adapter.js.map +1 -0
- package/dist/service/cloudfront/edge/adapter/sim-lambda-edge-response-adapter.d.ts +26 -0
- package/dist/service/cloudfront/edge/adapter/sim-lambda-edge-response-adapter.d.ts.map +1 -0
- package/dist/service/cloudfront/edge/adapter/sim-lambda-edge-response-adapter.js +47 -0
- package/dist/service/cloudfront/edge/adapter/sim-lambda-edge-response-adapter.js.map +1 -0
- package/dist/service/cloudfront/edge/sim-aws-cf-edge-functions.d.ts +44 -0
- package/dist/service/cloudfront/edge/sim-aws-cf-edge-functions.d.ts.map +1 -0
- package/dist/service/cloudfront/edge/sim-aws-cf-edge-functions.js +89 -0
- package/dist/service/cloudfront/edge/sim-aws-cf-edge-functions.js.map +1 -0
- package/dist/service/cloudfront/edge/sim-cf-edge-association-auth-z.d.ts +7 -0
- package/dist/service/cloudfront/edge/sim-cf-edge-association-auth-z.d.ts.map +1 -0
- package/dist/service/cloudfront/edge/sim-cf-edge-association-auth-z.js +27 -0
- package/dist/service/cloudfront/edge/sim-cf-edge-association-auth-z.js.map +1 -0
- package/dist/service/cloudfront/edge/sim-cf-edge-association-checks.d.ts +47 -0
- package/dist/service/cloudfront/edge/sim-cf-edge-association-checks.d.ts.map +1 -0
- package/dist/service/cloudfront/edge/sim-cf-edge-association-checks.js +71 -0
- package/dist/service/cloudfront/edge/sim-cf-edge-association-checks.js.map +1 -0
- package/dist/service/cloudfront/edge/sim-cf-edge-association-validator.d.ts +36 -0
- package/dist/service/cloudfront/edge/sim-cf-edge-association-validator.d.ts.map +1 -0
- package/dist/service/cloudfront/edge/sim-cf-edge-association-validator.js +79 -0
- package/dist/service/cloudfront/edge/sim-cf-edge-association-validator.js.map +1 -0
- package/dist/service/cloudfront/edge/sim-cf-edge-association.d.ts +23 -0
- package/dist/service/cloudfront/edge/sim-cf-edge-association.d.ts.map +1 -0
- package/dist/service/cloudfront/edge/sim-cf-edge-association.js +2 -0
- package/dist/service/cloudfront/edge/sim-cf-edge-association.js.map +1 -0
- package/dist/service/cloudfront/edge/sim-cf-edge-associations-configure.d.ts +14 -0
- package/dist/service/cloudfront/edge/sim-cf-edge-associations-configure.d.ts.map +1 -0
- package/dist/service/cloudfront/edge/sim-cf-edge-associations-configure.js +36 -0
- package/dist/service/cloudfront/edge/sim-cf-edge-associations-configure.js.map +1 -0
- package/dist/service/cloudfront/edge/sim-cf-edge-function-arn.d.ts +18 -0
- package/dist/service/cloudfront/edge/sim-cf-edge-function-arn.d.ts.map +1 -0
- package/dist/service/cloudfront/edge/sim-cf-edge-function-arn.js +47 -0
- package/dist/service/cloudfront/edge/sim-cf-edge-function-arn.js.map +1 -0
- package/dist/service/cloudfront/edge/sim-cf-edge-functions.d.ts +25 -0
- package/dist/service/cloudfront/edge/sim-cf-edge-functions.d.ts.map +1 -0
- package/dist/service/cloudfront/edge/sim-cf-edge-functions.js +2 -0
- package/dist/service/cloudfront/edge/sim-cf-edge-functions.js.map +1 -0
- package/dist/service/cloudfront/error/sim-cloudfront.error.d.ts +13 -0
- package/dist/service/cloudfront/error/sim-cloudfront.error.d.ts.map +1 -1
- package/dist/service/cloudfront/error/sim-cloudfront.error.js +15 -0
- package/dist/service/cloudfront/error/sim-cloudfront.error.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/sim-cloudfront-commands.d.ts +10 -0
- package/dist/service/cloudfront/sim-cloudfront-commands.d.ts.map +1 -1
- package/dist/service/cloudfront/sim-cloudfront-commands.js +10 -1
- package/dist/service/cloudfront/sim-cloudfront-commands.js.map +1 -1
- package/dist/service/cloudfront/sim-cloudfront.d.ts.map +1 -1
- package/dist/service/cloudfront/sim-cloudfront.js +3 -8
- package/dist/service/cloudfront/sim-cloudfront.js.map +1 -1
- package/dist/service/cloudfront/typings/lambda-at-edge.namespace.d.ts +91 -0
- package/dist/service/cloudfront/typings/lambda-at-edge.namespace.d.ts.map +1 -0
- package/dist/service/cloudfront/typings/lambda-at-edge.namespace.js +2 -0
- package/dist/service/cloudfront/typings/lambda-at-edge.namespace.js.map +1 -0
- package/dist/service/lambda/function/environment/sim-lambda-environment.d.ts +22 -20
- package/dist/service/lambda/function/environment/sim-lambda-environment.d.ts.map +1 -1
- package/dist/service/lambda/function/environment/sim-lambda-environment.js +27 -29
- package/dist/service/lambda/function/environment/sim-lambda-environment.js.map +1 -1
- package/dist/service/lambda/function/environment/sim-lambda-host-backed-variables.d.ts +28 -0
- package/dist/service/lambda/function/environment/sim-lambda-host-backed-variables.d.ts.map +1 -0
- package/dist/service/lambda/function/environment/sim-lambda-host-backed-variables.js +49 -0
- package/dist/service/lambda/function/environment/sim-lambda-host-backed-variables.js.map +1 -0
- package/dist/service/lambda/function/environment/sim-lambda-runtime-variables.d.ts +18 -0
- package/dist/service/lambda/function/environment/sim-lambda-runtime-variables.d.ts.map +1 -0
- package/dist/service/lambda/function/environment/sim-lambda-runtime-variables.js +23 -0
- package/dist/service/lambda/function/environment/sim-lambda-runtime-variables.js.map +1 -0
- package/dist/util/process/sim-process-environment.d.ts +9 -0
- package/dist/util/process/sim-process-environment.d.ts.map +1 -1
- package/dist/util/process/sim-process-environment.js +17 -0
- package/dist/util/process/sim-process-environment.js.map +1 -1
- package/dist/util/throttle/sim-token-bucket.d.ts +32 -0
- package/dist/util/throttle/sim-token-bucket.d.ts.map +1 -0
- package/dist/util/throttle/sim-token-bucket.js +53 -0
- package/dist/util/throttle/sim-token-bucket.js.map +1 -0
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { simAwsAccountRegionScopeFactory } from "../aws/sim-aws-account-region-scope.factory.js";
|
|
2
|
-
import { assertDefined } from "../../util/type-guard/defined.js";
|
|
3
2
|
import { SimCloudFrontCloudFormationResourceFactory } from "./cfn/sim-cfn-cloudfront-resource-factory.js";
|
|
4
3
|
import { SimCloudFrontResponseHeadersPolicyRegistry } from "./response-headers-policy/sim-cf-response-headers-policy-registry.js";
|
|
5
4
|
import { SimCloudFrontOriginAccessControlRegistry } from "./origin-access-control/sim-cf-origin-access-control-registry.js";
|
|
5
|
+
import { simCffNameInArn } from "./cff/sim-cff-arn.js";
|
|
6
6
|
import { SimCloudFrontSdkCommandRouter } from "./sdk/sim-cloudfront-sdk-command-router.js";
|
|
7
7
|
import { SimCloudFrontCommands, } from "./sim-cloudfront-commands.js";
|
|
8
8
|
/**
|
|
@@ -96,13 +96,8 @@ export class SimCloudFront {
|
|
|
96
96
|
* Get a sim CloudFront Function by ARN.
|
|
97
97
|
*/
|
|
98
98
|
getCloudFrontFunctionByArn(cloudFrontFunctionArn) {
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
return undefined;
|
|
102
|
-
}
|
|
103
|
-
const cloudFrontFunctionName = cloudFrontFunctionArn.split("/").pop();
|
|
104
|
-
assertDefined(cloudFrontFunctionName, `CloudFront Function name in ARN ${cloudFrontFunctionArn}`);
|
|
105
|
-
return this.cloudFrontFunctions.get(cloudFrontFunctionName);
|
|
99
|
+
const name = simCffNameInArn(cloudFrontFunctionArn, this.accountRegionScope.accountId);
|
|
100
|
+
return name === undefined ? undefined : this.cloudFrontFunctions.get(name);
|
|
106
101
|
}
|
|
107
102
|
/**
|
|
108
103
|
* Get a sim CloudFront Function by name.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sim-cloudfront.js","sourceRoot":"","sources":["../../../src/service/cloudfront/sim-cloudfront.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,+BAA+B,EAAE,MAAM,gDAAgD,CAAC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oB,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;IAC/D,CAAC;IAED;;OAEG;IACH,kBAAkB;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED;;OAEG;IACH,gBAAgB;QACd,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;CACF"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The event and result shapes a Lambda@Edge handler works with.
|
|
3
|
+
*
|
|
4
|
+
* These are hand written for the same reason the CloudFront Functions shapes
|
|
5
|
+
* are. The event is not part of any AWS SDK client package, and the simulator
|
|
6
|
+
* refuses to take a typings dependency to name four objects. They are
|
|
7
|
+
* structurally compatible with the `CloudFrontRequestEvent` and
|
|
8
|
+
* `CloudFrontResponseEvent` types in `@types/aws-lambda`, so a handler already
|
|
9
|
+
* written against those can be passed to the simulator unchanged.
|
|
10
|
+
*
|
|
11
|
+
* Two details differ from the CloudFront Functions shapes and catch people out.
|
|
12
|
+
* A header is a list of `{ key, value }` pairs under its lowercase name rather
|
|
13
|
+
* than a single value, and a status is a string rather than a number.
|
|
14
|
+
*/
|
|
15
|
+
export declare namespace LambdaAtEdge {
|
|
16
|
+
interface Header {
|
|
17
|
+
/** The header name with the casing the viewer or the origin sent. */
|
|
18
|
+
key?: string;
|
|
19
|
+
value: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Headers keyed by lowercase name, each holding every value sent under it.
|
|
23
|
+
*/
|
|
24
|
+
type Headers = Record<string, Header[]>;
|
|
25
|
+
/**
|
|
26
|
+
* The request body, present on a viewer-request event whose association
|
|
27
|
+
* sets `IncludeBody`.
|
|
28
|
+
*/
|
|
29
|
+
interface Body {
|
|
30
|
+
inputTruncated: boolean;
|
|
31
|
+
action: "read-only" | "replace";
|
|
32
|
+
encoding: "base64" | "text";
|
|
33
|
+
data: string;
|
|
34
|
+
}
|
|
35
|
+
interface Request {
|
|
36
|
+
clientIp: string;
|
|
37
|
+
method: string;
|
|
38
|
+
uri: string;
|
|
39
|
+
/** The query string without its leading `?`, empty when there is none. */
|
|
40
|
+
querystring: string;
|
|
41
|
+
headers: Headers;
|
|
42
|
+
body?: Body;
|
|
43
|
+
}
|
|
44
|
+
interface Response {
|
|
45
|
+
/** The HTTP status as a string, which is how CloudFront presents it. */
|
|
46
|
+
status: string;
|
|
47
|
+
statusDescription?: string;
|
|
48
|
+
headers?: Headers;
|
|
49
|
+
body?: string;
|
|
50
|
+
bodyEncoding?: "text" | "base64";
|
|
51
|
+
}
|
|
52
|
+
type EventType = "viewer-request" | "viewer-response";
|
|
53
|
+
interface Config {
|
|
54
|
+
distributionDomainName: string;
|
|
55
|
+
distributionId: string;
|
|
56
|
+
eventType: EventType;
|
|
57
|
+
requestId: string;
|
|
58
|
+
}
|
|
59
|
+
interface RequestRecord {
|
|
60
|
+
cf: {
|
|
61
|
+
config: Config & {
|
|
62
|
+
eventType: "viewer-request";
|
|
63
|
+
};
|
|
64
|
+
request: Request;
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
interface ResponseRecord {
|
|
68
|
+
cf: {
|
|
69
|
+
config: Config & {
|
|
70
|
+
eventType: "viewer-response";
|
|
71
|
+
};
|
|
72
|
+
request: Request;
|
|
73
|
+
response: Response;
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
interface RequestEvent {
|
|
77
|
+
Records: [RequestRecord];
|
|
78
|
+
}
|
|
79
|
+
interface ResponseEvent {
|
|
80
|
+
Records: [ResponseRecord];
|
|
81
|
+
}
|
|
82
|
+
type Event = RequestEvent | ResponseEvent;
|
|
83
|
+
/**
|
|
84
|
+
* What a viewer-request handler answers with.
|
|
85
|
+
*
|
|
86
|
+
* Returning the request carries on to the origin with whatever the handler
|
|
87
|
+
* changed. Returning a response answers the viewer there and then.
|
|
88
|
+
*/
|
|
89
|
+
type RequestResult = Request | Response;
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=lambda-at-edge.namespace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lambda-at-edge.namespace.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudfront/typings/lambda-at-edge.namespace.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,OAAO,WAAW,YAAY,CAAC;IACpC,UAAiB,MAAM;QACrB,qEAAqE;QACrE,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;KACf;IAED;;OAEG;IACH,KAAY,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAE/C;;;OAGG;IACH,UAAiB,IAAI;QACnB,cAAc,EAAE,OAAO,CAAC;QACxB,MAAM,EAAE,WAAW,GAAG,SAAS,CAAC;QAChC,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAAC;QAC5B,IAAI,EAAE,MAAM,CAAC;KACd;IAED,UAAiB,OAAO;QACtB,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;QACf,GAAG,EAAE,MAAM,CAAC;QACZ,0EAA0E;QAC1E,WAAW,EAAE,MAAM,CAAC;QACpB,OAAO,EAAE,OAAO,CAAC;QACjB,IAAI,CAAC,EAAE,IAAI,CAAC;KACb;IAED,UAAiB,QAAQ;QACvB,wEAAwE;QACxE,MAAM,EAAE,MAAM,CAAC;QACf,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,YAAY,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;KAClC;IAED,KAAY,SAAS,GAAG,gBAAgB,GAAG,iBAAiB,CAAC;IAE7D,UAAiB,MAAM;QACrB,sBAAsB,EAAE,MAAM,CAAC;QAC/B,cAAc,EAAE,MAAM,CAAC;QACvB,SAAS,EAAE,SAAS,CAAC;QACrB,SAAS,EAAE,MAAM,CAAC;KACnB;IAED,UAAiB,aAAa;QAC5B,EAAE,EAAE;YACF,MAAM,EAAE,MAAM,GAAG;gBAAE,SAAS,EAAE,gBAAgB,CAAA;aAAE,CAAC;YACjD,OAAO,EAAE,OAAO,CAAC;SAClB,CAAC;KACH;IAED,UAAiB,cAAc;QAC7B,EAAE,EAAE;YACF,MAAM,EAAE,MAAM,GAAG;gBAAE,SAAS,EAAE,iBAAiB,CAAA;aAAE,CAAC;YAClD,OAAO,EAAE,OAAO,CAAC;YACjB,QAAQ,EAAE,QAAQ,CAAC;SACpB,CAAC;KACH;IAED,UAAiB,YAAY;QAC3B,OAAO,EAAE,CAAC,aAAa,CAAC,CAAC;KAC1B;IAED,UAAiB,aAAa;QAC5B,OAAO,EAAE,CAAC,cAAc,CAAC,CAAC;KAC3B;IAED,KAAY,KAAK,GAAG,YAAY,GAAG,aAAa,CAAC;IAEjD;;;;;OAKG;IACH,KAAY,aAAa,GAAG,OAAO,GAAG,QAAQ,CAAC;CAChD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lambda-at-edge.namespace.js","sourceRoot":"","sources":["../../../../src/service/cloudfront/typings/lambda-at-edge.namespace.ts"],"names":[],"mappings":""}
|
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* The function details the AWS-provided runtime environment variables are
|
|
3
|
-
* built from.
|
|
4
|
-
*/
|
|
5
|
-
export interface SimLambdaEnvironmentDetails {
|
|
6
|
-
readonly functionName: string;
|
|
7
|
-
readonly regionName: string;
|
|
8
|
-
readonly memorySizeMb: number;
|
|
9
|
-
}
|
|
1
|
+
import { type SimLambdaEnvironmentDetails } from "./sim-lambda-runtime-variables.js";
|
|
10
2
|
interface SimLambdaEnvironmentProperties extends SimLambdaEnvironmentDetails {
|
|
11
3
|
readonly declaredVariables?: ReadonlyMap<string, string> | undefined;
|
|
12
4
|
}
|
|
@@ -22,12 +14,18 @@ export declare class SimLambdaEnvironment {
|
|
|
22
14
|
#private;
|
|
23
15
|
private readonly details;
|
|
24
16
|
private readonly declared;
|
|
17
|
+
/**
|
|
18
|
+
* The environment a function declaring nothing of its own runs with, which
|
|
19
|
+
* keeps the host process environment underneath the AWS-provided variables.
|
|
20
|
+
*/
|
|
21
|
+
private readonly hostBacked;
|
|
25
22
|
constructor(properties: SimLambdaEnvironmentProperties);
|
|
26
23
|
/**
|
|
27
24
|
* Whether any variables were declared for this function.
|
|
28
25
|
*
|
|
29
|
-
* A function with no declared variables
|
|
30
|
-
*
|
|
26
|
+
* A function with no declared variables runs with the host process
|
|
27
|
+
* environment under the AWS-provided runtime variables, and reports no
|
|
28
|
+
* Environment in its configuration.
|
|
31
29
|
*/
|
|
32
30
|
get hasDeclaredVariables(): boolean;
|
|
33
31
|
/**
|
|
@@ -50,21 +48,25 @@ export declare class SimLambdaEnvironment {
|
|
|
50
48
|
/**
|
|
51
49
|
* Run function code with this environment applied to process.env.
|
|
52
50
|
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
51
|
+
* Every invocation runs with the AWS-provided runtime variables, as every
|
|
52
|
+
* real Lambda invocation does, whatever the function declared. An AWS SDK
|
|
53
|
+
* client built inside the handler reads its Region from AWS_REGION there,
|
|
54
|
+
* and reads credentials the invocation is already attributed to.
|
|
55
|
+
*
|
|
56
|
+
* A function that declares nothing of its own keeps the host process
|
|
57
|
+
* environment underneath them. Taking that away would take away everything
|
|
58
|
+
* the test process set, which is where an in-process handler's
|
|
59
|
+
* configuration comes from when the function declares none. A function
|
|
60
|
+
* declaring variables gets only its own, as before.
|
|
61
|
+
*
|
|
62
|
+
* Zip code running in a vm context takes its variables from the sandbox
|
|
63
|
+
* instead, and is unaffected either way.
|
|
58
64
|
*/
|
|
59
65
|
runWith<T>(run: () => Promise<T>): Promise<T>;
|
|
60
66
|
/**
|
|
61
67
|
* The complete process.env-shaped variables the function code sees.
|
|
62
68
|
*/
|
|
63
69
|
variables(): Record<string, string>;
|
|
64
|
-
/**
|
|
65
|
-
* The AWS-like standard runtime environment variables.
|
|
66
|
-
*/
|
|
67
|
-
private runtimeVariables;
|
|
68
70
|
}
|
|
69
71
|
export {};
|
|
70
72
|
//# sourceMappingURL=sim-lambda-environment.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sim-lambda-environment.d.ts","sourceRoot":"","sources":["../../../../../src/service/lambda/function/environment/sim-lambda-environment.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sim-lambda-environment.d.ts","sourceRoot":"","sources":["../../../../../src/service/lambda/function/environment/sim-lambda-environment.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,2BAA2B,EAEjC,MAAM,mCAAmC,CAAC;AAE3C,UAAU,8BAA+B,SAAQ,2BAA2B;IAC1E,QAAQ,CAAC,iBAAiB,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC;CACtE;AAED;;;;;;;GAOG;AACH,qBAAa,oBAAoB;;IAC/B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA8B;IACtD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA8B;IAEvD;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAsC;IAYjE,YAAY,UAAU,EAAE,8BAA8B,EAIrD;IAED;;;;;;OAMG;IACH,IAAI,oBAAoB,IAAI,OAAO,CAElC;IAED;;OAEG;IACH,IAAI,iBAAiB,IAAI,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAEnD;IAED;;OAEG;IACH,IAAI,YAAY,IAAI,MAAM,CAEzB;IAED;;;;;OAKG;IACH,aAAa,IAAI;QAAE,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,GAAG,SAAS,CAMjE;IAED;;;;;;;;;;;;;;;;OAgBG;IACG,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAMlD;IAED;;OAEG;IACH,SAAS,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAMlC;CACF"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { simProcessEnvironment } from "../../../../util/process/sim-process-environment.js";
|
|
2
|
-
import {
|
|
2
|
+
import { SimLambdaHostBackedVariables } from "./sim-lambda-host-backed-variables.js";
|
|
3
|
+
import { simLambdaRuntimeVariables, } from "./sim-lambda-runtime-variables.js";
|
|
3
4
|
/**
|
|
4
5
|
* The environment a sim Lambda function runs with.
|
|
5
6
|
*
|
|
@@ -11,6 +12,11 @@ import { simLambdaExecutionCredentials } from "./sim-lambda-execution-credential
|
|
|
11
12
|
export class SimLambdaEnvironment {
|
|
12
13
|
details;
|
|
13
14
|
declared;
|
|
15
|
+
/**
|
|
16
|
+
* The environment a function declaring nothing of its own runs with, which
|
|
17
|
+
* keeps the host process environment underneath the AWS-provided variables.
|
|
18
|
+
*/
|
|
19
|
+
hostBacked = new SimLambdaHostBackedVariables();
|
|
14
20
|
/**
|
|
15
21
|
* The merged variables, built once and then reused.
|
|
16
22
|
*
|
|
@@ -28,8 +34,9 @@ export class SimLambdaEnvironment {
|
|
|
28
34
|
/**
|
|
29
35
|
* Whether any variables were declared for this function.
|
|
30
36
|
*
|
|
31
|
-
* A function with no declared variables
|
|
32
|
-
*
|
|
37
|
+
* A function with no declared variables runs with the host process
|
|
38
|
+
* environment under the AWS-provided runtime variables, and reports no
|
|
39
|
+
* Environment in its configuration.
|
|
33
40
|
*/
|
|
34
41
|
get hasDeclaredVariables() {
|
|
35
42
|
return this.declared.size > 0;
|
|
@@ -61,44 +68,35 @@ export class SimLambdaEnvironment {
|
|
|
61
68
|
/**
|
|
62
69
|
* Run function code with this environment applied to process.env.
|
|
63
70
|
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
71
|
+
* Every invocation runs with the AWS-provided runtime variables, as every
|
|
72
|
+
* real Lambda invocation does, whatever the function declared. An AWS SDK
|
|
73
|
+
* client built inside the handler reads its Region from AWS_REGION there,
|
|
74
|
+
* and reads credentials the invocation is already attributed to.
|
|
75
|
+
*
|
|
76
|
+
* A function that declares nothing of its own keeps the host process
|
|
77
|
+
* environment underneath them. Taking that away would take away everything
|
|
78
|
+
* the test process set, which is where an in-process handler's
|
|
79
|
+
* configuration comes from when the function declares none. A function
|
|
80
|
+
* declaring variables gets only its own, as before.
|
|
81
|
+
*
|
|
82
|
+
* Zip code running in a vm context takes its variables from the sandbox
|
|
83
|
+
* instead, and is unaffected either way.
|
|
69
84
|
*/
|
|
70
85
|
async runWith(run) {
|
|
71
|
-
if (
|
|
72
|
-
return await run();
|
|
86
|
+
if (this.hasDeclaredVariables) {
|
|
87
|
+
return await simProcessEnvironment.run(this.variables(), run);
|
|
73
88
|
}
|
|
74
|
-
return await
|
|
89
|
+
return await this.hostBacked.runWith(this.variables(), run);
|
|
75
90
|
}
|
|
76
91
|
/**
|
|
77
92
|
* The complete process.env-shaped variables the function code sees.
|
|
78
93
|
*/
|
|
79
94
|
variables() {
|
|
80
95
|
this.#variables ??= {
|
|
81
|
-
...this.
|
|
96
|
+
...simLambdaRuntimeVariables(this.details),
|
|
82
97
|
...Object.fromEntries(this.declared),
|
|
83
98
|
};
|
|
84
99
|
return this.#variables;
|
|
85
100
|
}
|
|
86
|
-
/**
|
|
87
|
-
* The AWS-like standard runtime environment variables.
|
|
88
|
-
*/
|
|
89
|
-
runtimeVariables() {
|
|
90
|
-
const { functionName, regionName, memorySizeMb } = this.details;
|
|
91
|
-
// Built from entries rather than an object literal because AWS
|
|
92
|
-
// environment variable names are not code identifier names, and the
|
|
93
|
-
// project's naming rules treat object literal keys as if they were.
|
|
94
|
-
return Object.fromEntries([
|
|
95
|
-
["AWS_REGION", regionName],
|
|
96
|
-
["AWS_DEFAULT_REGION", regionName],
|
|
97
|
-
["AWS_LAMBDA_FUNCTION_NAME", functionName],
|
|
98
|
-
["AWS_LAMBDA_FUNCTION_MEMORY_SIZE", String(memorySizeMb)],
|
|
99
|
-
["AWS_LAMBDA_FUNCTION_VERSION", "$LATEST"],
|
|
100
|
-
...simLambdaExecutionCredentials,
|
|
101
|
-
]);
|
|
102
|
-
}
|
|
103
101
|
}
|
|
104
102
|
//# sourceMappingURL=sim-lambda-environment.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sim-lambda-environment.js","sourceRoot":"","sources":["../../../../../src/service/lambda/function/environment/sim-lambda-environment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,qDAAqD,CAAC;AAC5F,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"sim-lambda-environment.js","sourceRoot":"","sources":["../../../../../src/service/lambda/function/environment/sim-lambda-environment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,qDAAqD,CAAC;AAC5F,OAAO,EAAE,4BAA4B,EAAE,MAAM,uCAAuC,CAAC;AACrF,OAAO,EAEL,yBAAyB,GAC1B,MAAM,mCAAmC,CAAC;AAM3C;;;;;;;GAOG;AACH,MAAM,OAAO,oBAAoB;IACd,OAAO,CAA8B;IACrC,QAAQ,CAA8B;IAEvD;;;OAGG;IACc,UAAU,GAAG,IAAI,4BAA4B,EAAE,CAAC;IAEjE;;;;;;;OAOG;IACH,UAAU,CAAqC;IAE/C,YAAY,UAA0C;QACpD,MAAM,EAAE,iBAAiB,EAAE,GAAG,OAAO,EAAE,GAAG,UAAU,CAAC;QACrD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,iBAAiB,IAAI,IAAI,GAAG,EAAE,CAAC;IACjD,CAAC;IAED;;;;;;OAMG;IACH,IAAI,oBAAoB;QACtB,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,GAAG,CAAC,CAAC;IAChC,CAAC;IAED;;OAEG;IACH,IAAI,iBAAiB;QACnB,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC;IACnC,CAAC;IAED;;;;;OAKG;IACH,aAAa;QACX,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC;YAC/B,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;IAC1D,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,KAAK,CAAC,OAAO,CAAI,GAAqB;QACpC,IAAI,IAAI,CAAC,oBAAoB,EAAE,CAAC;YAC9B,OAAO,MAAM,qBAAqB,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,GAAG,CAAC,CAAC;QAChE,CAAC;QAED,OAAO,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,GAAG,CAAC,CAAC;IAC9D,CAAC;IAED;;OAEG;IACH,SAAS;QACP,IAAI,CAAC,UAAU,KAAK;YAClB,GAAG,yBAAyB,CAAC,IAAI,CAAC,OAAO,CAAC;YAC1C,GAAG,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC;SACrC,CAAC;QACF,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;CACF"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The environment of a function that declares no variables of its own.
|
|
3
|
+
*
|
|
4
|
+
* It is the host process environment with the AWS-provided runtime variables
|
|
5
|
+
* laid over it. The host variables are read for each invocation rather than
|
|
6
|
+
* merged once, so a variable the test process sets between two invocations
|
|
7
|
+
* reaches the second of them.
|
|
8
|
+
*
|
|
9
|
+
* What the handler itself wrote is kept and laid over both, which is the warm
|
|
10
|
+
* execution environment semantics a function declaring variables gets from
|
|
11
|
+
* reusing one object. A name the handler wrote and the host also sets is the
|
|
12
|
+
* handler's, until the function is replaced.
|
|
13
|
+
*/
|
|
14
|
+
export declare class SimLambdaHostBackedVariables {
|
|
15
|
+
private readonly written;
|
|
16
|
+
/**
|
|
17
|
+
* Run function code with these variables as its process.env.
|
|
18
|
+
*/
|
|
19
|
+
runWith<T>(functionVariables: Record<string, string>, run: () => Promise<T>): Promise<T>;
|
|
20
|
+
/**
|
|
21
|
+
* Keep what the handler wrote for the next invocation.
|
|
22
|
+
*
|
|
23
|
+
* A name the handler removed is left out. The next invocation reads it from
|
|
24
|
+
* the host process again, the way a name it never touched is read.
|
|
25
|
+
*/
|
|
26
|
+
private recordWrites;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=sim-lambda-host-backed-variables.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-lambda-host-backed-variables.d.ts","sourceRoot":"","sources":["../../../../../src/service/lambda/function/environment/sim-lambda-host-backed-variables.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,qBAAa,4BAA4B;IACvC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA6B;IAErD;;OAEG;IACG,OAAO,CAAC,CAAC,EACb,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACzC,GAAG,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACpB,OAAO,CAAC,CAAC,CAAC,CAaZ;IAED;;;;;OAKG;IACH,OAAO,CAAC,YAAY;CAYrB"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { simProcessEnvironment } from "../../../../util/process/sim-process-environment.js";
|
|
2
|
+
/**
|
|
3
|
+
* The environment of a function that declares no variables of its own.
|
|
4
|
+
*
|
|
5
|
+
* It is the host process environment with the AWS-provided runtime variables
|
|
6
|
+
* laid over it. The host variables are read for each invocation rather than
|
|
7
|
+
* merged once, so a variable the test process sets between two invocations
|
|
8
|
+
* reaches the second of them.
|
|
9
|
+
*
|
|
10
|
+
* What the handler itself wrote is kept and laid over both, which is the warm
|
|
11
|
+
* execution environment semantics a function declaring variables gets from
|
|
12
|
+
* reusing one object. A name the handler wrote and the host also sets is the
|
|
13
|
+
* handler's, until the function is replaced.
|
|
14
|
+
*/
|
|
15
|
+
export class SimLambdaHostBackedVariables {
|
|
16
|
+
written = new Map();
|
|
17
|
+
/**
|
|
18
|
+
* Run function code with these variables as its process.env.
|
|
19
|
+
*/
|
|
20
|
+
async runWith(functionVariables, run) {
|
|
21
|
+
const merged = {
|
|
22
|
+
...simProcessEnvironment.definedHostVariables(),
|
|
23
|
+
...functionVariables,
|
|
24
|
+
...Object.fromEntries(this.written),
|
|
25
|
+
};
|
|
26
|
+
const variables = { ...merged };
|
|
27
|
+
try {
|
|
28
|
+
return await simProcessEnvironment.run(variables, run);
|
|
29
|
+
}
|
|
30
|
+
finally {
|
|
31
|
+
this.recordWrites(merged, variables);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Keep what the handler wrote for the next invocation.
|
|
36
|
+
*
|
|
37
|
+
* A name the handler removed is left out. The next invocation reads it from
|
|
38
|
+
* the host process again, the way a name it never touched is read.
|
|
39
|
+
*/
|
|
40
|
+
recordWrites(merged, variables) {
|
|
41
|
+
const before = new Map(Object.entries(merged));
|
|
42
|
+
for (const [name, value] of Object.entries(variables)) {
|
|
43
|
+
if (before.get(name) !== value) {
|
|
44
|
+
this.written.set(name, value);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=sim-lambda-host-backed-variables.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-lambda-host-backed-variables.js","sourceRoot":"","sources":["../../../../../src/service/lambda/function/environment/sim-lambda-host-backed-variables.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,qDAAqD,CAAC;AAE5F;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,4BAA4B;IACtB,OAAO,GAAG,IAAI,GAAG,EAAkB,CAAC;IAErD;;OAEG;IACH,KAAK,CAAC,OAAO,CACX,iBAAyC,EACzC,GAAqB;QAErB,MAAM,MAAM,GAAG;YACb,GAAG,qBAAqB,CAAC,oBAAoB,EAAE;YAC/C,GAAG,iBAAiB;YACpB,GAAG,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC;SACpC,CAAC;QACF,MAAM,SAAS,GAAG,EAAE,GAAG,MAAM,EAAE,CAAC;QAEhC,IAAI,CAAC;YACH,OAAO,MAAM,qBAAqB,CAAC,GAAG,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;QACzD,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QACvC,CAAC;IACH,CAAC;IAED;;;;;OAKG;IACK,YAAY,CAClB,MAA8B,EAC9B,SAAiC;QAEjC,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;QAE/C,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;YACtD,IAAI,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,KAAK,EAAE,CAAC;gBAC/B,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;YAChC,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The function details the AWS-provided runtime environment variables are
|
|
3
|
+
* built from.
|
|
4
|
+
*/
|
|
5
|
+
export interface SimLambdaEnvironmentDetails {
|
|
6
|
+
readonly functionName: string;
|
|
7
|
+
readonly regionName: string;
|
|
8
|
+
readonly memorySizeMb: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The AWS-like standard runtime environment variables a function runs with.
|
|
12
|
+
*
|
|
13
|
+
* Real Lambda provides these to every invocation, whatever the function's
|
|
14
|
+
* configuration declares, and an AWS SDK client built in the handler reads
|
|
15
|
+
* its Region and its credentials from them.
|
|
16
|
+
*/
|
|
17
|
+
export declare function simLambdaRuntimeVariables(details: SimLambdaEnvironmentDetails): Record<string, string>;
|
|
18
|
+
//# sourceMappingURL=sim-lambda-runtime-variables.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-lambda-runtime-variables.d.ts","sourceRoot":"","sources":["../../../../../src/service/lambda/function/environment/sim-lambda-runtime-variables.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,2BAA2B,GACnC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAcxB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { simLambdaExecutionCredentials } from "./sim-lambda-execution-credentials.js";
|
|
2
|
+
/**
|
|
3
|
+
* The AWS-like standard runtime environment variables a function runs with.
|
|
4
|
+
*
|
|
5
|
+
* Real Lambda provides these to every invocation, whatever the function's
|
|
6
|
+
* configuration declares, and an AWS SDK client built in the handler reads
|
|
7
|
+
* its Region and its credentials from them.
|
|
8
|
+
*/
|
|
9
|
+
export function simLambdaRuntimeVariables(details) {
|
|
10
|
+
const { functionName, regionName, memorySizeMb } = details;
|
|
11
|
+
// Built from entries rather than an object literal because AWS environment
|
|
12
|
+
// variable names are not code identifier names, and the project's naming
|
|
13
|
+
// rules treat object literal keys as if they were.
|
|
14
|
+
return Object.fromEntries([
|
|
15
|
+
["AWS_REGION", regionName],
|
|
16
|
+
["AWS_DEFAULT_REGION", regionName],
|
|
17
|
+
["AWS_LAMBDA_FUNCTION_NAME", functionName],
|
|
18
|
+
["AWS_LAMBDA_FUNCTION_MEMORY_SIZE", String(memorySizeMb)],
|
|
19
|
+
["AWS_LAMBDA_FUNCTION_VERSION", "$LATEST"],
|
|
20
|
+
...simLambdaExecutionCredentials,
|
|
21
|
+
]);
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=sim-lambda-runtime-variables.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-lambda-runtime-variables.js","sourceRoot":"","sources":["../../../../../src/service/lambda/function/environment/sim-lambda-runtime-variables.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,uCAAuC,CAAC;AAYtF;;;;;;GAMG;AACH,MAAM,UAAU,yBAAyB,CACvC,OAAoC;IAEpC,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC;IAE3D,2EAA2E;IAC3E,yEAAyE;IACzE,mDAAmD;IACnD,OAAO,MAAM,CAAC,WAAW,CAAC;QACxB,CAAC,YAAY,EAAE,UAAU,CAAC;QAC1B,CAAC,oBAAoB,EAAE,UAAU,CAAC;QAClC,CAAC,0BAA0B,EAAE,YAAY,CAAC;QAC1C,CAAC,iCAAiC,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC;QACzD,CAAC,6BAA6B,EAAE,SAAS,CAAC;QAC1C,GAAG,6BAA6B;KACjC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -37,6 +37,15 @@ declare class SimProcessEnvironment {
|
|
|
37
37
|
* The host process environment, ignoring any run in progress.
|
|
38
38
|
*/
|
|
39
39
|
hostVariables(): NodeJS.ProcessEnv;
|
|
40
|
+
/**
|
|
41
|
+
* The host process environment in the shape a run's variables are held in.
|
|
42
|
+
*
|
|
43
|
+
* A run's store holds string values only, which is what process.env holds
|
|
44
|
+
* once Node.js has read it. The declared type allows undefined, so the
|
|
45
|
+
* names holding one are dropped rather than carried into a run as the
|
|
46
|
+
* string "undefined".
|
|
47
|
+
*/
|
|
48
|
+
definedHostVariables(): Record<string, string>;
|
|
40
49
|
/**
|
|
41
50
|
* Redefine process.env as an accessor backed by the run store.
|
|
42
51
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sim-process-environment.d.ts","sourceRoot":"","sources":["../../../src/util/process/sim-process-environment.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,cAAM,qBAAqB;IACzB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAmD;IAC3E,OAAO,CAAC,eAAe,CAAkC;IACzD,OAAO,CAAC,SAAS,CAAS;IAE1B;;OAEG;IACG,GAAG,CAAC,CAAC,EACT,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACjC,GAAG,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACpB,OAAO,CAAC,CAAC,CAAC,CAGZ;IAED;;OAEG;IACH,aAAa,IAAI,MAAM,CAAC,UAAU,CAEjC;IAED;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,OAAO;IAkBf;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,gBAAgB;CAmBzB;AAED;;GAEG;AACH,eAAO,MAAM,qBAAqB,uBAA8B,CAAC"}
|
|
1
|
+
{"version":3,"file":"sim-process-environment.d.ts","sourceRoot":"","sources":["../../../src/util/process/sim-process-environment.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,cAAM,qBAAqB;IACzB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAmD;IAC3E,OAAO,CAAC,eAAe,CAAkC;IACzD,OAAO,CAAC,SAAS,CAAS;IAE1B;;OAEG;IACG,GAAG,CAAC,CAAC,EACT,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACjC,GAAG,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACpB,OAAO,CAAC,CAAC,CAAC,CAGZ;IAED;;OAEG;IACH,aAAa,IAAI,MAAM,CAAC,UAAU,CAEjC;IAED;;;;;;;OAOG;IACH,oBAAoB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAU7C;IAED;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,OAAO;IAkBf;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,gBAAgB;CAmBzB;AAED;;GAEG;AACH,eAAO,MAAM,qBAAqB,uBAA8B,CAAC"}
|
|
@@ -43,6 +43,23 @@ class SimProcessEnvironment {
|
|
|
43
43
|
hostVariables() {
|
|
44
44
|
return this.hostEnvironment;
|
|
45
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* The host process environment in the shape a run's variables are held in.
|
|
48
|
+
*
|
|
49
|
+
* A run's store holds string values only, which is what process.env holds
|
|
50
|
+
* once Node.js has read it. The declared type allows undefined, so the
|
|
51
|
+
* names holding one are dropped rather than carried into a run as the
|
|
52
|
+
* string "undefined".
|
|
53
|
+
*/
|
|
54
|
+
definedHostVariables() {
|
|
55
|
+
const defined = [];
|
|
56
|
+
for (const [name, value] of Object.entries(this.hostEnvironment)) {
|
|
57
|
+
if (value !== undefined) {
|
|
58
|
+
defined.push([name, value]);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return Object.fromEntries(defined);
|
|
62
|
+
}
|
|
46
63
|
/**
|
|
47
64
|
* Redefine process.env as an accessor backed by the run store.
|
|
48
65
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sim-process-environment.js","sourceRoot":"","sources":["../../../src/util/process/sim-process-environment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;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,CAAC;QAE9C,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YACtC,OAAO,CAAC,cAAc,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QACtC,CAAC;QACD,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,SAAS,EAAE,CAAC;YACtC,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;gBACxB,4DAA4D;gBAC5D,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;YACtB,CAAC;QACH,CAAC;IACH,CAAC;CACF;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,qBAAqB,EAAE,CAAC"}
|
|
1
|
+
{"version":3,"file":"sim-process-environment.js","sourceRoot":"","sources":["../../../src/util/process/sim-process-environment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,qBAAqB;IACR,OAAO,GAAG,IAAI,iBAAiB,EAA0B,CAAC;IACnE,eAAe,GAAsB,OAAO,CAAC,GAAG,CAAC;IACjD,SAAS,GAAG,KAAK,CAAC;IAE1B;;OAEG;IACH,KAAK,CAAC,GAAG,CACP,SAAiC,EACjC,GAAqB;QAErB,IAAI,CAAC,OAAO,EAAE,CAAC;QACf,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;IAChD,CAAC;IAED;;OAEG;IACH,aAAa;QACX,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;IAED;;;;;;;OAOG;IACH,oBAAoB;QAClB,MAAM,OAAO,GAAuB,EAAE,CAAC;QAEvC,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC;YACjE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,EAAE,CAAC;YACtC,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;gBACxB,4DAA4D;gBAC5D,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;YACtB,CAAC;QACH,CAAC;IACH,CAAC;CACF;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,qBAAqB,EAAE,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { SimClock } from "../clock/sim-clock.js";
|
|
2
|
+
interface SimTokenBucketProperties {
|
|
3
|
+
readonly clock: SimClock;
|
|
4
|
+
/** Tokens added per second, which is the throttling rate limit. */
|
|
5
|
+
readonly rateLimit: number;
|
|
6
|
+
/** How many tokens the bucket holds, which is the throttling burst limit. */
|
|
7
|
+
readonly burstLimit: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The token bucket one throttled thing is served from.
|
|
11
|
+
*
|
|
12
|
+
* The bucket starts full. A burst of five buys five requests before the rate
|
|
13
|
+
* matters. Each request takes a token, and tokens come back at the rate limit,
|
|
14
|
+
* up to the burst limit.
|
|
15
|
+
*
|
|
16
|
+
* Refilling is a function of the simulated clock. A frozen clock holds the
|
|
17
|
+
* bucket where it is, and a test moves the clock to fill it.
|
|
18
|
+
*
|
|
19
|
+
* An API Gateway stage throttle is what this is here for. An HTTP API's routes
|
|
20
|
+
* and a REST API's methods are both served from one of these each, and every
|
|
21
|
+
* client of one draws on that same bucket.
|
|
22
|
+
*/
|
|
23
|
+
export declare class SimTokenBucket {
|
|
24
|
+
#private;
|
|
25
|
+
constructor(properties: SimTokenBucketProperties);
|
|
26
|
+
/**
|
|
27
|
+
* Take one token for a request, and answer whether there was one to take.
|
|
28
|
+
*/
|
|
29
|
+
take(): boolean;
|
|
30
|
+
}
|
|
31
|
+
export {};
|
|
32
|
+
//# sourceMappingURL=sim-token-bucket.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-token-bucket.d.ts","sourceRoot":"","sources":["../../../src/util/throttle/sim-token-bucket.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAItD,UAAU,wBAAwB;IAChC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;IACzB,mEAAmE;IACnE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,6EAA6E;IAC7E,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;;;;;;;;GAaG;AACH,qBAAa,cAAc;;IAOzB,YAAY,UAAU,EAAE,wBAAwB,EAM/C;IAED;;OAEG;IACH,IAAI,IAAI,OAAO,CAUd;CAkBF"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
const millisecondsPerSecond = 1000;
|
|
2
|
+
/**
|
|
3
|
+
* The token bucket one throttled thing is served from.
|
|
4
|
+
*
|
|
5
|
+
* The bucket starts full. A burst of five buys five requests before the rate
|
|
6
|
+
* matters. Each request takes a token, and tokens come back at the rate limit,
|
|
7
|
+
* up to the burst limit.
|
|
8
|
+
*
|
|
9
|
+
* Refilling is a function of the simulated clock. A frozen clock holds the
|
|
10
|
+
* bucket where it is, and a test moves the clock to fill it.
|
|
11
|
+
*
|
|
12
|
+
* An API Gateway stage throttle is what this is here for. An HTTP API's routes
|
|
13
|
+
* and a REST API's methods are both served from one of these each, and every
|
|
14
|
+
* client of one draws on that same bucket.
|
|
15
|
+
*/
|
|
16
|
+
export class SimTokenBucket {
|
|
17
|
+
#clock;
|
|
18
|
+
#rateLimit;
|
|
19
|
+
#burstLimit;
|
|
20
|
+
#tokens;
|
|
21
|
+
#filledAt;
|
|
22
|
+
constructor(properties) {
|
|
23
|
+
this.#clock = properties.clock;
|
|
24
|
+
this.#rateLimit = properties.rateLimit;
|
|
25
|
+
this.#burstLimit = properties.burstLimit;
|
|
26
|
+
this.#tokens = properties.burstLimit;
|
|
27
|
+
this.#filledAt = properties.clock.now().getTime();
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Take one token for a request, and answer whether there was one to take.
|
|
31
|
+
*/
|
|
32
|
+
take() {
|
|
33
|
+
this.#refill();
|
|
34
|
+
if (this.#tokens < 1) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
this.#tokens -= 1;
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Add whatever has accrued since the bucket was last read.
|
|
42
|
+
*
|
|
43
|
+
* A clock that has gone backwards, which a test setting an earlier instant
|
|
44
|
+
* can do, adds nothing rather than taking tokens away.
|
|
45
|
+
*/
|
|
46
|
+
#refill() {
|
|
47
|
+
const now = this.#clock.now().getTime();
|
|
48
|
+
const elapsed = Math.max(0, now - this.#filledAt) / millisecondsPerSecond;
|
|
49
|
+
this.#filledAt = now;
|
|
50
|
+
this.#tokens = Math.min(this.#burstLimit, this.#tokens + elapsed * this.#rateLimit);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=sim-token-bucket.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-token-bucket.js","sourceRoot":"","sources":["../../../src/util/throttle/sim-token-bucket.ts"],"names":[],"mappings":"AAEA,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAUnC;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,cAAc;IAChB,MAAM,CAAW;IACjB,UAAU,CAAS;IACnB,WAAW,CAAS;IAC7B,OAAO,CAAS;IAChB,SAAS,CAAS;IAElB,YAAY,UAAoC;QAC9C,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC;QAC/B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,SAAS,CAAC;QACvC,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC,UAAU,CAAC;QACzC,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC,UAAU,CAAC;QACrC,IAAI,CAAC,SAAS,GAAG,UA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