@phila/cli 0.0.13 → 0.0.15

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 (35) hide show
  1. package/dist/templates/_shared/dotnet-api/Api.csproj +1 -1
  2. package/dist/templates/_shared/dotnet-api/aws-lambda-tools-defaults.json +1 -1
  3. package/dist/templates/_shared/dotnet-api-postgres/Api.csproj +1 -1
  4. package/dist/templates/_shared/dotnet-api-postgres/aws-lambda-tools-defaults.json +1 -1
  5. package/dist/templates/lambda-api-nodejs/apps/__lambdaName__/index.ts +25 -8
  6. package/dist/templates/lambda-api-nodejs/apps/__lambdaName__/package.json +1 -1
  7. package/dist/templates/lambda-api-nodejs/cdk/app.ts.tmpl +1 -1
  8. package/dist/templates/lambda-dynamo-api/apps/__lambdaName__/index.ts +7 -3
  9. package/dist/templates/lambda-dynamo-api/apps/__lambdaName__/package.json +1 -1
  10. package/dist/templates/lambda-dynamo-api/cdk/app.ts.tmpl +1 -1
  11. package/dist/templates/lambda-postgres-api/README.md.tmpl +1 -1
  12. package/dist/templates/lambda-postgres-api/apps/__lambdaName__/index.ts +7 -3
  13. package/dist/templates/lambda-postgres-api/apps/__lambdaName__/package.json +1 -1
  14. package/dist/templates/lambda-postgres-api/cdk/app.ts.tmpl +1 -1
  15. package/dist/templates/webapp-ecs-dotnet/apps/api/Api.csproj +1 -1
  16. package/dist/templates/webapp-ecs-postgres-dotnet/apps/api/Api.csproj +1 -1
  17. package/dist/templates/webapp-lambda-dotnet/apps/api/Api.csproj +1 -1
  18. package/dist/templates/webapp-lambda-dotnet/apps/api/aws-lambda-tools-defaults.json +1 -1
  19. package/dist/templates/webapp-lambda-dotnet/cdk/app.ts.tmpl +1 -1
  20. package/dist/templates/webapp-lambda-dynamo-dotnet/apps/api/Api.csproj +1 -1
  21. package/dist/templates/webapp-lambda-dynamo-dotnet/apps/api/aws-lambda-tools-defaults.json +1 -1
  22. package/dist/templates/webapp-lambda-dynamo-dotnet/cdk/app.ts.tmpl +1 -1
  23. package/dist/templates/webapp-lambda-dynamo-node/apps/api/index.ts +7 -3
  24. package/dist/templates/webapp-lambda-dynamo-node/apps/api/package.json +1 -1
  25. package/dist/templates/webapp-lambda-dynamo-node/cdk/app.ts.tmpl +1 -1
  26. package/dist/templates/webapp-lambda-node/apps/api/index.ts +7 -3
  27. package/dist/templates/webapp-lambda-node/apps/api/package.json +1 -1
  28. package/dist/templates/webapp-lambda-node/cdk/app.ts.tmpl +1 -1
  29. package/dist/templates/webapp-lambda-postgres-dotnet/apps/api/Api.csproj +1 -1
  30. package/dist/templates/webapp-lambda-postgres-dotnet/apps/api/aws-lambda-tools-defaults.json +1 -1
  31. package/dist/templates/webapp-lambda-postgres-dotnet/cdk/app.ts.tmpl +1 -1
  32. package/dist/templates/webapp-lambda-postgres-node/apps/api/index.ts +7 -3
  33. package/dist/templates/webapp-lambda-postgres-node/apps/api/package.json +1 -1
  34. package/dist/templates/webapp-lambda-postgres-node/cdk/app.ts.tmpl +1 -1
  35. package/package.json +3 -3
@@ -2,7 +2,7 @@
2
2
  <!-- ABOUTME: Uses AOT-compatible serialization for Lambda runtime -->
