@aligent/cdk-prerender-proxy 0.2.8 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (209) hide show
  1. package/index.ts +29 -0
  2. package/lib/error-response-construct.ts +54 -0
  3. package/lib/handlers/cache-control.ts +1 -4
  4. package/lib/handlers/error-response.ts +0 -1
  5. package/lib/handlers/prerender.ts +2 -2
  6. package/lib/prerender-cf-cache-control-construct.ts +58 -0
  7. package/lib/prerender-check-construct.ts +43 -0
  8. package/lib/prerender-construct.ts +55 -0
  9. package/lib/prerender-lambda-construct.ts +48 -0
  10. package/package.json +17 -26
  11. package/index.d.ts +0 -6
  12. package/lib/error-response-construct.d.ts +0 -9
  13. package/lib/error-response-construct.js +0 -32
  14. package/lib/handlers/node_modules/.package-lock.json +0 -55
  15. package/lib/handlers/node_modules/@types/aws-lambda/LICENSE +0 -21
  16. package/lib/handlers/node_modules/@types/aws-lambda/README.md +0 -16
  17. package/lib/handlers/node_modules/@types/aws-lambda/common/api-gateway.d.ts +0 -79
  18. package/lib/handlers/node_modules/@types/aws-lambda/common/cloudfront.d.ts +0 -79
  19. package/lib/handlers/node_modules/@types/aws-lambda/handler.d.ts +0 -171
  20. package/lib/handlers/node_modules/@types/aws-lambda/index.d.ts +0 -85
  21. package/lib/handlers/node_modules/@types/aws-lambda/package.json +0 -210
  22. package/lib/handlers/node_modules/@types/aws-lambda/trigger/alb.d.ts +0 -48
  23. package/lib/handlers/node_modules/@types/aws-lambda/trigger/api-gateway-authorizer.d.ts +0 -174
  24. package/lib/handlers/node_modules/@types/aws-lambda/trigger/api-gateway-proxy.d.ts +0 -187
  25. package/lib/handlers/node_modules/@types/aws-lambda/trigger/appsync-resolver.d.ts +0 -51
  26. package/lib/handlers/node_modules/@types/aws-lambda/trigger/cloudformation-custom-resource.d.ts +0 -68
  27. package/lib/handlers/node_modules/@types/aws-lambda/trigger/cloudfront-request.d.ts +0 -20
  28. package/lib/handlers/node_modules/@types/aws-lambda/trigger/cloudfront-response.d.ts +0 -21
  29. package/lib/handlers/node_modules/@types/aws-lambda/trigger/cloudwatch-events.d.ts +0 -8
  30. package/lib/handlers/node_modules/@types/aws-lambda/trigger/cloudwatch-logs.d.ts +0 -37
  31. package/lib/handlers/node_modules/@types/aws-lambda/trigger/codebuild-cloudwatch-state.d.ts +0 -104
  32. package/lib/handlers/node_modules/@types/aws-lambda/trigger/codepipeline-cloudwatch-action.d.ts +0 -31
  33. package/lib/handlers/node_modules/@types/aws-lambda/trigger/codepipeline-cloudwatch-pipeline.d.ts +0 -32
  34. package/lib/handlers/node_modules/@types/aws-lambda/trigger/codepipeline-cloudwatch-stage.d.ts +0 -23
  35. package/lib/handlers/node_modules/@types/aws-lambda/trigger/codepipeline-cloudwatch.d.ts +0 -11
  36. package/lib/handlers/node_modules/@types/aws-lambda/trigger/codepipeline.d.ts +0 -55
  37. package/lib/handlers/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/_common.d.ts +0 -41
  38. package/lib/handlers/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/create-auth-challenge.d.ts +0 -22
  39. package/lib/handlers/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/custom-email-sender.d.ts +0 -86
  40. package/lib/handlers/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/custom-message.d.ts +0 -44
  41. package/lib/handlers/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/define-auth-challenge.d.ts +0 -21
  42. package/lib/handlers/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/index.d.ts +0 -119
  43. package/lib/handlers/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/post-authentication.d.ts +0 -15
  44. package/lib/handlers/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/post-confirmation.d.ts +0 -22
  45. package/lib/handlers/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/pre-authentication.d.ts +0 -15
  46. package/lib/handlers/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/pre-signup.d.ts +0 -31
  47. package/lib/handlers/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/pre-token-generation.d.ts +0 -45
  48. package/lib/handlers/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/user-migration.d.ts +0 -39
  49. package/lib/handlers/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/verify-auth-challenge-response.d.ts +0 -20
  50. package/lib/handlers/node_modules/@types/aws-lambda/trigger/connect-contact-flow.d.ts +0 -65
  51. package/lib/handlers/node_modules/@types/aws-lambda/trigger/dynamodb-stream.d.ts +0 -45
  52. package/lib/handlers/node_modules/@types/aws-lambda/trigger/eventbridge.d.ts +0 -18
  53. package/lib/handlers/node_modules/@types/aws-lambda/trigger/iot.d.ts +0 -28
  54. package/lib/handlers/node_modules/@types/aws-lambda/trigger/kinesis-firehose-transformation.d.ts +0 -45
  55. package/lib/handlers/node_modules/@types/aws-lambda/trigger/kinesis-stream.d.ts +0 -28
  56. package/lib/handlers/node_modules/@types/aws-lambda/trigger/lex.d.ts +0 -116
  57. package/lib/handlers/node_modules/@types/aws-lambda/trigger/msk.d.ts +0 -21
  58. package/lib/handlers/node_modules/@types/aws-lambda/trigger/s3-batch.d.ts +0 -41
  59. package/lib/handlers/node_modules/@types/aws-lambda/trigger/s3.d.ts +0 -60
  60. package/lib/handlers/node_modules/@types/aws-lambda/trigger/ses.d.ts +0 -103
  61. package/lib/handlers/node_modules/@types/aws-lambda/trigger/sns.d.ts +0 -38
  62. package/lib/handlers/node_modules/@types/aws-lambda/trigger/sqs.d.ts +0 -46
  63. package/lib/handlers/node_modules/@types/node/LICENSE +0 -21
  64. package/lib/handlers/node_modules/@types/node/README.md +0 -16
  65. package/lib/handlers/node_modules/@types/node/assert/strict.d.ts +0 -4
  66. package/lib/handlers/node_modules/@types/node/assert.d.ts +0 -124
  67. package/lib/handlers/node_modules/@types/node/async_hooks.d.ts +0 -226
  68. package/lib/handlers/node_modules/@types/node/base.d.ts +0 -19
  69. package/lib/handlers/node_modules/@types/node/buffer.d.ts +0 -84
  70. package/lib/handlers/node_modules/@types/node/child_process.d.ts +0 -526
  71. package/lib/handlers/node_modules/@types/node/cluster.d.ts +0 -262
  72. package/lib/handlers/node_modules/@types/node/console.d.ts +0 -133
  73. package/lib/handlers/node_modules/@types/node/constants.d.ts +0 -13
  74. package/lib/handlers/node_modules/@types/node/crypto.d.ts +0 -1580
  75. package/lib/handlers/node_modules/@types/node/dgram.d.ts +0 -141
  76. package/lib/handlers/node_modules/@types/node/diagnostic_channel.d.ts +0 -34
  77. package/lib/handlers/node_modules/@types/node/dns/promises.d.ts +0 -97
  78. package/lib/handlers/node_modules/@types/node/dns.d.ts +0 -322
  79. package/lib/handlers/node_modules/@types/node/domain.d.ts +0 -24
  80. package/lib/handlers/node_modules/@types/node/events.d.ts +0 -93
  81. package/lib/handlers/node_modules/@types/node/fs/promises.d.ts +0 -592
  82. package/lib/handlers/node_modules/@types/node/fs.d.ts +0 -2239
  83. package/lib/handlers/node_modules/@types/node/globals.d.ts +0 -655
  84. package/lib/handlers/node_modules/@types/node/globals.global.d.ts +0 -1
  85. package/lib/handlers/node_modules/@types/node/http.d.ts +0 -434
  86. package/lib/handlers/node_modules/@types/node/http2.d.ts +0 -976
  87. package/lib/handlers/node_modules/@types/node/https.d.ts +0 -36
  88. package/lib/handlers/node_modules/@types/node/index.d.ts +0 -58
  89. package/lib/handlers/node_modules/@types/node/inspector.d.ts +0 -3041
  90. package/lib/handlers/node_modules/@types/node/module.d.ts +0 -52
  91. package/lib/handlers/node_modules/@types/node/net.d.ts +0 -326
  92. package/lib/handlers/node_modules/@types/node/os.d.ts +0 -239
  93. package/lib/handlers/node_modules/@types/node/package.json +0 -232
  94. package/lib/handlers/node_modules/@types/node/path.d.ts +0 -163
  95. package/lib/handlers/node_modules/@types/node/perf_hooks.d.ts +0 -310
  96. package/lib/handlers/node_modules/@types/node/process.d.ts +0 -461
  97. package/lib/handlers/node_modules/@types/node/punycode.d.ts +0 -75
  98. package/lib/handlers/node_modules/@types/node/querystring.d.ts +0 -28
  99. package/lib/handlers/node_modules/@types/node/readline.d.ts +0 -192
  100. package/lib/handlers/node_modules/@types/node/repl.d.ts +0 -395
  101. package/lib/handlers/node_modules/@types/node/stream/promises.d.ts +0 -67
  102. package/lib/handlers/node_modules/@types/node/stream.d.ts +0 -471
  103. package/lib/handlers/node_modules/@types/node/string_decoder.d.ts +0 -7
  104. package/lib/handlers/node_modules/@types/node/timers/promises.d.ts +0 -21
  105. package/lib/handlers/node_modules/@types/node/timers.d.ts +0 -27
  106. package/lib/handlers/node_modules/@types/node/tls.d.ts +0 -793
  107. package/lib/handlers/node_modules/@types/node/trace_events.d.ts +0 -61
  108. package/lib/handlers/node_modules/@types/node/ts3.6/assert.d.ts +0 -98
  109. package/lib/handlers/node_modules/@types/node/ts3.6/base.d.ts +0 -68
  110. package/lib/handlers/node_modules/@types/node/ts3.6/index.d.ts +0 -7
  111. package/lib/handlers/node_modules/@types/node/tty.d.ts +0 -66
  112. package/lib/handlers/node_modules/@types/node/url.d.ts +0 -116
  113. package/lib/handlers/node_modules/@types/node/util/types.d.ts +0 -53
  114. package/lib/handlers/node_modules/@types/node/util.d.ts +0 -156
  115. package/lib/handlers/node_modules/@types/node/v8.d.ts +0 -198
  116. package/lib/handlers/node_modules/@types/node/vm.d.ts +0 -152
  117. package/lib/handlers/node_modules/@types/node/wasi.d.ts +0 -86
  118. package/lib/handlers/node_modules/@types/node/worker_threads.d.ts +0 -282
  119. package/lib/handlers/node_modules/@types/node/zlib.d.ts +0 -361
  120. package/lib/handlers/node_modules/axios/CHANGELOG.md +0 -685
  121. package/lib/handlers/node_modules/axios/LICENSE +0 -19
  122. package/lib/handlers/node_modules/axios/README.md +0 -800
  123. package/lib/handlers/node_modules/axios/UPGRADE_GUIDE.md +0 -162
  124. package/lib/handlers/node_modules/axios/dist/axios.js +0 -1756
  125. package/lib/handlers/node_modules/axios/dist/axios.map +0 -1
  126. package/lib/handlers/node_modules/axios/dist/axios.min.js +0 -3
  127. package/lib/handlers/node_modules/axios/dist/axios.min.map +0 -1
  128. package/lib/handlers/node_modules/axios/index.d.ts +0 -161
  129. package/lib/handlers/node_modules/axios/index.js +0 -1
  130. package/lib/handlers/node_modules/axios/lib/adapters/README.md +0 -37
  131. package/lib/handlers/node_modules/axios/lib/adapters/http.js +0 -303
  132. package/lib/handlers/node_modules/axios/lib/adapters/xhr.js +0 -179
  133. package/lib/handlers/node_modules/axios/lib/axios.js +0 -56
  134. package/lib/handlers/node_modules/axios/lib/cancel/Cancel.js +0 -19
  135. package/lib/handlers/node_modules/axios/lib/cancel/CancelToken.js +0 -57
  136. package/lib/handlers/node_modules/axios/lib/cancel/isCancel.js +0 -5
  137. package/lib/handlers/node_modules/axios/lib/core/Axios.js +0 -95
  138. package/lib/handlers/node_modules/axios/lib/core/InterceptorManager.js +0 -52
  139. package/lib/handlers/node_modules/axios/lib/core/README.md +0 -7
  140. package/lib/handlers/node_modules/axios/lib/core/buildFullPath.js +0 -20
  141. package/lib/handlers/node_modules/axios/lib/core/createError.js +0 -18
  142. package/lib/handlers/node_modules/axios/lib/core/dispatchRequest.js +0 -79
  143. package/lib/handlers/node_modules/axios/lib/core/enhanceError.js +0 -42
  144. package/lib/handlers/node_modules/axios/lib/core/mergeConfig.js +0 -87
  145. package/lib/handlers/node_modules/axios/lib/core/settle.js +0 -25
  146. package/lib/handlers/node_modules/axios/lib/core/transformData.js +0 -20
  147. package/lib/handlers/node_modules/axios/lib/defaults.js +0 -98
  148. package/lib/handlers/node_modules/axios/lib/helpers/README.md +0 -7
  149. package/lib/handlers/node_modules/axios/lib/helpers/bind.js +0 -11
  150. package/lib/handlers/node_modules/axios/lib/helpers/buildURL.js +0 -70
  151. package/lib/handlers/node_modules/axios/lib/helpers/combineURLs.js +0 -14
  152. package/lib/handlers/node_modules/axios/lib/helpers/cookies.js +0 -53
  153. package/lib/handlers/node_modules/axios/lib/helpers/deprecatedMethod.js +0 -24
  154. package/lib/handlers/node_modules/axios/lib/helpers/isAbsoluteURL.js +0 -14
  155. package/lib/handlers/node_modules/axios/lib/helpers/isAxiosError.js +0 -11
  156. package/lib/handlers/node_modules/axios/lib/helpers/isURLSameOrigin.js +0 -68
  157. package/lib/handlers/node_modules/axios/lib/helpers/normalizeHeaderName.js +0 -12
  158. package/lib/handlers/node_modules/axios/lib/helpers/parseHeaders.js +0 -53
  159. package/lib/handlers/node_modules/axios/lib/helpers/spread.js +0 -27
  160. package/lib/handlers/node_modules/axios/lib/utils.js +0 -351
  161. package/lib/handlers/node_modules/axios/package.json +0 -86
  162. package/lib/handlers/node_modules/buffer-from/LICENSE +0 -21
  163. package/lib/handlers/node_modules/buffer-from/index.js +0 -69
  164. package/lib/handlers/node_modules/buffer-from/package.json +0 -19
  165. package/lib/handlers/node_modules/buffer-from/readme.md +0 -69
  166. package/lib/handlers/node_modules/follow-redirects/LICENSE +0 -18
  167. package/lib/handlers/node_modules/follow-redirects/README.md +0 -148
  168. package/lib/handlers/node_modules/follow-redirects/debug.js +0 -14
  169. package/lib/handlers/node_modules/follow-redirects/http.js +0 -1
  170. package/lib/handlers/node_modules/follow-redirects/https.js +0 -1
  171. package/lib/handlers/node_modules/follow-redirects/index.js +0 -531
  172. package/lib/handlers/node_modules/follow-redirects/package.json +0 -59
  173. package/lib/handlers/node_modules/source-map/CHANGELOG.md +0 -301
  174. package/lib/handlers/node_modules/source-map/LICENSE +0 -28
  175. package/lib/handlers/node_modules/source-map/README.md +0 -742
  176. package/lib/handlers/node_modules/source-map/dist/source-map.debug.js +0 -3234
  177. package/lib/handlers/node_modules/source-map/dist/source-map.js +0 -3233
  178. package/lib/handlers/node_modules/source-map/dist/source-map.min.js +0 -2
  179. package/lib/handlers/node_modules/source-map/dist/source-map.min.js.map +0 -1
  180. package/lib/handlers/node_modules/source-map/lib/array-set.js +0 -121
  181. package/lib/handlers/node_modules/source-map/lib/base64-vlq.js +0 -140
  182. package/lib/handlers/node_modules/source-map/lib/base64.js +0 -67
  183. package/lib/handlers/node_modules/source-map/lib/binary-search.js +0 -111
  184. package/lib/handlers/node_modules/source-map/lib/mapping-list.js +0 -79
  185. package/lib/handlers/node_modules/source-map/lib/quick-sort.js +0 -114
  186. package/lib/handlers/node_modules/source-map/lib/source-map-consumer.js +0 -1145
  187. package/lib/handlers/node_modules/source-map/lib/source-map-generator.js +0 -425
  188. package/lib/handlers/node_modules/source-map/lib/source-node.js +0 -413
  189. package/lib/handlers/node_modules/source-map/lib/util.js +0 -488
  190. package/lib/handlers/node_modules/source-map/package.json +0 -73
  191. package/lib/handlers/node_modules/source-map/source-map.d.ts +0 -98
  192. package/lib/handlers/node_modules/source-map/source-map.js +0 -8
  193. package/lib/handlers/node_modules/source-map-support/LICENSE.md +0 -21
  194. package/lib/handlers/node_modules/source-map-support/README.md +0 -284
  195. package/lib/handlers/node_modules/source-map-support/browser-source-map-support.js +0 -114
  196. package/lib/handlers/node_modules/source-map-support/package.json +0 -31
  197. package/lib/handlers/node_modules/source-map-support/register.js +0 -1
  198. package/lib/handlers/node_modules/source-map-support/source-map-support.js +0 -604
  199. package/lib/handlers/package-lock.json +0 -108
  200. package/lib/handlers/package.json +0 -13
  201. package/lib/handlers/tsconfig.json +0 -22
  202. package/lib/prerender-cf-cache-control-construct.d.ts +0 -10
  203. package/lib/prerender-cf-cache-control-construct.js +0 -33
  204. package/lib/prerender-check-construct.d.ts +0 -6
  205. package/lib/prerender-check-construct.js +0 -25
  206. package/lib/prerender-construct.d.ts +0 -11
  207. package/lib/prerender-construct.js +0 -34
  208. package/lib/prerender-lambda-construct.d.ts +0 -17
  209. package/lib/prerender-lambda-construct.js +0 -19
