cdk-nuxt 2.4.0 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/README.md +133 -46
  2. package/lib/cli/deploy-server.js +9 -2
  3. package/lib/cli/destroy-server.js +8 -1
  4. package/lib/functions/access-logs-analysis/group-by-date/package.json +20 -19
  5. package/lib/functions/access-logs-analysis/group-by-date/pnpm-lock.yaml +1385 -0
  6. package/lib/functions/access-logs-analysis/partitioning/package.json +20 -19
  7. package/lib/functions/access-logs-analysis/partitioning/pnpm-lock.yaml +1122 -0
  8. package/lib/functions/assets-cleanup/package.json +19 -18
  9. package/lib/functions/assets-cleanup/pnpm-lock.yaml +1377 -0
  10. package/lib/stack/access-logs-analysis/AccessLogsAnalysis.js +19 -4
  11. package/lib/stack/access-logs-analysis/AccessLogsAnalysis.ts +23 -5
  12. package/lib/stack/server/NuxtServerAppStack.d.ts +18 -3
  13. package/lib/stack/server/NuxtServerAppStack.js +56 -20
  14. package/lib/stack/server/NuxtServerAppStack.ts +76 -24
  15. package/lib/stack/server/NuxtServerAppStackProps.d.ts +73 -0
  16. package/lib/stack/server/NuxtServerAppStackProps.js +1 -1
  17. package/lib/stack/server/NuxtServerAppStackProps.ts +80 -0
  18. package/lib/templates/stack-index-server.ts +60 -24
  19. package/package.json +44 -42
  20. package/lib/functions/access-logs-analysis/group-by-date/.gitignore +0 -2
  21. package/lib/functions/access-logs-analysis/group-by-date/build/app/index.d.ts +0 -2
  22. package/lib/functions/access-logs-analysis/group-by-date/build/app/index.js +0 -57
  23. package/lib/functions/access-logs-analysis/group-by-date/build/app/index.js.map +0 -1
  24. package/lib/functions/access-logs-analysis/group-by-date/yarn.lock +0 -1253
  25. package/lib/functions/access-logs-analysis/partitioning/.gitignore +0 -2
  26. package/lib/functions/access-logs-analysis/partitioning/build/app/create-partition.d.ts +0 -1
  27. package/lib/functions/access-logs-analysis/partitioning/build/app/create-partition.js +0 -57
  28. package/lib/functions/access-logs-analysis/partitioning/build/app/create-partition.js.map +0 -1
  29. package/lib/functions/access-logs-analysis/partitioning/build/app/transform-partition.d.ts +0 -2
  30. package/lib/functions/access-logs-analysis/partitioning/build/app/transform-partition.js +0 -72
  31. package/lib/functions/access-logs-analysis/partitioning/build/app/transform-partition.js.map +0 -1
  32. package/lib/functions/access-logs-analysis/partitioning/build/app/types.d.ts +0 -7
  33. package/lib/functions/access-logs-analysis/partitioning/build/app/types.js +0 -3
  34. package/lib/functions/access-logs-analysis/partitioning/build/app/types.js.map +0 -1
  35. package/lib/functions/access-logs-analysis/partitioning/build/app/util.d.ts +0 -9
  36. package/lib/functions/access-logs-analysis/partitioning/build/app/util.js +0 -44
  37. package/lib/functions/access-logs-analysis/partitioning/build/app/util.js.map +0 -1
  38. package/lib/functions/access-logs-analysis/partitioning/yarn.lock +0 -1009
  39. package/lib/functions/assets-cleanup/.gitignore +0 -2
  40. package/lib/functions/assets-cleanup/build/app/index.d.ts +0 -1
  41. package/lib/functions/assets-cleanup/build/app/index.js +0 -114
  42. package/lib/functions/assets-cleanup/build/app/index.js.map +0 -1
  43. package/lib/functions/assets-cleanup/yarn.lock +0 -1245