3
3
  <Project Sdk="Microsoft.NET.Sdk.Web">
4
4
  <PropertyGroup>
5
- <TargetFramework>net8.0</TargetFramework>
5
+ <TargetFramework>net9.0</TargetFramework>
6
6
  <Nullable>enable</Nullable>
7
7
  <ImplicitUsings>enable</ImplicitUsings>
8
8
  <OutputType>Exe</OutputType>
@@ -3,7 +3,7 @@
3
3
  "profile": "",
4
4
  "region": "",
5
5
  "configuration": "Release",
6
- "function-runtime": "dotnet8",
6
+ "function-runtime": "dotnet9",
7
7
  "function-memory-size": 256,
8
8
  "function-timeout": 30,
9
9
  "function-handler": "Api"
@@ -2,7 +2,7 @@
2
2
  <!-- ABOUTME: Includes Npgsql and AWS SDK for database connectivity -->
3
3
  <Project Sdk="Microsoft.NET.Sdk.Web">
4
4
  <PropertyGroup>
5
- <TargetFramework>net8.0</TargetFramework>
5
+ <TargetFramework>net9.0</TargetFramework>
6
6
  <Nullable>enable</Nullable>
7
7
  <ImplicitUsings>enable</ImplicitUsings>
8
8
  <OutputType>Exe</OutputType>
@@ -3,7 +3,7 @@
3
3
  "profile": "",
4
4
  "region": "",
5
5
  "configuration": "Release",
6
- "function-runtime": "dotnet8",
6
+ "function-runtime": "dotnet9",
7
7
  "function-memory-size": 256,
8
8
  "function-timeout": 30,
9
9
  "function-handler": "Api"
@@ -39,15 +39,19 @@
39
39
  * by the CDK construct when a database is attached to the stack.
40
40
  */
41
41
 
42
- import type { APIGWV1Payload } from '@phila/philaroute/dist/aws';
43
- import type { RestAccumulator } from '@phila/philaroute/dist/types';
44
- import { Router, http, validate } from '@phila/philaroute';
42
+ import {
43
+ Router,
44
+ http,
45
+ validate,
46
+ type APIGWV1Payload,
47
+ type RestAccumulator,
48
+ } from '@phila/philaroute';
45
49
 
46
50
  const router = Router({
47
51
  cors: {
48
52
  'Access-Control-Allow-Origin': '*',
49
53
  'Access-Control-Allow-Method': 'GET,POST,PUT,DELETE,OPTIONS',
50
- 'Access-Control-Allow-Headers': 'Content-Type,Authorization',
54
+ 'Access-Control-Allow-Headers': 'Content-Type,Authorization,x-api-key',
51
55
  },
52
56
  });
53
57
 
@@ -67,6 +71,13 @@ const hello = {
67
71
  };
68
72
 