package/index.ts ADDED
@@ -0,0 +1,29 @@
1
+ import {
2
+ PrerenderLambda,
3
+ PrerenderLambdaProps,
4
+ } from "./lib/prerender-lambda-construct";
5
+ import {
6
+ PrerenderFunction,
7
+ PrerenderFunctionOptions,
8
+ } from "./lib/prerender-construct";
9
+ import { PrerenderCheckFunction } from "./lib/prerender-check-construct";
10
+ import {
11
+ ErrorResponseFunction,
12
+ ErrorResponseFunctionOptions,
13
+ } from "./lib/error-response-construct";
14
+ import {
15
+ CloudFrontCacheControl,
16
+ CloudFrontCacheControlOptions,
17
+ } from "./lib/prerender-cf-cache-control-construct";
18
+
19
+ export {
20
+ PrerenderLambda,
21
+ PrerenderFunction,
22
+ PrerenderCheckFunction,
23
+ ErrorResponseFunction,
24
+ CloudFrontCacheControl,
25
+ CloudFrontCacheControlOptions,
26
+ ErrorResponseFunctionOptions,
27
+ PrerenderFunctionOptions,
28
+ PrerenderLambdaProps,
29
+ };
@@ -0,0 +1,54 @@
1
+ import { AssetHashType, DockerImage } from "aws-cdk-lib";
2
+ import { EdgeFunction } from "aws-cdk-lib/aws-cloudfront/lib/experimental";
3
+ import { Code, IVersion, Runtime, Version } from "aws-cdk-lib/aws-lambda";
4
+ import { Construct } from "constructs";
5
+ import { join } from "path";
6
+ import { Esbuild } from "@aligent/esbuild";
7
+
8
+ export interface ErrorResponseFunctionOptions {
9
+ pathPrefix?: string;
10
+ }
11
+
12
+ export class ErrorResponseFunction extends Construct {
13
+ readonly edgeFunction: EdgeFunction;
14
+
15
+ constructor(
16
+ scope: Construct,
17
+ id: string,
18
+ options: ErrorResponseFunctionOptions
19
+ ) {
20
+ super(scope, id);
21
+
22
+ const command = [
23
+ "sh",
24
+ "-c",
25
+ 'echo "Docker build not supported. Please install esbuild."',
26
+ ];
27
+
28
+ this.edgeFunction = new EdgeFunction(this, `${id}-error-response-fn`, {
29
+ code: Code.fromAsset(join(__dirname, "handlers"), {
30
+ assetHashType: AssetHashType.OUTPUT,
31
+ bundling: {
32
+ command,
33
+ image: DockerImage.fromRegistry("busybox"),
34
+ local: new Esbuild({
35
+ entryPoints: [join(__dirname, "handlers/error-response.ts")],
36
+ define: {
37
+ "process.env.PATH_PREFIX": options.pathPrefix ?? "",
38
+ },
39
+ }),
40
+ },
41
+ }),
42
+ runtime: Runtime.NODEJS_18_X,
43
+ handler: "error-response.handler",
44
+ });
45
+ }
46
+
47
+ public getFunctionVersion(): IVersion {
48
+ return Version.fromVersionArn(
49
+ this,
50
+ "error-response-fn-version",
51
+ this.edgeFunction.currentVersion.edgeArn
52
+ );
53
+ }
54
+ }
@@ -1,9 +1,6 @@
1
1
  import "source-map-support/register";
