@scalar/cli 2.10.0 → 2.11.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/README.md +82 -1290
- package/chunks/{action-YSVTZVKV.js → action-25QMCP5G.js} +37 -26
- package/chunks/{action-X7BA7PQQ.js → action-2VF6LODL.js} +20 -18
- package/chunks/{action-5N3P43MD.js → action-5I4XDPPG.js} +16 -15
- package/chunks/action-6M5PTDF6.js +100 -0
- package/chunks/{action-PAM2EZ22.js → action-73ELLN3T.js} +8 -7
- package/chunks/{action-XOADBXSX.js → action-7H3AWCHX.js} +17 -16
- package/chunks/{action-KDUFU7TZ.js → action-BRSLSOE5.js} +19 -16
- package/chunks/{action-7XOHYWYM.js → action-CQQCKSNS.js} +13 -15
- package/chunks/action-D5QWDNQ2.js +65 -0
- package/chunks/{action-5RL4NWUZ.js → action-DQDHBOLJ.js} +33 -30
- package/chunks/{action-DKDRAIKV.js → action-EYPYQQVM.js} +13 -15
- package/chunks/{action-ZFI77WA5.js → action-FMA5ECUA.js} +10 -10
- package/chunks/{action-DTEO4YNX.js → action-GXDJLF2G.js} +13 -11
- package/chunks/{action-657A4K2D.js → action-HUICEXJZ.js} +26 -23
- package/chunks/action-IH6G77C5.js +38 -0
- package/chunks/{action-H3RTILLM.js → action-IIQMZVRJ.js} +1 -1
- package/chunks/action-IQM54ITT.js +164 -0
- package/chunks/{action-EAUTQ77U.js → action-J5TO3UJW.js} +26 -24
- package/chunks/{action-UUL6SWV4.js → action-KC3ZCNDR.js} +12 -14
- package/chunks/{action-HT42NUUX.js → action-L7TMS3Q3.js} +40 -38
- package/chunks/{action-GWYYTUTM.js → action-LAAHRDSR.js} +5 -5
- package/chunks/{action-5LF4XYHX.js → action-LR75GHBA.js} +12 -12
- package/chunks/{action-PPTFYZWD.js → action-MJMLQFLT.js} +12 -12
- package/chunks/action-NHU4CUKT.js +130 -0
- package/chunks/{action-4GZI2M5B.js → action-NKTFNFU7.js} +19 -17
- package/chunks/{action-CB55NWAU.js → action-NMW5WPD2.js} +9 -9
- package/chunks/{action-GFLRD7LO.js → action-OTPXODUE.js} +8 -8
- package/chunks/{action-R4PGILN4.js → action-RPCDNGCI.js} +47 -36
- package/chunks/{action-TOBU74JH.js → action-RQCXSJPZ.js} +51 -27
- package/chunks/{action-JEYDBB3P.js → action-SOYSVG67.js} +15 -15
- package/chunks/action-Y7EBKCUU.js +16 -0
- package/chunks/{action-XLE37MZL.js → action-YN4TE7TG.js} +23 -22
- package/chunks/{action-CABLS46Q.js → action-ZGNVWTHZ.js} +11 -11
- package/chunks/{action-4W5GUGEG.js → action-ZKKRPLDK.js} +20 -19
- package/chunks/{action-ZKA3RR3S.js → action-ZUZL7R3H.js} +18 -17
- package/chunks/{actions-3SAMH7A5.js → actions-S6K76HCW.js} +23 -20
- package/chunks/{agent-2ESZI7NO.js → agent-IRNEV4K5.js} +44 -9
- package/chunks/{asyncapi-4HGVM3PR.js → asyncapi-WQPIQMEZ.js} +13 -12
- package/chunks/{build.action-VBGFGACM.js → build.action-CLBVKFWD.js} +28 -26
- package/chunks/chunk-25XERWCE.js +1058 -0
- package/chunks/{chunk-35Z7VTJT.js → chunk-3RIUDHLG.js} +52 -38
- package/chunks/{chunk-ZYBLQ5CT.js → chunk-3TFOA64C.js} +9 -4
- package/chunks/{chunk-CWVYOXXM.js → chunk-4JKXZ5CF.js} +11 -7
- package/chunks/{chunk-XAGJJNQW.js → chunk-5L7V7RCH.js} +10 -10
- package/chunks/{chunk-KZNRQVMY.js → chunk-ALYM4ZB2.js} +1 -1
- package/chunks/chunk-AVZFSWPD.js +37 -0
- package/chunks/{chunk-GYRQPDTK.js → chunk-BQYVSPAI.js} +14 -2
- package/chunks/{chunk-UDBSV3CK.js → chunk-CSSTCHHF.js} +6083 -4167
- package/chunks/{chunk-ZGNDXPLU.js → chunk-DQD2753S.js} +3 -3
- package/chunks/{action-F2ZJNURT.js → chunk-EBNFCIKS.js} +7 -10
- package/chunks/{chunk-ATNTXKMS.js → chunk-F3OPMYME.js} +118 -38
- package/chunks/{chunk-KHF2QXBG.js → chunk-FG5AOTDN.js} +1433 -641
- package/chunks/{chunk-K2HIB5BA.js → chunk-GKCVATQJ.js} +3 -3
- package/chunks/{chunk-BIMLCGKS.js → chunk-GMHIK5K2.js} +1 -1
- package/chunks/{chunk-5SMP756H.js → chunk-GYR5E6RB.js} +2 -2
- package/chunks/{chunk-MC4EMNOR.js → chunk-HZN6IIPZ.js} +7 -6
- package/chunks/{chunk-VVRUSQCY.js → chunk-I57ID5K7.js} +13 -0
- package/chunks/{chunk-VYFGRLVQ.js → chunk-KOD2HX5I.js} +1 -1
- package/chunks/{chunk-ZKJPLWRJ.js → chunk-LOLVJNI5.js} +4 -4
- package/chunks/{chunk-GLWTVLKM.js → chunk-MN2AFJXM.js} +9 -2
- package/chunks/{chunk-WB6PWTMU.js → chunk-N5CJ5MTY.js} +1 -1
- package/chunks/{chunk-JXGF5EHC.js → chunk-NWJ37GI2.js} +23 -13
- package/chunks/{chunk-3ZJYGGAA.js → chunk-ORCUZITN.js} +1 -1
- package/chunks/{chunk-H467HDVV.js → chunk-QMLRYD76.js} +1 -1
- package/chunks/{chunk-43WALAW3.js → chunk-SEURG74P.js} +64 -115
- package/chunks/{chunk-G4HRW2FZ.js → chunk-SOV4POMS.js} +366 -253
- package/chunks/chunk-T34TL6KL.js +222 -0
- package/chunks/{chunk-WDIWLXLV.js → chunk-U6VE6JOS.js} +3 -3
- package/chunks/{chunk-MMWSCTDB.js → chunk-UFSFY7Z4.js} +19 -19
- package/chunks/{chunk-WIEXQUTD.js → chunk-ULRJZXMS.js} +1 -1
- package/chunks/{chunk-DHZW7Q7U.js → chunk-US54KYOJ.js} +2 -4
- package/chunks/{chunk-36LXIJIZ.js → chunk-V6LUKXBV.js} +1 -16
- package/chunks/{chunk-6M7TL2G2.js → chunk-VRZSDUZK.js} +45 -5
- package/chunks/chunk-VUXPDHTQ.js +22 -0
- package/chunks/chunk-XP5UM7SF.js +21 -0
- package/chunks/{chunk-IPZP3VRA.js → chunk-Y6XGC4K5.js} +5 -21
- package/chunks/{create.action-DBNIS665.js → create.action-ITEOQ644.js} +34 -32
- package/chunks/{delete.action-K7BLK7DK.js → delete.action-77MFPLUN.js} +29 -27
- package/chunks/{delete.action-GBOZC45K.js → delete.action-C6VX4S5Q.js} +30 -28
- package/chunks/{get.action-N3JOY3OU.js → get.action-3BP4FHZC.js} +16 -15
- package/chunks/{get.action-QHKMYZBK.js → get.action-LNBOWUVE.js} +24 -20
- package/chunks/{list.action-6SSO3JVN.js → list.action-6CRFQPJT.js} +39 -29
- package/chunks/{list.action-TJCS6UEY.js → list.action-KR5YIDR4.js} +37 -26
- package/chunks/{publish.action-T24VHRMR.js → publish.action-YBORRPBM.js} +45 -43
- package/chunks/{scripts-VIBLGKYG.js → scripts-6CI6U32J.js} +1 -1
- package/chunks/{update.action-VOE6PH5F.js → update.action-O7TSXDGV.js} +29 -27
- package/chunks/{update.action-OGYNBXRU.js → update.action-QZI7M2MV.js} +30 -28
- package/index.js +283 -278
- package/package.json +2 -2
- package/skills/scalar-cli/SKILL.md +49 -49
- package/template.md +66 -253
- package/chunks/action-FBRY5JKU.js +0 -37
- package/chunks/action-LYCNT3KA.js +0 -73
- package/chunks/action-OJ2NK25F.js +0 -121
- package/chunks/action-U2L5DCFG.js +0 -91
- package/chunks/chunk-MNNGUUKJ.js +0 -405
- package/chunks/chunk-ZGVZU6L2.js +0 -422
- package/docs.html +0 -6977
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
BaseCollections
|
|
4
|
+
} from "./chunk-NWJ37GI2.js";
|
|
5
|
+
import {
|
|
6
|
+
getDatabaseClient
|
|
7
|
+
} from "./chunk-U6VE6JOS.js";
|
|
8
|
+
import "./chunk-SEURG74P.js";
|
|
9
|
+
import "./chunk-3TFOA64C.js";
|
|
10
|
+
import "./chunk-5ENKYZA4.js";
|
|
11
|
+
import "./chunk-Y6XGC4K5.js";
|
|
12
|
+
import "./chunk-T34TL6KL.js";
|
|
13
|
+
import "./chunk-V6LUKXBV.js";
|
|
14
|
+
import "./chunk-VUXPDHTQ.js";
|
|
15
|
+
import {
|
|
16
|
+
getAuthData
|
|
17
|
+
} from "./chunk-3RIUDHLG.js";
|
|
18
|
+
import "./chunk-N5CJ5MTY.js";
|
|
19
|
+
import "./chunk-US54KYOJ.js";
|
|
20
|
+
import {
|
|
21
|
+
teamSchema
|
|
22
|
+
} from "./chunk-BQYVSPAI.js";
|
|
23
|
+
import "./chunk-VRZSDUZK.js";
|
|
24
|
+
import "./chunk-4ORL4MST.js";
|
|
25
|
+
import "./chunk-MN2AFJXM.js";
|
|
26
|
+
import {
|
|
27
|
+
output
|
|
28
|
+
} from "./chunk-T5HJUAWB.js";
|
|
29
|
+
import "./chunk-25XERWCE.js";
|
|
30
|
+
import "./chunk-AVZFSWPD.js";
|
|
31
|
+
import "./chunk-I57ID5K7.js";
|
|
32
|
+
import "./chunk-3MZYUBJ6.js";
|
|
33
|
+
|
|
34
|
+
// src/domains/auth/whoami/action.ts
|
|
35
|
+
import as from "ansis";
|
|
36
|
+
async function whoamiAction(options = {}) {
|
|
37
|
+
const auth = await getAuthData();
|
|
38
|
+
const team = await getDatabaseClient().then(
|
|
39
|
+
(client) => client.getOne({
|
|
40
|
+
collectionPath: BaseCollections.Teams,
|
|
41
|
+
query: { uid: auth.teamUid },
|
|
42
|
+
schema: teamSchema
|
|
43
|
+
})
|
|
44
|
+
).catch(() => null);
|
|
45
|
+
const details = {
|
|
46
|
+
email: auth.email,
|
|
47
|
+
team: {
|
|
48
|
+
uid: auth.teamUid,
|
|
49
|
+
name: team && !team.error ? team.data.name : null
|
|
50
|
+
},
|
|
51
|
+
role: auth.role ?? null,
|
|
52
|
+
authentication: "refreshToken" in auth ? "browser_session" : "personal_token"
|
|
53
|
+
};
|
|
54
|
+
if (options.json) {
|
|
55
|
+
process.stdout.write(`${JSON.stringify(details, null, 2)}
|
|
56
|
+
`);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
output.info().line(`User: ${as.cyan(details.email ?? "Unknown")}`).line(`Team: ${details.team.name ?? "Unavailable"}`).line(`Team ID: ${details.team.uid}`).line(`Role: ${as.cyan(details.role ?? "Unknown")}`).line(
|
|
60
|
+
`Authentication: ${details.authentication === "browser_session" ? "Browser session" : "Personal token"}`
|
|
61
|
+
).print();
|
|
62
|
+
}
|
|
63
|
+
export {
|
|
64
|
+
whoamiAction
|
|
65
|
+
};
|
|
@@ -6,37 +6,38 @@ import {
|
|
|
6
6
|
findConfig,
|
|
7
7
|
getCurrentFolderName,
|
|
8
8
|
scalarConfigSchema
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-CSSTCHHF.js";
|
|
10
10
|
import {
|
|
11
11
|
apiService
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-IPZP3VRA.js";
|
|
12
|
+
} from "./chunk-F3OPMYME.js";
|
|
13
|
+
import "./chunk-FG5AOTDN.js";
|
|
14
|
+
import "./chunk-SEURG74P.js";
|
|
15
|
+
import "./chunk-3TFOA64C.js";
|
|
17
16
|
import "./chunk-5ENKYZA4.js";
|
|
18
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-Y6XGC4K5.js";
|
|
18
|
+
import "./chunk-SOV4POMS.js";
|
|
19
|
+
import "./chunk-T34TL6KL.js";
|
|
19
20
|
import {
|
|
20
21
|
getMetadata
|
|
21
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-3RIUDHLG.js";
|
|
22
23
|
import {
|
|
23
24
|
config
|
|
24
|
-
} from "./chunk-
|
|
25
|
-
import "./chunk-
|
|
26
|
-
import "./chunk-
|
|
27
|
-
import "./chunk-
|
|
25
|
+
} from "./chunk-N5CJ5MTY.js";
|
|
26
|
+
import "./chunk-US54KYOJ.js";
|
|
27
|
+
import "./chunk-BQYVSPAI.js";
|
|
28
|
+
import "./chunk-VRZSDUZK.js";
|
|
28
29
|
import {
|
|
29
30
|
requireInteractive
|
|
30
31
|
} from "./chunk-EGOXR5FB.js";
|
|
31
|
-
import "./chunk-
|
|
32
|
-
import "./chunk-MNNGUUKJ.js";
|
|
32
|
+
import "./chunk-MN2AFJXM.js";
|
|
33
33
|
import {
|
|
34
34
|
output
|
|
35
35
|
} from "./chunk-T5HJUAWB.js";
|
|
36
|
-
import "./chunk-
|
|
36
|
+
import "./chunk-25XERWCE.js";
|
|
37
|
+
import "./chunk-AVZFSWPD.js";
|
|
37
38
|
import {
|
|
38
39
|
slugify
|
|
39
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-I57ID5K7.js";
|
|
40
41
|
import "./chunk-3MZYUBJ6.js";
|
|
41
42
|
|
|
42
43
|
// src/domains/project/init/action.ts
|
|
@@ -2003,21 +2004,21 @@ var __default = {
|
|
|
2003
2004
|
// src/domains/project/init/quickstart.ts
|
|
2004
2005
|
var quickstartMarkdown = `# Quickstart
|
|
2005
2006
|
|
|
2006
|
-
## 1. Preview
|
|
2007
|
+
## 1. Preview your documentation
|
|
2007
2008
|
|
|
2008
|
-
Run a local development server to see your changes
|
|
2009
|
+
Run a local development server to see your changes as you edit:
|
|
2009
2010
|
|
|
2010
2011
|
\`\`\`bash
|
|
2011
2012
|
npx @scalar/cli project preview
|
|
2012
2013
|
\`\`\`
|
|
2013
2014
|
|
|
2014
|
-
|
|
2015
|
+
The preview uses port 7970 by default and selects another port if it is unavailable. Open the URL printed by the command to see your changes.
|
|
2015
2016
|
|
|
2016
|
-
## 2. Customize
|
|
2017
|
+
## 2. Customize your documentation
|
|
2017
2018
|
|
|
2018
|
-
Make it yours with themes, custom CSS, and
|
|
2019
|
+
Make it yours with themes, custom CSS, and Markdown. Configure your documentation structure, navigation, and styling through \`scalar.config.json\`.
|
|
2019
2020
|
|
|
2020
|
-
## 3. Publish
|
|
2021
|
+
## 3. Publish your documentation
|
|
2021
2022
|
|
|
2022
2023
|
First, authenticate with your Scalar account:
|
|
2023
2024
|
|
|
@@ -2028,12 +2029,12 @@ npx @scalar/cli auth login
|
|
|
2028
2029
|
Then publish your documentation:
|
|
2029
2030
|
|
|
2030
2031
|
\`\`\`bash
|
|
2031
|
-
npx @scalar/cli project publish --slug
|
|
2032
|
+
npx @scalar/cli project publish --slug <project-slug>
|
|
2032
2033
|
\`\`\`
|
|
2033
2034
|
|
|
2034
|
-
|
|
2035
|
+
The command prints the deployment URL when publishing completes.
|
|
2035
2036
|
|
|
2036
|
-
##
|
|
2037
|
+
## Get help
|
|
2037
2038
|
|
|
2038
2039
|
Check whether your \`scalar.config.json\` is valid:
|
|
2039
2040
|
|
|
@@ -2063,12 +2064,12 @@ async function initAction({
|
|
|
2063
2064
|
}) {
|
|
2064
2065
|
const configFile = findConfig() || CONFIG_FILE_DEFAULT;
|
|
2065
2066
|
const nextSteps = () => {
|
|
2066
|
-
output.info().line("
|
|
2067
|
+
output.info().line("Next steps:").line(
|
|
2067
2068
|
` ${as.cyan("scalar project preview")} to preview your project locally`
|
|
2068
2069
|
).line(
|
|
2069
2070
|
` ${as.cyan("scalar project check-config")} to validate your scalar.config.json file`
|
|
2070
2071
|
).line(
|
|
2071
|
-
` ${as.cyan("scalar project publish --slug")} ${as.gray("
|
|
2072
|
+
` ${as.cyan("scalar project publish --slug")} ${as.gray("<project-slug>")} to publish your project`
|
|
2072
2073
|
).line(
|
|
2073
2074
|
as.white(
|
|
2074
2075
|
`Run ${as.magenta("scalar --help")} to see all available commands.`
|
|
@@ -2093,7 +2094,7 @@ async function initAction({
|
|
|
2093
2094
|
);
|
|
2094
2095
|
}
|
|
2095
2096
|
const shouldOverwriteExisting = force ?? await confirm({
|
|
2096
|
-
message: "
|
|
2097
|
+
message: "Overwrite the existing configuration file?",
|
|
2097
2098
|
initialValue: false
|
|
2098
2099
|
});
|
|
2099
2100
|
if (isCancel(shouldOverwriteExisting)) {
|
|
@@ -2147,7 +2148,7 @@ async function initAction({
|
|
|
2147
2148
|
}
|
|
2148
2149
|
while (true) {
|
|
2149
2150
|
const response = suppliedSubdomain ?? await text({
|
|
2150
|
-
message: "
|
|
2151
|
+
message: "Enter the project name",
|
|
2151
2152
|
defaultValue: folderName,
|
|
2152
2153
|
placeholder: folderName
|
|
2153
2154
|
});
|
|
@@ -2168,7 +2169,9 @@ async function initAction({
|
|
|
2168
2169
|
if (apiClient) {
|
|
2169
2170
|
const result = await apiClient.publish.getDomainAvailability(`${slug}.${config.publishTld}`).catch(() => null);
|
|
2170
2171
|
if (!result || result.error) {
|
|
2171
|
-
return output.error().message(
|
|
2172
|
+
return output.error().message(
|
|
2173
|
+
"Could not check subdomain availability. Check your connection and authentication before running the command again."
|
|
2174
|
+
).exit("error");
|
|
2172
2175
|
}
|
|
2173
2176
|
if (!result.data.available) {
|
|
2174
2177
|
const message = `Subdomain "${slug}" is already taken. Choose another name.`;
|
|
@@ -5,25 +5,25 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
getFileOrUrl,
|
|
7
7
|
isDocument
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-4JKXZ5CF.js";
|
|
9
9
|
import {
|
|
10
10
|
isAsyncApiDocument,
|
|
11
11
|
safeNormalize
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-QMLRYD76.js";
|
|
13
13
|
import {
|
|
14
14
|
requireInteractive
|
|
15
15
|
} from "./chunk-EGOXR5FB.js";
|
|
16
|
-
import "./chunk-GLWTVLKM.js";
|
|
17
16
|
import {
|
|
18
17
|
isUrl,
|
|
19
18
|
isYamlFileName
|
|
20
19
|
} from "./chunk-4ORL4MST.js";
|
|
21
|
-
import "./chunk-
|
|
20
|
+
import "./chunk-MN2AFJXM.js";
|
|
22
21
|
import {
|
|
23
22
|
output
|
|
24
23
|
} from "./chunk-T5HJUAWB.js";
|
|
25
|
-
import "./chunk-
|
|
26
|
-
import "./chunk-
|
|
24
|
+
import "./chunk-25XERWCE.js";
|
|
25
|
+
import "./chunk-AVZFSWPD.js";
|
|
26
|
+
import "./chunk-I57ID5K7.js";
|
|
27
27
|
import "./chunk-3MZYUBJ6.js";
|
|
28
28
|
|
|
29
29
|
// src/domains/document/upgrade/action.ts
|
|
@@ -35,24 +35,22 @@ import { upgrade as upgradeAsyncApi } from "@scalar/asyncapi-upgrader";
|
|
|
35
35
|
import { upgrade } from "@scalar/openapi-upgrader";
|
|
36
36
|
async function upgradeAction(input, { output: outputFilePath }) {
|
|
37
37
|
if (!input) {
|
|
38
|
-
return output.error().title("Missing input").message("
|
|
38
|
+
return output.error().title("Missing input").message("Provide a file path or URL to upgrade.").exit("error");
|
|
39
39
|
}
|
|
40
40
|
const isUrlInput = isUrl(input);
|
|
41
41
|
if (!outputFilePath) {
|
|
42
42
|
if (isUrlInput) {
|
|
43
|
-
return output.error().message(
|
|
44
|
-
"Please provide an output file using the -o flag when upgrading from a URL."
|
|
45
|
-
).exit("error");
|
|
43
|
+
return output.error().message("URL input requires an output file. Use `--output <file>`.").exit("error");
|
|
46
44
|
}
|
|
47
45
|
requireInteractive(
|
|
48
46
|
"Pass --output to upgrade a document in non-interactive mode."
|
|
49
47
|
);
|
|
50
48
|
const shouldContinue = await confirm({
|
|
51
|
-
message:
|
|
49
|
+
message: `No output file was specified. Overwrite "${input}"?`,
|
|
52
50
|
initialValue: false
|
|
53
51
|
});
|
|
54
52
|
if (shouldContinue !== true) {
|
|
55
|
-
return output.error().message("Operation cancelled
|
|
53
|
+
return output.error().message("Operation cancelled.").exit("error");
|
|
56
54
|
}
|
|
57
55
|
}
|
|
58
56
|
const outputFileName = outputFilePath ?? input;
|
|
@@ -60,7 +58,7 @@ async function upgradeAction(input, { output: outputFilePath }) {
|
|
|
60
58
|
const document = safeNormalize(content);
|
|
61
59
|
if (!isDocument(document)) {
|
|
62
60
|
return output.error().title("Invalid input").message(
|
|
63
|
-
"Could not read a document from the input.
|
|
61
|
+
"Could not read a document from the input. Provide a valid JSON or YAML file."
|
|
64
62
|
).exit("error");
|
|
65
63
|
}
|
|
66
64
|
const isAsyncApi = isAsyncApiDocument(document);
|
|
@@ -76,8 +74,8 @@ async function upgradeAction(input, { output: outputFilePath }) {
|
|
|
76
74
|
const version = upgraded[isAsyncApi ? "asyncapi" : "openapi"];
|
|
77
75
|
const versionSuffix = typeof version === "string" ? ` to version ${version}` : "";
|
|
78
76
|
output.info().message(
|
|
79
|
-
`${as.green(
|
|
80
|
-
).print();
|
|
77
|
+
`${as.green(`${specification} description upgraded${versionSuffix}`)} (${as.white(`${as.bold(`${executionTimeMs.toFixed(2)}`)} ms`)})`
|
|
78
|
+
).line(`Written to ${as.cyan(outputFileName)}`).print();
|
|
81
79
|
}
|
|
82
80
|
export {
|
|
83
81
|
upgradeAction
|
|
@@ -4,23 +4,23 @@ import {
|
|
|
4
4
|
} from "./chunk-KHDYYVYF.js";
|
|
5
5
|
import {
|
|
6
6
|
isDocument
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-4JKXZ5CF.js";
|
|
8
8
|
import {
|
|
9
9
|
isAsyncApiDocument
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-QMLRYD76.js";
|
|
11
11
|
import {
|
|
12
12
|
requireInteractive
|
|
13
13
|
} from "./chunk-EGOXR5FB.js";
|
|
14
|
-
import "./chunk-GLWTVLKM.js";
|
|
15
14
|
import {
|
|
16
15
|
isUrl
|
|
17
16
|
} from "./chunk-4ORL4MST.js";
|
|
18
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-MN2AFJXM.js";
|
|
19
18
|
import {
|
|
20
19
|
output
|
|
21
20
|
} from "./chunk-T5HJUAWB.js";
|
|
22
|
-
import "./chunk-
|
|
23
|
-
import "./chunk-
|
|
21
|
+
import "./chunk-25XERWCE.js";
|
|
22
|
+
import "./chunk-AVZFSWPD.js";
|
|
23
|
+
import "./chunk-I57ID5K7.js";
|
|
24
24
|
import "./chunk-3MZYUBJ6.js";
|
|
25
25
|
|
|
26
26
|
// src/domains/document/split/action.ts
|
|
@@ -188,7 +188,7 @@ async function splitAsyncApi(document, outputPath) {
|
|
|
188
188
|
// src/domains/document/split/action.ts
|
|
189
189
|
async function splitAction(input, { output: __outputPath }) {
|
|
190
190
|
if (!input) {
|
|
191
|
-
return output.error().title("Missing input").message("
|
|
191
|
+
return output.error().title("Missing input").message("Provide a file path or URL to split.").exit("error");
|
|
192
192
|
}
|
|
193
193
|
const getOutputPath = async () => {
|
|
194
194
|
if (__outputPath !== void 0 && typeof __outputPath === "string") {
|
|
@@ -203,7 +203,7 @@ async function splitAction(input, { output: __outputPath }) {
|
|
|
203
203
|
placeholder: "./assets"
|
|
204
204
|
});
|
|
205
205
|
if (typeof outputPath2 !== "string") {
|
|
206
|
-
return output.error().message("Operation cancelled
|
|
206
|
+
return output.error().message("Operation cancelled.").exit("error");
|
|
207
207
|
}
|
|
208
208
|
return outputPath2;
|
|
209
209
|
};
|
|
@@ -219,7 +219,7 @@ async function splitAction(input, { output: __outputPath }) {
|
|
|
219
219
|
}).catch(() => null);
|
|
220
220
|
if (!isDocument(document)) {
|
|
221
221
|
return output.error().title("Invalid input").message(
|
|
222
|
-
"Could not read an OpenAPI or AsyncAPI document from the input.
|
|
222
|
+
"Could not read an OpenAPI or AsyncAPI document from the input. Provide a valid JSON or YAML file."
|
|
223
223
|
).exit("error");
|
|
224
224
|
}
|
|
225
225
|
const { executionTimeMs } = await measureTime(async () => {
|
|
@@ -245,7 +245,7 @@ async function splitAction(input, { output: __outputPath }) {
|
|
|
245
245
|
);
|
|
246
246
|
await fs2.rm(workspaceFilePath);
|
|
247
247
|
});
|
|
248
|
-
output.info().line().title(as.green("
|
|
248
|
+
output.info().line().title(as.green("API description split")).line().message(`Written to ${as.blue(outputPath)}`).line(`Completed (${as.yellow(executionTimeMs.toFixed(2))} ms)`).line("").print();
|
|
249
249
|
}
|
|
250
250
|
export {
|
|
251
251
|
splitAction
|
|
@@ -4,27 +4,27 @@ import {
|
|
|
4
4
|
} from "./chunk-KHDYYVYF.js";
|
|
5
5
|
import {
|
|
6
6
|
isDocument
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-4JKXZ5CF.js";
|
|
8
8
|
import {
|
|
9
9
|
isAsyncApiDocument,
|
|
10
10
|
safeNormalize
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-QMLRYD76.js";
|
|
12
12
|
import {
|
|
13
13
|
err,
|
|
14
14
|
ok
|
|
15
15
|
} from "./chunk-5ENKYZA4.js";
|
|
16
|
-
import "./chunk-GLWTVLKM.js";
|
|
17
16
|
import {
|
|
18
17
|
isYamlFileName
|
|
19
18
|
} from "./chunk-4ORL4MST.js";
|
|
20
|
-
import "./chunk-
|
|
19
|
+
import "./chunk-MN2AFJXM.js";
|
|
21
20
|
import {
|
|
22
21
|
output
|
|
23
22
|
} from "./chunk-T5HJUAWB.js";
|
|
24
|
-
import "./chunk-
|
|
23
|
+
import "./chunk-25XERWCE.js";
|
|
24
|
+
import "./chunk-AVZFSWPD.js";
|
|
25
25
|
import {
|
|
26
26
|
external_exports
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-I57ID5K7.js";
|
|
28
28
|
import "./chunk-3MZYUBJ6.js";
|
|
29
29
|
|
|
30
30
|
// src/domains/document/join/action.ts
|
|
@@ -301,14 +301,16 @@ async function joinAction(rawInput, rawOpt) {
|
|
|
301
301
|
}).safeParse(rawOpt);
|
|
302
302
|
if (optsError) {
|
|
303
303
|
return output.error().title("Invalid options").line("").line(
|
|
304
|
-
optsError.issues.map(
|
|
304
|
+
optsError.issues.map(
|
|
305
|
+
(e) => e.path[0] === "output" ? "Provide an output file with --output <file>." : `${e.message} (option: ${e.path.join(".")})`
|
|
306
|
+
).join("\n")
|
|
305
307
|
).line("").exit("error");
|
|
306
308
|
}
|
|
307
309
|
const files = (await Promise.all(input.map((file) => fs.readFile(file, "utf-8")))).map((it) => {
|
|
308
310
|
const document = safeNormalize(it);
|
|
309
311
|
if (!isDocument(document)) {
|
|
310
312
|
return output.error().title("Invalid input").message(
|
|
311
|
-
"Could not read an API document from one of the input files.
|
|
313
|
+
"Could not read an API document from one of the input files. Provide valid JSON or YAML files."
|
|
312
314
|
).exit("error");
|
|
313
315
|
}
|
|
314
316
|
return document;
|
|
@@ -326,7 +328,7 @@ async function joinAction(rawInput, rawOpt) {
|
|
|
326
328
|
});
|
|
327
329
|
if (!isDocument(document)) {
|
|
328
330
|
return output.error().title("Invalid input").message(
|
|
329
|
-
"Could not read an API document from one of the input files.
|
|
331
|
+
"Could not read an API document from one of the input files. Provide valid JSON or YAML files."
|
|
330
332
|
).exit("error");
|
|
331
333
|
}
|
|
332
334
|
return document;
|
|
@@ -349,8 +351,8 @@ ${formatErrorMessage(result.error).join("\n")}`).line().exit("error");
|
|
|
349
351
|
"utf8"
|
|
350
352
|
);
|
|
351
353
|
output.info().message(
|
|
352
|
-
`${as.green(
|
|
353
|
-
).print();
|
|
354
|
+
`${as.green(`${specification} descriptions joined`)} (${as.white(`${as.bold(`${Math.round(executionTimeMs)}`)} ms`)})`
|
|
355
|
+
).line(`Written to ${as.cyan(opts.output)}`).print();
|
|
354
356
|
}
|
|
355
357
|
export {
|
|
356
358
|
joinAction
|
|
@@ -1,28 +1,29 @@
|
|
|
1
1
|
import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
apiService
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-IPZP3VRA.js";
|
|
4
|
+
} from "./chunk-F3OPMYME.js";
|
|
5
|
+
import "./chunk-FG5AOTDN.js";
|
|
6
|
+
import "./chunk-SEURG74P.js";
|
|
7
|
+
import "./chunk-3TFOA64C.js";
|
|
9
8
|
import "./chunk-5ENKYZA4.js";
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-Y6XGC4K5.js";
|
|
10
|
+
import "./chunk-SOV4POMS.js";
|
|
11
|
+
import "./chunk-T34TL6KL.js";
|
|
12
|
+
import "./chunk-3RIUDHLG.js";
|
|
13
|
+
import "./chunk-N5CJ5MTY.js";
|
|
14
|
+
import "./chunk-US54KYOJ.js";
|
|
15
|
+
import "./chunk-BQYVSPAI.js";
|
|
16
|
+
import "./chunk-VRZSDUZK.js";
|
|
16
17
|
import {
|
|
17
18
|
requireInteractive
|
|
18
19
|
} from "./chunk-EGOXR5FB.js";
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-MNNGUUKJ.js";
|
|
20
|
+
import "./chunk-MN2AFJXM.js";
|
|
21
21
|
import {
|
|
22
22
|
output
|
|
23
23
|
} from "./chunk-T5HJUAWB.js";
|
|
24
|
-
import "./chunk-
|
|
25
|
-
import "./chunk-
|
|
24
|
+
import "./chunk-25XERWCE.js";
|
|
25
|
+
import "./chunk-AVZFSWPD.js";
|
|
26
|
+
import "./chunk-I57ID5K7.js";
|
|
26
27
|
import "./chunk-3MZYUBJ6.js";
|
|
27
28
|
|
|
28
29
|
// src/domains/registry/update/action.ts
|
|
@@ -31,31 +32,33 @@ import as from "ansis";
|
|
|
31
32
|
async function updateAction(namespace, slug, { title, description }) {
|
|
32
33
|
const client = await apiService();
|
|
33
34
|
if (!namespace) {
|
|
34
|
-
return output.error().title("Invalid input").message("
|
|
35
|
+
return output.error().title("Invalid input").message("Provide the team namespace as the first argument.").exit("error");
|
|
35
36
|
}
|
|
36
37
|
if (!slug) {
|
|
37
|
-
return output.error().title("Invalid input").message("
|
|
38
|
+
return output.error().title("Invalid input").message("Provide the API description slug as the second argument.").exit("error");
|
|
38
39
|
}
|
|
39
40
|
let titleValue = title;
|
|
40
41
|
let descriptionValue = description;
|
|
41
42
|
const shouldPrompt = ![title, description].some((it) => it !== void 0);
|
|
42
43
|
if (shouldPrompt) {
|
|
43
|
-
requireInteractive("
|
|
44
|
+
requireInteractive("Provide --title or --description.");
|
|
44
45
|
}
|
|
45
46
|
if (!titleValue && shouldPrompt) {
|
|
46
47
|
titleValue = await text({
|
|
47
|
-
message: `
|
|
48
|
+
message: `Enter the new API description title ${as.grey("(optional)")}`
|
|
48
49
|
});
|
|
49
50
|
}
|
|
50
51
|
if (!descriptionValue && shouldPrompt) {
|
|
51
52
|
descriptionValue = await text({
|
|
52
|
-
message: `
|
|
53
|
+
message: `Enter the new API description summary ${as.grey("(optional)")}`
|
|
53
54
|
});
|
|
54
55
|
}
|
|
55
56
|
if (!titleValue && !descriptionValue) {
|
|
56
|
-
return output.error().title("Invalid input").message(
|
|
57
|
+
return output.error().title("Invalid input").message(
|
|
58
|
+
"Provide --title or --description to update the API description."
|
|
59
|
+
).exit("error");
|
|
57
60
|
}
|
|
58
|
-
const logger = output.info().line().loader("Updating the
|
|
61
|
+
const logger = output.info().line().loader("Updating the API description\u2026");
|
|
59
62
|
const updateDocument = await client.managedDocs.update(namespace, slug, {
|
|
60
63
|
title: titleValue,
|
|
61
64
|
description: descriptionValue
|
|
@@ -64,7 +67,7 @@ async function updateAction(namespace, slug, { title, description }) {
|
|
|
64
67
|
return output.error().title(updateDocument.message).exit("error");
|
|
65
68
|
}
|
|
66
69
|
logger.update("loader", 0, {
|
|
67
|
-
content: "
|
|
70
|
+
content: "API description metadata updated."
|
|
68
71
|
}).print();
|
|
69
72
|
}
|
|
70
73
|
export {
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
apiService
|
|
4
|
+
} from "./chunk-F3OPMYME.js";
|
|
5
|
+
import "./chunk-FG5AOTDN.js";
|
|
6
|
+
import "./chunk-SEURG74P.js";
|
|
7
|
+
import "./chunk-3TFOA64C.js";
|
|
8
|
+
import "./chunk-5ENKYZA4.js";
|
|
9
|
+
import "./chunk-Y6XGC4K5.js";
|
|
10
|
+
import "./chunk-SOV4POMS.js";
|
|
11
|
+
import "./chunk-T34TL6KL.js";
|
|
12
|
+
import "./chunk-3RIUDHLG.js";
|
|
13
|
+
import "./chunk-N5CJ5MTY.js";
|
|
14
|
+
import "./chunk-US54KYOJ.js";
|
|
15
|
+
import "./chunk-BQYVSPAI.js";
|
|
16
|
+
import "./chunk-VRZSDUZK.js";
|
|
17
|
+
import "./chunk-MN2AFJXM.js";
|
|
18
|
+
import {
|
|
19
|
+
output
|
|
20
|
+
} from "./chunk-T5HJUAWB.js";
|
|
21
|
+
import "./chunk-25XERWCE.js";
|
|
22
|
+
import "./chunk-AVZFSWPD.js";
|
|
23
|
+
import "./chunk-I57ID5K7.js";
|
|
24
|
+
import "./chunk-3MZYUBJ6.js";
|
|
25
|
+
|
|
26
|
+
// src/domains/registry/delete/action.ts
|
|
27
|
+
async function deleteAction(namespace, slug) {
|
|
28
|
+
const client = await apiService();
|
|
29
|
+
const logger = output.info().line().loader("Deleting the API description\u2026");
|
|
30
|
+
const deleteDocument = await client.managedDocs.delete(namespace, slug);
|
|
31
|
+
if (deleteDocument.error) {
|
|
32
|
+
return output.error().title(deleteDocument.message).exit("error");
|
|
33
|
+
}
|
|
34
|
+
logger.update("loader", 0, { content: "API description deleted." }).print();
|
|
35
|
+
}
|
|
36
|
+
export {
|
|
37
|
+
deleteAction
|
|
38
|
+
};
|
|
@@ -32,7 +32,7 @@ var bootServer = async ({
|
|
|
32
32
|
},
|
|
33
33
|
(info) => {
|
|
34
34
|
output.info().line(
|
|
35
|
-
`${as.green.bold("\u279C
|
|
35
|
+
`${as.green.bold("\u279C Request-mirroring server")} ${as.white(
|
|
36
36
|
"listening on"
|
|
37
37
|
)} ${as.cyan(`http://localhost:${info.port}`)}
|
|
38
38
|
`
|