@friggframework/devtools 2.0.0--canary.731.ffe61d3.0 → 2.0.0--canary.658.130b4ec.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.
Files changed (102) hide show
  1. package/frigg-cli/README.md +31 -115
  2. package/frigg-cli/__tests__/unit/commands/build.test.js +0 -3
  3. package/frigg-cli/__tests__/unit/commands/deploy.test.js +24 -33
  4. package/frigg-cli/__tests__/unit/commands/doctor.test.js +6 -10
  5. package/frigg-cli/__tests__/unit/commands/generate-iam.test.js +0 -18
  6. package/frigg-cli/__tests__/unit/commands/install.test.js +341 -601
  7. package/frigg-cli/__tests__/unit/commands/ui.test.js +30 -31
  8. package/frigg-cli/__tests__/unit/dependencies.test.js +2 -6
  9. package/frigg-cli/build-command/index.js +0 -6
  10. package/frigg-cli/deploy-command/index.js +0 -6
  11. package/frigg-cli/generate-command/index.js +0 -1
  12. package/frigg-cli/generate-iam-command.js +0 -1
  13. package/frigg-cli/index.js +5 -22
  14. package/frigg-cli/index.test.js +158 -0
  15. package/frigg-cli/init-command/backend-first-handler.js +551 -395
  16. package/frigg-cli/init-command/index.js +35 -82
  17. package/frigg-cli/install-command/commit-changes.js +8 -40
  18. package/frigg-cli/install-command/environment-variables.js +0 -15
  19. package/frigg-cli/install-command/index.js +21 -96
  20. package/frigg-cli/install-command/install-package.js +4 -77
  21. package/frigg-cli/install-command/integration-file.js +11 -20
  22. package/frigg-cli/install-command/template.js +75 -102
  23. package/frigg-cli/install-command/validate-package.js +4 -36
  24. package/frigg-cli/package.json +1 -1
  25. package/frigg-cli/start-command/index.js +0 -4
  26. package/frigg-cli/start-command/start-command.test.js +0 -3
  27. package/frigg-cli/test/init-command.test.js +2 -9
  28. package/infrastructure/README.md +5 -32
  29. package/infrastructure/__tests__/postgres-config.test.js +836 -245
  30. package/infrastructure/__tests__/scoped-environment.test.js +0 -3
  31. package/infrastructure/__tests__/ssm-preload-node-options.test.js +0 -3
  32. package/infrastructure/__tests__/template-generation.test.js +8 -39
  33. package/infrastructure/create-frigg-infrastructure.js +1 -4
  34. package/infrastructure/docs/POSTGRES-CONFIGURATION.md +98 -80
  35. package/infrastructure/domains/admin-scripts/admin-script-builder.js +2 -8
  36. package/infrastructure/domains/admin-scripts/admin-script-builder.test.js +6 -52
  37. package/infrastructure/domains/database/aurora-builder.js +2 -13
  38. package/infrastructure/domains/database/aurora-builder.test.js +0 -22
  39. package/infrastructure/domains/database/migration-builder.js +2 -21
  40. package/infrastructure/domains/database/migration-builder.test.js +6 -61
  41. package/infrastructure/domains/health/application/use-cases/__tests__/mismatch-analyzer-method-name.test.js +8 -12
  42. package/infrastructure/domains/health/application/use-cases/__tests__/repair-via-import-use-case.test.js +7 -19
  43. package/infrastructure/domains/health/application/use-cases/run-health-check-use-case.test.js +8 -12
  44. package/infrastructure/domains/health/domain/services/__tests__/import-progress-monitor.test.js +18 -17
  45. package/infrastructure/domains/health/domain/services/__tests__/update-progress-monitor.test.js +2 -12
  46. package/infrastructure/domains/health/infrastructure/adapters/__tests__/orphan-detection-relationship-analysis.test.js +1 -8
  47. package/infrastructure/domains/health/infrastructure/adapters/aws-property-reconciler.test.js +2 -4
  48. package/infrastructure/domains/health/infrastructure/adapters/aws-resource-detector.test.js +0 -10
  49. package/infrastructure/domains/integration/integration-builder.js +0 -2
  50. package/infrastructure/domains/integration/integration-builder.test.js +6 -22
  51. package/infrastructure/domains/networking/vpc-builder.js +8 -18
  52. package/infrastructure/domains/networking/vpc-builder.test.js +12 -26
  53. package/infrastructure/domains/security/iam-generator.js +5 -112
  54. package/infrastructure/domains/security/iam-generator.test.js +0 -94
  55. package/infrastructure/domains/shared/cloudformation-discovery.test.js +6 -36
  56. package/infrastructure/domains/shared/environment-builder.js +5 -31
  57. package/infrastructure/domains/shared/environment-builder.test.js +7 -93
  58. package/infrastructure/domains/shared/utilities/base-definition-factory.js +3 -39
  59. package/infrastructure/domains/shared/utilities/base-definition-factory.test.js +5 -85
  60. package/infrastructure/domains/shared/utilities/nested-node-modules.js +5 -6
  61. package/infrastructure/domains/shared/utilities/nested-node-modules.test.js +26 -20
  62. package/infrastructure/domains/shared/utilities/prisma-layer-manager.js +12 -92
  63. package/infrastructure/domains/shared/utilities/prisma-layer-manager.test.js +6 -158
  64. package/infrastructure/infrastructure-composer.js +1 -12
  65. package/infrastructure/infrastructure-composer.test.js +794 -339
  66. package/infrastructure/integration.test.js +381 -0
  67. package/infrastructure/scripts/build-prisma-layer.js +50 -136
  68. package/infrastructure/scripts/build-prisma-layer.test.js +7 -128
  69. package/infrastructure/scripts/build-time-discovery.test.js +3 -18
  70. package/package.json +10 -12
  71. package/frigg-cli/__tests__/unit/commands/init.test.js +0 -688
  72. package/frigg-cli/__tests__/unit/commands/validate-wiring.test.js +0 -92
  73. package/frigg-cli/init-command/deployment-modes.js +0 -7
  74. package/frigg-cli/init-command/safe-path.js +0 -58
  75. package/frigg-cli/init-command/scaffold-dependencies.js +0 -202
  76. package/frigg-cli/install-command/app-definition.js +0 -174
  77. package/frigg-cli/install-command/resolve-module.js +0 -69
  78. package/frigg-cli/templates/backend/README.md +0 -267
  79. package/frigg-cli/templates/backend/env.example +0 -20
  80. package/frigg-cli/templates/backend/gitignore +0 -10
  81. package/frigg-cli/templates/backend/index.js +0 -114
  82. package/frigg-cli/templates/backend/infrastructure.js +0 -20
  83. package/frigg-cli/validate-command/__tests__/init-validation.test.js +0 -63
  84. package/frigg-cli/validate-command/__tests__/integrations-checks.test.js +0 -133
  85. package/frigg-cli/validate-command/__tests__/validate-app-definition.test.js +0 -443
  86. package/frigg-cli/validate-command/__tests__/validate-command.test.js +0 -262
  87. package/frigg-cli/validate-command/checks/config.js +0 -504
  88. package/frigg-cli/validate-command/checks/integrations.js +0 -274
  89. package/frigg-cli/validate-command/format-report.js +0 -58
  90. package/frigg-cli/validate-command/index.js +0 -107
  91. package/frigg-cli/validate-command/load-app-definition.js +0 -105
  92. package/frigg-cli/validate-command/schema-issues.js +0 -154
  93. package/frigg-cli/validate-command/validate-app-definition.js +0 -60
  94. package/infrastructure/__tests__/helpers/bundled-prisma-engine-excludes.js +0 -39
  95. package/infrastructure/__tests__/management-api-gateway-routes.test.js +0 -284
  96. package/infrastructure/__tests__/scaffold-default-infrastructure.test.js +0 -151
  97. package/infrastructure/app-definition-schema-contract.test.js +0 -634
  98. package/infrastructure/create-frigg-infrastructure.test.js +0 -51
  99. package/infrastructure/domains/database/migration-engines.js +0 -93
  100. package/infrastructure/domains/database/migration-engines.test.js +0 -142
  101. package/infrastructure/domains/shared/lambda-architectures.js +0 -113
  102. package/infrastructure/domains/shared/lambda-architectures.test.js +0 -164
