@scalar/cli 2.8.0 → 2.10.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 +281 -65
- package/chunks/action-4GZI2M5B.js +62 -0
- package/chunks/action-4W5GUGEG.js +63 -0
- package/chunks/{action-FCAYFPVR.js → action-5LF4XYHX.js} +10 -7
- package/chunks/{action-XIUO64C7.js → action-5N3P43MD.js} +17 -12
- package/chunks/{action-Y7OUGD56.js → action-5RL4NWUZ.js} +17 -17
- package/chunks/{action-LXGXKXZZ.js → action-657A4K2D.js} +16 -16
- package/chunks/{action-EOAVVL52.js → action-7XOHYWYM.js} +11 -14
- package/chunks/{action-AQRPFQKI.js → action-CABLS46Q.js} +9 -7
- package/chunks/{action-F7A2K74G.js → action-CB55NWAU.js} +9 -13
- package/chunks/{action-5SK5NE7E.js → action-DKDRAIKV.js} +11 -14
- package/chunks/{action-7PEQXDWT.js → action-DTEO4YNX.js} +127 -20
- package/chunks/{action-UIKH4SZX.js → action-EAUTQ77U.js} +27 -23
- package/chunks/{action-YLF2G4G5.js → action-FBRY5JKU.js} +16 -16
- package/chunks/{action-VOFDW3U2.js → action-GFLRD7LO.js} +6 -5
- package/chunks/{action-GWXLHL2Z.js → action-GWYYTUTM.js} +4 -3
- package/chunks/{action-6BYGBXRC.js → action-HT42NUUX.js} +27 -22
- package/chunks/action-JEYDBB3P.js +147 -0
- package/chunks/{action-LLH4QPXM.js → action-KDUFU7TZ.js} +11 -13
- package/chunks/{action-W3C53GPH.js → action-LYCNT3KA.js} +29 -10
- package/chunks/{action-CA4QYPI6.js → action-OJ2NK25F.js} +4 -8
- package/chunks/{action-NVI5DWFP.js → action-PAM2EZ22.js} +4 -8
- package/chunks/action-PPTFYZWD.js +1552 -0
- package/chunks/{action-43YBNBDR.js → action-R4PGILN4.js} +28 -24
- package/chunks/{action-QQZLPI42.js → action-TOBU74JH.js} +23 -19
- package/chunks/action-U2L5DCFG.js +91 -0
- package/chunks/{action-H6OUJWWM.js → action-UUL6SWV4.js} +11 -14
- package/chunks/{action-354TUG4H.js → action-X7BA7PQQ.js} +10 -8
- package/chunks/{action-WFDNRA7D.js → action-XLE37MZL.js} +16 -16
- package/chunks/{action-Y6NXJQ4H.js → action-XOADBXSX.js} +16 -12
- package/chunks/{action-LEUD5P2U.js → action-YSVTZVKV.js} +36 -17
- package/chunks/{action-YRX6SN5F.js → action-ZFI77WA5.js} +8 -6
- package/chunks/{action-HT2DJ34Z.js → action-ZKA3RR3S.js} +15 -11
- package/chunks/{actions-OGIVBQC7.js → actions-3SAMH7A5.js} +41 -17
- package/chunks/{agent-ASPV3R5U.js → agent-2ESZI7NO.js} +7 -5
- package/chunks/{asyncapi-QNFKXHEI.js → asyncapi-4HGVM3PR.js} +14 -10
- package/chunks/{build.action-NM6CAE5F.js → build.action-VBGFGACM.js} +19 -17
- package/chunks/chunk-35Z7VTJT.js +453 -0
- package/chunks/chunk-36LXIJIZ.js +52 -0
- package/chunks/{chunk-KKRGBXCE.js → chunk-43WALAW3.js} +248 -103
- package/chunks/{chunk-C2KAWRIX.js → chunk-5ENKYZA4.js} +1 -1
- package/chunks/{chunk-GTV2BVXV.js → chunk-5SMP756H.js} +2 -2
- package/chunks/{chunk-5JLVQVKO.js → chunk-6M7TL2G2.js} +146 -148
- package/chunks/chunk-6PSYZO3U.js +24 -0
- package/chunks/{chunk-EXY3ZTV4.js → chunk-ATNTXKMS.js} +36 -274
- package/chunks/{chunk-PH3WFNXJ.js → chunk-BIMLCGKS.js} +1 -1
- package/chunks/{chunk-HGOD6THU.js → chunk-CWVYOXXM.js} +2 -19
- package/chunks/chunk-DFOZG7ZV.js +15 -0
- package/chunks/chunk-DHZW7Q7U.js +133 -0
- package/chunks/{chunk-R5LK6VPY.js → chunk-G4HRW2FZ.js} +13 -20
- package/chunks/{chunk-KCCFN4F7.js → chunk-GLWTVLKM.js} +29 -29
- package/chunks/{chunk-5UHLAJQD.js → chunk-GYRQPDTK.js} +24 -10
- package/chunks/chunk-H467HDVV.js +24 -0
- package/chunks/chunk-IPZP3VRA.js +327 -0
- package/chunks/{chunk-2OCWX42S.js → chunk-JXGF5EHC.js} +152 -18
- package/chunks/chunk-K2HIB5BA.js +92 -0
- package/chunks/{chunk-FDC2IESH.js → chunk-KHF2QXBG.js} +1352 -8327
- package/chunks/{chunk-IMG35UXX.js → chunk-KZNRQVMY.js} +1 -1
- package/chunks/{chunk-OJ2EWIJH.js → chunk-MC4EMNOR.js} +5 -1
- package/chunks/{chunk-YILQODZF.js → chunk-MMWSCTDB.js} +7 -4
- package/chunks/{chunk-6XWCMJDB.js → chunk-MNNGUUKJ.js} +12 -11
- package/chunks/chunk-NAC63XJF.js +10 -0
- package/chunks/{chunk-XXSQUBXS.js → chunk-UDBSV3CK.js} +107 -453
- package/chunks/{chunk-IKT5F47M.js → chunk-VVRUSQCY.js} +11 -11
- package/chunks/{chunk-BPGFSSUH.js → chunk-VYFGRLVQ.js} +1 -1
- package/chunks/{chunk-UXJ753NV.js → chunk-WB6PWTMU.js} +5 -13
- package/chunks/{chunk-5DEU2DVL.js → chunk-WDIWLXLV.js} +3 -15
- package/chunks/{chunk-6YPQGVF4.js → chunk-WIEXQUTD.js} +1 -1
- package/chunks/{chunk-W24BETFG.js → chunk-XAGJJNQW.js} +3 -3
- package/chunks/{chunk-22HYZ7LE.js → chunk-ZGNDXPLU.js} +3 -3
- package/chunks/{chunk-XEDGMZJD.js → chunk-ZGVZU6L2.js} +81 -25
- package/chunks/{chunk-L3UXDCBI.js → chunk-ZKJPLWRJ.js} +2 -2
- package/chunks/{chunk-MLSZVVTT.js → chunk-ZYBLQ5CT.js} +13 -7
- package/chunks/{create.action-FUQ2BVJA.js → create.action-DBNIS665.js} +19 -17
- package/chunks/{delete.action-BTDFH7WY.js → delete.action-GBOZC45K.js} +19 -17
- package/chunks/{delete.action-47E66R3I.js → delete.action-K7BLK7DK.js} +19 -17
- package/chunks/{get.action-XC7KC2JO.js → get.action-N3JOY3OU.js} +17 -12
- package/chunks/get.action-QHKMYZBK.js +91 -0
- package/chunks/{list.action-LXKEUYKO.js → list.action-6SSO3JVN.js} +45 -15
- package/chunks/{list.action-OFGLMRE7.js → list.action-TJCS6UEY.js} +39 -19
- package/chunks/{publish.action-OS27XOX4.js → publish.action-T24VHRMR.js} +27 -22
- package/chunks/query-WKATAJJ6.js +129 -0
- package/chunks/scripts-VIBLGKYG.js +102 -0
- package/chunks/{update.action-ZMS4CQ3T.js → update.action-OGYNBXRU.js} +23 -18
- package/chunks/{update.action-AEIBLCWD.js → update.action-VOE6PH5F.js} +23 -18
- package/docs.html +941 -209
- package/index.js +374 -182
- package/package.json +14 -13
- package/skills/scalar-cli/SKILL.md +7 -1
- package/template.md +148 -26
- package/chunks/action-JAHFRYWZ.js +0 -423
- package/chunks/action-KTYOCA2V.js +0 -229
- package/chunks/chunk-K74E42RV.js +0 -7311
- package/chunks/chunk-QVQ4PNVL.js +0 -610
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
resolveProject
|
|
4
|
+
} from "./chunk-TSURUX4A.js";
|
|
5
|
+
import {
|
|
6
|
+
projectDetails
|
|
7
|
+
} from "./chunk-6PSYZO3U.js";
|
|
8
|
+
import {
|
|
9
|
+
formatAbsoluteTime
|
|
10
|
+
} from "./chunk-AEFPCC4U.js";
|
|
11
|
+
import {
|
|
12
|
+
apiService
|
|
13
|
+
} from "./chunk-ATNTXKMS.js";
|
|
14
|
+
import "./chunk-43WALAW3.js";
|
|
15
|
+
import "./chunk-ZYBLQ5CT.js";
|
|
16
|
+
import "./chunk-KHF2QXBG.js";
|
|
17
|
+
import "./chunk-IPZP3VRA.js";
|
|
18
|
+
import "./chunk-5ENKYZA4.js";
|
|
19
|
+
import "./chunk-G4HRW2FZ.js";
|
|
20
|
+
import "./chunk-35Z7VTJT.js";
|
|
21
|
+
import "./chunk-WB6PWTMU.js";
|
|
22
|
+
import "./chunk-DHZW7Q7U.js";
|
|
23
|
+
import "./chunk-GYRQPDTK.js";
|
|
24
|
+
import "./chunk-6M7TL2G2.js";
|
|
25
|
+
import "./chunk-GLWTVLKM.js";
|
|
26
|
+
import "./chunk-MNNGUUKJ.js";
|
|
27
|
+
import {
|
|
28
|
+
output
|
|
29
|
+
} from "./chunk-T5HJUAWB.js";
|
|
30
|
+
import "./chunk-ZGVZU6L2.js";
|
|
31
|
+
import {
|
|
32
|
+
slugSchema
|
|
33
|
+
} from "./chunk-VVRUSQCY.js";
|
|
34
|
+
import "./chunk-3MZYUBJ6.js";
|
|
35
|
+
|
|
36
|
+
// src/domains/project/get/action.ts
|
|
37
|
+
async function getAction(slug, options) {
|
|
38
|
+
const parsed = slugSchema.safeParse(slug);
|
|
39
|
+
if (!parsed.success) {
|
|
40
|
+
return output.error().title("Invalid slug").message(parsed.error.issues[0].message).exit("error");
|
|
41
|
+
}
|
|
42
|
+
const client = await apiService();
|
|
43
|
+
const resolved = await resolveProject(parsed.data, client);
|
|
44
|
+
if (resolved.kind === "not-found") {
|
|
45
|
+
return output.error().title("Project not found").message(
|
|
46
|
+
`No project with slug "${slug}" was found for your team. Run scalar project list to find your project slug.`
|
|
47
|
+
).exit("error");
|
|
48
|
+
}
|
|
49
|
+
const project = projectDetails(resolved.project);
|
|
50
|
+
if (options.json) {
|
|
51
|
+
console.log(JSON.stringify(project));
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const deployment = project.activeDeployment;
|
|
55
|
+
output.info().title(project.name).line(`Slug: ${project.slug}`).line(`UID: ${project.uid}`).line(
|
|
56
|
+
`Source: ${project.provider === "forgejo" ? "Scalar" : project.provider}`
|
|
57
|
+
).line(`Access: ${project.isPrivate ? "Private" : "Public"}`).line(`Repository: ${project.repository?.name ?? "(unlinked)"}`).line(`Branch: ${project.repository?.branch || "\u2014"}`).line(`Config path: ${project.repository?.configPath || "\u2014"}`).line(`Live deployment: ${deployment?.uid ?? "(none)"}`).line(`Domain: ${deployment?.domain ?? "\u2014"}`).line(
|
|
58
|
+
`Deployed: ${deployment ? formatAbsoluteTime(deployment.publishedAt * 1e3) : "\u2014"}`
|
|
59
|
+
).print();
|
|
60
|
+
}
|
|
61
|
+
export {
|
|
62
|
+
getAction
|
|
63
|
+
};
|
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
|
|
2
2
|
import {
|
|
3
|
-
getFileOrUrl
|
|
3
|
+
getFileOrUrl
|
|
4
|
+
} from "./chunk-CWVYOXXM.js";
|
|
5
|
+
import {
|
|
4
6
|
isAsyncApiContent
|
|
5
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-H467HDVV.js";
|
|
6
8
|
import {
|
|
7
9
|
config
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-WB6PWTMU.js";
|
|
11
|
+
import "./chunk-DHZW7Q7U.js";
|
|
12
|
+
import "./chunk-GLWTVLKM.js";
|
|
11
13
|
import "./chunk-4ORL4MST.js";
|
|
14
|
+
import "./chunk-MNNGUUKJ.js";
|
|
12
15
|
import {
|
|
13
16
|
output
|
|
14
17
|
} from "./chunk-T5HJUAWB.js";
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
18
|
+
import "./chunk-ZGVZU6L2.js";
|
|
19
|
+
import "./chunk-VVRUSQCY.js";
|
|
17
20
|
import "./chunk-3MZYUBJ6.js";
|
|
18
21
|
|
|
19
22
|
// src/domains/document/share/action.ts
|
|
@@ -1,28 +1,33 @@
|
|
|
1
1
|
import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
fetchFromRegistry
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-BIMLCGKS.js";
|
|
5
|
+
import "./chunk-5SMP756H.js";
|
|
6
6
|
import {
|
|
7
7
|
registry
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-MMWSCTDB.js";
|
|
9
|
+
import {
|
|
10
|
+
DOCUMENT_FORMATS
|
|
11
|
+
} from "./chunk-NAC63XJF.js";
|
|
12
|
+
import "./chunk-36LXIJIZ.js";
|
|
9
13
|
import {
|
|
10
14
|
getAuthData
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
15
|
+
} from "./chunk-35Z7VTJT.js";
|
|
16
|
+
import "./chunk-WB6PWTMU.js";
|
|
17
|
+
import "./chunk-DHZW7Q7U.js";
|
|
18
|
+
import "./chunk-GYRQPDTK.js";
|
|
19
|
+
import "./chunk-6M7TL2G2.js";
|
|
20
|
+
import "./chunk-GLWTVLKM.js";
|
|
17
21
|
import "./chunk-4ORL4MST.js";
|
|
22
|
+
import "./chunk-MNNGUUKJ.js";
|
|
18
23
|
import {
|
|
19
24
|
output
|
|
20
25
|
} from "./chunk-T5HJUAWB.js";
|
|
21
|
-
import "./chunk-
|
|
26
|
+
import "./chunk-ZGVZU6L2.js";
|
|
22
27
|
import {
|
|
23
28
|
docVersionSchema,
|
|
24
29
|
external_exports
|
|
25
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-VVRUSQCY.js";
|
|
26
31
|
import "./chunk-3MZYUBJ6.js";
|
|
27
32
|
|
|
28
33
|
// src/domains/registry/get/action.ts
|
|
@@ -39,7 +44,7 @@ async function getAction(namespace, slug, args) {
|
|
|
39
44
|
}
|
|
40
45
|
const result = external_exports.object({
|
|
41
46
|
version: versionSchema,
|
|
42
|
-
format: external_exports.enum(
|
|
47
|
+
format: external_exports.enum(DOCUMENT_FORMATS),
|
|
43
48
|
output: external_exports.string().min(1).optional()
|
|
44
49
|
}).safeParse({
|
|
45
50
|
version: args.version ?? "latest",
|
|
@@ -6,37 +6,37 @@ import {
|
|
|
6
6
|
findConfig,
|
|
7
7
|
getCurrentFolderName,
|
|
8
8
|
scalarConfigSchema
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-UDBSV3CK.js";
|
|
10
10
|
import {
|
|
11
11
|
apiService
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-ATNTXKMS.js";
|
|
13
|
+
import "./chunk-43WALAW3.js";
|
|
14
|
+
import "./chunk-ZYBLQ5CT.js";
|
|
15
|
+
import "./chunk-KHF2QXBG.js";
|
|
16
|
+
import "./chunk-IPZP3VRA.js";
|
|
17
|
+
import "./chunk-5ENKYZA4.js";
|
|
18
|
+
import "./chunk-G4HRW2FZ.js";
|
|
18
19
|
import {
|
|
19
20
|
getMetadata
|
|
20
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-35Z7VTJT.js";
|
|
21
22
|
import {
|
|
22
23
|
config
|
|
23
|
-
} from "./chunk-
|
|
24
|
-
import "./chunk-
|
|
25
|
-
import "./chunk-
|
|
24
|
+
} from "./chunk-WB6PWTMU.js";
|
|
25
|
+
import "./chunk-DHZW7Q7U.js";
|
|
26
|
+
import "./chunk-GYRQPDTK.js";
|
|
27
|
+
import "./chunk-6M7TL2G2.js";
|
|
26
28
|
import {
|
|
27
29
|
requireInteractive
|
|
28
30
|
} from "./chunk-EGOXR5FB.js";
|
|
29
|
-
import "./chunk-
|
|
30
|
-
import "./chunk-
|
|
31
|
-
import "./chunk-6XWCMJDB.js";
|
|
32
|
-
import "./chunk-4ORL4MST.js";
|
|
31
|
+
import "./chunk-GLWTVLKM.js";
|
|
32
|
+
import "./chunk-MNNGUUKJ.js";
|
|
33
33
|
import {
|
|
34
34
|
output
|
|
35
35
|
} from "./chunk-T5HJUAWB.js";
|
|
36
|
-
import "./chunk-
|
|
36
|
+
import "./chunk-ZGVZU6L2.js";
|
|
37
37
|
import {
|
|
38
38
|
slugify
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-VVRUSQCY.js";
|
|
40
40
|
import "./chunk-3MZYUBJ6.js";
|
|
41
41
|
|
|
42
42
|
// src/domains/project/init/action.ts
|
|
@@ -1,28 +1,28 @@
|
|
|
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-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-ATNTXKMS.js";
|
|
5
|
+
import "./chunk-43WALAW3.js";
|
|
6
|
+
import "./chunk-ZYBLQ5CT.js";
|
|
7
|
+
import "./chunk-KHF2QXBG.js";
|
|
8
|
+
import "./chunk-IPZP3VRA.js";
|
|
9
|
+
import "./chunk-5ENKYZA4.js";
|
|
10
|
+
import "./chunk-G4HRW2FZ.js";
|
|
11
|
+
import "./chunk-35Z7VTJT.js";
|
|
12
|
+
import "./chunk-WB6PWTMU.js";
|
|
13
|
+
import "./chunk-DHZW7Q7U.js";
|
|
14
|
+
import "./chunk-GYRQPDTK.js";
|
|
15
|
+
import "./chunk-6M7TL2G2.js";
|
|
14
16
|
import {
|
|
15
17
|
requireInteractive
|
|
16
18
|
} from "./chunk-EGOXR5FB.js";
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-6XWCMJDB.js";
|
|
20
|
-
import "./chunk-4ORL4MST.js";
|
|
19
|
+
import "./chunk-GLWTVLKM.js";
|
|
20
|
+
import "./chunk-MNNGUUKJ.js";
|
|
21
21
|
import {
|
|
22
22
|
output
|
|
23
23
|
} from "./chunk-T5HJUAWB.js";
|
|
24
|
-
import "./chunk-
|
|
25
|
-
import "./chunk-
|
|
24
|
+
import "./chunk-ZGVZU6L2.js";
|
|
25
|
+
import "./chunk-VVRUSQCY.js";
|
|
26
26
|
import "./chunk-3MZYUBJ6.js";
|
|
27
27
|
|
|
28
28
|
// src/domains/registry/update/action.ts
|
|
@@ -2,38 +2,35 @@ import { createRequire as $$cR } from "node:module"; const require = $$cR(import
|
|
|
2
2
|
import {
|
|
3
3
|
measureTime
|
|
4
4
|
} from "./chunk-KHDYYVYF.js";
|
|
5
|
-
import "./chunk-
|
|
5
|
+
import "./chunk-CWVYOXXM.js";
|
|
6
|
+
import "./chunk-H467HDVV.js";
|
|
6
7
|
import {
|
|
7
8
|
DEFAULT_FETCH_CONCURRENCY
|
|
8
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-MC4EMNOR.js";
|
|
10
|
+
import "./chunk-DFOZG7ZV.js";
|
|
9
11
|
import {
|
|
10
12
|
requireInteractive
|
|
11
13
|
} from "./chunk-EGOXR5FB.js";
|
|
12
|
-
import
|
|
13
|
-
require_dist
|
|
14
|
-
} from "./chunk-K74E42RV.js";
|
|
15
|
-
import "./chunk-KCCFN4F7.js";
|
|
16
|
-
import "./chunk-6XWCMJDB.js";
|
|
14
|
+
import "./chunk-GLWTVLKM.js";
|
|
17
15
|
import {
|
|
18
16
|
isUrl,
|
|
19
17
|
isYamlFileName
|
|
20
18
|
} from "./chunk-4ORL4MST.js";
|
|
19
|
+
import "./chunk-MNNGUUKJ.js";
|
|
21
20
|
import {
|
|
22
21
|
output
|
|
23
22
|
} from "./chunk-T5HJUAWB.js";
|
|
24
|
-
import "./chunk-
|
|
25
|
-
import "./chunk-
|
|
26
|
-
import
|
|
27
|
-
__toESM
|
|
28
|
-
} from "./chunk-3MZYUBJ6.js";
|
|
23
|
+
import "./chunk-ZGVZU6L2.js";
|
|
24
|
+
import "./chunk-VVRUSQCY.js";
|
|
25
|
+
import "./chunk-3MZYUBJ6.js";
|
|
29
26
|
|
|
30
27
|
// src/domains/document/bundle/action.ts
|
|
31
|
-
var import_yaml = __toESM(require_dist(), 1);
|
|
32
28
|
import fs from "node:fs/promises";
|
|
33
29
|
import path from "node:path";
|
|
34
30
|
import { cwd } from "node:process";
|
|
35
31
|
import { confirm } from "@clack/prompts";
|
|
36
32
|
import as from "ansis";
|
|
33
|
+
import YAML from "yaml";
|
|
37
34
|
import { bundle } from "@scalar/json-magic/bundle";
|
|
38
35
|
import { fetchUrls, readFiles } from "@scalar/json-magic/bundle/plugins/node";
|
|
39
36
|
async function bundleAction(input, {
|
|
@@ -80,7 +77,7 @@ async function bundleAction(input, {
|
|
|
80
77
|
);
|
|
81
78
|
await fs.writeFile(
|
|
82
79
|
outputFilePath ?? input,
|
|
83
|
-
isYaml ?
|
|
80
|
+
isYaml ? YAML.stringify(result) : JSON.stringify(result),
|
|
84
81
|
"utf8"
|
|
85
82
|
);
|
|
86
83
|
output.info().message(
|
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
|
|
2
2
|
import {
|
|
3
|
-
isAsyncApiDocument,
|
|
4
3
|
isDocument
|
|
5
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-CWVYOXXM.js";
|
|
5
|
+
import {
|
|
6
|
+
isAsyncApiDocument
|
|
7
|
+
} from "./chunk-H467HDVV.js";
|
|
6
8
|
import {
|
|
7
9
|
err,
|
|
8
10
|
ok
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-6XWCMJDB.js";
|
|
11
|
+
} from "./chunk-5ENKYZA4.js";
|
|
12
|
+
import "./chunk-GLWTVLKM.js";
|
|
12
13
|
import {
|
|
13
14
|
isUrl
|
|
14
15
|
} from "./chunk-4ORL4MST.js";
|
|
16
|
+
import "./chunk-MNNGUUKJ.js";
|
|
15
17
|
import {
|
|
16
18
|
output
|
|
17
19
|
} from "./chunk-T5HJUAWB.js";
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
20
|
+
import "./chunk-ZGVZU6L2.js";
|
|
21
|
+
import "./chunk-VVRUSQCY.js";
|
|
20
22
|
import "./chunk-3MZYUBJ6.js";
|
|
21
23
|
|
|
22
24
|
// src/domains/document/validate/action.ts
|
|
@@ -1,28 +1,24 @@
|
|
|
1
1
|
import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
getFileOrUrl
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
} from "./chunk-K74E42RV.js";
|
|
8
|
-
import "./chunk-KCCFN4F7.js";
|
|
9
|
-
import "./chunk-6XWCMJDB.js";
|
|
4
|
+
} from "./chunk-CWVYOXXM.js";
|
|
5
|
+
import "./chunk-H467HDVV.js";
|
|
6
|
+
import "./chunk-GLWTVLKM.js";
|
|
10
7
|
import {
|
|
11
8
|
isYamlFileName
|
|
12
9
|
} from "./chunk-4ORL4MST.js";
|
|
10
|
+
import "./chunk-MNNGUUKJ.js";
|
|
13
11
|
import {
|
|
14
12
|
output
|
|
15
13
|
} from "./chunk-T5HJUAWB.js";
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import
|
|
19
|
-
__toESM
|
|
20
|
-
} from "./chunk-3MZYUBJ6.js";
|
|
14
|
+
import "./chunk-ZGVZU6L2.js";
|
|
15
|
+
import "./chunk-VVRUSQCY.js";
|
|
16
|
+
import "./chunk-3MZYUBJ6.js";
|
|
21
17
|
|
|
22
18
|
// src/domains/document/postman/action.ts
|
|
23
|
-
var import_yaml = __toESM(require_dist(), 1);
|
|
24
19
|
import fs from "node:fs";
|
|
25
20
|
import as from "ansis";
|
|
21
|
+
import YAML from "yaml";
|
|
26
22
|
import { convert } from "@scalar/postman-to-openapi";
|
|
27
23
|
async function convertAction(inputArgument, {
|
|
28
24
|
output: outputPath,
|
|
@@ -41,7 +37,7 @@ async function convertAction(inputArgument, {
|
|
|
41
37
|
} catch {
|
|
42
38
|
return output.error().title("Failed to convert Postman collection").message("The provided input is not a valid Postman collection").exit("error");
|
|
43
39
|
}
|
|
44
|
-
const openApiDocument = outputPath ? isYamlFileName(outputPath) ?
|
|
40
|
+
const openApiDocument = outputPath ? isYamlFileName(outputPath) ? YAML.stringify(specification) : JSON.stringify(specification, null, 2) : JSON.stringify(specification, null, 2);
|
|
45
41
|
if (outputPath) {
|
|
46
42
|
fs.writeFileSync(outputPath, openApiDocument, "utf8");
|
|
47
43
|
const endTime = performance.now();
|
|
@@ -4,36 +4,33 @@ import {
|
|
|
4
4
|
} from "./chunk-KHDYYVYF.js";
|
|
5
5
|
import {
|
|
6
6
|
getFileOrUrl,
|
|
7
|
+
isDocument
|
|
8
|
+
} from "./chunk-CWVYOXXM.js";
|
|
9
|
+
import {
|
|
7
10
|
isAsyncApiDocument,
|
|
8
|
-
isDocument,
|
|
9
11
|
safeNormalize
|
|
10
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-H467HDVV.js";
|
|
11
13
|
import {
|
|
12
14
|
requireInteractive
|
|
13
15
|
} from "./chunk-EGOXR5FB.js";
|
|
14
|
-
import
|
|
15
|
-
require_dist
|
|
16
|
-
} from "./chunk-K74E42RV.js";
|
|
17
|
-
import "./chunk-KCCFN4F7.js";
|
|
18
|
-
import "./chunk-6XWCMJDB.js";
|
|
16
|
+
import "./chunk-GLWTVLKM.js";
|
|
19
17
|
import {
|
|
20
18
|
isUrl,
|
|
21
19
|
isYamlFileName
|
|
22
20
|
} from "./chunk-4ORL4MST.js";
|
|
21
|
+
import "./chunk-MNNGUUKJ.js";
|
|
23
22
|
import {
|
|
24
23
|
output
|
|
25
24
|
} from "./chunk-T5HJUAWB.js";
|
|
26
|
-
import "./chunk-
|
|
27
|
-
import "./chunk-
|
|
28
|
-
import
|
|
29
|
-
__toESM
|
|
30
|
-
} from "./chunk-3MZYUBJ6.js";
|
|
25
|
+
import "./chunk-ZGVZU6L2.js";
|
|
26
|
+
import "./chunk-VVRUSQCY.js";
|
|
27
|
+
import "./chunk-3MZYUBJ6.js";
|
|
31
28
|
|
|
32
29
|
// src/domains/document/upgrade/action.ts
|
|
33
|
-
var import_yaml = __toESM(require_dist(), 1);
|
|
34
30
|
import fs from "node:fs/promises";
|
|
35
31
|
import { confirm } from "@clack/prompts";
|
|
36
32
|
import as from "ansis";
|
|
33
|
+
import YAML from "yaml";
|
|
37
34
|
import { upgrade as upgradeAsyncApi } from "@scalar/asyncapi-upgrader";
|
|
38
35
|
import { upgrade } from "@scalar/openapi-upgrader";
|
|
39
36
|
async function upgradeAction(input, { output: outputFilePath }) {
|
|
@@ -73,7 +70,7 @@ async function upgradeAction(input, { output: outputFilePath }) {
|
|
|
73
70
|
const isYaml = isYamlFileName(outputFileName);
|
|
74
71
|
await fs.writeFile(
|
|
75
72
|
outputFileName,
|
|
76
|
-
isYaml ?
|
|
73
|
+
isYaml ? YAML.stringify(upgraded) : JSON.stringify(upgraded, null, 2)
|
|
77
74
|
);
|
|
78
75
|
const specification = isAsyncApi ? "AsyncAPI" : "OpenAPI";
|
|
79
76
|
const version = upgraded[isAsyncApi ? "asyncapi" : "openapi"];
|
|
@@ -2,38 +2,38 @@ import { createRequire as $$cR } from "node:module"; const require = $$cR(import
|
|
|
2
2
|
import {
|
|
3
3
|
measureTime
|
|
4
4
|
} from "./chunk-KHDYYVYF.js";
|
|
5
|
+
import {
|
|
6
|
+
isDocument
|
|
7
|
+
} from "./chunk-CWVYOXXM.js";
|
|
5
8
|
import {
|
|
6
9
|
isAsyncApiDocument,
|
|
7
|
-
isDocument,
|
|
8
10
|
safeNormalize
|
|
9
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-H467HDVV.js";
|
|
10
12
|
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
import "./chunk-
|
|
13
|
+
err,
|
|
14
|
+
ok
|
|
15
|
+
} from "./chunk-5ENKYZA4.js";
|
|
16
|
+
import "./chunk-GLWTVLKM.js";
|
|
15
17
|
import {
|
|
16
18
|
isYamlFileName
|
|
17
19
|
} from "./chunk-4ORL4MST.js";
|
|
20
|
+
import "./chunk-MNNGUUKJ.js";
|
|
18
21
|
import {
|
|
19
22
|
output
|
|
20
23
|
} from "./chunk-T5HJUAWB.js";
|
|
21
|
-
import "./chunk-
|
|
24
|
+
import "./chunk-ZGVZU6L2.js";
|
|
22
25
|
import {
|
|
23
26
|
external_exports
|
|
24
|
-
} from "./chunk-
|
|
25
|
-
import
|
|
26
|
-
__toESM
|
|
27
|
-
} from "./chunk-3MZYUBJ6.js";
|
|
27
|
+
} from "./chunk-VVRUSQCY.js";
|
|
28
|
+
import "./chunk-3MZYUBJ6.js";
|
|
28
29
|
|
|
29
30
|
// src/domains/document/join/action.ts
|
|
30
|
-
var import_yaml = __toESM(require_dist(), 1);
|
|
31
31
|
import fs from "node:fs/promises";
|
|
32
32
|
import path from "node:path";
|
|
33
33
|
import as from "ansis";
|
|
34
|
-
import
|
|
34
|
+
import YAML from "yaml";
|
|
35
|
+
import { bundle as bundle2 } from "@scalar/json-magic/bundle";
|
|
35
36
|
import { fetchUrls, readFiles } from "@scalar/json-magic/bundle/plugins/node";
|
|
36
|
-
import { join } from "@scalar/openapi-parser";
|
|
37
37
|
|
|
38
38
|
// src/domains/document/join/helpers.ts
|
|
39
39
|
import { getValueByPath as getValueByPathWithContext } from "@scalar/json-magic/helpers/get-value-by-path";
|
|
@@ -171,6 +171,111 @@ var joinAsyncApi = (inputs, prefixes) => {
|
|
|
171
171
|
return conflicts.length ? { ok: false, conflicts } : { ok: true, document: result };
|
|
172
172
|
};
|
|
173
173
|
|
|
174
|
+
// ../../node_modules/.pnpm/@scalar+helpers@0.16.1/node_modules/@scalar/helpers/dist/object/prevent-pollution.js
|
|
175
|
+
var PROTOTYPE_POLLUTION_KEYS = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]);
|
|
176
|
+
var isPollutionKey = (key) => PROTOTYPE_POLLUTION_KEYS.has(key);
|
|
177
|
+
|
|
178
|
+
// src/domains/document/join/openapi.ts
|
|
179
|
+
import { bundle } from "@scalar/json-magic/bundle";
|
|
180
|
+
import { join } from "@scalar/json-magic/join";
|
|
181
|
+
import { upgrade as upgrade2 } from "@scalar/openapi-upgrader";
|
|
182
|
+
var omitEmptySection = (value) => {
|
|
183
|
+
if (Array.isArray(value)) return value.length ? value : void 0;
|
|
184
|
+
if (isDocument(value)) return Object.keys(value).length ? value : void 0;
|
|
185
|
+
return value ?? void 0;
|
|
186
|
+
};
|
|
187
|
+
var prefixComponents = async (document, prefix) => {
|
|
188
|
+
await bundle(document, {
|
|
189
|
+
treeShake: false,
|
|
190
|
+
urlMap: false,
|
|
191
|
+
plugins: [
|
|
192
|
+
{
|
|
193
|
+
type: "lifecycle",
|
|
194
|
+
onBeforeNodeProcess: (node) => {
|
|
195
|
+
const ref = node.$ref;
|
|
196
|
+
if (typeof ref !== "string" || !ref.startsWith("#/components/"))
|
|
197
|
+
return;
|
|
198
|
+
const parts = ref.split("/");
|
|
199
|
+
if (parts.length < 4) return;
|
|
200
|
+
parts[3] = `${prefix}${parts[3]}`;
|
|
201
|
+
node.$ref = parts.join("/");
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
type: "lifecycle",
|
|
206
|
+
onBeforeNodeProcess: (node, context) => {
|
|
207
|
+
if (context.path.length !== 2 || context.path[0] !== "components")
|
|
208
|
+
return;
|
|
209
|
+
for (const key of Object.keys(node)) {
|
|
210
|
+
const value = node[key];
|
|
211
|
+
delete node[key];
|
|
212
|
+
const name = `${prefix}${key}`;
|
|
213
|
+
if (!isPollutionKey(key) && !isPollutionKey(name))
|
|
214
|
+
node[name] = value;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
]
|
|
219
|
+
});
|
|
220
|
+
};
|
|
221
|
+
var joinOpenApi = async (inputs, prefixes) => {
|
|
222
|
+
const documents = await Promise.all(
|
|
223
|
+
inputs.map(async (input, index) => {
|
|
224
|
+
const document = upgrade2(structuredClone(input), "3.1");
|
|
225
|
+
await prefixComponents(document, prefixes[index] ?? "");
|
|
226
|
+
return {
|
|
227
|
+
...document,
|
|
228
|
+
info: isDocument(document.info) ? document.info : {},
|
|
229
|
+
paths: document.paths ?? {},
|
|
230
|
+
webhooks: document.webhooks ?? {},
|
|
231
|
+
components: document.components ?? {},
|
|
232
|
+
tags: document.tags ?? [],
|
|
233
|
+
servers: document.servers ?? []
|
|
234
|
+
};
|
|
235
|
+
})
|
|
236
|
+
);
|
|
237
|
+
const result = join(documents.reverse(), {
|
|
238
|
+
strategy: ({ path: path2, current }) => {
|
|
239
|
+
const [field] = path2;
|
|
240
|
+
if (isPollutionKey(path2.at(-1) ?? "") && (field === "info" || field === "components" || path2.length === 2))
|
|
241
|
+
return "skip";
|
|
242
|
+
if (field === "info") return "merge-by-index";
|
|
243
|
+
if (field === "tags") return { uniqueBy: "name" };
|
|
244
|
+
if (field === "servers") return { uniqueBy: "url" };
|
|
245
|
+
if (field === "paths" || field === "webhooks" || field === "components") {
|
|
246
|
+
if (path2.length < 3) return "merge";
|
|
247
|
+
return field === "components" && !current ? "replace" : "conflict";
|
|
248
|
+
}
|
|
249
|
+
return "replace";
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
if (!result.ok) {
|
|
253
|
+
const conflicts = [];
|
|
254
|
+
for (const field of ["paths", "webhooks", "components"]) {
|
|
255
|
+
for (const { path: path2 } of result.conflicts) {
|
|
256
|
+
if (path2[0] !== field) continue;
|
|
257
|
+
conflicts.push(
|
|
258
|
+
field === "components" ? { type: "component", componentType: path2[1], name: path2[2] } : {
|
|
259
|
+
type: field === "paths" ? "path" : "webhook",
|
|
260
|
+
path: path2[1],
|
|
261
|
+
method: path2[2]
|
|
262
|
+
}
|
|
263
|
+
);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
return err(conflicts);
|
|
267
|
+
}
|
|
268
|
+
return ok({
|
|
269
|
+
...result.document,
|
|
270
|
+
info: result.document.info ?? {},
|
|
271
|
+
paths: result.document.paths ?? {},
|
|
272
|
+
webhooks: omitEmptySection(result.document.webhooks),
|
|
273
|
+
tags: omitEmptySection(result.document.tags),
|
|
274
|
+
servers: omitEmptySection(result.document.servers),
|
|
275
|
+
components: omitEmptySection(result.document.components)
|
|
276
|
+
});
|
|
277
|
+
};
|
|
278
|
+
|
|
174
279
|
// src/domains/document/join/action.ts
|
|
175
280
|
var formatErrorMessage = (conflicts) => {
|
|
176
281
|
return conflicts.map((conflict) => {
|
|
@@ -215,7 +320,7 @@ async function joinAction(rawInput, rawOpt) {
|
|
|
215
320
|
const specification = asyncApiCount ? "AsyncAPI" : "OpenAPI";
|
|
216
321
|
const documents = asyncApiCount ? await Promise.all(
|
|
217
322
|
input.map(async (file) => {
|
|
218
|
-
const document = await
|
|
323
|
+
const document = await bundle2(path.resolve(file), {
|
|
219
324
|
plugins: [readFiles(), fetchUrls()],
|
|
220
325
|
treeShake: false
|
|
221
326
|
});
|
|
@@ -228,17 +333,19 @@ async function joinAction(rawInput, rawOpt) {
|
|
|
228
333
|
})
|
|
229
334
|
) : files;
|
|
230
335
|
const prefixes = opts.prefixComponentsWithPathValue ? getPrefixes(files, opts.prefixComponentsWithPathValue) : [];
|
|
231
|
-
const { executionTimeMs, result } = await measureTime(
|
|
232
|
-
|
|
233
|
-
|
|
336
|
+
const { executionTimeMs, result } = await measureTime(async () => {
|
|
337
|
+
if (!asyncApiCount) return joinOpenApi(files, prefixes);
|
|
338
|
+
const joined = joinAsyncApi(documents, prefixes);
|
|
339
|
+
return joined.ok ? ok(joined.document) : err(joined.conflicts);
|
|
340
|
+
});
|
|
234
341
|
if (!result.ok) {
|
|
235
342
|
return output.error().title(`Failed to join ${specification} documents`).line().line(`Conflicts:
|
|
236
|
-
${formatErrorMessage(result.
|
|
343
|
+
${formatErrorMessage(result.error).join("\n")}`).line().exit("error");
|
|
237
344
|
}
|
|
238
345
|
const isYaml = isYamlFileName(opts.output);
|
|
239
346
|
await fs.writeFile(
|
|
240
347
|
opts.output,
|
|
241
|
-
isYaml ?
|
|
348
|
+
isYaml ? YAML.stringify(result.data) : JSON.stringify(result.data, null, 2),
|
|
242
349
|
"utf8"
|
|
243
350
|
);
|
|
244
351
|
output.info().message(
|