2
2
  import { CloudFrontResponseEvent, CloudFrontResponse } from "aws-lambda";
3
- /*
4
- Prerender cache control function
5
- Consider associate this function as *origin response* function
6
- */
3
+
7
4
  export const handler = async (
8
5
  event: CloudFrontResponseEvent
9
6
  ): Promise<CloudFrontResponse> => {
@@ -5,7 +5,6 @@ import {
5
5
  CloudFrontResponse,
6
6
  } from "aws-lambda";
7
7
  import axios from "axios";
8
- import { URL } from "url";
9
8
  import * as https from "https";
10
9
 
11
10
  const FRONTEND_HOST = process.env.FRONTEND_HOST;
@@ -1,9 +1,9 @@
1
- import "source-map-support/register";
2
1
  import {
3
2
  CloudFrontRequest,
4
3
  CloudFrontRequestEvent,
5
4
  CloudFrontResponse,
6
- } from "@aws-cdk/aws-lambda";
5
+ } from "aws-lambda";
6
+ import "source-map-support/register";
7
7
 
8
8
  const PRERENDER_TOKEN = process.env.PRERENDER_TOKEN;
9
9
  const PATH_PREFIX = process.env.PATH_PREFIX;
@@ -0,0 +1,58 @@
1
+ import { AssetHashType, DockerImage } from "aws-cdk-lib";
2
+ import { EdgeFunction } from "aws-cdk-lib/aws-cloudfront/lib/experimental";
3
+ import { Code, IVersion, Runtime, Version } from "aws-cdk-lib/aws-lambda";
4
+ import { Construct } from "constructs";
5
+ import { join } from "path";
6
+ import { Esbuild } from "@aligent/esbuild";
7
+
8
+ export interface CloudFrontCacheControlOptions {
9
+ cacheKey?: string;
10
+ maxAge?: number;
11
+ }
12
+
13
+ export class CloudFrontCacheControl extends Construct {
14
+ readonly edgeFunction: EdgeFunction;
15
+
16
+ constructor(
17
+ scope: Construct,
18
+ id: string,
19
+ options?: CloudFrontCacheControlOptions
20
+ ) {
21
+ super(scope, id);
22
+
23
+ const command = [
24
+ "sh",
25
+ "-c",
26
+ 'echo "Docker build not supported. Please install esbuild."',
27
+ ];
28
+
29
+ this.edgeFunction = new EdgeFunction(this, `${id}-cache-control-fn`, {
30
+ code: Code.fromAsset(join(__dirname, "handlers"), {
31
+ assetHashType: AssetHashType.OUTPUT,
32
+ bundling: {
33
+ command,
34
+ image: DockerImage.fromRegistry("busybox"),
35
+ local: new Esbuild({
36
+ entryPoints: [join(__dirname, "handlers/cache-control.ts")],
37
+ define: {
38
+ "process.env.PRERENDER_CACHE_KEY":
39
+ options?.cacheKey ?? "x-prerender-requestid",
40
+ "process.env.PRERENDER_CACHE_MAX_AGE":
41
+ String(options?.maxAge) ?? "0",
42
+ },
43
+ }),
44
+ },
45
+ }),
46
+ runtime: Runtime.NODEJS_18_X,
47
+ handler: "cache-control.handler",
48
+ });
49
+ }
50
+
51
+ public getFunctionVersion(): IVersion {
52
+ return Version.fromVersionArn(
53
+ this,
54
+ "cache-control-fn-version",
55
+ this.edgeFunction.currentVersion.edgeArn
56
+ );
57
+ }
58
+ }
@@ -0,0 +1,43 @@
1
+ import { AssetHashType, DockerImage } from "aws-cdk-lib";
2
+ import { EdgeFunction } from "aws-cdk-lib/aws-cloudfront/lib/experimental";
3
+ import { Code, IVersion, Runtime, Version } from "aws-cdk-lib/aws-lambda";
4
+ import { Construct } from "constructs";
5
+ import { join } from "path";
6
+ import { Esbuild } from "@aligent/esbuild";
7
+
8
+ export class PrerenderCheckFunction extends Construct {
9
+ readonly edgeFunction: EdgeFunction;
10
+
11
+ constructor(scope: Construct, id: string) {
12
+ super(scope, id);
13
+
14
+ const command = [
15
+ "sh",
16
+ "-c",
17
+ 'echo "Docker build not supported. Please install esbuild."',
18
+ ];
19
+
20
+ this.edgeFunction = new EdgeFunction(this, `${id}-prerender-check-fn`, {
21
+ code: Code.fromAsset(join(__dirname, "handlers"), {
22
+ assetHashType: AssetHashType.OUTPUT,
23
+ bundling: {
24
+ command,
25
+ image: DockerImage.fromRegistry("busybox"),
26
+ local: new Esbuild({
27
+ entryPoints: [join(__dirname, "handlers/prerender-check.ts")],
28
+ }),
29
+ },
30
+ }),
31
+ runtime: Runtime.NODEJS_18_X,
32
+ handler: "prerender-check.handler",
33
+ });
34
+ }
35
+
36
+ public getFunctionVersion(): IVersion {
37
+ return Version.fromVersionArn(
38
+ this,
39
+ "prerender-check-fn-version",
40
+ this.edgeFunction.currentVersion.edgeArn
41
+ );
42
+ }
43
+ }
@@ -0,0 +1,55 @@
1
+ import { AssetHashType, DockerImage } from "aws-cdk-lib";
2
+ import { EdgeFunction } from "aws-cdk-lib/aws-cloudfront/lib/experimental";
3
+ import { Code, IVersion, Runtime, Version } from "aws-cdk-lib/aws-lambda";
4
+ import { Construct } from "constructs";
5
+ import { join } from "path";
6
+ import { Esbuild } from "@aligent/esbuild";
7
+
8
+ export interface PrerenderFunctionOptions {
9
+ prerenderToken: string;
10
+ prerenderUrl?: string;
11
+ pathPrefix?: string;
12
+ }
13
+
14
+ export class PrerenderFunction extends Construct {
15
+ readonly edgeFunction: EdgeFunction;
16
+
17
+ constructor(scope: Construct, id: string, options: PrerenderFunctionOptions) {
18
+ super(scope, id);
19
+
20
+ const command = [
21
+ "sh",
22
+ "-c",
23
+ 'echo "Docker build not supported. Please install esbuild."',
24
+ ];
25
+
26
+ this.edgeFunction = new EdgeFunction(this, `${id}-prerender-fn`, {
27
+ code: Code.fromAsset(join(__dirname, "handlers"), {
28
+ assetHashType: AssetHashType.OUTPUT,
29
+ bundling: {
30
+ command,
31
+ image: DockerImage.fromRegistry("busybox"),
32
+ local: new Esbuild({
33
+ entryPoints: [join(__dirname, "handlers/prerender.ts")],
34
+ define: {
35
+ "process.env.PRERENDER_TOKEN": options.prerenderToken,
36
+ "process.env.PATH_PREFIX": options.pathPrefix ?? "",
37
+ "process.env.PRERENDER_URL":
38
+ options.prerenderUrl ?? "service.prerender.io",
39
+ },
40
+ }),
41
+ },
42
+ }),
43
+ runtime: Runtime.NODEJS_18_X,
44
+ handler: "prerender.handler",
45
+ });
46
+ }
47
+
48
+ public getFunctionVersion(): IVersion {
49
+ return Version.fromVersionArn(
50
+ this,
51
+ "prerender-fn-version",
52
+ this.edgeFunction.currentVersion.edgeArn
53
+ );
54
+ }
55
+ }
@@ -0,0 +1,48 @@
1
+ import { Construct } from "constructs";
2
+ import {
3
+ CloudFrontCacheControl,
4
+ CloudFrontCacheControlOptions,
5
+ } from "./prerender-cf-cache-control-construct";
6
+ import { PrerenderCheckFunction } from "./prerender-check-construct";
7
+ import { PrerenderFunction } from "./prerender-construct";
8
+ import { ErrorResponseFunction } from "./error-response-construct";
9
+
10
+ export interface PrerenderLambdaProps {
11
+ prerenderToken: string;
12
+ exclusionExpression?: string;
13
+ cacheControlProps?: CloudFrontCacheControlOptions;
14
+ }
15
+
16
+ export class PrerenderLambda extends Construct {
17
+ readonly prerenderCheckFunction: PrerenderCheckFunction;
18
+ readonly prerenderFunction: PrerenderFunction;
19
+ readonly errorResponseFunction: ErrorResponseFunction;
20
+ readonly cacheControlFunction: CloudFrontCacheControl;
21
+
22
+ constructor(scope: Construct, id: string, props: PrerenderLambdaProps) {
23
+ super(scope, id);
24
+
25
+ this.prerenderCheckFunction = new PrerenderCheckFunction(
26
+ this,
27
+ "PrerenderViewerRequest"
28
+ );
29
+
30
+ this.prerenderFunction = new PrerenderFunction(
31
+ this,
32
+ "PrerenderOriginRequest",
33
+ props
34
+ );
35
+
36
+ this.errorResponseFunction = new ErrorResponseFunction(
37
+ this,
38
+ "ErrorResponse",
39
+ {}
40
+ );
41
+
42
+ this.cacheControlFunction = new CloudFrontCacheControl(
43
+ this,
44
+ "PrerenderCloudFrontCacheControl",
45
+ props.cacheControlProps
46
+ );
47
+ }
48
+ }
package/package.json CHANGED
@@ -1,11 +1,10 @@
1
1
  {
2
2
  "name": "@aligent/cdk-prerender-proxy",
3
- "version": "0.2.8",
4
- "description": "A Cloudfront Lambda@Edge stack for integrating with prerender.io",
3
+ "version": "2.0.1",
4
+ "description": "Cloudfront Lambda@Edge constructs for integrating with prerender.io",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
- "build": "tsc && cd ./lib/handlers && npm ci",
8
- "prepublish": "tsc && cd ./lib/handlers && npm ci"
7
+ "build": "tsc"
9
8
  },
