@unito/integrations-platform-client 0.44.3 → 0.45.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/README.md +2 -2
- package/dist/src/api.d.ts +77 -2
- package/dist/src/api.js +65 -121
- package/dist/src/httpError.d.ts +6 -0
- package/dist/src/httpError.js +11 -0
- package/dist/src/index.cjs +473 -0
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.js +2 -27
- package/package.json +22 -19
package/README.md
CHANGED
|
@@ -8,13 +8,13 @@ This component is a JS client library to communicate with the Integrations Platf
|
|
|
8
8
|
1. Install the library:
|
|
9
9
|
|
|
10
10
|
```sh
|
|
11
|
-
npm install @
|
|
11
|
+
npm install @unito/integrations-platform-client
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
2. Use the library:
|
|
15
15
|
|
|
16
16
|
```typescript
|
|
17
|
-
import IntegrationsPlatform from '@
|
|
17
|
+
import IntegrationsPlatform from '@unito/integrations-platform-client';
|
|
18
18
|
|
|
19
19
|
IntegrationsPlatform.defaults.baseUrl = 'http://enpoint.to.the.server';
|
|
20
20
|
IntegrationsPlatform.defaults.headers = { Authorization: 'Bearer YOUR_TOKEN' };
|
package/dist/src/api.d.ts
CHANGED
|
@@ -5,13 +5,14 @@
|
|
|
5
5
|
* See https://www.npmjs.com/package/oazapfts
|
|
6
6
|
*/
|
|
7
7
|
import * as Oazapfts from 'oazapfts/lib/runtime';
|
|
8
|
-
export declare const defaults: Oazapfts.
|
|
8
|
+
export declare const defaults: Oazapfts.Defaults<Oazapfts.CustomHeaders>;
|
|
9
9
|
export declare const servers: {
|
|
10
10
|
local: string;
|
|
11
11
|
staging: string;
|
|
12
12
|
production: string;
|
|
13
13
|
};
|
|
14
14
|
export type Pagination = {
|
|
15
|
+
/** The total number of results. */
|
|
15
16
|
total: number;
|
|
16
17
|
};
|
|
17
18
|
export type Base = {
|
|
@@ -20,51 +21,77 @@ export type Base = {
|
|
|
20
21
|
archivedAt: string | null;
|
|
21
22
|
};
|
|
22
23
|
export type IntegrationSummary = Base & {
|
|
24
|
+
/** The id of the integration. */
|
|
23
25
|
id: number;
|
|
26
|
+
/** The name of the integration. */
|
|
24
27
|
name: string;
|
|
28
|
+
/** The base URL where the integration is located. */
|
|
25
29
|
baseUrl: string | null;
|
|
30
|
+
/** The relative URL (to the baseUrl) where the graph of items of the integration is located. */
|
|
26
31
|
graphRelativeUrl: string;
|
|
32
|
+
/** The relative URL (to the baseUrl) to fetch the current integration's authenticated user. */
|
|
27
33
|
credentialAccountRelativeUrl: string;
|
|
34
|
+
/** The relative URL (to the baseUrl) to parse a webhook payload. */
|
|
28
35
|
webhookParsingRelativeUrl?: string | null;
|
|
36
|
+
/** The relative URL (to the baseUrl) to operate on webhook subscriptions. */
|
|
29
37
|
webhookSubscriptionsRelativeUrl?: string | null;
|
|
38
|
+
/** The relative URL (to the baseUrl) to acknowledge a webhook reception. */
|
|
30
39
|
webhookAcknowledgeRelativeUrl?: string | null;
|
|
40
|
+
/** The visibility of the integration. */
|
|
31
41
|
visibility: 'private' | 'public';
|
|
42
|
+
/** The list of organization ids for which this integration is visibile. */
|
|
32
43
|
unitoOrganizationIds: string[];
|
|
44
|
+
/** The UI-related information of the integration. */
|
|
33
45
|
ui: {
|
|
46
|
+
/** The name of the integration, as it should be displayed in a UI. */
|
|
34
47
|
displayName: string;
|
|
48
|
+
/** The logo of the integration, in SVG format. */
|
|
35
49
|
logo: string | null;
|
|
36
50
|
};
|
|
51
|
+
/** The encrypted secrets of the integration. */
|
|
37
52
|
secrets?: {
|
|
38
53
|
[key: string]: string;
|
|
39
54
|
};
|
|
55
|
+
/** The date at which the integration has been disabled */
|
|
40
56
|
disabledAt?: string | null;
|
|
41
57
|
};
|
|
42
58
|
export type Error = {
|
|
59
|
+
/** The message of the error. */
|
|
43
60
|
message: string;
|
|
61
|
+
/** The details of the error. */
|
|
44
62
|
details?: {
|
|
45
63
|
[key: string]: any;
|
|
46
64
|
};
|
|
65
|
+
/** The stack trace of the error. */
|
|
47
66
|
stack?: string[];
|
|
48
67
|
};
|
|
49
68
|
export type AuthorizationMethod = 'custom' | 'oauth2';
|
|
50
69
|
export type AuthorizationGrantType = 'authorization_code' | 'password';
|
|
51
70
|
export type AuthorizationScope = {
|
|
71
|
+
/** The name of the scope. */
|
|
52
72
|
name: string;
|
|
73
|
+
/** Message to the end-user to explain the usage of the scope by Unito. */
|
|
53
74
|
help?: string;
|
|
54
75
|
};
|
|
55
76
|
export type AuthorizationOAuth2ContentType = 'application/x-www-form-urlencoded' | 'application/json';
|
|
56
77
|
export type AuthorizationOAuth2RequestParameters = {
|
|
78
|
+
/** Extra information to include in the HTTP request headers. */
|
|
57
79
|
header?: {
|
|
58
80
|
[key: string]: string | number | boolean;
|
|
59
81
|
};
|
|
82
|
+
/** Extra information to include in the HTTP request body. */
|
|
60
83
|
body?: {
|
|
61
84
|
[key: string]: string | number | boolean;
|
|
62
85
|
};
|
|
63
86
|
};
|
|
64
87
|
export type AuthorizationOAuth2 = {
|
|
88
|
+
/** The Client Secret obtained from the provider. */
|
|
65
89
|
clientSecret?: string;
|
|
90
|
+
/** The Client Id obtained from the provider. */
|
|
66
91
|
clientId?: string;
|
|
92
|
+
/** The URL to grant or deny access to the user account. */
|
|
67
93
|
authorizationUrl?: string;
|
|
94
|
+
/** The URL to obtain or refresh an access token. */
|
|
68
95
|
tokenUrl: string;
|
|
69
96
|
grantType: AuthorizationGrantType;
|
|
70
97
|
scopes: AuthorizationScope[];
|
|
@@ -93,46 +120,71 @@ export type Authorization = Base & {
|
|
|
93
120
|
method: AuthorizationMethod;
|
|
94
121
|
oauth2: AuthorizationOAuth2;
|
|
95
122
|
variables: AuthorizationVariables;
|
|
123
|
+
/** The Base64-encoded data URL of an <img> src content. For example: 'data:image/png;base64,<base64>' */
|
|
96
124
|
instructionsImage?: string | null;
|
|
125
|
+
/** A string representing a markdown document. */
|
|
97
126
|
instructionsMarkdown?: string | null;
|
|
98
127
|
};
|
|
99
128
|
export type Integration = IntegrationSummary & {
|
|
129
|
+
/** The authorizations of the integration. */
|
|
100
130
|
authorizations: Authorization[];
|
|
131
|
+
/** The ids of the developers of the integration. */
|
|
101
132
|
userIds: number[];
|
|
102
133
|
};
|
|
103
134
|
export type IntegrationEvent = {
|
|
135
|
+
/** The date at which the event took place. */
|
|
104
136
|
date: string;
|
|
137
|
+
/** The text of the event. */
|
|
105
138
|
text: string;
|
|
139
|
+
/** The tags associated with the event. */
|
|
106
140
|
tags: string[];
|
|
141
|
+
/** The title of the event. */
|
|
107
142
|
title: string;
|
|
108
143
|
};
|
|
109
144
|
export type Credential = Base & {
|
|
145
|
+
/** The id of the credential. */
|
|
110
146
|
id: number;
|
|
147
|
+
/** The id of the integration. */
|
|
111
148
|
integrationId: number;
|
|
149
|
+
/** The name of the integration. */
|
|
112
150
|
integrationName: string;
|
|
151
|
+
/** The id of the authorization. */
|
|
113
152
|
authorizationId: number;
|
|
153
|
+
/** The scope of the credential. */
|
|
114
154
|
scope: 'development' | 'compliance' | 'production' | 'service';
|
|
155
|
+
/** The id of the Unito User for which this credential belongs to. */
|
|
115
156
|
unitoUserId: string | null;
|
|
157
|
+
/** The payload of the credential, which conforms to the schema (ex. variables) of the authorization. */
|
|
116
158
|
payload: {
|
|
117
159
|
[key: string]: any;
|
|
118
160
|
};
|
|
161
|
+
/** The partition used to divide data into different buckets. */
|
|
119
162
|
partitionKey?: string | null;
|
|
120
163
|
};
|
|
121
164
|
export type UserRole = 'unitoAdministrator' | 'unitoService' | 'developer';
|
|
122
165
|
export type UserSummary = Base & {
|
|
166
|
+
/** The id of the user. */
|
|
123
167
|
id: number;
|
|
168
|
+
/** The email of the user. */
|
|
124
169
|
email: string;
|
|
170
|
+
/** The ID of the organization which will have access to integrations created by this user. */
|
|
125
171
|
defaultUnitoOrganizationId: string | null;
|
|
172
|
+
/** The date & time at which the user accepted the terms & conditions of the SDK. */
|
|
126
173
|
termsAcceptedAt: string | null;
|
|
127
174
|
role: UserRole;
|
|
128
175
|
};
|
|
129
176
|
export type User = UserSummary & {
|
|
177
|
+
/** The API key of the user. */
|
|
130
178
|
apiKey: string;
|
|
131
179
|
};
|
|
132
180
|
export type CredentialAccount = {
|
|
181
|
+
/** The native id of the provider account. */
|
|
133
182
|
id: string;
|
|
183
|
+
/** The display name of the provider account. */
|
|
134
184
|
displayName: string;
|
|
185
|
+
/** The emails associated with the provider account. */
|
|
135
186
|
emails: string[];
|
|
187
|
+
/** The partition used to divide data into different buckets. */
|
|
136
188
|
partition?: string;
|
|
137
189
|
};
|
|
138
190
|
/**
|
|
@@ -140,12 +192,15 @@ export type CredentialAccount = {
|
|
|
140
192
|
*/
|
|
141
193
|
export declare function getIntegrations({ pagination, unitoOrganizationId, search, }?: {
|
|
142
194
|
pagination?: {
|
|
195
|
+
/** Number of 'first results' to skip */
|
|
143
196
|
offset?: number;
|
|
197
|
+
/** Maximum number of results after the offset */
|
|
144
198
|
limit?: number;
|
|
145
199
|
};
|
|
146
200
|
unitoOrganizationId?: string;
|
|
147
201
|
search?: string;
|
|
148
202
|
}, opts?: Oazapfts.RequestOpts): Promise<Pagination & {
|
|
203
|
+
/** The integrations. */
|
|
149
204
|
data: IntegrationSummary[];
|
|
150
205
|
}>;
|
|
151
206
|
/**
|
|
@@ -164,6 +219,7 @@ export declare function createIntegration(body?: {
|
|
|
164
219
|
* Publish an integration
|
|
165
220
|
*/
|
|
166
221
|
export declare function publishIntegration(body?: {
|
|
222
|
+
/** The archive of the integration, including the .unito.json file. */
|
|
167
223
|
file: Blob;
|
|
168
224
|
}, opts?: Oazapfts.RequestOpts): Promise<Integration>;
|
|
169
225
|
/**
|
|
@@ -176,6 +232,12 @@ export declare function getIntegrationByName(integrationName: string, opts?: Oaz
|
|
|
176
232
|
export declare function inviteUser(integrationId: number, body?: {
|
|
177
233
|
email?: string;
|
|
178
234
|
}, opts?: Oazapfts.RequestOpts): Promise<Integration>;
|
|
235
|
+
/**
|
|
236
|
+
* Invite a unito organization to an integration
|
|
237
|
+
*/
|
|
238
|
+
export declare function inviteOrganization(integrationId: number, body?: {
|
|
239
|
+
unitoOrganizationId?: string;
|
|
240
|
+
}, opts?: Oazapfts.RequestOpts): Promise<Integration>;
|
|
179
241
|
/**
|
|
180
242
|
* Get an integration
|
|
181
243
|
*/
|
|
@@ -207,6 +269,7 @@ export declare function updateIntegration(integrationId: number, body?: {
|
|
|
207
269
|
};
|
|
208
270
|
visibility?: 'private' | 'public';
|
|
209
271
|
unitoOrganizationIds?: string[];
|
|
272
|
+
/** The encrypted secrets of the integration. */
|
|
210
273
|
secrets?: {
|
|
211
274
|
[key: string]: string;
|
|
212
275
|
};
|
|
@@ -219,6 +282,7 @@ export declare function deleteIntegration(integrationId: number, name: string, o
|
|
|
219
282
|
* Get the events associated with this integration.
|
|
220
283
|
*/
|
|
221
284
|
export declare function getIntegrationEvents(integrationId: number, opts?: Oazapfts.RequestOpts): Promise<Pagination & {
|
|
285
|
+
/** The integration events. */
|
|
222
286
|
data: IntegrationEvent[];
|
|
223
287
|
}>;
|
|
224
288
|
/**
|
|
@@ -230,17 +294,25 @@ export declare function getIntegrationLogo(integrationName: string, opts?: Oazap
|
|
|
230
294
|
*/
|
|
231
295
|
export declare function getCredentials({ pagination, filters, }?: {
|
|
232
296
|
pagination?: {
|
|
297
|
+
/** Number of 'first results' to skip */
|
|
233
298
|
offset?: number;
|
|
299
|
+
/** Maximum number of results after the offset */
|
|
234
300
|
limit?: number;
|
|
235
301
|
};
|
|
236
302
|
filters?: {
|
|
303
|
+
/** The authorization id of the credential. */
|
|
237
304
|
authorizationId?: number;
|
|
305
|
+
/** The integration id of the credential. */
|
|
238
306
|
integrationId?: number;
|
|
307
|
+
/** The scope of the credential. */
|
|
239
308
|
credentialScope?: 'development' | 'compliance' | 'production' | 'service';
|
|
309
|
+
/** The id of the Unito User for which this credential belongs to. */
|
|
240
310
|
unitoUserId?: string;
|
|
311
|
+
/** The id of the credential account for which this credential belongs to. */
|
|
241
312
|
credentialAccountId?: string;
|
|
242
313
|
};
|
|
243
314
|
}, opts?: Oazapfts.RequestOpts): Promise<Pagination & {
|
|
315
|
+
/** The credentials. */
|
|
244
316
|
data: Credential[];
|
|
245
317
|
}>;
|
|
246
318
|
/**
|
|
@@ -374,10 +446,13 @@ export declare function deleteProxyGraph(xUnitoCredentialId: string, path: strin
|
|
|
374
446
|
*/
|
|
375
447
|
export declare function getUsers({ pagination, }?: {
|
|
376
448
|
pagination?: {
|
|
449
|
+
/** Number of 'first results' to skip */
|
|
377
450
|
offset?: number;
|
|
451
|
+
/** Maximum number of results after the offset */
|
|
378
452
|
limit?: number;
|
|
379
453
|
};
|
|
380
454
|
}, opts?: Oazapfts.RequestOpts): Promise<Pagination & {
|
|
455
|
+
/** The users. */
|
|
381
456
|
data: UserSummary[];
|
|
382
457
|
}>;
|
|
383
458
|
/**
|
|
@@ -417,5 +492,5 @@ export declare function getHealthReady(opts?: Oazapfts.RequestOpts): Promise<nev
|
|
|
417
492
|
* Whether the service is responsive
|
|
418
493
|
*/
|
|
419
494
|
export declare function getHealthAlive(opts?: Oazapfts.RequestOpts): Promise<never>;
|
|
420
|
-
import { HttpError } from '
|
|
495
|
+
import { HttpError } from './httpError.js';
|
|
421
496
|
export { HttpError };
|