@@ -8,9 +8,6 @@ const {
8
8
  getMigrationsPackages,
9
9
  getMigrationSourcePath,
10
10
  getMigrationDestinationPath,
11
- engineFilesToRemove,
12
- verifyTargetBinaries,
13
- layerBuildInputs,
14
11
  } = require('./build-prisma-layer');
15
12
 
16
13
  // Mock the log function
@@ -146,35 +143,14 @@ describe('getMigrationsPackages()', () => {
146
143
  });
147
144
 
148
145
  describe('getMigrationSourcePath()', () => {
149
- // getMigrationSourcePath() returns the first search path whose
150
- // prisma-<dbType>/migrations directory exists on disk, so the test needs a
151
- // real directory rather than a made-up absolute path.
152
- const fs = require('fs');
153
- const os = require('os');
154
- const path = require('path');
155
- let tmpRoot;
156
-
157
- beforeEach(() => {
158
- tmpRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'frigg-prisma-layer-'));
159
- });
160
-
161
- afterEach(() => {
162
- fs.rmSync(tmpRoot, { recursive: true, force: true });
163
- });
164
-
165
- it('should return the migrations path of the first search path that has one', () => {
166
- const missing = path.join(tmpRoot, 'missing');
167
- const core = path.join(tmpRoot, 'packages', 'core');
168
- const expected = path.join(core, 'prisma-postgresql', 'migrations');
169
- fs.mkdirSync(expected, { recursive: true });
146
+ it('should return correct source path for database type', () => {
147
+ const searchPaths = ['/workspace/packages/core'];
148
+ const dbType = 'postgresql';
170
149
 
171
- const sourcePath = getMigrationSourcePath([missing, core], 'postgresql');
172
- expect(sourcePath).toBe(expected);
173
- });
174
-
175
- it('should return null when no search path has migrations for the database type', () => {
176
- const sourcePath = getMigrationSourcePath([tmpRoot], 'postgresql');
177
- expect(sourcePath).toBeNull();
150
+ const sourcePath = getMigrationSourcePath(searchPaths, dbType);
151
+ expect(sourcePath).toBe(
152
+ '/workspace/packages/core/prisma-postgresql/migrations'
153
+ );
178
154
  });
179
155
  });
