@friggframework/core 2.0.0--canary.522.cbd3d5a.0 → 2.0.0--canary.517.35ee143.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 (225) hide show
  1. package/CHANGELOG.md +67 -66
  2. package/CLAUDE.md +124 -148
  3. package/README.md +130 -165
  4. package/admin-scripts/index.js +16 -30
  5. package/admin-scripts/repositories/{admin-api-key-repository-documentdb.js → admin-process-repository-documentdb.js} +5 -5
  6. package/admin-scripts/repositories/{admin-api-key-repository-factory.js → admin-process-repository-factory.js} +15 -19
  7. package/admin-scripts/repositories/admin-process-repository-interface.js +150 -0
  8. package/admin-scripts/repositories/admin-process-repository-mongo.js +213 -0
  9. package/admin-scripts/repositories/admin-process-repository-postgres.js +251 -0
  10. package/admin-scripts/repositories/script-schedule-repository-factory.js +2 -6
  11. package/admin-scripts/repositories/script-schedule-repository-interface.js +14 -36
  12. package/admin-scripts/repositories/script-schedule-repository-mongo.js +13 -25
  13. package/admin-scripts/repositories/script-schedule-repository-postgres.js +13 -25
  14. package/application/commands/admin-script-commands.js +102 -266
  15. package/application/commands/integration-commands.js +6 -12
  16. package/application/index.js +3 -1
  17. package/assertions/get.js +4 -1
  18. package/associations/association.js +57 -59
  19. package/associations/model.js +41 -41
  20. package/core/CLAUDE.md +156 -222
  21. package/core/Worker.js +1 -5
  22. package/credential/repositories/credential-repository-documentdb.js +1 -71
  23. package/credential/repositories/credential-repository-interface.js +2 -8
  24. package/credential/repositories/credential-repository-mongo.js +4 -45
  25. package/credential/repositories/credential-repository-postgres.js +3 -44
  26. package/credential/repositories/credential-repository.js +4 -6
  27. package/credential/use-cases/get-credential-for-user.js +3 -21
  28. package/credential/use-cases/update-authentication-status.js +2 -5
  29. package/database/MONGODB_TRANSACTION_FIX.md +52 -72
  30. package/database/adapters/lambda-invoker.js +7 -8
  31. package/database/config.js +13 -15
  32. package/database/documentdb-encryption-service.js +13 -29
  33. package/database/documentdb-utils.js +12 -21
  34. package/database/encryption/README.md +36 -53
  35. package/database/encryption/encryption-schema-registry.js +9 -21
  36. package/database/encryption/field-encryption-service.js +4 -15
  37. package/database/encryption/logger.js +2 -3
  38. package/database/encryption/prisma-encryption-extension.js +8 -5
  39. package/database/index.js +2 -4
  40. package/database/models/IndividualUser.js +15 -15
  41. package/database/models/OrganizationUser.js +4 -6
  42. package/database/models/UserModel.js +2 -2
  43. package/database/models/WebsocketConnection.js +1 -4
  44. package/database/mongoose.js +2 -2
  45. package/database/prisma.js +14 -22
  46. package/database/repositories/health-check-repository-documentdb.js +7 -22
  47. package/database/repositories/health-check-repository-factory.js +3 -9
  48. package/database/repositories/health-check-repository-interface.js +5 -15
  49. package/database/repositories/health-check-repository-mongodb.js +6 -9
  50. package/database/repositories/health-check-repository-postgres.js +1 -1
  51. package/database/repositories/migration-status-repository-s3.js +5 -10
  52. package/database/use-cases/check-database-health-use-case.js +2 -3
  53. package/database/use-cases/check-database-state-use-case.js +7 -9
  54. package/database/use-cases/get-database-state-via-worker-use-case.js +12 -15
  55. package/database/use-cases/get-migration-status-use-case.js +2 -4
  56. package/database/use-cases/run-database-migration-use-case.js +9 -41
  57. package/database/use-cases/test-encryption-use-case.js +5 -4
  58. package/database/use-cases/trigger-database-migration-use-case.js +8 -9
  59. package/database/utils/mongodb-collection-utils.js +3 -11
  60. package/database/utils/mongodb-schema-init.js +4 -10
  61. package/database/utils/prisma-runner.js +74 -144
  62. package/database/utils/prisma-schema-parser.js +2 -2
  63. package/docs/PROCESS_MANAGEMENT_QUEUE_SPEC.md +80 -135
  64. package/encrypt/Cryptor.js +2 -8
  65. package/errors/fetch-error.js +1 -1
  66. package/generated/prisma-mongodb/edge.js +16 -59
  67. package/generated/prisma-mongodb/index-browser.js +12 -62
  68. package/generated/prisma-mongodb/index.d.ts +4850 -8136
  69. package/generated/prisma-mongodb/index.js +16 -59
  70. package/generated/prisma-mongodb/package.json +1 -1
  71. package/generated/prisma-mongodb/schema.prisma +33 -75
  72. package/generated/prisma-mongodb/wasm.js +16 -59
  73. package/generated/prisma-postgresql/edge.js +15 -59
  74. package/generated/prisma-postgresql/index-browser.js +11 -62
  75. package/generated/prisma-postgresql/index.d.ts +5963 -8930
  76. package/generated/prisma-postgresql/index.js +15 -59
  77. package/generated/prisma-postgresql/package.json +1 -1
  78. package/generated/prisma-postgresql/schema.prisma +33 -73
  79. package/generated/prisma-postgresql/wasm.js +15 -59
  80. package/handlers/WEBHOOKS.md +81 -104
  81. package/handlers/app-definition-loader.js +1 -1
  82. package/handlers/app-handler-helpers.js +2 -14
  83. package/handlers/backend-utils.js +1 -0
  84. package/handlers/database-migration-handler.js +45 -64
  85. package/handlers/middleware/admin-auth.js +53 -0
  86. package/handlers/routers/HEALTHCHECK.md +135 -170
  87. package/handlers/routers/auth.js +2 -23
  88. package/handlers/routers/db-migration.handler.js +3 -2
  89. package/handlers/routers/db-migration.js +33 -69
  90. package/handlers/routers/health.js +8 -23
  91. package/handlers/routers/integration-defined-routers.js +4 -4
  92. package/handlers/routers/integration-webhook-routers.js +7 -17
  93. package/handlers/routers/websocket.js +3 -9
  94. package/handlers/use-cases/check-integrations-health-use-case.js +6 -13
  95. package/handlers/workers/db-migration.js +26 -54
  96. package/index.js +9 -5
  97. package/integrations/WEBHOOK-QUICKSTART.md +14 -21
  98. package/integrations/index.js +0 -4
  99. package/integrations/integration-base.js +6 -9
  100. package/integrations/integration-router.js +146 -1817
  101. package/integrations/options.js +20 -47
  102. package/integrations/repositories/integration-repository-documentdb.js +24 -53
  103. package/integrations/repositories/integration-repository-factory.js +2 -6
  104. package/integrations/repositories/integration-repository-interface.js +9 -27
  105. package/integrations/repositories/integration-repository-postgres.js +3 -3
  106. package/integrations/repositories/process-repository-factory.js +1 -0
  107. package/integrations/repositories/process-repository-interface.js +5 -9
  108. package/integrations/repositories/process-repository-mongo.js +3 -7
  109. package/integrations/repositories/process-repository-postgres.js +2 -2
  110. package/integrations/tests/doubles/config-capturing-integration.js +8 -9
  111. package/integrations/tests/doubles/dummy-integration-class.js +8 -81
  112. package/integrations/tests/doubles/test-integration-repository.js +11 -51
  113. package/integrations/use-cases/create-integration.js +32 -36
  114. package/integrations/use-cases/create-process.js +9 -20
  115. package/integrations/use-cases/delete-integration-for-user.js +4 -5
  116. package/integrations/use-cases/get-integration-for-user.js +10 -25
  117. package/integrations/use-cases/get-integration-instance-by-definition.js +7 -13
  118. package/integrations/use-cases/get-integrations-for-user.js +1 -4
  119. package/integrations/use-cases/get-possible-integrations.js +1 -1
  120. package/integrations/use-cases/get-process.js +6 -5
  121. package/integrations/use-cases/index.js +1 -3
  122. package/integrations/use-cases/load-integration-context.js +5 -1
  123. package/integrations/use-cases/update-process-state.js +8 -10
  124. package/integrations/utils/map-integration-dto.js +3 -9
  125. package/jest-setup.js +1 -1
  126. package/jest-teardown.js +1 -1
  127. package/lambda/TimeoutCatcher.js +30 -32
  128. package/lambda/index.js +1 -1
  129. package/logs/index.js +3 -3
  130. package/modules/module.js +1 -3
  131. package/modules/repositories/module-repository-documentdb.js +48 -114
  132. package/modules/repositories/module-repository-interface.js +0 -13
  133. package/modules/repositories/module-repository-mongo.js +6 -46
  134. package/modules/repositories/module-repository-postgres.js +6 -48
  135. package/modules/repositories/module-repository.js +1 -34
  136. package/modules/requester/api-key.js +2 -0
  137. package/modules/requester/basic.js +1 -0
  138. package/modules/requester/oauth-2.js +2 -3
  139. package/modules/test/mock-api/definition.js +10 -15
  140. package/modules/test/mock-api/mocks/hubspot.js +36 -36
  141. package/modules/tests/doubles/test-module-factory.js +4 -10
  142. package/modules/tests/doubles/test-module-repository.js +1 -1
  143. package/modules/use-cases/get-entities-for-user.js +1 -1
  144. package/modules/use-cases/get-entity-options-by-id.js +6 -8
  145. package/modules/use-cases/get-module.js +9 -12
  146. package/modules/use-cases/process-authorization-callback.js +6 -12
  147. package/modules/use-cases/refresh-entity-options.js +6 -8
  148. package/modules/use-cases/test-module-auth.js +6 -8
  149. package/modules/utils/map-module-dto.js +2 -2
  150. package/package.json +5 -7
  151. package/prisma-mongodb/schema.prisma +33 -75
  152. package/prisma-postgresql/schema.prisma +33 -73
  153. package/queues/queuer-util.js +1 -5
  154. package/syncs/model.js +51 -51
  155. package/syncs/repositories/sync-repository-documentdb.js +19 -39
  156. package/syncs/repositories/sync-repository-interface.js +2 -6
  157. package/syncs/repositories/sync-repository-postgres.js +13 -19
  158. package/syncs/sync.js +100 -104
  159. package/token/repositories/token-repository-factory.js +3 -1
  160. package/types/assertions/index.d.ts +72 -72
  161. package/types/associations/index.d.ts +57 -57
  162. package/types/core/index.d.ts +53 -59
  163. package/types/database/index.d.ts +2 -2
  164. package/types/encrypt/index.d.ts +3 -3
  165. package/types/errors/index.d.ts +54 -61
  166. package/types/eslint-config/index.d.ts +40 -40
  167. package/types/integrations/index.d.ts +183 -185
  168. package/types/lambda/index.d.ts +26 -26
  169. package/types/logs/index.d.ts +4 -4
  170. package/types/module-plugin/index.d.ts +237 -239
  171. package/types/prettier-config/index.d.ts +5 -5
  172. package/types/syncs/index.d.ts +108 -102
  173. package/types/test-environment/index.d.ts +14 -14
  174. package/types/tsconfig.json +93 -95
  175. package/user/tests/doubles/test-user-repository.js +2 -5
  176. package/user/use-cases/authenticate-user.js +4 -2
  177. package/user/use-cases/authenticate-with-shared-secret.js +1 -1
  178. package/user/use-cases/create-individual-user.js +7 -8
  179. package/user/use-cases/create-organization-user.js +1 -1
  180. package/user/use-cases/create-token-for-user-id.js +1 -1
  181. package/user/use-cases/get-user-from-adopter-jwt.js +2 -0
  182. package/user/use-cases/get-user-from-bearer-token.js +3 -7
  183. package/user/use-cases/get-user-from-x-frigg-headers.js +11 -14
  184. package/user/use-cases/login-user.js +8 -8
  185. package/user/user.js +4 -18
  186. package/utils/backend-path.js +2 -2
  187. package/utils/index.js +1 -4
  188. package/websocket/repositories/websocket-connection-repository-documentdb.js +8 -21
  189. package/websocket/repositories/websocket-connection-repository-mongo.js +4 -8
  190. package/websocket/repositories/websocket-connection-repository-postgres.js +4 -8
  191. package/websocket/repositories/websocket-connection-repository.js +4 -8
  192. package/admin-scripts/repositories/admin-api-key-repository-interface.js +0 -121
  193. package/admin-scripts/repositories/admin-api-key-repository-mongo.js +0 -155
  194. package/admin-scripts/repositories/admin-api-key-repository-postgres.js +0 -189
  195. package/admin-scripts/repositories/script-execution-repository-documentdb.js +0 -21
  196. package/admin-scripts/repositories/script-execution-repository-factory.js +0 -55
  197. package/admin-scripts/repositories/script-execution-repository-interface.js +0 -193
  198. package/admin-scripts/repositories/script-execution-repository-mongo.js +0 -278
  199. package/admin-scripts/repositories/script-execution-repository-postgres.js +0 -320
  200. package/credential/credential-router.js +0 -262
  201. package/credential/use-cases/delete-credential-for-user.js +0 -50
  202. package/credential/use-cases/list-credentials-for-user.js +0 -31
  203. package/credential/use-cases/reauthorize-credential.js +0 -103
  204. package/handlers/routers/admin.js +0 -450
  205. package/handlers/routers/docs.js +0 -180
  206. package/handlers/routers/middleware/loadUser.js +0 -39
  207. package/handlers/routers/middleware/requireAdmin.js +0 -41
  208. package/handlers/routers/middleware/requireLoggedInUser.js +0 -19
  209. package/integrations/use-cases/execute-proxy-request.js +0 -564
  210. package/modules/domain/entities/AuthorizationSession.js +0 -131
  211. package/modules/domain/entities/index.js +0 -10
  212. package/modules/repositories/authorization-session-repository-factory.js +0 -55
  213. package/modules/repositories/authorization-session-repository-interface.js +0 -75
  214. package/modules/repositories/authorization-session-repository-mongo.js +0 -169
  215. package/modules/repositories/authorization-session-repository-postgres.js +0 -170
  216. package/modules/use-cases/delete-module-entity.js +0 -23
  217. package/modules/use-cases/get-authorization-requirements.js +0 -110
  218. package/modules/use-cases/get-module-entity-by-id.js +0 -16
  219. package/modules/use-cases/process-authorization-step.js +0 -160
  220. package/modules/use-cases/start-authorization-session.js +0 -86
  221. package/modules/use-cases/update-module-entity.js +0 -27
  222. package/openapi/openapi-spec-generator.js +0 -370
  223. package/openapi/openapi-v1.yaml +0 -1360
  224. package/openapi/openapi-v2.yaml +0 -1535
  225. package/user/use-cases/delete-user.js +0 -47
