@friggframework/core 2.0.0--canary.397.58770d0.0 → 2.0.0--canary.397.db073e6.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 +8 -3
- package/integrations/integration.js +0 -19
- package/integrations/use-cases/get-integrations-for-user.js +0 -1
- package/integrations/use-cases/get-possible-integrations.js +13 -0
- package/integrations/utils/map-integration-dto.js +0 -1
- package/package.json +5 -5
|
@@ -21,6 +21,7 @@ const { TestModuleAuth } = require('../module-plugin/use-cases/test-module-auth'
|
|
|
21
21
|
const { GetModule } = require('../module-plugin/use-cases/get-module');
|
|
22
22
|
const { GetEntityOptionsById } = require('../module-plugin/use-cases/get-entity-options-by-id');
|
|
23
23
|
const { RefreshEntityOptions } = require('../module-plugin/use-cases/refresh-entity-options');
|
|
24
|
+
const { GetPossibleIntegrations } = require('./use-cases/get-possible-integrations');
|
|
24
25
|
|
|
25
26
|
/**
|
|
26
27
|
* Creates an Express router with integration and entity routes configured
|
|
@@ -104,6 +105,10 @@ function createIntegrationRouter(params) {
|
|
|
104
105
|
moduleDefinitions: getModulesDefinitionFromIntegrationClasses(integrationClasses),
|
|
105
106
|
});
|
|
106
107
|
|
|
108
|
+
const getPossibleIntegrations = new GetPossibleIntegrations({
|
|
109
|
+
integrationClasses,
|
|
110
|
+
});
|
|
111
|
+
|
|
107
112
|
const router = get(params, 'router', express());
|
|
108
113
|
const getUserFromBearerToken = get(params, 'getUserFromBearerToken');
|
|
109
114
|
|
|
@@ -114,6 +119,7 @@ function createIntegrationRouter(params) {
|
|
|
114
119
|
getEntitiesForUser,
|
|
115
120
|
getIntegrationInstance,
|
|
116
121
|
updateIntegration,
|
|
122
|
+
getPossibleIntegrations,
|
|
117
123
|
});
|
|
118
124
|
setEntityRoutes(router, getUserFromBearerToken, {
|
|
119
125
|
getCredentialForUser,
|
|
@@ -163,6 +169,7 @@ function setIntegrationRoutes(router, getUserFromBearerToken, useCases) {
|
|
|
163
169
|
getEntitiesForUser,
|
|
164
170
|
getIntegrationInstance,
|
|
165
171
|
updateIntegration,
|
|
172
|
+
getPossibleIntegrations,
|
|
166
173
|
} = useCases;
|
|
167
174
|
router.route('/api/integrations').get(
|
|
168
175
|
catchAsyncError(async (req, res) => {
|
|
@@ -173,9 +180,7 @@ function setIntegrationRoutes(router, getUserFromBearerToken, useCases) {
|
|
|
173
180
|
const integrations = await getIntegrationsForUser.execute(userId);
|
|
174
181
|
const results = {
|
|
175
182
|
entities: {
|
|
176
|
-
options:
|
|
177
|
-
integration.options
|
|
178
|
-
),
|
|
183
|
+
options: await getPossibleIntegrations.execute(),
|
|
179
184
|
authorized: await getEntitiesForUser.execute(userId),
|
|
180
185
|
},
|
|
181
186
|
integrations: integrations,
|
|
@@ -211,25 +211,6 @@ class Integration {
|
|
|
211
211
|
});
|
|
212
212
|
return options.get();
|
|
213
213
|
}
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* Custom JSON serializer to prevent circular references (e.g. Module → Api → delegate)
|
|
217
|
-
* and to keep API responses lightweight.
|
|
218
|
-
* Only primitive, serialisable data needed by clients is returned.
|
|
219
|
-
*/
|
|
220
|
-
toJSON() {
|
|
221
|
-
return {
|
|
222
|
-
id: this.id,
|
|
223
|
-
userId: this.userId,
|
|
224
|
-
entities: this.entities,
|
|
225
|
-
config: this.config,
|
|
226
|
-
status: this.status,
|
|
227
|
-
version: this.version,
|
|
228
|
-
messages: this.messages,
|
|
229
|
-
// Expose userActions if they were loaded/attached elsewhere
|
|
230
|
-
userActions: this.userActions,
|
|
231
|
-
};
|
|
232
|
-
}
|
|
233
214
|
}
|
|
234
215
|
|
|
235
216
|
module.exports = { Integration };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
class GetPossibleIntegrations {
|
|
2
|
+
constructor({ integrationClasses }) {
|
|
3
|
+
this.integrationClasses = integrationClasses;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
async execute() {
|
|
7
|
+
return this.integrationClasses.map((integrationClass) =>
|
|
8
|
+
integrationClass.getOptionDetails()
|
|
9
|
+
);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
module.exports = { GetPossibleIntegrations };
|
|
@@ -13,7 +13,6 @@ function mapIntegrationClassToIntegrationDTO(integration) {
|
|
|
13
13
|
status: integration.status,
|
|
14
14
|
version: integration.version,
|
|
15
15
|
messages: integration.messages,
|
|
16
|
-
entityReference: integration.entityReference,
|
|
17
16
|
userActions: integration.userActions,
|
|
18
17
|
options: integration.getOptionDetails(),
|
|
19
18
|
};
|
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.397.
|
|
4
|
+
"version": "2.0.0--canary.397.db073e6.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.397.
|
|
26
|
-
"@friggframework/prettier-config": "2.0.0--canary.397.
|
|
27
|
-
"@friggframework/test": "2.0.0--canary.397.
|
|
25
|
+
"@friggframework/eslint-config": "2.0.0--canary.397.db073e6.0",
|
|
26
|
+
"@friggframework/prettier-config": "2.0.0--canary.397.db073e6.0",
|
|
27
|
+
"@friggframework/test": "2.0.0--canary.397.db073e6.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": "db073e64e46dafe5b3afd08c234471b73af4e942"
|
|
57
57
|
}
|