@unito/integration-cli 0.62.9 → 0.62.10
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.
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const core_1 = require("@oclif/core");
|
|
5
5
|
const inquirer_1 = tslib_1.__importDefault(require("inquirer"));
|
|
6
|
-
const ngrok_1 = tslib_1.__importDefault(require("ngrok"));
|
|
6
|
+
const ngrok_1 = tslib_1.__importDefault(require("@ngrok/ngrok"));
|
|
7
7
|
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
8
8
|
const gradient = tslib_1.__importStar(require("gradient-string"));
|
|
9
9
|
const json_colorizer_1 = tslib_1.__importDefault(require("json-colorizer"));
|
|
@@ -131,9 +131,23 @@ class Publish extends baseCommand_1.BaseCommand {
|
|
|
131
131
|
].join(' - ');
|
|
132
132
|
}
|
|
133
133
|
// Start ngrok & update the base url.
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
134
|
+
try {
|
|
135
|
+
core_1.ux.action.start('Starting ngrok');
|
|
136
|
+
const listener = await ngrok_1.default.forward({ addr: 9200, authtoken_from_env: true });
|
|
137
|
+
const url = listener.url();
|
|
138
|
+
if (url) {
|
|
139
|
+
updatedConfiguration.baseUrl = url;
|
|
140
|
+
core_1.ux.log(`Ngrok started at: ${url}`);
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
throw new Error('Ngrok failed to start: URL is null');
|
|
144
|
+
}
|
|
145
|
+
core_1.ux.action.stop();
|
|
146
|
+
}
|
|
147
|
+
catch (error) {
|
|
148
|
+
core_1.ux.action.stop();
|
|
149
|
+
console.error('Failed to start ngrok:', error);
|
|
150
|
+
}
|
|
137
151
|
// Update the registry.
|
|
138
152
|
await this.updateRegistry(updatedConfiguration);
|
|
139
153
|
// Launch the process.
|
|
@@ -5,7 +5,7 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const express_1 = tslib_1.__importDefault(require("express"));
|
|
6
6
|
const cors_1 = tslib_1.__importDefault(require("cors"));
|
|
7
7
|
const openUrl = tslib_1.__importStar(require("openurl"));
|
|
8
|
-
const ngrok_1 = tslib_1.__importDefault(require("ngrok"));
|
|
8
|
+
const ngrok_1 = tslib_1.__importDefault(require("@ngrok/ngrok"));
|
|
9
9
|
const IntegrationsPlatformClient = tslib_1.__importStar(require("./integrationsPlatform"));
|
|
10
10
|
const configurationTypes_1 = require("../configurationTypes");
|
|
11
11
|
const template_1 = require("../resources/template");
|
|
@@ -263,7 +263,15 @@ class OAuth2Service {
|
|
|
263
263
|
async startServer() {
|
|
264
264
|
const app = (0, express_1.default)();
|
|
265
265
|
const PORT = process.env.OAUTH2_PORT ?? 9002;
|
|
266
|
-
|
|
266
|
+
const listener = await ngrok_1.default.forward({ addr: Number(PORT), authtoken_from_env: true });
|
|
267
|
+
const url = listener.url();
|
|
268
|
+
if (url) {
|
|
269
|
+
this.serverUrl = url;
|
|
270
|
+
console.log(` Ngrok started at: ${url}`);
|
|
271
|
+
}
|
|
272
|
+
else {
|
|
273
|
+
throw new Error('Ngrok failed to start: URL is null');
|
|
274
|
+
}
|
|
267
275
|
app.use((0, cors_1.default)({ credentials: true, origin: true }));
|
|
268
276
|
app.use(express_1.default.json());
|
|
269
277
|
app.get('/health', (_req, res) => {
|
|
@@ -281,7 +289,7 @@ class OAuth2Service {
|
|
|
281
289
|
/* istanbul ignore next */
|
|
282
290
|
async stopServer() {
|
|
283
291
|
if (this.server) {
|
|
284
|
-
await ngrok_1.default.
|
|
292
|
+
await ngrok_1.default.disconnect();
|
|
285
293
|
this.server.close(() => {
|
|
286
294
|
console.log(' Server has stopped');
|
|
287
295
|
});
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const test_1 = require("@oclif/test");
|
|
5
5
|
const sinon_1 = tslib_1.__importDefault(require("sinon"));
|
|
6
|
-
const ngrok_1 = tslib_1.__importDefault(require("ngrok"));
|
|
6
|
+
const ngrok_1 = tslib_1.__importDefault(require("@ngrok/ngrok"));
|
|
7
7
|
const child_process_1 = tslib_1.__importDefault(require("child_process"));
|
|
8
8
|
const inquirer_1 = tslib_1.__importDefault(require("inquirer"));
|
|
9
9
|
const GlobalConfiguration = tslib_1.__importStar(require("../../src/resources/globalConfiguration"));
|
|
@@ -22,7 +22,7 @@ describe('Publish', () => {
|
|
|
22
22
|
sinon_1.default.stub(IntegrationsPlatform, 'setApiKey');
|
|
23
23
|
sinon_1.default.stub(IntegrationsPlatform, 'publishIntegration');
|
|
24
24
|
sinon_1.default.stub(IntegrationsPlatform, 'reencryptData').resolves({ encryptedData: 'newEncryptedSecret' });
|
|
25
|
-
sinon_1.default.stub(ngrok_1.default, '
|
|
25
|
+
sinon_1.default.stub(ngrok_1.default, 'forward');
|
|
26
26
|
sinon_1.default.stub(child_process_1.default, 'spawn');
|
|
27
27
|
sinon_1.default.stub(IntegrationsPlatform, 'getProfile').resolves({
|
|
28
28
|
id: 1,
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unito/integration-cli",
|
|
3
|
-
"version": "0.62.
|
|
3
|
+
"version": "0.62.10",
|
|
4
4
|
"description": "Integration CLI",
|
|
5
5
|
"bin": {
|
|
6
6
|
"integration-cli": "./bin/run"
|
|
@@ -36,9 +36,10 @@
|
|
|
36
36
|
"!/bin/dev*"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
+
"@ngrok/ngrok": "^1.4.1",
|
|
40
|
+
"@oazapfts/runtime": "1.x",
|
|
39
41
|
"@oclif/core": "3.x",
|
|
40
42
|
"@unito/integration-debugger": "0.28.5",
|
|
41
|
-
"@oazapfts/runtime": "1.x",
|
|
42
43
|
"ajv": "8.x",
|
|
43
44
|
"ajv-formats": "2.x",
|
|
44
45
|
"better-ajv-errors": "1.x",
|
|
@@ -48,7 +49,6 @@
|
|
|
48
49
|
"gradient-string": "2.x",
|
|
49
50
|
"inquirer": "8.x",
|
|
50
51
|
"json-colorizer": "2.x",
|
|
51
|
-
"ngrok": "5.0.0-beta.2",
|
|
52
52
|
"openurl": "1.x",
|
|
53
53
|
"tmp": "0.x"
|
|
54
54
|
},
|