package/CLAUDE.md CHANGED
@@ -4,12 +4,12 @@ This file provides guidance to Claude Code when working with the Frigg Framework
4
4
 
5
5
  ## Critical Context (Read First)
6
6
 
7
- - **Package Purpose**: Core framework functionality for building enterprise serverless integrations
8
- - **Main Architecture**: Hexagonal/DDD architecture with clear separation of adapters, use cases, and repositories
9
- - **Key Technologies**: Node.js, Express, AWS Lambda, MongoDB/PostgreSQL (Prisma), AWS KMS encryption
10
- - **Core Value**: Provides building blocks for integration developers - they extend IntegrationBase and use framework services
11
- - **Security Model**: Field-level encryption, OAuth2 flows, signature validation, VPC deployment
12
- - **DO NOT**: Bypass architectural layers, skip encryption for sensitive data, expose internal errors to users
7
+ - **Package Purpose**: Core framework functionality for building enterprise serverless integrations
8
+ - **Main Architecture**: Hexagonal/DDD architecture with clear separation of adapters, use cases, and repositories
9
+ - **Key Technologies**: Node.js, Express, AWS Lambda, MongoDB/PostgreSQL (Prisma), AWS KMS encryption
10
+ - **Core Value**: Provides building blocks for integration developers - they extend IntegrationBase and use framework services
11
+ - **Security Model**: Field-level encryption, OAuth2 flows, signature validation, VPC deployment
12
+ - **DO NOT**: Bypass architectural layers, skip encryption for sensitive data, expose internal errors to users
13
13
 
