@friggframework/devtools 2.0.0-next.126 → 2.0.0-next.128
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/README.md +32 -5
- package/infrastructure/__tests__/helpers/bundled-prisma-engine-excludes.js +39 -0
- package/infrastructure/__tests__/management-api-gateway-routes.test.js +3 -0
- package/infrastructure/__tests__/postgres-config.test.js +3 -0
- package/infrastructure/__tests__/scaffold-default-infrastructure.test.js +3 -0
- package/infrastructure/__tests__/scoped-environment.test.js +3 -0
- package/infrastructure/__tests__/ssm-preload-node-options.test.js +3 -0
- package/infrastructure/__tests__/template-generation.test.js +3 -0
- package/infrastructure/app-definition-schema-contract.test.js +5 -0
- package/infrastructure/domains/admin-scripts/admin-script-builder.js +2 -0
- package/infrastructure/domains/admin-scripts/admin-script-builder.test.js +22 -6
- package/infrastructure/domains/database/migration-builder.js +21 -2
- package/infrastructure/domains/database/migration-builder.test.js +61 -6
- package/infrastructure/domains/database/migration-engines.js +93 -0
- package/infrastructure/domains/database/migration-engines.test.js +142 -0
- package/infrastructure/domains/integration/integration-builder.js +2 -0
- package/infrastructure/domains/integration/integration-builder.test.js +22 -6
- package/infrastructure/domains/shared/environment-builder.js +31 -5
- package/infrastructure/domains/shared/environment-builder.test.js +93 -7
- package/infrastructure/domains/shared/lambda-architectures.js +113 -0
- package/infrastructure/domains/shared/lambda-architectures.test.js +164 -0
- package/infrastructure/domains/shared/utilities/base-definition-factory.js +13 -1
- package/infrastructure/domains/shared/utilities/base-definition-factory.test.js +51 -4
- package/infrastructure/domains/shared/utilities/nested-node-modules.js +6 -5
- package/infrastructure/domains/shared/utilities/nested-node-modules.test.js +20 -26
- package/infrastructure/domains/shared/utilities/prisma-layer-manager.js +92 -12
- package/infrastructure/domains/shared/utilities/prisma-layer-manager.test.js +158 -6
- package/infrastructure/infrastructure-composer.js +12 -1
- package/infrastructure/infrastructure-composer.test.js +71 -0
- package/infrastructure/scripts/build-prisma-layer.js +136 -50
- package/infrastructure/scripts/build-prisma-layer.test.js +100 -0
- package/package.json +9 -9
|
@@ -8,6 +8,9 @@ const {
|
|
|
8
8
|
getMigrationsPackages,
|
|
9
9
|
getMigrationSourcePath,
|
|
10
10
|
getMigrationDestinationPath,
|
|
11
|
+
engineFilesToRemove,
|
|
12
|
+
verifyTargetBinaries,
|
|
13
|
+
layerBuildInputs,
|
|
11
14
|
} = require('./build-prisma-layer');
|
|
12
15
|
|
|
13
16
|
// Mock the log function
|
|
@@ -189,3 +192,100 @@ describe('getMigrationDestinationPath()', () => {
|
|
|
189
192
|
);
|
|
190
193
|
});
|
|
191
194
|
});
|
|
195
|
+
|
|
196
|
+
describe('engineFilesToRemove()', () => {
|
|
197
|
+
const files = [
|
|
198
|
+
'libquery_engine-rhel-openssl-3.0.x.so.node',
|
|
199
|
+
'libquery_engine-linux-arm64-openssl-3.0.x.so.node',
|
|
200
|
+
'libquery_engine-debian-openssl-3.0.x.so.node',
|
|
201
|
+
'schema-engine-rhel-openssl-3.0.x',
|
|
202
|
+
'query-engine-linux-arm64-openssl-3.0.x',
|
|
203
|
+
'query_engine_bg.wasm',
|
|
204
|
+
'index.js',
|
|
205
|
+
];
|
|
206
|
+
|
|
207
|
+
it('keeps the rhel engines and the non-engine files for an x86_64 target', () => {
|
|
208
|
+
expect(engineFilesToRemove(files, 'rhel-openssl-3.0.x')).toEqual([
|
|
209
|
+
'libquery_engine-linux-arm64-openssl-3.0.x.so.node',
|
|
210
|
+
'libquery_engine-debian-openssl-3.0.x.so.node',
|
|
211
|
+
'query-engine-linux-arm64-openssl-3.0.x',
|
|
212
|
+
]);
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
it('keeps the linux-arm64 engines and the non-engine files for an arm64 target', () => {
|
|
216
|
+
expect(engineFilesToRemove(files, 'linux-arm64-openssl-3.0.x')).toEqual([
|
|
217
|
+
'libquery_engine-rhel-openssl-3.0.x.so.node',
|
|
218
|
+
'libquery_engine-debian-openssl-3.0.x.so.node',
|
|
219
|
+
'schema-engine-rhel-openssl-3.0.x',
|
|
220
|
+
]);
|
|
221
|
+
});
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
describe('verifyTargetBinaries()', () => {
|
|
225
|
+
const fs = require('fs');
|
|
226
|
+
const os = require('os');
|
|
227
|
+
const path = require('path');
|
|
228
|
+
const clients = ['generated/prisma-postgresql', 'generated/prisma-mongodb'];
|
|
229
|
+
let layerNodeModules;
|
|
230
|
+
|
|
231
|
+
const writeEngine = (client, engine) => {
|
|
232
|
+
const dir = path.join(layerNodeModules, client);
|
|
233
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
234
|
+
fs.writeFileSync(path.join(dir, engine), '');
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
beforeEach(() => {
|
|
238
|
+
layerNodeModules = fs.mkdtempSync(path.join(os.tmpdir(), 'frigg-prisma-layer-'));
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
afterEach(() => {
|
|
242
|
+
fs.rmSync(layerNodeModules, { recursive: true, force: true });
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
it.each([
|
|
246
|
+
['rhel-openssl-3.0.x'],
|
|
247
|
+
['linux-arm64-openssl-3.0.x'],
|
|
248
|
+
])('passes when every client holds only the %s engine', async (target) => {
|
|
249
|
+
for (const client of clients) {
|
|
250
|
+
writeEngine(client, `libquery_engine-${target}.so.node`);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
await expect(
|
|
254
|
+
verifyTargetBinaries(layerNodeModules, target, clients, '2.0.0-next.0')
|
|
255
|
+
).resolves.toBeUndefined();
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
it('fails naming the client, the target and the core version when one client lacks the engine', async () => {
|
|
259
|
+
writeEngine('generated/prisma-postgresql', 'libquery_engine-linux-arm64-openssl-3.0.x.so.node');
|
|
260
|
+
writeEngine('generated/prisma-mongodb', 'libquery_engine-rhel-openssl-3.0.x.so.node');
|
|
261
|
+
|
|
262
|
+
await expect(
|
|
263
|
+
verifyTargetBinaries(layerNodeModules, 'linux-arm64-openssl-3.0.x', clients, '2.0.0-next.105')
|
|
264
|
+
).rejects.toThrow(/prisma-mongodb.*linux-arm64-openssl-3\.0\.x[\s\S]*2\.0\.0-next\.105/);
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
it('fails when a client still holds an engine for another Linux target', async () => {
|
|
268
|
+
writeEngine('generated/prisma-postgresql', 'libquery_engine-rhel-openssl-3.0.x.so.node');
|
|
269
|
+
writeEngine('generated/prisma-postgresql', 'libquery_engine-linux-arm64-openssl-3.0.x.so.node');
|
|
270
|
+
|
|
271
|
+
await expect(
|
|
272
|
+
verifyTargetBinaries(layerNodeModules, 'rhel-openssl-3.0.x', ['generated/prisma-postgresql'], '2.0.0-next.0')
|
|
273
|
+
).rejects.toThrow(/libquery_engine-linux-arm64-openssl-3\.0\.x\.so\.node/);
|
|
274
|
+
});
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
describe('layerBuildInputs()', () => {
|
|
278
|
+
it('names the target, the client set and the core and @prisma/client versions the layer is built from', () => {
|
|
279
|
+
const inputs = layerBuildInputs({
|
|
280
|
+
databaseConfig: { postgres: { enable: true }, mongoDB: { enable: true } },
|
|
281
|
+
prismaBinaryTarget: 'linux-arm64-openssl-3.0.x',
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
expect(inputs).toEqual({
|
|
285
|
+
prismaBinaryTarget: 'linux-arm64-openssl-3.0.x',
|
|
286
|
+
clientPackages: ['generated/prisma-mongodb', 'generated/prisma-postgresql'],
|
|
287
|
+
coreVersion: require('@friggframework/core/package.json').version,
|
|
288
|
+
prismaClientVersion: require('@prisma/client/package.json').version,
|
|
289
|
+
});
|
|
290
|
+
});
|
|
291
|
+
});
|
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-next.
|
|
4
|
+
"version": "2.0.0-next.128",
|
|
5
5
|
"bin": {
|
|
6
6
|
"frigg": "./frigg-cli/index.js"
|
|
7
7
|
},
|
|
@@ -28,13 +28,13 @@
|
|
|
28
28
|
"@babel/eslint-parser": "^7.18.9",
|
|
29
29
|
"@babel/parser": "^7.25.3",
|
|
30
30
|
"@babel/traverse": "^7.25.3",
|
|
31
|
-
"@friggframework/core": "2.0.0-next.
|
|
32
|
-
"@friggframework/schemas": "2.0.0-next.
|
|
33
|
-
"@friggframework/test": "2.0.0-next.
|
|
31
|
+
"@friggframework/core": "2.0.0-next.128",
|
|
32
|
+
"@friggframework/schemas": "2.0.0-next.128",
|
|
33
|
+
"@friggframework/test": "2.0.0-next.128",
|
|
34
34
|
"@hapi/boom": "^10.0.1",
|
|
35
35
|
"@inquirer/prompts": "^5.3.8",
|
|
36
36
|
"axios": "^1.18.0",
|
|
37
|
-
"body-parser": "^1.20.
|
|
37
|
+
"body-parser": "^1.20.9",
|
|
38
38
|
"chalk": "^4.1.2",
|
|
39
39
|
"commander": "^12.1.0",
|
|
40
40
|
"cors": "^2.8.5",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"eslint-plugin-markdown": "^3.0.0",
|
|
47
47
|
"eslint-plugin-no-only-tests": "^3.0.0",
|
|
48
48
|
"eslint-plugin-yaml": "^0.5.0",
|
|
49
|
-
"express": "^4.22.
|
|
49
|
+
"express": "^4.22.3",
|
|
50
50
|
"express-async-handler": "^1.2.0",
|
|
51
51
|
"fs-extra": "^11.2.0",
|
|
52
52
|
"js-yaml": "^4.1.0",
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
"validate-npm-package-name": "^5.0.0"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@friggframework/eslint-config": "2.0.0-next.
|
|
62
|
-
"@friggframework/prettier-config": "2.0.0-next.
|
|
61
|
+
"@friggframework/eslint-config": "2.0.0-next.128",
|
|
62
|
+
"@friggframework/prettier-config": "2.0.0-next.128",
|
|
63
63
|
"aws-sdk-client-mock": "^4.1.0",
|
|
64
64
|
"aws-sdk-client-mock-jest": "^4.1.0",
|
|
65
65
|
"jest": "^30.1.3",
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
"publishConfig": {
|
|
92
92
|
"access": "public"
|
|
93
93
|
},
|
|
94
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "c116a4803d205e5b54a59d56d8b163ab43d66205"
|
|
95
95
|
}
|