@scalar/cli 2.10.0 → 2.12.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 +84 -1289
- package/chunks/action-2OPUQFUY.js +164 -0
- package/chunks/{action-4GZI2M5B.js → action-36LZ6XXE.js} +19 -17
- package/chunks/{action-KDUFU7TZ.js → action-3XMTJJRT.js} +19 -16
- package/chunks/{action-R4PGILN4.js → action-6CLEENBI.js} +47 -36
- package/chunks/{action-ZFI77WA5.js → action-7HXYZPOT.js} +10 -10
- package/chunks/{action-X7BA7PQQ.js → action-AC5ENU6Z.js} +20 -18
- package/chunks/{action-PPTFYZWD.js → action-ADGLTNFC.js} +28 -22
- package/chunks/{action-7XOHYWYM.js → action-AOKHLTZ6.js} +25 -21
- package/chunks/{action-XOADBXSX.js → action-AVSJ3AJY.js} +17 -16
- package/chunks/{action-GFLRD7LO.js → action-D3IVCY24.js} +8 -8
- package/chunks/action-EBZJS367.js +130 -0
- package/chunks/{action-ZKA3RR3S.js → action-EZXHSAJ2.js} +18 -17
- package/chunks/{action-5LF4XYHX.js → action-FDTVHVHF.js} +12 -12
- package/chunks/{action-JEYDBB3P.js → action-FUO5F7NV.js} +15 -15
- package/chunks/{action-DKDRAIKV.js → action-HA3CMV3P.js} +13 -15
- package/chunks/{action-YSVTZVKV.js → action-IG3BK2LF.js} +37 -26
- package/chunks/{action-H3RTILLM.js → action-IIQMZVRJ.js} +1 -1
- package/chunks/{action-DTEO4YNX.js → action-JT6C472I.js} +13 -11
- package/chunks/{action-UUL6SWV4.js → action-KDT6H6ML.js} +12 -14
- package/chunks/{action-PAM2EZ22.js → action-KJDIJQ3A.js} +8 -7
- package/chunks/{action-HT42NUUX.js → action-NF5E7JKA.js} +40 -38
- package/chunks/{action-EAUTQ77U.js → action-NIZBME45.js} +26 -24
- package/chunks/{action-CB55NWAU.js → action-O757TFA2.js} +9 -9
- package/chunks/{action-XLE37MZL.js → action-ONR7QSN7.js} +23 -22
- package/chunks/{action-5RL4NWUZ.js → action-QM2BMMHG.js} +33 -30
- package/chunks/{action-GWYYTUTM.js → action-QVTAZCKY.js} +5 -5
- package/chunks/action-SLB52XRG.js +65 -0
- package/chunks/{action-CABLS46Q.js → action-UTFRCKGE.js} +11 -11
- package/chunks/{action-4W5GUGEG.js → action-VESBFIP3.js} +20 -19
- package/chunks/{action-657A4K2D.js → action-VGFAIFYE.js} +26 -23
- package/chunks/action-WCU5O2VT.js +100 -0
- package/chunks/{action-TOBU74JH.js → action-XS5EESHW.js} +51 -27
- package/chunks/action-XVNRZ5VX.js +38 -0
- package/chunks/action-Y7EBKCUU.js +16 -0
- package/chunks/{action-5N3P43MD.js → action-YWQ2OKS3.js} +16 -15
- package/chunks/{actions-3SAMH7A5.js → actions-6QG7LH7P.js} +23 -20
- package/chunks/{agent-2ESZI7NO.js → agent-ONXROEAE.js} +44 -9
- package/chunks/{asyncapi-4HGVM3PR.js → asyncapi-7IFXAIE3.js} +13 -12
- package/chunks/{build.action-VBGFGACM.js → build.action-FI4OWY3T.js} +28 -26
- package/chunks/{chunk-ZGNDXPLU.js → chunk-26VIHQGL.js} +3 -3
- package/chunks/{chunk-JXGF5EHC.js → chunk-3HCEUGOE.js} +42 -13
- package/chunks/{chunk-G4HRW2FZ.js → chunk-5TNKTLQP.js} +370 -254
- package/chunks/{chunk-XAGJJNQW.js → chunk-BB6WWG25.js} +10 -10
- package/chunks/{chunk-K2HIB5BA.js → chunk-BCFUMXMC.js} +3 -3
- package/chunks/{action-F2ZJNURT.js → chunk-EBNFCIKS.js} +7 -10
- package/chunks/{chunk-MC4EMNOR.js → chunk-EJSGWV2K.js} +7 -6
- package/chunks/{chunk-GYRQPDTK.js → chunk-FJCOYEKT.js} +139 -3
- package/chunks/{chunk-ZKJPLWRJ.js → chunk-HU47OMI4.js} +4 -4
- package/chunks/{chunk-VVRUSQCY.js → chunk-I57ID5K7.js} +13 -0
- package/chunks/{chunk-43WALAW3.js → chunk-JLNHOA5Z.js} +64 -115
- package/chunks/{chunk-5SMP756H.js → chunk-LCSU43NJ.js} +2 -2
- package/chunks/{chunk-KHF2QXBG.js → chunk-N645RGAB.js} +1853 -683
- package/chunks/{chunk-3ZJYGGAA.js → chunk-ORCUZITN.js} +1 -1
- package/chunks/{chunk-H467HDVV.js → chunk-PERC34BV.js} +1 -1
- package/chunks/chunk-Q26DFKTY.js +37 -0
- package/chunks/{chunk-MMWSCTDB.js → chunk-QJQTSRU4.js} +19 -19
- package/chunks/{chunk-WDIWLXLV.js → chunk-RLBS4HJT.js} +3 -3
- package/chunks/{chunk-ATNTXKMS.js → chunk-RNZVZMYC.js} +198 -42
- package/chunks/{chunk-IPZP3VRA.js → chunk-RYWXF3LO.js} +12 -21
- package/chunks/{chunk-CWVYOXXM.js → chunk-SNOAL2C5.js} +11 -7
- package/chunks/{chunk-UDBSV3CK.js → chunk-T3R66THO.js} +6085 -4167
- package/chunks/{chunk-VYFGRLVQ.js → chunk-U73OW57G.js} +1 -1
- package/chunks/chunk-U764PQUA.js +1034 -0
- package/chunks/{chunk-KZNRQVMY.js → chunk-UAFCSWQ6.js} +1 -1
- package/chunks/{chunk-WB6PWTMU.js → chunk-UBLFIMUA.js} +1 -1
- package/chunks/{chunk-WIEXQUTD.js → chunk-UODTHS76.js} +1 -1
- package/chunks/chunk-V3MYP5SQ.js +247 -0
- package/chunks/{chunk-36LXIJIZ.js → chunk-V6LUKXBV.js} +1 -16
- package/chunks/{chunk-6M7TL2G2.js → chunk-VRZSDUZK.js} +45 -5
- package/chunks/{chunk-GLWTVLKM.js → chunk-VUNOOPEG.js} +9 -2
- package/chunks/chunk-VUXPDHTQ.js +22 -0
- package/chunks/{chunk-DHZW7Q7U.js → chunk-VVQOFG76.js} +2 -4
- package/chunks/chunk-XP5UM7SF.js +21 -0
- package/chunks/{chunk-ZYBLQ5CT.js → chunk-Y6C3H27E.js} +9 -4
- package/chunks/{chunk-35Z7VTJT.js → chunk-YTFFBGNQ.js} +52 -38
- package/chunks/{chunk-BIMLCGKS.js → chunk-ZNLMQKDU.js} +1 -1
- package/chunks/{create.action-DBNIS665.js → create.action-PPMZEMZL.js} +34 -32
- package/chunks/{delete.action-GBOZC45K.js → delete.action-GDOHATRZ.js} +30 -28
- package/chunks/{delete.action-K7BLK7DK.js → delete.action-VAHKEHEU.js} +29 -27
- package/chunks/{get.action-QHKMYZBK.js → get.action-UXFTGO7W.js} +24 -20
- package/chunks/{get.action-N3JOY3OU.js → get.action-XON3EZDT.js} +16 -15
- package/chunks/{list.action-TJCS6UEY.js → list.action-24F5WDGR.js} +37 -26
- package/chunks/{list.action-6SSO3JVN.js → list.action-OQEAEJ5U.js} +39 -29
- package/chunks/{publish.action-T24VHRMR.js → publish.action-G7FPDRBZ.js} +45 -43
- package/chunks/{scripts-VIBLGKYG.js → scripts-6CI6U32J.js} +1 -1
- package/chunks/{update.action-VOE6PH5F.js → update.action-IFIFXZWA.js} +29 -27
- package/chunks/{update.action-OGYNBXRU.js → update.action-MJDHVVR3.js} +30 -28
- package/index.js +290 -284
- package/package.json +2 -2
- package/skills/scalar-cli/SKILL.md +49 -49
- package/template.md +68 -252
- 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,164 @@
|
|
|
1
|
+
import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
projectDetails
|
|
4
|
+
} from "./chunk-6PSYZO3U.js";
|
|
5
|
+
import {
|
|
6
|
+
formatListTime
|
|
7
|
+
} from "./chunk-XP5UM7SF.js";
|
|
8
|
+
import "./chunk-AEFPCC4U.js";
|
|
9
|
+
import {
|
|
10
|
+
getPublishUrl
|
|
11
|
+
} from "./chunk-QJQTSRU4.js";
|
|
12
|
+
import {
|
|
13
|
+
BaseCollections
|
|
14
|
+
} from "./chunk-3HCEUGOE.js";
|
|
15
|
+
import {
|
|
16
|
+
getDatabaseClient
|
|
17
|
+
} from "./chunk-RLBS4HJT.js";
|
|
18
|
+
import {
|
|
19
|
+
apiService
|
|
20
|
+
} from "./chunk-RNZVZMYC.js";
|
|
21
|
+
import "./chunk-N645RGAB.js";
|
|
22
|
+
import "./chunk-JLNHOA5Z.js";
|
|
23
|
+
import "./chunk-Y6C3H27E.js";
|
|
24
|
+
import "./chunk-5ENKYZA4.js";
|
|
25
|
+
import "./chunk-RYWXF3LO.js";
|
|
26
|
+
import "./chunk-5TNKTLQP.js";
|
|
27
|
+
import "./chunk-V3MYP5SQ.js";
|
|
28
|
+
import "./chunk-V6LUKXBV.js";
|
|
29
|
+
import "./chunk-VUXPDHTQ.js";
|
|
30
|
+
import {
|
|
31
|
+
getAuthData
|
|
32
|
+
} from "./chunk-YTFFBGNQ.js";
|
|
33
|
+
import "./chunk-UBLFIMUA.js";
|
|
34
|
+
import "./chunk-VVQOFG76.js";
|
|
35
|
+
import "./chunk-FJCOYEKT.js";
|
|
36
|
+
import {
|
|
37
|
+
publishRecordSchema
|
|
38
|
+
} from "./chunk-VRZSDUZK.js";
|
|
39
|
+
import "./chunk-4ORL4MST.js";
|
|
40
|
+
import "./chunk-VUNOOPEG.js";
|
|
41
|
+
import {
|
|
42
|
+
output,
|
|
43
|
+
printTable
|
|
44
|
+
} from "./chunk-T5HJUAWB.js";
|
|
45
|
+
import "./chunk-U764PQUA.js";
|
|
46
|
+
import "./chunk-Q26DFKTY.js";
|
|
47
|
+
import "./chunk-I57ID5K7.js";
|
|
48
|
+
import "./chunk-3MZYUBJ6.js";
|
|
49
|
+
|
|
50
|
+
// src/domains/project/list/action.ts
|
|
51
|
+
async function listAction(options) {
|
|
52
|
+
const client = await apiService();
|
|
53
|
+
const projects = [];
|
|
54
|
+
let cursor;
|
|
55
|
+
const seenCursors = /* @__PURE__ */ new Set();
|
|
56
|
+
do {
|
|
57
|
+
const response = await client.docsProject.listProjects({
|
|
58
|
+
limit: 200,
|
|
59
|
+
cursor
|
|
60
|
+
});
|
|
61
|
+
if (response.error) {
|
|
62
|
+
return output.error().title("Could not list projects").message(response.message).exit("error");
|
|
63
|
+
}
|
|
64
|
+
projects.push(...response.data.data);
|
|
65
|
+
if (!response.data.hasMore) break;
|
|
66
|
+
const nextCursor = response.data.nextCursor;
|
|
67
|
+
if (!nextCursor || seenCursors.has(nextCursor)) {
|
|
68
|
+
return output.error().title("Could not list all projects").message(
|
|
69
|
+
"The server did not return a valid continuation cursor. No partial list was printed."
|
|
70
|
+
).exit("error");
|
|
71
|
+
}
|
|
72
|
+
seenCursors.add(nextCursor);
|
|
73
|
+
cursor = nextCursor;
|
|
74
|
+
} while (cursor);
|
|
75
|
+
const legacy = await client.github.getProjects();
|
|
76
|
+
if (legacy.error) {
|
|
77
|
+
return output.error().title("Could not list projects").message(legacy.message).exit("error");
|
|
78
|
+
}
|
|
79
|
+
const unifiedUids = new Set(projects.map((project) => project.uid));
|
|
80
|
+
const unifiedSlugs = new Set(projects.map((project) => project.slug));
|
|
81
|
+
const details = [
|
|
82
|
+
...projects,
|
|
83
|
+
...legacy.data.filter(
|
|
84
|
+
(project) => !unifiedUids.has(project.uid) && !unifiedSlugs.has(project.slug)
|
|
85
|
+
)
|
|
86
|
+
].map(projectDetails).sort((a, b) => a.slug.localeCompare(b.slug));
|
|
87
|
+
if (options.json) {
|
|
88
|
+
console.log(JSON.stringify(details));
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
if (details.length === 0) {
|
|
92
|
+
output.info().message("No projects found for the current team.").print();
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
const deploymentUids = details.flatMap(
|
|
96
|
+
(project) => project.activeDeployment?.domain ? [project.activeDeployment.uid] : []
|
|
97
|
+
);
|
|
98
|
+
const urls = /* @__PURE__ */ new Map();
|
|
99
|
+
if (deploymentUids.length > 0) {
|
|
100
|
+
const auth = await getAuthData();
|
|
101
|
+
const database = await getDatabaseClient();
|
|
102
|
+
const records = await database.getMany({
|
|
103
|
+
collectionPath: BaseCollections.PublishRecords(auth.teamUid),
|
|
104
|
+
query: { uid: { $in: deploymentUids } },
|
|
105
|
+
schema: publishRecordSchema.array()
|
|
106
|
+
});
|
|
107
|
+
if (records.error) {
|
|
108
|
+
console.error(
|
|
109
|
+
"[WARN] Could not load project URLs. Project details are still available."
|
|
110
|
+
);
|
|
111
|
+
} else {
|
|
112
|
+
for (const project of details) {
|
|
113
|
+
const deployment = project.activeDeployment;
|
|
114
|
+
if (!deployment?.domain) continue;
|
|
115
|
+
const record = records.data.find(
|
|
116
|
+
(record2) => record2.uid === deployment.uid
|
|
117
|
+
);
|
|
118
|
+
if (!record) continue;
|
|
119
|
+
try {
|
|
120
|
+
urls.set(
|
|
121
|
+
project.uid,
|
|
122
|
+
getPublishUrl(
|
|
123
|
+
deployment.domain.replace(/^https?:\/\//, ""),
|
|
124
|
+
record.subpath
|
|
125
|
+
)
|
|
126
|
+
);
|
|
127
|
+
} catch {
|
|
128
|
+
urls.set(project.uid, "\u2014");
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
const now = Date.now();
|
|
134
|
+
printTable(
|
|
135
|
+
[
|
|
136
|
+
{ name: "name", title: "Name", alignment: "left", maxLen: 40 },
|
|
137
|
+
{ name: "slug", title: "Slug", alignment: "left" },
|
|
138
|
+
{ name: "provider", title: "Source", alignment: "left" },
|
|
139
|
+
{ name: "access", title: "Access", alignment: "left" },
|
|
140
|
+
{ name: "url", title: "URL", alignment: "left" },
|
|
141
|
+
{ name: "published", title: "Published", alignment: "left" }
|
|
142
|
+
],
|
|
143
|
+
[...details].sort(
|
|
144
|
+
(a, b) => (b.activeDeployment?.publishedAt ?? Number.NEGATIVE_INFINITY) - (a.activeDeployment?.publishedAt ?? Number.NEGATIVE_INFINITY) || a.slug.localeCompare(b.slug)
|
|
145
|
+
).map((project) => {
|
|
146
|
+
return {
|
|
147
|
+
name: project.name,
|
|
148
|
+
slug: project.slug,
|
|
149
|
+
provider: {
|
|
150
|
+
forgejo: "Scalar",
|
|
151
|
+
github: "GitHub",
|
|
152
|
+
bitbucket: "Bitbucket",
|
|
153
|
+
unlinked: "Unlinked"
|
|
154
|
+
}[project.provider],
|
|
155
|
+
access: project.isPrivate ? "Private" : "Public",
|
|
156
|
+
url: urls.get(project.uid) ?? "\u2014",
|
|
157
|
+
published: project.activeDeployment ? formatListTime(project.activeDeployment.publishedAt, now) : "\u2014"
|
|
158
|
+
};
|
|
159
|
+
})
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
export {
|
|
163
|
+
listAction
|
|
164
|
+
};
|
|
@@ -1,32 +1,34 @@
|
|
|
1
1
|
import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
BaseCollections
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-3HCEUGOE.js";
|
|
5
5
|
import {
|
|
6
6
|
getDatabaseClient
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-IPZP3VRA.js";
|
|
7
|
+
} from "./chunk-RLBS4HJT.js";
|
|
8
|
+
import "./chunk-JLNHOA5Z.js";
|
|
9
|
+
import "./chunk-Y6C3H27E.js";
|
|
11
10
|
import "./chunk-5ENKYZA4.js";
|
|
12
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-RYWXF3LO.js";
|
|
12
|
+
import "./chunk-V3MYP5SQ.js";
|
|
13
|
+
import "./chunk-V6LUKXBV.js";
|
|
14
|
+
import "./chunk-VUXPDHTQ.js";
|
|
13
15
|
import {
|
|
14
16
|
getAuthData
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
17
|
+
} from "./chunk-YTFFBGNQ.js";
|
|
18
|
+
import "./chunk-UBLFIMUA.js";
|
|
19
|
+
import "./chunk-VVQOFG76.js";
|
|
18
20
|
import {
|
|
19
21
|
teamSchema
|
|
20
|
-
} from "./chunk-
|
|
21
|
-
import "./chunk-
|
|
22
|
-
import "./chunk-GLWTVLKM.js";
|
|
22
|
+
} from "./chunk-FJCOYEKT.js";
|
|
23
|
+
import "./chunk-VRZSDUZK.js";
|
|
23
24
|
import "./chunk-4ORL4MST.js";
|
|
24
|
-
import "./chunk-
|
|
25
|
+
import "./chunk-VUNOOPEG.js";
|
|
25
26
|
import {
|
|
26
27
|
output
|
|
27
28
|
} from "./chunk-T5HJUAWB.js";
|
|
28
|
-
import "./chunk-
|
|
29
|
-
import "./chunk-
|
|
29
|
+
import "./chunk-U764PQUA.js";
|
|
30
|
+
import "./chunk-Q26DFKTY.js";
|
|
31
|
+
import "./chunk-I57ID5K7.js";
|
|
30
32
|
import "./chunk-3MZYUBJ6.js";
|
|
31
33
|
|
|
32
34
|
// src/domains/team/get/action.ts
|
|
@@ -40,7 +42,7 @@ async function getAction(args = {}) {
|
|
|
40
42
|
schema: teamSchema
|
|
41
43
|
});
|
|
42
44
|
if (team.error) {
|
|
43
|
-
return output.error().title("
|
|
45
|
+
return output.error().title("Could not load the current team").message(team.message).exit("error");
|
|
44
46
|
}
|
|
45
47
|
const details = {
|
|
46
48
|
uid: team.data.uid,
|
|
@@ -53,7 +55,7 @@ async function getAction(args = {}) {
|
|
|
53
55
|
`);
|
|
54
56
|
return;
|
|
55
57
|
}
|
|
56
|
-
output.info().title(details.name).line(`Team
|
|
58
|
+
output.info().title(details.name).line(`Team ID: ${details.uid}`).line(`Slug: ${details.slug}`).line(
|
|
57
59
|
`Namespaces: ${details.namespaces.length ? details.namespaces.join(", ") : "None"}`
|
|
58
60
|
).print();
|
|
59
61
|
}
|
|
@@ -1,31 +1,33 @@
|
|
|
1
1
|
import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
downloadIsolate
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-HU47OMI4.js";
|
|
5
|
+
import "./chunk-ORCUZITN.js";
|
|
6
6
|
import {
|
|
7
7
|
readAndParseConfig,
|
|
8
8
|
renderConfigError
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-BB6WWG25.js";
|
|
10
10
|
import {
|
|
11
11
|
CONFIG_FILE_DEFAULT,
|
|
12
12
|
findConfig
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-T3R66THO.js";
|
|
14
14
|
import {
|
|
15
15
|
ISOLATE_DIR
|
|
16
|
-
} from "./chunk-
|
|
17
|
-
import "./chunk-
|
|
16
|
+
} from "./chunk-U73OW57G.js";
|
|
17
|
+
import "./chunk-5ENKYZA4.js";
|
|
18
|
+
import "./chunk-V6LUKXBV.js";
|
|
19
|
+
import "./chunk-VUXPDHTQ.js";
|
|
18
20
|
import {
|
|
19
21
|
getAuthData
|
|
20
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-YTFFBGNQ.js";
|
|
21
23
|
import {
|
|
22
24
|
config
|
|
23
|
-
} from "./chunk-
|
|
24
|
-
import "./chunk-
|
|
25
|
-
import "./chunk-
|
|
25
|
+
} from "./chunk-UBLFIMUA.js";
|
|
26
|
+
import "./chunk-VVQOFG76.js";
|
|
27
|
+
import "./chunk-FJCOYEKT.js";
|
|
26
28
|
import {
|
|
27
29
|
ConfigVersion
|
|
28
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-VRZSDUZK.js";
|
|
29
31
|
import {
|
|
30
32
|
requireInteractive
|
|
31
33
|
} from "./chunk-EGOXR5FB.js";
|
|
@@ -33,7 +35,8 @@ import "./chunk-4ORL4MST.js";
|
|
|
33
35
|
import {
|
|
34
36
|
output
|
|
35
37
|
} from "./chunk-T5HJUAWB.js";
|
|
36
|
-
import "./chunk-
|
|
38
|
+
import "./chunk-Q26DFKTY.js";
|
|
39
|
+
import "./chunk-I57ID5K7.js";
|
|
37
40
|
import "./chunk-3MZYUBJ6.js";
|
|
38
41
|
|
|
39
42
|
// src/domains/project/preview/action.ts
|
|
@@ -77,7 +80,7 @@ async function getAccessToken() {
|
|
|
77
80
|
return accessToken;
|
|
78
81
|
} catch {
|
|
79
82
|
output.info().message(
|
|
80
|
-
"You're not
|
|
83
|
+
"You're not logged in. Private Scalar content will not be fetched."
|
|
81
84
|
).print();
|
|
82
85
|
return "";
|
|
83
86
|
}
|
|
@@ -94,7 +97,7 @@ async function previewV2Project({
|
|
|
94
97
|
const relativeConfigPath = path.relative(root, configPath);
|
|
95
98
|
const accessToken = await getAccessToken();
|
|
96
99
|
await downloadIsolate();
|
|
97
|
-
output.info().message("Starting preview
|
|
100
|
+
output.info().message("Starting preview\u2026").print();
|
|
98
101
|
await runIsolate({
|
|
99
102
|
configPath: relativeConfigPath,
|
|
100
103
|
projectDir: root,
|
|
@@ -114,7 +117,7 @@ async function previewV2Project({
|
|
|
114
117
|
async function previewAction(__configPath, options) {
|
|
115
118
|
const _port = Number.parseInt(options.port || "7970", 10);
|
|
116
119
|
if (Number.isNaN(_port)) {
|
|
117
|
-
return output.error().title("Invalid port").message("
|
|
120
|
+
return output.error().title("Invalid port").message("Provide a valid port number").exit("error");
|
|
118
121
|
}
|
|
119
122
|
if (_port < 0 || _port > 65535) {
|
|
120
123
|
return output.error().title("Invalid port").message("Port number must be between 0 and 65535").exit("error");
|
|
@@ -143,7 +146,7 @@ async function previewAction(__configPath, options) {
|
|
|
143
146
|
}
|
|
144
147
|
const { config: config2 } = parseConfigResult;
|
|
145
148
|
if (config2.version === ConfigVersion.V1) {
|
|
146
|
-
return output.error().title("
|
|
149
|
+
return output.error().title("Version 1 previews are no longer supported").message("Run `scalar project upgrade` to upgrade your project.").exit("error");
|
|
147
150
|
}
|
|
148
151
|
if (config2.version === ConfigVersion.V2) {
|
|
149
152
|
await previewV2Project({
|
|
@@ -1,53 +1,55 @@
|
|
|
1
1
|
import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
getPublishDeploymentUrl
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-UAFCSWQ6.js";
|
|
5
5
|
import {
|
|
6
6
|
readAndParseConfig,
|
|
7
7
|
renderConfigError
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-BB6WWG25.js";
|
|
9
9
|
import {
|
|
10
10
|
resolveProject
|
|
11
11
|
} from "./chunk-TSURUX4A.js";
|
|
12
12
|
import {
|
|
13
13
|
DEFAULT_ASSETS_DIR
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-T3R66THO.js";
|
|
15
|
+
import "./chunk-QJQTSRU4.js";
|
|
16
16
|
import {
|
|
17
17
|
getDatabaseClient
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-RLBS4HJT.js";
|
|
19
19
|
import {
|
|
20
20
|
apiService
|
|
21
|
-
} from "./chunk-
|
|
22
|
-
import "./chunk-
|
|
23
|
-
import "./chunk-
|
|
24
|
-
import "./chunk-
|
|
25
|
-
import "./chunk-IPZP3VRA.js";
|
|
21
|
+
} from "./chunk-RNZVZMYC.js";
|
|
22
|
+
import "./chunk-N645RGAB.js";
|
|
23
|
+
import "./chunk-JLNHOA5Z.js";
|
|
24
|
+
import "./chunk-Y6C3H27E.js";
|
|
26
25
|
import "./chunk-5ENKYZA4.js";
|
|
27
|
-
import "./chunk-
|
|
28
|
-
import "./chunk-
|
|
26
|
+
import "./chunk-RYWXF3LO.js";
|
|
27
|
+
import "./chunk-5TNKTLQP.js";
|
|
28
|
+
import "./chunk-V3MYP5SQ.js";
|
|
29
|
+
import "./chunk-V6LUKXBV.js";
|
|
30
|
+
import "./chunk-VUXPDHTQ.js";
|
|
29
31
|
import {
|
|
30
32
|
getAuthData
|
|
31
|
-
} from "./chunk-
|
|
32
|
-
import "./chunk-
|
|
33
|
-
import "./chunk-
|
|
34
|
-
import "./chunk-
|
|
33
|
+
} from "./chunk-YTFFBGNQ.js";
|
|
34
|
+
import "./chunk-UBLFIMUA.js";
|
|
35
|
+
import "./chunk-VVQOFG76.js";
|
|
36
|
+
import "./chunk-FJCOYEKT.js";
|
|
35
37
|
import {
|
|
36
38
|
ConfigVersion,
|
|
37
39
|
isGithubBackedDocsProject,
|
|
38
40
|
publishRecordSchema
|
|
39
|
-
} from "./chunk-
|
|
40
|
-
import "./chunk-GLWTVLKM.js";
|
|
41
|
+
} from "./chunk-VRZSDUZK.js";
|
|
41
42
|
import "./chunk-4ORL4MST.js";
|
|
42
|
-
import "./chunk-
|
|
43
|
+
import "./chunk-VUNOOPEG.js";
|
|
43
44
|
import {
|
|
44
45
|
output
|
|
45
46
|
} from "./chunk-T5HJUAWB.js";
|
|
46
|
-
import "./chunk-
|
|
47
|
+
import "./chunk-U764PQUA.js";
|
|
48
|
+
import "./chunk-Q26DFKTY.js";
|
|
47
49
|
import {
|
|
48
50
|
slugSchema,
|
|
49
51
|
zod_default
|
|
50
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-I57ID5K7.js";
|
|
51
53
|
import "./chunk-3MZYUBJ6.js";
|
|
52
54
|
|
|
53
55
|
// src/domains/project/publish/action.ts
|
|
@@ -397,7 +399,7 @@ async function publishAction(args) {
|
|
|
397
399
|
github: zod_default.coerce.boolean().default(false)
|
|
398
400
|
}).safeParse(args);
|
|
399
401
|
if (argsParseResult.error)
|
|
400
|
-
return output.error().title("Invalid
|
|
402
|
+
return output.error().title("Invalid arguments").message(argsParseResult.error.issues[0].message).exit("error");
|
|
401
403
|
const {
|
|
402
404
|
config: configPathOption,
|
|
403
405
|
slug,
|
|
@@ -420,17 +422,17 @@ async function publishAction(args) {
|
|
|
420
422
|
if (resolved.kind === "github") {
|
|
421
423
|
if (!resolved.project.repository) {
|
|
422
424
|
return output.error().title("Your project is not linked to a GitHub repository").message(
|
|
423
|
-
"
|
|
425
|
+
"Connect the project to a GitHub repository in the Scalar Dashboard to publish from GitHub."
|
|
424
426
|
).exit("error");
|
|
425
427
|
}
|
|
426
428
|
if (resolved.project.repository.expired) {
|
|
427
|
-
return output.error().title("
|
|
428
|
-
"
|
|
429
|
+
return output.error().title("GitHub repository access has expired").message(
|
|
430
|
+
"Reconnect the GitHub repository in the Scalar Dashboard to publish from GitHub."
|
|
429
431
|
).exit("error");
|
|
430
432
|
}
|
|
431
433
|
const publishResult3 = await publishGithub({ apiClient, slug, preview });
|
|
432
434
|
if (!publishResult3.success) {
|
|
433
|
-
return output.error().title("Could not publish
|
|
435
|
+
return output.error().title("Could not publish from GitHub").message(publishResult3.error).exit("error");
|
|
434
436
|
}
|
|
435
437
|
return await waitForPublish({
|
|
436
438
|
teamUid: auth.teamUid,
|
|
@@ -439,12 +441,12 @@ async function publishAction(args) {
|
|
|
439
441
|
}
|
|
440
442
|
if (!isGithubBackedDocsProject(resolved.project)) {
|
|
441
443
|
return output.error().title("Your project is not linked to a GitHub repository").message(
|
|
442
|
-
"
|
|
444
|
+
"Connect the project to a GitHub repository in the Scalar Dashboard to publish from GitHub."
|
|
443
445
|
).exit("error");
|
|
444
446
|
}
|
|
445
447
|
if (resolved.project.repository.expired) {
|
|
446
|
-
return output.error().title("
|
|
447
|
-
"
|
|
448
|
+
return output.error().title("GitHub repository access has expired").message(
|
|
449
|
+
"Reconnect the GitHub repository in the Scalar Dashboard to publish from GitHub."
|
|
448
450
|
).exit("error");
|
|
449
451
|
}
|
|
450
452
|
const publishResult2 = await publishUnifiedDocsProjectFromGithub({
|
|
@@ -453,7 +455,7 @@ async function publishAction(args) {
|
|
|
453
455
|
preview
|
|
454
456
|
});
|
|
455
457
|
if (!publishResult2.success) {
|
|
456
|
-
return output.error().title("Could not publish
|
|
458
|
+
return output.error().title("Could not publish from GitHub").message(publishResult2.error).exit("error");
|
|
457
459
|
}
|
|
458
460
|
return await waitForPublish({
|
|
459
461
|
teamUid: auth.teamUid,
|
|
@@ -465,6 +467,7 @@ async function publishAction(args) {
|
|
|
465
467
|
renderConfigError(configResult.error);
|
|
466
468
|
}
|
|
467
469
|
const { config, filePath: configPath } = configResult;
|
|
470
|
+
warnIfLegacyConfig(config);
|
|
468
471
|
const publishResult = await publishProject({
|
|
469
472
|
config,
|
|
470
473
|
slug,
|
|
@@ -473,7 +476,7 @@ async function publishAction(args) {
|
|
|
473
476
|
...preview && { mode: "preview" }
|
|
474
477
|
});
|
|
475
478
|
if (!publishResult.success) {
|
|
476
|
-
return output.error().title("
|
|
479
|
+
return output.error().title("Could not deploy the project").message(
|
|
477
480
|
publishResult.error instanceof Error ? publishResult.error.message : publishResult.error
|
|
478
481
|
).exit("error");
|
|
479
482
|
}
|
|
@@ -482,12 +485,18 @@ async function publishAction(args) {
|
|
|
482
485
|
publishUid: publishResult.publishUid
|
|
483
486
|
});
|
|
484
487
|
}
|
|
488
|
+
function warnIfLegacyConfig(config) {
|
|
489
|
+
if (config.version !== ConfigVersion.V1) return;
|
|
490
|
+
output.warn().title("This project uses a v1 Scalar config").line(
|
|
491
|
+
"It will be upgraded to v2 for this build only. Run `scalar project upgrade` to upgrade the config file."
|
|
492
|
+
).print();
|
|
493
|
+
}
|
|
485
494
|
async function waitForPublish({
|
|
486
495
|
teamUid,
|
|
487
496
|
publishUid
|
|
488
497
|
}) {
|
|
489
498
|
const dbClient = await getDatabaseClient();
|
|
490
|
-
const logger = output.info({ animate: true }).loader("
|
|
499
|
+
const logger = output.info({ animate: true }).loader("Deploying project\u2026");
|
|
491
500
|
while (true) {
|
|
492
501
|
const deployStatus = await getDeployStatus({
|
|
493
502
|
client: dbClient,
|
|
@@ -495,9 +504,7 @@ async function waitForPublish({
|
|
|
495
504
|
teamUid
|
|
496
505
|
});
|
|
497
506
|
if (deployStatus.error === true) {
|
|
498
|
-
return output.error().title(
|
|
499
|
-
"Something went wrong while getting information about the deployment"
|
|
500
|
-
).exit("error");
|
|
507
|
+
return output.error().title("Could not load deployment status").exit("error");
|
|
501
508
|
}
|
|
502
509
|
logger.update("loader", 0, { content: deployStatus.data.message });
|
|
503
510
|
if (deployStatus.data.status === "deployed") {
|
|
@@ -507,6 +514,9 @@ async function waitForPublish({
|
|
|
507
514
|
`${deployStatus.data.preview ? "Preview URL" : "Deployment URL"}: ${deploymentUrl}`
|
|
508
515
|
).print();
|
|
509
516
|
}
|
|
517
|
+
if (deployStatus.data.hasWarnings) {
|
|
518
|
+
output.warn().title("The build finished with warnings").line("Check the build log in the Scalar Dashboard for details.").print();
|
|
519
|
+
}
|
|
510
520
|
logger.exit("success");
|
|
511
521
|
return;
|
|
512
522
|
}
|
|
@@ -529,5 +539,6 @@ async function getDeployStatus({
|
|
|
529
539
|
}
|
|
530
540
|
export {
|
|
531
541
|
publishAction,
|
|
532
|
-
waitForPublish
|
|
542
|
+
waitForPublish,
|
|
543
|
+
warnIfLegacyConfig
|
|
533
544
|
};
|
|
@@ -4,23 +4,23 @@ import {
|
|
|
4
4
|
} from "./chunk-KHDYYVYF.js";
|
|
5
5
|
import {
|
|
6
6
|
isDocument
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-SNOAL2C5.js";
|
|
8
8
|
import {
|
|
9
9
|
isAsyncApiDocument
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-PERC34BV.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-VUNOOPEG.js";
|
|
19
18
|
import {
|
|
20
19
|
output
|
|
21
20
|
} from "./chunk-T5HJUAWB.js";
|
|
22
|
-
import "./chunk-
|
|
23
|
-
import "./chunk-
|
|
21
|
+
import "./chunk-U764PQUA.js";
|
|
22
|
+
import "./chunk-Q26DFKTY.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
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
getUserTeams
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-UODTHS76.js";
|
|
5
5
|
import {
|
|
6
6
|
getDatabaseClient
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-RLBS4HJT.js";
|
|
8
|
+
import "./chunk-Y6C3H27E.js";
|
|
9
|
+
import "./chunk-V6LUKXBV.js";
|
|
10
|
+
import "./chunk-VUXPDHTQ.js";
|
|
10
11
|
import {
|
|
11
12
|
getAuthData,
|
|
12
13
|
refreshToken
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-YTFFBGNQ.js";
|
|
15
|
+
import "./chunk-UBLFIMUA.js";
|
|
16
|
+
import "./chunk-VVQOFG76.js";
|
|
17
|
+
import "./chunk-FJCOYEKT.js";
|
|
18
|
+
import "./chunk-VRZSDUZK.js";
|
|
18
19
|
import {
|
|
19
20
|
requireInteractive
|
|
20
21
|
} from "./chunk-EGOXR5FB.js";
|
|
@@ -22,7 +23,8 @@ import "./chunk-4ORL4MST.js";
|
|
|
22
23
|
import {
|
|
23
24
|
output
|
|
24
25
|
} from "./chunk-T5HJUAWB.js";
|
|
25
|
-
import "./chunk-
|
|
26
|
+
import "./chunk-Q26DFKTY.js";
|
|
27
|
+
import "./chunk-I57ID5K7.js";
|
|
26
28
|
import "./chunk-3MZYUBJ6.js";
|
|
27
29
|
|
|
28
30
|
// src/domains/team/set/action.ts
|
|
@@ -33,19 +35,19 @@ async function setAction({ team }) {
|
|
|
33
35
|
auth.addEventListener((state) => Object.assign(auth, state));
|
|
34
36
|
if (!("refreshToken" in auth)) {
|
|
35
37
|
return output.error().title("Unsupported operation").message(
|
|
36
|
-
"
|
|
38
|
+
"Personal tokens belong to one team. To switch teams, create a token for the target team and run `scalar auth login --token <token>`."
|
|
37
39
|
).exit("error");
|
|
38
40
|
}
|
|
39
41
|
const client = await getDatabaseClient();
|
|
40
42
|
const userTeams = await getUserTeams(client, auth.email ?? "");
|
|
41
43
|
if (userTeams.error) {
|
|
42
|
-
return output.error().title("
|
|
44
|
+
return output.error().title("Could not list your teams").exit("error");
|
|
43
45
|
}
|
|
44
46
|
let teamValue = team;
|
|
45
47
|
if (!teamValue) {
|
|
46
|
-
requireInteractive("
|
|
48
|
+
requireInteractive("Provide --team with a valid team ID.");
|
|
47
49
|
teamValue = await select({
|
|
48
|
-
message: "
|
|
50
|
+
message: "Select a team",
|
|
49
51
|
options: userTeams.data.map((it) => ({
|
|
50
52
|
value: it.teamUid,
|
|
51
53
|
label: it.teamName
|
|
@@ -54,12 +56,12 @@ async function setAction({ team }) {
|
|
|
54
56
|
}
|
|
55
57
|
const selectedTeam = userTeams.data.find((it) => it.teamUid === teamValue);
|
|
56
58
|
if (!selectedTeam) {
|
|
57
|
-
return output.error().title("Invalid team").message(
|
|
59
|
+
return output.error().title("Invalid team").message(
|
|
60
|
+
"Provide a valid team ID. Run `scalar team list` to see available teams."
|
|
61
|
+
).exit("error");
|
|
58
62
|
}
|
|
59
63
|
await refreshToken(auth.refreshToken, teamValue);
|
|
60
|
-
output.info().message(
|
|
61
|
-
`Operation ${as.green("successful")}. Selected team: ${as.cyan(selectedTeam.teamName)}`
|
|
62
|
-
).print();
|
|
64
|
+
output.info().message(`Current team: ${as.cyan(selectedTeam.teamName)}.`).print();
|
|
63
65
|
}
|
|
64
66
|
export {
|
|
65
67
|
setAction
|