@unito/integration-cli 0.60.0 → 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',
@@ -111,11 +111,13 @@ class Dev extends baseCommand_1.BaseCommand {
111
111
  // Load environment variables.
112
112
  const { successful: environmentVariables, failed: failedEnvironmentVariables } = await (0, decryption_1.decryptEntries)(configuration.name, environment, this.config.configDir, configuration.environmentVariables ?? {});
113
113
  for (const environmentVariable of failedEnvironmentVariables) {
114
- core_1.ux.log();
115
- core_1.ux.log(`Could not decrypt the environment variable ${chalk_1.default.yellowBright(environmentVariable)}.`);
116
- core_1.ux.log('It may be a normal behavior locally as some environment variables are sensitive secrets.');
117
- core_1.ux.log(`You can still pass ${chalk_1.default.yellowBright(`${environmentVariable}=<value>`)} to the CLI command to provide a value for this environment variable.`);
118
- core_1.ux.log(`Example: ${chalk_1.default.yellowBright(`${environmentVariable}=foo ${this.config.bin} ${this.id}`)}`);
114
+ if (!process.env[environmentVariable]) {
115
+ core_1.ux.log();
116
+ core_1.ux.log(`Could not decrypt the environment variable ${chalk_1.default.yellowBright(environmentVariable)}.`);
117
+ core_1.ux.log('It may be a normal behavior locally as some environment variables are sensitive secrets.');
118
+ core_1.ux.log(`You can still pass ${chalk_1.default.yellowBright(`${environmentVariable}=<value>`)} to the CLI command to provide a value for this environment variable.`);
119
+ core_1.ux.log(`Example: ${chalk_1.default.yellowBright(`${environmentVariable}=foo ${this.config.bin} ${this.id}`)}`);
120
+ }
119
121
  }
120
122
  // Launch the debugger.
121
123
  const commandArguments = [
@@ -129,11 +129,13 @@ class Test extends baseCommand_1.BaseCommand {
129
129
  // Load environment variables.
130
130
  const { successful: environmentVariables, failed: failedEnvironmentVariables } = await (0, decryption_1.decryptEntries)(configuration.name, environment, this.config.configDir, configuration.environmentVariables ?? {});
131
131
  for (const environmentVariable of failedEnvironmentVariables) {
132
- core_1.ux.log();
133
- core_1.ux.log(`Could not decrypt the environment variable ${chalk_1.default.yellowBright(environmentVariable)}.`);
134
- core_1.ux.log('It may be a normal behavior locally as some environment variables are sensitive secrets.');
135
- core_1.ux.log(`You can still pass ${chalk_1.default.yellowBright(`${environmentVariable}=<value>`)} to the CLI command to provide a value for this environment variable.`);
136
- core_1.ux.log(`Example: ${chalk_1.default.yellowBright(`${environmentVariable}=foo ${this.config.bin} ${this.id}`)}`);
132
+ if (!process.env[environmentVariable]) {
133
+ core_1.ux.log();
134
+ core_1.ux.log(`Could not decrypt the environment variable ${chalk_1.default.yellowBright(environmentVariable)}.`);
135
+ core_1.ux.log('It may be a normal behavior locally as some environment variables are sensitive secrets.');
136
+ core_1.ux.log(`You can still pass ${chalk_1.default.yellowBright(`${environmentVariable}=<value>`)} to the CLI command to provide a value for this environment variable.`);
137
+ core_1.ux.log(`Example: ${chalk_1.default.yellowBright(`${environmentVariable}=foo ${this.config.bin} ${this.id}`)}`);
138
+ }
137
139
  }
138
140
  // Launch the tests.
139
141
  const commandArguments = [
@@ -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;