14
14
  ## Table of Contents
15
15
 
@@ -26,14 +26,14 @@ This file provides guidance to Claude Code when working with the Frigg Framework
26
26
 
27
27
  `@friggframework/core` is the foundational package of the Frigg Framework, providing:
28
28
 
29
- - **IntegrationBase**: Base class all integrations extend
30
- - **Database Layer**: Multi-database support (MongoDB, DocumentDB, PostgreSQL) with Prisma ORM
31
- - **Encryption**: Transparent field-level encryption with AWS KMS or AES
32
- - **User Management**: Individual and organizational user support
33
- - **Module System**: API module loading and credential management
34
- - **Lambda Runtime**: Handler factory, worker base class, timeout management
35
- - **Error Handling**: Standardized error types with proper HTTP status codes
36
- - **Event System**: Integration lifecycle events and user actions
29
+ - **IntegrationBase**: Base class all integrations extend
30
+ - **Database Layer**: Multi-database support (MongoDB, DocumentDB, PostgreSQL) with Prisma ORM
31
+ - **Encryption**: Transparent field-level encryption with AWS KMS or AES
32
+ - **User Management**: Individual and organizational user support
33
+ - **Module System**: API module loading and credential management
34
+ - **Lambda Runtime**: Handler factory, worker base class, timeout management
35
+ - **Error Handling**: Standardized error types with proper HTTP status codes
36
+ - **Event System**: Integration lifecycle events and user actions
37
37
 
