@friggframework/core 2.0.0--canary.395.0e9373c.0 → 2.0.0--canary.395.1cc36bf.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.
- package/application/commands/credential-commands.js +10 -10
- package/application/commands/entity-commands.js +4 -2
- package/application/commands/integration-commands.js +7 -5
- package/application/commands/user-commands.js +2 -2
- package/core/CLAUDE.md +690 -0
- package/credential/repositories/credential-repository-factory.js +45 -0
- package/credential/repositories/credential-repository-interface.js +98 -0
- package/credential/repositories/credential-repository.js +317 -0
- package/database/config.js +30 -0
- package/database/index.js +23 -4
- package/database/models/readme.md +1 -0
- package/database/prisma.js +69 -0
- package/database/repositories/health-check-repository-factory.js +44 -0
- package/database/repositories/health-check-repository-interface.js +86 -0
- package/database/repositories/health-check-repository.js +132 -0
- package/database/use-cases/check-database-health-use-case.js +34 -0
- package/database/use-cases/test-encryption-use-case.js +193 -0
- package/handlers/routers/HEALTHCHECK.md +103 -1
- package/handlers/routers/health.js +26 -193
- package/handlers/routers/user.js +2 -2
- package/handlers/routers/websocket.js +5 -3
- package/index.js +21 -8
- package/integrations/index.js +10 -9
- package/integrations/integration-base.js +17 -5
- package/integrations/integration-router.js +145 -61
- package/integrations/repositories/integration-mapping-repository-factory.js +47 -0
- package/integrations/repositories/integration-mapping-repository-interface.js +106 -0
- package/integrations/repositories/integration-mapping-repository.js +156 -0
- package/integrations/repositories/integration-repository-factory.js +46 -0
- package/integrations/repositories/integration-repository-interface.js +115 -0
- package/integrations/repositories/integration-repository-mongo.js +271 -0
- package/integrations/repositories/integration-repository-postgres.js +270 -0
- package/integrations/use-cases/create-integration.js +21 -9
- package/integrations/use-cases/delete-integration-for-user.js +8 -7
- package/integrations/use-cases/get-integration-for-user.js +3 -3
- package/integrations/use-cases/get-integration-instance-by-definition.js +3 -3
- package/integrations/use-cases/get-integration-instance.js +15 -14
- package/integrations/use-cases/get-integrations-for-user.js +28 -17
- package/integrations/use-cases/load-integration-context-full.test.js +3 -3
- package/integrations/use-cases/update-integration-messages.js +17 -4
- package/integrations/use-cases/update-integration-status.js +7 -3
- package/integrations/use-cases/update-integration.js +18 -16
- package/modules/index.js +0 -2
- package/modules/module-factory.js +2 -2
- package/modules/module.js +19 -12
- package/modules/repositories/module-repository-factory.js +45 -0
- package/modules/repositories/module-repository-interface.js +129 -0
- package/modules/repositories/module-repository.js +327 -0
- package/modules/use-cases/get-entity-options-by-id.js +3 -2
- package/modules/use-cases/process-authorization-callback.js +30 -17
- package/modules/use-cases/refresh-entity-options.js +3 -2
- package/modules/use-cases/test-module-auth.js +7 -6
- package/package.json +14 -6
- package/prisma-mongo/schema.prisma +321 -0
- package/prisma-postgres/migrations/20250930193005_init/migration.sql +315 -0
- package/prisma-postgres/migrations/migration_lock.toml +3 -0
- package/prisma-postgres/schema.prisma +303 -0
- package/syncs/manager.js +468 -443
- package/syncs/repositories/sync-repository-factory.js +46 -0
- package/syncs/repositories/sync-repository-interface.js +109 -0
- package/syncs/repositories/sync-repository-mongo.js +239 -0
- package/syncs/repositories/sync-repository-postgres.js +230 -0
- package/token/repositories/token-repository-factory.js +45 -0
- package/token/repositories/token-repository-interface.js +131 -0
- package/token/repositories/token-repository.js +219 -0
- package/user/repositories/user-repository-factory.js +48 -0
- package/user/repositories/user-repository-interface.js +198 -0
- package/user/repositories/user-repository.js +261 -0
- package/user/use-cases/create-individual-user.js +1 -1
- package/user/use-cases/create-organization-user.js +1 -1
- package/user/use-cases/create-token-for-user-id.js +1 -1
- package/user/use-cases/get-user-from-bearer-token.js +1 -1
- package/user/use-cases/login-user.js +1 -1
- package/websocket/repositories/websocket-connection-repository-factory.js +47 -0
- package/websocket/repositories/websocket-connection-repository-interface.js +106 -0
- package/websocket/repositories/websocket-connection-repository.js +160 -0
- package/credential/credential-repository.js +0 -122
- package/database/models/State.js +0 -9
- package/database/models/Token.js +0 -70
- package/integrations/integration-mapping.js +0 -43
- package/integrations/integration-model.js +0 -46
- package/integrations/integration-repository.js +0 -100
- package/modules/module-repository.js +0 -165
- package/user/user-repository.js +0 -62
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const {
|
|
2
|
-
|
|
3
|
-
} = require('../../credential/credential-repository');
|
|
2
|
+
createCredentialRepository,
|
|
3
|
+
} = require('../../credential/repositories/credential-repository-factory');
|
|
4
4
|
|
|
5
5
|
const ERROR_CODE_MAP = {
|
|
6
6
|
CREDENTIAL_NOT_FOUND: 404,
|
|
@@ -24,7 +24,7 @@ function mapErrorToResponse(error) {
|
|
|
24
24
|
* @returns {Object} Credential command object with CRUD operations
|
|
25
25
|
*/
|
|
26
26
|
function createCredentialCommands() {
|
|
27
|
-
const credRepo =
|
|
27
|
+
const credRepo = createCredentialRepository();
|
|
28
28
|
|
|
29
29
|
return {
|
|
30
30
|
/**
|
|
@@ -49,7 +49,7 @@ function createCredentialCommands() {
|
|
|
49
49
|
try {
|
|
50
50
|
if (!userId || !externalId || !access_token) {
|
|
51
51
|
const error = new Error(
|
|
52
|
-
'userId, externalId, and access_token are required'
|
|
52
|
+
'userId, externalId, and access_token are required'
|
|
53
53
|
);
|
|
54
54
|
error.code = 'INVALID_CREDENTIAL_DATA';
|
|
55
55
|
throw error;
|
|
@@ -71,7 +71,7 @@ function createCredentialCommands() {
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
const credential = await credRepo.upsertCredential(
|
|
74
|
-
credentialData
|
|
74
|
+
credentialData
|
|
75
75
|
);
|
|
76
76
|
|
|
77
77
|
return {
|
|
@@ -103,7 +103,7 @@ function createCredentialCommands() {
|
|
|
103
103
|
!filter.credentialId
|
|
104
104
|
) {
|
|
105
105
|
const error = new Error(
|
|
106
|
-
'At least one filter criterion is required'
|
|
106
|
+
'At least one filter criterion is required'
|
|
107
107
|
);
|
|
108
108
|
error.code = 'INVALID_CREDENTIAL_DATA';
|
|
109
109
|
throw error;
|
|
@@ -145,12 +145,12 @@ function createCredentialCommands() {
|
|
|
145
145
|
|
|
146
146
|
const credential = await credRepo.updateCredential(
|
|
147
147
|
credentialId,
|
|
148
|
-
updates
|
|
148
|
+
updates
|
|
149
149
|
);
|
|
150
150
|
|
|
151
151
|
if (!credential) {
|
|
152
152
|
const error = new Error(
|
|
153
|
-
`Credential ${credentialId} not found
|
|
153
|
+
`Credential ${credentialId} not found`
|
|
154
154
|
);
|
|
155
155
|
error.code = 'CREDENTIAL_NOT_FOUND';
|
|
156
156
|
throw error;
|
|
@@ -186,7 +186,7 @@ function createCredentialCommands() {
|
|
|
186
186
|
|
|
187
187
|
await credRepo.updateAuthenticationStatus(
|
|
188
188
|
credentialId,
|
|
189
|
-
isValid
|
|
189
|
+
isValid
|
|
190
190
|
);
|
|
191
191
|
|
|
192
192
|
return { success: true };
|
|
@@ -221,4 +221,4 @@ function createCredentialCommands() {
|
|
|
221
221
|
module.exports = {
|
|
222
222
|
createCredentialCommands,
|
|
223
223
|
ERROR_CODE_MAP,
|
|
224
|
-
};
|
|
224
|
+
};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const {
|
|
2
|
+
createModuleRepository,
|
|
3
|
+
} = require('../../modules/repositories/module-repository-factory');
|
|
2
4
|
|
|
3
5
|
const ERROR_CODE_MAP = {
|
|
4
6
|
ENTITY_NOT_FOUND: 404,
|
|
@@ -22,7 +24,7 @@ function mapErrorToResponse(error) {
|
|
|
22
24
|
* @returns {Object} Entity command object with CRUD operations
|
|
23
25
|
*/
|
|
24
26
|
function createEntityCommands() {
|
|
25
|
-
const moduleRepo =
|
|
27
|
+
const moduleRepo = createModuleRepository();
|
|
26
28
|
|
|
27
29
|
return {
|
|
28
30
|
/**
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
const {
|
|
2
|
-
|
|
3
|
-
} = require('../../integrations/integration-repository');
|
|
4
|
-
const {
|
|
2
|
+
createIntegrationRepository,
|
|
3
|
+
} = require('../../integrations/repositories/integration-repository-factory');
|
|
4
|
+
const {
|
|
5
|
+
createModuleRepository,
|
|
6
|
+
} = require('../../modules/repositories/module-repository-factory');
|
|
5
7
|
const { ModuleFactory } = require('../../modules/module-factory');
|
|
6
8
|
const {
|
|
7
9
|
LoadIntegrationContextUseCase,
|
|
@@ -36,8 +38,8 @@ function createIntegrationCommands({ integrationClass } = {}) {
|
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
// Always use Frigg's default repositories and use cases
|
|
39
|
-
const integrationRepository =
|
|
40
|
-
const moduleRepository =
|
|
41
|
+
const integrationRepository = createIntegrationRepository();
|
|
42
|
+
const moduleRepository = createModuleRepository();
|
|
41
43
|
|
|
42
44
|
const moduleDefinitions = getModulesDefinitionFromIntegrationClasses([
|
|
43
45
|
integrationClass,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const { createUserRepository } = require('../../user/user-repository-factory');
|
|
2
2
|
|
|
3
3
|
const ERROR_CODE_MAP = {
|
|
4
4
|
USER_NOT_FOUND: 404,
|
|
@@ -23,7 +23,7 @@ function mapErrorToResponse(error) {
|
|
|
23
23
|
* @returns {Object} User command object with CRUD operations
|
|
24
24
|
*/
|
|
25
25
|
function createUserCommands() {
|
|
26
|
-
const userRepository =
|
|
26
|
+
const userRepository = createUserRepository({ userConfig: {} });
|
|
27
27
|
|
|
28
28
|
return {
|
|
29
29
|
/**
|