@aligent/cdk-prerender-proxy 0.2.5-experimental5 → 0.2.6
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/index.d.ts +1 -1
- package/index.js +1 -1
- package/lib/error-response-construct.js +5 -5
- package/lib/handlers/cache-control.ts +22 -3
- package/lib/handlers/error-response.ts +61 -3
- package/lib/handlers/node_modules/.package-lock.json +55 -0
- package/lib/handlers/node_modules/@types/aws-lambda/LICENSE +21 -0
- package/lib/handlers/node_modules/@types/aws-lambda/README.md +16 -0
- package/lib/handlers/node_modules/@types/aws-lambda/common/api-gateway.d.ts +79 -0
- package/lib/handlers/node_modules/@types/aws-lambda/common/cloudfront.d.ts +79 -0
- package/lib/handlers/node_modules/@types/aws-lambda/handler.d.ts +171 -0
- package/lib/handlers/node_modules/@types/aws-lambda/index.d.ts +85 -0
- package/lib/handlers/node_modules/@types/aws-lambda/package.json +210 -0
- package/lib/handlers/node_modules/@types/aws-lambda/trigger/alb.d.ts +48 -0
- package/lib/handlers/node_modules/@types/aws-lambda/trigger/api-gateway-authorizer.d.ts +174 -0
- package/lib/handlers/node_modules/@types/aws-lambda/trigger/api-gateway-proxy.d.ts +187 -0
- package/lib/handlers/node_modules/@types/aws-lambda/trigger/appsync-resolver.d.ts +51 -0
- package/lib/handlers/node_modules/@types/aws-lambda/trigger/cloudformation-custom-resource.d.ts +68 -0
- package/lib/handlers/node_modules/@types/aws-lambda/trigger/cloudfront-request.d.ts +20 -0
- package/lib/handlers/node_modules/@types/aws-lambda/trigger/cloudfront-response.d.ts +21 -0
- package/lib/handlers/node_modules/@types/aws-lambda/trigger/cloudwatch-events.d.ts +8 -0
- package/lib/handlers/node_modules/@types/aws-lambda/trigger/cloudwatch-logs.d.ts +37 -0
- package/lib/handlers/node_modules/@types/aws-lambda/trigger/codebuild-cloudwatch-state.d.ts +104 -0
- package/lib/handlers/node_modules/@types/aws-lambda/trigger/codepipeline-cloudwatch-action.d.ts +31 -0
- package/lib/handlers/node_modules/@types/aws-lambda/trigger/codepipeline-cloudwatch-pipeline.d.ts +32 -0
- package/lib/handlers/node_modules/@types/aws-lambda/trigger/codepipeline-cloudwatch-stage.d.ts +23 -0
- package/lib/handlers/node_modules/@types/aws-lambda/trigger/codepipeline-cloudwatch.d.ts +11 -0
- package/lib/handlers/node_modules/@types/aws-lambda/trigger/codepipeline.d.ts +55 -0
- package/lib/handlers/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/_common.d.ts +41 -0
- package/lib/handlers/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/create-auth-challenge.d.ts +22 -0
- package/lib/handlers/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/custom-email-sender.d.ts +86 -0
- package/lib/handlers/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/custom-message.d.ts +44 -0
- package/lib/handlers/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/define-auth-challenge.d.ts +21 -0
- package/lib/handlers/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/index.d.ts +119 -0
- package/lib/handlers/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/post-authentication.d.ts +15 -0
- package/lib/handlers/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/post-confirmation.d.ts +22 -0
- package/lib/handlers/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/pre-authentication.d.ts +15 -0
- package/lib/handlers/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/pre-signup.d.ts +31 -0
- package/lib/handlers/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/pre-token-generation.d.ts +45 -0
- package/lib/handlers/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/user-migration.d.ts +39 -0
- package/lib/handlers/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/verify-auth-challenge-response.d.ts +20 -0
- package/lib/handlers/node_modules/@types/aws-lambda/trigger/connect-contact-flow.d.ts +65 -0
- package/lib/handlers/node_modules/@types/aws-lambda/trigger/dynamodb-stream.d.ts +45 -0
- package/lib/handlers/node_modules/@types/aws-lambda/trigger/eventbridge.d.ts +18 -0
- package/lib/handlers/node_modules/@types/aws-lambda/trigger/iot.d.ts +28 -0
- package/lib/handlers/node_modules/@types/aws-lambda/trigger/kinesis-firehose-transformation.d.ts +45 -0
- package/lib/handlers/node_modules/@types/aws-lambda/trigger/kinesis-stream.d.ts +28 -0
- package/lib/handlers/node_modules/@types/aws-lambda/trigger/lex.d.ts +116 -0
- package/lib/handlers/node_modules/@types/aws-lambda/trigger/msk.d.ts +21 -0
- package/lib/handlers/node_modules/@types/aws-lambda/trigger/s3-batch.d.ts +41 -0
- package/lib/handlers/node_modules/@types/aws-lambda/trigger/s3.d.ts +60 -0
- package/lib/handlers/node_modules/@types/aws-lambda/trigger/ses.d.ts +103 -0
- package/lib/handlers/node_modules/@types/aws-lambda/trigger/sns.d.ts +38 -0
- package/lib/handlers/node_modules/@types/aws-lambda/trigger/sqs.d.ts +46 -0
- package/lib/handlers/node_modules/@types/node/LICENSE +21 -0
- package/lib/handlers/node_modules/@types/node/README.md +16 -0
- package/lib/handlers/node_modules/@types/node/assert/strict.d.ts +4 -0
- package/lib/handlers/node_modules/@types/node/assert.d.ts +124 -0
- package/lib/handlers/node_modules/@types/node/async_hooks.d.ts +226 -0
- package/lib/handlers/node_modules/@types/node/base.d.ts +19 -0
- package/lib/handlers/node_modules/@types/node/buffer.d.ts +84 -0
- package/lib/handlers/node_modules/@types/node/child_process.d.ts +526 -0
- package/lib/handlers/node_modules/@types/node/cluster.d.ts +262 -0
- package/lib/handlers/node_modules/@types/node/console.d.ts +133 -0
- package/lib/handlers/node_modules/@types/node/constants.d.ts +13 -0
- package/lib/handlers/node_modules/@types/node/crypto.d.ts +1580 -0
- package/lib/handlers/node_modules/@types/node/dgram.d.ts +141 -0
- package/lib/handlers/node_modules/@types/node/diagnostic_channel.d.ts +34 -0
- package/lib/handlers/node_modules/@types/node/dns/promises.d.ts +97 -0
- package/lib/handlers/node_modules/@types/node/dns.d.ts +322 -0
- package/lib/handlers/node_modules/@types/node/domain.d.ts +24 -0
- package/lib/handlers/node_modules/@types/node/events.d.ts +93 -0
- package/lib/handlers/node_modules/@types/node/fs/promises.d.ts +592 -0
- package/lib/handlers/node_modules/@types/node/fs.d.ts +2239 -0
- package/lib/handlers/node_modules/@types/node/globals.d.ts +655 -0
- package/lib/handlers/node_modules/@types/node/globals.global.d.ts +1 -0
- package/lib/handlers/node_modules/@types/node/http.d.ts +434 -0
- package/lib/handlers/node_modules/@types/node/http2.d.ts +976 -0
- package/lib/handlers/node_modules/@types/node/https.d.ts +36 -0
- package/lib/handlers/node_modules/@types/node/index.d.ts +58 -0
- package/lib/handlers/node_modules/@types/node/inspector.d.ts +3041 -0
- package/lib/handlers/node_modules/@types/node/module.d.ts +52 -0
- package/lib/handlers/node_modules/@types/node/net.d.ts +326 -0
- package/lib/handlers/node_modules/@types/node/os.d.ts +239 -0
- package/lib/handlers/node_modules/@types/node/package.json +232 -0
- package/lib/handlers/node_modules/@types/node/path.d.ts +163 -0
- package/lib/handlers/node_modules/@types/node/perf_hooks.d.ts +310 -0
- package/lib/handlers/node_modules/@types/node/process.d.ts +461 -0
- package/lib/handlers/node_modules/@types/node/punycode.d.ts +75 -0
- package/lib/handlers/node_modules/@types/node/querystring.d.ts +28 -0
- package/lib/handlers/node_modules/@types/node/readline.d.ts +192 -0
- package/lib/handlers/node_modules/@types/node/repl.d.ts +395 -0
- package/lib/handlers/node_modules/@types/node/stream/promises.d.ts +67 -0
- package/lib/handlers/node_modules/@types/node/stream.d.ts +471 -0
- package/lib/handlers/node_modules/@types/node/string_decoder.d.ts +7 -0
- package/lib/handlers/node_modules/@types/node/timers/promises.d.ts +21 -0
- package/lib/handlers/node_modules/@types/node/timers.d.ts +27 -0
- package/lib/handlers/node_modules/@types/node/tls.d.ts +793 -0
- package/lib/handlers/node_modules/@types/node/trace_events.d.ts +61 -0
- package/lib/handlers/node_modules/@types/node/ts3.6/assert.d.ts +98 -0
- package/lib/handlers/node_modules/@types/node/ts3.6/base.d.ts +68 -0
- package/lib/handlers/node_modules/@types/node/ts3.6/index.d.ts +7 -0
- package/lib/handlers/node_modules/@types/node/tty.d.ts +66 -0
- package/lib/handlers/node_modules/@types/node/url.d.ts +116 -0
- package/lib/handlers/node_modules/@types/node/util/types.d.ts +53 -0
- package/lib/handlers/node_modules/@types/node/util.d.ts +156 -0
- package/lib/handlers/node_modules/@types/node/v8.d.ts +198 -0
- package/lib/handlers/node_modules/@types/node/vm.d.ts +152 -0
- package/lib/handlers/node_modules/@types/node/wasi.d.ts +86 -0
- package/lib/handlers/node_modules/@types/node/worker_threads.d.ts +282 -0
- package/lib/handlers/node_modules/@types/node/zlib.d.ts +361 -0
- package/lib/handlers/node_modules/axios/CHANGELOG.md +685 -0
- package/lib/handlers/node_modules/axios/LICENSE +19 -0
- package/lib/handlers/node_modules/axios/README.md +800 -0
- package/lib/handlers/node_modules/axios/UPGRADE_GUIDE.md +162 -0
- package/lib/handlers/node_modules/axios/dist/axios.js +1756 -0
- package/lib/handlers/node_modules/axios/dist/axios.map +1 -0
- package/lib/handlers/node_modules/axios/dist/axios.min.js +3 -0
- package/lib/handlers/node_modules/axios/dist/axios.min.map +1 -0
- package/lib/handlers/node_modules/axios/index.d.ts +161 -0
- package/lib/handlers/node_modules/axios/index.js +1 -0
- package/lib/handlers/node_modules/axios/lib/adapters/README.md +37 -0
- package/lib/handlers/node_modules/axios/lib/adapters/http.js +303 -0
- package/lib/handlers/node_modules/axios/lib/adapters/xhr.js +179 -0
- package/lib/handlers/node_modules/axios/lib/axios.js +56 -0
- package/lib/handlers/node_modules/axios/lib/cancel/Cancel.js +19 -0
- package/lib/handlers/node_modules/axios/lib/cancel/CancelToken.js +57 -0
- package/lib/handlers/node_modules/axios/lib/cancel/isCancel.js +5 -0
- package/lib/handlers/node_modules/axios/lib/core/Axios.js +95 -0
- package/lib/handlers/node_modules/axios/lib/core/InterceptorManager.js +52 -0
- package/lib/handlers/node_modules/axios/lib/core/README.md +7 -0
- package/lib/handlers/node_modules/axios/lib/core/buildFullPath.js +20 -0
- package/lib/handlers/node_modules/axios/lib/core/createError.js +18 -0
- package/lib/handlers/node_modules/axios/lib/core/dispatchRequest.js +79 -0
- package/lib/handlers/node_modules/axios/lib/core/enhanceError.js +42 -0
- package/lib/handlers/node_modules/axios/lib/core/mergeConfig.js +87 -0
- package/lib/handlers/node_modules/axios/lib/core/settle.js +25 -0
- package/lib/handlers/node_modules/axios/lib/core/transformData.js +20 -0
- package/lib/handlers/node_modules/axios/lib/defaults.js +98 -0
- package/lib/handlers/node_modules/axios/lib/helpers/README.md +7 -0
- package/lib/handlers/node_modules/axios/lib/helpers/bind.js +11 -0
- package/lib/handlers/node_modules/axios/lib/helpers/buildURL.js +70 -0
- package/lib/handlers/node_modules/axios/lib/helpers/combineURLs.js +14 -0
- package/lib/handlers/node_modules/axios/lib/helpers/cookies.js +53 -0
- package/lib/handlers/node_modules/axios/lib/helpers/deprecatedMethod.js +24 -0
- package/lib/handlers/node_modules/axios/lib/helpers/isAbsoluteURL.js +14 -0
- package/lib/handlers/node_modules/axios/lib/helpers/isAxiosError.js +11 -0
- package/lib/handlers/node_modules/axios/lib/helpers/isURLSameOrigin.js +68 -0
- package/lib/handlers/node_modules/axios/lib/helpers/normalizeHeaderName.js +12 -0
- package/lib/handlers/node_modules/axios/lib/helpers/parseHeaders.js +53 -0
- package/lib/handlers/node_modules/axios/lib/helpers/spread.js +27 -0
- package/lib/handlers/node_modules/axios/lib/utils.js +351 -0
- package/lib/handlers/node_modules/axios/package.json +86 -0
- package/lib/handlers/node_modules/buffer-from/LICENSE +21 -0
- package/lib/handlers/node_modules/buffer-from/index.js +69 -0
- package/lib/handlers/node_modules/buffer-from/package.json +19 -0
- package/lib/handlers/node_modules/buffer-from/readme.md +69 -0
- package/lib/handlers/node_modules/follow-redirects/LICENSE +18 -0
- package/lib/handlers/node_modules/follow-redirects/README.md +148 -0
- package/lib/handlers/node_modules/follow-redirects/debug.js +14 -0
- package/lib/handlers/node_modules/follow-redirects/http.js +1 -0
- package/lib/handlers/node_modules/follow-redirects/https.js +1 -0
- package/lib/handlers/node_modules/follow-redirects/index.js +531 -0
- package/lib/handlers/node_modules/follow-redirects/package.json +59 -0
- package/lib/handlers/node_modules/source-map/CHANGELOG.md +301 -0
- package/lib/handlers/node_modules/source-map/LICENSE +28 -0
- package/lib/handlers/node_modules/source-map/README.md +742 -0
- package/lib/handlers/node_modules/source-map/dist/source-map.debug.js +3234 -0
- package/lib/handlers/node_modules/source-map/dist/source-map.js +3233 -0
- package/lib/handlers/node_modules/source-map/dist/source-map.min.js +2 -0
- package/lib/handlers/node_modules/source-map/dist/source-map.min.js.map +1 -0
- package/lib/handlers/node_modules/source-map/lib/array-set.js +121 -0
- package/lib/handlers/node_modules/source-map/lib/base64-vlq.js +140 -0
- package/lib/handlers/node_modules/source-map/lib/base64.js +67 -0
- package/lib/handlers/node_modules/source-map/lib/binary-search.js +111 -0
- package/lib/handlers/node_modules/source-map/lib/mapping-list.js +79 -0
- package/lib/handlers/node_modules/source-map/lib/quick-sort.js +114 -0
- package/lib/handlers/node_modules/source-map/lib/source-map-consumer.js +1145 -0
- package/lib/handlers/node_modules/source-map/lib/source-map-generator.js +425 -0
- package/lib/handlers/node_modules/source-map/lib/source-node.js +413 -0
- package/lib/handlers/node_modules/source-map/lib/util.js +488 -0
- package/lib/handlers/node_modules/source-map/package.json +73 -0
- package/lib/handlers/node_modules/source-map/source-map.d.ts +98 -0
- package/lib/handlers/node_modules/source-map/source-map.js +8 -0
- package/lib/handlers/node_modules/source-map-support/LICENSE.md +21 -0
- package/lib/handlers/node_modules/source-map-support/README.md +284 -0
- package/lib/handlers/node_modules/source-map-support/browser-source-map-support.js +114 -0
- package/lib/handlers/node_modules/source-map-support/package.json +31 -0
- package/lib/handlers/node_modules/source-map-support/register.js +1 -0
- package/lib/handlers/node_modules/source-map-support/source-map-support.js +604 -0
- package/lib/handlers/package-lock.json +40 -1257
- package/lib/handlers/package.json +3 -7
- package/lib/handlers/prerender-check.ts +32 -3
- package/lib/handlers/prerender.ts +50 -3
- package/lib/handlers/tsconfig.json +3 -2
- package/lib/prerender-cf-cache-control-construct.d.ts +1 -1
- package/lib/prerender-cf-cache-control-construct.js +6 -6
- package/lib/prerender-check-construct.js +4 -4
- package/lib/prerender-construct.js +7 -7
- package/lib/prerender-lambda-construct.d.ts +4 -4
- package/lib/prerender-lambda-construct.js +5 -5
- package/package.json +4 -6
- package/tsconfig.json +1 -1
package/index.d.ts
CHANGED
|
@@ -3,4 +3,4 @@ import { PrerenderFunction } from "./lib/prerender-construct";
|
|
|
3
3
|
import { PrerenderCheckFunction } from "./lib/prerender-check-construct";
|
|
4
4
|
import { ErrorResponseFunction } from "./lib/error-response-construct";
|
|
5
5
|
import { CloudFrontCacheControl, CloudFrontCacheControlOptions } from "./lib/prerender-cf-cache-control-construct";
|
|
6
|
-
export { PrerenderLambda, PrerenderFunction, PrerenderCheckFunction, ErrorResponseFunction, CloudFrontCacheControl, CloudFrontCacheControlOptions };
|
|
6
|
+
export { PrerenderLambda, PrerenderFunction, PrerenderCheckFunction, ErrorResponseFunction, CloudFrontCacheControl, CloudFrontCacheControlOptions, };
|
package/index.js
CHANGED
|
@@ -11,4 +11,4 @@ const error_response_construct_1 = require("./lib/error-response-construct");
|
|
|
11
11
|
Object.defineProperty(exports, "ErrorResponseFunction", { enumerable: true, get: function () { return error_response_construct_1.ErrorResponseFunction; } });
|
|
12
12
|
const prerender_cf_cache_control_construct_1 = require("./lib/prerender-cf-cache-control-construct");
|
|
13
13
|
Object.defineProperty(exports, "CloudFrontCacheControl", { enumerable: true, get: function () { return prerender_cf_cache_control_construct_1.CloudFrontCacheControl; } });
|
|
14
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
14
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJz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G91ZEZyb250Q2FjaGVDb250cm9sLFxuICBDbG91ZEZyb250Q2FjaGVDb250cm9sT3B0aW9ucyxcbn07XG4iXX0=
|
|
@@ -9,7 +9,7 @@ class ErrorResponseFunction extends core_1.Construct {
|
|
|
9
9
|
constructor(scope, id, options) {
|
|
10
10
|
var _a;
|
|
11
11
|
super(scope, id);
|
|
12
|
-
this.edgeFunction = new aws_cloudfront_1.experimental.EdgeFunction(this,
|
|
12
|
+
this.edgeFunction = new aws_cloudfront_1.experimental.EdgeFunction(this, "ErrorResponseFunction", {
|
|
13
13
|
code: bundling_1.Bundling.bundle({
|
|
14
14
|
entry: `${__dirname}/handlers/error-response.ts`,
|
|
15
15
|
runtime: aws_lambda_1.Runtime.NODEJS_14_X,
|
|
@@ -20,13 +20,13 @@ class ErrorResponseFunction extends core_1.Construct {
|
|
|
20
20
|
// and replace during build/deploy with static values. This gets around the lambda@edge limitation
|
|
21
21
|
// of no environment variables at runtime.
|
|
22
22
|
define: {
|
|
23
|
-
|
|
24
|
-
}
|
|
23
|
+
"process.env.PATH_PREFIX": JSON.stringify((_a = options.pathPrefix) !== null && _a !== void 0 ? _a : ""),
|
|
24
|
+
},
|
|
25
25
|
}),
|
|
26
26
|
runtime: aws_lambda_1.Runtime.NODEJS_14_X,
|
|
27
|
-
handler:
|
|
27
|
+
handler: "index.handler",
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
exports.ErrorResponseFunction = ErrorResponseFunction;
|
|
32
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
32
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXJyb3ItcmVzcG9uc2UtY29uc3RydWN0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiZXJyb3ItcmVzcG9uc2UtY29uc3RydWN0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLHdDQUEwQztBQUMxQyxzRUFBb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GxlcnMvYCxcbiAgICAgICAgICBkZXBzTG9ja0ZpbGVQYXRoOiBgJHtfX2Rpcm5hbWV9L2hhbmRsZXJzL3BhY2thZ2UtbG9jay5qc29uYCxcbiAgICAgICAgICAvLyBEZWZpbmUgb3B0aW9ucyByZXBsYWNlIHZhbHVlcyBhdCBidWlsZCB0aW1lIHNvIHdlIGNhbiB1c2UgZW52aXJvbm1lbnQgdmFyaWFibGVzIHRvIHRlc3QgbG9jYWxseVxuICAgICAgICAgIC8vIGFuZCByZXBsYWNlIGR1cmluZyBidWlsZC9kZXBsb3kgd2l0aCBzdGF0aWMgdmFsdWVzLiBUaGlzIGdldHMgYXJvdW5kIHRoZSBsYW1iZGFAZWRnZSBsaW1pdGF0aW9uXG4gICAgICAgICAgLy8gb2Ygbm8gZW52aXJvbm1lbnQgdmFyaWFibGVzIGF0IHJ1bnRpbWUuXG4gICAgICAgICAgZGVmaW5lOiB7XG4gICAgICAgICAgICBcInByb2Nlc3MuZW52LlBBVEhfUFJFRklYXCI6IEpTT04uc3RyaW5naWZ5KG9wdGlvbnMucGF0aFByZWZpeCA/PyBcIlwiKSxcbiAgICAgICAgICB9LFxuICAgICAgICB9IGFzIGFueSksXG4gICAgICAgIHJ1bnRpbWU6IFJ1bnRpbWUuTk9ERUpTXzE0X1gsXG4gICAgICAgIGhhbmRsZXI6IFwiaW5kZXguaGFuZGxlclwiLFxuICAgICAgfVxuICAgICk7XG4gIH1cbn1cbiJdfQ==
|
|
@@ -1,4 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import "source-map-support/register";
|
|
2
|
+
import { CloudFrontResponseEvent, CloudFrontResponse } from "aws-lambda";
|
|
3
|
+
/*
|
|
4
|
+
Prerender cache control function
|
|
5
|
+
Consider associate this function as *origin response* function
|
|
6
|
+
*/
|
|
7
|
+
export const handler = async (
|
|
8
|
+
event: CloudFrontResponseEvent
|
|
9
|
+
): Promise<CloudFrontResponse> => {
|
|
10
|
+
const cacheKey = process.env.PRERENDER_CACHE_KEY || "x-prerender-requestid";
|
|
11
|
+
const cacheMaxAge = process.env.PRERENDER_CACHE_MAX_AGE || "0";
|
|
12
|
+
const response = event.Records[0].cf.response;
|
|
3
13
|
|
|
4
|
-
|
|
14
|
+
if (response.headers[`${cacheKey}`]) {
|
|
15
|
+
response.headers["Cache-Control"] = [
|
|
16
|
+
{
|
|
17
|
+
key: "Cache-Control",
|
|
18
|
+
value: `max-age=${cacheMaxAge}`,
|
|
19
|
+
},
|
|
20
|
+
];
|
|
21
|
+
}
|
|
22
|
+
return response;
|
|
23
|
+
};
|
|
@@ -1,4 +1,62 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import "source-map-support/register";
|
|
2
|
+
import {
|
|
3
|
+
CloudFrontRequest,
|
|
4
|
+
CloudFrontResponseEvent,
|
|
5
|
+
CloudFrontResponse,
|
|
6
|
+
} from "aws-lambda";
|
|
7
|
+
import axios from "axios";
|
|
8
|
+
import { URL } from "url";
|
|
9
|
+
import * as https from "https";
|
|
3
10
|
|
|
4
|
-
|
|
11
|
+
const FRONTEND_HOST = process.env.FRONTEND_HOST;
|
|
12
|
+
const PATH_PREFIX = process.env.PATH_PREFIX;
|
|
13
|
+
|
|
14
|
+
// Create axios client outside of lambda function for re-use between calls
|
|
15
|
+
const instance = axios.create({
|
|
16
|
+
timeout: 1000,
|
|
17
|
+
// Don't follow redirects
|
|
18
|
+
maxRedirects: 0,
|
|
19
|
+
// Only valid response codes are 200
|
|
20
|
+
validateStatus: function (status) {
|
|
21
|
+
return status == 200;
|
|
22
|
+
},
|
|
23
|
+
// keep connection alive so we don't constantly do SSL negotiation
|
|
24
|
+
httpsAgent: new https.Agent({ keepAlive: true }),
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export const handler = (
|
|
28
|
+
event: CloudFrontResponseEvent
|
|
29
|
+
): Promise<CloudFrontResponse | CloudFrontRequest> => {
|
|
30
|
+
const response = event.Records[0].cf.response;
|
|
31
|
+
const request = event.Records[0].cf.request;
|
|
32
|
+
|
|
33
|
+
if (
|
|
34
|
+
response.status != "200" &&
|
|
35
|
+
!request.headers["x-request-prerender"] &&
|
|
36
|
+
request.uri != `${PATH_PREFIX}/index.html`
|
|
37
|
+
) {
|
|
38
|
+
// Fetch default page and return body
|
|
39
|
+
return instance
|
|
40
|
+
.get(`https://${FRONTEND_HOST}${PATH_PREFIX}/index.html`)
|
|
41
|
+
.then(res => {
|
|
42
|
+
response.body = res.data;
|
|
43
|
+
|
|
44
|
+
response.headers["content-type"] = [
|
|
45
|
+
{
|
|
46
|
+
key: "Content-Type",
|
|
47
|
+
value: "text/html",
|
|
48
|
+
},
|
|
49
|
+
];
|
|
50
|
+
|
|
51
|
+
// Remove content-length if set as this may be the value from the origin.
|
|
52
|
+
delete response.headers["content-length"];
|
|
53
|
+
|
|
54
|
+
return response;
|
|
55
|
+
})
|
|
56
|
+
.catch(err => {
|
|
57
|
+
return response;
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return Promise.resolve(response);
|
|
62
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "handlers",
|
|
3
|
+
"lockfileVersion": 2,
|
|
4
|
+
"requires": true,
|
|
5
|
+
"packages": {
|
|
6
|
+
"node_modules/@types/aws-lambda": {
|
|
7
|
+
"version": "8.10.77",
|
|
8
|
+
"resolved": "https://registry.npmjs.org/@types/aws-lambda/-/aws-lambda-8.10.77.tgz",
|
|
9
|
+
"integrity": "sha512-n0EMFJU/7u3KvHrR83l/zrKOVURXl5pUJPNED/Bzjah89QKCHwCiKCBoVUXRwTGRfCYGIDdinJaAlKDHZdp/Ng=="
|
|
10
|
+
},
|
|
11
|
+
"node_modules/@types/node": {
|
|
12
|
+
"version": "15.12.4",
|
|
13
|
+
"resolved": "https://registry.npmjs.org/@types/node/-/node-15.12.4.tgz",
|
|
14
|
+
"integrity": "sha512-zrNj1+yqYF4WskCMOHwN+w9iuD12+dGm0rQ35HLl9/Ouuq52cEtd0CH9qMgrdNmi5ejC1/V7vKEXYubB+65DkA=="
|
|
15
|
+
},
|
|
16
|
+
"node_modules/axios": {
|
|
17
|
+
"version": "0.21.1",
|
|
18
|
+
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz",
|
|
19
|
+
"integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==",
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"follow-redirects": "^1.10.0"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"node_modules/buffer-from": {
|
|
25
|
+
"version": "1.1.1",
|
|
26
|
+
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz",
|
|
27
|
+
"integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A=="
|
|
28
|
+
},
|
|
29
|
+
"node_modules/follow-redirects": {
|
|
30
|
+
"version": "1.14.1",
|
|
31
|
+
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.1.tgz",
|
|
32
|
+
"integrity": "sha512-HWqDgT7ZEkqRzBvc2s64vSZ/hfOceEol3ac/7tKwzuvEyWx3/4UegXh5oBOIotkGsObyk3xznnSRVADBgWSQVg==",
|
|
33
|
+
"engines": {
|
|
34
|
+
"node": ">=4.0"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"node_modules/source-map": {
|
|
38
|
+
"version": "0.6.1",
|
|
39
|
+
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
|
|
40
|
+
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
|
|
41
|
+
"engines": {
|
|
42
|
+
"node": ">=0.10.0"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"node_modules/source-map-support": {
|
|
46
|
+
"version": "0.5.19",
|
|
47
|
+
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz",
|
|
48
|
+
"integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==",
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"buffer-from": "^1.0.0",
|
|
51
|
+
"source-map": "^0.6.0"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Microsoft Corporation.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Installation
|
|
2
|
+
> `npm install --save @types/aws-lambda`
|
|
3
|
+
|
|
4
|
+
# Summary
|
|
5
|
+
This package contains type definitions for AWS Lambda (http://docs.aws.amazon.com/lambda).
|
|
6
|
+
|
|
7
|
+
# Details
|
|
8
|
+
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/aws-lambda.
|
|
9
|
+
|
|
10
|
+
### Additional Details
|
|
11
|
+
* Last updated: Fri, 04 Jun 2021 13:01:30 GMT
|
|
12
|
+
* Dependencies: none
|
|
13
|
+
* Global values: `AWSLambda`
|
|
14
|
+
|
|
15
|
+
# Credits
|
|
16
|
+
These definitions were written by [James Darbyshire](https://github.com/darbio), [Michael Skarum](https://github.com/skarum), [Stef Heyenrath](https://github.com/StefH), [Rich Buggy](https://github.com/buggy), [Yoriki Yamaguchi](https://github.com/y13i), [wwwy3y3](https://github.com/wwwy3y3), [Ishaan Malhi](https://github.com/OrthoDex), [Michael Marner](https://github.com/MichaelMarner), [Daniel Cottone](https://github.com/daniel-cottone), [Kostya Misura](https://github.com/kostya-misura), [Markus Tacker](https://github.com/coderbyheart), [Palmi Valgeirsson](https://github.com/palmithor), [Danilo Raisi](https://github.com/daniloraisi), [Simon Buchan](https://github.com/simonbuchan), [David Hayden](https://github.com/Haydabase), [Chris Redekop](https://github.com/repl-chris), [Aneil Mallavarapu](https://github.com/aneilbaboo), [Jeremy Nagel](https://github.com/jeznag), [Louis Larry](https://github.com/louislarry), [Daniel Papukchiev](https://github.com/dpapukchiev), [Oliver Hookins](https://github.com/ohookins), [Trevor Leach](https://github.com/trevor-leach), [James Gregory](https://github.com/jagregory), [Erik Dalén](https://github.com/dalen), [Loïk Gaonac'h](https://github.com/loikg), [Roberto Zen](https://github.com/skyzenr), [Grzegorz Redlicki](https://github.com/redlickigrzegorz), [Juan Carbonel](https://github.com/juancarbonel), [Peter McIntyre](https://github.com/pwmcintyre), [Alex Bolenok](https://github.com/alex-bolenok-centralreach), [Marian Zange](https://github.com/marianzange), [Alexander Pepper](https://github.com/apepper), [Alessandro Palumbo](https://github.com/apalumbo), [Sachin Shekhar](https://github.com/SachinShekhar), [Ivan Martos](https://github.com/ivanmartos), [Zach Anthony](https://github.com/zach-anthony), [Peter Savnik](https://github.com/savnik), and [Sven Milewski](https://github.com/svenmilewski).
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// Types shared between trigger/api-gateway-authorizer.d.ts and api-gateway-proxy.d.ts
|
|
2
|
+
|
|
3
|
+
// Poorly documented, but API Gateway will just fail internally if
|
|
4
|
+
// the context type does not match this.
|
|
5
|
+
// Note that although non-string types will be accepted, they will be
|
|
6
|
+
// coerced to strings on the other side.
|
|
7
|
+
export interface APIGatewayAuthorizerResultContext {
|
|
8
|
+
[name: string]: string | number | boolean | null | undefined;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// Default authorizer type, prefer using a specific type with the "...WithAuthorizer..." variant types.
|
|
12
|
+
// Note that this doesn't have to be a context from a custom lambda outhorizer, AWS also has a cognito
|
|
13
|
+
// authorizer type and could add more, so the property won't always be a string.
|
|
14
|
+
export type APIGatewayEventDefaultAuthorizerContext = undefined | null | {
|
|
15
|
+
[name: string]: any;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export type APIGatewayEventRequestContext =
|
|
19
|
+
APIGatewayEventRequestContextWithAuthorizer<APIGatewayEventDefaultAuthorizerContext>;
|
|
20
|
+
|
|
21
|
+
// The requestContext property of both request authorizer and proxy integration events.
|
|
22
|
+
export interface APIGatewayEventRequestContextWithAuthorizer<TAuthorizerContext> {
|
|
23
|
+
accountId: string;
|
|
24
|
+
apiId: string;
|
|
25
|
+
// This one is a bit confusing: it is not actually present in authorizer calls
|
|
26
|
+
// and proxy calls without an authorizer. We model this by allowing undefined in the type,
|
|
27
|
+
// since it ends up the same and avoids breaking users that are testing the property.
|
|
28
|
+
// This lets us allow parameterizing the authorizer for proxy events that know what authorizer
|
|
29
|
+
// context values they have.
|
|
30
|
+
authorizer: TAuthorizerContext;
|
|
31
|
+
connectedAt?: number;
|
|
32
|
+
connectionId?: string;
|
|
33
|
+
domainName?: string;
|
|
34
|
+
domainPrefix?: string;
|
|
35
|
+
eventType?: string;
|
|
36
|
+
extendedRequestId?: string;
|
|
37
|
+
protocol: string;
|
|
38
|
+
httpMethod: string;
|
|
39
|
+
identity: APIGatewayEventIdentity;
|
|
40
|
+
messageDirection?: string;
|
|
41
|
+
messageId?: string | null;
|
|
42
|
+
path: string;
|
|
43
|
+
stage: string;
|
|
44
|
+
requestId: string;
|
|
45
|
+
requestTime?: string;
|
|
46
|
+
requestTimeEpoch: number;
|
|
47
|
+
resourceId: string;
|
|
48
|
+
resourcePath: string;
|
|
49
|
+
routeKey?: string;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface APIGatewayEventClientCertificate {
|
|
53
|
+
clientCertPem: string;
|
|
54
|
+
serialNumber: string;
|
|
55
|
+
subjectDN: string;
|
|
56
|
+
issuerDN: string;
|
|
57
|
+
validity: {
|
|
58
|
+
notAfter: string;
|
|
59
|
+
notBefore: string;
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface APIGatewayEventIdentity {
|
|
64
|
+
accessKey: string | null;
|
|
65
|
+
accountId: string | null;
|
|
66
|
+
apiKey: string | null;
|
|
67
|
+
apiKeyId: string | null;
|
|
68
|
+
caller: string | null;
|
|
69
|
+
clientCert: APIGatewayEventClientCertificate | null;
|
|
70
|
+
cognitoAuthenticationProvider: string | null;
|
|
71
|
+
cognitoAuthenticationType: string | null;
|
|
72
|
+
cognitoIdentityId: string | null;
|
|
73
|
+
cognitoIdentityPoolId: string | null;
|
|
74
|
+
principalOrgId: string | null;
|
|
75
|
+
sourceIp: string;
|
|
76
|
+
user: string | null;
|
|
77
|
+
userAgent: string | null;
|
|
78
|
+
userArn: string | null;
|
|
79
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CloudFront events
|
|
3
|
+
* http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-event-structure.html
|
|
4
|
+
* Bear in mind that the "example" event structure in the page above includes
|
|
5
|
+
* both an S3 and a Custom origin, which is not strictly allowed. Only one
|
|
6
|
+
* of these per event may be present.
|
|
7
|
+
*/
|
|
8
|
+
export interface CloudFrontHeaders {
|
|
9
|
+
[name: string]: Array<{
|
|
10
|
+
key?: string;
|
|
11
|
+
value: string;
|
|
12
|
+
}>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type CloudFrontOrigin =
|
|
16
|
+
| { s3: CloudFrontS3Origin; custom?: never }
|
|
17
|
+
| { custom: CloudFrontCustomOrigin; s3?: never };
|
|
18
|
+
|
|
19
|
+
export interface CloudFrontCustomOrigin {
|
|
20
|
+
customHeaders: CloudFrontHeaders;
|
|
21
|
+
domainName: string;
|
|
22
|
+
keepaliveTimeout: number;
|
|
23
|
+
path: string;
|
|
24
|
+
port: number;
|
|
25
|
+
protocol: 'http' | 'https';
|
|
26
|
+
readTimeout: number;
|
|
27
|
+
sslProtocols: string[];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface CloudFrontS3Origin {
|
|
31
|
+
authMethod: 'origin-access-identity' | 'none';
|
|
32
|
+
customHeaders: CloudFrontHeaders;
|
|
33
|
+
domainName: string;
|
|
34
|
+
path: string;
|
|
35
|
+
region: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface CloudFrontResponse {
|
|
39
|
+
status: string;
|
|
40
|
+
statusDescription: string;
|
|
41
|
+
headers: CloudFrontHeaders;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface CloudFrontRequest {
|
|
45
|
+
body?: {
|
|
46
|
+
action: 'read-only' | 'replace';
|
|
47
|
+
data: string;
|
|
48
|
+
encoding: 'base64' | 'text';
|
|
49
|
+
readonly inputTruncated: boolean;
|
|
50
|
+
};
|
|
51
|
+
readonly clientIp: string;
|
|
52
|
+
readonly method: string;
|
|
53
|
+
uri: string;
|
|
54
|
+
querystring: string;
|
|
55
|
+
headers: CloudFrontHeaders;
|
|
56
|
+
origin?: CloudFrontOrigin;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface CloudFrontEvent {
|
|
60
|
+
config: {
|
|
61
|
+
readonly distributionDomainName: string;
|
|
62
|
+
readonly distributionId: string;
|
|
63
|
+
readonly eventType: 'origin-request' | 'origin-response' | 'viewer-request' | 'viewer-response';
|
|
64
|
+
readonly requestId: string;
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Generated HTTP response in viewer request event or origin request event
|
|
70
|
+
*
|
|
71
|
+
* https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-generating-http-responses-in-requests.html#lambda-generating-http-responses-object
|
|
72
|
+
*/
|
|
73
|
+
export interface CloudFrontResultResponse {
|
|
74
|
+
status: string;
|
|
75
|
+
statusDescription?: string;
|
|
76
|
+
headers?: CloudFrontHeaders;
|
|
77
|
+
bodyEncoding?: 'text' | 'base64';
|
|
78
|
+
body?: string;
|
|
79
|
+
}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The interface that AWS Lambda will invoke your handler with.
|
|
3
|
+
* There are more specialized types for many cases where AWS services
|
|
4
|
+
* invoke your lambda, but you can directly use this type for when you are invoking
|
|
5
|
+
* your lambda directly.
|
|
6
|
+
*
|
|
7
|
+
* See tme {@link http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-handler.html AWS documentation}
|
|
8
|
+
* for more information about the runtime behavior, and the
|
|
9
|
+
* {@link https://aws.amazon.com/blogs/compute/node-js-8-10-runtime-now-available-in-aws-lambda/ AWS Blog post}
|
|
10
|
+
* introducing the async handler behavior in the 8.10 runtime.
|
|
11
|
+
*
|
|
12
|
+
* @example <caption>Defining a custom handler type</caption>
|
|
13
|
+
* import { Handler } from 'aws-lambda'
|
|
14
|
+
*
|
|
15
|
+
* interface NameEvent {
|
|
16
|
+
* fullName: string
|
|
17
|
+
* }
|
|
18
|
+
* interface NameResult {
|
|
19
|
+
* firstName: string
|
|
20
|
+
* middleNames: string
|
|
21
|
+
* lastName: string
|
|
22
|
+
* }
|
|
23
|
+
* type PersonHandler = Handler<NameEvent, NameResult>
|
|
24
|
+
*
|
|
25
|
+
* export const handler: PersonHandler = async (event) => {
|
|
26
|
+
* const names = event.fullName.split(' ')
|
|
27
|
+
* const firstName = names.shift()
|
|
28
|
+
* const lastName = names.pop()
|
|
29
|
+
* return { firstName, middleNames: names, lastName }
|
|
30
|
+
* }
|
|
31
|
+
*
|
|
32
|
+
* @example <caption>Logs the contents of the event object and returns the location of the logs</caption>
|
|
33
|
+
* import { Handler } from 'aws-lambda'
|
|
34
|
+
*
|
|
35
|
+
* export const handler: Handler = async (event, context) => {
|
|
36
|
+
* console.log("EVENT: \n" + JSON.stringify(event, null, 2))
|
|
37
|
+
* return context.logStreamName
|
|
38
|
+
* }
|
|
39
|
+
*
|
|
40
|
+
* @example <caption>AWS SDK with Async Function and Promises</caption>
|
|
41
|
+
* import { Handler } from 'aws-lambda'
|
|
42
|
+
* import AWS from 'aws-sdk'
|
|
43
|
+
*
|
|
44
|
+
* const s3 = new AWS.S3()
|
|
45
|
+
*
|
|
46
|
+
* export const handler: Handler = async (event) => {
|
|
47
|
+
* const response = await s3.listBuckets().promise()
|
|
48
|
+
* return response?.Buckets.map((bucket) => bucket.Name)
|
|
49
|
+
* }
|
|
50
|
+
*
|
|
51
|
+
* @example <caption>HTTP Request with Callback</caption>
|
|
52
|
+
* import { Handler } from 'aws-lambda'
|
|
53
|
+
* import https from 'https'
|
|
54
|
+
*
|
|
55
|
+
* let url = "https://docs.aws.amazon.com/lambda/latest/dg/welcome.html"
|
|
56
|
+
*
|
|
57
|
+
* export const handler: Handler<void, number> = (event, context, callback) => {
|
|
58
|
+
* https.get(url, (res) => {
|
|
59
|
+
* callback(null, res.statusCode)
|
|
60
|
+
* }).on('error', (e) => {
|
|
61
|
+
* callback(Error(e))
|
|
62
|
+
* })
|
|
63
|
+
* }
|
|
64
|
+
*
|
|
65
|
+
* @param event
|
|
66
|
+
* Parsed JSON data in the lambda request payload. For an AWS service triggered
|
|
67
|
+
* lambda this should be in the format of a type ending in Event, for example the
|
|
68
|
+
* S3Handler receives an event of type S3Event.
|
|
69
|
+
* @param context
|
|
70
|
+
* Runtime contextual information of the current invocation, for example the caller
|
|
71
|
+
* identity, available memory and time remaining, legacy completion callbacks, and
|
|
72
|
+
* a mutable property controlling when the lambda execution completes.
|
|
73
|
+
* @param callback
|
|
74
|
+
* NodeJS-style completion callback that the AWS Lambda runtime will provide that can
|
|
75
|
+
* be used to provide the lambda result payload value, or any execution error. Can
|
|
76
|
+
* instead return a promise that resolves with the result payload value or rejects
|
|
77
|
+
* with the execution error.
|
|
78
|
+
* @return
|
|
79
|
+
* A promise that resolves with the lambda result payload value, or rejects with the
|
|
80
|
+
* execution error. Note that if you implement your handler as an async function,
|
|
81
|
+
* you will automatically return a promise that will resolve with a returned value,
|
|
82
|
+
* or reject with a thrown value.
|
|
83
|
+
*/
|
|
84
|
+
export type Handler<TEvent = any, TResult = any> = (
|
|
85
|
+
event: TEvent,
|
|
86
|
+
context: Context,
|
|
87
|
+
callback: Callback<TResult>,
|
|
88
|
+
) => void | Promise<TResult>;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* {@link Handler} context parameter.
|
|
92
|
+
* See {@link https://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-context.html AWS documentation}.
|
|
93
|
+
*/
|
|
94
|
+
export interface Context {
|
|
95
|
+
callbackWaitsForEmptyEventLoop: boolean;
|
|
96
|
+
functionName: string;
|
|
97
|
+
functionVersion: string;
|
|
98
|
+
invokedFunctionArn: string;
|
|
99
|
+
memoryLimitInMB: string;
|
|
100
|
+
awsRequestId: string;
|
|
101
|
+
logGroupName: string;
|
|
102
|
+
logStreamName: string;
|
|
103
|
+
identity?: CognitoIdentity;
|
|
104
|
+
clientContext?: ClientContext;
|
|
105
|
+
|
|
106
|
+
getRemainingTimeInMillis(): number;
|
|
107
|
+
|
|
108
|
+
// Functions for compatibility with earlier Node.js Runtime v0.10.42
|
|
109
|
+
// No longer documented, so they are deprecated, but they still work
|
|
110
|
+
// as of the 12.x runtime, so they are not removed from the types.
|
|
111
|
+
|
|
112
|
+
/** @deprecated Use handler callback or promise result */
|
|
113
|
+
done(error?: Error, result?: any): void;
|
|
114
|
+
/** @deprecated Use handler callback with first argument or reject a promise result */
|
|
115
|
+
fail(error: Error | string): void;
|
|
116
|
+
/** @deprecated Use handler callback with second argument or resolve a promise result */
|
|
117
|
+
succeed(messageOrObject: any): void;
|
|
118
|
+
// Unclear what behavior this is supposed to have, I couldn't find any still extant reference,
|
|
119
|
+
// and it behaves like the above, ignoring the object parameter.
|
|
120
|
+
/** @deprecated Use handler callback or promise result */
|
|
121
|
+
succeed(message: string, object: any): void;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export interface CognitoIdentity {
|
|
125
|
+
cognitoIdentityId: string;
|
|
126
|
+
cognitoIdentityPoolId: string;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export interface ClientContext {
|
|
130
|
+
client: ClientContextClient;
|
|
131
|
+
Custom?: any;
|
|
132
|
+
env: ClientContextEnv;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export interface ClientContextClient {
|
|
136
|
+
installationId: string;
|
|
137
|
+
appTitle: string;
|
|
138
|
+
appVersionName: string;
|
|
139
|
+
appVersionCode: string;
|
|
140
|
+
appPackageName: string;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export interface ClientContextEnv {
|
|
144
|
+
platformVersion: string;
|
|
145
|
+
platform: string;
|
|
146
|
+
make: string;
|
|
147
|
+
model: string;
|
|
148
|
+
locale: string;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* NodeJS-style callback parameter for the {@link Handler} type.
|
|
153
|
+
* Can be used instead of returning a promise, see the
|
|
154
|
+
* {@link https://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-handler.html AWS documentation}
|
|
155
|
+
* for the handler programming model.
|
|
156
|
+
*
|
|
157
|
+
* @param error
|
|
158
|
+
* Parameter to use to provide the error payload for a failed lambda execution.
|
|
159
|
+
* See {@link https://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-mode-exceptions.html AWS documentation}
|
|
160
|
+
* for error handling.
|
|
161
|
+
* If an Error instance is passed, the error payload uses the `name` property as the `errorType`,
|
|
162
|
+
* the `message` property as the `errorMessage`, and parses the `stack` property string into
|
|
163
|
+
* the `trace` array.
|
|
164
|
+
* For other values, the `errorType` is `typeof value`, the `errorMessage` is `String(value)`, and
|
|
165
|
+
* `trace` is an empty array.
|
|
166
|
+
*
|
|
167
|
+
* @param result
|
|
168
|
+
* Parameter to use to provide the result payload for a successful lambda execution.
|
|
169
|
+
* Pass `null` or `undefined` for the `error` parameter to use this parameter.
|
|
170
|
+
*/
|
|
171
|
+
export type Callback<TResult = any> = (error?: Error | string | null, result?: TResult) => void;
|