{"_id":"@aws-abaschen/cdk-typescript","_rev":"4-93b12251e5f14faf77bc0507451d5792","name":"@aws-abaschen/cdk-typescript","dist-tags":{"latest":"0.0.5"},"versions":{"0.0.1":{"name":"@aws-abaschen/cdk-typescript","version":"0.0.1","description":"Typescript helpers and constructs for AWS CDK","types":"dist/index.d.ts","main":"dist/index.js","scripts":{"build":"tsc","prepublishOnly":"tsc","test":"jest"},"repository":{"type":"git","url":"git+ssh://git@github.com/aws-abaschen/cdk-typescript.git"},"keywords":["typescript","aws","cdk"],"author":{"name":"aws-abaschen"},"license":"MIT","bugs":{"url":"https://github.com/aws-abaschen/cdk-typescript/issues"},"homepage":"https://github.com/aws-abaschen/cdk-typescript#readme","dependencies":{"aws-cdk-lib":"^2.93.0","constructs":"^10.2.70","esbuild":"^0.17.12","source-map-support":"^0.5.21"},"peerDependencies":{},"devDependencies":{"@types/aws-lambda":"^8.10.114","@types/jest":"^29.5.4","@types/node":"^20.5.7","aws-cdk":"2.70.0","jest":"^29.6.4","ts-jest":"^29.1.1","ts-node":"^10.9.1","tsconfig-paths":"^4.2.0","typescript":"~4.9.5"},"engines":{"node":">=18"},"gitHead":"6b6331ff2880e591c896bbdcf52c2bcfb9359789","_id":"@aws-abaschen/cdk-typescript@0.0.1","_nodeVersion":"18.16.0","_npmVersion":"9.5.1","dist":{"integrity":"sha512-+xWppmPBa4b0n0vhExtATTqHJMTfKncv2Q2bTzitVQ/XbTixsWaK7NNZQkAPHNCs0vVaVL2SJkFi87inSqtRFg==","shasum":"333facd5b4a3c81f862b835dec3c95cb15c74cd0","tarball":"https://registry.npmjs.org/@aws-abaschen/cdk-typescript/-/cdk-typescript-0.0.1.tgz","fileCount":11,"unpackedSize":40477,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC7Rw9xP6aLKNWT26NO3YruIE58WcmQvcCj7MKvcOFHnAIgZYesxRHFhygCKRAtn7O94qHrprRYkCQmCQqtRKJ9//4="}]},"_npmUser":{"name":"tecdev","email":"a.baschenis@techunter.io"},"directories":{},"maintainers":[{"name":"tecdev","email":"a.baschenis@techunter.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/cdk-typescript_0.0.1_1693564492584_0.5133476341959136"},"_hasShrinkwrap":false},"0.0.2":{"name":"@aws-abaschen/cdk-typescript","version":"0.0.2","description":"Typescript helpers and constructs for AWS CDK","types":"dist/index.d.ts","main":"dist/index.js","scripts":{"build":"tsc","prepublishOnly":"tsc","test":"jest"},"repository":{"type":"git","url":"git+ssh://git@github.com/aws-abaschen/cdk-typescript.git"},"keywords":["typescript","aws","cdk"],"author":{"name":"aws-abaschen"},"license":"MIT","bugs":{"url":"https://github.com/aws-abaschen/cdk-typescript/issues"},"homepage":"https://github.com/aws-abaschen/cdk-typescript#readme","dependencies":{"aws-cdk-lib":"^2.93.0","constructs":"^10.2.70","esbuild":"^0.17.12","source-map-support":"^0.5.21"},"peerDependencies":{},"devDependencies":{"@types/aws-lambda":"^8.10.114","@types/jest":"^29.5.4","@types/node":"^20.5.7","aws-cdk":"2.70.0","jest":"^29.6.4","ts-jest":"^29.1.1","ts-node":"^10.9.1","tsconfig-paths":"^4.2.0","typescript":"~4.9.5"},"engines":{"node":">=18"},"gitHead":"4e892fe61f31e0538529e98f6d100c1e23e45ce3","_id":"@aws-abaschen/cdk-typescript@0.0.2","_nodeVersion":"18.16.0","_npmVersion":"9.5.1","dist":{"integrity":"sha512-+1QgYCzJ3U2KXX4Yd8a+oSgDHREVnm1WN/VYCx6QSx9tc884mnEaGUpGDlwInh3RxMpKWipGfrQ1QJZJjB/pXA==","shasum":"391914d1854242c86d5adeeb17406faf39b33399","tarball":"https://registry.npmjs.org/@aws-abaschen/cdk-typescript/-/cdk-typescript-0.0.2.tgz","fileCount":11,"unpackedSize":40659,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGFoeeDCJj+dc+Vr62HFU9+8gywcmWDZL3iHxRJtzTHEAiEA2Yn3YYIzTC+o5DAo6V3v38NI2v0znmDkBPqoI9snZrc="}]},"_npmUser":{"name":"tecdev","email":"a.baschenis@techunter.io"},"directories":{},"maintainers":[{"name":"tecdev","email":"a.baschenis@techunter.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/cdk-typescript_0.0.2_1693565470719_0.6589608899008181"},"_hasShrinkwrap":false},"0.0.3":{"name":"@aws-abaschen/cdk-typescript","version":"0.0.3","description":"Typescript helpers and constructs for AWS CDK","types":"dist/index.d.ts","main":"dist/index.js","scripts":{"build":"tsc","prepublishOnly":"tsc","prepack":"yarn build","test":"jest"},"repository":{"type":"git","url":"git+ssh://git@github.com/aws-abaschen/cdk-typescript.git"},"keywords":["typescript","aws","cdk"],"author":{"name":"aws-abaschen"},"license":"MIT","bugs":{"url":"https://github.com/aws-abaschen/cdk-typescript/issues"},"homepage":"https://github.com/aws-abaschen/cdk-typescript#readme","dependencies":{"aws-cdk-lib":"^2.93.0","constructs":"^10.2.70","esbuild":"^0.17.12","source-map-support":"^0.5.21"},"peerDependencies":{},"devDependencies":{"@types/aws-lambda":"^8.10.114","@types/jest":"^29.5.4","@types/node":"^20.5.7","aws-cdk":"2.70.0","jest":"^29.6.4","ts-jest":"^29.1.1","ts-node":"^10.9.1","tsconfig-paths":"^4.2.0","typescript":"~4.9.5"},"engines":{"node":">=18"},"licenseText":"MIT License\n\nCopyright (c) 2023 aws-abaschen\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_id":"@aws-abaschen/cdk-typescript@0.0.3","dist":{"shasum":"3a8392bb244a66de7c83f1ab4223573962428131","integrity":"sha512-hCz29o/E+Ib+CXWQX+tc6YY/hjd8VovXYHUAWiwbioeLW4AbjCZKIHL5T0pwQ+PtZZiOYJW8bZy8/0jXZsDQ1g==","tarball":"https://registry.npmjs.org/@aws-abaschen/cdk-typescript/-/cdk-typescript-0.0.3.tgz","fileCount":15,"unpackedSize":42267,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDUmRfSF8O5LsTuGawzgkUutt8olghVHyVjg+2/aivHpAIhAPppQvd4y3ZFVmJMBlaYWQpGRHJWydWaYrPw4AucnGnL"}]},"_npmUser":{"name":"tecdev","email":"a.baschenis@techunter.io"},"directories":{},"maintainers":[{"name":"tecdev","email":"a.baschenis@techunter.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/cdk-typescript_0.0.3_1693572396949_0.4405894963360679"},"_hasShrinkwrap":false},"0.0.4":{"name":"@aws-abaschen/cdk-typescript","version":"0.0.4","description":"Typescript helpers and constructs for AWS CDK","types":"dist/index.d.ts","main":"dist/index.js","scripts":{"build":"tsc","prepublishOnly":"tsc","prepack":"yarn build","test":"jest --passWithNoTests"},"repository":{"type":"git","url":"git+ssh://git@github.com/aws-abaschen/cdk-typescript.git"},"keywords":["typescript","aws","cdk"],"author":{"name":"aws-abaschen"},"license":"MIT","bugs":{"url":"https://github.com/aws-abaschen/cdk-typescript/issues"},"homepage":"https://github.com/aws-abaschen/cdk-typescript#readme","dependencies":{"aws-cdk-lib":"^2.93.0","constructs":"^10.2.70","esbuild":"^0.17.12","source-map-support":"^0.5.21"},"peerDependencies":{},"devDependencies":{"@jest/globals":"^29.6.4","@types/aws-lambda":"^8.10.114","@types/node":"^20.5.7","aws-cdk":"2.70.0","jest":"^29.6.4","ts-jest":"^29.1.1","ts-node":"^10.9.1","tsconfig-paths":"^4.2.0","typescript":"~4.9.5"},"engines":{"node":">=18"},"licenseText":"MIT License\n\nCopyright (c) 2023 aws-abaschen\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_id":"@aws-abaschen/cdk-typescript@0.0.4","dist":{"shasum":"e66d374b5c4143ead862d17d0cb00ecf8c2072c8","integrity":"sha512-WgKNHGemBakQUTy2q4HHISn23O9MQW6Im5nUwnqAvSSb4KSjbhSBqbOG69ORB82nWfdHi7y9HU8A135jBlBzCw==","tarball":"https://registry.npmjs.org/@aws-abaschen/cdk-typescript/-/cdk-typescript-0.0.4.tgz","fileCount":15,"unpackedSize":42335,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAPZcJUkuFsNYVcaBWt5IV00W0I6tB94BRyDm/q7EWPLAiBlQmtqOJtgcMobvZvh0Ya5gEHpRAnQ+uRkxCycvxGt1A=="}]},"_npmUser":{"name":"tecdev","email":"a.baschenis@techunter.io"},"directories":{},"maintainers":[{"name":"tecdev","email":"a.baschenis@techunter.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/cdk-typescript_0.0.4_1693574834083_0.11456986809431391"},"_hasShrinkwrap":false},"0.0.5":{"name":"@aws-abaschen/cdk-typescript","version":"0.0.5","description":"Typescript helpers and constructs for AWS CDK","types":"dist/index.d.ts","main":"dist/index.js","scripts":{"build":"tsc","prepublishOnly":"tsc","prepack":"yarn build","test":"jest --passWithNoTests"},"repository":{"type":"git","url":"git+ssh://git@github.com/aws-abaschen/cdk-typescript.git"},"keywords":["typescript","aws","cdk"],"author":{"name":"aws-abaschen"},"license":"MIT","bugs":{"url":"https://github.com/aws-abaschen/cdk-typescript/issues"},"homepage":"https://github.com/aws-abaschen/cdk-typescript#readme","dependencies":{"aws-cdk-lib":"^2.96.0","constructs":"^10.2.70","esbuild":"^0.17.12","source-map-support":"^0.5.21"},"peerDependencies":{},"devDependencies":{"@jest/globals":"^29.6.4","@types/aws-lambda":"^8.10.114","@types/node":"^20.5.7","aws-cdk":"^2.96.0","jest":"^29.6.4","ts-jest":"^29.1.1","ts-node":"^10.9.1","tsconfig-paths":"^4.2.0","typescript":"~4.9.5"},"engines":{"node":">=18"},"licenseText":"MIT License\n\nCopyright (c) 2023 aws-abaschen\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_id":"@aws-abaschen/cdk-typescript@0.0.5","dist":{"shasum":"5e32d7eb508a4f3d4436573e766fae68ef8e23d7","integrity":"sha512-Nq5mH1LmvGreqwrJTvpz/FHXwdsOlq/sDTA5KApCqKsv4W+rUNqJvZ+uq2FAEMJfT7p4+CBTP5YIt0ALR71jvw==","tarball":"https://registry.npmjs.org/@aws-abaschen/cdk-typescript/-/cdk-typescript-0.0.5.tgz","fileCount":15,"unpackedSize":39027,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDkx5nROeD0hZceUh5MEkuxnpfh0L9HtHBiBiuS3lSoOAiAKAjMJiaRbjXCLfIs8BKSNJ1SvfnHD8beRp6vetIYyoQ=="}]},"_npmUser":{"name":"tecdev","email":"a.baschenis@techunter.io"},"directories":{},"maintainers":[{"name":"tecdev","email":"a.baschenis@techunter.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/cdk-typescript_0.0.5_1709050117514_0.25559320730348944"},"_hasShrinkwrap":false}},"time":{"created":"2023-09-01T10:34:52.493Z","0.0.1":"2023-09-01T10:34:52.721Z","modified":"2024-02-27T16:08:38.139Z","0.0.2":"2023-09-01T10:51:10.856Z","0.0.3":"2023-09-01T12:46:37.180Z","0.0.4":"2023-09-01T13:27:14.284Z","0.0.5":"2024-02-27T16:08:37.674Z"},"maintainers":[{"name":"tecdev","email":"a.baschenis@techunter.io"}],"description":"Typescript helpers and constructs for AWS CDK","homepage":"https://github.com/aws-abaschen/cdk-typescript#readme","keywords":["typescript","aws","cdk"],"repository":{"type":"git","url":"git+ssh://git@github.com/aws-abaschen/cdk-typescript.git"},"author":{"name":"aws-abaschen"},"bugs":{"url":"https://github.com/aws-abaschen/cdk-typescript/issues"},"license":"MIT","readme":"# CDK Typescript library\n\n## Getting started\n\n```bash\nyarn add @aws-abaschen/cdk-typescript\nmkdir -p src/{functions,layers}\n```\n\nRefer to [this example Stack](example/ExampleStack.ts) and the related [CDK App](example/bin/deploy.ts)\n\n\n## NodetsFunction\n\nThis construct will allow your lambdas to output `.mjs` files with their source maps. It relies on standardized folder structure in `src/`\nEach Lambda function will have to be written in a folder which will become its `functionName` in `src/functions/{functionName}/index.ts`.\n\n*All the default values are for example purpose and doesn't reflect any recommendation nor will be maintained.*\n\n### IAM Role and Policies\nInstead of letting CDK generating a role, the construct will create one named `fnRole${id}` and will append the policies below with a Stack id `fn-role-${id}`. The property `role` is also available for further manipulation.\n\n#### 1. Logging\nBy default, the PolicyStatement to write in the log group will be added:\n```typescript\nnew PolicyStatement(\n    {\n        effect: Effect.ALLOW,\n        actions: [\n            \"logs:CreateLogGroup\",\n            \"logs:CreateLogStream\",\n            \"logs:PutLogEvents\",\n        ],\n        resources: [`arn:aws:logs:${Stack.of(this).region}:${scope.account}:log-group:/aws/lambda/${id}:*`]\n    }\n);\n```\n\n#### 2. VPC\nAdding a VPC to your lambda function will automatically add the policy to connect: \n```typescript\nnew PolicyStatement({\n    effect: Effect.ALLOW,\n    actions: [\n        \"ec2:CreateNetworkInterface\",\n        \"ec2:DescribeNetworkInterfaces\",\n        \"ec2:DeleteNetworkInterface\",\n        \"ec2:AssignPrivateIpAddresses\",\n        \"ec2:UnassignPrivateIpAddresses\"\n    ],\n    resources: [\"*\"]\n});\n```\n\n#### 3. Tracing\nTracing is enabled by default and the policy statement will be added unless disabled: \n\n```typescript\nnew PolicyStatement({\n        effect: Effect.ALLOW,\n        actions: [\n            \"logs:CreateLogDelivery\",\n            \"logs:DeleteLogDelivery\",\n            \"logs:DescribeLogGroups\",\n            \"logs:DescribeResourcePolicies\",\n            \"logs:GetLogDelivery\",\n            \"logs:ListLogDeliveries\",\n            \"logs:PutResourcePolicy\",\n            \"logs:UpdateLogDelivery\",\n            \"xray:GetSamplingRules\",\n            \"xray:GetSamplingTargets\",\n            \"xray:PutTelemetryRecords\",\n            \"xray:PutTraceSegments\"\n        ],\n        resources: [`arn:aws:logs:${Stack.of(this).region}:${scope.account}:log-group:/aws/lambda/${id}:*`],\n})\n```\n\n### SSM String parameters\n\nString parameters can be automatically referenced and read policy applied if they follow a specific prefix (default here is `fn-`). They will then get injected as an environment variable with `PARAM_` prefix and `-` (dash) replaced with `_` (underscore) in the name:\n```typescript\nnew NodetsFunction(this, name, {\n    parameters: ['DB-USER'],\n    environment: {\n        TEST_1: 'test Value 1'\n    }\n});\n```\n\nWill output: \n```yaml\n[...]\n      Environment:\n        Variables:\n          NODE_OPTIONS: --enable-source-maps\n          PARAM_DB_USER:\n            Ref: discordpongfnparamDBUSERParameter70CB30BD\n          TEST_1: test Value 1\n          AWS_NODEJS_CONNECTION_REUSE_ENABLED: \"1\"\n[...]\nParameters:\n  discordpongfnparamDBUSERParameter70CB30BD:\n    Type: AWS::SSM::Parameter::Value<String>\n    Default: fn-DB-USER\n```\n\n## NodetsLayer\n\nSimilarly, a layer will be named and the source has to be in a folder `layerName` in `src/layers/{layerName}/index.ts`.\nThen a layer has to be referenced with `import { someExport } from '@layer/layerName'`. The aliasing for typescript is in [tsconfig.json](tsconfig.json) `$.aliases` and `$.compilerOptions.paths`.\n\nExample in [Discord authorizer layer](src/layers/discord-authorizer/index.ts):\n```typescript\nexport const verify = async (event: APIGatewayEvent): Promise<Boolean> => {\n    ...\n}\n```\n\nCan be referenced in [the lambda function discrod-pong](src/functions/discord-pong/index.ts):\n```typescript\nimport { verify } from '@layer/discord-authorizer';\n```\n\n*Explanations:\nDuring layer build, the layer is compiled into a module with a `package.json` file. At runtime this module will end up in the lambda filesystem inside the `/nodejs/node_modules/@layer\\/discord-authorizer`. Thus when referencing '@layer/discord-authorizer` it will automatically find it.*\n\n## Autotagging\n\nThe `ResourceAspect` will tag every Cloud Formation resource with whatever static tag given in the props:\n\n```typescript\nconst fn = new NodetsFunction(this, 'fn', {...});\nAspects.of(fn).add(new ResourceAspect({\n  app: 'SampleApp'\n}));\n```\n\nWill result in the template:\n```yaml\n\n  fnreturn2005A3631C2:\n    Type: AWS::Lambda::Function    \n    Properties:\n      # ...\n      Tags:\n        - Key: resource:type\n          Value: AWS::Lambda::Function\n        - Key: x-app\n          Value: SampleApp\n```\n\nAny static tag is prefixed with `x-`. The aspect can also be applied to the `App` or `Stack` directly for recursive tagging. Some resource may be missed like the lambda for log retention in a lambda function.\n","readmeFilename":"README.md"}