@friggframework/core 2.0.0--canary.396.8420fe0.0 → 2.0.0--canary.396.8e54b1f.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/integrations/integration-router.js +1 -1
- package/integrations/integration.js +9 -3
- package/integrations/use-cases/create-integration.js +1 -1
- package/integrations/use-cases/get-integration-for-user.js +1 -1
- package/integrations/use-cases/get-integration.js +1 -1
- package/integrations/use-cases/get-integrations-for-user.js +1 -1
- package/module-plugin/module-repository.js +1 -1
- package/module-plugin/utils/map-module-dto.js +2 -0
- package/package.json +5 -5
|
@@ -140,7 +140,7 @@ function setIntegrationRoutes(router, factory, getUserFromBearerToken, integrati
|
|
|
140
140
|
const results = {
|
|
141
141
|
entities: {
|
|
142
142
|
options: integrations.map((integration) =>
|
|
143
|
-
integration.
|
|
143
|
+
integration.options
|
|
144
144
|
),
|
|
145
145
|
authorized: await getEntitiesForUserUseCase.execute(userId),
|
|
146
146
|
},
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
const { Options } = require('./options');
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Integration Domain Entity
|
|
3
5
|
* Represents a configured integration with its data and behavior
|
|
@@ -152,9 +154,13 @@ class Integration {
|
|
|
152
154
|
return methodName in this || (this.behavior && methodName in this.behavior);
|
|
153
155
|
}
|
|
154
156
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
157
|
+
getOptionDetails() {
|
|
158
|
+
const options = new Options({
|
|
159
|
+
module: Object.values(this.integrationClass.Definition.modules)[0], // This is a placeholder until we revamp the frontend
|
|
160
|
+
...this.integrationClass.Definition,
|
|
161
|
+
});
|
|
162
|
+
return options.get();
|
|
163
|
+
}
|
|
158
164
|
|
|
159
165
|
/**
|
|
160
166
|
* Custom JSON serializer to prevent circular references (e.g. Module → Api → delegate)
|
|
@@ -27,7 +27,7 @@ class CreateIntegration {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
const integrationInstance = new Integration({
|
|
30
|
-
id: integrationRecord.
|
|
30
|
+
id: integrationRecord._id.toString(),
|
|
31
31
|
userId: integrationRecord.user,
|
|
32
32
|
entities: integrationRecord.entities,
|
|
33
33
|
config: integrationRecord.config,
|
|
@@ -42,7 +42,7 @@ class GetIntegrationForUser {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
const integrationInstance = new Integration({
|
|
45
|
-
id: integrationRecord.
|
|
45
|
+
id: integrationRecord._id.toString(),
|
|
46
46
|
userId: integrationRecord.user,
|
|
47
47
|
entities: integrationRecord.entities,
|
|
48
48
|
config: integrationRecord.config,
|
|
@@ -50,7 +50,7 @@ class GetIntegration {
|
|
|
50
50
|
|
|
51
51
|
// 4. Create the Integration domain entity with modules
|
|
52
52
|
const integrationInstance = new Integration({
|
|
53
|
-
id: integrationRecord.
|
|
53
|
+
id: integrationRecord._id.toString(),
|
|
54
54
|
userId: integrationRecord.user,
|
|
55
55
|
entities: integrationRecord.entities,
|
|
56
56
|
config: integrationRecord.config,
|
|
@@ -37,7 +37,7 @@ class GetIntegrationsForUser {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
const integrationInstance = new Integration({
|
|
40
|
-
id: integrationRecord.
|
|
40
|
+
id: integrationRecord._id.toString(),
|
|
41
41
|
userId: integrationRecord.user,
|
|
42
42
|
entities: integrationRecord.entities,
|
|
43
43
|
config: integrationRecord.config,
|
|
@@ -2,7 +2,7 @@ const { Entity } = require('./entity');
|
|
|
2
2
|
|
|
3
3
|
class ModuleRepository {
|
|
4
4
|
async findEntityById(entityId) {
|
|
5
|
-
const entity = await Entity.findById(entityId).populate('credential');
|
|
5
|
+
const entity = await Entity.findById(entityId, undefined, { lean: true }).populate('credential');
|
|
6
6
|
if (!entity) {
|
|
7
7
|
throw new Error(`Entity ${entityId} not found`);
|
|
8
8
|
}
|
|
@@ -6,10 +6,12 @@ function mapModuleClassToModuleDTO(moduleInstance) {
|
|
|
6
6
|
if (!moduleInstance) return null;
|
|
7
7
|
|
|
8
8
|
return {
|
|
9
|
+
id: moduleInstance._id.toString(),
|
|
9
10
|
name: moduleInstance.name,
|
|
10
11
|
userId: moduleInstance.userId,
|
|
11
12
|
entity: moduleInstance.entity,
|
|
12
13
|
credentialId: moduleInstance.credential?._id?.toString(),
|
|
14
|
+
type: moduleInstance.getName()
|
|
13
15
|
};
|
|
14
16
|
}
|
|
15
17
|
|
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.396.
|
|
4
|
+
"version": "2.0.0--canary.396.8e54b1f.0",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@hapi/boom": "^10.0.1",
|
|
7
7
|
"aws-sdk": "^2.1200.0",
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
"uuid": "^9.0.1"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@friggframework/eslint-config": "2.0.0--canary.396.
|
|
26
|
-
"@friggframework/prettier-config": "2.0.0--canary.396.
|
|
27
|
-
"@friggframework/test": "2.0.0--canary.396.
|
|
25
|
+
"@friggframework/eslint-config": "2.0.0--canary.396.8e54b1f.0",
|
|
26
|
+
"@friggframework/prettier-config": "2.0.0--canary.396.8e54b1f.0",
|
|
27
|
+
"@friggframework/test": "2.0.0--canary.396.8e54b1f.0",
|
|
28
28
|
"@types/lodash": "4.17.15",
|
|
29
29
|
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
30
30
|
"chai": "^4.3.6",
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
},
|
|
54
54
|
"homepage": "https://github.com/friggframework/frigg#readme",
|
|
55
55
|
"description": "",
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "8e54b1f14a93fe56c2fef9974fb23740d41a643c"
|
|
57
57
|
}
|