10
9
  "repository": {
11
10
  "type": "git",
@@ -17,29 +16,21 @@
17
16
  },
18
17
  "homepage": "https://github.com/aligent/aws-cdk-prerender-proxy-stack#readme",
19
18
  "devDependencies": {
20
- "@aws-cdk/assert": "1.180.0",
21
- "@types/jest": "^26.0.21",
22
- "@types/node": "^10.17.60",
23
- "jest": "^26.4.2",
24
- "ts-jest": "^26.5.4",
25
- "ts-node": "^10.0.0",
26
- "typescript": "^4.3.5"
19
+ "@types/jest": "^29.5.5",
20
+ "@types/node": "20.6.3",
21
+ "@types/aws-lambda": "^8.10.122",
22
+ "aws-cdk": "2.97.0",
23
+ "jest": "^29.7.0",
24
+ "ts-jest": "^29.1.1",
25
+ "ts-node": "^10.9.1",
26
+ "typescript": "~5.2.2",
27
+ "@aligent/esbuild": "^2.0"
27
28
  },
28
29
  "dependencies": {
29
- "@aws-cdk/aws-cloudfront": "1.180.0",
30
- "@aws-cdk/aws-lambda": "1.180.0",
31
- "@aws-cdk/aws-lambda-nodejs": "1.180.0",
32
- "@aws-cdk/core": "1.180.0",
33
- "aws-cdk": "1.180.0",
34
- "esbuild": "0.12.15",
35
- "source-map-support": "^0.5.16"
36
- },
37
- "peerDependencies": {
38
- "@aws-cdk/aws-cloudfront": "1.180.0",
39
- "@aws-cdk/aws-lambda": "1.180.0",
40
- "@aws-cdk/aws-lambda-nodejs": "1.180.0",
41
- "@aws-cdk/core": "1.180.0",
42
- "aws-cdk": "1.180.0",
43
- "esbuild": "0.12.15"
30
+ "aws-cdk-lib": "2.97.0",
31
+ "axios": "^1.5.1",
32
+ "constructs": "^10.0.0",
33
+ "esbuild": "^0.17.0",
34
+ "source-map-support": "^0.5.21"
44
35
  }
