@scalar/cli 2.7.1 → 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 +475 -80
- package/chunks/action-4GZI2M5B.js +62 -0
- package/chunks/action-4W5GUGEG.js +63 -0
- package/chunks/{action-HJYZCPUN.js → action-5LF4XYHX.js} +10 -7
- package/chunks/{action-SRBN7N3R.js → action-5N3P43MD.js} +17 -12
- package/chunks/{action-RBOLLIGX.js → action-5RL4NWUZ.js} +17 -17
- package/chunks/{action-SNPOOW6S.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-BAQYJ6UE.js → action-EAUTQ77U.js} +27 -23
- package/chunks/{action-QYGOPSTY.js → action-FBRY5JKU.js} +16 -16
- package/chunks/{action-VOFDW3U2.js → action-GFLRD7LO.js} +6 -5
- package/chunks/{action-LPVITMWA.js → action-GWYYTUTM.js} +4 -3
- package/chunks/{action-4NGK5XMD.js → action-HT42NUUX.js} +29 -24
- package/chunks/action-JEYDBB3P.js +147 -0
- package/chunks/{action-E4YSRFGT.js → action-KDUFU7TZ.js} +11 -13
- package/chunks/{action-BRSSC2SR.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-OX2566BE.js → action-R4PGILN4.js} +30 -26
- package/chunks/{action-CPLH2CQ5.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-T5XMJXPO.js → action-X7BA7PQQ.js} +10 -8
- package/chunks/{action-LVDU6YOI.js → action-XLE37MZL.js} +16 -16
- package/chunks/{action-BOZNBCNZ.js → action-XOADBXSX.js} +16 -12
- package/chunks/{action-SCOXTCPR.js → action-YSVTZVKV.js} +38 -19
- package/chunks/{action-YRX6SN5F.js → action-ZFI77WA5.js} +8 -6
- package/chunks/{action-ATGZOWSH.js → action-ZKA3RR3S.js} +15 -11
- package/chunks/actions-3SAMH7A5.js +182 -0
- package/chunks/{agent-ASPV3R5U.js → agent-2ESZI7NO.js} +7 -5
- package/chunks/{asyncapi-H4FU6GPC.js → asyncapi-4HGVM3PR.js} +14 -10
- package/chunks/{build.action-6V6GXI3X.js → build.action-VBGFGACM.js} +21 -19
- package/chunks/chunk-35Z7VTJT.js +453 -0
- package/chunks/chunk-36LXIJIZ.js +52 -0
- package/chunks/{chunk-BIKOD3SG.js → chunk-43WALAW3.js} +251 -103
- package/chunks/{chunk-C2KAWRIX.js → chunk-5ENKYZA4.js} +1 -1
- package/chunks/{chunk-ZJVYOZFB.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-ISXH6Q7I.js → chunk-ATNTXKMS.js} +45 -274
- package/chunks/{chunk-BDEPNGTO.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-LG7IFACX.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-2PPRO2QB.js → chunk-VYFGRLVQ.js} +1 -1
- package/chunks/{chunk-GPNB7ISG.js → chunk-WB6PWTMU.js} +5 -13
- package/chunks/{chunk-4X47MN6Q.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-2DSVF5AD.js → chunk-ZGNDXPLU.js} +3 -3
- package/chunks/{chunk-XEDGMZJD.js → chunk-ZGVZU6L2.js} +81 -25
- package/chunks/{chunk-QXQZVEDC.js → chunk-ZKJPLWRJ.js} +2 -2
- package/chunks/{chunk-MLSZVVTT.js → chunk-ZYBLQ5CT.js} +13 -7
- package/chunks/{create.action-P6DLCK4W.js → create.action-DBNIS665.js} +21 -19
- package/chunks/{delete.action-HJKRRHE2.js → delete.action-GBOZC45K.js} +21 -19
- package/chunks/{delete.action-Z3GAA4ZN.js → delete.action-K7BLK7DK.js} +21 -19
- package/chunks/{get.action-IT4EHAV4.js → get.action-N3JOY3OU.js} +17 -12
- package/chunks/get.action-QHKMYZBK.js +91 -0
- package/chunks/{list.action-WLIAO5UW.js → list.action-6SSO3JVN.js} +45 -15
- package/chunks/{list.action-2FU5UZNH.js → list.action-TJCS6UEY.js} +41 -21
- package/chunks/{publish.action-T4J4DRXR.js → publish.action-T24VHRMR.js} +29 -24
- package/chunks/query-WKATAJJ6.js +129 -0
- package/chunks/scripts-VIBLGKYG.js +102 -0
- package/chunks/{update.action-3OVS3HWC.js → update.action-OGYNBXRU.js} +24 -19
- package/chunks/{update.action-MY7QPSSU.js → update.action-VOE6PH5F.js} +24 -19
- package/docs.html +1363 -320
- package/index.js +417 -174
- package/package.json +14 -13
- package/skills/scalar-cli/SKILL.md +13 -1
- package/template.md +157 -15
- package/chunks/action-JAHFRYWZ.js +0 -423
- package/chunks/action-N7BA5I3E.js +0 -229
- package/chunks/chunk-CWCETP6H.js +0 -610
- package/chunks/chunk-K74E42RV.js +0 -7311
|
@@ -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/schema/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",
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
inspectSdk
|
|
4
|
+
} from "./chunk-K2HIB5BA.js";
|
|
5
|
+
import {
|
|
6
|
+
BaseCollections
|
|
7
|
+
} from "./chunk-JXGF5EHC.js";
|
|
8
|
+
import {
|
|
9
|
+
getDatabaseClient
|
|
10
|
+
} from "./chunk-WDIWLXLV.js";
|
|
11
|
+
import "./chunk-43WALAW3.js";
|
|
12
|
+
import "./chunk-ZYBLQ5CT.js";
|
|
13
|
+
import "./chunk-KHF2QXBG.js";
|
|
14
|
+
import {
|
|
15
|
+
sdkBuildSchema,
|
|
16
|
+
sdkSchema
|
|
17
|
+
} from "./chunk-IPZP3VRA.js";
|
|
18
|
+
import "./chunk-5ENKYZA4.js";
|
|
19
|
+
import "./chunk-36LXIJIZ.js";
|
|
20
|
+
import {
|
|
21
|
+
getAuthData
|
|
22
|
+
} from "./chunk-35Z7VTJT.js";
|
|
23
|
+
import "./chunk-WB6PWTMU.js";
|
|
24
|
+
import "./chunk-DHZW7Q7U.js";
|
|
25
|
+
import {
|
|
26
|
+
teamSchema
|
|
27
|
+
} from "./chunk-GYRQPDTK.js";
|
|
28
|
+
import "./chunk-6M7TL2G2.js";
|
|
29
|
+
import "./chunk-GLWTVLKM.js";
|
|
30
|
+
import "./chunk-4ORL4MST.js";
|
|
31
|
+
import "./chunk-MNNGUUKJ.js";
|
|
32
|
+
import {
|
|
33
|
+
output
|
|
34
|
+
} from "./chunk-T5HJUAWB.js";
|
|
35
|
+
import "./chunk-ZGVZU6L2.js";
|
|
36
|
+
import {
|
|
37
|
+
external_exports,
|
|
38
|
+
namespaceSchema,
|
|
39
|
+
slugSchema
|
|
40
|
+
} from "./chunk-VVRUSQCY.js";
|
|
41
|
+
import "./chunk-3MZYUBJ6.js";
|
|
42
|
+
|
|
43
|
+
// src/domains/sdk/get.action.ts
|
|
44
|
+
async function getAction(args) {
|
|
45
|
+
const result = external_exports.object({ slug: slugSchema, namespace: namespaceSchema.optional() }).safeParse(args);
|
|
46
|
+
if (result.error)
|
|
47
|
+
return output.error().title("Invalid input").message(result.error.issues[0].message).exit("error");
|
|
48
|
+
const auth = await getAuthData();
|
|
49
|
+
const client = await getDatabaseClient();
|
|
50
|
+
const team = await client.getOne({
|
|
51
|
+
collectionPath: BaseCollections.Teams,
|
|
52
|
+
query: { uid: auth.teamUid },
|
|
53
|
+
schema: teamSchema
|
|
54
|
+
});
|
|
55
|
+
if (team.error)
|
|
56
|
+
return output.error().title("An error occurred when fetching your team.").message(team.message).exit("error");
|
|
57
|
+
const namespace = result.data.namespace || team.data.namespaces.at(0);
|
|
58
|
+
if (!namespace)
|
|
59
|
+
return output.error().title("Missing namespace").message("Please specify a namespace for your SDK.").exit("error");
|
|
60
|
+
const sdk = await client.getOne({
|
|
61
|
+
collectionPath: BaseCollections.Sdks(team.data.uid),
|
|
62
|
+
query: { namespace, slug: result.data.slug },
|
|
63
|
+
schema: sdkSchema
|
|
64
|
+
});
|
|
65
|
+
if (sdk.error)
|
|
66
|
+
return output.error().title("Unable to fetch SDK").message(sdk.message).exit("error");
|
|
67
|
+
const builds = await client.getMany({
|
|
68
|
+
collectionPath: BaseCollections.SdkBuilds(team.data.uid),
|
|
69
|
+
query: { "sdk.uid": sdk.data.uid },
|
|
70
|
+
schema: sdkBuildSchema.array()
|
|
71
|
+
});
|
|
72
|
+
if (builds.error)
|
|
73
|
+
return output.error().title("Unable to fetch SDK builds").message(builds.message).exit("error");
|
|
74
|
+
const metadata = await inspectSdk(
|
|
75
|
+
client,
|
|
76
|
+
team.data.uid,
|
|
77
|
+
sdk.data,
|
|
78
|
+
builds.data
|
|
79
|
+
);
|
|
80
|
+
if (!metadata.ok)
|
|
81
|
+
return output.error().title("Unable to fetch SDK API source").message(metadata.error).exit("error");
|
|
82
|
+
if (args.json) {
|
|
83
|
+
process.stdout.write(`${JSON.stringify(metadata.data, null, 2)}
|
|
84
|
+
`);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
output.info().title(`@${namespace}/${sdk.data.slug}`).line(JSON.stringify(metadata.data, null, 2)).print();
|
|
88
|
+
}
|
|
89
|
+
export {
|
|
90
|
+
getAction
|
|
91
|
+
};
|
|
@@ -2,40 +2,45 @@ import { createRequire as $$cR } from "node:module"; const require = $$cR(import
|
|
|
2
2
|
import {
|
|
3
3
|
formatAbsoluteTime
|
|
4
4
|
} from "./chunk-AEFPCC4U.js";
|
|
5
|
+
import {
|
|
6
|
+
inspectSdk
|
|
7
|
+
} from "./chunk-K2HIB5BA.js";
|
|
5
8
|
import {
|
|
6
9
|
BaseCollections
|
|
7
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-JXGF5EHC.js";
|
|
8
11
|
import {
|
|
9
12
|
getDatabaseClient
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
+
} from "./chunk-WDIWLXLV.js";
|
|
14
|
+
import "./chunk-43WALAW3.js";
|
|
15
|
+
import "./chunk-ZYBLQ5CT.js";
|
|
16
|
+
import "./chunk-KHF2QXBG.js";
|
|
13
17
|
import {
|
|
14
18
|
sdkBuildSchema,
|
|
15
19
|
sdkSchema
|
|
16
|
-
} from "./chunk-
|
|
17
|
-
import "./chunk-
|
|
20
|
+
} from "./chunk-IPZP3VRA.js";
|
|
21
|
+
import "./chunk-5ENKYZA4.js";
|
|
22
|
+
import "./chunk-36LXIJIZ.js";
|
|
18
23
|
import {
|
|
19
24
|
getAuthData
|
|
20
|
-
} from "./chunk-
|
|
21
|
-
import "./chunk-
|
|
25
|
+
} from "./chunk-35Z7VTJT.js";
|
|
26
|
+
import "./chunk-WB6PWTMU.js";
|
|
27
|
+
import "./chunk-DHZW7Q7U.js";
|
|
22
28
|
import {
|
|
23
29
|
teamSchema
|
|
24
|
-
} from "./chunk-
|
|
25
|
-
import "./chunk-
|
|
26
|
-
import "./chunk-
|
|
27
|
-
import "./chunk-KCCFN4F7.js";
|
|
28
|
-
import "./chunk-6XWCMJDB.js";
|
|
30
|
+
} from "./chunk-GYRQPDTK.js";
|
|
31
|
+
import "./chunk-6M7TL2G2.js";
|
|
32
|
+
import "./chunk-GLWTVLKM.js";
|
|
29
33
|
import "./chunk-4ORL4MST.js";
|
|
34
|
+
import "./chunk-MNNGUUKJ.js";
|
|
30
35
|
import {
|
|
31
36
|
output,
|
|
32
37
|
printTable
|
|
33
38
|
} from "./chunk-T5HJUAWB.js";
|
|
34
|
-
import "./chunk-
|
|
39
|
+
import "./chunk-ZGVZU6L2.js";
|
|
35
40
|
import {
|
|
36
41
|
external_exports,
|
|
37
42
|
namespaceSchema
|
|
38
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-VVRUSQCY.js";
|
|
39
44
|
import "./chunk-3MZYUBJ6.js";
|
|
40
45
|
|
|
41
46
|
// src/domains/sdk/list.action.ts
|
|
@@ -75,6 +80,10 @@ async function listAction(args) {
|
|
|
75
80
|
});
|
|
76
81
|
if (sdks.error) return output.error().title(sdks.message).exit("error");
|
|
77
82
|
if (sdks.data.length === 0) {
|
|
83
|
+
if (args.json) {
|
|
84
|
+
process.stdout.write("[]\n");
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
78
87
|
output.info().title(`No SDKs found for namespace "${namespace}".`).print();
|
|
79
88
|
return;
|
|
80
89
|
}
|
|
@@ -83,6 +92,27 @@ async function listAction(args) {
|
|
|
83
92
|
query: {},
|
|
84
93
|
schema: sdkBuildSchema.array()
|
|
85
94
|
});
|
|
95
|
+
if (args.json) {
|
|
96
|
+
if (builds.error)
|
|
97
|
+
return output.error().title("Unable to fetch SDK builds").message(builds.message).exit("error");
|
|
98
|
+
const metadata = await Promise.all(
|
|
99
|
+
sdks.data.map(
|
|
100
|
+
(sdk) => inspectSdk(client, team.data.uid, sdk, builds.data)
|
|
101
|
+
)
|
|
102
|
+
);
|
|
103
|
+
const failed = metadata.find((result) => !result.ok);
|
|
104
|
+
if (failed && !failed.ok)
|
|
105
|
+
return output.error().title("Unable to fetch SDK API source").message(failed.error).exit("error");
|
|
106
|
+
process.stdout.write(
|
|
107
|
+
`${JSON.stringify(
|
|
108
|
+
metadata.filter((result) => result.ok).map((result) => result.data),
|
|
109
|
+
null,
|
|
110
|
+
2
|
|
111
|
+
)}
|
|
112
|
+
`
|
|
113
|
+
);
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
86
116
|
const lastBuiltAt = /* @__PURE__ */ new Map();
|
|
87
117
|
if (!builds.error) {
|
|
88
118
|
for (const build of builds.data) {
|
|
@@ -1,49 +1,53 @@
|
|
|
1
1
|
import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
apiService
|
|
4
|
-
} from "./chunk-ISXH6Q7I.js";
|
|
5
2
|
import {
|
|
6
3
|
BaseCollections
|
|
7
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-JXGF5EHC.js";
|
|
8
5
|
import {
|
|
9
6
|
getDatabaseClient
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-WDIWLXLV.js";
|
|
8
|
+
import {
|
|
9
|
+
apiService
|
|
10
|
+
} from "./chunk-ATNTXKMS.js";
|
|
11
|
+
import "./chunk-43WALAW3.js";
|
|
12
|
+
import "./chunk-ZYBLQ5CT.js";
|
|
13
|
+
import "./chunk-KHF2QXBG.js";
|
|
14
|
+
import "./chunk-IPZP3VRA.js";
|
|
15
|
+
import "./chunk-5ENKYZA4.js";
|
|
16
|
+
import "./chunk-G4HRW2FZ.js";
|
|
17
|
+
import "./chunk-36LXIJIZ.js";
|
|
16
18
|
import {
|
|
17
19
|
getAuthData
|
|
18
|
-
} from "./chunk-
|
|
19
|
-
import "./chunk-
|
|
20
|
+
} from "./chunk-35Z7VTJT.js";
|
|
21
|
+
import "./chunk-WB6PWTMU.js";
|
|
22
|
+
import "./chunk-DHZW7Q7U.js";
|
|
20
23
|
import {
|
|
21
24
|
teamSchema
|
|
22
|
-
} from "./chunk-
|
|
23
|
-
import "./chunk-
|
|
24
|
-
import "./chunk-
|
|
25
|
-
import "./chunk-KCCFN4F7.js";
|
|
26
|
-
import "./chunk-6XWCMJDB.js";
|
|
25
|
+
} from "./chunk-GYRQPDTK.js";
|
|
26
|
+
import "./chunk-6M7TL2G2.js";
|
|
27
|
+
import "./chunk-GLWTVLKM.js";
|
|
27
28
|
import "./chunk-4ORL4MST.js";
|
|
29
|
+
import "./chunk-MNNGUUKJ.js";
|
|
28
30
|
import {
|
|
29
31
|
output,
|
|
30
32
|
printTable
|
|
31
33
|
} from "./chunk-T5HJUAWB.js";
|
|
32
|
-
import "./chunk-
|
|
34
|
+
import "./chunk-ZGVZU6L2.js";
|
|
33
35
|
import {
|
|
34
36
|
compareVersionsDesc,
|
|
35
37
|
external_exports,
|
|
36
38
|
namespaceSchema
|
|
37
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-VVRUSQCY.js";
|
|
38
40
|
import "./chunk-3MZYUBJ6.js";
|
|
39
41
|
|
|
40
42
|
// src/domains/schema/list.action.ts
|
|
41
43
|
import as from "ansis";
|
|
42
44
|
async function listAction(args) {
|
|
43
45
|
const { error, data } = external_exports.object({
|
|
44
|
-
namespace: namespaceSchema.optional()
|
|
46
|
+
namespace: namespaceSchema.optional(),
|
|
47
|
+
json: external_exports.boolean().default(false)
|
|
45
48
|
}).safeParse({
|
|
46
|
-
namespace: args.namespace
|
|
49
|
+
namespace: args.namespace,
|
|
50
|
+
json: args.json
|
|
47
51
|
});
|
|
48
52
|
if (error)
|
|
49
53
|
return output.error().title("Invalid input").message(error.issues[0].message).exit("error");
|
|
@@ -68,6 +72,22 @@ async function listAction(args) {
|
|
|
68
72
|
const apiClient = await apiService();
|
|
69
73
|
const schemas = await apiClient.managedSchemas.getSchemas(namespace);
|
|
70
74
|
if (schemas.error) return output.error().title(schemas.message).exit("error");
|
|
75
|
+
if (data.json) {
|
|
76
|
+
console.log(
|
|
77
|
+
JSON.stringify(
|
|
78
|
+
schemas.data.map((schema) => ({
|
|
79
|
+
namespace: schema.namespace,
|
|
80
|
+
slug: schema.slug,
|
|
81
|
+
title: schema.title,
|
|
82
|
+
version: [...schema.versions].sort((a, b) => compareVersionsDesc(a.version, b.version)).at(0)?.version ?? null,
|
|
83
|
+
isPrivate: schema.isPrivate
|
|
84
|
+
})),
|
|
85
|
+
null,
|
|
86
|
+
2
|
|
87
|
+
)
|
|
88
|
+
);
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
71
91
|
if (schemas.data.length === 0) {
|
|
72
92
|
output.info().title(`No schemas found for namespace "${namespace}".`).print();
|
|
73
93
|
return;
|
|
@@ -2,61 +2,66 @@ import { createRequire as $$cR } from "node:module"; const require = $$cR(import
|
|
|
2
2
|
import {
|
|
3
3
|
dashboardUrl,
|
|
4
4
|
registryUrl
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-5SMP756H.js";
|
|
6
6
|
import {
|
|
7
7
|
registry
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-MMWSCTDB.js";
|
|
9
9
|
import {
|
|
10
10
|
getFileOrUrl,
|
|
11
|
-
isDocument
|
|
11
|
+
isDocument
|
|
12
|
+
} from "./chunk-CWVYOXXM.js";
|
|
13
|
+
import {
|
|
12
14
|
safeNormalize
|
|
13
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-H467HDVV.js";
|
|
14
16
|
import {
|
|
15
17
|
DEFAULT_FETCH_CONCURRENCY
|
|
16
|
-
} from "./chunk-
|
|
17
|
-
import
|
|
18
|
-
apiService
|
|
19
|
-
} from "./chunk-ISXH6Q7I.js";
|
|
18
|
+
} from "./chunk-MC4EMNOR.js";
|
|
19
|
+
import "./chunk-DFOZG7ZV.js";
|
|
20
20
|
import {
|
|
21
21
|
BaseCollections
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-JXGF5EHC.js";
|
|
23
23
|
import {
|
|
24
24
|
getDatabaseClient
|
|
25
|
-
} from "./chunk-
|
|
26
|
-
import
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
import "./chunk-
|
|
30
|
-
import "./chunk-
|
|
25
|
+
} from "./chunk-WDIWLXLV.js";
|
|
26
|
+
import {
|
|
27
|
+
apiService
|
|
28
|
+
} from "./chunk-ATNTXKMS.js";
|
|
29
|
+
import "./chunk-43WALAW3.js";
|
|
30
|
+
import "./chunk-ZYBLQ5CT.js";
|
|
31
|
+
import "./chunk-KHF2QXBG.js";
|
|
32
|
+
import "./chunk-IPZP3VRA.js";
|
|
33
|
+
import "./chunk-5ENKYZA4.js";
|
|
34
|
+
import "./chunk-G4HRW2FZ.js";
|
|
35
|
+
import "./chunk-36LXIJIZ.js";
|
|
31
36
|
import {
|
|
32
37
|
getAuthData
|
|
33
|
-
} from "./chunk-
|
|
34
|
-
import "./chunk-
|
|
38
|
+
} from "./chunk-35Z7VTJT.js";
|
|
39
|
+
import "./chunk-WB6PWTMU.js";
|
|
40
|
+
import "./chunk-DHZW7Q7U.js";
|
|
35
41
|
import {
|
|
36
42
|
teamSchema
|
|
37
|
-
} from "./chunk-
|
|
38
|
-
import "./chunk-
|
|
43
|
+
} from "./chunk-GYRQPDTK.js";
|
|
44
|
+
import "./chunk-6M7TL2G2.js";
|
|
39
45
|
import {
|
|
40
46
|
requireInteractive
|
|
41
47
|
} from "./chunk-EGOXR5FB.js";
|
|
42
|
-
import "./chunk-K74E42RV.js";
|
|
43
48
|
import {
|
|
44
49
|
RegistryAsset
|
|
45
|
-
} from "./chunk-
|
|
46
|
-
import "./chunk-6XWCMJDB.js";
|
|
50
|
+
} from "./chunk-GLWTVLKM.js";
|
|
47
51
|
import {
|
|
48
52
|
isUrl
|
|
49
53
|
} from "./chunk-4ORL4MST.js";
|
|
54
|
+
import "./chunk-MNNGUUKJ.js";
|
|
50
55
|
import {
|
|
51
56
|
output
|
|
52
57
|
} from "./chunk-T5HJUAWB.js";
|
|
53
|
-
import "./chunk-
|
|
58
|
+
import "./chunk-ZGVZU6L2.js";
|
|
54
59
|
import {
|
|
55
60
|
docVersionSchema,
|
|
56
61
|
external_exports,
|
|
57
62
|
namespaceSchema,
|
|
58
63
|
slugSchema
|
|
59
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-VVRUSQCY.js";
|
|
60
65
|
import "./chunk-3MZYUBJ6.js";
|
|
61
66
|
|
|
62
67
|
// src/domains/schema/publish.action.ts
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
isFileArgument,
|
|
4
|
+
isFileOption
|
|
5
|
+
} from "./chunk-DFOZG7ZV.js";
|
|
6
|
+
import "./chunk-3MZYUBJ6.js";
|
|
7
|
+
|
|
8
|
+
// src/helpers/completion/query.ts
|
|
9
|
+
var visibleCommands = (command) => command.createHelp().visibleCommands(command);
|
|
10
|
+
var visibleOptions = (command) => command.createHelp().visibleOptions(command);
|
|
11
|
+
var findOption = (command, flag) => visibleOptions(command).find(
|
|
12
|
+
(option) => option.short === flag || option.long === flag
|
|
13
|
+
);
|
|
14
|
+
var valueCompletion = (choices, files, prefix) => ({
|
|
15
|
+
mode: choices ? "values" : files ? "files" : "none",
|
|
16
|
+
candidates: choices?.filter((choice) => choice.startsWith(prefix)) ?? []
|
|
17
|
+
});
|
|
18
|
+
var optionCompletion = ({ option, command }, prefix) => valueCompletion(
|
|
19
|
+
option.argChoices,
|
|
20
|
+
isFileOption(command, option.long ?? "") || isFileOption(command, option.short ?? ""),
|
|
21
|
+
prefix
|
|
22
|
+
);
|
|
23
|
+
var argumentCompletion = (command, argument, prefix) => valueCompletion(
|
|
24
|
+
argument?.argChoices,
|
|
25
|
+
!!argument && isFileArgument(command, argument.name()),
|
|
26
|
+
prefix
|
|
27
|
+
);
|
|
28
|
+
var withPrefix = (result, prefix) => ({
|
|
29
|
+
...result,
|
|
30
|
+
prefix,
|
|
31
|
+
candidates: result.candidates.map((candidate) => `${prefix}${candidate}`)
|
|
32
|
+
});
|
|
33
|
+
var queryCompletion = (program, words, cursor) => {
|
|
34
|
+
const state = { command: program, position: 0, terminated: false, help: false };
|
|
35
|
+
const current = words[cursor] ?? "";
|
|
36
|
+
for (const word of words.slice(1, cursor)) {
|
|
37
|
+
if (state.pending) {
|
|
38
|
+
if (state.pending.option.required && !state.pending.consumed || !word.startsWith("-")) {
|
|
39
|
+
if (state.pending.option.variadic) state.pending.consumed = true;
|
|
40
|
+
else state.pending = void 0;
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
state.pending = void 0;
|
|
44
|
+
}
|
|
45
|
+
if (!state.terminated && word === "--") {
|
|
46
|
+
state.terminated = true;
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
if (!state.terminated && word.startsWith("-")) {
|
|
50
|
+
const equals = word.indexOf("=");
|
|
51
|
+
const flag = equals < 0 ? word : word.slice(0, equals);
|
|
52
|
+
const option = findOption(state.command, flag);
|
|
53
|
+
if (option) {
|
|
54
|
+
if ((option.required || option.optional) && (equals < 0 || option.variadic))
|
|
55
|
+
state.pending = {
|
|
56
|
+
option,
|
|
57
|
+
command: state.command,
|
|
58
|
+
consumed: equals >= 0
|
|
59
|
+
};
|
|
60
|
+
} else if (!word.startsWith("--")) {
|
|
61
|
+
for (let index = 1; index < word.length; index++) {
|
|
62
|
+
const short = findOption(state.command, `-${word[index]}`);
|
|
63
|
+
if (short?.required || short?.optional) {
|
|
64
|
+
if (index === word.length - 1 || short.variadic)
|
|
65
|
+
state.pending = { option: short, command: state.command };
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
if (!state.terminated && state.position === 0) {
|
|
73
|
+
if (word === "help" && state.command === program) {
|
|
74
|
+
state.help = true;
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
const child = visibleCommands(state.command).find(
|
|
78
|
+
(candidate) => candidate.name() === word || candidate.aliases().includes(word)
|
|
79
|
+
);
|
|
80
|
+
if (child) {
|
|
81
|
+
state.command = child;
|
|
82
|
+
state.position = 0;
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
state.position++;
|
|
87
|
+
}
|
|
88
|
+
if (state.pending && (state.pending.option.required && !state.pending.consumed || !current.startsWith("-")))
|
|
89
|
+
return optionCompletion(state.pending, current);
|
|
90
|
+
if (!state.terminated && current.startsWith("-")) {
|
|
91
|
+
const equals = current.indexOf("=");
|
|
92
|
+
if (equals >= 0) {
|
|
93
|
+
const option = findOption(state.command, current.slice(0, equals));
|
|
94
|
+
if (!option || !(option.required || option.optional))
|
|
95
|
+
return { mode: "none", candidates: [] };
|
|
96
|
+
const result2 = optionCompletion(
|
|
97
|
+
{ option, command: state.command },
|
|
98
|
+
current.slice(equals + 1)
|
|
99
|
+
);
|
|
100
|
+
return withPrefix(result2, current.slice(0, equals + 1));
|
|
101
|
+
}
|
|
102
|
+
if (!current.startsWith("--") && current.length > 2) {
|
|
103
|
+
for (let index = 1; index < current.length; index++) {
|
|
104
|
+
const option = findOption(state.command, `-${current[index]}`);
|
|
105
|
+
if (option?.required || option?.optional) {
|
|
106
|
+
const result2 = optionCompletion(
|
|
107
|
+
{ option, command: state.command },
|
|
108
|
+
current.slice(index + 1)
|
|
109
|
+
);
|
|
110
|
+
return withPrefix(result2, current.slice(0, index + 1));
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return {
|
|
115
|
+
mode: "values",
|
|
116
|
+
candidates: visibleOptions(state.command).flatMap((option) => [option.short, option.long]).filter((flag) => !!flag && flag.startsWith(current))
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
const argument = state.command.registeredArguments[state.position] ?? state.command.registeredArguments.find((argument2) => argument2.variadic);
|
|
120
|
+
const result = argumentCompletion(state.command, argument, current);
|
|
121
|
+
if (state.position === 0 && !state.terminated) {
|
|
122
|
+
const candidates = visibleCommands(state.command).flatMap((child) => [child.name(), ...child.aliases()]).filter((name) => name.startsWith(current));
|
|
123
|
+
if (candidates.length || state.help) return { mode: "values", candidates };
|
|
124
|
+
}
|
|
125
|
+
return result;
|
|
126
|
+
};
|
|
127
|
+
export {
|
|
128
|
+
queryCompletion
|
|
129
|
+
};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
|
|
2
|
+
import "./chunk-3MZYUBJ6.js";
|
|
3
|
+
|
|
4
|
+
// src/helpers/completion/scripts.ts
|
|
5
|
+
var bash = `
|
|
6
|
+
_scalar_complete() {
|
|
7
|
+
local mode prefix candidate current word index cursor=0 trim=''
|
|
8
|
+
local -a words
|
|
9
|
+
words=()
|
|
10
|
+
# Bash splits equals signs into separate completion words by default.
|
|
11
|
+
for ((index=0; index<=COMP_CWORD; index++)); do
|
|
12
|
+
word="\${COMP_WORDS[index]}"
|
|
13
|
+
if [[ "$word" == '=' && \${#words[@]} -gt 0 ]]; then
|
|
14
|
+
words[\${#words[@]}-1]="\${words[\${#words[@]}-1]}="
|
|
15
|
+
elif [[ \${#words[@]} -gt 0 && "\${words[\${#words[@]}-1]}" == *= ]]; then
|
|
16
|
+
words[\${#words[@]}-1]="\${words[\${#words[@]}-1]}$word"
|
|
17
|
+
else
|
|
18
|
+
words[\${#words[@]}]="$word"
|
|
19
|
+
fi
|
|
20
|
+
done
|
|
21
|
+
cursor=$((\${#words[@]}-1))
|
|
22
|
+
current="\${words[cursor]}"
|
|
23
|
+
if [[ "$current" == *=* && ("\${COMP_WORDS[COMP_CWORD]}" == '=' || "\${COMP_WORDS[COMP_CWORD]}" != *=*) ]]; then
|
|
24
|
+
trim="\${current%%=*}="
|
|
25
|
+
fi
|
|
26
|
+
COMPREPLY=()
|
|
27
|
+
{
|
|
28
|
+
IFS= read -r mode
|
|
29
|
+
IFS= read -r prefix
|
|
30
|
+
if [[ "$mode" == files ]]; then
|
|
31
|
+
[[ "$prefix" == '-' ]] && prefix=''
|
|
32
|
+
current="\${current#"$prefix"}"
|
|
33
|
+
while IFS= read -r candidate; do
|
|
34
|
+
COMPREPLY[\${#COMPREPLY[@]}]="\${prefix#"$trim"}$candidate"
|
|
35
|
+
done < <(compgen -f -- "$current")
|
|
36
|
+
type compopt >/dev/null 2>&1 && compopt -o filenames
|
|
37
|
+
else
|
|
38
|
+
while IFS= read -r candidate; do
|
|
39
|
+
[[ -n "$candidate" ]] && COMPREPLY[\${#COMPREPLY[@]}]="\${candidate#"$trim"}"
|
|
40
|
+
done
|
|
41
|
+
fi
|
|
42
|
+
} < <("\${words[0]}" __complete "$cursor" -- "\${words[@]}" 2>/dev/null)
|
|
43
|
+
}
|
|
44
|
+
complete -F _scalar_complete scalar scalar-cli
|
|
45
|
+
`;
|
|
46
|
+
var zsh = `
|
|
47
|
+
_scalar_complete() {
|
|
48
|
+
local -a response candidates
|
|
49
|
+
local mode prefix
|
|
50
|
+
response=("\${(@f)$("\${words[1]}" __complete "$((CURRENT-1))" -- "\${words[@]}" 2>/dev/null)}")
|
|
51
|
+
mode="\${response[1]}"
|
|
52
|
+
prefix="\${response[2]}"
|
|
53
|
+
if [[ "$mode" == files ]]; then
|
|
54
|
+
if [[ "$prefix" != '-' ]]; then
|
|
55
|
+
compset -P "$prefix"
|
|
56
|
+
fi
|
|
57
|
+
_files
|
|
58
|
+
elif [[ "$mode" == values ]]; then
|
|
59
|
+
candidates=("\${response[@]:2}")
|
|
60
|
+
compadd -- "\${candidates[@]}"
|
|
61
|
+
fi
|
|
62
|
+
}
|
|
63
|
+
_scalar_complete "$@"
|
|
64
|
+
`;
|
|
65
|
+
var fish = `
|
|
66
|
+
function __scalar_complete
|
|
67
|
+
set -l words (commandline -opc)
|
|
68
|
+
set -l current (commandline -ct)
|
|
69
|
+
set -l cursor (count $words)
|
|
70
|
+
set -l response (command $words[1] __complete $cursor -- $words "$current" 2>/dev/null)
|
|
71
|
+
if test "$response[1]" = files
|
|
72
|
+
set -l prefix $response[2]
|
|
73
|
+
if test "$prefix" = '-'
|
|
74
|
+
set prefix ''
|
|
75
|
+
end
|
|
76
|
+
set -l path (string sub -s (math (string length -- "$prefix") + 1) -- "$current")
|
|
77
|
+
for candidate in (__fish_complete_path "$path")
|
|
78
|
+
printf '%s%s\\n' "$prefix" "$candidate"
|
|
79
|
+
end
|
|
80
|
+
else if test "$response[1]" = values
|
|
81
|
+
for candidate in $response[3..-1]
|
|
82
|
+
printf '%s\\n' "$candidate"
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
complete -c scalar -f -a '(__scalar_complete)'
|
|
87
|
+
complete -c scalar-cli -f -a '(__scalar_complete)'
|
|
88
|
+
`;
|
|
89
|
+
var renderCompletionScript = (shell) => {
|
|
90
|
+
const setup = {
|
|
91
|
+
bash: "# Save this script and source it from ~/.bashrc (or ~/.bash_profile on macOS).",
|
|
92
|
+
zsh: "# Save as _scalar on fpath, then run autoload -Uz compinit; compinit.",
|
|
93
|
+
fish: "# Save as ~/.config/fish/completions/scalar.fish. Copy to scalar-cli.fish for that alias."
|
|
94
|
+
};
|
|
95
|
+
return `${shell === "zsh" ? "#compdef scalar scalar-cli\n" : ""}# Scalar ${shell} completion
|
|
96
|
+
${setup[shell]}
|
|
97
|
+
# Regenerate with scalar completion ${shell} after upgrades.
|
|
98
|
+
${{ bash, zsh, fish }[shell]}`;
|
|
99
|
+
};
|
|
100
|
+
export {
|
|
101
|
+
renderCompletionScript
|
|
102
|
+
};
|