69
73
  const items = {
74
+ list: async (acc: RestAccumulator) => {
75
+ acc.data.items = [
76
+ { id: '1', name: 'Example Item 1' },
77
+ { id: '2', name: 'Example Item 2' },
78
+ ];
79
+ return acc;
80
+ },
70
81
  create: async (acc: RestAccumulator) => {
71
82
  acc.data.item = { id: '123', ...acc.data.valid.body };
72
83
  acc.data.message = 'Item created';
@@ -77,13 +88,19 @@ const items = {
77
88
  // Route definitions
78
89
  // The router automatically responds with 200 and acc.data as body.
79
90
  // Use http.response({ statusCode }) only when overriding (e.g., 201 for POST).
91
+ //
92
+ // Routes under /public/* require no authentication
93
+ // Routes under /private/key/* require API key authentication
94
+ // API key is stored in Secrets Manager - check Parameter Store for secret ARN
80
95
 
81
- router.path('/health').get([health.check]);
82
-
83
- router.path('/hello').get([validate.parameters(['name']), hello.greet]);
96
+ // Public routes - no authentication required
97
+ router.path('/public/health').get([health.check]);
98
+ router.path('/public/hello').get([validate.parameters(['name']), hello.greet]);
84
99
 
100
+ // Protected routes - API key required
101
+ router.path('/private/key/items').get([items.list]);
85
102
  router
86
- .path('/items')
103
+ .path('/private/key/items')
87
104
  .post([validate.body({ name: 'string' }), items.create, http.response({ statusCode: 201 })]);
88
105
 
89
106
  export const handler = async (event: APIGWV1Payload) => router.routeToPath(event);
@@ -8,7 +8,7 @@
8
8
  "watch": "{{execCommand}} tsc -w"
9
9
  },
10
10
  "dependencies": {
11
- "@phila/philaroute": "^1.0.12",
11
+ "@phila/philaroute": "^1.0.14",
12
12
  "@types/aws-lambda": "^8.10.0"
13
13
  },
14
14
  "devDependencies": {
@@ -41,7 +41,7 @@ const stack = new Stack(app, '{{appName}}-' + environment, {
41
41
  new LambdaApi(stack as any, '{{appName}}Api', {
42
42
  ...context,
43
43
  apiId: 'main',
44
- runtime: 'nodejs20',
44
+ runtime: 'nodejs22',
45
45
  handler: 'index.handler',
46
46
  codeDir: '../apps/{{lambdaName}}',
47
47
  });
@@ -8,9 +8,13 @@
8
8
  * DynamoDB integration using AWS SDK v3 DocumentClient
9
9
  */
10
10
 
11
- import type { APIGWV1Payload } from '@phila/philaroute/dist/aws';
12
- import type { RestAccumulator } from '@phila/philaroute/dist/types';
13
- import { Router, http, validate } from '@phila/philaroute';
11
+ import {
12
+ Router,
13
+ http,
14
+ validate,
15
+ type APIGWV1Payload,
16
+ type RestAccumulator,
17
+ } from '@phila/philaroute';
14
18
  import { DynamoDBClient } from '@aws-sdk/client-dynamodb';
15
19
  import {
16
20
  DynamoDBDocumentClient,
@@ -8,7 +8,7 @@
8
8
  "watch": "{{execCommand}} tsc -w"
9
9
  },
10
10
  "dependencies": {
11
- "@phila/philaroute": "^1.0.12",
11
+ "@phila/philaroute": "^1.0.14",
12
12
  "@aws-sdk/client-dynamodb": "^3.0.0",
13
13
  "@aws-sdk/lib-dynamodb": "^3.0.0",
14
14
  "@types/aws-lambda": "^8.10.0"
@@ -41,7 +41,7 @@ const stack = new Stack(app, '{{appName}}-' + environment, {
41
41
  new LambdaDynamoApi(stack as any, '{{appName}}Api', {
42
42
  ...context,
43
43
  apiId: 'main',
44
- runtime: 'nodejs20',
44
+ runtime: 'nodejs22',
45
45
  handler: 'index.handler',
46
46
  codeDir: '../apps/{{lambdaName}}',
47
47
  // DynamoDB table configuration
@@ -208,7 +208,7 @@ To use Aurora Serverless v2 instead of provisioned RDS, edit `cdk/app.ts`:
208
208
  new LambdaPostgresApi(stack as any, '{{appName}}Api', {
209
209
  ...context,
210
210
  apiId: 'main',
211
- runtime: 'nodejs20',
211
+ runtime: 'nodejs22',
212
212
  handler: 'index.handler',
213
213
  codeDir: '../apps/{{lambdaName}}',
214
214
  serverless: true, // Use Aurora Serverless v2
@@ -12,9 +12,13 @@
12
12
  * by the CDK construct.
13
13
  */
14
14
 
15
- import type { APIGWV1Payload } from '@phila/philaroute/dist/aws';
16
- import type { RestAccumulator } from '@phila/philaroute/dist/types';
17
- import { Router, http, validate } from '@phila/philaroute';
15
+ import {
16
+ Router,
17
+ http,
18
+ validate,
19
+ type APIGWV1Payload,
20
+ type RestAccumulator,
21
+ } from '@phila/philaroute';
18
22
  import { getPool } from '@phila/db-postgres';
19
23
 
20
24
  const router = Router({
@@ -8,7 +8,7 @@
8
8
  "watch": "{{execCommand}} tsc -w"
9
9
  },
10
10
  "dependencies": {
11
- "@phila/philaroute": "^1.0.12",
11
+ "@phila/philaroute": "^1.0.14",
12
12
  "@phila/db-postgres": "^{{dbPostgresVersion}}",
13
13
  "@types/aws-lambda": "^8.10.0"
14
14
  },
@@ -41,7 +41,7 @@ const stack = new Stack(app, '{{appName}}-' + environment, {
41
41
  new LambdaPostgresApi(stack as any, '{{appName}}Api', {
42
42
  ...context,
43
43
  apiId: 'main',
44
- runtime: 'nodejs20',
44
+ runtime: 'nodejs22',
45
45
  handler: 'index.handler',
46
46
  codeDir: '../apps/{{lambdaName}}',
47
47
  // Uncomment for serverless Aurora instead of provisioned RDS:
@@ -2,7 +2,7 @@
2
2
  <!-- ABOUTME: Standard web application hosted on Kestrel server -->
3
3
  <Project Sdk="Microsoft.NET.Sdk.Web">
4
4
  <PropertyGroup>
5
- <TargetFramework>net8.0</TargetFramework>
5
+ <TargetFramework>net9.0</TargetFramework>
6
6
  <Nullable>enable</Nullable>
7
7
  <ImplicitUsings>enable</ImplicitUsings>
8
8
  <OutputType>Exe</OutputType>
@@ -2,7 +2,7 @@
2
2
  <!-- ABOUTME: Uses Npgsql for database access and AWS SDK for Secrets Manager -->
3
3
  <Project Sdk="Microsoft.NET.Sdk.Web">
4
4
  <PropertyGroup>
5
- <TargetFramework>net8.0</TargetFramework>
5
+ <TargetFramework>net9.0</TargetFramework>
6
6
  <Nullable>enable</Nullable>
7
7
  <ImplicitUsings>enable</ImplicitUsings>
8
8
  <OutputType>Exe</OutputType>
@@ -2,7 +2,7 @@
2
2
  <!-- ABOUTME: Uses AOT-compatible serialization for Lambda runtime -->
3
3
  <Project Sdk="Microsoft.NET.Sdk.Web">
4
4
  <PropertyGroup>
5
- <TargetFramework>net8.0</TargetFramework>
5
+ <TargetFramework>net9.0</TargetFramework>
6
6
  <Nullable>enable</Nullable>
7
7
  <ImplicitUsings>enable</ImplicitUsings>
8
8
  <OutputType>Exe</OutputType>
@@ -3,7 +3,7 @@
3
3
  "profile": "",
4
4
  "region": "",
5
5
  "configuration": "Release",
6
- "function-runtime": "dotnet8",
6
+ "function-runtime": "dotnet9",
7
7
  "function-memory-size": 256,
8
8
  "function-timeout": 30,
9
9
  "function-handler": "Api"
@@ -46,7 +46,7 @@ new StaticSite(stack as any, '{{appName}}Site', {
46
46
  new LambdaApi(stack as any, '{{appName}}Api', {
47
47
  ...context,
48
48
  apiId: 'api',
49
- runtime: 'dotnet8',
49
+ runtime: 'dotnet9',
50
50
  handler: 'Api',
51
51
  codeDir: '../apps/api',
52
52
  });
@@ -2,7 +2,7 @@
2
2
  <!-- ABOUTME: Uses AWS SDK for DynamoDB Document Model API -->
3
3
  <Project Sdk="Microsoft.NET.Sdk.Web">
4
4
  <PropertyGroup>
5
- <TargetFramework>net8.0</TargetFramework>
5
+ <TargetFramework>net9.0</TargetFramework>
6
6
  <Nullable>enable</Nullable>
7
7
  <ImplicitUsings>enable</ImplicitUsings>
8
8
  <OutputType>Exe</OutputType>
@@ -3,7 +3,7 @@
3
3
  "profile": "",
4
4
  "region": "",
5
5
  "configuration": "Release",
6
- "function-runtime": "dotnet8",
6
+ "function-runtime": "dotnet9",
7
7
  "function-memory-size": 256,
8
8
  "function-timeout": 30,
9
9
  "function-handler": "Api"
@@ -46,7 +46,7 @@ new StaticSite(stack as any, '{{appName}}Site', {
46
46
  new LambdaDynamoApi(stack as any, '{{appName}}Api', {
47
47
  ...context,
48
48
  apiId: 'api',
49
- runtime: 'dotnet8',
49
+ runtime: 'dotnet9',
50
50
  handler: 'Api',
51
51
  codeDir: '../apps/api',
52
52
  // DynamoDB table configuration
@@ -8,9 +8,13 @@
8
8
  * DynamoDB integration using AWS SDK v3 DocumentClient
9
9
  */
10
10
 
11
- import type { APIGWV1Payload } from '@phila/philaroute/dist/aws';
12
- import type { RestAccumulator } from '@phila/philaroute/dist/types';
13
- import { Router, http, validate } from '@phila/philaroute';
11
+ import {
12
+ Router,
13
+ http,
14
+ validate,
15
+ type APIGWV1Payload,
16
+ type RestAccumulator,
17
+ } from '@phila/philaroute';
14
18
  import { DynamoDBClient } from '@aws-sdk/client-dynamodb';
15
19
  import {
16
20
  DynamoDBDocumentClient,
@@ -8,7 +8,7 @@
8
8
  "watch": "tsc -w"
9
9
  },
10
10
  "dependencies": {
11
- "@phila/philaroute": "^1.0.12",
11
+ "@phila/philaroute": "^1.0.14",
12
12
  "@aws-sdk/client-dynamodb": "^3.0.0",
13
13
  "@aws-sdk/lib-dynamodb": "^3.0.0",
14
14
  "@types/aws-lambda": "^8.10.0"
@@ -46,7 +46,7 @@ new StaticSite(stack as any, '{{appName}}Site', {
46
46
  new LambdaDynamoApi(stack as any, '{{appName}}Api', {
47
47
  ...context,
48
48
  apiId: 'api',
49
- runtime: 'nodejs20',
49
+ runtime: 'nodejs22',
50
50
  handler: 'index.handler',
51
51
  codeDir: '../apps/api',
52
52
  // DynamoDB table configuration
@@ -39,9 +39,13 @@
39
39
  * by the CDK construct when a database is attached to the stack.
40
40
  */
41
41
 
42
- import type { APIGWV1Payload } from '@phila/philaroute/dist/aws';
43
- import type { RestAccumulator } from '@phila/philaroute/dist/types';
44
- import { Router, http, validate } from '@phila/philaroute';
42
+ import {
43
+ Router,
44
+ http,
45
+ validate,
46
+ type APIGWV1Payload,
47
+ type RestAccumulator,
48
+ } from '@phila/philaroute';
45
49
 
46
50
  const router = Router({
47
51
  cors: {
@@ -8,7 +8,7 @@
8
8
  "watch": "tsc -w"
9
9
  },
10
10
  "dependencies": {
11
- "@phila/philaroute": "^1.0.12",
11
+ "@phila/philaroute": "^1.0.14",
12
12
  "@types/aws-lambda": "^8.10.0"
13
13
  },
14
14
  "devDependencies": {
@@ -46,7 +46,7 @@ new StaticSite(stack as any, '{{appName}}Site', {
46
46
  new LambdaApi(stack as any, '{{appName}}Api', {
47
47
  ...context,
48
48
  apiId: 'api',
49
- runtime: 'nodejs20',
49
+ runtime: 'nodejs22',
50
50
  handler: 'index.handler',
51
51
  codeDir: '../apps/api',
52
52
  });
@@ -2,7 +2,7 @@
2
2
  <!-- ABOUTME: Includes Npgsql and AWS SDK for database connectivity -->
3
3
  <Project Sdk="Microsoft.NET.Sdk.Web">
4
4
  <PropertyGroup>
5
- <TargetFramework>net8.0</TargetFramework>
5
+ <TargetFramework>net9.0</TargetFramework>
6
6
  <Nullable>enable</Nullable>
7
7
  <ImplicitUsings>enable</ImplicitUsings>
8
8
  <OutputType>Exe</OutputType>
@@ -3,7 +3,7 @@
3
3
  "profile": "",
4
4
  "region": "",
5
5
  "configuration": "Release",
6
- "function-runtime": "dotnet8",
6
+ "function-runtime": "dotnet9",
7
7
  "function-memory-size": 256,
8
8
  "function-timeout": 30,
9
9
  "function-handler": "Api"
@@ -46,7 +46,7 @@ new StaticSite(stack as any, '{{appName}}Site', {
46
46
  new LambdaPostgresApi(stack as any, '{{appName}}Api', {
47
47
  ...context,
48
48
  apiId: 'api',
49
- runtime: 'dotnet8',
49
+ runtime: 'dotnet9',
50
50
  handler: 'Api',
51
51
  codeDir: '../apps/api',
52
52
  // Uncomment for serverless Aurora instead of provisioned RDS:
@@ -12,9 +12,13 @@
12
12
  * by the CDK construct.
13
13
  */
14
14
 
15
- import type { APIGWV1Payload } from '@phila/philaroute/dist/aws';
16
- import type { RestAccumulator } from '@phila/philaroute/dist/types';
17
- import { Router, http, validate } from '@phila/philaroute';
15
+ import {
16
+ Router,
17
+ http,
18
+ validate,
19
+ type APIGWV1Payload,
20
+ type RestAccumulator,
21
+ } from '@phila/philaroute';
18
22
  import { getPool } from '@phila/db-postgres';
19
23
 
20
24
  const router = Router({
@@ -8,7 +8,7 @@
8
8
  "watch": "tsc -w"
9
9
  },
10
10
  "dependencies": {
11
- "@phila/philaroute": "^1.0.12",
11
+ "@phila/philaroute": "^1.0.14",
12
12
  "@phila/db-postgres": "^{{dbPostgresVersion}}",
13
13
  "@types/aws-lambda": "^8.10.0"
14
14
  },
@@ -46,7 +46,7 @@ new StaticSite(stack as any, '{{appName}}Site', {
46
46
  new LambdaPostgresApi(stack as any, '{{appName}}Api', {
47
47
  ...context,
48
48
  apiId: 'api',
49
- runtime: 'nodejs20',
49
+ runtime: 'nodejs22',
50
50
  handler: 'index.handler',
51
51
  codeDir: '../apps/api',
52
52
  // Uncomment for serverless Aurora instead of provisioned RDS:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phila/cli",
3
- "version": "0.0.13",
3
+ "version": "0.0.15",
4
4
  "description": "CLI tool for City of Philadelphia AWS infrastructure",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -24,8 +24,8 @@
24
24
  "commander": "^11.0.0",
25
25
  "fs-extra": "^11.1.0",
26
26
  "inquirer": "^8.2.5",
27
- "@phila/constructs": "0.0.6",
28
- "@phila/db-postgres": "0.0.5"
27
+ "@phila/constructs": "0.0.8",
28
+ "@phila/db-postgres": "0.0.6"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/fs-extra": "^11.0.0",