45
36
  }
package/index.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import { PrerenderLambda, PrerenderLambdaProps } from "./lib/prerender-lambda-construct";
2
- import { PrerenderFunction, PrerenderFunctionOptions } from "./lib/prerender-construct";
3
- import { PrerenderCheckFunction } from "./lib/prerender-check-construct";
4
- import { ErrorResponseFunction, ErrorResponseFunctionOptions } from "./lib/error-response-construct";
5
- import { CloudFrontCacheControl, CloudFrontCacheControlOptions } from "./lib/prerender-cf-cache-control-construct";
6
- export { PrerenderLambda, PrerenderFunction, PrerenderCheckFunction, ErrorResponseFunction, CloudFrontCacheControl, CloudFrontCacheControlOptions, ErrorResponseFunctionOptions, PrerenderFunctionOptions, PrerenderLambdaProps, };
@@ -1,9 +0,0 @@
1
- import { Construct } from "@aws-cdk/core";
2
- import { EdgeFunction } from "@aws-cdk/aws-cloudfront/lib/experimental";
3
- export interface ErrorResponseFunctionOptions {
4
- pathPrefix?: string;
5
- }
6
- export declare class ErrorResponseFunction extends Construct {
7
- readonly edgeFunction: EdgeFunction;
8
- constructor(scope: Construct, id: string, options: ErrorResponseFunctionOptions);
9
- }
@@ -1,32 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ErrorResponseFunction = void 0;
4
- const core_1 = require("@aws-cdk/core");
5
- const bundling_1 = require("@aws-cdk/aws-lambda-nodejs/lib/bundling");
6
- const aws_lambda_1 = require("@aws-cdk/aws-lambda");
7
- const aws_cloudfront_1 = require("@aws-cdk/aws-cloudfront");
8
- class ErrorResponseFunction extends core_1.Construct {
9
- constructor(scope, id, options) {
10
- var _a;
11
- super(scope, id);
12
- this.edgeFunction = new aws_cloudfront_1.experimental.EdgeFunction(this, "ErrorResponseFunction", {
13
- code: bundling_1.Bundling.bundle({
14
- entry: `${__dirname}/handlers/error-response.ts`,
15
- runtime: aws_lambda_1.Runtime.NODEJS_14_X,
16
- sourceMap: true,
17
- projectRoot: `${__dirname}/handlers/`,
18
- depsLockFilePath: `${__dirname}/handlers/package-lock.json`,
19
- // Define options replace values at build time so we can use environment variables to test locally
20
- // and replace during build/deploy with static values. This gets around the lambda@edge limitation
21
- // of no environment variables at runtime.
22
- define: {
23
- "process.env.PATH_PREFIX": JSON.stringify((_a = options.pathPrefix) !== null && _a !== void 0 ? _a : ""),
24
- },
25
- }),
26
- runtime: aws_lambda_1.Runtime.NODEJS_14_X,
27
- handler: "index.handler",
28
- });
29
- }
30
- }
31
- exports.ErrorResponseFunction = ErrorResponseFunction;
32
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXJyb3ItcmVzcG9uc2UtY29uc3RydWN0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiZXJyb3ItcmVzcG9uc2UtY29uc3RydWN0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLHdDQUEwQztBQUMxQyxzRUFBbUU7QUFDbkUsb0RBQThDO0FBQzlDLDREQUF1RDtBQU92RCxNQUFhLHFCQUFzQixTQUFRLGdCQUFTO0lBR2xELFlBQ0UsS0FBZ0IsRUFDaEIsRUFBVSxFQUNWLE9BQXFDOztRQUVyQyxLQUFLLENBQUMsS0FBSyxFQUFFLEVBQUUsQ0FBQyxDQUFDO1FBRWpCLElBQUksQ0FBQyxZQUFZLEdBQUcsSUFBSSw2QkFBWSxDQUFDLFlBQVksQ0FDL0MsSUFBSSxFQUNKLHVCQUF1QixFQUN2QjtZQUNFLElBQUksRUFBRSxtQkFBUSxDQUFDLE1BQU0sQ0FBQztnQkFDcEIsS0FBSyxFQUFFLEdBQUcsU0FBUyw2QkFBNkI7Z0JBQ2hELE9BQU8sRUFBRSxvQkFBTyxDQUFDLFdBQVc7Z0JBQzVCLFNBQVMsRUFBRSxJQUFJO2dCQUNmLFdBQVcsRUFBRSxHQUFHLFNBQVMsWUFBWTtnQkFDckMsZ0JBQWdCLEVBQUUsR0FBRyxTQUFTLDZCQUE2QjtnQkFDM0Qsa0dBQWtHO2dCQUNsRyxrR0FBa0c7Z0JBQ2xHLDBDQUEwQztnQkFDMUMsTUFBTSxFQUFFO29CQUNOLHlCQUF5QixFQUFFLElBQUksQ0FBQyxTQUFTLENBQUMsTUFBQSxPQUFPLENBQUMsVUFBVSxtQ0FBSSxFQUFFLENBQUM7aUJBQ3BFO2FBQ0ssQ0FBQztZQUNULE9BQU8sRUFBRSxvQkFBTyxDQUFDLFdBQVc7WUFDNUIsT0FBTyxFQUFFLGVBQWU7U0FDekIsQ0FDRixDQUFDO0lBQ0osQ0FBQztDQUNGO0FBaENELHNEQWdDQyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IENvbnN0cnVjdCB9IGZyb20gXCJAYXdzLWNkay9jb3JlXCI7XG5pbXBvcnQgeyBCdW5kbGluZyB9IGZyb20gXCJAYXdzLWNkay9hd3MtbGFtYmRhLW5vZGVqcy9saWIvYnVuZGxpbmdcIjtcbmltcG9ydCB7IFJ1bnRpbWUgfSBmcm9tIFwiQGF3cy1jZGsvYXdzLWxhbWJkYVwiO1xuaW1wb3J0IHsgZXhwZXJpbWVudGFsIH0gZnJvbSBcIkBhd3MtY2RrL2F3cy1jbG91ZGZyb250XCI7XG5pbXBvcnQgeyBFZGdlRnVuY3Rpb24gfSBmcm9tIFwiQGF3cy1jZGsvYXdzLWNsb3VkZnJvbnQvbGliL2V4cGVyaW1lbnRhbFwiO1xuXG5leHBvcnQgaW50ZXJmYWNlIEVycm9yUmVzcG9uc2VGdW5jdGlvbk9wdGlvbnMge1xuICBwYXRoUHJlZml4Pzogc3RyaW5nO1xufVxuXG5leHBvcnQgY2xhc3MgRXJyb3JSZXNwb25zZUZ1bmN0aW9uIGV4dGVuZHMgQ29uc3RydWN0IHtcbiAgcmVhZG9ubHkgZWRnZUZ1bmN0aW9uOiBFZGdlRnVuY3Rpb247XG5cbiAgY29uc3RydWN0b3IoXG4gICAgc2NvcGU6IENvbnN0cnVjdCxcbiAgICBpZDogc3RyaW5nLFxuICAgIG9wdGlvbnM6IEVycm9yUmVzcG9uc2VGdW5jdGlvbk9wdGlvbnNcbiAgKSB7XG4gICAgc3VwZXIoc2NvcGUsIGlkKTtcblxuICAgIHRoaXMuZWRnZUZ1bmN0aW9uID0gbmV3IGV4cGVyaW1lbnRhbC5FZGdlRnVuY3Rpb24oXG4gICAgICB0aGlzLFxuICAgICAgXCJFcnJvclJlc3BvbnNlRnVuY3Rpb25cIixcbiAgICAgIHtcbiAgICAgICAgY29kZTogQnVuZGxpbmcuYnVuZGxlKHtcbiAgICAgICAgICBlbnRyeTogYCR7X19kaXJuYW1lfS9oYW5kbGVycy9lcnJvci1yZXNwb25zZS50c2AsXG4gICAgICAgICAgcnVudGltZTogUnVudGltZS5OT0RFSlNfMTRfWCxcbiAgICAgICAgICBzb3VyY2VNYXA6IHRydWUsXG4gICAgICAgICAgcHJvamVjdFJvb3Q6IGAke19fZGlybmFtZX0vaGFuZGxlcnMvYCxcbiAgICAgICAgICBkZXBzTG9ja0ZpbGVQYXRoOiBgJHtfX2Rpcm5hbWV9L2hhbmRsZXJzL3BhY2thZ2UtbG9jay5qc29uYCxcbiAgICAgICAgICAvLyBEZWZpbmUgb3B0aW9ucyByZXBsYWNlIHZhbHVlcyBhdCBidWlsZCB0aW1lIHNvIHdlIGNhbiB1c2UgZW52aXJvbm1lbnQgdmFyaWFibGVzIHRvIHRlc3QgbG9jYWxseVxuICAgICAgICAgIC8vIGFuZCByZXBsYWNlIGR1cmluZyBidWlsZC9kZXBsb3kgd2l0aCBzdGF0aWMgdmFsdWVzLiBUaGlzIGdldHMgYXJvdW5kIHRoZSBsYW1iZGFAZWRnZSBsaW1pdGF0aW9uXG4gICAgICAgICAgLy8gb2Ygbm8gZW52aXJvbm1lbnQgdmFyaWFibGVzIGF0IHJ1bnRpbWUuXG4gICAgICAgICAgZGVmaW5lOiB7XG4gICAgICAgICAgICBcInByb2Nlc3MuZW52LlBBVEhfUFJFRklYXCI6IEpTT04uc3RyaW5naWZ5KG9wdGlvbnMucGF0aFByZWZpeCA/PyBcIlwiKSxcbiAgICAgICAgICB9LFxuICAgICAgICB9IGFzIGFueSksXG4gICAgICAgIHJ1bnRpbWU6IFJ1bnRpbWUuTk9ERUpTXzE0X1gsXG4gICAgICAgIGhhbmRsZXI6IFwiaW5kZXguaGFuZGxlclwiLFxuICAgICAgfVxuICAgICk7XG4gIH1cbn1cbiJdfQ==
@@ -1,55 +0,0 @@
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
- }
@@ -1,21 +0,0 @@
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
@@ -1,16 +0,0 @@
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).
@@ -1,79 +0,0 @@
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
- }