38
38
  ## Architecture Principles
39
39
 
@@ -196,25 +196,22 @@ packages/core/
196
196
  **Purpose**: Foundation for building integrations between external systems.
197
197
 
198
198
  **Key Files**:
199
-
200
- - `integration-base.js` - Base class all integrations extend
201
- - `integration.js` - Integration domain aggregate using Proxy pattern
202
- - `options.js` - Integration configuration and options
199
+ - `integration-base.js` - Base class all integrations extend
200
+ - `integration.js` - Integration domain aggregate using Proxy pattern
201
+ - `options.js` - Integration configuration and options
203
202
 
204
203
  **Use Cases**:
205
-
206
- - `create-integration.js` - Create new integration instance
207
- - `update-integration.js` - Update integration configuration
208
- - `delete-integration-for-user.js` - Remove integration
209
- - `get-integration-instance.js` - Load integration with modules
210
- - `load-integration-context.js` - Full integration context loading
204
+ - `create-integration.js` - Create new integration instance
205
+ - `update-integration.js` - Update integration configuration
206
+ - `delete-integration-for-user.js` - Remove integration
207
+ - `get-integration-instance.js` - Load integration with modules
208
+ - `load-integration-context.js` - Full integration context loading
211
209
 
212
210
  **Repositories**:
213
-
214
- - `integration-repository-factory.js` - Creates database-specific repositories
215
- - `integration-repository-mongo.js` - MongoDB implementation
216
- - `integration-repository-postgres.js` - PostgreSQL implementation
217
- - `integration-mapping-repository-*.js` - Mapping data persistence
211
+ - `integration-repository-factory.js` - Creates database-specific repositories
212
+ - `integration-repository-mongo.js` - MongoDB implementation
213
+ - `integration-repository-postgres.js` - PostgreSQL implementation
214
+ - `integration-mapping-repository-*.js` - Mapping data persistence
218
215
 
219
216
  **Integration developers extend IntegrationBase**:
220
217
 
@@ -227,8 +224,8 @@ class MyIntegration extends IntegrationBase {
227
224
  version: '1.0.0',
228
225
  modules: {
229
226
  serviceA: 'service-a',
230
- serviceB: 'service-b',
231
- },
227
+ serviceB: 'service-b'
228
+ }
232
229
  };
233
230
 
234
231
  async onCreate({ integrationId }) {
@@ -243,60 +240,52 @@ class MyIntegration extends IntegrationBase {
243
240
  **Purpose**: Multi-database support with transparent encryption.
244
241
 
245
242
  **Key Components**:
246
-
247
- - `prisma.js` - Prisma client initialization with encryption extension
248
- - `mongo.js` - Mongoose connection management (legacy)
249
- - `models/` - Mongoose model definitions
243
+ - `prisma.js` - Prisma client initialization with encryption extension
244
+ - `mongo.js` - Mongoose connection management (legacy)
245
+ - `models/` - Mongoose model definitions
250
246
 
251
247
  **Encryption System** (`/database/encryption`):
252
-
253
- - **Transparent encryption**: Application code never sees encrypted data
254
- - **Database-agnostic**: Works with MongoDB and PostgreSQL
255
- - **AWS KMS or AES**: Production KMS, development AES
256
- - **Configurable**: Via environment variables and app definition
248
+ - **Transparent encryption**: Application code never sees encrypted data
249
+ - **Database-agnostic**: Works with MongoDB and PostgreSQL
250
+ - **AWS KMS or AES**: Production KMS, development AES
251
+ - **Configurable**: Via environment variables and app definition
257
252
 
258
253
  **See**: `database/encryption/README.md` for comprehensive documentation
259
254
 
260
255
  **Repositories**:
261
-
262
- - `health-check-repository.js` - Database health monitoring
263
- - `token-repository.js` - Authentication tokens
264
- - `websocket-connection-repository.js` - WebSocket connections
265
- - DocumentDB-enabled adapters mirror the MongoDB APIs but execute raw commands (`$runCommandRaw`, `$aggregateRaw`) for compatibility; encrypted models (e.g., credentials) still delegate reads to Prisma so the encryption extension can decrypt secrets transparently.
256
+ - `health-check-repository.js` - Database health monitoring
257
+ - `token-repository.js` - Authentication tokens
258
+ - `websocket-connection-repository.js` - WebSocket connections
259
+ - DocumentDB-enabled adapters mirror the MongoDB APIs but execute raw commands (`$runCommandRaw`, `$aggregateRaw`) for compatibility; encrypted models (e.g., credentials) still delegate reads to Prisma so the encryption extension can decrypt secrets transparently.
266
260
 
267
261
  **Use Cases**:
268
-
269
- - `check-database-health-use-case.js` - Database health checks
270
- - `test-encryption-use-case.js` - Encryption verification
262
+ - `check-database-health-use-case.js` - Database health checks
263
+ - `test-encryption-use-case.js` - Encryption verification
271
264
 
272
265
  ### 3. User Management (`/user`)
273
266
 
274
267
  **Purpose**: Individual and organizational user authentication.
275
268
 
276
269
  **User Types**:
277
-
278
- - **Individual Users**: Personal accounts with email/password
279
- - **Organization Users**: Business accounts with organization-level access
280
- - **Hybrid**: Support both simultaneously
270
+ - **Individual Users**: Personal accounts with email/password
271
+ - **Organization Users**: Business accounts with organization-level access
272
+ - **Hybrid**: Support both simultaneously
281
273
 
282
274
  **Authentication Methods**:
283
-
284
- - Password-based (bcrypt hashed)
285
- - Token-based (Bearer tokens)
286
- - App-based (external app user IDs)
275
+ - Password-based (bcrypt hashed)
276
+ - Token-based (Bearer tokens)
277
+ - App-based (external app user IDs)
287
278
 
288
279
  **Use Cases**:
289
-
290
- - `login-user.js` - User authentication
291
- - `create-individual-user.js` - Create personal account
292
- - `create-organization-user.js` - Create business account
293
- - `get-user-from-bearer-token.js` - Token authentication
280
+ - `login-user.js` - User authentication
281
+ - `create-individual-user.js` - Create personal account
282
+ - `create-organization-user.js` - Create business account
283
+ - `get-user-from-bearer-token.js` - Token authentication
294
284
 
295
285
  **Repositories**:
296
-
297
- - `user-repository-factory.js` - Creates database-specific repositories
298
- - `user-repository-mongo.js` - MongoDB implementation
299
- - `user-repository-postgres.js` - PostgreSQL implementation
286
+ - `user-repository-factory.js` - Creates database-specific repositories
287
+ - `user-repository-mongo.js` - MongoDB implementation
288
+ - `user-repository-postgres.js` - PostgreSQL implementation
300
289
 
301
290
  **Configuration** (in app definition):
302
291
 
@@ -316,24 +305,21 @@ class MyIntegration extends IntegrationBase {
316
305
  **Purpose**: API module loading, credential management, and HTTP clients.
317
306
 
318
307
  **Key Classes**:
319
-
320
- - `Credential` - API credentials domain entity
321
- - `Entity` - External service entity (account, workspace, etc.)
322
- - `Requester` - Base HTTP client class
323
- - `OAuth2Requester` - OAuth 2.0 flow implementation
324
- - `ApiKeyRequester` - API key authentication
325
- - `BasicAuthRequester` - Basic authentication
308
+ - `Credential` - API credentials domain entity
309
+ - `Entity` - External service entity (account, workspace, etc.)
310
+ - `Requester` - Base HTTP client class
311
+ - `OAuth2Requester` - OAuth 2.0 flow implementation
312
+ - `ApiKeyRequester` - API key authentication
313
+ - `BasicAuthRequester` - Basic authentication
326
314
 
327
315
  **Module Factory**:
328
-
329
- - `ModuleFactory` - Creates and configures API module instances
330
- - Handles credential injection
331
- - Manages module lifecycle
316
+ - `ModuleFactory` - Creates and configures API module instances
317
+ - Handles credential injection
318
+ - Manages module lifecycle
332
319
 
333
320
  **Repositories**:
334
-
335
- - `module-repository.js` - Module data access
336
- - `credential-repository.js` - Credential persistence (encrypted)
321
+ - `module-repository.js` - Module data access
322
+ - `credential-repository.js` - Credential persistence (encrypted)
337
323
 
338
324
  ### 5. Core Runtime System (`/core`)
339
325
 
@@ -342,11 +328,10 @@ class MyIntegration extends IntegrationBase {
342
328
  **See**: `core/CLAUDE.md` for comprehensive documentation
343
329
 
344
330
  **Key Components**:
345
-
346
- - `create-handler.js` - Lambda handler factory
347
- - `Worker.js` - SQS job processing base class
348
- - `Delegate.js` - Observer/delegation pattern
349
- - `load-installed-modules.js` - Dynamic module loading
331
+ - `create-handler.js` - Lambda handler factory
332
+ - `Worker.js` - SQS job processing base class
333
+ - `Delegate.js` - Observer/delegation pattern
334
+ - `load-installed-modules.js` - Dynamic module loading
350
335
 
351
336
  **Handler Pattern**:
352
337
 
@@ -355,12 +340,12 @@ const { createHandler } = require('@friggframework/core');
355
340
 
356
341
  const handler = createHandler({
357
342
  eventName: 'MyIntegration',
358
- isUserFacingResponse: true, // Sanitize errors
359
- shouldUseDatabase: true, // Connect to DB
343
+ isUserFacingResponse: true, // Sanitize errors
344
+ shouldUseDatabase: true, // Connect to DB
360
345
  method: async (event, context) => {
361
346
  // Your logic here
362
347
  return { statusCode: 200, body: 'Success' };
363
- },
348
+ }
364
349
  });
365
350
  ```
366
351
 
@@ -385,11 +370,10 @@ class MyWorker extends Worker {
385
370
  **Purpose**: Cryptor adapter for AWS KMS and AES encryption.
386
371
 
387
372
  **Key Class**: `Cryptor.js`
388
-
389
- - Envelope encryption pattern
390
- - AWS KMS integration
391
- - AES-256-GCM fallback
392
- - Key rotation support
373
+ - Envelope encryption pattern
374
+ - AWS KMS integration
375
+ - AES-256-GCM fallback
376
+ - Key rotation support
393
377
 
394
378
  **Usage**:
395
379
 
@@ -397,7 +381,7 @@ class MyWorker extends Worker {
397
381
  const { Cryptor } = require('@friggframework/core');
398
382
 
399
383
  const cryptor = new Cryptor({
400
- shouldUseAws: process.env.KMS_KEY_ARN ? true : false,
384
+ shouldUseAws: process.env.KMS_KEY_ARN ? true : false
401
385
  });
402
386
 
403
387
  const encrypted = await cryptor.encrypt('sensitive-data');
@@ -409,33 +393,29 @@ const decrypted = await cryptor.decrypt(encrypted);
409
393
  **Purpose**: HTTP/Lambda request handling and routing.
410
394
 
411
395
  **Key Routers**:
412
-
413
- - `integration-router.js` - Integration CRUD operations
414
- - `auth.js` - Authentication endpoints
415
- - `health.js` - Health check endpoints with encryption verification
396
+ - `integration-router.js` - Integration CRUD operations
397
+ - `auth.js` - Authentication endpoints
398
+ - `health.js` - Health check endpoints with encryption verification
416
399
 
417
400
  **Handler Types**:
418
-
419
- - **User-facing**: Sanitize errors, friendly responses
420
- - **Server-to-server**: Full error details for debugging
421
- - **Background workers**: SQS message processing
401
+ - **User-facing**: Sanitize errors, friendly responses
402
+ - **Server-to-server**: Full error details for debugging
403
+ - **Background workers**: SQS message processing
422
404
 
423
405
  **Event Dispatcher**:
424
-
425
- - `integration-event-dispatcher.js` - Routes events to integration handlers
426
- - Supports lifecycle events and user actions
406
+ - `integration-event-dispatcher.js` - Routes events to integration handlers
407
+ - Supports lifecycle events and user actions
427
408
 
428
409
  ### 8. Error Handling (`/errors`)
429
410
 
430
411
  **Purpose**: Standardized error types with proper HTTP semantics.
431
412
 
432
413
  **Error Types**:
433
-
434
- - `BaseError` - Base error class
435
- - `FetchError` - HTTP request failures
436
- - `HaltError` - Stop processing without retry
437
- - `RequiredPropertyError` - Missing required parameters
438
- - `ParameterTypeError` - Invalid parameter type
414
+ - `BaseError` - Base error class
415
+ - `FetchError` - HTTP request failures
416
+ - `HaltError` - Stop processing without retry
417
+ - `RequiredPropertyError` - Missing required parameters
418
+ - `ParameterTypeError` - Invalid parameter type
439
419
 
440
420
  **Usage**:
441
421
 
@@ -452,10 +432,9 @@ if (!userId) {
452
432
  **Purpose**: Structured logging with debug capabilities.
453
433
 
454
434
  **Functions**:
455
-
456
- - `debug(message, data)` - Debug logging
457
- - `initDebugLog(eventName, event)` - Initialize debug context
458
- - `flushDebugLog(error)` - Flush logs on error
435
+ - `debug(message, data)` - Debug logging
436
+ - `initDebugLog(eventName, event)` - Initialize debug context
437
+ - `flushDebugLog(error)` - Flush logs on error
459
438
 
460
439
  **Usage**:
461
440
 
@@ -473,9 +452,8 @@ flushDebugLog(); // On error
473
452
  **Purpose**: AWS Lambda-specific utilities.
474
453
 
475
454
  **Key Classes**:
476
-
477
- - `TimeoutCatcher` - Detect approaching Lambda timeout
478
- - Graceful shutdown handling
455
+ - `TimeoutCatcher` - Detect approaching Lambda timeout
456
+ - Graceful shutdown handling
479
457
 
480
458
  **Usage**:
481
459
 
@@ -533,10 +511,10 @@ const appDefinition = {
533
511
  encryption: {
534
512
  schema: {
535
513
  MyCustomModel: {
536
- fields: ['secretData', 'data.apiKey'],
537
- },
538
- },
539
- },
514
+ fields: ['secretData', 'data.apiKey']
515
+ }
516
+ }
517
+ }
540
518
  };
541
519
  ```
542
520
 
@@ -547,8 +525,8 @@ Edit `database/encryption/encryption-schema-registry.js`:
547
525
  ```javascript
548
526
  const ENCRYPTION_SCHEMA = {
549
527
  MyModel: {
550
- fields: ['sensitiveField'],
551
- },
528
+ fields: ['sensitiveField']
529
+ }
552
530
  };
553
531
  ```
554
532
 
@@ -593,7 +571,7 @@ describe('MyUseCase', () => {
593
571
  beforeEach(() => {
594
572
  mockRepository = {
595
573
  findById: jest.fn(),
596
- save: jest.fn(),
574
+ save: jest.fn()
597
575
  };
598
576
  useCase = new MyUseCase({ repository: mockRepository });
599
577
  });
@@ -660,35 +638,35 @@ Use test doubles from `@friggframework/test` package for consistent mocking.
660
638
 
661
639
  ### Required
662
640
 
663
- - `AWS_REGION` - AWS region for services
664
- - `DATABASE_URL` - Database connection string (auto-set)
665
- - `DB_TYPE` - Database type: 'mongodb' or 'postgresql'
641
+ - `AWS_REGION` - AWS region for services
642
+ - `DATABASE_URL` - Database connection string (auto-set)
643
+ - `DB_TYPE` - Database type: 'mongodb' or 'postgresql'
666
644
 
667
645
  ### Encryption
668
646
 
669
- - `KMS_KEY_ARN` - AWS KMS key ARN (production)
670
- - `AES_KEY_ID` - AES key ID (development)
671
- - `AES_KEY` - AES encryption key (development)
672
- - `STAGE` - Environment stage (dev, test, local bypass encryption)
647
+ - `KMS_KEY_ARN` - AWS KMS key ARN (production)
648
+ - `AES_KEY_ID` - AES key ID (development)
649
+ - `AES_KEY` - AES encryption key (development)
650
+ - `STAGE` - Environment stage (dev, test, local bypass encryption)
673
651
 
674
652
  ### Optional
675
653
 
676
- - `SECRET_ARN` - AWS Secrets Manager ARN for auto-injection
677
- - `DEBUG` - Debug logging pattern
678
- - `LOG_LEVEL` - Logging level (debug, info, warn, error)
654
+ - `SECRET_ARN` - AWS Secrets Manager ARN for auto-injection
655
+ - `DEBUG` - Debug logging pattern
656
+ - `LOG_LEVEL` - Logging level (debug, info, warn, error)
679
657
 
680
658
  ## Version Information
681
659
 
682
- - **Current Version**: 2.0.0-next.0 (pre-release)
683
- - **Node.js**: >=18 required
684
- - **Dependencies**: See package.json for full list
660
+ - **Current Version**: 2.0.0-next.0 (pre-release)
661
+ - **Node.js**: >=18 required
662
+ - **Dependencies**: See package.json for full list
685
663
 
686
664
  ## Support and Documentation
687
665
 
688
- - **Main Framework CLAUDE.md**: See root Frigg CLAUDE.md for framework-wide guidance
689
- - **Core Runtime**: See `core/CLAUDE.md` for Lambda/Worker patterns
690
- - **Encryption**: See `database/encryption/README.md` for encryption details
691
- - **Package README**: See `README.md` for API reference
666
+ - **Main Framework CLAUDE.md**: See root Frigg CLAUDE.md for framework-wide guidance
667
+ - **Core Runtime**: See `core/CLAUDE.md` for Lambda/Worker patterns
668
+ - **Encryption**: See `database/encryption/README.md` for encryption details
669
+ - **Package README**: See `README.md` for API reference
692
670
 
693
671
  ## Recent Important Changes
694
672
 
@@ -699,15 +677,13 @@ Use test doubles from `@friggframework/test` package for consistent mocking.
699
677
  **Problem**: The `FieldEncryptionService` was converting objects to the string `"[object Object]"` before encrypting, corrupting JSON fields like `IntegrationMapping.mapping`.
700
678
 
701
679
  **Solution**: Added `_serializeForEncryption()` and `_deserializeAfterDecryption()` methods:
702
-
703
- - Objects are now JSON.stringify'd before encryption
704
- - Decrypted strings are JSON.parse'd back to objects
705
- - Plain strings work as before
680
+ - Objects are now JSON.stringify'd before encryption
681
+ - Decrypted strings are JSON.parse'd back to objects
682
+ - Plain strings work as before
706
683
 
707
684
  **Files Changed**:
708
-
709
- - `database/encryption/field-encryption-service.js`
710
- - `database/encryption/field-encryption-service.test.js`
685
+ - `database/encryption/field-encryption-service.js`
686
+ - `database/encryption/field-encryption-service.test.js`
711
687
 
712
688
  **Test Coverage**: All 40 tests pass, including new object encryption test.
713
689