@redocly/cli 1.28.5 → 1.30.0
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/CHANGELOG.md +23 -0
- package/lib/__tests__/commands/push-region.test.js +3 -3
- package/lib/__tests__/utils.test.js +1 -0
- package/lib/auth/__tests__/device-flow.test.js +62 -0
- package/lib/auth/__tests__/oauth-client.test.js +93 -0
- package/lib/auth/device-flow.d.ts +26 -0
- package/lib/auth/device-flow.js +133 -0
- package/lib/auth/oauth-client.d.ts +14 -0
- package/lib/auth/oauth-client.js +93 -0
- package/lib/commands/auth.d.ts +13 -0
- package/lib/commands/auth.js +51 -0
- package/lib/commands/push.d.ts +1 -1
- package/lib/commands/push.js +4 -4
- package/lib/commands/split/index.js +4 -4
- package/lib/index.js +14 -15
- package/lib/otel.d.ts +10 -0
- package/lib/otel.js +47 -0
- package/lib/reunite/api/__tests__/domains.test.js +32 -0
- package/lib/{cms → reunite}/api/api-client.d.ts +9 -0
- package/lib/{cms → reunite}/api/api-client.js +2 -1
- package/lib/reunite/api/domains.d.ts +4 -0
- package/lib/reunite/api/domains.js +22 -0
- package/lib/reunite/commands/__tests__/push.test.d.ts +1 -0
- package/lib/reunite/commands/__tests__/utils.test.d.ts +1 -0
- package/lib/types.d.ts +4 -4
- package/lib/utils/miscellaneous.d.ts +5 -4
- package/lib/utils/miscellaneous.js +14 -14
- package/package.json +7 -2
- package/src/__tests__/commands/push-region.test.ts +2 -2
- package/src/__tests__/utils.test.ts +1 -0
- package/src/auth/__tests__/device-flow.test.ts +73 -0
- package/src/auth/__tests__/oauth-client.test.ts +117 -0
- package/src/auth/device-flow.ts +175 -0
- package/src/auth/oauth-client.ts +111 -0
- package/src/commands/auth.ts +66 -0
- package/src/commands/push.ts +3 -3
- package/src/commands/split/index.ts +9 -9
- package/src/index.ts +14 -15
- package/src/otel.ts +59 -0
- package/src/reunite/api/__tests__/domains.test.ts +41 -0
- package/src/{cms → reunite}/api/api-client.ts +1 -1
- package/src/reunite/api/domains.ts +23 -0
- package/src/types.ts +4 -3
- package/src/utils/miscellaneous.ts +20 -18
- package/tsconfig.tsbuildinfo +1 -1
- package/lib/cms/api/__tests__/domains.test.js +0 -13
- package/lib/cms/api/domains.d.ts +0 -1
- package/lib/cms/api/domains.js +0 -11
- package/lib/commands/login.d.ts +0 -9
- package/lib/commands/login.js +0 -23
- package/src/cms/api/__tests__/domains.test.ts +0 -15
- package/src/cms/api/domains.ts +0 -11
- package/src/commands/login.ts +0 -34
- /package/lib/{cms/api/__tests__/api-keys.test.d.ts → auth/__tests__/device-flow.test.d.ts} +0 -0
- /package/lib/{cms/api/__tests__/api.client.test.d.ts → auth/__tests__/oauth-client.test.d.ts} +0 -0
- /package/lib/{cms/api/__tests__/domains.test.d.ts → reunite/api/__tests__/api-keys.test.d.ts} +0 -0
- /package/lib/{cms → reunite}/api/__tests__/api-keys.test.js +0 -0
- /package/lib/{cms/commands/__tests__/push-status.test.d.ts → reunite/api/__tests__/api.client.test.d.ts} +0 -0
- /package/lib/{cms → reunite}/api/__tests__/api.client.test.js +0 -0
- /package/lib/{cms/commands/__tests__/push.test.d.ts → reunite/api/__tests__/domains.test.d.ts} +0 -0
- /package/lib/{cms → reunite}/api/api-keys.d.ts +0 -0
- /package/lib/{cms → reunite}/api/api-keys.js +0 -0
- /package/lib/{cms → reunite}/api/index.d.ts +0 -0
- /package/lib/{cms → reunite}/api/index.js +0 -0
- /package/lib/{cms → reunite}/api/types.d.ts +0 -0
- /package/lib/{cms → reunite}/api/types.js +0 -0
- /package/lib/{cms/commands/__tests__/utils.test.d.ts → reunite/commands/__tests__/push-status.test.d.ts} +0 -0
- /package/lib/{cms → reunite}/commands/__tests__/push-status.test.js +0 -0
- /package/lib/{cms → reunite}/commands/__tests__/push.test.js +0 -0
- /package/lib/{cms → reunite}/commands/__tests__/utils.test.js +0 -0
- /package/lib/{cms → reunite}/commands/push-status.d.ts +0 -0
- /package/lib/{cms → reunite}/commands/push-status.js +0 -0
- /package/lib/{cms → reunite}/commands/push.d.ts +0 -0
- /package/lib/{cms → reunite}/commands/push.js +0 -0
- /package/lib/{cms → reunite}/commands/utils.d.ts +0 -0
- /package/lib/{cms → reunite}/commands/utils.js +0 -0
- /package/lib/{cms → reunite}/utils.d.ts +0 -0
- /package/lib/{cms → reunite}/utils.js +0 -0
- /package/src/{cms → reunite}/api/__tests__/api-keys.test.ts +0 -0
- /package/src/{cms → reunite}/api/__tests__/api.client.test.ts +0 -0
- /package/src/{cms → reunite}/api/api-keys.ts +0 -0
- /package/src/{cms → reunite}/api/index.ts +0 -0
- /package/src/{cms → reunite}/api/types.ts +0 -0
- /package/src/{cms → reunite}/commands/__tests__/push-status.test.ts +0 -0
- /package/src/{cms → reunite}/commands/__tests__/push.test.ts +0 -0
- /package/src/{cms → reunite}/commands/__tests__/utils.test.ts +0 -0
- /package/src/{cms → reunite}/commands/push-status.ts +0 -0
- /package/src/{cms → reunite}/commands/push.ts +0 -0
- /package/src/{cms → reunite}/commands/utils.ts +0 -0
- /package/src/{cms → reunite}/utils.ts +0 -0
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const domains_1 = require("../domains");
|
|
4
|
-
describe('getDomain()', () => {
|
|
5
|
-
it('should return the domain from environment variable', () => {
|
|
6
|
-
process.env.REDOCLY_DOMAIN = 'test-domain';
|
|
7
|
-
expect((0, domains_1.getDomain)()).toBe('test-domain');
|
|
8
|
-
});
|
|
9
|
-
it('should return the default domain if no domain provided', () => {
|
|
10
|
-
process.env.REDOCLY_DOMAIN = '';
|
|
11
|
-
expect((0, domains_1.getDomain)()).toBe('https://app.cloud.redocly.com');
|
|
12
|
-
});
|
|
13
|
-
});
|
package/lib/cms/api/domains.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function getDomain(): string;
|
package/lib/cms/api/domains.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getDomain = getDomain;
|
|
4
|
-
const DEFAULT_DOMAIN = 'https://app.cloud.redocly.com';
|
|
5
|
-
function getDomain() {
|
|
6
|
-
const domain = process.env.REDOCLY_DOMAIN;
|
|
7
|
-
if (domain) {
|
|
8
|
-
return domain;
|
|
9
|
-
}
|
|
10
|
-
return DEFAULT_DOMAIN;
|
|
11
|
-
}
|
package/lib/commands/login.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { CommandArgs } from '../wrapper';
|
|
2
|
-
import type { Region } from '@redocly/openapi-core';
|
|
3
|
-
export declare function promptClientToken(domain: string): Promise<string>;
|
|
4
|
-
export type LoginOptions = {
|
|
5
|
-
verbose?: boolean;
|
|
6
|
-
region?: Region;
|
|
7
|
-
config?: string;
|
|
8
|
-
};
|
|
9
|
-
export declare function handleLogin({ argv, config }: CommandArgs<LoginOptions>): Promise<void>;
|
package/lib/commands/login.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.promptClientToken = promptClientToken;
|
|
4
|
-
exports.handleLogin = handleLogin;
|
|
5
|
-
const colorette_1 = require("colorette");
|
|
6
|
-
const openapi_core_1 = require("@redocly/openapi-core");
|
|
7
|
-
const miscellaneous_1 = require("../utils/miscellaneous");
|
|
8
|
-
function promptClientToken(domain) {
|
|
9
|
-
return (0, miscellaneous_1.promptUser)((0, colorette_1.green)(`\n 🔑 Copy your API key from ${(0, colorette_1.blue)(`https://app.${domain}/profile`)} and paste it below`), true);
|
|
10
|
-
}
|
|
11
|
-
async function handleLogin({ argv, config }) {
|
|
12
|
-
try {
|
|
13
|
-
const region = argv.region || config.region;
|
|
14
|
-
const client = new openapi_core_1.RedoclyClient(region);
|
|
15
|
-
const clientToken = await promptClientToken(client.domain);
|
|
16
|
-
process.stdout.write((0, colorette_1.gray)('\n Logging in...\n'));
|
|
17
|
-
await client.login(clientToken, argv.verbose);
|
|
18
|
-
process.stdout.write((0, colorette_1.green)(' Authorization confirmed. ✅\n\n'));
|
|
19
|
-
}
|
|
20
|
-
catch (err) {
|
|
21
|
-
(0, miscellaneous_1.exitWithError)(' ' + err?.message);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { getDomain } from '../domains';
|
|
2
|
-
|
|
3
|
-
describe('getDomain()', () => {
|
|
4
|
-
it('should return the domain from environment variable', () => {
|
|
5
|
-
process.env.REDOCLY_DOMAIN = 'test-domain';
|
|
6
|
-
|
|
7
|
-
expect(getDomain()).toBe('test-domain');
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
it('should return the default domain if no domain provided', () => {
|
|
11
|
-
process.env.REDOCLY_DOMAIN = '';
|
|
12
|
-
|
|
13
|
-
expect(getDomain()).toBe('https://app.cloud.redocly.com');
|
|
14
|
-
});
|
|
15
|
-
});
|
package/src/cms/api/domains.ts
DELETED
package/src/commands/login.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { blue, green, gray } from 'colorette';
|
|
2
|
-
import { RedoclyClient } from '@redocly/openapi-core';
|
|
3
|
-
import { exitWithError, promptUser } from '../utils/miscellaneous';
|
|
4
|
-
|
|
5
|
-
import type { CommandArgs } from '../wrapper';
|
|
6
|
-
import type { Region } from '@redocly/openapi-core';
|
|
7
|
-
|
|
8
|
-
export function promptClientToken(domain: string) {
|
|
9
|
-
return promptUser(
|
|
10
|
-
green(
|
|
11
|
-
`\n 🔑 Copy your API key from ${blue(`https://app.${domain}/profile`)} and paste it below`
|
|
12
|
-
),
|
|
13
|
-
true
|
|
14
|
-
);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export type LoginOptions = {
|
|
18
|
-
verbose?: boolean;
|
|
19
|
-
region?: Region;
|
|
20
|
-
config?: string;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export async function handleLogin({ argv, config }: CommandArgs<LoginOptions>) {
|
|
24
|
-
try {
|
|
25
|
-
const region = argv.region || config.region;
|
|
26
|
-
const client = new RedoclyClient(region);
|
|
27
|
-
const clientToken = await promptClientToken(client.domain);
|
|
28
|
-
process.stdout.write(gray('\n Logging in...\n'));
|
|
29
|
-
await client.login(clientToken, argv.verbose);
|
|
30
|
-
process.stdout.write(green(' Authorization confirmed. ✅\n\n'));
|
|
31
|
-
} catch (err) {
|
|
32
|
-
exitWithError(' ' + err?.message);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
File without changes
|
/package/lib/{cms/api/__tests__/api.client.test.d.ts → auth/__tests__/oauth-client.test.d.ts}
RENAMED
|
File without changes
|
/package/lib/{cms/api/__tests__/domains.test.d.ts → reunite/api/__tests__/api-keys.test.d.ts}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/lib/{cms/commands/__tests__/push.test.d.ts → reunite/api/__tests__/domains.test.d.ts}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|