@unito/integrations-platform-client 0.44.4 → 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/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.RequestOpts;
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 'oazapfts';
495
+ import { HttpError } from './httpError.js';
421
496
  export { HttpError };
package/dist/src/api.js CHANGED
@@ -1,42 +1,17 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.HttpError = exports.getHealthAlive = exports.getHealthReady = exports.getUserByEmail = exports.regenerateApiKey = exports.updateUser = exports.getUserById = exports.createUser = exports.getUsers = exports.deleteProxyGraph = exports.postProxyGraph = exports.patchProxyGraph = exports.getProxyGraph = exports.updateWebhookSubscription = exports.getProxyMe = exports.updateProfile = exports.getProfile = exports.reencryptData = exports.decryptData = exports.encryptData = exports.postTrack = exports.deleteCredential = exports.updateCredential = exports.getCredentialById = exports.createCredential = exports.getCredentials = exports.getIntegrationLogo = exports.getIntegrationEvents = exports.deleteIntegration = exports.updateIntegration = exports.getIntegrationById = exports.inviteUser = exports.getIntegrationByName = exports.publishIntegration = exports.createIntegration = exports.getIntegrations = exports.servers = exports.defaults = void 0;
27
1
  /**
28
2
  * Integrations Platform API
29
3
  * 0.1.0
30
4
  * DO NOT MODIFY - This file has been generated using oazapfts.
31
5
  * See https://www.npmjs.com/package/oazapfts
32
6
  */