180
156
 
@@ -192,100 +168,3 @@ describe('getMigrationDestinationPath()', () => {
192
168
  );
193
169
  });
194
170
  });
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
- });
@@ -1,29 +1,14 @@
1
1
  const fs = require('fs');
2
2
  const path = require('path');
3
-
4
- // SKIPPED: BuildTimeDiscovery lazily requires './aws-discovery', which was
5
- // deleted in the hexagonal infrastructure refactor (7b36f0f4). Discovery now
6
- // lives in domains/shared/resource-discovery.js + providers/aws-provider-adapter.js,
7
- // and nothing in devtools, the CLI or the serverless plugin invokes
8
- // build-time-discovery.js / run-discovery.js any more, so this suite cannot load
9
- // its subject. Either port BuildTimeDiscovery to gatherDiscoveredResources() and
10
- // rewrite these tests, or delete the dead module and this suite.
11
- // Tracked in https://github.com/friggframework/frigg/issues/708
12
- let BuildTimeDiscovery;
13
- let runBuildTimeDiscovery;
14
- let AWSDiscovery;
3
+ const { BuildTimeDiscovery, runBuildTimeDiscovery } = require('./build-time-discovery');
4
+ const { AWSDiscovery } = require('./aws-discovery');
15
5
 
16
6
  // Mock dependencies
17
7
  jest.mock('fs');
18
8
  // Mock will be updated when tests are rewritten for new provider architecture
19
9
  // jest.mock('./aws-discovery');
20
10
 
