@friggframework/core 2.0.0--canary.461.f753a98.0 → 2.0.0--canary.461.740089b.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.
@@ -173,5 +173,9 @@ router.get(
173
173
  })
174
174
  );
175
175
 
176
- module.exports = router;
176
+ // Export handler for Lambda (like auth.js and user.js)
177
+ const { createAppHandler } = require('../app-handler-helpers');
178
+ const handler = createAppHandler('HTTP Event: DB Migration', router, true);
179
+
180
+ module.exports = { handler, router };
177
181
 
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Adapter Layer Tests - Database Migration Router
3
+ *
4
+ * CRITICAL TEST: Verify handler loads without app definition
5
+ *
6
+ * Business logic is tested in:
7
+ * - database/use-cases/trigger-database-migration-use-case.test.js (14 tests)
8
+ * - database/use-cases/get-migration-status-use-case.test.js (11 tests)
9
+ *
10
+ * Following hexagonal architecture principles:
11
+ * - Handlers are thin adapters (HTTP → Use Case → HTTP)
12
+ * - Use cases contain all business logic (fully tested)
13
+ * - Repositories are infrastructure adapters (tested separately)
14
+ */
15
+
16
+ process.env.ADMIN_API_KEY = 'test-admin-key';
17
+ process.env.DB_MIGRATION_QUEUE_URL = 'https://sqs.test/queue';
18
+
19
+ // Mock infrastructure dependencies to prevent app definition loading
20
+ jest.mock('../../integrations/repositories/process-repository-postgres', () => ({
21
+ ProcessRepositoryPostgres: jest.fn(() => ({
22
+ create: jest.fn(),
23
+ findById: jest.fn(),
24
+ })),
25
+ }));
26
+
27
+ describe('Database Migration Router - Adapter Layer', () => {
28
+ it('should load without requiring app definition (critical bug fix)', () => {
29
+ // Before fix: createProcessRepository() → getDatabaseType() → loads app definition → requires integrations → CRASH
30
+ // After fix: ProcessRepositoryPostgres instantiated directly → no app definition → SUCCESS
31
+
32
+ expect(() => {
33
+ require('./db-migration');
34
+ }).not.toThrow();
35
+ });
36
+
37
+ it('should export Express router', () => {
38
+ const router = require('./db-migration');
39
+ expect(typeof router).toBe('function');
40
+ expect(router.stack).toBeDefined();
41
+ });
42
+ });
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Adapter Layer Tests - Database Migration Worker
3
+ *
4
+ * CRITICAL TEST: Verify handler loads without app definition
5
+ *
6
+ * Business logic is tested in:
7
+ * - database/use-cases/run-database-migration-use-case.test.js (22 tests)
8
+ *
9
+ * Following hexagonal architecture principles:
10
+ * - Handlers are thin adapters (SQS → Use Case → Response)
11
+ * - Use cases contain all business logic (fully tested)
12
+ * - Repositories are infrastructure adapters (tested separately)
13
+ */
14
+
15
+ process.env.DATABASE_URL = 'postgresql://test:test@localhost:5432/test';
16
+ process.env.STAGE = 'test';
17
+
18
+ // Mock infrastructure dependencies to prevent app definition loading
19
+ jest.mock('../../integrations/repositories/process-repository-postgres', () => ({
20
+ ProcessRepositoryPostgres: jest.fn(() => ({
21
+ create: jest.fn(),
22
+ findById: jest.fn(),
23
+ updateState: jest.fn(),
24
+ })),
25
+ }));
26
+
27
+ jest.mock('../../integrations/use-cases/update-process-state', () => ({
28
+ UpdateProcessState: jest.fn(() => ({ execute: jest.fn() })),
29
+ }));
30
+
31
+ jest.mock('../../database/utils/prisma-runner', () => ({
32
+ runMigration: jest.fn(),
33
+ deployMigration: jest.fn(),
34
+ }));
35
+
36
+ describe('Database Migration Worker - Adapter Layer', () => {
37
+ it('should load without requiring app definition (critical bug fix)', () => {
38
+ // Before fix: createProcessRepository() → getDatabaseType() → loads app definition → requires integrations → CRASH
39
+ // After fix: ProcessRepositoryPostgres instantiated directly → no app definition → SUCCESS
40
+
41
+ expect(() => {
42
+ require('./db-migration');
43
+ }).not.toThrow();
44
+ });
45
+
46
+ it('should export handler function', () => {
47
+ const { handler } = require('./db-migration');
48
+ expect(typeof handler).toBe('function');
49
+ });
50
+ });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@friggframework/core",
3
3
  "prettier": "@friggframework/prettier-config",
4
- "version": "2.0.0--canary.461.f753a98.0",
4
+ "version": "2.0.0--canary.461.740089b.0",
5
5
  "dependencies": {
6
6
  "@aws-sdk/client-apigatewaymanagementapi": "^3.588.0",
7
7
  "@aws-sdk/client-kms": "^3.588.0",
@@ -37,9 +37,9 @@
37
37
  }
38
38
  },
39
39
  "devDependencies": {
40
- "@friggframework/eslint-config": "2.0.0--canary.461.f753a98.0",
41
- "@friggframework/prettier-config": "2.0.0--canary.461.f753a98.0",
42
- "@friggframework/test": "2.0.0--canary.461.f753a98.0",
40
+ "@friggframework/eslint-config": "2.0.0--canary.461.740089b.0",
41
+ "@friggframework/prettier-config": "2.0.0--canary.461.740089b.0",
42
+ "@friggframework/test": "2.0.0--canary.461.740089b.0",
43
43
  "@prisma/client": "^6.17.0",
44
44
  "@types/lodash": "4.17.15",
45
45
  "@typescript-eslint/eslint-plugin": "^8.0.0",
@@ -79,5 +79,5 @@
79
79
  "publishConfig": {
80
80
  "access": "public"
81
81
  },
82
- "gitHead": "f753a98f8601dcb06cd579c918a9b132fce2d61b"
82
+ "gitHead": "740089b293858dc4a11a55a4bb65e87bbe765db0"
83
83
  }