@unito/integrations-platform-client 0.48.4 → 1.0.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/dist/src/addons.d.ts +66 -0
- package/dist/src/addons.js +84 -0
- package/dist/src/api.d.ts +813 -95
- package/dist/src/api.js +76 -151
- package/dist/src/index.cjs +145 -134
- package/dist/src/index.d.ts +4 -2
- package/dist/src/index.js +4 -2
- package/package.json +1 -1
package/dist/src/index.cjs
CHANGED
|
@@ -43,248 +43,248 @@ const servers = {
|
|
|
43
43
|
* Get all the integrations
|
|
44
44
|
*/
|
|
45
45
|
function getIntegrations({ pagination, unitoOrganizationId, search, } = {}, opts) {
|
|
46
|
-
return oazapfts.
|
|
46
|
+
return oazapfts.fetchJson(`/integrations${QS__namespace.query(QS__namespace.explode({
|
|
47
47
|
pagination,
|
|
48
48
|
unitoOrganizationId,
|
|
49
49
|
search,
|
|
50
50
|
}))}`, {
|
|
51
51
|
...opts,
|
|
52
|
-
})
|
|
52
|
+
});
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
55
55
|
* Create an integration
|
|
56
56
|
*/
|
|
57
57
|
function createIntegration(body, opts) {
|
|
58
|
-
return oazapfts.
|
|
58
|
+
return oazapfts.fetchJson('/integrations', oazapfts.json({
|
|
59
59
|
...opts,
|
|
60
60
|
method: 'POST',
|
|
61
61
|
body,
|
|
62
|
-
}))
|
|
62
|
+
}));
|
|
63
63
|
}
|
|
64
64
|
/**
|
|
65
65
|
* Publish an integration
|
|
66
66
|
*/
|
|
67
67
|
function publishIntegration(body, opts) {
|
|
68
|
-
return oazapfts.
|
|
68
|
+
return oazapfts.fetchJson('/integrations/publish', oazapfts.multipart({
|
|
69
69
|
...opts,
|
|
70
70
|
method: 'POST',
|
|
71
71
|
body,
|
|
72
|
-
}))
|
|
72
|
+
}));
|
|
73
73
|
}
|
|
74
74
|
/**
|
|
75
75
|
* Find an integration by exact name
|
|
76
76
|
*/
|
|
77
77
|
function getIntegrationByName(integrationName, opts) {
|
|
78
|
-
return oazapfts.
|
|
78
|
+
return oazapfts.fetchJson(`/integrations/find/${encodeURIComponent(integrationName)}`, {
|
|
79
79
|
...opts,
|
|
80
|
-
})
|
|
80
|
+
});
|
|
81
81
|
}
|
|
82
82
|
/**
|
|
83
83
|
* Invite a user to an integration
|
|
84
84
|
*/
|
|
85
85
|
function inviteUser(integrationId, body, opts) {
|
|
86
|
-
return oazapfts.
|
|
86
|
+
return oazapfts.fetchJson(`/integrations/${encodeURIComponent(integrationId)}/users/invite`, oazapfts.json({
|
|
87
87
|
...opts,
|
|
88
88
|
method: 'POST',
|
|
89
89
|
body,
|
|
90
|
-
}))
|
|
90
|
+
}));
|
|
91
91
|
}
|
|
92
92
|
/**
|
|
93
93
|
* Invite a unito organization to an integration
|
|
94
94
|
*/
|
|
95
95
|
function inviteOrganization(integrationId, body, opts) {
|
|
96
|
-
return oazapfts.
|
|
96
|
+
return oazapfts.fetchJson(`/integrations/${encodeURIComponent(integrationId)}/organizations/invite`, oazapfts.json({
|
|
97
97
|
...opts,
|
|
98
98
|
method: 'POST',
|
|
99
99
|
body,
|
|
100
|
-
}))
|
|
100
|
+
}));
|
|
101
101
|
}
|
|
102
102
|
/**
|
|
103
103
|
* Get an integration
|
|
104
104
|
*/
|
|
105
105
|
function getIntegrationById(integrationId, opts) {
|
|
106
|
-
return oazapfts.
|
|
106
|
+
return oazapfts.fetchJson(`/integrations/${encodeURIComponent(integrationId)}`, {
|
|
107
107
|
...opts,
|
|
108
|
-
})
|
|
108
|
+
});
|
|
109
109
|
}
|
|
110
110
|
/**
|
|
111
111
|
* Update an integration
|
|
112
112
|
*/
|
|
113
113
|
function updateIntegration(integrationId, body, opts) {
|
|
114
|
-
return oazapfts.
|
|
114
|
+
return oazapfts.fetchJson(`/integrations/${encodeURIComponent(integrationId)}`, oazapfts.json({
|
|
115
115
|
...opts,
|
|
116
116
|
method: 'PATCH',
|
|
117
117
|
body,
|
|
118
|
-
}))
|
|
118
|
+
}));
|
|
119
119
|
}
|
|
120
120
|
/**
|
|
121
121
|
* Delete an integration
|
|
122
122
|
*/
|
|
123
123
|
function deleteIntegration(integrationId, name, opts) {
|
|
124
|
-
return oazapfts.
|
|
124
|
+
return oazapfts.fetchJson(`/integrations/${encodeURIComponent(integrationId)}${QS__namespace.query(QS__namespace.explode({
|
|
125
125
|
name,
|
|
126
126
|
}))}`, {
|
|
127
127
|
...opts,
|
|
128
128
|
method: 'DELETE',
|
|
129
|
-
})
|
|
129
|
+
});
|
|
130
130
|
}
|
|
131
131
|
/**
|
|
132
132
|
* Get the events associated with this integration.
|
|
133
133
|
*/
|
|
134
134
|
function getIntegrationEvents(integrationId, { search, $from, limit, } = {}, opts) {
|
|
135
|
-
return oazapfts.
|
|
135
|
+
return oazapfts.fetchJson(`/integrations/${encodeURIComponent(integrationId)}/events${QS__namespace.query(QS__namespace.explode({
|
|
136
136
|
search,
|
|
137
137
|
from: $from,
|
|
138
138
|
limit,
|
|
139
139
|
}))}`, {
|
|
140
140
|
...opts,
|
|
141
|
-
})
|
|
141
|
+
});
|
|
142
142
|
}
|
|
143
143
|
/**
|
|
144
144
|
* Get the logo of the integration, in SVG format.
|
|
145
145
|
*/
|
|
146
146
|
function getIntegrationLogo(integrationName, opts) {
|
|
147
|
-
return oazapfts.
|
|
147
|
+
return oazapfts.fetchJson(`/public/${encodeURIComponent(integrationName)}/logo.svg`, {
|
|
148
148
|
...opts,
|
|
149
|
-
})
|
|
149
|
+
});
|
|
150
150
|
}
|
|
151
151
|
/**
|
|
152
152
|
* Get all the credentials
|
|
153
153
|
*/
|
|
154
154
|
function getCredentials({ pagination, filters, } = {}, opts) {
|
|
155
|
-
return oazapfts.
|
|
155
|
+
return oazapfts.fetchJson(`/credentials${QS__namespace.query(QS__namespace.explode({
|
|
156
156
|
pagination,
|
|
157
157
|
filters,
|
|
158
158
|
}))}`, {
|
|
159
159
|
...opts,
|
|
160
|
-
})
|
|
160
|
+
});
|
|
161
161
|
}
|
|
162
162
|
/**
|
|
163
163
|
* Create a credential
|
|
164
164
|
*/
|
|
165
165
|
function createCredential(body, opts) {
|
|
166
|
-
return oazapfts.
|
|
166
|
+
return oazapfts.fetchJson('/credentials', oazapfts.json({
|
|
167
167
|
...opts,
|
|
168
168
|
method: 'POST',
|
|
169
169
|
body,
|
|
170
|
-
}))
|
|
170
|
+
}));
|
|
171
171
|
}
|
|
172
172
|
/**
|
|
173
173
|
* Get a credential
|
|
174
174
|
*/
|
|
175
175
|
function getCredentialById(credentialId, opts) {
|
|
176
|
-
return oazapfts.
|
|
176
|
+
return oazapfts.fetchJson(`/credentials/${encodeURIComponent(credentialId)}`, {
|
|
177
177
|
...opts,
|
|
178
|
-
})
|
|
178
|
+
});
|
|
179
179
|
}
|
|
180
180
|
/**
|
|
181
181
|
* Update a credential
|
|
182
182
|
*/
|
|
183
183
|
function updateCredential(credentialId, body, opts) {
|
|
184
|
-
return oazapfts.
|
|
184
|
+
return oazapfts.fetchJson(`/credentials/${encodeURIComponent(credentialId)}`, oazapfts.json({
|
|
185
185
|
...opts,
|
|
186
186
|
method: 'PATCH',
|
|
187
187
|
body,
|
|
188
|
-
}))
|
|
188
|
+
}));
|
|
189
189
|
}
|
|
190
190
|
/**
|
|
191
191
|
* Delete a credential
|
|
192
192
|
*/
|
|
193
193
|
function deleteCredential(credentialId, opts) {
|
|
194
|
-
return oazapfts.
|
|
194
|
+
return oazapfts.fetchJson(`/credentials/${encodeURIComponent(credentialId)}`, {
|
|
195
195
|
...opts,
|
|
196
196
|
method: 'DELETE',
|
|
197
|
-
})
|
|
197
|
+
});
|
|
198
198
|
}
|
|
199
199
|
/**
|
|
200
200
|
* Returns the credentialAccount either from the integration's /me endpoint, if available, or the credential's latestCredentialAccount
|
|
201
201
|
*/
|
|
202
202
|
function getCredentialAccount(xUnitoCredentialId, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
|
|
203
|
-
return oazapfts.
|
|
203
|
+
return oazapfts.fetchJson('/credentialAccount', {
|
|
204
204
|
...opts,
|
|
205
205
|
headers: oazapfts.mergeHeaders(opts?.headers, {
|
|
206
206
|
'X-Unito-Credential-Id': xUnitoCredentialId,
|
|
207
207
|
'X-Unito-Correlation-Id': xUnitoCorrelationId,
|
|
208
208
|
'X-Unito-Additional-Logging-Context': xUnitoAdditionalLoggingContext,
|
|
209
209
|
}),
|
|
210
|
-
})
|
|
210
|
+
});
|
|
211
211
|
}
|
|
212
212
|
/**
|
|
213
213
|
* Used by the frontend to send analytics data
|
|
214
214
|
*/
|
|
215
215
|
function postTrack(body, opts) {
|
|
216
|
-
return oazapfts.
|
|
216
|
+
return oazapfts.fetchJson('/track', oazapfts.json({
|
|
217
217
|
...opts,
|
|
218
218
|
method: 'POST',
|
|
219
219
|
body,
|
|
220
|
-
}))
|
|
220
|
+
}));
|
|
221
221
|
}
|
|
222
222
|
/**
|
|
223
223
|
* Encrypt data
|
|
224
224
|
*/
|
|
225
225
|
function encryptData(body, opts) {
|
|
226
|
-
return oazapfts.
|
|
226
|
+
return oazapfts.fetchJson('/encryptions/encrypt', oazapfts.json({
|
|
227
227
|
...opts,
|
|
228
228
|
method: 'POST',
|
|
229
229
|
body,
|
|
230
|
-
}))
|
|
230
|
+
}));
|
|
231
231
|
}
|
|
232
232
|
/**
|
|
233
233
|
* Decrypt data
|
|
234
234
|
*/
|
|
235
235
|
function decryptData(body, opts) {
|
|
236
|
-
return oazapfts.
|
|
236
|
+
return oazapfts.fetchJson('/encryptions/decrypt', oazapfts.json({
|
|
237
237
|
...opts,
|
|
238
238
|
method: 'POST',
|
|
239
239
|
body,
|
|
240
|
-
}))
|
|
240
|
+
}));
|
|
241
241
|
}
|
|
242
242
|
/**
|
|
243
243
|
* Decrypt and encrypt data
|
|
244
244
|
*/
|
|
245
245
|
function reencryptData(body, opts) {
|
|
246
|
-
return oazapfts.
|
|
246
|
+
return oazapfts.fetchJson('/encryptions/reencrypt', oazapfts.json({
|
|
247
247
|
...opts,
|
|
248
248
|
method: 'POST',
|
|
249
249
|
body,
|
|
250
|
-
}))
|
|
250
|
+
}));
|
|
251
251
|
}
|
|
252
252
|
/**
|
|
253
253
|
* Get my profile
|
|
254
254
|
*/
|
|
255
255
|
function getProfile(opts) {
|
|
256
|
-
return oazapfts.
|
|
256
|
+
return oazapfts.fetchJson('/profile', {
|
|
257
257
|
...opts,
|
|
258
|
-
})
|
|
258
|
+
});
|
|
259
259
|
}
|
|
260
260
|
/**
|
|
261
261
|
* Update my profile
|
|
262
262
|
*/
|
|
263
263
|
function updateProfile(body, opts) {
|
|
264
|
-
return oazapfts.
|
|
264
|
+
return oazapfts.fetchJson('/profile', oazapfts.json({
|
|
265
265
|
...opts,
|
|
266
266
|
method: 'PATCH',
|
|
267
267
|
body,
|
|
268
|
-
}))
|
|
268
|
+
}));
|
|
269
269
|
}
|
|
270
270
|
/**
|
|
271
271
|
* Call an integration's me
|
|
272
272
|
*/
|
|
273
273
|
function getProxyMe(xUnitoCredentialId, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
|
|
274
|
-
return oazapfts.
|
|
274
|
+
return oazapfts.fetchJson('/proxy/me', {
|
|
275
275
|
...opts,
|
|
276
276
|
headers: oazapfts.mergeHeaders(opts?.headers, {
|
|
277
277
|
'X-Unito-Credential-Id': xUnitoCredentialId,
|
|
278
278
|
'X-Unito-Correlation-Id': xUnitoCorrelationId,
|
|
279
279
|
'X-Unito-Additional-Logging-Context': xUnitoAdditionalLoggingContext,
|
|
280
280
|
}),
|
|
281
|
-
})
|
|
281
|
+
});
|
|
282
282
|
}
|
|
283
283
|
/**
|
|
284
284
|
* Update a webhook subscription
|
|
285
285
|
*/
|
|
286
286
|
function updateWebhookSubscription(xUnitoCredentialId, body, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
|
|
287
|
-
return oazapfts.
|
|
287
|
+
return oazapfts.fetchJson('/proxy/webhooks/subscriptions', oazapfts.json({
|
|
288
288
|
...opts,
|
|
289
289
|
method: 'PUT',
|
|
290
290
|
body,
|
|
@@ -293,13 +293,13 @@ function updateWebhookSubscription(xUnitoCredentialId, body, { xUnitoCorrelation
|
|
|
293
293
|
'X-Unito-Correlation-Id': xUnitoCorrelationId,
|
|
294
294
|
'X-Unito-Additional-Logging-Context': xUnitoAdditionalLoggingContext,
|
|
295
295
|
}),
|
|
296
|
-
}))
|
|
296
|
+
}));
|
|
297
297
|
}
|
|
298
298
|
/**
|
|
299
299
|
* Call an integration's graph
|
|
300
300
|
*/
|
|
301
|
-
function getProxyGraph(xUnitoCredentialId, path, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
|
|
302
|
-
return oazapfts.
|
|
301
|
+
function getProxyGraph(xUnitoCredentialId, path, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, accept, } = {}, opts) {
|
|
302
|
+
return oazapfts.fetchJson(`/proxy/graph${QS__namespace.query(QS__namespace.explode({
|
|
303
303
|
path,
|
|
304
304
|
}))}`, {
|
|
305
305
|
...opts,
|
|
@@ -307,14 +307,15 @@ function getProxyGraph(xUnitoCredentialId, path, { xUnitoCorrelationId, xUnitoAd
|
|
|
307
307
|
'X-Unito-Credential-Id': xUnitoCredentialId,
|
|
308
308
|
'X-Unito-Correlation-Id': xUnitoCorrelationId,
|
|
309
309
|
'X-Unito-Additional-Logging-Context': xUnitoAdditionalLoggingContext,
|
|
310
|
+
Accept: accept,
|
|
310
311
|
}),
|
|
311
|
-
})
|
|
312
|
+
});
|
|
312
313
|
}
|
|
313
314
|
/**
|
|
314
315
|
* Call an integration's graph
|
|
315
316
|
*/
|
|
316
|
-
function patchProxyGraph(xUnitoCredentialId, path, body, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
|
|
317
|
-
return oazapfts.
|
|
317
|
+
function patchProxyGraph(xUnitoCredentialId, path, body, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, contentType, } = {}, opts) {
|
|
318
|
+
return oazapfts.fetchJson(`/proxy/graph${QS__namespace.query(QS__namespace.explode({
|
|
318
319
|
path,
|
|
319
320
|
}))}`, oazapfts.json({
|
|
320
321
|
...opts,
|
|
@@ -324,14 +325,15 @@ function patchProxyGraph(xUnitoCredentialId, path, body, { xUnitoCorrelationId,
|
|
|
324
325
|
'X-Unito-Credential-Id': xUnitoCredentialId,
|
|
325
326
|
'X-Unito-Correlation-Id': xUnitoCorrelationId,
|
|
326
327
|
'X-Unito-Additional-Logging-Context': xUnitoAdditionalLoggingContext,
|
|
328
|
+
'Content-Type': contentType,
|
|
327
329
|
}),
|
|
328
|
-
}))
|
|
330
|
+
}));
|
|
329
331
|
}
|
|
330
332
|
/**
|
|
331
333
|
* Call an integration's graph
|
|
332
334
|
*/
|
|
333
|
-
function postProxyGraph(xUnitoCredentialId, path, body, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
|
|
334
|
-
return oazapfts.
|
|
335
|
+
function postProxyGraph(xUnitoCredentialId, path, body, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, contentType, } = {}, opts) {
|
|
336
|
+
return oazapfts.fetchJson(`/proxy/graph${QS__namespace.query(QS__namespace.explode({
|
|
335
337
|
path,
|
|
336
338
|
}))}`, oazapfts.json({
|
|
337
339
|
...opts,
|
|
@@ -341,14 +343,15 @@ function postProxyGraph(xUnitoCredentialId, path, body, { xUnitoCorrelationId, x
|
|
|
341
343
|
'X-Unito-Credential-Id': xUnitoCredentialId,
|
|
342
344
|
'X-Unito-Correlation-Id': xUnitoCorrelationId,
|
|
343
345
|
'X-Unito-Additional-Logging-Context': xUnitoAdditionalLoggingContext,
|
|
346
|
+
'Content-Type': contentType,
|
|
344
347
|
}),
|
|
345
|
-
}))
|
|
348
|
+
}));
|
|
346
349
|
}
|
|
347
350
|
/**
|
|
348
351
|
* Call an integration's graph
|
|
349
352
|
*/
|
|
350
353
|
function deleteProxyGraph(xUnitoCredentialId, path, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
|
|
351
|
-
return oazapfts.
|
|
354
|
+
return oazapfts.fetchJson(`/proxy/graph${QS__namespace.query(QS__namespace.explode({
|
|
352
355
|
path,
|
|
353
356
|
}))}`, {
|
|
354
357
|
...opts,
|
|
@@ -358,90 +361,99 @@ function deleteProxyGraph(xUnitoCredentialId, path, { xUnitoCorrelationId, xUnit
|
|
|
358
361
|
'X-Unito-Correlation-Id': xUnitoCorrelationId,
|
|
359
362
|
'X-Unito-Additional-Logging-Context': xUnitoAdditionalLoggingContext,
|
|
360
363
|
}),
|
|
361
|
-
})
|
|
364
|
+
});
|
|
362
365
|
}
|
|
363
366
|
/**
|
|
364
367
|
* Get all the users
|
|
365
368
|
*/
|
|
366
369
|
function getUsers({ pagination, } = {}, opts) {
|
|
367
|
-
return oazapfts.
|
|
370
|
+
return oazapfts.fetchJson(`/users${QS__namespace.query(QS__namespace.explode({
|
|
368
371
|
pagination,
|
|
369
372
|
}))}`, {
|
|
370
373
|
...opts,
|
|
371
|
-
})
|
|
374
|
+
});
|
|
372
375
|
}
|
|
373
376
|
/**
|
|
374
377
|
* Create a user
|
|
375
378
|
*/
|
|
376
379
|
function createUser(body, opts) {
|
|
377
|
-
return oazapfts.
|
|
380
|
+
return oazapfts.fetchJson('/users', oazapfts.json({
|
|
378
381
|
...opts,
|
|
379
382
|
method: 'POST',
|
|
380
383
|
body,
|
|
381
|
-
}))
|
|
384
|
+
}));
|
|
382
385
|
}
|
|
383
386
|
/**
|
|
384
387
|
* Get a user
|
|
385
388
|
*/
|
|
386
389
|
function getUserById(userId, opts) {
|
|
387
|
-
return oazapfts.
|
|
390
|
+
return oazapfts.fetchJson(`/users/${encodeURIComponent(userId)}`, {
|
|
388
391
|
...opts,
|
|
389
|
-
})
|
|
392
|
+
});
|
|
390
393
|
}
|
|
391
394
|
/**
|
|
392
395
|
* Update a user
|
|
393
396
|
*/
|
|
394
397
|
function updateUser(userId, body, opts) {
|
|
395
|
-
return oazapfts.
|
|
398
|
+
return oazapfts.fetchJson(`/users/${encodeURIComponent(userId)}`, oazapfts.json({
|
|
396
399
|
...opts,
|
|
397
400
|
method: 'PATCH',
|
|
398
401
|
body,
|
|
399
|
-
}))
|
|
402
|
+
}));
|
|
400
403
|
}
|
|
401
404
|
/**
|
|
402
405
|
* Regenerate the api key of a user
|
|
403
406
|
*/
|
|
404
407
|
function regenerateApiKey(userId, opts) {
|
|
405
|
-
return oazapfts.
|
|
408
|
+
return oazapfts.fetchJson(`/users/${encodeURIComponent(userId)}/apiKey`, {
|
|
406
409
|
...opts,
|
|
407
410
|
method: 'POST',
|
|
408
|
-
})
|
|
411
|
+
});
|
|
409
412
|
}
|
|
410
413
|
/**
|
|
411
414
|
* Get a user by its email address
|
|
412
415
|
*/
|
|
413
416
|
function getUserByEmail(email, opts) {
|
|
414
|
-
return oazapfts.
|
|
417
|
+
return oazapfts.fetchJson(`/users/find/${encodeURIComponent(email)}`, {
|
|
415
418
|
...opts,
|
|
416
|
-
})
|
|
419
|
+
});
|
|
417
420
|
}
|
|
421
|
+
|
|
422
|
+
// MANUAL ADDONS
|
|
418
423
|
/**
|
|
419
424
|
* Return true if object has the shape of an item, false otherwise.
|
|
420
425
|
* @param object
|
|
421
426
|
*/
|
|
422
|
-
function
|
|
423
|
-
|
|
427
|
+
function isItemResponse(object) {
|
|
428
|
+
const data = object.data;
|
|
429
|
+
return !!object && !!data && typeof data === 'object' && 'fields' in data && 'relations' in data;
|
|
424
430
|
}
|
|
425
431
|
/**
|
|
426
432
|
* Return true if object has the shape of an item, false otherwise.
|
|
427
433
|
* @param object
|
|
428
434
|
*/
|
|
429
|
-
function
|
|
430
|
-
|
|
435
|
+
function isItemSummaryResponse(object) {
|
|
436
|
+
const data = object.data;
|
|
437
|
+
return !!object && !!data && typeof data === 'object' && 'path' in data;
|
|
431
438
|
}
|
|
432
439
|
/**
|
|
433
440
|
* Return true if object has the shape of a collection, false otherwise.
|
|
434
441
|
* @param object
|
|
435
442
|
*/
|
|
436
|
-
function
|
|
437
|
-
|
|
443
|
+
function isCollectionResponse(object) {
|
|
444
|
+
const data = object.data;
|
|
445
|
+
return !!object && !!data && typeof data === 'object' && 'info' in data && 'data' in data && Array.isArray(data.data);
|
|
446
|
+
}
|
|
447
|
+
function isErrorResponse(object) {
|
|
448
|
+
const status = object.status;
|
|
449
|
+
return !!object && typeof object === 'object' && status && status >= 400 && 'data' in object && 'headers' in object;
|
|
438
450
|
}
|
|
439
451
|
async function getProxyGraphItem(xUnitoCredentialId, path, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
|
|
440
452
|
const response = await getProxyGraph(xUnitoCredentialId, path, {
|
|
441
453
|
xUnitoCorrelationId,
|
|
442
454
|
xUnitoAdditionalLoggingContext,
|
|
443
455
|
}, opts);
|
|
444
|
-
if (
|
|
456
|
+
if (isItemResponse(response) || isErrorResponse(response)) {
|
|
445
457
|
return response;
|
|
446
458
|
}
|
|
447
459
|
else {
|
|
@@ -453,7 +465,7 @@ async function getProxyGraphCollection(xUnitoCredentialId, path, { xUnitoCorrela
|
|
|
453
465
|
xUnitoCorrelationId,
|
|
454
466
|
xUnitoAdditionalLoggingContext,
|
|
455
467
|
}, opts);
|
|
456
|
-
if (
|
|
468
|
+
if (isCollectionResponse(response) || isErrorResponse(response)) {
|
|
457
469
|
return response;
|
|
458
470
|
}
|
|
459
471
|
else {
|
|
@@ -465,7 +477,7 @@ async function patchProxyGraphItem(xUnitoCredentialId, path, body, { xUnitoCorre
|
|
|
465
477
|
xUnitoCorrelationId,
|
|
466
478
|
xUnitoAdditionalLoggingContext,
|
|
467
479
|
}, opts);
|
|
468
|
-
if (
|
|
480
|
+
if (isItemResponse(response) || isErrorResponse(response)) {
|
|
469
481
|
return response;
|
|
470
482
|
}
|
|
471
483
|
else {
|
|
@@ -477,7 +489,7 @@ async function postProxyGraphCollection(xUnitoCredentialId, path, body, { xUnito
|
|
|
477
489
|
xUnitoCorrelationId,
|
|
478
490
|
xUnitoAdditionalLoggingContext,
|
|
479
491
|
}, opts);
|
|
480
|
-
if (
|
|
492
|
+
if (isItemSummaryResponse(response) || isErrorResponse(response)) {
|
|
481
493
|
return response;
|
|
482
494
|
}
|
|
483
495
|
else {
|
|
@@ -491,55 +503,54 @@ async function deleteProxyGraphItem(xUnitoCredentialId, path, { xUnitoCorrelatio
|
|
|
491
503
|
}, opts);
|
|
492
504
|
}
|
|
493
505
|
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
module.exports = api;
|
|
506
|
+
Object.defineProperty(exports, "HttpError", {
|
|
507
|
+
enumerable: true,
|
|
508
|
+
get: function () { return Oazapfts.HttpError; }
|
|
509
|
+
});
|
|
510
|
+
exports.createCredential = createCredential;
|
|
511
|
+
exports.createIntegration = createIntegration;
|
|
512
|
+
exports.createUser = createUser;
|
|
513
|
+
exports.decryptData = decryptData;
|
|
514
|
+
exports.defaults = defaults;
|
|
515
|
+
exports.deleteCredential = deleteCredential;
|
|
516
|
+
exports.deleteIntegration = deleteIntegration;
|
|
517
|
+
exports.deleteProxyGraph = deleteProxyGraph;
|
|
518
|
+
exports.deleteProxyGraphItem = deleteProxyGraphItem;
|
|
519
|
+
exports.encryptData = encryptData;
|
|
520
|
+
exports.getCredentialAccount = getCredentialAccount;
|
|
521
|
+
exports.getCredentialById = getCredentialById;
|
|
522
|
+
exports.getCredentials = getCredentials;
|
|
523
|
+
exports.getIntegrationById = getIntegrationById;
|
|
524
|
+
exports.getIntegrationByName = getIntegrationByName;
|
|
525
|
+
exports.getIntegrationEvents = getIntegrationEvents;
|
|
526
|
+
exports.getIntegrationLogo = getIntegrationLogo;
|
|
527
|
+
exports.getIntegrations = getIntegrations;
|
|
528
|
+
exports.getProfile = getProfile;
|
|
529
|
+
exports.getProxyGraph = getProxyGraph;
|
|
530
|
+
exports.getProxyGraphCollection = getProxyGraphCollection;
|
|
531
|
+
exports.getProxyGraphItem = getProxyGraphItem;
|
|
532
|
+
exports.getProxyMe = getProxyMe;
|
|
533
|
+
exports.getUserByEmail = getUserByEmail;
|
|
534
|
+
exports.getUserById = getUserById;
|
|
535
|
+
exports.getUsers = getUsers;
|
|
536
|
+
exports.inviteOrganization = inviteOrganization;
|
|
537
|
+
exports.inviteUser = inviteUser;
|
|
538
|
+
exports.isCollectionResponse = isCollectionResponse;
|
|
539
|
+
exports.isErrorResponse = isErrorResponse;
|
|
540
|
+
exports.isItemResponse = isItemResponse;
|
|
541
|
+
exports.isItemSummaryResponse = isItemSummaryResponse;
|
|
542
|
+
exports.patchProxyGraph = patchProxyGraph;
|
|
543
|
+
exports.patchProxyGraphItem = patchProxyGraphItem;
|
|
544
|
+
exports.postProxyGraph = postProxyGraph;
|
|
545
|
+
exports.postProxyGraphCollection = postProxyGraphCollection;
|
|
546
|
+
exports.postTrack = postTrack;
|
|
547
|
+
exports.publishIntegration = publishIntegration;
|
|
548
|
+
exports.reencryptData = reencryptData;
|
|
549
|
+
exports.regenerateApiKey = regenerateApiKey;
|
|
550
|
+
exports.servers = servers;
|
|
551
|
+
exports.updateCredential = updateCredential;
|
|
552
|
+
exports.updateIntegration = updateIntegration;
|
|
553
|
+
exports.updateProfile = updateProfile;
|
|
554
|
+
exports.updateUser = updateUser;
|
|
555
|
+
exports.updateWebhookSubscription = updateWebhookSubscription;
|
|
545
556
|
module.exports.default = api;
|
package/dist/src/index.d.ts
CHANGED
package/dist/src/index.js
CHANGED