@friggframework/devtools 2.0.0--canary.461.4066059.0 → 2.0.0--canary.461.c53515a.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.
@@ -96,8 +96,14 @@ async function gatherDiscoveredResources(appDefinition) {
96
96
  console.log(' ℹ Isolated mode: discovering KMS (shareable) but not VPC/Aurora (isolated)');
97
97
 
98
98
  // Still run KMS discovery - encryption keys are safe to share
99
+ // Pass serviceName and stage to search for stage-specific alias
99
100
  const kmsDiscovery = new KmsDiscovery(provider);
100
- const kmsResult = await kmsDiscovery.discover();
101
+ const kmsConfig = {
102
+ serviceName: appDefinition.name || 'create-frigg-app',
103
+ stage,
104
+ keyAlias: `alias/${appDefinition.name || 'create-frigg-app'}-${stage}-frigg-kms`,
105
+ };
106
+ const kmsResult = await kmsDiscovery.discover(kmsConfig);
101
107
 
102
108
  if (kmsResult?.defaultKmsKeyId) {
103
109
  console.log(' ✓ Found shared KMS key (can be reused across stages)');
@@ -105,7 +111,7 @@ async function gatherDiscoveredResources(appDefinition) {
105
111
  return kmsResult;
106
112
  }
107
113
 
108
- console.log(' ℹ No existing resources found - will create fresh infrastructure');
114
+ console.log(' ℹ No existing KMS key found - will create new one');
109
115
  console.log('✅ Cloud resource discovery completed successfully!');
110
116
  return {};
111
117
  }
@@ -0,0 +1,101 @@
1
+ /**
2
+ * Tests for Prisma Lambda Layer Builder
3
+ * Validates database client selection logic
4
+ */
5
+
6
+ const { getGeneratedClientPackages } = require('./build-prisma-layer');
7
+
8
+ // Mock the log function
9
+ jest.mock('./build-prisma-layer', () => {
10
+ const actual = jest.requireActual('./build-prisma-layer');
11
+ return {
12
+ ...actual,
13
+ getGeneratedClientPackages: actual.getGeneratedClientPackages,
14
+ };
15
+ });
16
+
17
+ describe('getGeneratedClientPackages()', () => {
18
+ it('should include MongoDB client when mongoDB.enable is true', () => {
19
+ const databaseConfig = {
20
+ mongoDB: { enable: true },
21
+ };
22
+
23
+ const packages = getGeneratedClientPackages(databaseConfig);
24
+
25
+ expect(packages).toContain('generated/prisma-mongodb');
26
+ });
27
+
28
+ it('should include MongoDB client when documentDB.enable is true', () => {
29
+ const databaseConfig = {
30
+ documentDB: { enable: true },
31
+ };
32
+
33
+ const packages = getGeneratedClientPackages(databaseConfig);
34
+
35
+ expect(packages).toContain('generated/prisma-mongodb');
36
+ });
37
+
38
+ it('should include PostgreSQL client when postgres.enable is true', () => {
39
+ const databaseConfig = {
40
+ postgres: { enable: true },
41
+ };
42
+
43
+ const packages = getGeneratedClientPackages(databaseConfig);
44
+
45
+ expect(packages).toContain('generated/prisma-postgresql');
46
+ });
47
+
48
+ it('should include both clients when both databases are enabled', () => {
49
+ const databaseConfig = {
50
+ mongoDB: { enable: true },
51
+ postgres: { enable: true },
52
+ };
53
+
54
+ const packages = getGeneratedClientPackages(databaseConfig);
55
+
56
+ expect(packages).toContain('generated/prisma-mongodb');
57
+ expect(packages).toContain('generated/prisma-postgresql');
58
+ expect(packages).toHaveLength(2);
59
+ });
60
+
61
+ it('should include both clients when documentDB and postgres are enabled', () => {
62
+ const databaseConfig = {
63
+ documentDB: { enable: true },
64
+ postgres: { enable: true },
65
+ };
66
+
67
+ const packages = getGeneratedClientPackages(databaseConfig);
68
+
69
+ expect(packages).toContain('generated/prisma-mongodb');
70
+ expect(packages).toContain('generated/prisma-postgresql');
71
+ expect(packages).toHaveLength(2);
72
+ });
73
+
74
+ it('should default to PostgreSQL when no database config provided', () => {
75
+ const packages = getGeneratedClientPackages({});
76
+
77
+ expect(packages).toContain('generated/prisma-postgresql');
78
+ expect(packages).toHaveLength(1);
79
+ });
80
+
81
+ it('should default to PostgreSQL when database config is null', () => {
82
+ const packages = getGeneratedClientPackages(null);
83
+
84
+ expect(packages).toContain('generated/prisma-postgresql');
85
+ expect(packages).toHaveLength(1);
86
+ });
87
+
88
+ it('should only include MongoDB when postgres.enable is false and mongoDB is true', () => {
89
+ const databaseConfig = {
90
+ mongoDB: { enable: true },
91
+ postgres: { enable: false },
92
+ };
93
+
94
+ const packages = getGeneratedClientPackages(databaseConfig);
95
+
96
+ expect(packages).toContain('generated/prisma-mongodb');
97
+ expect(packages).not.toContain('generated/prisma-postgresql');
98
+ expect(packages).toHaveLength(1);
99
+ });
100
+ });
101
+
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@friggframework/devtools",
3
3
  "prettier": "@friggframework/prettier-config",
4
- "version": "2.0.0--canary.461.4066059.0",
4
+ "version": "2.0.0--canary.461.c53515a.0",
5
5
  "dependencies": {
6
6
  "@aws-sdk/client-ec2": "^3.835.0",
7
7
  "@aws-sdk/client-kms": "^3.835.0",
@@ -11,8 +11,8 @@
11
11
  "@babel/eslint-parser": "^7.18.9",
12
12
  "@babel/parser": "^7.25.3",
13
13
  "@babel/traverse": "^7.25.3",
14
- "@friggframework/schemas": "2.0.0--canary.461.4066059.0",
15
- "@friggframework/test": "2.0.0--canary.461.4066059.0",
14
+ "@friggframework/schemas": "2.0.0--canary.461.c53515a.0",
15
+ "@friggframework/test": "2.0.0--canary.461.c53515a.0",
16
16
  "@hapi/boom": "^10.0.1",
17
17
  "@inquirer/prompts": "^5.3.8",
18
18
  "axios": "^1.7.2",
@@ -34,8 +34,8 @@
34
34
  "serverless-http": "^2.7.0"
35
35
  },
36
36
  "devDependencies": {
37
- "@friggframework/eslint-config": "2.0.0--canary.461.4066059.0",
38
- "@friggframework/prettier-config": "2.0.0--canary.461.4066059.0",
37
+ "@friggframework/eslint-config": "2.0.0--canary.461.c53515a.0",
38
+ "@friggframework/prettier-config": "2.0.0--canary.461.c53515a.0",
39
39
  "aws-sdk-client-mock": "^4.1.0",
40
40
  "aws-sdk-client-mock-jest": "^4.1.0",
41
41
  "jest": "^30.1.3",
@@ -70,5 +70,5 @@
70
70
  "publishConfig": {
71
71
  "access": "public"
72
72
  },
73
- "gitHead": "4066059afecf11231ca7ff94cc4483b47f5b6e74"
73
+ "gitHead": "c53515a6014c114056ebde56a8b7c08007c53908"
74
74
  }