@friggframework/devtools 2.0.0--canary.731.ffe61d3.0 → 2.0.0--canary.656.6eb85ab.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/frigg-cli/README.md +31 -115
- package/frigg-cli/__tests__/unit/commands/build.test.js +0 -3
- package/frigg-cli/__tests__/unit/commands/deploy.test.js +24 -33
- package/frigg-cli/__tests__/unit/commands/doctor.test.js +6 -10
- package/frigg-cli/__tests__/unit/commands/generate-iam.test.js +0 -18
- package/frigg-cli/__tests__/unit/commands/install.test.js +341 -601
- package/frigg-cli/__tests__/unit/commands/ui.test.js +30 -31
- package/frigg-cli/__tests__/unit/dependencies.test.js +2 -6
- package/frigg-cli/build-command/index.js +0 -6
- package/frigg-cli/deploy-command/index.js +0 -6
- package/frigg-cli/generate-command/index.js +0 -1
- package/frigg-cli/generate-iam-command.js +0 -1
- package/frigg-cli/index.js +5 -22
- package/frigg-cli/index.test.js +158 -0
- package/frigg-cli/init-command/backend-first-handler.js +551 -395
- package/frigg-cli/init-command/index.js +35 -82
- package/frigg-cli/install-command/commit-changes.js +8 -40
- package/frigg-cli/install-command/environment-variables.js +0 -15
- package/frigg-cli/install-command/index.js +21 -96
- package/frigg-cli/install-command/install-package.js +4 -77
- package/frigg-cli/install-command/integration-file.js +11 -20
- package/frigg-cli/install-command/template.js +75 -102
- package/frigg-cli/install-command/validate-package.js +4 -36
- package/frigg-cli/package.json +1 -1
- package/frigg-cli/start-command/index.js +0 -4
- package/frigg-cli/start-command/start-command.test.js +0 -3
- package/frigg-cli/test/init-command.test.js +2 -9
- package/infrastructure/README.md +5 -32
- package/infrastructure/__tests__/postgres-config.test.js +836 -245
- package/infrastructure/__tests__/scoped-environment.test.js +0 -3
- package/infrastructure/__tests__/ssm-preload-node-options.test.js +0 -3
- package/infrastructure/__tests__/template-generation.test.js +8 -39
- package/infrastructure/create-frigg-infrastructure.js +1 -4
- package/infrastructure/docs/POSTGRES-CONFIGURATION.md +98 -80
- package/infrastructure/domains/admin-scripts/admin-script-builder.js +2 -8
- package/infrastructure/domains/admin-scripts/admin-script-builder.test.js +6 -52
- package/infrastructure/domains/database/aurora-builder.js +2 -13
- package/infrastructure/domains/database/aurora-builder.test.js +0 -22
- package/infrastructure/domains/database/migration-builder.js +2 -21
- package/infrastructure/domains/database/migration-builder.test.js +6 -61
- package/infrastructure/domains/health/application/use-cases/__tests__/mismatch-analyzer-method-name.test.js +8 -12
- package/infrastructure/domains/health/application/use-cases/__tests__/repair-via-import-use-case.test.js +7 -19
- package/infrastructure/domains/health/application/use-cases/run-health-check-use-case.test.js +8 -12
- package/infrastructure/domains/health/domain/services/__tests__/import-progress-monitor.test.js +18 -17
- package/infrastructure/domains/health/domain/services/__tests__/update-progress-monitor.test.js +2 -12
- package/infrastructure/domains/health/infrastructure/adapters/__tests__/orphan-detection-relationship-analysis.test.js +1 -8
- package/infrastructure/domains/health/infrastructure/adapters/aws-property-reconciler.test.js +2 -4
- package/infrastructure/domains/health/infrastructure/adapters/aws-resource-detector.test.js +0 -10
- package/infrastructure/domains/integration/integration-builder.js +0 -2
- package/infrastructure/domains/integration/integration-builder.test.js +6 -22
- package/infrastructure/domains/networking/vpc-builder.js +8 -18
- package/infrastructure/domains/networking/vpc-builder.test.js +12 -26
- package/infrastructure/domains/security/iam-generator.js +5 -112
- package/infrastructure/domains/security/iam-generator.test.js +0 -94
- package/infrastructure/domains/shared/cloudformation-discovery.test.js +6 -36
- package/infrastructure/domains/shared/environment-builder.js +5 -31
- package/infrastructure/domains/shared/environment-builder.test.js +7 -93
- package/infrastructure/domains/shared/utilities/base-definition-factory.js +3 -39
- package/infrastructure/domains/shared/utilities/base-definition-factory.test.js +5 -85
- package/infrastructure/domains/shared/utilities/nested-node-modules.js +5 -6
- package/infrastructure/domains/shared/utilities/nested-node-modules.test.js +26 -20
- package/infrastructure/domains/shared/utilities/prisma-layer-manager.js +12 -92
- package/infrastructure/domains/shared/utilities/prisma-layer-manager.test.js +6 -158
- package/infrastructure/infrastructure-composer.js +1 -12
- package/infrastructure/infrastructure-composer.test.js +794 -339
- package/infrastructure/integration.test.js +381 -0
- package/infrastructure/scripts/build-prisma-layer.js +50 -136
- package/infrastructure/scripts/build-prisma-layer.test.js +7 -128
- package/infrastructure/scripts/build-time-discovery.test.js +3 -18
- package/package.json +10 -12
- package/frigg-cli/__tests__/unit/commands/init.test.js +0 -688
- package/frigg-cli/__tests__/unit/commands/validate-wiring.test.js +0 -92
- package/frigg-cli/init-command/deployment-modes.js +0 -7
- package/frigg-cli/init-command/safe-path.js +0 -58
- package/frigg-cli/init-command/scaffold-dependencies.js +0 -202
- package/frigg-cli/install-command/app-definition.js +0 -174
- package/frigg-cli/install-command/resolve-module.js +0 -69
- package/frigg-cli/templates/backend/README.md +0 -267
- package/frigg-cli/templates/backend/env.example +0 -20
- package/frigg-cli/templates/backend/gitignore +0 -10
- package/frigg-cli/templates/backend/index.js +0 -114
- package/frigg-cli/templates/backend/infrastructure.js +0 -20
- package/frigg-cli/validate-command/__tests__/init-validation.test.js +0 -63
- package/frigg-cli/validate-command/__tests__/integrations-checks.test.js +0 -133
- package/frigg-cli/validate-command/__tests__/validate-app-definition.test.js +0 -443
- package/frigg-cli/validate-command/__tests__/validate-command.test.js +0 -262
- package/frigg-cli/validate-command/checks/config.js +0 -504
- package/frigg-cli/validate-command/checks/integrations.js +0 -274
- package/frigg-cli/validate-command/format-report.js +0 -58
- package/frigg-cli/validate-command/index.js +0 -107
- package/frigg-cli/validate-command/load-app-definition.js +0 -105
- package/frigg-cli/validate-command/schema-issues.js +0 -154
- package/frigg-cli/validate-command/validate-app-definition.js +0 -60
- package/infrastructure/__tests__/helpers/bundled-prisma-engine-excludes.js +0 -39
- package/infrastructure/__tests__/management-api-gateway-routes.test.js +0 -284
- package/infrastructure/__tests__/scaffold-default-infrastructure.test.js +0 -151
- package/infrastructure/app-definition-schema-contract.test.js +0 -634
- package/infrastructure/create-frigg-infrastructure.test.js +0 -51
- package/infrastructure/domains/database/migration-engines.js +0 -93
- package/infrastructure/domains/database/migration-engines.test.js +0 -142
- package/infrastructure/domains/shared/lambda-architectures.js +0 -113
- package/infrastructure/domains/shared/lambda-architectures.test.js +0 -164
|
@@ -12,19 +12,9 @@ const { ensurePrismaLayerExists } = require('./prisma-layer-manager');
|
|
|
12
12
|
jest.mock('fs');
|
|
13
13
|
jest.mock('../../../scripts/build-prisma-layer', () => ({
|
|
14
14
|
buildPrismaLayer: jest.fn(),
|
|
15
|
-
layerBuildInputs: jest.fn(),
|
|
16
15
|
}));
|
|
17
16
|
|
|
18
|
-
const { buildPrismaLayer
|
|
19
|
-
|
|
20
|
-
const inputsFor = ({ prismaBinaryTarget = 'rhel-openssl-3.0.x' } = {}) => ({
|
|
21
|
-
prismaBinaryTarget,
|
|
22
|
-
clientPackages: ['generated/prisma-postgresql'],
|
|
23
|
-
coreVersion: '2.0.0-next.120',
|
|
24
|
-
prismaClientVersion: '6.19.3',
|
|
25
|
-
});
|
|
26
|
-
const markerFor = (overrides = {}) =>
|
|
27
|
-
JSON.stringify({ ...inputsFor(), ...overrides });
|
|
17
|
+
const { buildPrismaLayer } = require('../../../scripts/build-prisma-layer');
|
|
28
18
|
|
|
29
19
|
// Helper to mock fs methods for different scenarios
|
|
30
20
|
const mockFs = {
|
|
@@ -60,8 +50,6 @@ describe('Prisma Layer Manager', () => {
|
|
|
60
50
|
originalCwd = process.cwd;
|
|
61
51
|
process.cwd = jest.fn().mockReturnValue('/project');
|
|
62
52
|
jest.clearAllMocks();
|
|
63
|
-
layerBuildInputs.mockImplementation(inputsFor);
|
|
64
|
-
fs.readFileSync = jest.fn((p) => (p.endsWith('.build-lock') ? '99999' : markerFor()));
|
|
65
53
|
});
|
|
66
54
|
|
|
67
55
|
afterEach(() => {
|
|
@@ -99,27 +87,9 @@ describe('Prisma Layer Manager', () => {
|
|
|
99
87
|
postgres: { enable: true },
|
|
100
88
|
};
|
|
101
89
|
|
|
102
|
-
await ensurePrismaLayerExists(
|
|
103
|
-
|
|
104
|
-
expect(buildPrismaLayer).toHaveBeenCalledWith({
|
|
105
|
-
databaseConfig,
|
|
106
|
-
prismaBinaryTarget: 'rhel-openssl-3.0.x',
|
|
107
|
-
});
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
it('should pass the Prisma binary target of the deployed architecture to buildPrismaLayer', async () => {
|
|
111
|
-
fs.existsSync = jest.fn().mockReturnValue(false);
|
|
112
|
-
buildPrismaLayer.mockResolvedValue();
|
|
113
|
-
|
|
114
|
-
await ensurePrismaLayerExists({
|
|
115
|
-
databaseConfig: {},
|
|
116
|
-
prismaBinaryTarget: 'linux-arm64-openssl-3.0.x',
|
|
117
|
-
});
|
|
90
|
+
await ensurePrismaLayerExists(databaseConfig);
|
|
118
91
|
|
|
119
|
-
expect(buildPrismaLayer).toHaveBeenCalledWith(
|
|
120
|
-
databaseConfig: {},
|
|
121
|
-
prismaBinaryTarget: 'linux-arm64-openssl-3.0.x',
|
|
122
|
-
});
|
|
92
|
+
expect(buildPrismaLayer).toHaveBeenCalledWith(databaseConfig);
|
|
123
93
|
});
|
|
124
94
|
|
|
125
95
|
it('should handle build errors and rethrow', async () => {
|
|
@@ -135,10 +105,7 @@ describe('Prisma Layer Manager', () => {
|
|
|
135
105
|
|
|
136
106
|
await ensurePrismaLayerExists();
|
|
137
107
|
|
|
138
|
-
expect(buildPrismaLayer).toHaveBeenCalledWith({
|
|
139
|
-
databaseConfig: {},
|
|
140
|
-
prismaBinaryTarget: 'rhel-openssl-3.0.x',
|
|
141
|
-
});
|
|
108
|
+
expect(buildPrismaLayer).toHaveBeenCalledWith({});
|
|
142
109
|
});
|
|
143
110
|
|
|
144
111
|
it('should use correct layer path relative to project root', async () => {
|
|
@@ -156,7 +123,6 @@ describe('Prisma Layer Manager', () => {
|
|
|
156
123
|
|
|
157
124
|
it('should log success when layer already exists', async () => {
|
|
158
125
|
fs.existsSync = jest.fn().mockReturnValue(true);
|
|
159
|
-
fs.readFileSync = jest.fn().mockReturnValue(markerFor());
|
|
160
126
|
const consoleSpy = jest.spyOn(console, 'log').mockImplementation();
|
|
161
127
|
|
|
162
128
|
await ensurePrismaLayerExists();
|
|
@@ -203,120 +169,6 @@ describe('Prisma Layer Manager', () => {
|
|
|
203
169
|
consoleErrorSpy.mockRestore();
|
|
204
170
|
});
|
|
205
171
|
|
|
206
|
-
describe('layer cache keyed by its inputs', () => {
|
|
207
|
-
const existingMarker = () => {
|
|
208
|
-
fs.existsSync = jest.fn((p) => p.endsWith('.build-complete') || p.endsWith('layers/prisma'));
|
|
209
|
-
fs.writeFileSync = jest.fn();
|
|
210
|
-
fs.rmSync = jest.fn();
|
|
211
|
-
buildPrismaLayer.mockResolvedValue();
|
|
212
|
-
};
|
|
213
|
-
|
|
214
|
-
it('reuses the layer when the marker records the same target, clients and versions', async () => {
|
|
215
|
-
existingMarker();
|
|
216
|
-
fs.readFileSync = jest.fn().mockReturnValue(markerFor());
|
|
217
|
-
|
|
218
|
-
await ensurePrismaLayerExists({ prismaBinaryTarget: 'rhel-openssl-3.0.x' });
|
|
219
|
-
|
|
220
|
-
expect(buildPrismaLayer).not.toHaveBeenCalled();
|
|
221
|
-
});
|
|
222
|
-
|
|
223
|
-
it('rebuilds when the deployed architecture changes the target', async () => {
|
|
224
|
-
existingMarker();
|
|
225
|
-
fs.readFileSync = jest.fn().mockReturnValue(markerFor());
|
|
226
|
-
|
|
227
|
-
await ensurePrismaLayerExists({ prismaBinaryTarget: 'linux-arm64-openssl-3.0.x' });
|
|
228
|
-
|
|
229
|
-
expect(buildPrismaLayer).toHaveBeenCalledWith({
|
|
230
|
-
databaseConfig: {},
|
|
231
|
-
prismaBinaryTarget: 'linux-arm64-openssl-3.0.x',
|
|
232
|
-
});
|
|
233
|
-
});
|
|
234
|
-
|
|
235
|
-
it('rebuilds when the installed core version changes', async () => {
|
|
236
|
-
existingMarker();
|
|
237
|
-
fs.readFileSync = jest.fn().mockReturnValue(markerFor({ coreVersion: '2.0.0-next.105' }));
|
|
238
|
-
|
|
239
|
-
await ensurePrismaLayerExists();
|
|
240
|
-
|
|
241
|
-
expect(buildPrismaLayer).toHaveBeenCalledTimes(1);
|
|
242
|
-
});
|
|
243
|
-
|
|
244
|
-
it('rebuilds when the client set changes', async () => {
|
|
245
|
-
existingMarker();
|
|
246
|
-
fs.readFileSync = jest.fn().mockReturnValue(
|
|
247
|
-
markerFor({ clientPackages: ['generated/prisma-postgresql', 'generated/prisma-mongodb'] })
|
|
248
|
-
);
|
|
249
|
-
|
|
250
|
-
await ensurePrismaLayerExists();
|
|
251
|
-
|
|
252
|
-
expect(buildPrismaLayer).toHaveBeenCalledTimes(1);
|
|
253
|
-
});
|
|
254
|
-
|
|
255
|
-
it('rebuilds over a legacy plain-text marker, which records no target or versions', async () => {
|
|
256
|
-
existingMarker();
|
|
257
|
-
fs.readFileSync = jest.fn().mockReturnValue(
|
|
258
|
-
'Build completed: 2026-01-01T00:00:00.000Z\nNode: v22.0.0\nPlatform: darwin\n'
|
|
259
|
-
);
|
|
260
|
-
|
|
261
|
-
await ensurePrismaLayerExists();
|
|
262
|
-
|
|
263
|
-
expect(buildPrismaLayer).toHaveBeenCalledTimes(1);
|
|
264
|
-
});
|
|
265
|
-
|
|
266
|
-
it('writes the inputs into the marker after a build', async () => {
|
|
267
|
-
mockFs.noBuild();
|
|
268
|
-
buildPrismaLayer.mockResolvedValue();
|
|
269
|
-
|
|
270
|
-
await ensurePrismaLayerExists({ prismaBinaryTarget: 'linux-arm64-openssl-3.0.x' });
|
|
271
|
-
|
|
272
|
-
const [, written] = fs.writeFileSync.mock.calls.find(
|
|
273
|
-
([p]) => p === '/project/layers/prisma/.build-complete'
|
|
274
|
-
);
|
|
275
|
-
expect(JSON.parse(written)).toEqual(
|
|
276
|
-
expect.objectContaining(inputsFor({ prismaBinaryTarget: 'linux-arm64-openssl-3.0.x' }))
|
|
277
|
-
);
|
|
278
|
-
});
|
|
279
|
-
|
|
280
|
-
it('rebuilds after waiting on a concurrent build that finished for the other target', async () => {
|
|
281
|
-
jest.useFakeTimers();
|
|
282
|
-
let completionMarkerExists = false;
|
|
283
|
-
fs.existsSync = jest.fn((p) => {
|
|
284
|
-
if (p.endsWith('.build-complete')) return completionMarkerExists;
|
|
285
|
-
if (p.endsWith('.build-lock')) return !completionMarkerExists;
|
|
286
|
-
if (p.endsWith('layers/prisma')) return true;
|
|
287
|
-
return false;
|
|
288
|
-
});
|
|
289
|
-
fs.readFileSync = jest.fn((p) =>
|
|
290
|
-
p.endsWith('.build-lock') ? '12345' : markerFor({ prismaBinaryTarget: 'rhel-openssl-3.0.x' })
|
|
291
|
-
);
|
|
292
|
-
fs.writeFileSync = jest.fn();
|
|
293
|
-
fs.mkdirSync = jest.fn();
|
|
294
|
-
fs.rmSync = jest.fn();
|
|
295
|
-
buildPrismaLayer.mockResolvedValue();
|
|
296
|
-
const originalKill = process.kill;
|
|
297
|
-
let polls = 0;
|
|
298
|
-
process.kill = jest.fn(() => {
|
|
299
|
-
if (++polls >= 3) completionMarkerExists = true;
|
|
300
|
-
return true;
|
|
301
|
-
});
|
|
302
|
-
|
|
303
|
-
const promise = ensurePrismaLayerExists({ prismaBinaryTarget: 'linux-arm64-openssl-3.0.x' });
|
|
304
|
-
for (let i = 0; i < 5; i++) {
|
|
305
|
-
jest.advanceTimersByTime(1000);
|
|
306
|
-
await Promise.resolve();
|
|
307
|
-
}
|
|
308
|
-
await promise;
|
|
309
|
-
|
|
310
|
-
expect(buildPrismaLayer).toHaveBeenCalledWith({
|
|
311
|
-
databaseConfig: {},
|
|
312
|
-
prismaBinaryTarget: 'linux-arm64-openssl-3.0.x',
|
|
313
|
-
});
|
|
314
|
-
|
|
315
|
-
process.kill = originalKill;
|
|
316
|
-
jest.useRealTimers();
|
|
317
|
-
});
|
|
318
|
-
});
|
|
319
|
-
|
|
320
172
|
describe('Concurrent Build Protection', () => {
|
|
321
173
|
it('should skip build if completion marker exists (TDD)', async () => {
|
|
322
174
|
mockFs.completedBuild();
|
|
@@ -339,9 +191,7 @@ describe('Prisma Layer Manager', () => {
|
|
|
339
191
|
if (path.endsWith('layers/prisma')) return true;
|
|
340
192
|
return false;
|
|
341
193
|
});
|
|
342
|
-
fs.readFileSync = jest.fn((
|
|
343
|
-
p.endsWith('.build-lock') ? activePid.toString() : markerFor()
|
|
344
|
-
);
|
|
194
|
+
fs.readFileSync = jest.fn().mockReturnValue(activePid.toString());
|
|
345
195
|
fs.writeFileSync = jest.fn();
|
|
346
196
|
fs.rmSync = jest.fn();
|
|
347
197
|
|
|
@@ -555,9 +405,7 @@ describe('Prisma Layer Manager', () => {
|
|
|
555
405
|
if (path.endsWith('layers/prisma')) return true;
|
|
556
406
|
return false;
|
|
557
407
|
});
|
|
558
|
-
fs.readFileSync = jest.fn((
|
|
559
|
-
p.endsWith('.build-lock') ? '12345' : markerFor()
|
|
560
|
-
);
|
|
408
|
+
fs.readFileSync = jest.fn().mockReturnValue('12345');
|
|
561
409
|
fs.writeFileSync = jest.fn();
|
|
562
410
|
fs.rmSync = jest.fn();
|
|
563
411
|
|
|
@@ -61,8 +61,6 @@ function applySsmPreloadNodeOptions(appDefinition, functions, providerEnvironmen
|
|
|
61
61
|
const { modifyHandlerPaths } = require('./domains/shared/utilities/handler-path-resolver');
|
|
62
62
|
const { createBaseDefinition } = require('./domains/shared/utilities/base-definition-factory');
|
|
63
63
|
const { ensurePrismaLayerExists } = require('./domains/shared/utilities/prisma-layer-manager');
|
|
64
|
-
const { resolveLambdaArchitecture } = require('./domains/shared/lambda-architectures');
|
|
65
|
-
const { ensureMigrationEngines } = require('./domains/database/migration-engines');
|
|
66
64
|
const { validateAndCleanPlugins, validatePackagingConfiguration } = require('./domains/shared/validation/plugin-validator');
|
|
67
65
|
|
|
68
66
|
/**
|
|
@@ -76,23 +74,14 @@ const composeServerlessDefinition = async (AppDefinition) => {
|
|
|
76
74
|
|
|
77
75
|
// Determine if deployment should use Prisma Lambda Layer (default: true)
|
|
78
76
|
const usePrismaLayer = AppDefinition.usePrismaLambdaLayer !== false;
|
|
79
|
-
const { prismaBinaryTarget } = resolveLambdaArchitecture(AppDefinition);
|
|
80
77
|
|
|
81
78
|
// Ensure Prisma layer exists only when configured to use it
|
|
82
79
|
if (usePrismaLayer) {
|
|
83
|
-
await ensurePrismaLayerExists({
|
|
84
|
-
databaseConfig: AppDefinition.database || {},
|
|
85
|
-
prismaBinaryTarget,
|
|
86
|
-
});
|
|
80
|
+
await ensurePrismaLayerExists(AppDefinition.database || {});
|
|
87
81
|
} else {
|
|
88
82
|
console.log('📦 Skipping Prisma Lambda Layer (usePrismaLambdaLayer=false - bundling Prisma with functions)');
|
|
89
83
|
}
|
|
90
84
|
|
|
91
|
-
// The migration worker ships its own Prisma CLI engines (layer or not)
|
|
92
|
-
if (new MigrationBuilder().shouldExecute(AppDefinition)) {
|
|
93
|
-
await ensureMigrationEngines({ prismaBinaryTarget });
|
|
94
|
-
}
|
|
95
|
-
|
|
96
85
|
// Create orchestrator with all domain builders
|
|
97
86
|
const orchestrator = new BuilderOrchestrator([
|
|
98
87
|
new VpcBuilder(),
|