@unito/integration-cli 0.60.1 → 0.60.2

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.
@@ -6,6 +6,7 @@ declare let _extends: string[];
6
6
  export { _extends as extends };
7
7
  export declare let rules: {
8
8
  'no-console': string;
9
+ '@typescript-eslint/no-explicit-any': string;
9
10
  };
10
11
  export declare let ignorePatterns: string[];
11
12
  export declare let overrides: {
package/dist/.eslintrc.js CHANGED
@@ -12,6 +12,7 @@ module.exports = {
12
12
  ],
13
13
  rules: {
14
14
  'no-console': 'off',
15
+ '@typescript-eslint/no-explicit-any': 'off',
15
16
  },
16
17
  ignorePatterns: [
17
18
  'boilerplate',
@@ -1,4 +1,4 @@
1
- import IntegrationsPlatform from '@unito/integrations-platform-client';
1
+ import * as IntegrationsPlatform from './integrationsPlatformClient';
2
2
  import { Environment } from '../resources/globalConfiguration';
3
3
  import { Configuration } from '../configurationTypes';
4
4
  export type User = IntegrationsPlatform.User;
@@ -3,40 +3,40 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getCredential = exports.updateIntegration = exports.getIntegrationEvents = exports.inviteUserToIntegration = exports.createIntegration = exports.publishIntegration = exports.getIntegrations = exports.getIntegrationByName = exports.getIntegration = exports.reencryptData = exports.decryptData = exports.encryptData = exports.getProfile = exports.setApiKey = exports.getApiKey = exports.setEnvironment = exports.Servers = exports.HttpError = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const fs = tslib_1.__importStar(require("fs"));
6
- const integrations_platform_client_1 = tslib_1.__importDefault(require("@unito/integrations-platform-client"));
6
+ const IntegrationsPlatform = tslib_1.__importStar(require("./integrationsPlatformClient"));
7
7
  const globalConfiguration_1 = require("../resources/globalConfiguration");
8
- const { HttpError } = integrations_platform_client_1.default;
8
+ const { HttpError } = IntegrationsPlatform;
9
9
  exports.HttpError = HttpError;
10
10
  exports.Servers = {
11
- [globalConfiguration_1.Environment.Local]: integrations_platform_client_1.default.servers.local,
12
- [globalConfiguration_1.Environment.Staging]: integrations_platform_client_1.default.servers.staging,
13
- [globalConfiguration_1.Environment.Production]: integrations_platform_client_1.default.servers.production,
11
+ [globalConfiguration_1.Environment.Local]: IntegrationsPlatform.servers.local,
12
+ [globalConfiguration_1.Environment.Staging]: IntegrationsPlatform.servers.staging,
13
+ [globalConfiguration_1.Environment.Production]: IntegrationsPlatform.servers.production,
14
14
  };
15
15
  function setEnvironment(environment) {
16
- integrations_platform_client_1.default.defaults.fetch = fetch;
17
- integrations_platform_client_1.default.defaults.baseUrl = exports.Servers[environment];
16
+ IntegrationsPlatform.defaults.fetch = fetch;
17
+ IntegrationsPlatform.defaults.baseUrl = exports.Servers[environment];
18
18
  }
19
19
  exports.setEnvironment = setEnvironment;
20
20
  function getApiKey() {
21
- const header = integrations_platform_client_1.default.defaults.headers?.Authorization?.toString();
21
+ const header = IntegrationsPlatform.defaults.headers?.Authorization?.toString();
22
22
  return header?.split(' ')?.at(1);
23
23
  }
24
24
  exports.getApiKey = getApiKey;
25
25
  function setApiKey(apiKey) {
26
26
  if (apiKey) {
27
- integrations_platform_client_1.default.defaults.headers = { Authorization: `Bearer ${apiKey}` };
27
+ IntegrationsPlatform.defaults.headers = { Authorization: `Bearer ${apiKey}` };
28
28
  }
29
29
  else {
30
- integrations_platform_client_1.default.defaults.headers = {};
30
+ IntegrationsPlatform.defaults.headers = {};
31
31
  }
32
32
  }
33
33
  exports.setApiKey = setApiKey;
34
34
  async function getProfile() {
35
- return integrations_platform_client_1.default.getProfile();
35
+ return IntegrationsPlatform.getProfile();
36
36
  }
37
37
  exports.getProfile = getProfile;
38
38
  async function encryptData(integrationName, data, sensitive) {
39
- return integrations_platform_client_1.default.encryptData({
39
+ return IntegrationsPlatform.encryptData({
40
40
  integrationName,
41
41
  data,
42
42
  sensitive,
@@ -44,14 +44,14 @@ async function encryptData(integrationName, data, sensitive) {
44
44
  }
45
45
  exports.encryptData = encryptData;
46
46
  async function decryptData(integrationName, data) {
47
- return integrations_platform_client_1.default.decryptData({
47
+ return IntegrationsPlatform.decryptData({
48
48
  integrationName,
49
49
  data,
50
50
  });
51
51
  }
52
52
  exports.decryptData = decryptData;
53
53
  async function reencryptData(integrationName, encryptedData, newIntegrationName) {
54
- return integrations_platform_client_1.default.reencryptData({
54
+ return IntegrationsPlatform.reencryptData({
55
55
  integrationName,
56
56
  encryptedData,
57
57
  newIntegrationName,
@@ -59,11 +59,11 @@ async function reencryptData(integrationName, encryptedData, newIntegrationName)
59
59
  }
60
60
  exports.reencryptData = reencryptData;
61
61
  async function getIntegration(integrationId) {
62
- return integrations_platform_client_1.default.getIntegrationById(integrationId);
62
+ return IntegrationsPlatform.getIntegrationById(integrationId);
63
63
  }
64
64
  exports.getIntegration = getIntegration;
65
65
  async function getIntegrationByName(integrationName) {
66
- return integrations_platform_client_1.default.getIntegrationByName(integrationName);
66
+ return IntegrationsPlatform.getIntegrationByName(integrationName);
67
67
  }
68
68
  exports.getIntegrationByName = getIntegrationByName;
69
69
  async function getIntegrations() {
@@ -72,7 +72,7 @@ async function getIntegrations() {
72
72
  const limit = 100;
73
73
  let nextPageOffset = 0;
74
74
  do {
75
- page = await integrations_platform_client_1.default.getIntegrations({
75
+ page = await IntegrationsPlatform.getIntegrations({
76
76
  pagination: { offset: nextPageOffset, limit },
77
77
  });
78
78
  nextPageOffset += limit;
@@ -84,27 +84,27 @@ exports.getIntegrations = getIntegrations;
84
84
  async function publishIntegration(archivePath) {
85
85
  const file = fs.readFileSync(archivePath);
86
86
  const blob = new Blob([file], { type: 'binary' });
87
- return await integrations_platform_client_1.default.publishIntegration({ file: blob });
87
+ return await IntegrationsPlatform.publishIntegration({ file: blob });
88
88
  }
89
89
  exports.publishIntegration = publishIntegration;
90
90
  async function createIntegration(configuration) {
91
91
  // The creation of an integration is kept to its minimal required fields...
92
- const integration = await integrations_platform_client_1.default.createIntegration({ name: configuration.name });
92
+ const integration = await IntegrationsPlatform.createIntegration({ name: configuration.name });
93
93
  // ... as all other non-required fields are updated here.
94
94
  return updateIntegration(integration.id, configuration);
95
95
  }
96
96
  exports.createIntegration = createIntegration;
97
97
  async function inviteUserToIntegration(integrationId, email) {
98
- await integrations_platform_client_1.default.inviteUser(integrationId, { email });
98
+ await IntegrationsPlatform.inviteUser(integrationId, { email });
99
99
  }
100
100
  exports.inviteUserToIntegration = inviteUserToIntegration;
101
101
  async function getIntegrationEvents(integrationId, options = {}) {
102
- const { data: events } = await integrations_platform_client_1.default.getIntegrationEvents(integrationId, options);
102
+ const { data: events } = await IntegrationsPlatform.getIntegrationEvents(integrationId, options);
103
103
  return events;
104
104
  }
105
105
  exports.getIntegrationEvents = getIntegrationEvents;
106
106
  async function updateIntegration(integrationId, configuration) {
107
- const current = await integrations_platform_client_1.default.getIntegrationById(integrationId);
107
+ const current = await IntegrationsPlatform.getIntegrationById(integrationId);
108
108
  // Create authorizations.
109
109
  const authorizationsToCreate = configuration.authorizations
110
110
  ?.filter(configAuthorization => !current.authorizations.some(platformAuthorization => platformAuthorization.name === configAuthorization.name))
@@ -141,7 +141,7 @@ async function updateIntegration(integrationId, configuration) {
141
141
  };
142
142
  return authorizationToUpdate;
143
143
  });
144
- return await integrations_platform_client_1.default.updateIntegration(current.id, {
144
+ return await IntegrationsPlatform.updateIntegration(current.id, {
145
145
  baseUrl: configuration.baseUrl,
146
146
  graphRelativeUrl: configuration.graphRelativeUrl ?? '/',
147
147
  credentialAccountRelativeUrl: configuration.credentialAccountRelativeUrl ?? '/me',
@@ -156,6 +156,6 @@ async function updateIntegration(integrationId, configuration) {
156
156
  }
157
157
  exports.updateIntegration = updateIntegration;
158
158
  async function getCredential(credentialId) {
159
- return integrations_platform_client_1.default.getCredentialById(credentialId);
159
+ return IntegrationsPlatform.getCredentialById(credentialId);
160
160
  }
161
161
  exports.getCredential = getCredential;
@@ -0,0 +1,502 @@
1
+ /**
2
+ * Integrations Platform API
3
+ * 0.1.0
4
+ * DO NOT MODIFY - This file has been generated using oazapfts.
5
+ * See https://www.npmjs.com/package/oazapfts
6
+ */
7
+ import * as Oazapfts from '@oazapfts/runtime';
8
+ export declare const defaults: Oazapfts.Defaults<Oazapfts.CustomHeaders>;
9
+ export declare const servers: {
10
+ local: string;
11
+ staging: string;
12
+ production: string;
13
+ };
14
+ export type Pagination = {
15
+ /** The total number of results. */
16
+ total: number;
17
+ };
18
+ export type Base = {
19
+ createdAt: string;
20
+ updatedAt: string;
21
+ archivedAt: string | null;
22
+ };
23
+ export type IntegrationSummary = Base & {
24
+ /** The id of the integration. */
25
+ id: number;
26
+ /** The name of the integration. */
27
+ name: string;
28
+ /** The base URL where the integration is located. */
29
+ baseUrl: string | null;
30
+ /** The relative URL (to the baseUrl) where the graph of items of the integration is located. */
31
+ graphRelativeUrl: string;
32
+ /** The relative URL (to the baseUrl) to fetch the current integration's authenticated user. */
33
+ credentialAccountRelativeUrl: string;
34
+ /** The relative URL (to the baseUrl) to parse a webhook payload. */
35
+ webhookParsingRelativeUrl?: string | null;
36
+ /** The relative URL (to the baseUrl) to operate on webhook subscriptions. */
37
+ webhookSubscriptionsRelativeUrl?: string | null;
38
+ /** The relative URL (to the baseUrl) to acknowledge a webhook reception. */
39
+ webhookAcknowledgeRelativeUrl?: string | null;
40
+ /** The visibility of the integration. */
41
+ visibility: 'private' | 'public';
42
+ /** The list of organization ids for which this integration is visibile. */
43
+ unitoOrganizationIds: string[];
44
+ /** The UI-related information of the integration. */
45
+ ui: {
46
+ /** The name of the integration, as it should be displayed in a UI. */
47
+ displayName: string;
48
+ /** The logo of the integration, in SVG format. */
49
+ logo: string | null;
50
+ };
51
+ /** The encrypted secrets of the integration. */
52
+ secrets?: {
53
+ [key: string]: string;
54
+ };
55
+ /** The date at which the integration has been disabled */
56
+ disabledAt?: string | null;
57
+ };
58
+ export type Error = {
59
+ /** The message of the error. */
60
+ message: string;
61
+ /** The details of the error. */
62
+ details?: {
63
+ [key: string]: any;
64
+ };
65
+ /** The stack trace of the error. */
66
+ stack?: string[];
67
+ };
68
+ export type AuthorizationMethod = 'custom' | 'oauth2';
69
+ export type AuthorizationGrantType = 'authorization_code' | 'password' | 'client_credentials';
70
+ export type AuthorizationScope = {
71
+ /** The name of the scope. */
72
+ name: string;
73
+ /** Message to the end-user to explain the usage of the scope by Unito. */
74
+ help?: string;
75
+ };
76
+ export type AuthorizationOAuth2ContentType = 'application/x-www-form-urlencoded' | 'application/json';
77
+ export type AuthorizationOAuth2RequestParameters = {
78
+ /** Extra information to include in the HTTP request headers. */
79
+ header?: {
80
+ [key: string]: string | number | boolean;
81
+ };
82
+ /** Extra information to include in the HTTP request body. */
83
+ body?: {
84
+ [key: string]: string | number | boolean;
85
+ };
86
+ };
87
+ export type AuthorizationOAuth2 = {
88
+ /** The Client Secret obtained from the provider. */
89
+ clientSecret?: string;
90
+ /** The Client Id obtained from the provider. */
91
+ clientId?: string;
92
+ /** The URL to grant or deny access to the user account. */
93
+ authorizationUrl?: string;
94
+ /** The URL to obtain or refresh an access token. */
95
+ tokenUrl: string;
96
+ grantType: AuthorizationGrantType;
97
+ scopes: AuthorizationScope[];
98
+ requestContentType: AuthorizationOAuth2ContentType;
99
+ responseContentType: AuthorizationOAuth2ContentType;
100
+ refreshRequestParameters?: AuthorizationOAuth2RequestParameters;
101
+ tokenRequestParameters?: AuthorizationOAuth2RequestParameters;
102
+ } | null;
103
+ export type AuthorizationVariables = {
104
+ [key: string]: {
105
+ type: 'boolean' | 'number' | 'password' | 'string' | 'text';
106
+ format?: 'uri' | 'email';
107
+ pattern?: string;
108
+ label?: string;
109
+ required?: boolean;
110
+ placeholder?: string;
111
+ defaultValue?: string | number | boolean;
112
+ help?: string;
113
+ documentationUrl?: string;
114
+ };
115
+ };
116
+ export type Authorization = Base & {
117
+ id: number;
118
+ integrationId: number;
119
+ name: string;
120
+ method: AuthorizationMethod;
121
+ oauth2: AuthorizationOAuth2;
122
+ variables: AuthorizationVariables;
123
+ /** The Base64-encoded data URL of an <img> src content. For example: 'data:image/png;base64,<base64>' */
124
+ instructionsImage?: string | null;
125
+ /** A string representing a markdown document. */
126
+ instructionsMarkdown?: string | null;
127
+ };
128
+ export type Integration = IntegrationSummary & {
129
+ /** The authorizations of the integration. */
130
+ authorizations: Authorization[];
131
+ /** The ids of the developers of the integration. */
132
+ userIds: number[];
133
+ };
134
+ export type IntegrationEvent = {
135
+ /** The date at which the event took place. */
136
+ date: string;
137
+ /** The text of the event. */
138
+ text: string;
139
+ /** The tags associated with the event. */
140
+ tags: string[];
141
+ /** The title of the event. */
142
+ title: string;
143
+ };
144
+ export type Credential = Base & {
145
+ /** The id of the credential. */
146
+ id: number;
147
+ /** The id of the integration. */
148
+ integrationId: number;
149
+ /** The name of the integration. */
150
+ integrationName: string;
151
+ /** The id of the authorization. */
152
+ authorizationId: number;
153
+ /** The scope of the credential. */
154
+ scope: 'development' | 'compliance' | 'production' | 'service';
155
+ /** The id of the Unito User for which this credential belongs to. */
156
+ unitoUserId: string | null;
157
+ /** The payload of the credential, which conforms to the schema (ex. variables) of the authorization. */
158
+ payload: {
159
+ [key: string]: any;
160
+ };
161
+ /** The partition used to divide data into different buckets. */
162
+ partitionKey?: string | null;
163
+ };
164
+ export type CredentialAccount = {
165
+ /** The native id of the provider account. */
166
+ id: string;
167
+ /** The display name of the provider account. */
168
+ displayName: string;
169
+ /** The emails associated with the provider account. */
170
+ emails: string[];
171
+ /** The partition used to divide data into different buckets. */
172
+ partition?: string;
173
+ };
174
+ export type UserRole = 'unitoAdministrator' | 'unitoService' | 'developer';
175
+ export type UserSummary = Base & {
176
+ /** The id of the user. */
177
+ id: number;
178
+ /** The email of the user. */
179
+ email: string;
180
+ /** The ID of the organization which will have access to integrations created by this user. */
181
+ defaultUnitoOrganizationId: string | null;
182
+ /** The date & time at which the user accepted the terms & conditions of the SDK. */
183
+ termsAcceptedAt: string | null;
184
+ role: UserRole;
185
+ };
186
+ export type User = UserSummary & {
187
+ /** The API key of the user. */
188
+ apiKey: string;
189
+ };
190
+ /**
191
+ * Get all the integrations
192
+ */
193
+ export declare function getIntegrations({ pagination, unitoOrganizationId, search, }?: {
194
+ pagination?: {
195
+ /** Number of 'first results' to skip */
196
+ offset?: number;
197
+ /** Maximum number of results after the offset */
198
+ limit?: number;
199
+ };
200
+ unitoOrganizationId?: string;
201
+ search?: string;
202
+ }, opts?: Oazapfts.RequestOpts): Promise<Pagination & {
203
+ /** The integrations. */
204
+ data: IntegrationSummary[];
205
+ }>;
206
+ /**
207
+ * Create an integration
208
+ */
209
+ export declare function createIntegration(body?: {
210
+ name: string;
211
+ baseUrl?: string | null;
212
+ graphRelativeUrl?: string | null;
213
+ credentialAccountRelativeUrl?: string | null;
214
+ webhookParsingRelativeUrl?: string | null;
215
+ webhookSubscriptionsRelativeUrl?: string | null;
216
+ webhookAcknowledgeRelativeUrl?: string | null;
217
+ }, opts?: Oazapfts.RequestOpts): Promise<Integration>;
218
+ /**
219
+ * Publish an integration
220
+ */
221
+ export declare function publishIntegration(body?: {
222
+ /** The archive of the integration, including the .unito.json file. */
223
+ file: Blob;
224
+ }, opts?: Oazapfts.RequestOpts): Promise<Integration>;
225
+ /**
226
+ * Find an integration by exact name
227
+ */
228
+ export declare function getIntegrationByName(integrationName: string, opts?: Oazapfts.RequestOpts): Promise<Integration>;
229
+ /**
230
+ * Invite a user to an integration
231
+ */
232
+ export declare function inviteUser(integrationId: number, body?: {
233
+ email?: string;
234
+ }, opts?: Oazapfts.RequestOpts): Promise<unknown>;
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>;
241
+ /**
242
+ * Get an integration
243
+ */
244
+ export declare function getIntegrationById(integrationId: number, opts?: Oazapfts.RequestOpts): Promise<Integration>;
245
+ /**
246
+ * Update an integration
247
+ */
248
+ export declare function updateIntegration(integrationId: number, body?: {
249
+ baseUrl?: string | null;
250
+ graphRelativeUrl?: string | null;
251
+ credentialAccountRelativeUrl?: string | null;
252
+ webhookParsingRelativeUrl?: string | null;
253
+ webhookSubscriptionsRelativeUrl?: string | null;
254
+ webhookAcknowledgeRelativeUrl?: string | null;
255
+ authorizations?: {
256
+ id?: number;
257
+ name: string;
258
+ method: AuthorizationMethod;
259
+ oauth2?: AuthorizationOAuth2;
260
+ variables?: AuthorizationVariables;
261
+ archived?: boolean;
262
+ }[];
263
+ userIds?: number[];
264
+ archived?: boolean;
265
+ disabled?: boolean;
266
+ ui?: {
267
+ displayName?: string | null;
268
+ logo?: string | null;
269
+ };
270
+ visibility?: 'private' | 'public';
271
+ unitoOrganizationIds?: string[];
272
+ /** The encrypted secrets of the integration. */
273
+ secrets?: {
274
+ [key: string]: string;
275
+ };
276
+ }, opts?: Oazapfts.RequestOpts): Promise<Integration>;
277
+ /**
278
+ * Delete an integration
279
+ */
280
+ export declare function deleteIntegration(integrationId: number, name: string, opts?: Oazapfts.RequestOpts): Promise<unknown>;
281
+ /**
282
+ * Get the events associated with this integration.
283
+ */
284
+ export declare function getIntegrationEvents(integrationId: number, { search, $from, limit, }?: {
285
+ search?: string;
286
+ $from?: number;
287
+ limit?: number;
288
+ }, opts?: Oazapfts.RequestOpts): Promise<Pagination & {
289
+ /** The integration events. */
290
+ data: IntegrationEvent[];
291
+ }>;
292
+ /**
293
+ * Get the logo of the integration, in SVG format.
294
+ */
295
+ export declare function getIntegrationLogo(integrationName: string, opts?: Oazapfts.RequestOpts): Promise<Blob>;
296
+ /**
297
+ * Get all the credentials
298
+ */
299
+ export declare function getCredentials({ pagination, filters, }?: {
300
+ pagination?: {
301
+ /** Number of 'first results' to skip */
302
+ offset?: number;
303
+ /** Maximum number of results after the offset */
304
+ limit?: number;
305
+ };
306
+ filters?: {
307
+ /** The authorization id of the credential. */
308
+ authorizationId?: number;
309
+ /** The integration id of the credential. */
310
+ integrationId?: number;
311
+ /** List of credential ids. */
312
+ id?: number[];
313
+ /** The scope of the credential. */
314
+ credentialScope?: 'development' | 'compliance' | 'production' | 'service';
315
+ /** The id of the Unito User for which this credential belongs to. */
316
+ unitoUserId?: string;
317
+ /** The id of the credential account for which this credential belongs to. */
318
+ credentialAccountId?: string;
319
+ };
320
+ }, opts?: Oazapfts.RequestOpts): Promise<Pagination & {
321
+ /** The credentials. */
322
+ data: Credential[];
323
+ }>;
324
+ /**
325
+ * Create a credential
326
+ */
327
+ export declare function createCredential(body?: {
328
+ authorizationId: number;
329
+ scope?: 'development' | 'compliance' | 'production' | 'service';
330
+ payload: {
331
+ [key: string]: any;
332
+ };
333
+ unitoUserId?: string;
334
+ credentialAccountId?: string;
335
+ }, opts?: Oazapfts.RequestOpts): Promise<Credential>;
336
+ /**
337
+ * Get a credential
338
+ */
339
+ export declare function getCredentialById(credentialId: number, opts?: Oazapfts.RequestOpts): Promise<Credential>;
340
+ /**
341
+ * Update a credential
342
+ */
343
+ export declare function updateCredential(credentialId: number, body?: {
344
+ payload?: {
345
+ [key: string]: any;
346
+ };
347
+ scope?: 'development' | 'compliance' | 'production' | 'service';
348
+ archived?: boolean;
349
+ unitoUserId?: string;
350
+ credentialAccountId?: string;
351
+ }, opts?: Oazapfts.RequestOpts): Promise<Credential>;
352
+ /**
353
+ * Delete a credential
354
+ */
355
+ export declare function deleteCredential(credentialId: number, opts?: Oazapfts.RequestOpts): Promise<unknown>;
356
+ /**
357
+ * Returns the credentialAccount either from the integration's /me endpoint, if available, or the credential's latestCredentialAccount
358
+ */
359
+ export declare function getCredentialAccount(xUnitoCredentialId: string, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, }?: {
360
+ xUnitoCorrelationId?: string;
361
+ xUnitoAdditionalLoggingContext?: string;
362
+ }, opts?: Oazapfts.RequestOpts): Promise<CredentialAccount>;
363
+ /**
364
+ * Used by the frontend to send analytics data
365
+ */
366
+ export declare function postTrack(body: {
367
+ jwtToken: string;
368
+ event: 'AUTH_START' | 'AUTH_SUBMIT' | 'AUTH_ACTION' | 'AUTH_BLOCKED' | 'AUTH_CHOOSE_CONNECTION_START' | 'AUTH_CHOOSE_CONNECTION_SUBMIT';
369
+ payload?: {
370
+ [key: string]: any;
371
+ };
372
+ }, opts?: Oazapfts.RequestOpts): Promise<unknown>;
373
+ /**
374
+ * Encrypt data
375
+ */
376
+ export declare function encryptData(body: {
377
+ data: string;
378
+ integrationName: string;
379
+ sensitive?: boolean;
380
+ }, opts?: Oazapfts.RequestOpts): Promise<{
381
+ encryptedData: string;
382
+ }>;
383
+ /**
384
+ * Decrypt data
385
+ */
386
+ export declare function decryptData(body: {
387
+ data: string;
388
+ integrationName: string;
389
+ }, opts?: Oazapfts.RequestOpts): Promise<{
390
+ decryptedData: string;
391
+ }>;
392
+ /**
393
+ * Decrypt and encrypt data
394
+ */
395
+ export declare function reencryptData(body: {
396
+ encryptedData: string;
397
+ integrationName: string;
398
+ newIntegrationName: string;
399
+ }, opts?: Oazapfts.RequestOpts): Promise<{
400
+ encryptedData: string;
401
+ }>;
402
+ /**
403
+ * Get my profile
404
+ */
405
+ export declare function getProfile(opts?: Oazapfts.RequestOpts): Promise<User>;
406
+ /**
407
+ * Update my profile
408
+ */
409
+ export declare function updateProfile(body?: {
410
+ termsAccepted?: boolean;
411
+ }, opts?: Oazapfts.RequestOpts): Promise<User>;
412
+ /**
413
+ * Call an integration's me
414
+ */
415
+ export declare function getProxyMe(xUnitoCredentialId: string, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, }?: {
416
+ xUnitoCorrelationId?: string;
417
+ xUnitoAdditionalLoggingContext?: string;
418
+ }, opts?: Oazapfts.RequestOpts): Promise<CredentialAccount>;
419
+ /**
420
+ * Update a webhook subscription
421
+ */
422
+ export declare function updateWebhookSubscription(xUnitoCredentialId: string, body: {
423
+ itemPath: string;
424
+ targetUrl: string;
425
+ action: 'start' | 'stop';
426
+ }, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, }?: {
427
+ xUnitoCorrelationId?: string;
428
+ xUnitoAdditionalLoggingContext?: string;
429
+ }, opts?: Oazapfts.RequestOpts): Promise<unknown>;
430
+ /**
431
+ * Call an integration's graph
432
+ */
433
+ export declare function getProxyGraph(xUnitoCredentialId: string, path: string, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, }?: {
434
+ xUnitoCorrelationId?: string;
435
+ xUnitoAdditionalLoggingContext?: string;
436
+ }, opts?: Oazapfts.RequestOpts): Promise<any>;
437
+ /**
438
+ * Call an integration's graph
439
+ */
440
+ export declare function patchProxyGraph(xUnitoCredentialId: string, path: string, body?: object, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, }?: {
441
+ xUnitoCorrelationId?: string;
442
+ xUnitoAdditionalLoggingContext?: string;
443
+ }, opts?: Oazapfts.RequestOpts): Promise<any>;
444
+ /**
445
+ * Call an integration's graph
446
+ */
447
+ export declare function postProxyGraph(xUnitoCredentialId: string, path: string, body?: object, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, }?: {
448
+ xUnitoCorrelationId?: string;
449
+ xUnitoAdditionalLoggingContext?: string;
450
+ }, opts?: Oazapfts.RequestOpts): Promise<any>;
451
+ /**
452
+ * Call an integration's graph
453
+ */
454
+ export declare function deleteProxyGraph(xUnitoCredentialId: string, path: string, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, }?: {
455
+ xUnitoCorrelationId?: string;
456
+ xUnitoAdditionalLoggingContext?: string;
457
+ }, opts?: Oazapfts.RequestOpts): Promise<any>;
458
+ /**
459
+ * Get all the users
460
+ */
461
+ export declare function getUsers({ pagination, }?: {
462
+ pagination?: {
463
+ /** Number of 'first results' to skip */
464
+ offset?: number;
465
+ /** Maximum number of results after the offset */
466
+ limit?: number;
467
+ };
468
+ }, opts?: Oazapfts.RequestOpts): Promise<Pagination & {
469
+ /** The users. */
470
+ data: UserSummary[];
471
+ }>;
472
+ /**
473
+ * Create a user
474
+ */
475
+ export declare function createUser(body: {
476
+ email: string;
477
+ defaultUnitoOrganizationId?: string | null;
478
+ role: UserRole;
479
+ }, opts?: Oazapfts.RequestOpts): Promise<User>;
480
+ /**
481
+ * Get a user
482
+ */
483
+ export declare function getUserById(userId: number, opts?: Oazapfts.RequestOpts): Promise<User>;
484
+ /**
485
+ * Update a user
486
+ */
487
+ export declare function updateUser(userId: number, body: {
488
+ email?: string;
489
+ role?: UserRole;
490
+ archived?: boolean;
491
+ defaultUnitoOrganizationId?: string | null;
492
+ }, opts?: Oazapfts.RequestOpts): Promise<User>;
493
+ /**
494
+ * Regenerate the api key of a user
495
+ */
496
+ export declare function regenerateApiKey(userId: number, opts?: Oazapfts.RequestOpts): Promise<User>;
497
+ /**
498
+ * Get a user by its email address
499
+ */
500
+ export declare function getUserByEmail(email: string, opts?: Oazapfts.RequestOpts): Promise<User>;
501
+ import { HttpError } from '@oazapfts/runtime';
502
+ export { HttpError };
@@ -0,0 +1,435 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HttpError = 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.getCredentialAccount = exports.deleteCredential = exports.updateCredential = exports.getCredentialById = exports.createCredential = exports.getCredentials = exports.getIntegrationLogo = exports.getIntegrationEvents = exports.deleteIntegration = exports.updateIntegration = exports.getIntegrationById = exports.inviteOrganization = exports.inviteUser = exports.getIntegrationByName = exports.publishIntegration = exports.createIntegration = exports.getIntegrations = exports.servers = exports.defaults = void 0;
4
+ const tslib_1 = require("tslib");
5
+ /**
6
+ * Integrations Platform API
7
+ * 0.1.0
8
+ * DO NOT MODIFY - This file has been generated using oazapfts.
9
+ * See https://www.npmjs.com/package/oazapfts
10
+ */
11
+ const Oazapfts = tslib_1.__importStar(require("@oazapfts/runtime"));
12
+ const QS = tslib_1.__importStar(require("@oazapfts/runtime/query"));
13
+ exports.defaults = {
14
+ headers: {},
15
+ baseUrl: 'http://localhost:9000',
16
+ };
17
+ const oazapfts = Oazapfts.runtime(exports.defaults);
18
+ exports.servers = {
19
+ local: 'http://localhost:9000',
20
+ staging: 'https://staging-integrations-platform.unito.io',
21
+ production: 'https://integrations-platform.unito.io',
22
+ };
23
+ /**
24
+ * Get all the integrations
25
+ */
26
+ function getIntegrations({ pagination, unitoOrganizationId, search, } = {}, opts) {
27
+ return oazapfts.ok(oazapfts.fetchJson(`/integrations${QS.query(QS.explode({
28
+ pagination,
29
+ unitoOrganizationId,
30
+ search,
31
+ }))}`, {
32
+ ...opts,
33
+ }));
34
+ }
35
+ exports.getIntegrations = getIntegrations;
36
+ /**
37
+ * Create an integration
38
+ */
39
+ function createIntegration(body, opts) {
40
+ return oazapfts.ok(oazapfts.fetchJson('/integrations', oazapfts.json({
41
+ ...opts,
42
+ method: 'POST',
43
+ body,
44
+ })));
45
+ }
46
+ exports.createIntegration = createIntegration;
47
+ /**
48
+ * Publish an integration
49
+ */
50
+ function publishIntegration(body, opts) {
51
+ return oazapfts.ok(oazapfts.fetchJson('/integrations/publish', oazapfts.multipart({
52
+ ...opts,
53
+ method: 'POST',
54
+ body,
55
+ })));
56
+ }
57
+ exports.publishIntegration = publishIntegration;
58
+ /**
59
+ * Find an integration by exact name
60
+ */
61
+ function getIntegrationByName(integrationName, opts) {
62
+ return oazapfts.ok(oazapfts.fetchJson(`/integrations/find/${encodeURIComponent(integrationName)}`, {
63
+ ...opts,
64
+ }));
65
+ }
66
+ exports.getIntegrationByName = getIntegrationByName;
67
+ /**
68
+ * Invite a user to an integration
69
+ */
70
+ function inviteUser(integrationId, body, opts) {
71
+ return oazapfts.ok(oazapfts.fetchJson(`/integrations/${encodeURIComponent(integrationId)}/users/invite`, oazapfts.json({
72
+ ...opts,
73
+ method: 'POST',
74
+ body,
75
+ })));
76
+ }
77
+ exports.inviteUser = inviteUser;
78
+ /**
79
+ * Invite a unito organization to an integration
80
+ */
81
+ function inviteOrganization(integrationId, body, opts) {
82
+ return oazapfts.ok(oazapfts.fetchJson(`/integrations/${encodeURIComponent(integrationId)}/organizations/invite`, oazapfts.json({
83
+ ...opts,
84
+ method: 'POST',
85
+ body,
86
+ })));
87
+ }
88
+ exports.inviteOrganization = inviteOrganization;
89
+ /**
90
+ * Get an integration
91
+ */
92
+ function getIntegrationById(integrationId, opts) {
93
+ return oazapfts.ok(oazapfts.fetchJson(`/integrations/${encodeURIComponent(integrationId)}`, {
94
+ ...opts,
95
+ }));
96
+ }
97
+ exports.getIntegrationById = getIntegrationById;
98
+ /**
99
+ * Update an integration
100
+ */
101
+ function updateIntegration(integrationId, body, opts) {
102
+ return oazapfts.ok(oazapfts.fetchJson(`/integrations/${encodeURIComponent(integrationId)}`, oazapfts.json({
103
+ ...opts,
104
+ method: 'PATCH',
105
+ body,
106
+ })));
107
+ }
108
+ exports.updateIntegration = updateIntegration;
109
+ /**
110
+ * Delete an integration
111
+ */
112
+ function deleteIntegration(integrationId, name, opts) {
113
+ return oazapfts.ok(oazapfts.fetchJson(`/integrations/${encodeURIComponent(integrationId)}${QS.query(QS.explode({
114
+ name,
115
+ }))}`, {
116
+ ...opts,
117
+ method: 'DELETE',
118
+ }));
119
+ }
120
+ exports.deleteIntegration = deleteIntegration;
121
+ /**
122
+ * Get the events associated with this integration.
123
+ */
124
+ function getIntegrationEvents(integrationId, { search, $from, limit, } = {}, opts) {
125
+ return oazapfts.ok(oazapfts.fetchJson(`/integrations/${encodeURIComponent(integrationId)}/events${QS.query(QS.explode({
126
+ search,
127
+ from: $from,
128
+ limit,
129
+ }))}`, {
130
+ ...opts,
131
+ }));
132
+ }
133
+ exports.getIntegrationEvents = getIntegrationEvents;
134
+ /**
135
+ * Get the logo of the integration, in SVG format.
136
+ */
137
+ function getIntegrationLogo(integrationName, opts) {
138
+ return oazapfts.ok(oazapfts.fetchJson(`/public/${encodeURIComponent(integrationName)}/logo.svg`, {
139
+ ...opts,
140
+ }));
141
+ }
142
+ exports.getIntegrationLogo = getIntegrationLogo;
143
+ /**
144
+ * Get all the credentials
145
+ */
146
+ function getCredentials({ pagination, filters, } = {}, opts) {
147
+ return oazapfts.ok(oazapfts.fetchJson(`/credentials${QS.query(QS.explode({
148
+ pagination,
149
+ filters,
150
+ }))}`, {
151
+ ...opts,
152
+ }));
153
+ }
154
+ exports.getCredentials = getCredentials;
155
+ /**
156
+ * Create a credential
157
+ */
158
+ function createCredential(body, opts) {
159
+ return oazapfts.ok(oazapfts.fetchJson('/credentials', oazapfts.json({
160
+ ...opts,
161
+ method: 'POST',
162
+ body,
163
+ })));
164
+ }
165
+ exports.createCredential = createCredential;
166
+ /**
167
+ * Get a credential
168
+ */
169
+ function getCredentialById(credentialId, opts) {
170
+ return oazapfts.ok(oazapfts.fetchJson(`/credentials/${encodeURIComponent(credentialId)}`, {
171
+ ...opts,
172
+ }));
173
+ }
174
+ exports.getCredentialById = getCredentialById;
175
+ /**
176
+ * Update a credential
177
+ */
178
+ function updateCredential(credentialId, body, opts) {
179
+ return oazapfts.ok(oazapfts.fetchJson(`/credentials/${encodeURIComponent(credentialId)}`, oazapfts.json({
180
+ ...opts,
181
+ method: 'PATCH',
182
+ body,
183
+ })));
184
+ }
185
+ exports.updateCredential = updateCredential;
186
+ /**
187
+ * Delete a credential
188
+ */
189
+ function deleteCredential(credentialId, opts) {
190
+ return oazapfts.ok(oazapfts.fetchJson(`/credentials/${encodeURIComponent(credentialId)}`, {
191
+ ...opts,
192
+ method: 'DELETE',
193
+ }));
194
+ }
195
+ exports.deleteCredential = deleteCredential;
196
+ /**
197
+ * Returns the credentialAccount either from the integration's /me endpoint, if available, or the credential's latestCredentialAccount
198
+ */
199
+ function getCredentialAccount(xUnitoCredentialId, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
200
+ return oazapfts.ok(oazapfts.fetchJson('/credentialAccount', {
201
+ ...opts,
202
+ headers: oazapfts.mergeHeaders(opts?.headers, {
203
+ 'X-Unito-Credential-Id': xUnitoCredentialId,
204
+ 'X-Unito-Correlation-Id': xUnitoCorrelationId,
205
+ 'X-Unito-Additional-Logging-Context': xUnitoAdditionalLoggingContext,
206
+ }),
207
+ }));
208
+ }
209
+ exports.getCredentialAccount = getCredentialAccount;
210
+ /**
211
+ * Used by the frontend to send analytics data
212
+ */
213
+ function postTrack(body, opts) {
214
+ return oazapfts.ok(oazapfts.fetchJson('/track', oazapfts.json({
215
+ ...opts,
216
+ method: 'POST',
217
+ body,
218
+ })));
219
+ }
220
+ exports.postTrack = postTrack;
221
+ /**
222
+ * Encrypt data
223
+ */
224
+ function encryptData(body, opts) {
225
+ return oazapfts.ok(oazapfts.fetchJson('/encryptions/encrypt', oazapfts.json({
226
+ ...opts,
227
+ method: 'POST',
228
+ body,
229
+ })));
230
+ }
231
+ exports.encryptData = encryptData;
232
+ /**
233
+ * Decrypt data
234
+ */
235
+ function decryptData(body, opts) {
236
+ return oazapfts.ok(oazapfts.fetchJson('/encryptions/decrypt', oazapfts.json({
237
+ ...opts,
238
+ method: 'POST',
239
+ body,
240
+ })));
241
+ }
242
+ exports.decryptData = decryptData;
243
+ /**
244
+ * Decrypt and encrypt data
245
+ */
246
+ function reencryptData(body, opts) {
247
+ return oazapfts.ok(oazapfts.fetchJson('/encryptions/reencrypt', oazapfts.json({
248
+ ...opts,
249
+ method: 'POST',
250
+ body,
251
+ })));
252
+ }
253
+ exports.reencryptData = reencryptData;
254
+ /**
255
+ * Get my profile
256
+ */
257
+ function getProfile(opts) {
258
+ return oazapfts.ok(oazapfts.fetchJson('/profile', {
259
+ ...opts,
260
+ }));
261
+ }
262
+ exports.getProfile = getProfile;
263
+ /**
264
+ * Update my profile
265
+ */
266
+ function updateProfile(body, opts) {
267
+ return oazapfts.ok(oazapfts.fetchJson('/profile', oazapfts.json({
268
+ ...opts,
269
+ method: 'PATCH',
270
+ body,
271
+ })));
272
+ }
273
+ exports.updateProfile = updateProfile;
274
+ /**
275
+ * Call an integration's me
276
+ */
277
+ function getProxyMe(xUnitoCredentialId, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
278
+ return oazapfts.ok(oazapfts.fetchJson('/proxy/me', {
279
+ ...opts,
280
+ headers: oazapfts.mergeHeaders(opts?.headers, {
281
+ 'X-Unito-Credential-Id': xUnitoCredentialId,
282
+ 'X-Unito-Correlation-Id': xUnitoCorrelationId,
283
+ 'X-Unito-Additional-Logging-Context': xUnitoAdditionalLoggingContext,
284
+ }),
285
+ }));
286
+ }
287
+ exports.getProxyMe = getProxyMe;
288
+ /**
289
+ * Update a webhook subscription
290
+ */
291
+ function updateWebhookSubscription(xUnitoCredentialId, body, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
292
+ return oazapfts.ok(oazapfts.fetchJson('/proxy/webhooks/subscriptions', oazapfts.json({
293
+ ...opts,
294
+ method: 'PUT',
295
+ body,
296
+ headers: oazapfts.mergeHeaders(opts?.headers, {
297
+ 'X-Unito-Credential-Id': xUnitoCredentialId,
298
+ 'X-Unito-Correlation-Id': xUnitoCorrelationId,
299
+ 'X-Unito-Additional-Logging-Context': xUnitoAdditionalLoggingContext,
300
+ }),
301
+ })));
302
+ }
303
+ exports.updateWebhookSubscription = updateWebhookSubscription;
304
+ /**
305
+ * Call an integration's graph
306
+ */
307
+ function getProxyGraph(xUnitoCredentialId, path, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
308
+ return oazapfts.ok(oazapfts.fetchJson(`/proxy/graph${QS.query(QS.explode({
309
+ path,
310
+ }))}`, {
311
+ ...opts,
312
+ headers: oazapfts.mergeHeaders(opts?.headers, {
313
+ 'X-Unito-Credential-Id': xUnitoCredentialId,
314
+ 'X-Unito-Correlation-Id': xUnitoCorrelationId,
315
+ 'X-Unito-Additional-Logging-Context': xUnitoAdditionalLoggingContext,
316
+ }),
317
+ }));
318
+ }
319
+ exports.getProxyGraph = getProxyGraph;
320
+ /**
321
+ * Call an integration's graph
322
+ */
323
+ function patchProxyGraph(xUnitoCredentialId, path, body, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
324
+ return oazapfts.ok(oazapfts.fetchJson(`/proxy/graph${QS.query(QS.explode({
325
+ path,
326
+ }))}`, oazapfts.json({
327
+ ...opts,
328
+ method: 'PATCH',
329
+ body,
330
+ headers: oazapfts.mergeHeaders(opts?.headers, {
331
+ 'X-Unito-Credential-Id': xUnitoCredentialId,
332
+ 'X-Unito-Correlation-Id': xUnitoCorrelationId,
333
+ 'X-Unito-Additional-Logging-Context': xUnitoAdditionalLoggingContext,
334
+ }),
335
+ })));
336
+ }
337
+ exports.patchProxyGraph = patchProxyGraph;
338
+ /**
339
+ * Call an integration's graph
340
+ */
341
+ function postProxyGraph(xUnitoCredentialId, path, body, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
342
+ return oazapfts.ok(oazapfts.fetchJson(`/proxy/graph${QS.query(QS.explode({
343
+ path,
344
+ }))}`, oazapfts.json({
345
+ ...opts,
346
+ method: 'POST',
347
+ body,
348
+ headers: oazapfts.mergeHeaders(opts?.headers, {
349
+ 'X-Unito-Credential-Id': xUnitoCredentialId,
350
+ 'X-Unito-Correlation-Id': xUnitoCorrelationId,
351
+ 'X-Unito-Additional-Logging-Context': xUnitoAdditionalLoggingContext,
352
+ }),
353
+ })));
354
+ }
355
+ exports.postProxyGraph = postProxyGraph;
356
+ /**
357
+ * Call an integration's graph
358
+ */
359
+ function deleteProxyGraph(xUnitoCredentialId, path, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
360
+ return oazapfts.ok(oazapfts.fetchJson(`/proxy/graph${QS.query(QS.explode({
361
+ path,
362
+ }))}`, {
363
+ ...opts,
364
+ method: 'DELETE',
365
+ headers: oazapfts.mergeHeaders(opts?.headers, {
366
+ 'X-Unito-Credential-Id': xUnitoCredentialId,
367
+ 'X-Unito-Correlation-Id': xUnitoCorrelationId,
368
+ 'X-Unito-Additional-Logging-Context': xUnitoAdditionalLoggingContext,
369
+ }),
370
+ }));
371
+ }
372
+ exports.deleteProxyGraph = deleteProxyGraph;
373
+ /**
374
+ * Get all the users
375
+ */
376
+ function getUsers({ pagination, } = {}, opts) {
377
+ return oazapfts.ok(oazapfts.fetchJson(`/users${QS.query(QS.explode({
378
+ pagination,
379
+ }))}`, {
380
+ ...opts,
381
+ }));
382
+ }
383
+ exports.getUsers = getUsers;
384
+ /**
385
+ * Create a user
386
+ */
387
+ function createUser(body, opts) {
388
+ return oazapfts.ok(oazapfts.fetchJson('/users', oazapfts.json({
389
+ ...opts,
390
+ method: 'POST',
391
+ body,
392
+ })));
393
+ }
394
+ exports.createUser = createUser;
395
+ /**
396
+ * Get a user
397
+ */
398
+ function getUserById(userId, opts) {
399
+ return oazapfts.ok(oazapfts.fetchJson(`/users/${encodeURIComponent(userId)}`, {
400
+ ...opts,
401
+ }));
402
+ }
403
+ exports.getUserById = getUserById;
404
+ /**
405
+ * Update a user
406
+ */
407
+ function updateUser(userId, body, opts) {
408
+ return oazapfts.ok(oazapfts.fetchJson(`/users/${encodeURIComponent(userId)}`, oazapfts.json({
409
+ ...opts,
410
+ method: 'PATCH',
411
+ body,
412
+ })));
413
+ }
414
+ exports.updateUser = updateUser;
415
+ /**
416
+ * Regenerate the api key of a user
417
+ */
418
+ function regenerateApiKey(userId, opts) {
419
+ return oazapfts.ok(oazapfts.fetchJson(`/users/${encodeURIComponent(userId)}/apiKey`, {
420
+ ...opts,
421
+ method: 'POST',
422
+ }));
423
+ }
424
+ exports.regenerateApiKey = regenerateApiKey;
425
+ /**
426
+ * Get a user by its email address
427
+ */
428
+ function getUserByEmail(email, opts) {
429
+ return oazapfts.ok(oazapfts.fetchJson(`/users/find/${encodeURIComponent(email)}`, {
430
+ ...opts,
431
+ }));
432
+ }
433
+ exports.getUserByEmail = getUserByEmail;
434
+ const runtime_1 = require("@oazapfts/runtime");
435
+ Object.defineProperty(exports, "HttpError", { enumerable: true, get: function () { return runtime_1.HttpError; } });
@@ -21,6 +21,6 @@ export declare function generateIntegration(overrides?: Partial<IntegrationsPlat
21
21
  [key: string]: string;
22
22
  } | undefined;
23
23
  disabledAt?: string | null | undefined;
24
- authorizations: import("@unito/integrations-platform-client/dist/src/api").Authorization[];
24
+ authorizations: import("../../src/services/integrationsPlatformClient").Authorization[];
25
25
  userIds: number[];
26
26
  };
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const strict_1 = tslib_1.__importDefault(require("node:assert/strict"));
5
5
  const sinon = tslib_1.__importStar(require("sinon"));
6
- const integrations_platform_client_1 = tslib_1.__importDefault(require("@unito/integrations-platform-client"));
6
+ const IntegrationsPlatformClient = tslib_1.__importStar(require("../../src/services/integrationsPlatformClient"));
7
7
  const IntegrationsPlatform = tslib_1.__importStar(require("../../src/services/integrationsPlatform"));
8
8
  const globalConfiguration_1 = require("../../src/resources/globalConfiguration");
9
9
  const configurationTypes_1 = require("../../src/configurationTypes");
@@ -45,49 +45,49 @@ describe('integrations platform', function () {
45
45
  });
46
46
  it('environment', function () {
47
47
  IntegrationsPlatform.setEnvironment(globalConfiguration_1.Environment.Local);
48
- strict_1.default.equal(integrations_platform_client_1.default.defaults.baseUrl, integrations_platform_client_1.default.servers.local);
48
+ strict_1.default.equal(IntegrationsPlatformClient.defaults.baseUrl, IntegrationsPlatformClient.servers.local);
49
49
  IntegrationsPlatform.setEnvironment(globalConfiguration_1.Environment.Production);
50
- strict_1.default.equal(integrations_platform_client_1.default.defaults.baseUrl, integrations_platform_client_1.default.servers.production);
50
+ strict_1.default.equal(IntegrationsPlatformClient.defaults.baseUrl, IntegrationsPlatformClient.servers.production);
51
51
  });
52
52
  it('apiKey', function () {
53
53
  IntegrationsPlatform.setApiKey('foo');
54
54
  strict_1.default.equal(IntegrationsPlatform.getApiKey(), 'foo');
55
- strict_1.default.deepEqual(integrations_platform_client_1.default.defaults.headers, {
55
+ strict_1.default.deepEqual(IntegrationsPlatformClient.defaults.headers, {
56
56
  Authorization: 'Bearer foo',
57
57
  });
58
58
  IntegrationsPlatform.setApiKey(undefined);
59
59
  strict_1.default.equal(IntegrationsPlatform.getApiKey(), undefined);
60
- strict_1.default.deepEqual(integrations_platform_client_1.default.defaults.headers, {});
60
+ strict_1.default.deepEqual(IntegrationsPlatformClient.defaults.headers, {});
61
61
  });
62
62
  it('getProfile', async function () {
63
- sinon.stub(integrations_platform_client_1.default, 'getProfile').resolves(user);
63
+ sinon.stub(IntegrationsPlatformClient, 'getProfile').resolves(user);
64
64
  strict_1.default.deepEqual(await IntegrationsPlatform.getProfile(), user);
65
65
  });
66
66
  it('getIntegration', async function () {
67
- sinon.stub(integrations_platform_client_1.default, 'getIntegrationById').resolves(integration);
67
+ sinon.stub(IntegrationsPlatformClient, 'getIntegrationById').resolves(integration);
68
68
  strict_1.default.deepEqual(await IntegrationsPlatform.getIntegration(1), integration);
69
69
  });
70
70
  it('getIntegrationByName', async function () {
71
- sinon.stub(integrations_platform_client_1.default, 'getIntegrationByName').resolves(integration);
71
+ sinon.stub(IntegrationsPlatformClient, 'getIntegrationByName').resolves(integration);
72
72
  strict_1.default.deepEqual(await IntegrationsPlatform.getIntegrationByName('foo'), integration);
73
73
  });
74
74
  it('getIntegrations', async function () {
75
- sinon.stub(integrations_platform_client_1.default, 'getIntegrations').resolves({ total: 1, data: [integrationSummary] });
75
+ sinon.stub(IntegrationsPlatformClient, 'getIntegrations').resolves({ total: 1, data: [integrationSummary] });
76
76
  strict_1.default.deepEqual(await IntegrationsPlatform.getIntegrations(), [integrationSummary]);
77
77
  });
78
78
  it('createIntegration', async function () {
79
- sinon.stub(integrations_platform_client_1.default, 'createIntegration').resolves(integration);
80
- sinon.stub(integrations_platform_client_1.default, 'getIntegrationById').resolves(integration);
81
- sinon.stub(integrations_platform_client_1.default, 'updateIntegration').resolves(integration);
79
+ sinon.stub(IntegrationsPlatformClient, 'createIntegration').resolves(integration);
80
+ sinon.stub(IntegrationsPlatformClient, 'getIntegrationById').resolves(integration);
81
+ sinon.stub(IntegrationsPlatformClient, 'updateIntegration').resolves(integration);
82
82
  strict_1.default.deepEqual(await IntegrationsPlatform.createIntegration({ name: 'foo' }), integration);
83
83
  });
84
84
  it('updateIntegration', async function () {
85
- sinon.stub(integrations_platform_client_1.default, 'getIntegrationById').resolves(integration);
86
- sinon.stub(integrations_platform_client_1.default, 'updateIntegration').resolves(integration);
85
+ sinon.stub(IntegrationsPlatformClient, 'getIntegrationById').resolves(integration);
86
+ sinon.stub(IntegrationsPlatformClient, 'updateIntegration').resolves(integration);
87
87
  strict_1.default.deepEqual(await IntegrationsPlatform.updateIntegration(1, { name: 'foo' }), integration);
88
88
  });
89
89
  it('updateIntegration - create / archive authorization', async function () {
90
- sinon.stub(integrations_platform_client_1.default, 'getIntegrationById').resolves({
90
+ sinon.stub(IntegrationsPlatformClient, 'getIntegrationById').resolves({
91
91
  ...integration,
92
92
  authorizations: [
93
93
  {
@@ -103,14 +103,14 @@ describe('integrations platform', function () {
103
103
  },
104
104
  ],
105
105
  });
106
- sinon.stub(integrations_platform_client_1.default, 'updateIntegration').resolves(integration);
106
+ sinon.stub(IntegrationsPlatformClient, 'updateIntegration').resolves(integration);
107
107
  strict_1.default.deepEqual(await IntegrationsPlatform.updateIntegration(1, {
108
108
  name: 'foo',
109
109
  authorizations: [{ name: 'bar', method: configurationTypes_1.Method.CUSTOM }],
110
110
  }), integration);
111
111
  });
112
112
  it('updateIntegration - update authorization', async function () {
113
- sinon.stub(integrations_platform_client_1.default, 'getIntegrationById').resolves({
113
+ sinon.stub(IntegrationsPlatformClient, 'getIntegrationById').resolves({
114
114
  ...integration,
115
115
  authorizations: [
116
116
  {
@@ -126,7 +126,7 @@ describe('integrations platform', function () {
126
126
  },
127
127
  ],
128
128
  });
129
- sinon.stub(integrations_platform_client_1.default, 'updateIntegration').resolves(integration);
129
+ sinon.stub(IntegrationsPlatformClient, 'updateIntegration').resolves(integration);
130
130
  strict_1.default.deepEqual(await IntegrationsPlatform.updateIntegration(1, { name: 'foo' }), integration);
131
131
  strict_1.default.deepEqual(await IntegrationsPlatform.updateIntegration(1, {
132
132
  name: 'foo',
@@ -134,8 +134,8 @@ describe('integrations platform', function () {
134
134
  }), integration);
135
135
  });
136
136
  it('updateIntegration - update secrets', async function () {
137
- sinon.stub(integrations_platform_client_1.default, 'getIntegrationById').resolves({ ...integration });
138
- const mockUpdateIntegration = sinon.stub(integrations_platform_client_1.default, 'updateIntegration');
137
+ sinon.stub(IntegrationsPlatformClient, 'getIntegrationById').resolves({ ...integration });
138
+ const mockUpdateIntegration = sinon.stub(IntegrationsPlatformClient, 'updateIntegration');
139
139
  const integrationId = 1;
140
140
  const configuration = {
141
141
  name: 'foo',
@@ -158,8 +158,8 @@ describe('integrations platform', function () {
158
158
  });
159
159
  });
160
160
  it('updateIntegration - unarchive', async function () {
161
- sinon.stub(integrations_platform_client_1.default, 'getIntegrationById').resolves({ ...integration });
162
- const mockUpdateIntegration = sinon.stub(integrations_platform_client_1.default, 'updateIntegration');
161
+ sinon.stub(IntegrationsPlatformClient, 'getIntegrationById').resolves({ ...integration });
162
+ const mockUpdateIntegration = sinon.stub(IntegrationsPlatformClient, 'updateIntegration');
163
163
  const integrationId = 1;
164
164
  const archived = false;
165
165
  const configuration = {
@@ -183,7 +183,7 @@ describe('integrations platform', function () {
183
183
  });
184
184
  });
185
185
  it('encryptData', async function () {
186
- sinon.stub(integrations_platform_client_1.default, 'encryptData').resolves({ encryptedData: 'encryptedFoo' });
186
+ sinon.stub(IntegrationsPlatformClient, 'encryptData').resolves({ encryptedData: 'encryptedFoo' });
187
187
  strict_1.default.deepEqual(await IntegrationsPlatform.encryptData('mySuperIntegration', 'foo', false), {
188
188
  encryptedData: 'encryptedFoo',
189
189
  });
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.60.1",
2
+ "version": "0.60.2",
3
3
  "commands": {
4
4
  "activity": {
5
5
  "id": "activity",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unito/integration-cli",
3
- "version": "0.60.1",
3
+ "version": "0.60.2",
4
4
  "description": "Integration CLI",
5
5
  "bin": {
6
6
  "integration-cli": "./bin/run"
@@ -36,8 +36,8 @@
36
36
  ],
37
37
  "dependencies": {
38
38
  "@oclif/core": "3.x",
39
- "@unito/integration-debugger": "0.25.1",
40
- "@unito/integrations-platform-client": "0.48.2",
39
+ "@unito/integration-debugger": "0.26.0",
40
+ "@oazapfts/runtime": "1.x",
41
41
  "ajv": "8.x",
42
42
  "ajv-formats": "2.x",
43
43
  "better-ajv-errors": "1.x",