@friggframework/devtools 2.0.0--canary.461.2db86ce.0 → 2.0.0--canary.461.cdfbcf7.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.
- package/infrastructure/domains/database/aurora-builder.js +8 -2
- package/infrastructure/domains/database/aurora-builder.test.js +6 -9
- package/infrastructure/domains/database/migration-builder.js +3 -2
- package/infrastructure/domains/database/migration-builder.test.js +2 -2
- package/infrastructure/domains/shared/utilities/base-definition-factory.js +4 -3
- package/infrastructure/domains/shared/utilities/base-definition-factory.test.js +14 -0
- package/package.json +6 -6
|
@@ -156,7 +156,10 @@ class AuroraBuilder extends InfrastructureBuilder {
|
|
|
156
156
|
SecretStringTemplate: JSON.stringify({ username: dbConfig.username || 'postgres' }),
|
|
157
157
|
GenerateStringKey: 'password',
|
|
158
158
|
PasswordLength: 32,
|
|
159
|
-
|
|
159
|
+
// Exclude URL-special characters for Prisma connection string compatibility
|
|
160
|
+
// Prisma docs: https://www.prisma.io/docs/reference/database-reference/connection-urls#special-characters
|
|
161
|
+
// Exclude: " @ : / ? # [ ] % \ (all have special meaning in URLs or need escaping)
|
|
162
|
+
ExcludeCharacters: '"@:/?#[]%\\\\',
|
|
160
163
|
},
|
|
161
164
|
Tags: [
|
|
162
165
|
{ Key: 'Name', Value: '${self:service}-${self:provider.stage}-db-secret' },
|
|
@@ -288,7 +291,10 @@ class AuroraBuilder extends InfrastructureBuilder {
|
|
|
288
291
|
SecretStringTemplate: JSON.stringify({ username: dbConfig.username || 'postgres' }),
|
|
289
292
|
GenerateStringKey: 'password',
|
|
290
293
|
PasswordLength: 32,
|
|
291
|
-
|
|
294
|
+
// Exclude URL-special characters for Prisma connection string compatibility
|
|
295
|
+
// Prisma docs: https://www.prisma.io/docs/reference/database-reference/connection-urls#special-characters
|
|
296
|
+
// Exclude: " @ : / ? # [ ] % \ (all have special meaning in URLs or need escaping)
|
|
297
|
+
ExcludeCharacters: '"@:/?#[]%\\\\',
|
|
292
298
|
},
|
|
293
299
|
Tags: [
|
|
294
300
|
{ Key: 'Name', Value: '${self:service}-${self:provider.stage}-db-secret' },
|
|
@@ -572,7 +572,7 @@ describe('AuroraBuilder', () => {
|
|
|
572
572
|
expect(jsonOutput).not.toContain('[object Object]');
|
|
573
573
|
});
|
|
574
574
|
|
|
575
|
-
it('should
|
|
575
|
+
it('should exclude URL-special characters from password generation for Prisma compatibility', async () => {
|
|
576
576
|
const appDefinition = {
|
|
577
577
|
database: {
|
|
578
578
|
postgres: {
|
|
@@ -592,17 +592,14 @@ describe('AuroraBuilder', () => {
|
|
|
592
592
|
|
|
593
593
|
const excludeChars = result.resources.FriggDBSecret.Properties.GenerateSecretString.ExcludeCharacters;
|
|
594
594
|
|
|
595
|
-
//
|
|
596
|
-
//
|
|
597
|
-
//
|
|
598
|
-
|
|
595
|
+
// Must exclude URL-special characters that would break Prisma connection strings
|
|
596
|
+
// Prisma docs: https://www.prisma.io/docs/reference/database-reference/connection-urls#special-characters
|
|
597
|
+
// These characters have special meaning in URLs and must be excluded or the password must be URL-encoded
|
|
598
|
+
// Exclude: " @ : / ? # [ ] % (and \ for JSON escaping)
|
|
599
|
+
expect(excludeChars).toBe('"@:/?#[]%\\\\');
|
|
599
600
|
|
|
600
601
|
// Verify it can be JSON-stringified without errors
|
|
601
602
|
expect(() => JSON.stringify(result.resources.FriggDBSecret)).not.toThrow();
|
|
602
|
-
|
|
603
|
-
// Verify the JSON output has the correct escape sequence
|
|
604
|
-
const jsonOutput = JSON.stringify(result.resources.FriggDBSecret);
|
|
605
|
-
expect(jsonOutput).toContain('\\"@/\\\\\\\\'); // In JSON string: "\"@/\\\\"
|
|
606
603
|
});
|
|
607
604
|
});
|
|
608
605
|
});
|
|
@@ -108,8 +108,9 @@ class MigrationBuilder extends InfrastructureBuilder {
|
|
|
108
108
|
'**/libquery_engine-darwin*',
|
|
109
109
|
'**/*-darwin-arm64*',
|
|
110
110
|
'**/*-darwin*',
|
|
111
|
-
|
|
112
|
-
'
|
|
111
|
+
// Exclude WASM engines (but keep Prisma CLI WASM files in build/)
|
|
112
|
+
'**/runtime/*.wasm', // Exclude query engine WASM (unused with binary engines)
|
|
113
|
+
// DO NOT exclude **/*.wasm* - Prisma CLI needs build/*.wasm files!
|
|
113
114
|
'src/**',
|
|
114
115
|
'test/**',
|
|
115
116
|
'layers/**',
|
|
@@ -186,7 +186,7 @@ describe('MigrationBuilder', () => {
|
|
|
186
186
|
// Both migration functions should have the same package config
|
|
187
187
|
expect(result.functions.dbMigrationWorker.package).toBeDefined();
|
|
188
188
|
expect(result.functions.dbMigrationRouter.package).toBeDefined();
|
|
189
|
-
|
|
189
|
+
|
|
190
190
|
// They should share the same config object (migrationPackageConfig)
|
|
191
191
|
expect(result.functions.dbMigrationWorker.package).toBe(result.functions.dbMigrationRouter.package);
|
|
192
192
|
|
|
@@ -194,7 +194,7 @@ describe('MigrationBuilder', () => {
|
|
|
194
194
|
const packageConfig = result.functions.dbMigrationWorker.package;
|
|
195
195
|
expect(packageConfig.individually).toBe(true);
|
|
196
196
|
expect(Array.isArray(packageConfig.exclude)).toBe(true);
|
|
197
|
-
|
|
197
|
+
|
|
198
198
|
// Critical exclusions to prevent Lambda size limit errors
|
|
199
199
|
expect(packageConfig.exclude).toContain('test/**');
|
|
200
200
|
expect(packageConfig.exclude).toContain('**/*.test.js');
|
|
@@ -333,9 +333,10 @@ function createBaseDefinition(
|
|
|
333
333
|
'**/*-darwin-arm64*',
|
|
334
334
|
'**/*-darwin*',
|
|
335
335
|
|
|
336
|
-
// Exclude WASM engines
|
|
337
|
-
|
|
338
|
-
'
|
|
336
|
+
// Exclude WASM engines (but keep Prisma CLI WASM files in build/)
|
|
337
|
+
// Note: Prisma CLI needs prisma/build/prisma_schema_build_bg.wasm for migrations
|
|
338
|
+
'**/runtime/*.wasm', // Exclude query engine WASM (unused with binary engines)
|
|
339
|
+
// DO NOT exclude **/*.wasm* - Prisma CLI needs build/*.wasm files!
|
|
339
340
|
|
|
340
341
|
// Exclude backend source (dbMigrate doesn't need it)
|
|
341
342
|
'src/**', // OK to exclude for migration handler only
|
|
@@ -106,6 +106,20 @@ describe('Base Definition Factory', () => {
|
|
|
106
106
|
expect(result.functions.dbMigrate.layers).toBeUndefined(); // No Prisma layer
|
|
107
107
|
});
|
|
108
108
|
|
|
109
|
+
it('should NOT exclude Prisma CLI WASM files from dbMigrate function', () => {
|
|
110
|
+
const result = createBaseDefinition({}, {}, {});
|
|
111
|
+
|
|
112
|
+
const excludeList = result.functions.dbMigrate.package.exclude;
|
|
113
|
+
|
|
114
|
+
// Should exclude WASM files from runtime/ (query engine WASM)
|
|
115
|
+
expect(excludeList).toContain('**/runtime/*.wasm');
|
|
116
|
+
|
|
117
|
+
// But should NOT exclude build/*.wasm files (Prisma CLI needs prisma_schema_build_bg.wasm)
|
|
118
|
+
expect(excludeList).not.toContain('**/*.wasm*');
|
|
119
|
+
expect(excludeList).not.toContain('**/*.wasm');
|
|
120
|
+
expect(excludeList).not.toContain('**/build/*.wasm');
|
|
121
|
+
});
|
|
122
|
+
|
|
109
123
|
it('should include Prisma Lambda Layer', () => {
|
|
110
124
|
const result = createBaseDefinition({}, {}, {});
|
|
111
125
|
|
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.
|
|
4
|
+
"version": "2.0.0--canary.461.cdfbcf7.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.
|
|
15
|
-
"@friggframework/test": "2.0.0--canary.461.
|
|
14
|
+
"@friggframework/schemas": "2.0.0--canary.461.cdfbcf7.0",
|
|
15
|
+
"@friggframework/test": "2.0.0--canary.461.cdfbcf7.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.
|
|
38
|
-
"@friggframework/prettier-config": "2.0.0--canary.461.
|
|
37
|
+
"@friggframework/eslint-config": "2.0.0--canary.461.cdfbcf7.0",
|
|
38
|
+
"@friggframework/prettier-config": "2.0.0--canary.461.cdfbcf7.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": "
|
|
73
|
+
"gitHead": "cdfbcf7ed07ca84840c56a33d30d39a6c6b20628"
|
|
74
74
|
}
|