@friggframework/devtools 2.0.0--canary.461.9de6fdd.0 → 2.0.0--canary.461.2db86ce.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.
|
@@ -388,11 +388,11 @@ describe('AuroraBuilder', () => {
|
|
|
388
388
|
// Check DATABASE_URL uses the secret
|
|
389
389
|
expect(result.environment.DATABASE_URL).toBeDefined();
|
|
390
390
|
expect(result.environment.DATABASE_URL['Fn::Sub']).toBeDefined();
|
|
391
|
-
|
|
391
|
+
|
|
392
392
|
// Username and Password should use nested Fn::Sub to resolve the Ref
|
|
393
393
|
expect(result.environment.DATABASE_URL['Fn::Sub'][1].Username['Fn::Sub']).toBeDefined();
|
|
394
394
|
expect(result.environment.DATABASE_URL['Fn::Sub'][1].Password['Fn::Sub']).toBeDefined();
|
|
395
|
-
|
|
395
|
+
|
|
396
396
|
// Should contain secretsmanager resolution
|
|
397
397
|
expect(result.environment.DATABASE_URL['Fn::Sub'][1].Username['Fn::Sub'][0]).toContain('resolve:secretsmanager');
|
|
398
398
|
expect(result.environment.DATABASE_URL['Fn::Sub'][1].Password['Fn::Sub'][0]).toContain('resolve:secretsmanager');
|
|
@@ -558,15 +558,15 @@ describe('AuroraBuilder', () => {
|
|
|
558
558
|
const result = await auroraBuilder.build(appDefinition, discoveredResources);
|
|
559
559
|
|
|
560
560
|
const dbUrl = result.environment.DATABASE_URL;
|
|
561
|
-
|
|
561
|
+
|
|
562
562
|
// Should use Fn::Sub with nested Fn::Sub to resolve the Ref
|
|
563
563
|
expect(dbUrl['Fn::Sub']).toBeDefined();
|
|
564
564
|
expect(dbUrl['Fn::Sub'][0]).toBe('postgresql://${Username}:${Password}@${Host}:${Port}/${Database}');
|
|
565
|
-
|
|
565
|
+
|
|
566
566
|
// The Username and Password should use Fn::Sub to resolve the secret Ref, not literal "[object Object]"
|
|
567
567
|
expect(dbUrl['Fn::Sub'][1].Username['Fn::Sub']).toBeDefined();
|
|
568
568
|
expect(dbUrl['Fn::Sub'][1].Password['Fn::Sub']).toBeDefined();
|
|
569
|
-
|
|
569
|
+
|
|
570
570
|
// Should not contain the literal string "[object Object]"
|
|
571
571
|
const jsonOutput = JSON.stringify(dbUrl);
|
|
572
572
|
expect(jsonOutput).not.toContain('[object Object]');
|
|
@@ -72,6 +72,61 @@ class MigrationBuilder extends InfrastructureBuilder {
|
|
|
72
72
|
|
|
73
73
|
console.log(' ✓ Created DbMigrationQueue resource');
|
|
74
74
|
|
|
75
|
+
// Package configuration for migration functions (reuse from base-definition-factory)
|
|
76
|
+
const migrationPackageConfig = {
|
|
77
|
+
individually: true,
|
|
78
|
+
exclude: [
|
|
79
|
+
// Exclude ALL nested node_modules
|
|
80
|
+
'node_modules/**/node_modules/**',
|
|
81
|
+
'node_modules/aws-sdk/**',
|
|
82
|
+
'node_modules/@aws-sdk/**',
|
|
83
|
+
'node_modules/esbuild/**',
|
|
84
|
+
'node_modules/@esbuild/**',
|
|
85
|
+
'node_modules/typescript/**',
|
|
86
|
+
'node_modules/webpack/**',
|
|
87
|
+
'node_modules/osls/**',
|
|
88
|
+
'node_modules/serverless-esbuild/**',
|
|
89
|
+
'node_modules/serverless-jetpack/**',
|
|
90
|
+
'node_modules/serverless-offline/**',
|
|
91
|
+
'node_modules/serverless-offline-sqs/**',
|
|
92
|
+
'node_modules/serverless-dotenv-plugin/**',
|
|
93
|
+
'node_modules/serverless-kms-grants/**',
|
|
94
|
+
'node_modules/@friggframework/test/**',
|
|
95
|
+
'node_modules/@friggframework/eslint-config/**',
|
|
96
|
+
'node_modules/@friggframework/prettier-config/**',
|
|
97
|
+
'node_modules/@friggframework/devtools/**',
|
|
98
|
+
'node_modules/@friggframework/serverless-plugin/**',
|
|
99
|
+
'node_modules/jest/**',
|
|
100
|
+
'node_modules/prettier/**',
|
|
101
|
+
'node_modules/eslint/**',
|
|
102
|
+
'node_modules/@friggframework/core/generated/prisma-mongodb/**',
|
|
103
|
+
'node_modules/@friggframework/core/integrations/**',
|
|
104
|
+
'node_modules/@friggframework/core/user/**',
|
|
105
|
+
'node_modules/@friggframework/core/handlers/routers/**',
|
|
106
|
+
'**/query-engine-darwin*',
|
|
107
|
+
'**/schema-engine-darwin*',
|
|
108
|
+
'**/libquery_engine-darwin*',
|
|
109
|
+
'**/*-darwin-arm64*',
|
|
110
|
+
'**/*-darwin*',
|
|
111
|
+
'**/runtime/*.wasm',
|
|
112
|
+
'**/*.wasm*',
|
|
113
|
+
'src/**',
|
|
114
|
+
'test/**',
|
|
115
|
+
'layers/**',
|
|
116
|
+
'coverage/**',
|
|
117
|
+
'deploy.log',
|
|
118
|
+
'.env.backup',
|
|
119
|
+
'docker-compose.yml',
|
|
120
|
+
'jest.config.js',
|
|
121
|
+
'jest.unit.config.js',
|
|
122
|
+
'package-lock.json',
|
|
123
|
+
'**/*.test.js',
|
|
124
|
+
'**/*.spec.js',
|
|
125
|
+
'**/.claude-flow/**',
|
|
126
|
+
'**/.swarm/**',
|
|
127
|
+
],
|
|
128
|
+
};
|
|
129
|
+
|
|
75
130
|
// Create migration worker Lambda (triggered by SQS)
|
|
76
131
|
result.functions.dbMigrationWorker = {
|
|
77
132
|
handler: 'node_modules/@friggframework/core/handlers/workers/db-migration.handler',
|
|
@@ -81,6 +136,7 @@ class MigrationBuilder extends InfrastructureBuilder {
|
|
|
81
136
|
memorySize: 1024, // Extra memory for Prisma operations
|
|
82
137
|
reservedConcurrency: 1, // Process one migration at a time (critical for safety)
|
|
83
138
|
description: 'Database migration worker (triggered by SQS queue)',
|
|
139
|
+
package: migrationPackageConfig,
|
|
84
140
|
events: [
|
|
85
141
|
{
|
|
86
142
|
sqs: {
|
|
@@ -101,6 +157,7 @@ class MigrationBuilder extends InfrastructureBuilder {
|
|
|
101
157
|
timeout: 30, // Router just queues jobs, doesn't run migrations
|
|
102
158
|
memorySize: 512,
|
|
103
159
|
description: 'Database migration HTTP API (POST to trigger, GET to check status)',
|
|
160
|
+
package: migrationPackageConfig,
|
|
104
161
|
events: [
|
|
105
162
|
{ httpApi: { path: '/db-migrate', method: 'POST' } },
|
|
106
163
|
{ httpApi: { path: '/db-migrate/{processId}', method: 'GET' } },
|
|
@@ -172,6 +172,39 @@ describe('MigrationBuilder', () => {
|
|
|
172
172
|
});
|
|
173
173
|
});
|
|
174
174
|
|
|
175
|
+
it('should configure package exclusions for migration functions to reduce Lambda size', async () => {
|
|
176
|
+
const appDef = {
|
|
177
|
+
database: {
|
|
178
|
+
postgres: {
|
|
179
|
+
enable: true,
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
const result = await builder.build(appDef, {});
|
|
185
|
+
|
|
186
|
+
// Both migration functions should have the same package config
|
|
187
|
+
expect(result.functions.dbMigrationWorker.package).toBeDefined();
|
|
188
|
+
expect(result.functions.dbMigrationRouter.package).toBeDefined();
|
|
189
|
+
|
|
190
|
+
// They should share the same config object (migrationPackageConfig)
|
|
191
|
+
expect(result.functions.dbMigrationWorker.package).toBe(result.functions.dbMigrationRouter.package);
|
|
192
|
+
|
|
193
|
+
// Verify the shared package config has critical exclusions for size optimization
|
|
194
|
+
const packageConfig = result.functions.dbMigrationWorker.package;
|
|
195
|
+
expect(packageConfig.individually).toBe(true);
|
|
196
|
+
expect(Array.isArray(packageConfig.exclude)).toBe(true);
|
|
197
|
+
|
|
198
|
+
// Critical exclusions to prevent Lambda size limit errors
|
|
199
|
+
expect(packageConfig.exclude).toContain('test/**');
|
|
200
|
+
expect(packageConfig.exclude).toContain('**/*.test.js');
|
|
201
|
+
expect(packageConfig.exclude).toContain('node_modules/**/node_modules/**');
|
|
202
|
+
expect(packageConfig.exclude).toContain('node_modules/esbuild/**');
|
|
203
|
+
expect(packageConfig.exclude).toContain('node_modules/typescript/**');
|
|
204
|
+
expect(packageConfig.exclude).toContain('node_modules/@friggframework/devtools/**');
|
|
205
|
+
expect(packageConfig.exclude).toContain('src/**'); // Migration handlers don't need backend source
|
|
206
|
+
});
|
|
207
|
+
|
|
175
208
|
it('should add queue URL to environment', async () => {
|
|
176
209
|
const appDef = {
|
|
177
210
|
database: {
|
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.2db86ce.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.2db86ce.0",
|
|
15
|
+
"@friggframework/test": "2.0.0--canary.461.2db86ce.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.2db86ce.0",
|
|
38
|
+
"@friggframework/prettier-config": "2.0.0--canary.461.2db86ce.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": "2db86ce72c7e8f37cfcf3576560288dd2322065e"
|
|
74
74
|
}
|