package/package.json CHANGED
@@ -1,44 +1,46 @@
1
1
  {
2
- "name": "cdk-nuxt",
3
- "version": "2.4.0",
4
- "license": "MIT",
5
- "repository": {
6
- "type": "git",
7
- "url": "https://github.com/ferdinandfrank/cdk-nuxt.git"
8
- },
9
- "files": [
10
- "lib",
11
- "index.d.ts"
12
- ],
13
- "main": "index.js",
14
- "types": "index.d.ts",
15
- "bin": {
16
- "cdk-nuxt-init-server": "lib/cli/init-server.js",
17
- "cdk-nuxt-init-static": "lib/cli/init-static.js",
18
- "cdk-nuxt-deploy-server": "lib/cli/deploy-server.js",
19
- "cdk-nuxt-destroy-server": "lib/cli/destroy-server.js",
20
- "cdk-nuxt-deploy-static": "lib/cli/deploy-static.js"
21
- },
22
- "scripts": {
23
- "build": "tsc",
24
- "release": "yarn run build && yarn version && git push --follow-tags"
25
- },
26
- "devDependencies": {
27
- "@types/node": "^20.10",
28
- "fs": "^0.0.1-security",
29
- "ts-node": "^10.9.2",
30
- "typescript": "^5.6.3"
31
- },
32
- "dependencies": {
33
- "@aws-cdk/aws-glue-alpha": "2.166.0-alpha.0",
34
- "aws-cdk": "2.166.0",
35
- "aws-cdk-lib": "2.166.0",
36
- "constructs": "^10.2.31",
37
- "shelljs": "^0.8.5"
38
- },
39
- "peerDependencies": {
40
- "aws-cdk": "2.166.0",
41
- "ts-node": "^10.9.2",
42
- "typescript": "^5.6.3"
43
- }
2
+ "name": "cdk-nuxt",
3
+ "version": "2.5.0",
4
+ "license": "MIT",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/ferdinandfrank/cdk-nuxt.git"
8
+ },
9
+ "files": [
10
+ "lib",
11
+ "index.d.ts"
12
+ ],
13
+ "main": "index.js",
14
+ "types": "index.d.ts",
15
+ "bin": {
16
+ "cdk-nuxt-init-server": "lib/cli/init-server.js",
17
+ "cdk-nuxt-init-static": "lib/cli/init-static.js",
18
+ "cdk-nuxt-deploy-server": "lib/cli/deploy-server.js",
19
+ "cdk-nuxt-destroy-server": "lib/cli/destroy-server.js",
20
+ "cdk-nuxt-deploy-static": "lib/cli/deploy-static.js"
21
+ },
22
+ "scripts": {
23
+ "build": "tsc",
24
+ "release:check": "pnpm run build",
25
+ "release": "pnpm run release:check && pnpm changelogen --release --push"
26
+ },
27
+ "devDependencies": {
28
+ "@types/node": "^20.10",
29
+ "changelogen": "^0.6.2",
30
+ "ts-node": "^10.9.2",
31
+ "typescript": "^5.6.3"
32
+ },
33
+ "dependencies": {
34
+ "@aws-cdk/aws-glue-alpha": "2.214.0-alpha.0",
35
+ "aws-cdk-lib": "2.214.0",
36
+ "constructs": "^10.4.2",
37
+ "shelljs": "^0.10.0"
38
+ },
39
+ "peerDependencies": {
40
+ "aws-cdk-lib": "^2.214.0",
41
+ "constructs": "^10.4.2",
42
+ "ts-node": "^10.9.2",
43
+ "typescript": "^5.6.3"
44
+ },
45
+ "packageManager": "pnpm@10.15.1"
44
46
  }
