@friggframework/core 1.1.4--canary.301.ffb9dc2.0 → 1.1.4--canary.301.a08eae3.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.
|
@@ -308,6 +308,37 @@ function setEntityRoutes(router, factory, getUserId) {
|
|
|
308
308
|
})
|
|
309
309
|
);
|
|
310
310
|
|
|
311
|
+
router.route('/api/entity').post(
|
|
312
|
+
catchAsyncError(async (req, res) => {
|
|
313
|
+
const params = checkRequiredParams(req.body, [
|
|
314
|
+
'entityType',
|
|
315
|
+
'data',
|
|
316
|
+
]);
|
|
317
|
+
checkRequiredParams(req.body.data, ['credential_id']);
|
|
318
|
+
|
|
319
|
+
// May want to pass along the user ID as well so credential ID's can't be fished???
|
|
320
|
+
const credential = await IntegrationHelper.getCredentialById(
|
|
321
|
+
params.data.credential_id
|
|
322
|
+
);
|
|
323
|
+
|
|
324
|
+
if (!credential) {
|
|
325
|
+
throw Boom.badRequest('Invalid credential ID');
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
const module = await getModuleInstance(req, params.entityType);
|
|
329
|
+
const entityDetails = await module.getEntityDetails(
|
|
330
|
+
module.api,
|
|
331
|
+
null,
|
|
332
|
+
null,
|
|
333
|
+
getUserId(req)
|
|
334
|
+
)
|
|
335
|
+
|
|
336
|
+
res.json(
|
|
337
|
+
await module.findOrCreateEntity(entityDetails)
|
|
338
|
+
);
|
|
339
|
+
})
|
|
340
|
+
);
|
|
341
|
+
|
|
311
342
|
router.route('/api/entity/options/:credentialId').get(
|
|
312
343
|
catchAsyncError(async (req, res) => {
|
|
313
344
|
// TODO May want to pass along the user ID as well so credential ID's can't be fished???
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@friggframework/core",
|
|
3
3
|
"prettier": "@friggframework/prettier-config",
|
|
4
|
-
"version": "1.1.4--canary.301.
|
|
4
|
+
"version": "1.1.4--canary.301.a08eae3.0",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@hapi/boom": "^10.0.1",
|
|
7
7
|
"aws-sdk": "^2.1200.0",
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
"node-fetch": "^2.6.7"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@friggframework/eslint-config": "1.1.4--canary.301.
|
|
19
|
-
"@friggframework/prettier-config": "1.1.4--canary.301.
|
|
20
|
-
"@friggframework/test": "1.1.4--canary.301.
|
|
18
|
+
"@friggframework/eslint-config": "1.1.4--canary.301.a08eae3.0",
|
|
19
|
+
"@friggframework/prettier-config": "1.1.4--canary.301.a08eae3.0",
|
|
20
|
+
"@friggframework/test": "1.1.4--canary.301.a08eae3.0",
|
|
21
21
|
"@types/lodash": "^4.14.191",
|
|
22
22
|
"@typescript-eslint/eslint-plugin": "^5.55.0",
|
|
23
23
|
"chai": "^4.3.6",
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
},
|
|
50
50
|
"homepage": "https://github.com/friggframework/frigg#readme",
|
|
51
51
|
"description": "",
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "a08eae3d040b2b4f8ab6ed454c1f1e528285bfea"
|
|
53
53
|
}
|