33
- const Oazapfts = __importStar(require("oazapfts/lib/runtime"));
34
- const QS = __importStar(require("oazapfts/lib/runtime/query"));
35
- exports.defaults = {
7
+ import * as Oazapfts from 'oazapfts/lib/runtime';
8
+ import * as QS from 'oazapfts/lib/runtime/query';
9
+ export const defaults = {
10
+ headers: {},
36
11
  baseUrl: 'http://localhost:9000',
37
12
  };
38
- const oazapfts = Oazapfts.runtime(exports.defaults);
39
- exports.servers = {
13
+ const oazapfts = Oazapfts.runtime(defaults);
14
+ export const servers = {
40
15
  local: 'http://localhost:9000',
41
16
  staging: 'https://staging-integrations-platform.unito.io',
42
17
  production: 'https://integrations-platform.unito.io',
@@ -44,7 +19,7 @@ exports.servers = {
44
19
  /**
45
20
  * Get all the integrations
46
21
  */
47
- function getIntegrations({ pagination, unitoOrganizationId, search, } = {}, opts) {
22
+ export function getIntegrations({ pagination, unitoOrganizationId, search, } = {}, opts) {
48
23
  return oazapfts.ok(oazapfts.fetchJson(`/integrations${QS.query(QS.explode({
49
24
  pagination,
50
25
  unitoOrganizationId,
@@ -53,73 +28,76 @@ function getIntegrations({ pagination, unitoOrganizationId, search, } = {}, opts
53
28
  ...opts,
54
29
  }));
55
30
  }
56
- exports.getIntegrations = getIntegrations;
57
31
  /**
58
32
  * Create an integration
59
33
  */
60
- function createIntegration(body, opts) {
34
+ export function createIntegration(body, opts) {
61
35
  return oazapfts.ok(oazapfts.fetchJson('/integrations', oazapfts.json({
62
36
  ...opts,
63
37
  method: 'POST',
64
38
  body,
65
39
  })));
66
40
  }
67
- exports.createIntegration = createIntegration;
68
41
  /**
69
42
  * Publish an integration
70
43
  */
71
- function publishIntegration(body, opts) {
44
+ export function publishIntegration(body, opts) {
72
45
  return oazapfts.ok(oazapfts.fetchJson('/integrations/publish', oazapfts.multipart({
73
46
  ...opts,
74
47
  method: 'POST',
75
48
  body,
76
49
  })));
77
50
  }
78
- exports.publishIntegration = publishIntegration;
79
51
  /**
80
52
  * Find an integration by exact name
81
53
  */
82
- function getIntegrationByName(integrationName, opts) {
54
+ export function getIntegrationByName(integrationName, opts) {
83
55
  return oazapfts.ok(oazapfts.fetchJson(`/integrations/find/${encodeURIComponent(integrationName)}`, {
84
56
  ...opts,
85
57
  }));
86
58
  }
87
- exports.getIntegrationByName = getIntegrationByName;
88
59
  /**
89
60
  * Invite a user to an integration
90
61
  */
91
- function inviteUser(integrationId, body, opts) {
62
+ export function inviteUser(integrationId, body, opts) {
92
63
  return oazapfts.ok(oazapfts.fetchJson(`/integrations/${encodeURIComponent(integrationId)}/users/invite`, oazapfts.json({
93
64
  ...opts,
94
65
  method: 'POST',
95
66
  body,
96
67
  })));
97
68
  }
98
- exports.inviteUser = inviteUser;
69
+ /**
70
+ * Invite a unito organization to an integration
71
+ */
72
+ export function inviteOrganization(integrationId, body, opts) {
73
+ return oazapfts.ok(oazapfts.fetchJson(`/integrations/${encodeURIComponent(integrationId)}/organizations/invite`, oazapfts.json({
74
+ ...opts,
75
+ method: 'POST',
76
+ body,
77
+ })));
78
+ }
99
79
  /**
100
80
  * Get an integration
101
81
  */
102
- function getIntegrationById(integrationId, opts) {
82
+ export function getIntegrationById(integrationId, opts) {
103
83
  return oazapfts.ok(oazapfts.fetchJson(`/integrations/${encodeURIComponent(integrationId)}`, {
104
84
  ...opts,
105
85
  }));
106
86
  }
107
- exports.getIntegrationById = getIntegrationById;
108
87
  /**
109
88
  * Update an integration
110
89
  */
111
- function updateIntegration(integrationId, body, opts) {
90
+ export function updateIntegration(integrationId, body, opts) {
112
91
  return oazapfts.ok(oazapfts.fetchJson(`/integrations/${encodeURIComponent(integrationId)}`, oazapfts.json({
113
92
  ...opts,
114
93
  method: 'PATCH',
115
94
  body,
116
95
  })));
117
96
  }
118
- exports.updateIntegration = updateIntegration;
119
97
  /**
120
98
  * Delete an integration
121
99
  */
122
- function deleteIntegration(integrationId, name, opts) {
100
+ export function deleteIntegration(integrationId, name, opts) {
123
101
  return oazapfts.ok(oazapfts.fetchJson(`/integrations/${encodeURIComponent(integrationId)}${QS.query(QS.explode({
124
102
  name,
125
103
  }))}`, {
@@ -127,29 +105,26 @@ function deleteIntegration(integrationId, name, opts) {
127
105
  method: 'DELETE',
128
106
  }));
129
107
  }
130
- exports.deleteIntegration = deleteIntegration;
131
108
  /**
132
109
  * Get the events associated with this integration.
133
110
  */
134
- function getIntegrationEvents(integrationId, opts) {
111
+ export function getIntegrationEvents(integrationId, opts) {
135
112
  return oazapfts.ok(oazapfts.fetchJson(`/integrations/${encodeURIComponent(integrationId)}/events`, {
136
113
  ...opts,
137
114
  }));
138
115
  }
139
- exports.getIntegrationEvents = getIntegrationEvents;
140
116
  /**
141
117
  * Get the logo of the integration, in SVG format.
142
118
  */
143
- function getIntegrationLogo(integrationName, opts) {
119
+ export function getIntegrationLogo(integrationName, opts) {
144
120
  return oazapfts.ok(oazapfts.fetchJson(`/public/${encodeURIComponent(integrationName)}/logo.svg`, {
145
121
  ...opts,
146
122
  }));
147
123
  }
148
- exports.getIntegrationLogo = getIntegrationLogo;
149
124
  /**
150
125
  * Get all the credentials
151
126
  */
152
- function getCredentials({ pagination, filters, } = {}, opts) {
127
+ export function getCredentials({ pagination, filters, } = {}, opts) {
153
128
  return oazapfts.ok(oazapfts.fetchJson(`/credentials${QS.query(QS.explode({
154
129
  pagination,
155
130
  filters,
@@ -157,295 +132,264 @@ function getCredentials({ pagination, filters, } = {}, opts) {
157
132
  ...opts,
158
133
  }));
159
134
  }
160
- exports.getCredentials = getCredentials;
161
135
  /**
162
136
  * Create a credential
163
137
  */
164
- function createCredential(body, opts) {
138
+ export function createCredential(body, opts) {
165
139
  return oazapfts.ok(oazapfts.fetchJson('/credentials', oazapfts.json({
166
140
  ...opts,
167
141
  method: 'POST',
168
142
  body,
169
143
  })));
170
144
  }
171
- exports.createCredential = createCredential;
172
145
  /**
173
146
  * Get a credential
174
147
  */
175
- function getCredentialById(credentialId, opts) {
148
+ export function getCredentialById(credentialId, opts) {
176
149
  return oazapfts.ok(oazapfts.fetchJson(`/credentials/${encodeURIComponent(credentialId)}`, {
177
150
  ...opts,
178
151
  }));
179
152
  }
180
- exports.getCredentialById = getCredentialById;
181
153
  /**
182
154
  * Update a credential
183
155
  */
184
- function updateCredential(credentialId, body, opts) {
156
+ export function updateCredential(credentialId, body, opts) {
185
157
  return oazapfts.ok(oazapfts.fetchJson(`/credentials/${encodeURIComponent(credentialId)}`, oazapfts.json({
186
158
  ...opts,
187
159
  method: 'PATCH',
188
160
  body,
189
161
  })));
190
162
  }
191
- exports.updateCredential = updateCredential;
192
163
  /**
193
164
  * Delete a credential
194
165
  */
195
- function deleteCredential(credentialId, opts) {
166
+ export function deleteCredential(credentialId, opts) {
196
167
  return oazapfts.ok(oazapfts.fetchJson(`/credentials/${encodeURIComponent(credentialId)}`, {
197
168
  ...opts,
198
169
  method: 'DELETE',
199
170
  }));
200
171
  }
201
- exports.deleteCredential = deleteCredential;
202
172
  /**
203
173
  * Used by the frontend to send analytics data
204
174
  */
205
- function postTrack(body, opts) {
175
+ export function postTrack(body, opts) {
206
176
  return oazapfts.ok(oazapfts.fetchJson('/track', oazapfts.json({
207
177
  ...opts,
208
178
  method: 'POST',
209
179
  body,
210
180
  })));
211
181
  }
212
- exports.postTrack = postTrack;
213
182
  /**
214
183
  * Encrypt data
215
184
  */
216
- function encryptData(body, opts) {
185
+ export function encryptData(body, opts) {
217
186
  return oazapfts.ok(oazapfts.fetchJson('/encryptions/encrypt', oazapfts.json({
218
187
  ...opts,
219
188
  method: 'POST',
220
189
  body,
221
190
  })));
222
191
  }
223
- exports.encryptData = encryptData;
224
192
  /**
225
193
  * Decrypt data
226
194
  */
227
- function decryptData(body, opts) {
195
+ export function decryptData(body, opts) {
228
196
  return oazapfts.ok(oazapfts.fetchJson('/encryptions/decrypt', oazapfts.json({
229
197
  ...opts,
230
198
  method: 'POST',
231
199
  body,
232
200
  })));
233
201
  }
234
- exports.decryptData = decryptData;
235
202
  /**
236
203
  * Decrypt and encrypt data
237
204
  */
238
- function reencryptData(body, opts) {
205
+ export function reencryptData(body, opts) {
239
206
  return oazapfts.ok(oazapfts.fetchJson('/encryptions/reencrypt', oazapfts.json({
240
207
  ...opts,
241
208
  method: 'POST',
242
209
  body,
243
210
  })));
244
211
  }
245
- exports.reencryptData = reencryptData;
246
212
  /**
247
213
  * Get my profile
248
214
  */
249
- function getProfile(opts) {
215
+ export function getProfile(opts) {
250
216
  return oazapfts.ok(oazapfts.fetchJson('/profile', {
251
217
  ...opts,
252
218
  }));
253
219
  }
254
- exports.getProfile = getProfile;
255
220
  /**
256
221
  * Update my profile
257
222
  */
258
- function updateProfile(body, opts) {
223
+ export function updateProfile(body, opts) {
259
224
  return oazapfts.ok(oazapfts.fetchJson('/profile', oazapfts.json({
260
225
  ...opts,
261
226
  method: 'PATCH',
262
227
  body,
263
228
  })));
264
229
  }
265
- exports.updateProfile = updateProfile;
266
230
  /**
267
231
  * Call an integration's me
268
232
  */
269
- function getProxyMe(xUnitoCredentialId, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
233
+ export function getProxyMe(xUnitoCredentialId, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
270
234
  return oazapfts.ok(oazapfts.fetchJson('/proxy/me', {
271
235
  ...opts,
272
- headers: {
273
- ...(opts && opts.headers),
236
+ headers: oazapfts.mergeHeaders(opts?.headers, {
274
237
  'X-Unito-Credential-Id': xUnitoCredentialId,
275
238
  'X-Unito-Correlation-Id': xUnitoCorrelationId,
276
239
  'X-Unito-Additional-Logging-Context': xUnitoAdditionalLoggingContext,
277
- },
240
+ }),
278
241
  }));
279
242
  }
280
- exports.getProxyMe = getProxyMe;
281
243
  /**
282
244
  * Update a webhook subscription
283
245
  */
284
- function updateWebhookSubscription(xUnitoCredentialId, body, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
246
+ export function updateWebhookSubscription(xUnitoCredentialId, body, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
285
247
  return oazapfts.ok(oazapfts.fetchJson('/proxy/webhooks/subscriptions', oazapfts.json({
286
248
  ...opts,
287
249
  method: 'PUT',
288
250
  body,
289
- headers: {
290
- ...(opts && opts.headers),
251
+ headers: oazapfts.mergeHeaders(opts?.headers, {
291
252
  'X-Unito-Credential-Id': xUnitoCredentialId,
292
253
  'X-Unito-Correlation-Id': xUnitoCorrelationId,
293
254
  'X-Unito-Additional-Logging-Context': xUnitoAdditionalLoggingContext,
294
- },
255
+ }),
295
256
  })));
296
257
  }
297
- exports.updateWebhookSubscription = updateWebhookSubscription;
298
258
  /**
299
259
  * Call an integration's graph
300
260
  */
301
- function getProxyGraph(xUnitoCredentialId, path, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
261
+ export function getProxyGraph(xUnitoCredentialId, path, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
302
262
  return oazapfts.ok(oazapfts.fetchJson(`/proxy/graph${QS.query(QS.explode({
303
263
  path,
304
264
  }))}`, {
305
265
  ...opts,
306
- headers: {
307
- ...(opts && opts.headers),
266
+ headers: oazapfts.mergeHeaders(opts?.headers, {
308
267
  'X-Unito-Credential-Id': xUnitoCredentialId,
309
268
  'X-Unito-Correlation-Id': xUnitoCorrelationId,
310
269
  'X-Unito-Additional-Logging-Context': xUnitoAdditionalLoggingContext,
311
- },
270
+ }),
312
271
  }));
313
272
  }
314
- exports.getProxyGraph = getProxyGraph;
315
273
  /**
316
274
  * Call an integration's graph
317
275
  */
318
- function patchProxyGraph(xUnitoCredentialId, path, body, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
276
+ export function patchProxyGraph(xUnitoCredentialId, path, body, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
319
277
  return oazapfts.ok(oazapfts.fetchJson(`/proxy/graph${QS.query(QS.explode({
320
278
  path,
321
279
  }))}`, oazapfts.json({
322
280
  ...opts,
323
281
  method: 'PATCH',
324
282
  body,
325
- headers: {
326
- ...(opts && opts.headers),
283
+ headers: oazapfts.mergeHeaders(opts?.headers, {
327
284
  'X-Unito-Credential-Id': xUnitoCredentialId,
328
285
  'X-Unito-Correlation-Id': xUnitoCorrelationId,
329
286
  'X-Unito-Additional-Logging-Context': xUnitoAdditionalLoggingContext,
330
- },
287
+ }),
331
288
  })));
332
289
  }
333
- exports.patchProxyGraph = patchProxyGraph;
334
290
  /**
335
291
  * Call an integration's graph
336
292
  */
337
- function postProxyGraph(xUnitoCredentialId, path, body, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
293
+ export function postProxyGraph(xUnitoCredentialId, path, body, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
338
294
  return oazapfts.ok(oazapfts.fetchJson(`/proxy/graph${QS.query(QS.explode({
339
295
  path,
340
296
  }))}`, oazapfts.json({
341
297
  ...opts,
342
298
  method: 'POST',
343
299
  body,
344
- headers: {
345
- ...(opts && opts.headers),
300
+ headers: oazapfts.mergeHeaders(opts?.headers, {
346
301
  'X-Unito-Credential-Id': xUnitoCredentialId,
347
302
  'X-Unito-Correlation-Id': xUnitoCorrelationId,
348
303
  'X-Unito-Additional-Logging-Context': xUnitoAdditionalLoggingContext,
349
- },
304
+ }),
350
305
  })));
351
306
  }
352
- exports.postProxyGraph = postProxyGraph;
353
307
  /**
354
308
  * Call an integration's graph
355
309
  */
356
- function deleteProxyGraph(xUnitoCredentialId, path, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
310
+ export function deleteProxyGraph(xUnitoCredentialId, path, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
357
311
  return oazapfts.ok(oazapfts.fetchJson(`/proxy/graph${QS.query(QS.explode({
358
312
  path,
359
313
  }))}`, {
360
314
  ...opts,
361
315
  method: 'DELETE',
362
- headers: {
363
- ...(opts && opts.headers),
316
+ headers: oazapfts.mergeHeaders(opts?.headers, {
364
317
  'X-Unito-Credential-Id': xUnitoCredentialId,
365
318
  'X-Unito-Correlation-Id': xUnitoCorrelationId,
366
319
  'X-Unito-Additional-Logging-Context': xUnitoAdditionalLoggingContext,
367
- },
320
+ }),
368
321
  }));
369
322
  }
370
- exports.deleteProxyGraph = deleteProxyGraph;
371
323
  /**
372
324
  * Get all the users
373
325
  */
374
- function getUsers({ pagination, } = {}, opts) {
326
+ export function getUsers({ pagination, } = {}, opts) {
375
327
  return oazapfts.ok(oazapfts.fetchJson(`/users${QS.query(QS.explode({
376
328
  pagination,
377
329
  }))}`, {
378
330
  ...opts,
379
331
  }));
380
332
  }
381
- exports.getUsers = getUsers;
382
333
  /**
383
334
  * Create a user
384
335
  */
385
- function createUser(body, opts) {
336
+ export function createUser(body, opts) {
386
337
  return oazapfts.ok(oazapfts.fetchJson('/users', oazapfts.json({
387
338
  ...opts,
388
339
  method: 'POST',
389
340
  body,
390
341
  })));
391
342
  }
392
- exports.createUser = createUser;
393
343
  /**
394
344
  * Get a user
395
345
  */
396
- function getUserById(userId, opts) {
346
+ export function getUserById(userId, opts) {
397
347
  return oazapfts.ok(oazapfts.fetchJson(`/users/${encodeURIComponent(userId)}`, {
398
348
  ...opts,
399
349
  }));
400
350
  }
401
- exports.getUserById = getUserById;
402
351
  /**
403
352
  * Update a user
404
353
  */
405
- function updateUser(userId, body, opts) {
354
+ export function updateUser(userId, body, opts) {
406
355
  return oazapfts.ok(oazapfts.fetchJson(`/users/${encodeURIComponent(userId)}`, oazapfts.json({
407
356
  ...opts,
408
357
  method: 'PATCH',
409
358
  body,
410
359
  })));
411
360
  }
412
- exports.updateUser = updateUser;
413
361
  /**
414
362
  * Regenerate the api key of a user
415
363
  */
416
- function regenerateApiKey(userId, opts) {
364
+ export function regenerateApiKey(userId, opts) {
417
365
  return oazapfts.ok(oazapfts.fetchJson(`/users/${encodeURIComponent(userId)}/apiKey`, {
418
366
  ...opts,
419
367
  method: 'POST',
420
368
  }));
421
369
  }
422
- exports.regenerateApiKey = regenerateApiKey;
423
370
  /**
424
371
  * Get a user by its email address
425
372
  */
426
- function getUserByEmail(email, opts) {
373
+ export function getUserByEmail(email, opts) {
427
374
  return oazapfts.ok(oazapfts.fetchJson(`/users/find/${encodeURIComponent(email)}`, {
428
375
  ...opts,
429
376
  }));
430
377
  }
431
- exports.getUserByEmail = getUserByEmail;
432
378
  /**
433
379
  * Whether the service is ready to serve requests
434
380
  */
435
- function getHealthReady(opts) {
381
+ export function getHealthReady(opts) {
436
382
  return oazapfts.ok(oazapfts.fetchText('/health/ready', {
437
383
  ...opts,
438
384
  }));
439
385
  }
440
- exports.getHealthReady = getHealthReady;
441
386
  /**
442
387
  * Whether the service is responsive
443
388
  */
444
- function getHealthAlive(opts) {
389
+ export function getHealthAlive(opts) {
445
390
  return oazapfts.ok(oazapfts.fetchText('/health/alive', {
446
391
  ...opts,
447
392
  }));
448
393
  }
449
- exports.getHealthAlive = getHealthAlive;
450
- const oazapfts_1 = require("oazapfts");
451
- Object.defineProperty(exports, "HttpError", { enumerable: true, get: function () { return oazapfts_1.HttpError; } });
394
+ import { HttpError } from './httpError.js';
395
+ export { HttpError };
@@ -0,0 +1,6 @@
1
+ export declare class HttpError extends Error {
2
+ status: number;
3
+ data?: unknown;
4
+ headers: Headers;
5
+ constructor(status: number, data: unknown, headers: Headers);
6
+ }
@@ -0,0 +1,11 @@
1
+ export class HttpError extends Error {
2
+ status;
3
+ data;
4
+ headers;
5
+ constructor(status, data, headers) {
6
+ super(`Error: ${status}`);
7
+ this.status = status;
8
+ this.data = data;
9
+ this.headers = headers;
10
+ }
11
+ }
@@ -0,0 +1,473 @@
1
+ 'use strict';
2
+
3
+ var Oazapfts = require('oazapfts/lib/runtime');
4
+ var QS = require('oazapfts/lib/runtime/query');
5
+
6
+ function _interopNamespaceDefault(e) {
7
+ var n = Object.create(null);
8
+ if (e) {
9
+ Object.keys(e).forEach(function (k) {
10
+ if (k !== 'default') {
11
+ var d = Object.getOwnPropertyDescriptor(e, k);
12
+ Object.defineProperty(n, k, d.get ? d : {
13
+ enumerable: true,
14
+ get: function () { return e[k]; }
15
+ });
16
+ }
17
+ });
18
+ }
19
+ n.default = e;
20
+ return Object.freeze(n);
21
+ }
22
+
23
+ var Oazapfts__namespace = /*#__PURE__*/_interopNamespaceDefault(Oazapfts);
24
+ var QS__namespace = /*#__PURE__*/_interopNamespaceDefault(QS);
25
+
26
+ class HttpError extends Error {
27
+ status;
28
+ data;
29
+ headers;
30
+ constructor(status, data, headers) {
31
+ super(`Error: ${status}`);
32
+ this.status = status;
33
+ this.data = data;
34
+ this.headers = headers;
35
+ }
36
+ }
37
+
38
+ /**
39
+ * Integrations Platform API
40
+ * 0.1.0
41
+ * DO NOT MODIFY - This file has been generated using oazapfts.
42
+ * See https://www.npmjs.com/package/oazapfts
43
+ */
44
+ const defaults = {
45
+ headers: {},
46
+ baseUrl: 'http://localhost:9000',
47
+ };
48
+ const oazapfts = Oazapfts__namespace.runtime(defaults);
49
+ const servers = {
50
+ local: 'http://localhost:9000',
51
+ staging: 'https://staging-integrations-platform.unito.io',
52
+ production: 'https://integrations-platform.unito.io',
53
+ };
54
+ /**
55
+ * Get all the integrations
56
+ */
57
+ function getIntegrations({ pagination, unitoOrganizationId, search, } = {}, opts) {
58
+ return oazapfts.ok(oazapfts.fetchJson(`/integrations${QS__namespace.query(QS__namespace.explode({
59
+ pagination,
60
+ unitoOrganizationId,
61
+ search,
62
+ }))}`, {
63
+ ...opts,
64
+ }));
65
+ }
66
+ /**
67
+ * Create an integration
68
+ */
69
+ function createIntegration(body, opts) {
70
+ return oazapfts.ok(oazapfts.fetchJson('/integrations', oazapfts.json({
71
+ ...opts,
72
+ method: 'POST',
73
+ body,
74
+ })));
75
+ }
76
+ /**
77
+ * Publish an integration
78
+ */
79
+ function publishIntegration(body, opts) {
80
+ return oazapfts.ok(oazapfts.fetchJson('/integrations/publish', oazapfts.multipart({
81
+ ...opts,
82
+ method: 'POST',
83
+ body,
84
+ })));
85
+ }
86
+ /**
87
+ * Find an integration by exact name
88
+ */
89
+ function getIntegrationByName(integrationName, opts) {
90
+ return oazapfts.ok(oazapfts.fetchJson(`/integrations/find/${encodeURIComponent(integrationName)}`, {
91
+ ...opts,
92
+ }));
93
+ }
94
+ /**
95
+ * Invite a user to an integration
96
+ */
97
+ function inviteUser(integrationId, body, opts) {
98
+ return oazapfts.ok(oazapfts.fetchJson(`/integrations/${encodeURIComponent(integrationId)}/users/invite`, oazapfts.json({
99
+ ...opts,
100
+ method: 'POST',
101
+ body,
102
+ })));
103
+ }
104
+ /**
105
+ * Invite a unito organization to an integration
106
+ */
107
+ function inviteOrganization(integrationId, body, opts) {
108
+ return oazapfts.ok(oazapfts.fetchJson(`/integrations/${encodeURIComponent(integrationId)}/organizations/invite`, oazapfts.json({
109
+ ...opts,
110
+ method: 'POST',
111
+ body,
112
+ })));
113
+ }
114
+ /**
115
+ * Get an integration
116
+ */
117
+ function getIntegrationById(integrationId, opts) {
118
+ return oazapfts.ok(oazapfts.fetchJson(`/integrations/${encodeURIComponent(integrationId)}`, {
119
+ ...opts,
120
+ }));
121
+ }
122
+ /**
123
+ * Update an integration
124
+ */
125
+ function updateIntegration(integrationId, body, opts) {
126
+ return oazapfts.ok(oazapfts.fetchJson(`/integrations/${encodeURIComponent(integrationId)}`, oazapfts.json({
127
+ ...opts,
128
+ method: 'PATCH',
129
+ body,
130
+ })));
131
+ }
132
+ /**
133
+ * Delete an integration
134
+ */
135
+ function deleteIntegration(integrationId, name, opts) {
136
+ return oazapfts.ok(oazapfts.fetchJson(`/integrations/${encodeURIComponent(integrationId)}${QS__namespace.query(QS__namespace.explode({
137
+ name,
138
+ }))}`, {
139
+ ...opts,
140
+ method: 'DELETE',
141
+ }));
142
+ }
143
+ /**
144
+ * Get the events associated with this integration.
145
+ */
146
+ function getIntegrationEvents(integrationId, opts) {
147
+ return oazapfts.ok(oazapfts.fetchJson(`/integrations/${encodeURIComponent(integrationId)}/events`, {
148
+ ...opts,
149
+ }));
150
+ }
151
+ /**
152
+ * Get the logo of the integration, in SVG format.
153
+ */
154
+ function getIntegrationLogo(integrationName, opts) {
155
+ return oazapfts.ok(oazapfts.fetchJson(`/public/${encodeURIComponent(integrationName)}/logo.svg`, {
156
+ ...opts,
157
+ }));
158
+ }
159
+ /**
160
+ * Get all the credentials
161
+ */
162
+ function getCredentials({ pagination, filters, } = {}, opts) {
163
+ return oazapfts.ok(oazapfts.fetchJson(`/credentials${QS__namespace.query(QS__namespace.explode({
164
+ pagination,
165
+ filters,
166
+ }))}`, {
167
+ ...opts,
168
+ }));
169
+ }
170
+ /**
171
+ * Create a credential
172
+ */
173
+ function createCredential(body, opts) {
174
+ return oazapfts.ok(oazapfts.fetchJson('/credentials', oazapfts.json({
175
+ ...opts,
176
+ method: 'POST',
177
+ body,
178
+ })));
179
+ }
180
+ /**
181
+ * Get a credential
182
+ */
183
+ function getCredentialById(credentialId, opts) {
184
+ return oazapfts.ok(oazapfts.fetchJson(`/credentials/${encodeURIComponent(credentialId)}`, {
185
+ ...opts,
186
+ }));
187
+ }
188
+ /**
189
+ * Update a credential
190
+ */
191
+ function updateCredential(credentialId, body, opts) {
192
+ return oazapfts.ok(oazapfts.fetchJson(`/credentials/${encodeURIComponent(credentialId)}`, oazapfts.json({
193
+ ...opts,
194
+ method: 'PATCH',
195
+ body,
196
+ })));
197
+ }
198
+ /**
199
+ * Delete a credential
200
+ */
201
+ function deleteCredential(credentialId, opts) {
202
+ return oazapfts.ok(oazapfts.fetchJson(`/credentials/${encodeURIComponent(credentialId)}`, {
203
+ ...opts,
204
+ method: 'DELETE',
205
+ }));
206
+ }
207
+ /**
208
+ * Used by the frontend to send analytics data
209
+ */
210
+ function postTrack(body, opts) {
211
+ return oazapfts.ok(oazapfts.fetchJson('/track', oazapfts.json({
212
+ ...opts,
213
+ method: 'POST',
214
+ body,
215
+ })));
216
+ }
217
+ /**
218
+ * Encrypt data
219
+ */
220
+ function encryptData(body, opts) {
221
+ return oazapfts.ok(oazapfts.fetchJson('/encryptions/encrypt', oazapfts.json({
222
+ ...opts,
223
+ method: 'POST',
224
+ body,
225
+ })));
226
+ }
227
+ /**
228
+ * Decrypt data
229
+ */
230
+ function decryptData(body, opts) {
231
+ return oazapfts.ok(oazapfts.fetchJson('/encryptions/decrypt', oazapfts.json({
232
+ ...opts,
233
+ method: 'POST',
234
+ body,
235
+ })));
236
+ }
237
+ /**
238
+ * Decrypt and encrypt data
239
+ */
240
+ function reencryptData(body, opts) {
241
+ return oazapfts.ok(oazapfts.fetchJson('/encryptions/reencrypt', oazapfts.json({
242
+ ...opts,
243
+ method: 'POST',
244
+ body,
245
+ })));
246
+ }
247
+ /**
248
+ * Get my profile
249
+ */
250
+ function getProfile(opts) {
251
+ return oazapfts.ok(oazapfts.fetchJson('/profile', {
252
+ ...opts,
253
+ }));
254
+ }
255
+ /**
256
+ * Update my profile
257
+ */
258
+ function updateProfile(body, opts) {
259
+ return oazapfts.ok(oazapfts.fetchJson('/profile', oazapfts.json({
260
+ ...opts,
261
+ method: 'PATCH',
262
+ body,
263
+ })));
264
+ }
265
+ /**
266
+ * Call an integration's me
267
+ */
268
+ function getProxyMe(xUnitoCredentialId, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
269
+ return oazapfts.ok(oazapfts.fetchJson('/proxy/me', {
270
+ ...opts,
271
+ headers: oazapfts.mergeHeaders(opts?.headers, {
272
+ 'X-Unito-Credential-Id': xUnitoCredentialId,
273
+ 'X-Unito-Correlation-Id': xUnitoCorrelationId,
274
+ 'X-Unito-Additional-Logging-Context': xUnitoAdditionalLoggingContext,
275
+ }),
276
+ }));
277
+ }
278
+ /**
279
+ * Update a webhook subscription
280
+ */
281
+ function updateWebhookSubscription(xUnitoCredentialId, body, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
282
+ return oazapfts.ok(oazapfts.fetchJson('/proxy/webhooks/subscriptions', oazapfts.json({
283
+ ...opts,
284
+ method: 'PUT',
285
+ body,
286
+ headers: oazapfts.mergeHeaders(opts?.headers, {
287
+ 'X-Unito-Credential-Id': xUnitoCredentialId,
288
+ 'X-Unito-Correlation-Id': xUnitoCorrelationId,
289
+ 'X-Unito-Additional-Logging-Context': xUnitoAdditionalLoggingContext,
290
+ }),
291
+ })));
292
+ }
293
+ /**
294
+ * Call an integration's graph
295
+ */
296
+ function getProxyGraph(xUnitoCredentialId, path, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
297
+ return oazapfts.ok(oazapfts.fetchJson(`/proxy/graph${QS__namespace.query(QS__namespace.explode({
298
+ path,
299
+ }))}`, {
300
+ ...opts,
301
+ headers: oazapfts.mergeHeaders(opts?.headers, {
302
+ 'X-Unito-Credential-Id': xUnitoCredentialId,
303
+ 'X-Unito-Correlation-Id': xUnitoCorrelationId,
304
+ 'X-Unito-Additional-Logging-Context': xUnitoAdditionalLoggingContext,
305
+ }),
306
+ }));
307
+ }
308
+ /**
309
+ * Call an integration's graph
310
+ */
311
+ function patchProxyGraph(xUnitoCredentialId, path, body, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
312
+ return oazapfts.ok(oazapfts.fetchJson(`/proxy/graph${QS__namespace.query(QS__namespace.explode({
313
+ path,
314
+ }))}`, oazapfts.json({
315
+ ...opts,
316
+ method: 'PATCH',
317
+ body,
318
+ headers: oazapfts.mergeHeaders(opts?.headers, {
319
+ 'X-Unito-Credential-Id': xUnitoCredentialId,
320
+ 'X-Unito-Correlation-Id': xUnitoCorrelationId,
321
+ 'X-Unito-Additional-Logging-Context': xUnitoAdditionalLoggingContext,
322
+ }),
323
+ })));
324
+ }
325
+ /**
326
+ * Call an integration's graph
327
+ */
328
+ function postProxyGraph(xUnitoCredentialId, path, body, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
329
+ return oazapfts.ok(oazapfts.fetchJson(`/proxy/graph${QS__namespace.query(QS__namespace.explode({
330
+ path,
331
+ }))}`, oazapfts.json({
332
+ ...opts,
333
+ method: 'POST',
334
+ body,
335
+ headers: oazapfts.mergeHeaders(opts?.headers, {
336
+ 'X-Unito-Credential-Id': xUnitoCredentialId,
337
+ 'X-Unito-Correlation-Id': xUnitoCorrelationId,
338
+ 'X-Unito-Additional-Logging-Context': xUnitoAdditionalLoggingContext,
339
+ }),
340
+ })));
341
+ }
342
+ /**
343
+ * Call an integration's graph
344
+ */
345
+ function deleteProxyGraph(xUnitoCredentialId, path, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
346
+ return oazapfts.ok(oazapfts.fetchJson(`/proxy/graph${QS__namespace.query(QS__namespace.explode({
347
+ path,
348
+ }))}`, {
349
+ ...opts,
350
+ method: 'DELETE',
351
+ headers: oazapfts.mergeHeaders(opts?.headers, {
352
+ 'X-Unito-Credential-Id': xUnitoCredentialId,
353
+ 'X-Unito-Correlation-Id': xUnitoCorrelationId,
354
+ 'X-Unito-Additional-Logging-Context': xUnitoAdditionalLoggingContext,
355
+ }),
356
+ }));
357
+ }
358
+ /**
359
+ * Get all the users
360
+ */
361
+ function getUsers({ pagination, } = {}, opts) {
362
+ return oazapfts.ok(oazapfts.fetchJson(`/users${QS__namespace.query(QS__namespace.explode({
363
+ pagination,
364
+ }))}`, {
365
+ ...opts,
366
+ }));
367
+ }
368
+ /**
369
+ * Create a user
370
+ */
371
+ function createUser(body, opts) {
372
+ return oazapfts.ok(oazapfts.fetchJson('/users', oazapfts.json({
373
+ ...opts,
374
+ method: 'POST',
375
+ body,
376
+ })));
377
+ }
378
+ /**
379
+ * Get a user
380
+ */
381
+ function getUserById(userId, opts) {
382
+ return oazapfts.ok(oazapfts.fetchJson(`/users/${encodeURIComponent(userId)}`, {
383
+ ...opts,
384
+ }));
385
+ }
386
+ /**
387
+ * Update a user
388
+ */
389
+ function updateUser(userId, body, opts) {
390
+ return oazapfts.ok(oazapfts.fetchJson(`/users/${encodeURIComponent(userId)}`, oazapfts.json({
391
+ ...opts,
392
+ method: 'PATCH',
393
+ body,
394
+ })));
395
+ }
396
+ /**
397
+ * Regenerate the api key of a user
398
+ */
399
+ function regenerateApiKey(userId, opts) {
400
+ return oazapfts.ok(oazapfts.fetchJson(`/users/${encodeURIComponent(userId)}/apiKey`, {
401
+ ...opts,
402
+ method: 'POST',
403
+ }));
404
+ }
405
+ /**
406
+ * Get a user by its email address
407
+ */
408
+ function getUserByEmail(email, opts) {
409
+ return oazapfts.ok(oazapfts.fetchJson(`/users/find/${encodeURIComponent(email)}`, {
410
+ ...opts,
411
+ }));
412
+ }
413
+ /**
414
+ * Whether the service is ready to serve requests
415
+ */
416
+ function getHealthReady(opts) {
417
+ return oazapfts.ok(oazapfts.fetchText('/health/ready', {
418
+ ...opts,
419
+ }));
420
+ }
421
+ /**
422
+ * Whether the service is responsive
423
+ */
424
+ function getHealthAlive(opts) {
425
+ return oazapfts.ok(oazapfts.fetchText('/health/alive', {
426
+ ...opts,
427
+ }));
428
+ }
429
+
430
+ var api = /*#__PURE__*/Object.freeze({
431
+ __proto__: null,
432
+ HttpError: HttpError,
433
+ createCredential: createCredential,
434
+ createIntegration: createIntegration,
435
+ createUser: createUser,
436
+ decryptData: decryptData,
437
+ defaults: defaults,
438
+ deleteCredential: deleteCredential,
439
+ deleteIntegration: deleteIntegration,
440
+ deleteProxyGraph: deleteProxyGraph,
441
+ encryptData: encryptData,
442
+ getCredentialById: getCredentialById,
443
+ getCredentials: getCredentials,
444
+ getHealthAlive: getHealthAlive,
445
+ getHealthReady: getHealthReady,
446
+ getIntegrationById: getIntegrationById,
447
+ getIntegrationByName: getIntegrationByName,
448
+ getIntegrationEvents: getIntegrationEvents,
449
+ getIntegrationLogo: getIntegrationLogo,
450
+ getIntegrations: getIntegrations,
451
+ getProfile: getProfile,
452
+ getProxyGraph: getProxyGraph,
453
+ getProxyMe: getProxyMe,
454
+ getUserByEmail: getUserByEmail,
455
+ getUserById: getUserById,
456
+ getUsers: getUsers,
457
+ inviteOrganization: inviteOrganization,
458
+ inviteUser: inviteUser,
459
+ patchProxyGraph: patchProxyGraph,
460
+ postProxyGraph: postProxyGraph,
461
+ postTrack: postTrack,
462
+ publishIntegration: publishIntegration,
463
+ reencryptData: reencryptData,
464
+ regenerateApiKey: regenerateApiKey,
465
+ servers: servers,
466
+ updateCredential: updateCredential,
467
+ updateIntegration: updateIntegration,
468
+ updateProfile: updateProfile,
469
+ updateUser: updateUser,
470
+ updateWebhookSubscription: updateWebhookSubscription
471
+ });
472
+
473
+ module.exports = api;
@@ -1,2 +1,2 @@
1
- import * as api from './api';
1
+ import * as api from './api.js';
2
2
  export default api;
package/dist/src/index.js CHANGED
@@ -1,27 +1,2 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- const api = __importStar(require("./api"));
27
- exports.default = api;
1
+ import * as api from './api.js';
2
+ export default api;
package/package.json CHANGED
@@ -1,8 +1,19 @@
1
1
  {
2
2
  "name": "@unito/integrations-platform-client",
3
- "version": "0.44.4",
3
+ "version": "0.45.0",
4
4
  "description": "The Unito Integrations Platform Client",
5
- "type": "commonjs",
5
+ "type": "module",
6
+ "types": "./dist/src/index.d.ts",
7
+ "exports": {
8
+ "./package.json": "./package.json",
9
+ ".": {
10
+ "import": "./dist/src/index.js",
11
+ "require": "./dist/src/index.cjs"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist/src/**/*"
16
+ ],
6
17
  "engines": {
7
18
  "node": ">=18",
8
19
  "npm": ">=9.5.0"
@@ -11,10 +22,11 @@
11
22
  "prepublishOnly": "npm run lint && npm run test",
12
23
  "prepare": "npm run compile",
13
24
  "lint": "eslint --fix src test --ext .ts && prettier --write src test",
14
- "compile": "tsc",
15
- "compile:watch": "tsc --watch",
16
- "test": "NODE_ENV=test ts-mocha -p tsconfig.json test/**/*.test.ts",
17
- "test:debug": "NODE_ENV=test ts-mocha -p tsconfig.json --inspect-brk test/**/*.test.ts",
25
+ "compile:esm": "tsc",
26
+ "compile:cjs": "rollup dist/src/index.js --file dist/src/index.cjs --format cjs",
27
+ "compile": "rm -rf dist && npm run compile:esm && npm run compile:cjs",
28
+ "test": "NODE_ENV=test node --loader ts-node/esm --test ./test/*.test.ts",
29
+ "test:debug": "NODE_ENV=test node --loader ts-node/esm --inspect-brk --test ./test/*.test.ts",
18
30
  "ci:test": "nyc npm run test"
19
31
  },
20
32
  "author": {
@@ -22,31 +34,22 @@
22
34
  "email": "hello@unito.io"
23
35
  },
24
36
  "license": "LicenseRef-LICENSE",
25
- "main": "dist/src/index.js",
26
- "files": [
27
- "dist/src/**/*"
28
- ],
29
37
  "devDependencies": {
30
- "@types/chai": "4.x",
31
- "@types/mocha": "10.x",
32
38
  "@types/node": "18.x",
33
39
  "@types/node-fetch": "2.x",
34
40
  "@types/prettier": "2.x",
35
- "@types/sinon": "10.x",
41
+ "@types/sinon": "17.x",
36
42
  "@typescript-eslint/eslint-plugin": "6.x",
37
43
  "@typescript-eslint/parser": "6.x",
38
- "chai": "4.x",
39
44
  "eslint": "8.x",
40
- "mocha": "10.x",
41
45
  "nyc": "15.x",
42
46
  "prettier": "3.x",
43
- "sinon": "16.x",
44
- "ts-mocha": "10.x",
47
+ "rollup": "4.x",
48
+ "sinon": "17.x",
45
49
  "ts-node": "10.x",
46
50
  "typescript": "5.x"
47
51
  },
48
52
  "dependencies": {
49
- "node-fetch": "2.x",
50
- "oazapfts": "4.9.x"
53
+ "oazapfts": "5.x"
51
54
  }
52
55
  }