@friggframework/core 2.0.0--canary.461.740089b.0 → 2.0.0--canary.461.ba2dc6d.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.
@@ -1,21 +1,29 @@
1
1
  /**
2
2
  * Database Migration Router Lambda Handler
3
3
  *
4
- * Wraps the Express router with Lambda infrastructure:
5
- * - Express app with middleware (CORS, body-parser, error handling)
6
- * - serverless-http for Lambda compatibility
7
- * - createHandler for DB pooling + secrets management
8
- *
9
- * This matches the pattern used by health.handler.js and user.handler.js
4
+ * Minimal Lambda wrapper that avoids loading core/index.js
5
+ * (which would try to load user/** modules excluded from migration packages)
6
+ *
7
+ * This handler is intentionally simpler than health.handler.js to avoid dependencies.
10
8
  */
11
9
 
12
- const { createAppHandler } = require('../app-handler-helpers');
10
+ const serverlessHttp = require('serverless-http');
11
+ const express = require('express');
12
+ const cors = require('cors');
13
13
  const dbMigrationRouter = require('./db-migration');
14
14
 
15
- // Export handler directly (Lambda config points to db-migration.handler)
16
- module.exports = createAppHandler(
17
- 'db-migration-router',
18
- dbMigrationRouter,
19
- true // shouldUseDatabase - need DB for Process repository
20
- );
15
+ // Create minimal Express app
16
+ const app = express();
17
+ app.use(cors());
18
+ app.use(express.json());
19
+ app.use(dbMigrationRouter);
20
+
21
+ // Error handler
22
+ app.use((err, req, res, next) => {
23
+ console.error('Error:', err);
24
+ res.status(500).json({ message: 'Internal Server Error' });
25
+ });
26
+
27
+ // Export serverless-http wrapped handler
28
+ module.exports = serverlessHttp(app);
21
29
 
@@ -173,9 +173,5 @@ router.get(
173
173
  })
174
174
  );
175
175
 
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 };
176
+ module.exports = router;
181
177
 
@@ -28,7 +28,7 @@ describe('Database Migration Router - Adapter Layer', () => {
28
28
  it('should load without requiring app definition (critical bug fix)', () => {
29
29
  // Before fix: createProcessRepository() → getDatabaseType() → loads app definition → requires integrations → CRASH
30
30
  // After fix: ProcessRepositoryPostgres instantiated directly → no app definition → SUCCESS
31
-
31
+
32
32
  expect(() => {
33
33
  require('./db-migration');
34
34
  }).not.toThrow();
@@ -39,4 +39,10 @@ describe('Database Migration Router - Adapter Layer', () => {
39
39
  expect(typeof router).toBe('function');
40
40
  expect(router.stack).toBeDefined();
41
41
  });
42
+
43
+ it('should have separate handler file for Lambda', () => {
44
+ // db-migration.handler.js wraps router with createAppHandler
45
+ // This keeps db-migration.js free of app-handler-helpers dependency
46
+ expect(() => require('./db-migration.handler')).not.toThrow();
47
+ });
42
48
  });
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.740089b.0",
4
+ "version": "2.0.0--canary.461.ba2dc6d.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.740089b.0",
41
- "@friggframework/prettier-config": "2.0.0--canary.461.740089b.0",
42
- "@friggframework/test": "2.0.0--canary.461.740089b.0",
40
+ "@friggframework/eslint-config": "2.0.0--canary.461.ba2dc6d.0",
41
+ "@friggframework/prettier-config": "2.0.0--canary.461.ba2dc6d.0",
42
+ "@friggframework/test": "2.0.0--canary.461.ba2dc6d.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": "740089b293858dc4a11a55a4bb65e87bbe765db0"
82
+ "gitHead": "ba2dc6de5cdccd48e5a35d189d5b9e25f5c3eeb0"
83
83
  }