@@ -1,2 +0,0 @@
1
- node_modules
2
- build
@@ -1,2 +0,0 @@
1
- import type { S3Event } from 'aws-lambda';
2
- export declare const handler: (event: S3Event) => Promise<void>;
@@ -1,57 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.handler = void 0;
4
- /**
5
- * This script moves access logs into a target folder hierarchy, structured by year, month, day, and hour (UTC).
6
- * That way, the logs can easier be processed with Athena.
7
- * Taken and adjusted from https://github.com/aws-samples/amazon-cloudfront-access-logs-queries.
8
- * This Lambda supports access logs from both: CloudFront and S3.
9
- */
10
- const client_s3_1 = require("@aws-sdk/client-s3");
11
- // without leading and trailing slashes
12
- const targetFolder = process.env.TARGET_FOLDER;
13
- if (!targetFolder) {
14
- throw new Error('Required environment variable TARGET_FOLDER missing!');
15
- }
16
- if (!process.env.RAW_ACCESS_LOG_FILE_PATTERN) {
17
- throw new Error('Required environment variable RAW_ACCESS_LOG_FILE_PATTERN missing!');
18
- }
19
- // unfortunately, CloudFront logs and S3 logs are completely different. That's why the pattern to identify
20
- // unprocessed log files need to be configurable
21
- const rawAccessLogFilePattern = new RegExp(process.env.RAW_ACCESS_LOG_FILE_PATTERN);
22
- // matches for everything after the last slash
23
- const filenamePattern = /[^/]+$/;
24
- const s3Client = new client_s3_1.S3Client({ region: process.env.AWS_REGION });
25
- const internalHandler = async (event) => {
26
- try {
27
- const pendingMoves = event.Records.map(async (record) => {
28
- const bucket = record.s3.bucket.name;
29
- const sourceKey = record.s3.object.key;
30
- const match = rawAccessLogFilePattern.exec(sourceKey);
31
- // skip other files/folder
32
- if (match?.groups) {
33
- const { year, month, day, hour } = match.groups;
34
- const filename = filenamePattern.exec(sourceKey)[0];
35
- const targetKey = `${targetFolder}/year=${year}/month=${month}/day=${day}/hour=${hour}/${filename}`;
36
- const copyCommand = new client_s3_1.CopyObjectCommand({
37
- Bucket: bucket,
38
- Key: targetKey,
39
- CopySource: bucket + '/' + sourceKey,
40
- });
41
- await s3Client.send(copyCommand);
42
- const deleteSourceCommand = new client_s3_1.DeleteObjectCommand({
43
- Bucket: bucket,
44
- Key: sourceKey,
45
- });
46
- await s3Client.send(deleteSourceCommand);
47
- }
48
- });
49
- const processed = await Promise.all(pendingMoves);
50
- console.log(`successfully moved ${processed.length} files`);
51
- }
52
- catch (error) {
53
- console.error('### unexpected runtime error ###', error);
54
- }
55
- };
56
- exports.handler = internalHandler;
57
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,kDAAoF;AAGpF,uCAAuC;AACvC,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC;AAC/C,IAAI,CAAC,YAAY,EAAE,CAAC;IAClB,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;AAC1E,CAAC;AACD,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,2BAA2B,EAAE,CAAC;IAC7C,MAAM,IAAI,KAAK,CAAC,oEAAoE,CAAC,CAAC;AACxF,CAAC;AACD,0GAA0G;AAC1G,gDAAgD;AAChD,MAAM,uBAAuB,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;AAEpF,8CAA8C;AAC9C,MAAM,eAAe,GAAG,QAAQ,CAAC;AAEjC,MAAM,QAAQ,GAAG,IAAI,oBAAQ,CAAC,EAAC,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU,EAAC,CAAC,CAAC;AAEhE,MAAM,eAAe,GAAG,KAAK,EAAE,KAAc,EAAE,EAAE;IAC/C,IAAI,CAAC;QACH,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAC,MAAM,EAAC,EAAE;YACpD,MAAM,MAAM,GAA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IAC3D,CAAC;AACH,CAAC,CAAC;AAEW,QAAA,OAAO,GAAG,eAAe,CAAC","sourcesContent":["/**\n * This script moves access logs into a target folder hierarchy, structured by year, month, day, and hour (UTC).\n * That way, the logs can easier be processed with Athena.\n * Taken and adjusted from https://github.com/aws-samples/amazon-cloudfront-access-logs-queries.\n * This Lambda supports access logs from both: CloudFront and S3.\n */\nimport {S3Client, CopyObjectCommand, DeleteObjectCommand} from '@aws-sdk/client-s3';\nimport type {S3Event} from 'aws-lambda';\n\n// without leading and trailing slashes\nconst targetFolder = process.env.TARGET_FOLDER;\nif (!targetFolder) {\n throw new Error('Required environment variable TARGET_FOLDER missing!');\n}\nif (!process.env.RAW_ACCESS_LOG_FILE_PATTERN) {\n throw new Error('Required environment variable RAW_ACCESS_LOG_FILE_PATTERN missing!');\n}\n// unfortunately, CloudFront logs and S3 logs are completely different. That's why the pattern to identify\n// unprocessed log files need to be configurable\nconst rawAccessLogFilePattern = new RegExp(process.env.RAW_ACCESS_LOG_FILE_PATTERN);\n\n// matches for everything after the last slash\nconst filenamePattern = /[^/]+$/;\n\nconst s3Client = new S3Client({region: process.env.AWS_REGION});\n\nconst internalHandler = async (event: S3Event) => {\n try {\n const pendingMoves = event.Records.map(async record => {\n const bucket = record.s3.bucket.name;\n const sourceKey = record.s3.object.key;\n const match = rawAccessLogFilePattern.exec(sourceKey);\n\n // skip other files/folder\n if (match?.groups) {\n const {year, month, day, hour} = match.groups;\n const filename = filenamePattern.exec(sourceKey)![0];\n const targetKey = `${targetFolder}/year=${year}/month=${month}/day=${day}/hour=${hour}/${filename}`;\n\n const copyCommand = new CopyObjectCommand({\n Bucket: bucket,\n Key: targetKey,\n CopySource: bucket + '/' + sourceKey,\n });\n\n await s3Client.send(copyCommand);\n\n const deleteSourceCommand = new DeleteObjectCommand({\n Bucket: bucket,\n Key: sourceKey,\n });\n\n await s3Client.send(deleteSourceCommand);\n }\n });\n\n const processed = await Promise.all(pendingMoves);\n console.log(`successfully moved ${processed.length} files`);\n } catch (error) {\n console.error('### unexpected runtime error ###', error);\n }\n};\n\nexport const handler = internalHandler;\n"]}