@unito/integration-cli 0.60.10 → 0.60.12
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/boilerplate/Dockerfile +1 -1
- package/dist/src/commands/oauth2.js +14 -3
- package/dist/src/errors.js +2 -2
- package/dist/src/index.js +0 -1
- package/dist/src/resources/configuration.js +5 -5
- package/dist/src/resources/credentials.js +1 -2
- package/dist/src/resources/decryption.js +1 -2
- package/dist/src/resources/fileSystem.d.ts +0 -1
- package/dist/src/resources/fileSystem.js +1 -2
- package/dist/src/resources/globalConfiguration.js +4 -4
- package/dist/src/resources/integrations.js +3 -4
- package/dist/src/resources/integrationsPlatform.js +1 -2
- package/dist/src/resources/oauth2.js +2 -3
- package/dist/src/resources/template.js +1 -2
- package/dist/src/services/integrationsPlatform.js +17 -17
- package/dist/src/services/integrationsPlatformClient.js +36 -36
- package/dist/test/helpers/integrations.d.ts +4 -4
- package/dist/test/helpers/integrations.js +1 -2
- package/dist/test/helpers/styles.js +1 -2
- package/oclif.manifest.json +1 -1
- package/package.json +2 -2
|
@@ -76,6 +76,7 @@ class Oauth2 extends core_1.Command {
|
|
|
76
76
|
oauth2 = decryptedEntries.successful;
|
|
77
77
|
const testAccount = flags['test-account'];
|
|
78
78
|
const testAccountCredentials = configuration.testAccounts?.[testAccount];
|
|
79
|
+
const testAccountsToRefresh = new Set([testAccount]);
|
|
79
80
|
let credentials;
|
|
80
81
|
if (!testAccountCredentials?.accessToken || flags.reauth) {
|
|
81
82
|
core_1.ux.log(`Starting Oauth2 flow for test account: ${testAccount}`);
|
|
@@ -87,6 +88,14 @@ class Oauth2 extends core_1.Command {
|
|
|
87
88
|
core_1.ux.log(chalk_1.default.redBright('No refresh token found, nothing to do.'));
|
|
88
89
|
return;
|
|
89
90
|
}
|
|
91
|
+
// Figure out if we want to refresh other test account at the same time (like if they currently have the same values)
|
|
92
|
+
for (const [account, accountCredentials] of Object.entries(configuration.testAccounts ?? {})) {
|
|
93
|
+
if (!testAccountsToRefresh.has(account) &&
|
|
94
|
+
accountCredentials?.accessToken === testAccountCredentials.accessToken &&
|
|
95
|
+
accountCredentials?.refreshToken === testAccountCredentials.refreshToken) {
|
|
96
|
+
testAccountsToRefresh.add(account);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
90
99
|
const decryptionResult = await (0, decryption_1.decryptEntries)(configuration.name, environment, this.config.configDir, testAccountCredentials);
|
|
91
100
|
const refreshToken = decryptionResult.successful.refreshToken;
|
|
92
101
|
core_1.ux.action.start(`Refreshing test account ${testAccount}`, undefined, { stdout: true });
|
|
@@ -103,9 +112,11 @@ class Oauth2 extends core_1.Command {
|
|
|
103
112
|
}
|
|
104
113
|
core_1.ux.action.stop();
|
|
105
114
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
115
|
+
for (const account of testAccountsToRefresh) {
|
|
116
|
+
core_1.ux.action.start(`Saving credentials for account: ${account}`, undefined, { stdout: true });
|
|
117
|
+
await (0, configuration_1.writeTestAccount)(configuration, environment, customConfigPath, credentials, account);
|
|
118
|
+
core_1.ux.action.stop();
|
|
119
|
+
}
|
|
109
120
|
return;
|
|
110
121
|
}
|
|
111
122
|
}
|
package/dist/src/errors.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ConfigurationInvalid = exports.EntryDecryptionError = exports.IntegrationAlreadyExistsError = exports.CredentialAccessDenied = exports.CredentialAuthenticationError = exports.UnsupportedContentTypeError = exports.DecryptionAuthenticationError = exports.AuthenticationFailed = exports.MissingApiKey = exports.FileSizeExceeded = exports.MissingAuth2AuthorizationError = exports.InvalidRequestContentTypeError = exports.FailedToRetrieveAccessTokenError = exports.NoRefreshTokenError = exports.ConfigurationMalformed = exports.NoConfigurationFileError = exports.NoIntegrationFoundError = void 0;
|
|
4
|
+
exports.handleError = handleError;
|
|
4
5
|
const tslib_1 = require("tslib");
|
|
5
6
|
const core_1 = require("@oclif/core");
|
|
6
7
|
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
@@ -166,4 +167,3 @@ function handleError(command, error) {
|
|
|
166
167
|
}
|
|
167
168
|
return !unhandled;
|
|
168
169
|
}
|
|
169
|
-
exports.handleError = handleError;
|
package/dist/src/index.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ENCRYPTION_PREFIX = exports.DEFAULT_CONFIGURATION_NAME = exports.CredentialScope = exports.CrawlMode = void 0;
|
|
4
|
+
exports.getConfigurationPath = getConfigurationPath;
|
|
5
|
+
exports.getConfiguration = getConfiguration;
|
|
6
|
+
exports.writeConfiguration = writeConfiguration;
|
|
7
|
+
exports.writeTestAccount = writeTestAccount;
|
|
4
8
|
const tslib_1 = require("tslib");
|
|
5
9
|
const fs = tslib_1.__importStar(require("fs"));
|
|
6
10
|
const ajv_1 = tslib_1.__importDefault(require("ajv"));
|
|
@@ -39,7 +43,6 @@ function getConfigurationPath(environment = globalConfiguration_1.Environment.Pr
|
|
|
39
43
|
return `${process.cwd()}/${exports.DEFAULT_CONFIGURATION_NAME}`;
|
|
40
44
|
}
|
|
41
45
|
}
|
|
42
|
-
exports.getConfigurationPath = getConfigurationPath;
|
|
43
46
|
async function getConfiguration(environment, customConfigPath) {
|
|
44
47
|
(0, integrations_1.validateIsIntegrationDirectory)();
|
|
45
48
|
let configuration;
|
|
@@ -82,7 +85,6 @@ async function getConfiguration(environment, customConfigPath) {
|
|
|
82
85
|
await validateConfiguration(configuration);
|
|
83
86
|
return configuration;
|
|
84
87
|
}
|
|
85
|
-
exports.getConfiguration = getConfiguration;
|
|
86
88
|
/**
|
|
87
89
|
* Write the configuration to the default configuration file.
|
|
88
90
|
*/
|
|
@@ -94,7 +96,6 @@ async function writeConfiguration(configuration, environment = globalConfigurati
|
|
|
94
96
|
: getConfigurationPath(environment);
|
|
95
97
|
await fs.promises.writeFile(configurationPath, JSON.stringify(configuration, null, 2));
|
|
96
98
|
}
|
|
97
|
-
exports.writeConfiguration = writeConfiguration;
|
|
98
99
|
async function writeTestAccount(configuration, environment = globalConfiguration_1.Environment.Production, customConfigPath, account, accountName) {
|
|
99
100
|
// istanbul ignore next
|
|
100
101
|
if (accountName !== 'development' && accountName !== 'compliance') {
|
|
@@ -104,7 +105,6 @@ async function writeTestAccount(configuration, environment = globalConfiguration
|
|
|
104
105
|
configuration.testAccounts[accountName] = { ...configuration.testAccounts[accountName], ...account };
|
|
105
106
|
await writeConfiguration(configuration, environment, customConfigPath);
|
|
106
107
|
}
|
|
107
|
-
exports.writeTestAccount = writeTestAccount;
|
|
108
108
|
async function validateConfiguration(configuration) {
|
|
109
109
|
const directory = `${__dirname}/../../schemas`;
|
|
110
110
|
const files = await fs.promises.readdir(directory);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fetchCredential =
|
|
3
|
+
exports.fetchCredential = fetchCredential;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const errors_1 = require("../errors");
|
|
6
6
|
const GlobalConfiguration = tslib_1.__importStar(require("./globalConfiguration"));
|
|
@@ -23,4 +23,3 @@ async function fetchCredential(environment, configDir, credentialId) {
|
|
|
23
23
|
}
|
|
24
24
|
return credential;
|
|
25
25
|
}
|
|
26
|
-
exports.fetchCredential = fetchCredential;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.decryptEntries =
|
|
3
|
+
exports.decryptEntries = decryptEntries;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const errors_1 = require("../errors");
|
|
6
6
|
const GlobalConfiguration = tslib_1.__importStar(require("./globalConfiguration"));
|
|
@@ -40,4 +40,3 @@ async function decryptEntries(configurationName, environment, configDir, entries
|
|
|
40
40
|
}
|
|
41
41
|
return { successful: { ...toKeepAsIs, ...decrypted }, failed };
|
|
42
42
|
}
|
|
43
|
-
exports.decryptEntries = decryptEntries;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getFileBuffer =
|
|
3
|
+
exports.getFileBuffer = getFileBuffer;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const promises_1 = tslib_1.__importDefault(require("fs/promises"));
|
|
6
6
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
@@ -19,4 +19,3 @@ async function getFileBuffer(fileName, maxFileSize) {
|
|
|
19
19
|
}
|
|
20
20
|
return promises_1.default.readFile(filePath);
|
|
21
21
|
}
|
|
22
|
-
exports.getFileBuffer = getFileBuffer;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.Environment = void 0;
|
|
4
|
+
exports.getDefault = getDefault;
|
|
5
|
+
exports.read = read;
|
|
6
|
+
exports.write = write;
|
|
4
7
|
const tslib_1 = require("tslib");
|
|
5
8
|
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
6
9
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
@@ -17,7 +20,6 @@ function getDefault() {
|
|
|
17
20
|
apiKeyLocal: undefined,
|
|
18
21
|
};
|
|
19
22
|
}
|
|
20
|
-
exports.getDefault = getDefault;
|
|
21
23
|
async function read(baseDir) {
|
|
22
24
|
await fs_1.default.promises.mkdir(path_1.default.dirname(getConfigurationPath(baseDir)), { recursive: true });
|
|
23
25
|
let configuration;
|
|
@@ -30,7 +32,6 @@ async function read(baseDir) {
|
|
|
30
32
|
}
|
|
31
33
|
return { ...getDefault(), ...configuration };
|
|
32
34
|
}
|
|
33
|
-
exports.read = read;
|
|
34
35
|
async function write(baseDir, configuration) {
|
|
35
36
|
await fs_1.default.promises.mkdir(path_1.default.dirname(getConfigurationPath(baseDir)), { recursive: true });
|
|
36
37
|
await fs_1.default.promises.writeFile(getConfigurationPath(baseDir), JSON.stringify(configuration, null, 2), {
|
|
@@ -38,7 +39,6 @@ async function write(baseDir, configuration) {
|
|
|
38
39
|
flag: 'w',
|
|
39
40
|
});
|
|
40
41
|
}
|
|
41
|
-
exports.write = write;
|
|
42
42
|
function getConfigurationPath(baseDir) {
|
|
43
43
|
return `${baseDir}/configuration.json`;
|
|
44
44
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.validateIsIntegrationDirectory = validateIsIntegrationDirectory;
|
|
4
|
+
exports.isIntegrationDirectory = isIntegrationDirectory;
|
|
5
|
+
exports.copyBoilerplate = copyBoilerplate;
|
|
4
6
|
const tslib_1 = require("tslib");
|
|
5
7
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
6
8
|
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
@@ -12,11 +14,9 @@ function validateIsIntegrationDirectory() {
|
|
|
12
14
|
throw new errors_2.NoIntegrationFoundError();
|
|
13
15
|
}
|
|
14
16
|
}
|
|
15
|
-
exports.validateIsIntegrationDirectory = validateIsIntegrationDirectory;
|
|
16
17
|
function isIntegrationDirectory() {
|
|
17
18
|
return fs_1.default.existsSync((0, configuration_1.getConfigurationPath)());
|
|
18
19
|
}
|
|
19
|
-
exports.isIntegrationDirectory = isIntegrationDirectory;
|
|
20
20
|
async function copyBoilerplate(integrationName, destinationPath) {
|
|
21
21
|
const sourcePath = path_1.default.join(__dirname, `../../boilerplate`);
|
|
22
22
|
const targetPath = `${destinationPath}/${integrationName.toLowerCase().replace(/ /g, '_')}`;
|
|
@@ -31,7 +31,6 @@ async function copyBoilerplate(integrationName, destinationPath) {
|
|
|
31
31
|
await fs_1.default.promises.writeFile(path_1.default.join(targetPath, '.npmrc'), npmrcContent);
|
|
32
32
|
return targetPath;
|
|
33
33
|
}
|
|
34
|
-
exports.copyBoilerplate = copyBoilerplate;
|
|
35
34
|
async function copyFilesAndFolders(source, destination, excludedFolders) {
|
|
36
35
|
const files = await fs_1.default.promises.readdir(source);
|
|
37
36
|
for (const file of files) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateAuthenticated =
|
|
3
|
+
exports.validateAuthenticated = validateAuthenticated;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const IntegrationsPlatformClient = tslib_1.__importStar(require("../services/integrationsPlatform"));
|
|
6
6
|
const errors_1 = require("../errors");
|
|
@@ -30,4 +30,3 @@ async function validateAuthenticated(globalConfiguration, environment) {
|
|
|
30
30
|
throw new errors_1.AuthenticationFailed();
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
exports.validateAuthenticated = validateAuthenticated;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.performOAuth2Flow = performOAuth2Flow;
|
|
4
|
+
exports.updateToken = updateToken;
|
|
4
5
|
const tslib_1 = require("tslib");
|
|
5
6
|
const oauth2_1 = tslib_1.__importDefault(require("../services/oauth2"));
|
|
6
7
|
const errors_1 = require("../errors");
|
|
@@ -21,9 +22,7 @@ async function performOAuth2Flow(applicationCredentials, environment = globalCon
|
|
|
21
22
|
}
|
|
22
23
|
return oauth2Response;
|
|
23
24
|
}
|
|
24
|
-
exports.performOAuth2Flow = performOAuth2Flow;
|
|
25
25
|
async function updateToken(applicationCredentials, refreshToken) {
|
|
26
26
|
const oauthHelper = new oauth2_1.default(applicationCredentials);
|
|
27
27
|
return oauthHelper.updateToken(refreshToken);
|
|
28
28
|
}
|
|
29
|
-
exports.updateToken = updateToken;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.expandTemplate =
|
|
3
|
+
exports.expandTemplate = expandTemplate;
|
|
4
4
|
function encode(value) {
|
|
5
5
|
return value
|
|
6
6
|
? value
|
|
@@ -30,4 +30,3 @@ function expandTemplate(template, context, options) {
|
|
|
30
30
|
});
|
|
31
31
|
return interpolated;
|
|
32
32
|
}
|
|
33
|
-
exports.expandTemplate = expandTemplate;
|
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.Servers = exports.HttpError = void 0;
|
|
4
|
+
exports.setEnvironment = setEnvironment;
|
|
5
|
+
exports.getApiKey = getApiKey;
|
|
6
|
+
exports.setApiKey = setApiKey;
|
|
7
|
+
exports.getProfile = getProfile;
|
|
8
|
+
exports.encryptData = encryptData;
|
|
9
|
+
exports.decryptData = decryptData;
|
|
10
|
+
exports.reencryptData = reencryptData;
|
|
11
|
+
exports.getIntegration = getIntegration;
|
|
12
|
+
exports.getIntegrationByName = getIntegrationByName;
|
|
13
|
+
exports.getIntegrations = getIntegrations;
|
|
14
|
+
exports.publishIntegration = publishIntegration;
|
|
15
|
+
exports.createIntegration = createIntegration;
|
|
16
|
+
exports.inviteUserToIntegration = inviteUserToIntegration;
|
|
17
|
+
exports.getIntegrationEvents = getIntegrationEvents;
|
|
18
|
+
exports.updateIntegration = updateIntegration;
|
|
19
|
+
exports.getCredential = getCredential;
|
|
4
20
|
const tslib_1 = require("tslib");
|
|
5
21
|
const fs = tslib_1.__importStar(require("fs"));
|
|
6
22
|
const IntegrationsPlatform = tslib_1.__importStar(require("./integrationsPlatformClient"));
|
|
@@ -16,12 +32,10 @@ function setEnvironment(environment) {
|
|
|
16
32
|
IntegrationsPlatform.defaults.fetch = fetch;
|
|
17
33
|
IntegrationsPlatform.defaults.baseUrl = exports.Servers[environment];
|
|
18
34
|
}
|
|
19
|
-
exports.setEnvironment = setEnvironment;
|
|
20
35
|
function getApiKey() {
|
|
21
36
|
const header = IntegrationsPlatform.defaults.headers?.Authorization?.toString();
|
|
22
37
|
return header?.split(' ')?.at(1);
|
|
23
38
|
}
|
|
24
|
-
exports.getApiKey = getApiKey;
|
|
25
39
|
function setApiKey(apiKey) {
|
|
26
40
|
if (apiKey) {
|
|
27
41
|
IntegrationsPlatform.defaults.headers = { Authorization: `Bearer ${apiKey}` };
|
|
@@ -30,11 +44,9 @@ function setApiKey(apiKey) {
|
|
|
30
44
|
IntegrationsPlatform.defaults.headers = {};
|
|
31
45
|
}
|
|
32
46
|
}
|
|
33
|
-
exports.setApiKey = setApiKey;
|
|
34
47
|
async function getProfile() {
|
|
35
48
|
return IntegrationsPlatform.getProfile();
|
|
36
49
|
}
|
|
37
|
-
exports.getProfile = getProfile;
|
|
38
50
|
async function encryptData(integrationName, data, sensitive) {
|
|
39
51
|
return IntegrationsPlatform.encryptData({
|
|
40
52
|
integrationName,
|
|
@@ -42,14 +54,12 @@ async function encryptData(integrationName, data, sensitive) {
|
|
|
42
54
|
sensitive,
|
|
43
55
|
});
|
|
44
56
|
}
|
|
45
|
-
exports.encryptData = encryptData;
|
|
46
57
|
async function decryptData(integrationName, data) {
|
|
47
58
|
return IntegrationsPlatform.decryptData({
|
|
48
59
|
integrationName,
|
|
49
60
|
data,
|
|
50
61
|
});
|
|
51
62
|
}
|
|
52
|
-
exports.decryptData = decryptData;
|
|
53
63
|
async function reencryptData(integrationName, encryptedData, newIntegrationName) {
|
|
54
64
|
return IntegrationsPlatform.reencryptData({
|
|
55
65
|
integrationName,
|
|
@@ -57,15 +67,12 @@ async function reencryptData(integrationName, encryptedData, newIntegrationName)
|
|
|
57
67
|
newIntegrationName,
|
|
58
68
|
});
|
|
59
69
|
}
|
|
60
|
-
exports.reencryptData = reencryptData;
|
|
61
70
|
async function getIntegration(integrationId) {
|
|
62
71
|
return IntegrationsPlatform.getIntegrationById(integrationId);
|
|
63
72
|
}
|
|
64
|
-
exports.getIntegration = getIntegration;
|
|
65
73
|
async function getIntegrationByName(integrationName) {
|
|
66
74
|
return IntegrationsPlatform.getIntegrationByName(integrationName);
|
|
67
75
|
}
|
|
68
|
-
exports.getIntegrationByName = getIntegrationByName;
|
|
69
76
|
async function getIntegrations() {
|
|
70
77
|
const integrations = [];
|
|
71
78
|
let page;
|
|
@@ -80,29 +87,24 @@ async function getIntegrations() {
|
|
|
80
87
|
} while (page.data.length >= limit);
|
|
81
88
|
return integrations;
|
|
82
89
|
}
|
|
83
|
-
exports.getIntegrations = getIntegrations;
|
|
84
90
|
async function publishIntegration(archivePath) {
|
|
85
91
|
const file = fs.readFileSync(archivePath);
|
|
86
92
|
const blob = new Blob([file], { type: 'binary' });
|
|
87
93
|
return await IntegrationsPlatform.publishIntegration({ file: blob });
|
|
88
94
|
}
|
|
89
|
-
exports.publishIntegration = publishIntegration;
|
|
90
95
|
async function createIntegration(configuration) {
|
|
91
96
|
// The creation of an integration is kept to its minimal required fields...
|
|
92
97
|
const integration = await IntegrationsPlatform.createIntegration({ name: configuration.name });
|
|
93
98
|
// ... as all other non-required fields are updated here.
|
|
94
99
|
return updateIntegration(integration.id, configuration);
|
|
95
100
|
}
|
|
96
|
-
exports.createIntegration = createIntegration;
|
|
97
101
|
async function inviteUserToIntegration(integrationId, email) {
|
|
98
102
|
await IntegrationsPlatform.inviteUser(integrationId, { email });
|
|
99
103
|
}
|
|
100
|
-
exports.inviteUserToIntegration = inviteUserToIntegration;
|
|
101
104
|
async function getIntegrationEvents(integrationId, options = {}) {
|
|
102
105
|
const { data: events } = await IntegrationsPlatform.getIntegrationEvents(integrationId, options);
|
|
103
106
|
return events;
|
|
104
107
|
}
|
|
105
|
-
exports.getIntegrationEvents = getIntegrationEvents;
|
|
106
108
|
async function updateIntegration(integrationId, configuration) {
|
|
107
109
|
const current = await IntegrationsPlatform.getIntegrationById(integrationId);
|
|
108
110
|
// Create authorizations.
|
|
@@ -154,8 +156,6 @@ async function updateIntegration(integrationId, configuration) {
|
|
|
154
156
|
archived: configuration.archived,
|
|
155
157
|
});
|
|
156
158
|
}
|
|
157
|
-
exports.updateIntegration = updateIntegration;
|
|
158
159
|
async function getCredential(credentialId) {
|
|
159
160
|
return IntegrationsPlatform.getCredentialById(credentialId);
|
|
160
161
|
}
|
|
161
|
-
exports.getCredential = getCredential;
|
|
@@ -1,6 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HttpError = exports.
|
|
3
|
+
exports.HttpError = exports.servers = exports.defaults = void 0;
|
|
4
|
+
exports.getIntegrations = getIntegrations;
|
|
5
|
+
exports.createIntegration = createIntegration;
|
|
6
|
+
exports.publishIntegration = publishIntegration;
|
|
7
|
+
exports.getIntegrationByName = getIntegrationByName;
|
|
8
|
+
exports.inviteUser = inviteUser;
|
|
9
|
+
exports.inviteOrganization = inviteOrganization;
|
|
10
|
+
exports.getIntegrationById = getIntegrationById;
|
|
11
|
+
exports.updateIntegration = updateIntegration;
|
|
12
|
+
exports.deleteIntegration = deleteIntegration;
|
|
13
|
+
exports.getIntegrationEvents = getIntegrationEvents;
|
|
14
|
+
exports.getIntegrationLogo = getIntegrationLogo;
|
|
15
|
+
exports.getCredentials = getCredentials;
|
|
16
|
+
exports.createCredential = createCredential;
|
|
17
|
+
exports.getCredentialById = getCredentialById;
|
|
18
|
+
exports.updateCredential = updateCredential;
|
|
19
|
+
exports.deleteCredential = deleteCredential;
|
|
20
|
+
exports.getCredentialAccount = getCredentialAccount;
|
|
21
|
+
exports.postTrack = postTrack;
|
|
22
|
+
exports.encryptData = encryptData;
|
|
23
|
+
exports.decryptData = decryptData;
|
|
24
|
+
exports.reencryptData = reencryptData;
|
|
25
|
+
exports.getProfile = getProfile;
|
|
26
|
+
exports.updateProfile = updateProfile;
|
|
27
|
+
exports.getProxyMe = getProxyMe;
|
|
28
|
+
exports.updateWebhookSubscription = updateWebhookSubscription;
|
|
29
|
+
exports.getProxyGraph = getProxyGraph;
|
|
30
|
+
exports.patchProxyGraph = patchProxyGraph;
|
|
31
|
+
exports.postProxyGraph = postProxyGraph;
|
|
32
|
+
exports.deleteProxyGraph = deleteProxyGraph;
|
|
33
|
+
exports.getUsers = getUsers;
|
|
34
|
+
exports.createUser = createUser;
|
|
35
|
+
exports.getUserById = getUserById;
|
|
36
|
+
exports.updateUser = updateUser;
|
|
37
|
+
exports.regenerateApiKey = regenerateApiKey;
|
|
38
|
+
exports.getUserByEmail = getUserByEmail;
|
|
4
39
|
const tslib_1 = require("tslib");
|
|
5
40
|
/**
|
|
6
41
|
* Integrations Platform API
|
|
@@ -32,7 +67,6 @@ function getIntegrations({ pagination, unitoOrganizationId, search, } = {}, opts
|
|
|
32
67
|
...opts,
|
|
33
68
|
}));
|
|
34
69
|
}
|
|
35
|
-
exports.getIntegrations = getIntegrations;
|
|
36
70
|
/**
|
|
37
71
|
* Create an integration
|
|
38
72
|
*/
|
|
@@ -43,7 +77,6 @@ function createIntegration(body, opts) {
|
|
|
43
77
|
body,
|
|
44
78
|
})));
|
|
45
79
|
}
|
|
46
|
-
exports.createIntegration = createIntegration;
|
|
47
80
|
/**
|
|
48
81
|
* Publish an integration
|
|
49
82
|
*/
|
|
@@ -54,7 +87,6 @@ function publishIntegration(body, opts) {
|
|
|
54
87
|
body,
|
|
55
88
|
})));
|
|
56
89
|
}
|
|
57
|
-
exports.publishIntegration = publishIntegration;
|
|
58
90
|
/**
|
|
59
91
|
* Find an integration by exact name
|
|
60
92
|
*/
|
|
@@ -63,7 +95,6 @@ function getIntegrationByName(integrationName, opts) {
|
|
|
63
95
|
...opts,
|
|
64
96
|
}));
|
|
65
97
|
}
|
|
66
|
-
exports.getIntegrationByName = getIntegrationByName;
|
|
67
98
|
/**
|
|
68
99
|
* Invite a user to an integration
|
|
69
100
|
*/
|
|
@@ -74,7 +105,6 @@ function inviteUser(integrationId, body, opts) {
|
|
|
74
105
|
body,
|
|
75
106
|
})));
|
|
76
107
|
}
|
|
77
|
-
exports.inviteUser = inviteUser;
|
|
78
108
|
/**
|
|
79
109
|
* Invite a unito organization to an integration
|
|
80
110
|
*/
|
|
@@ -85,7 +115,6 @@ function inviteOrganization(integrationId, body, opts) {
|
|
|
85
115
|
body,
|
|
86
116
|
})));
|
|
87
117
|
}
|
|
88
|
-
exports.inviteOrganization = inviteOrganization;
|
|
89
118
|
/**
|
|
90
119
|
* Get an integration
|
|
91
120
|
*/
|
|
@@ -94,7 +123,6 @@ function getIntegrationById(integrationId, opts) {
|
|
|
94
123
|
...opts,
|
|
95
124
|
}));
|
|
96
125
|
}
|
|
97
|
-
exports.getIntegrationById = getIntegrationById;
|
|
98
126
|
/**
|
|
99
127
|
* Update an integration
|
|
100
128
|
*/
|
|
@@ -105,7 +133,6 @@ function updateIntegration(integrationId, body, opts) {
|
|
|
105
133
|
body,
|
|
106
134
|
})));
|
|
107
135
|
}
|
|
108
|
-
exports.updateIntegration = updateIntegration;
|
|
109
136
|
/**
|
|
110
137
|
* Delete an integration
|
|
111
138
|
*/
|
|
@@ -117,7 +144,6 @@ function deleteIntegration(integrationId, name, opts) {
|
|
|
117
144
|
method: 'DELETE',
|
|
118
145
|
}));
|
|
119
146
|
}
|
|
120
|
-
exports.deleteIntegration = deleteIntegration;
|
|
121
147
|
/**
|
|
122
148
|
* Get the events associated with this integration.
|
|
123
149
|
*/
|
|
@@ -130,7 +156,6 @@ function getIntegrationEvents(integrationId, { search, $from, limit, } = {}, opt
|
|
|
130
156
|
...opts,
|
|
131
157
|
}));
|
|
132
158
|
}
|
|
133
|
-
exports.getIntegrationEvents = getIntegrationEvents;
|
|
134
159
|
/**
|
|
135
160
|
* Get the logo of the integration, in SVG format.
|
|
136
161
|
*/
|
|
@@ -139,7 +164,6 @@ function getIntegrationLogo(integrationName, opts) {
|
|
|
139
164
|
...opts,
|
|
140
165
|
}));
|
|
141
166
|
}
|
|
142
|
-
exports.getIntegrationLogo = getIntegrationLogo;
|
|
143
167
|
/**
|
|
144
168
|
* Get all the credentials
|
|
145
169
|
*/
|
|
@@ -151,7 +175,6 @@ function getCredentials({ pagination, filters, } = {}, opts) {
|
|
|
151
175
|
...opts,
|
|
152
176
|
}));
|
|
153
177
|
}
|
|
154
|
-
exports.getCredentials = getCredentials;
|
|
155
178
|
/**
|
|
156
179
|
* Create a credential
|
|
157
180
|
*/
|
|
@@ -162,7 +185,6 @@ function createCredential(body, opts) {
|
|
|
162
185
|
body,
|
|
163
186
|
})));
|
|
164
187
|
}
|
|
165
|
-
exports.createCredential = createCredential;
|
|
166
188
|
/**
|
|
167
189
|
* Get a credential
|
|
168
190
|
*/
|
|
@@ -171,7 +193,6 @@ function getCredentialById(credentialId, opts) {
|
|
|
171
193
|
...opts,
|
|
172
194
|
}));
|
|
173
195
|
}
|
|
174
|
-
exports.getCredentialById = getCredentialById;
|
|
175
196
|
/**
|
|
176
197
|
* Update a credential
|
|
177
198
|
*/
|
|
@@ -182,7 +203,6 @@ function updateCredential(credentialId, body, opts) {
|
|
|
182
203
|
body,
|
|
183
204
|
})));
|
|
184
205
|
}
|
|
185
|
-
exports.updateCredential = updateCredential;
|
|
186
206
|
/**
|
|
187
207
|
* Delete a credential
|
|
188
208
|
*/
|
|
@@ -192,7 +212,6 @@ function deleteCredential(credentialId, opts) {
|
|
|
192
212
|
method: 'DELETE',
|
|
193
213
|
}));
|
|
194
214
|
}
|
|
195
|
-
exports.deleteCredential = deleteCredential;
|
|
196
215
|
/**
|
|
197
216
|
* Returns the credentialAccount either from the integration's /me endpoint, if available, or the credential's latestCredentialAccount
|
|
198
217
|
*/
|
|
@@ -206,7 +225,6 @@ function getCredentialAccount(xUnitoCredentialId, { xUnitoCorrelationId, xUnitoA
|
|
|
206
225
|
}),
|
|
207
226
|
}));
|
|
208
227
|
}
|
|
209
|
-
exports.getCredentialAccount = getCredentialAccount;
|
|
210
228
|
/**
|
|
211
229
|
* Used by the frontend to send analytics data
|
|
212
230
|
*/
|
|
@@ -217,7 +235,6 @@ function postTrack(body, opts) {
|
|
|
217
235
|
body,
|
|
218
236
|
})));
|
|
219
237
|
}
|
|
220
|
-
exports.postTrack = postTrack;
|
|
221
238
|
/**
|
|
222
239
|
* Encrypt data
|
|
223
240
|
*/
|
|
@@ -228,7 +245,6 @@ function encryptData(body, opts) {
|
|
|
228
245
|
body,
|
|
229
246
|
})));
|
|
230
247
|
}
|
|
231
|
-
exports.encryptData = encryptData;
|
|
232
248
|
/**
|
|
233
249
|
* Decrypt data
|
|
234
250
|
*/
|
|
@@ -239,7 +255,6 @@ function decryptData(body, opts) {
|
|
|
239
255
|
body,
|
|
240
256
|
})));
|
|
241
257
|
}
|
|
242
|
-
exports.decryptData = decryptData;
|
|
243
258
|
/**
|
|
244
259
|
* Decrypt and encrypt data
|
|
245
260
|
*/
|
|
@@ -250,7 +265,6 @@ function reencryptData(body, opts) {
|
|
|
250
265
|
body,
|
|
251
266
|
})));
|
|
252
267
|
}
|
|
253
|
-
exports.reencryptData = reencryptData;
|
|
254
268
|
/**
|
|
255
269
|
* Get my profile
|
|
256
270
|
*/
|
|
@@ -259,7 +273,6 @@ function getProfile(opts) {
|
|
|
259
273
|
...opts,
|
|
260
274
|
}));
|
|
261
275
|
}
|
|
262
|
-
exports.getProfile = getProfile;
|
|
263
276
|
/**
|
|
264
277
|
* Update my profile
|
|
265
278
|
*/
|
|
@@ -270,7 +283,6 @@ function updateProfile(body, opts) {
|
|
|
270
283
|
body,
|
|
271
284
|
})));
|
|
272
285
|
}
|
|
273
|
-
exports.updateProfile = updateProfile;
|
|
274
286
|
/**
|
|
275
287
|
* Call an integration's me
|
|
276
288
|
*/
|
|
@@ -284,7 +296,6 @@ function getProxyMe(xUnitoCredentialId, { xUnitoCorrelationId, xUnitoAdditionalL
|
|
|
284
296
|
}),
|
|
285
297
|
}));
|
|
286
298
|
}
|
|
287
|
-
exports.getProxyMe = getProxyMe;
|
|
288
299
|
/**
|
|
289
300
|
* Update a webhook subscription
|
|
290
301
|
*/
|
|
@@ -300,7 +311,6 @@ function updateWebhookSubscription(xUnitoCredentialId, body, { xUnitoCorrelation
|
|
|
300
311
|
}),
|
|
301
312
|
})));
|
|
302
313
|
}
|
|
303
|
-
exports.updateWebhookSubscription = updateWebhookSubscription;
|
|
304
314
|
/**
|
|
305
315
|
* Call an integration's graph
|
|
306
316
|
*/
|
|
@@ -317,7 +327,6 @@ function getProxyGraph(xUnitoCredentialId, path, { xUnitoCorrelationId, xUnitoAd
|
|
|
317
327
|
}),
|
|
318
328
|
}));
|
|
319
329
|
}
|
|
320
|
-
exports.getProxyGraph = getProxyGraph;
|
|
321
330
|
/**
|
|
322
331
|
* Call an integration's graph
|
|
323
332
|
*/
|
|
@@ -335,7 +344,6 @@ function patchProxyGraph(xUnitoCredentialId, path, body, { xUnitoCorrelationId,
|
|
|
335
344
|
}),
|
|
336
345
|
})));
|
|
337
346
|
}
|
|
338
|
-
exports.patchProxyGraph = patchProxyGraph;
|
|
339
347
|
/**
|
|
340
348
|
* Call an integration's graph
|
|
341
349
|
*/
|
|
@@ -353,7 +361,6 @@ function postProxyGraph(xUnitoCredentialId, path, body, { xUnitoCorrelationId, x
|
|
|
353
361
|
}),
|
|
354
362
|
})));
|
|
355
363
|
}
|
|
356
|
-
exports.postProxyGraph = postProxyGraph;
|
|
357
364
|
/**
|
|
358
365
|
* Call an integration's graph
|
|
359
366
|
*/
|
|
@@ -370,7 +377,6 @@ function deleteProxyGraph(xUnitoCredentialId, path, { xUnitoCorrelationId, xUnit
|
|
|
370
377
|
}),
|
|
371
378
|
}));
|
|
372
379
|
}
|
|
373
|
-
exports.deleteProxyGraph = deleteProxyGraph;
|
|
374
380
|
/**
|
|
375
381
|
* Get all the users
|
|
376
382
|
*/
|
|
@@ -381,7 +387,6 @@ function getUsers({ pagination, } = {}, opts) {
|
|
|
381
387
|
...opts,
|
|
382
388
|
}));
|
|
383
389
|
}
|
|
384
|
-
exports.getUsers = getUsers;
|
|
385
390
|
/**
|
|
386
391
|
* Create a user
|
|
387
392
|
*/
|
|
@@ -392,7 +397,6 @@ function createUser(body, opts) {
|
|
|
392
397
|
body,
|
|
393
398
|
})));
|
|
394
399
|
}
|
|
395
|
-
exports.createUser = createUser;
|
|
396
400
|
/**
|
|
397
401
|
* Get a user
|
|
398
402
|
*/
|
|
@@ -401,7 +405,6 @@ function getUserById(userId, opts) {
|
|
|
401
405
|
...opts,
|
|
402
406
|
}));
|
|
403
407
|
}
|
|
404
|
-
exports.getUserById = getUserById;
|
|
405
408
|
/**
|
|
406
409
|
* Update a user
|
|
407
410
|
*/
|
|
@@ -412,7 +415,6 @@ function updateUser(userId, body, opts) {
|
|
|
412
415
|
body,
|
|
413
416
|
})));
|
|
414
417
|
}
|
|
415
|
-
exports.updateUser = updateUser;
|
|
416
418
|
/**
|
|
417
419
|
* Regenerate the api key of a user
|
|
418
420
|
*/
|
|
@@ -422,7 +424,6 @@ function regenerateApiKey(userId, opts) {
|
|
|
422
424
|
method: 'POST',
|
|
423
425
|
}));
|
|
424
426
|
}
|
|
425
|
-
exports.regenerateApiKey = regenerateApiKey;
|
|
426
427
|
/**
|
|
427
428
|
* Get a user by its email address
|
|
428
429
|
*/
|
|
@@ -431,6 +432,5 @@ function getUserByEmail(email, opts) {
|
|
|
431
432
|
...opts,
|
|
432
433
|
}));
|
|
433
434
|
}
|
|
434
|
-
exports.getUserByEmail = getUserByEmail;
|
|
435
435
|
const runtime_1 = require("@oazapfts/runtime");
|
|
436
436
|
Object.defineProperty(exports, "HttpError", { enumerable: true, get: function () { return runtime_1.HttpError; } });
|
|
@@ -8,9 +8,9 @@ export declare function generateIntegration(overrides?: Partial<IntegrationsPlat
|
|
|
8
8
|
baseUrl: string | null;
|
|
9
9
|
graphRelativeUrl: string;
|
|
10
10
|
credentialAccountRelativeUrl: string;
|
|
11
|
-
webhookParsingRelativeUrl?: string | null | undefined;
|
|
12
|
-
webhookSubscriptionsRelativeUrl?: string | null | undefined;
|
|
13
|
-
webhookAcknowledgeRelativeUrl?: string | null | undefined;
|
|
11
|
+
webhookParsingRelativeUrl?: (string | null) | undefined;
|
|
12
|
+
webhookSubscriptionsRelativeUrl?: (string | null) | undefined;
|
|
13
|
+
webhookAcknowledgeRelativeUrl?: (string | null) | undefined;
|
|
14
14
|
visibility: string;
|
|
15
15
|
unitoOrganizationIds: string[];
|
|
16
16
|
ui: {
|
|
@@ -20,7 +20,7 @@ export declare function generateIntegration(overrides?: Partial<IntegrationsPlat
|
|
|
20
20
|
secrets?: {
|
|
21
21
|
[key: string]: string;
|
|
22
22
|
} | undefined;
|
|
23
|
-
disabledAt?: string | null | undefined;
|
|
23
|
+
disabledAt?: (string | null) | undefined;
|
|
24
24
|
authorizations: import("../../src/services/integrationsPlatformClient").Authorization[];
|
|
25
25
|
userIds: number[];
|
|
26
26
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generateIntegration =
|
|
3
|
+
exports.generateIntegration = generateIntegration;
|
|
4
4
|
function generateIntegration(overrides = {}) {
|
|
5
5
|
return {
|
|
6
6
|
id: 1,
|
|
@@ -22,4 +22,3 @@ function generateIntegration(overrides = {}) {
|
|
|
22
22
|
...overrides,
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
-
exports.generateIntegration = generateIntegration;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.uncolorize =
|
|
3
|
+
exports.uncolorize = uncolorize;
|
|
4
4
|
function uncolorize(text) {
|
|
5
5
|
// eslint-disable-next-line
|
|
6
6
|
return text.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, '');
|
|
7
7
|
}
|
|
8
|
-
exports.uncolorize = uncolorize;
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unito/integration-cli",
|
|
3
|
-
"version": "0.60.
|
|
3
|
+
"version": "0.60.12",
|
|
4
4
|
"description": "Integration CLI",
|
|
5
5
|
"bin": {
|
|
6
6
|
"integration-cli": "./bin/run"
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@oclif/core": "3.x",
|
|
40
|
-
"@unito/integration-debugger": "0.26.
|
|
40
|
+
"@unito/integration-debugger": "0.26.8",
|
|
41
41
|
"@oazapfts/runtime": "1.x",
|
|
42
42
|
"ajv": "8.x",
|
|
43
43
|
"ajv-formats": "2.x",
|