@friggframework/core 1.1.4--canary.301.ea53eb9.0 → 1.1.4--canary.301.19256e3.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.
|
@@ -89,11 +89,6 @@ function setIntegrationRoutes(router, factory, getUserId) {
|
|
|
89
89
|
);
|
|
90
90
|
await integration.onCreate();
|
|
91
91
|
|
|
92
|
-
// filtered set for results
|
|
93
|
-
const response = await IntegrationHelper.getFormattedIntegration(
|
|
94
|
-
integration.record
|
|
95
|
-
);
|
|
96
|
-
|
|
97
92
|
res.status(201).json(
|
|
98
93
|
await IntegrationHelper.getFormattedIntegration(integration.record)
|
|
99
94
|
);
|
|
@@ -116,11 +111,9 @@ function setIntegrationRoutes(router, factory, getUserId) {
|
|
|
116
111
|
);
|
|
117
112
|
await integration.onUpdate(params);
|
|
118
113
|
|
|
119
|
-
|
|
120
|
-
integration.record
|
|
114
|
+
res.json(
|
|
115
|
+
await IntegrationHelper.getFormattedIntegration(integration.record)
|
|
121
116
|
);
|
|
122
|
-
|
|
123
|
-
res.json(response);
|
|
124
117
|
})
|
|
125
118
|
);
|
|
126
119
|
|
|
@@ -144,8 +137,7 @@ function setIntegrationRoutes(router, factory, getUserId) {
|
|
|
144
137
|
params.integrationId
|
|
145
138
|
);
|
|
146
139
|
|
|
147
|
-
res.status(201);
|
|
148
|
-
res.json({});
|
|
140
|
+
res.status(201).json({});
|
|
149
141
|
})
|
|
150
142
|
);
|
|
151
143
|
|
|
@@ -156,8 +148,7 @@ function setIntegrationRoutes(router, factory, getUserId) {
|
|
|
156
148
|
]);
|
|
157
149
|
const integration =
|
|
158
150
|
await integrationFactory.getInstanceFromIntegrationId(params);
|
|
159
|
-
|
|
160
|
-
res.json(results);
|
|
151
|
+
res.json(await integration.getConfigOptions());
|
|
161
152
|
})
|
|
162
153
|
);
|
|
163
154
|
|
|
@@ -168,10 +159,10 @@ function setIntegrationRoutes(router, factory, getUserId) {
|
|
|
168
159
|
]);
|
|
169
160
|
const integration =
|
|
170
161
|
await integrationFactory.getInstanceFromIntegrationId(params);
|
|
171
|
-
|
|
172
|
-
|
|
162
|
+
|
|
163
|
+
res.json(
|
|
164
|
+
await integration.refreshConfigOptions(req.body)
|
|
173
165
|
);
|
|
174
|
-
res.json(results);
|
|
175
166
|
})
|
|
176
167
|
);
|
|
177
168
|
|
|
@@ -183,11 +174,10 @@ function setIntegrationRoutes(router, factory, getUserId) {
|
|
|
183
174
|
]);
|
|
184
175
|
const integration =
|
|
185
176
|
await integrationFactory.getInstanceFromIntegrationId(params);
|
|
186
|
-
|
|
187
|
-
|
|
177
|
+
|
|
178
|
+
res.json(
|
|
179
|
+
await integration.getActionOptions(params.actionId)
|
|
188
180
|
);
|
|
189
|
-
// We could perhaps augment router with dynamic options? Haven't decided yet, but here may be the place
|
|
190
|
-
res.json(results);
|
|
191
181
|
})
|
|
192
182
|
);
|
|
193
183
|
|
|
@@ -199,12 +189,10 @@ function setIntegrationRoutes(router, factory, getUserId) {
|
|
|
199
189
|
]);
|
|
200
190
|
const integration =
|
|
201
191
|
await integrationFactory.getInstanceFromIntegrationId(params);
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
req.body
|
|
192
|
+
|
|
193
|
+
res.json(
|
|
194
|
+
await integration.refreshActionOptions(params.actionId, req.body)
|
|
205
195
|
);
|
|
206
|
-
// We could perhaps augment router with dynamic options? Haven't decided yet, but here may be the place
|
|
207
|
-
res.json(results);
|
|
208
196
|
})
|
|
209
197
|
);
|
|
210
198
|
|
|
@@ -216,14 +204,12 @@ function setIntegrationRoutes(router, factory, getUserId) {
|
|
|
216
204
|
]);
|
|
217
205
|
const integration =
|
|
218
206
|
await integrationFactory.getInstanceFromIntegrationId(params);
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
req.body
|
|
207
|
+
|
|
208
|
+
res.json(
|
|
209
|
+
await integration.notify(params.actionId, req.body)
|
|
222
210
|
);
|
|
223
|
-
// We could perhaps augment router with dynamic options? Haven't decided yet, but here may be the place
|
|
224
|
-
res.json(results);
|
|
225
211
|
})
|
|
226
|
-
)
|
|
212
|
+
);
|
|
227
213
|
|
|
228
214
|
router.route('/api/integrations/:integrationId').get(
|
|
229
215
|
catchAsyncError(async (req, res) => {
|
|
@@ -300,6 +286,7 @@ function setEntityRoutes(router, factory, getUserId) {
|
|
|
300
286
|
`Error: EntityManager of type ${params.entityType} requires a valid url`
|
|
301
287
|
);
|
|
302
288
|
}
|
|
289
|
+
|
|
303
290
|
res.json(await module.getAuthorizationRequirements());
|
|
304
291
|
})
|
|
305
292
|
);
|
|
@@ -310,15 +297,44 @@ function setEntityRoutes(router, factory, getUserId) {
|
|
|
310
297
|
'entityType',
|
|
311
298
|
'data',
|
|
312
299
|
]);
|
|
313
|
-
console.log('post authorize', params);
|
|
314
300
|
const module = await getModuleInstance(req, params.entityType);
|
|
315
|
-
console.log('post authorize module', module);
|
|
316
|
-
const results = await module.processAuthorizationCallback({
|
|
317
|
-
userId: getUserId(req),
|
|
318
|
-
data: params.data,
|
|
319
|
-
});
|
|
320
301
|
|
|
321
|
-
res.json(
|
|
302
|
+
res.json(
|
|
303
|
+
await module.processAuthorizationCallback({
|
|
304
|
+
userId: getUserId(req),
|
|
305
|
+
data: params.data,
|
|
306
|
+
})
|
|
307
|
+
);
|
|
308
|
+
})
|
|
309
|
+
);
|
|
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
|
+
res.json(
|
|
336
|
+
await module.findOrCreateEntity(entityDetails)
|
|
337
|
+
);
|
|
322
338
|
})
|
|
323
339
|
);
|
|
324
340
|
|
|
@@ -384,6 +400,7 @@ function setEntityRoutes(router, factory, getUserId) {
|
|
|
384
400
|
if (!module) {
|
|
385
401
|
throw Boom.notFound();
|
|
386
402
|
}
|
|
403
|
+
|
|
387
404
|
res.json(module.entity);
|
|
388
405
|
})
|
|
389
406
|
);
|
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.19256e3.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.19256e3.0",
|
|
19
|
+
"@friggframework/prettier-config": "1.1.4--canary.301.19256e3.0",
|
|
20
|
+
"@friggframework/test": "1.1.4--canary.301.19256e3.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": "19256e3241d018af6bfdd03f52521bc69621af28"
|
|
53
53
|
}
|