@unito/integration-cli 0.60.1 → 0.60.3
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/.eslintrc.d.ts +1 -0
- package/dist/.eslintrc.js +1 -0
- package/dist/boilerplate/.nvmrc +1 -1
- package/dist/boilerplate/Dockerfile +2 -2
- package/dist/boilerplate/package.json +2 -2
- package/dist/src/services/integrationsPlatform.d.ts +1 -1
- package/dist/src/services/integrationsPlatform.js +24 -24
- package/dist/src/services/integrationsPlatformClient.d.ts +502 -0
- package/dist/src/services/integrationsPlatformClient.js +435 -0
- package/dist/src/services/oauth2.js +22 -23
- package/dist/test/helpers/integrations.d.ts +1 -1
- package/dist/test/services/integrationsPlatform.test.js +23 -23
- package/dist/test/services/oauth2.test.js +21 -12
- package/oclif.manifest.json +11 -1
- package/package.json +3 -3
package/dist/.eslintrc.d.ts
CHANGED
package/dist/.eslintrc.js
CHANGED
package/dist/boilerplate/.nvmrc
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
20.9
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
# Build
|
|
5
5
|
#
|
|
6
6
|
|
|
7
|
-
FROM --platform=$BUILDPLATFORM public.ecr.aws/docker/library/node:20-alpine as build
|
|
7
|
+
FROM --platform=$BUILDPLATFORM public.ecr.aws/docker/library/node:20.9-alpine as build
|
|
8
8
|
|
|
9
9
|
WORKDIR /build
|
|
10
10
|
|
|
@@ -19,7 +19,7 @@ RUN npm run compile
|
|
|
19
19
|
# Runtime
|
|
20
20
|
#
|
|
21
21
|
|
|
22
|
-
FROM --platform=$TARGETPLATFORM public.ecr.aws/docker/library/node:20-alpine as runtime
|
|
22
|
+
FROM --platform=$TARGETPLATFORM public.ecr.aws/docker/library/node:20.9-alpine as runtime
|
|
23
23
|
|
|
24
24
|
WORKDIR /app
|
|
25
25
|
|
|
@@ -20,13 +20,13 @@
|
|
|
20
20
|
"email": "hello@unito.io"
|
|
21
21
|
},
|
|
22
22
|
"engines": {
|
|
23
|
-
"node": "
|
|
23
|
+
"node": "20.9"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@unito/integration-sdk": "^0.x"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@types/node": "20.x",
|
|
29
|
+
"@types/node": "20.9.x",
|
|
30
30
|
"typescript-eslint": "7.x",
|
|
31
31
|
"eslint": "8.x",
|
|
32
32
|
"npm-audit-resolver": "^3.0.0-RC.0",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import IntegrationsPlatform from '
|
|
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
|
|
6
|
+
const IntegrationsPlatform = tslib_1.__importStar(require("./integrationsPlatformClient"));
|
|
7
7
|
const globalConfiguration_1 = require("../resources/globalConfiguration");
|
|
8
|
-
const { HttpError } =
|
|
8
|
+
const { HttpError } = IntegrationsPlatform;
|
|
9
9
|
exports.HttpError = HttpError;
|
|
10
10
|
exports.Servers = {
|
|
11
|
-
[globalConfiguration_1.Environment.Local]:
|
|
12
|
-
[globalConfiguration_1.Environment.Staging]:
|
|
13
|
-
[globalConfiguration_1.Environment.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
|
-
|
|
17
|
-
|
|
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 =
|
|
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
|
-
|
|
27
|
+
IntegrationsPlatform.defaults.headers = { Authorization: `Bearer ${apiKey}` };
|
|
28
28
|
}
|
|
29
29
|
else {
|
|
30
|
-
|
|
30
|
+
IntegrationsPlatform.defaults.headers = {};
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
exports.setApiKey = setApiKey;
|
|
34
34
|
async function getProfile() {
|
|
35
|
-
return
|
|
35
|
+
return IntegrationsPlatform.getProfile();
|
|
36
36
|
}
|
|
37
37
|
exports.getProfile = getProfile;
|
|
38
38
|
async function encryptData(integrationName, data, sensitive) {
|
|
39
|
-
return
|
|
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
|
|
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
|
|
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
|
|
62
|
+
return IntegrationsPlatform.getIntegrationById(integrationId);
|
|
63
63
|
}
|
|
64
64
|
exports.getIntegration = getIntegration;
|
|
65
65
|
async function getIntegrationByName(integrationName) {
|
|
66
|
-
return
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
159
|
+
return IntegrationsPlatform.getCredentialById(credentialId);
|
|
160
160
|
}
|
|
161
161
|
exports.getCredential = getCredential;
|