21
- describe.skip('BuildTimeDiscovery', () => {
22
- beforeAll(() => {
23
- ({ BuildTimeDiscovery, runBuildTimeDiscovery } = require('./build-time-discovery'));
24
- ({ AWSDiscovery } = require('./aws-discovery'));
25
- });
26
-
11
+ describe('BuildTimeDiscovery', () => {
27
12
  let buildTimeDiscovery;
28
13
  let mockAWSDiscovery;
29
14
  const originalEnv = process.env;
package/package.json CHANGED
@@ -1,13 +1,12 @@
1
1
  {
2
2
  "name": "@friggframework/devtools",
3
3
  "prettier": "@friggframework/prettier-config",
4
- "version": "2.0.0--canary.731.ffe61d3.0",
4
+ "version": "2.0.0--canary.658.130b4ec.0",
5
5
  "bin": {
6
6
  "frigg": "./frigg-cli/index.js"
7
7
  },
8
8
  "files": [
9
9
  "frigg-cli/",
10
- "frigg-cli/templates/",
11
10
  "infrastructure/",
12
11
  "migrations/",
13
12
  "management-ui/dist/",
@@ -19,7 +18,6 @@
19
18
  "@aws-sdk/client-cloudformation": "^3.705.0",
20
19
  "@aws-sdk/client-ec2": "^3.835.0",
21
20
  "@aws-sdk/client-kms": "^3.835.0",
22
- "@aws-sdk/client-lambda": "^3.714.0",
23
21
  "@aws-sdk/client-rds": "^3.906.0",
24
22
  "@aws-sdk/client-s3": "^3.917.0",
25
23
  "@aws-sdk/client-secrets-manager": "^3.906.0",
@@ -28,13 +26,13 @@
28
26
  "@babel/eslint-parser": "^7.18.9",
29
27
  "@babel/parser": "^7.25.3",
30
28
  "@babel/traverse": "^7.25.3",
31
- "@friggframework/core": "2.0.0--canary.731.ffe61d3.0",
32
- "@friggframework/schemas": "2.0.0--canary.731.ffe61d3.0",
33
- "@friggframework/test": "2.0.0--canary.731.ffe61d3.0",
29
+ "@friggframework/core": "2.0.0--canary.658.130b4ec.0",
30
+ "@friggframework/schemas": "2.0.0--canary.658.130b4ec.0",
31
+ "@friggframework/test": "2.0.0--canary.658.130b4ec.0",
34
32
  "@hapi/boom": "^10.0.1",
35
33
  "@inquirer/prompts": "^5.3.8",
36
34
  "axios": "^1.18.0",
37
- "body-parser": "^1.20.9",
35
+ "body-parser": "^1.20.5",
38
36
  "chalk": "^4.1.2",
39
37
  "commander": "^12.1.0",
40
38
  "cors": "^2.8.5",
@@ -46,7 +44,7 @@
46
44
  "eslint-plugin-markdown": "^3.0.0",
47
45
  "eslint-plugin-no-only-tests": "^3.0.0",
48
46
  "eslint-plugin-yaml": "^0.5.0",
49
- "express": "^4.22.3",
47
+ "express": "^4.22.2",
50
48
  "express-async-handler": "^1.2.0",
51
49
  "fs-extra": "^11.2.0",
52
50
  "js-yaml": "^4.1.0",
@@ -58,12 +56,12 @@
58
56
  "validate-npm-package-name": "^5.0.0"
59
57
  },
60
58
  "devDependencies": {
61
- "@friggframework/eslint-config": "2.0.0--canary.731.ffe61d3.0",
62
- "@friggframework/prettier-config": "2.0.0--canary.731.ffe61d3.0",
59
+ "@friggframework/eslint-config": "2.0.0--canary.658.130b4ec.0",
60
+ "@friggframework/prettier-config": "2.0.0--canary.658.130b4ec.0",
63
61
  "aws-sdk-client-mock": "^4.1.0",
64
62
  "aws-sdk-client-mock-jest": "^4.1.0",
65
63
  "jest": "^30.1.3",
66
- "osls": "^3.78.0",
64
+ "osls": "^3.58.0",
67
65
  "prettier": "^2.7.1",
68
66
  "serverless-dotenv-plugin": "^6.0.0",
69
67
  "serverless-esbuild": "^1.54.3",
@@ -91,5 +89,5 @@
91
89
  "publishConfig": {
92
90
  "access": "public"
93
91
  },
94
- "gitHead": "ffe61d3981e0f6a83e9c8063efcb77ce121c1286"
92
+ "gitHead": "130b4ec4ebf0f605416f3db316b5ddbe54a37d32"
95
93
  }