@unito/integration-cli 0.62.8 → 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.
- package/dist/boilerplate/Dockerfile +2 -2
- package/dist/schemas/authorization.json +5 -0
- package/dist/src/commands/publish.js +18 -4
- package/dist/src/configurationTypes.d.ts +4 -0
- package/dist/src/services/oauth2.js +11 -3
- package/dist/test/commands/publish.test.js +2 -2
- package/oclif.manifest.json +1 -1
- package/package.json +4 -4
|
@@ -10,7 +10,7 @@ WORKDIR /build
|
|
|
10
10
|
|
|
11
11
|
COPY . .
|
|
12
12
|
|
|
13
|
-
RUN --mount=type=secret,id=npmrc,target=.npmrc npm ci
|
|
13
|
+
RUN --mount=type=secret,id=npmrc,target=.npmrc npm --no-audit --no-fund ci
|
|
14
14
|
|
|
15
15
|
RUN npm install
|
|
16
16
|
RUN npm run compile
|
|
@@ -30,7 +30,7 @@ COPY --from=build \
|
|
|
30
30
|
/build/dist \
|
|
31
31
|
.
|
|
32
32
|
|
|
33
|
-
RUN --mount=type=secret,id=npmrc,target=.npmrc npm ci --omit=dev
|
|
33
|
+
RUN --mount=type=secret,id=npmrc,target=.npmrc npm --no-audit --no-fund ci --omit=dev
|
|
34
34
|
|
|
35
35
|
RUN npm install --omit=dev
|
|
36
36
|
|
|
@@ -161,6 +161,11 @@
|
|
|
161
161
|
"description": "The URL to obtain or refresh an access token.",
|
|
162
162
|
"format": "uri-template"
|
|
163
163
|
},
|
|
164
|
+
"legacyRedirectUrl": {
|
|
165
|
+
"type": "string",
|
|
166
|
+
"description": "The legacy redirect callback URL used for specific connectors where an existing app definition with a predefined redirect URL must be reused.",
|
|
167
|
+
"format": "uri-template"
|
|
168
|
+
},
|
|
164
169
|
"grantType": {
|
|
165
170
|
"type": "string",
|
|
166
171
|
"description": "The type of grant of the OAuth 2 authorization.",
|
|
@@ -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.
|
|
@@ -149,6 +149,10 @@ export interface Oauth2 {
|
|
|
149
149
|
* The URL to obtain or refresh an access token.
|
|
150
150
|
*/
|
|
151
151
|
tokenUrl: string;
|
|
152
|
+
/**
|
|
153
|
+
* The legacy redirect callback URL used for specific connectors where an existing app definition with a predefined redirect URL must be reused.
|
|
154
|
+
*/
|
|
155
|
+
legacyRedirectUrl?: string;
|
|
152
156
|
grantType?: GrantType;
|
|
153
157
|
scopes: {
|
|
154
158
|
/**
|
|
@@ -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
|
-
"@
|
|
40
|
-
"@unito/integration-debugger": "0.28.4",
|
|
39
|
+
"@ngrok/ngrok": "^1.4.1",
|
|
41
40
|
"@oazapfts/runtime": "1.x",
|
|
41
|
+
"@oclif/core": "3.x",
|
|
42
|
+
"@unito/integration-debugger": "0.28.5",
|
|
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
|
},
|