@scalar/cli 2.10.0 → 2.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +82 -1290
- package/chunks/{action-YSVTZVKV.js → action-25QMCP5G.js} +37 -26
- package/chunks/{action-X7BA7PQQ.js → action-2VF6LODL.js} +20 -18
- package/chunks/{action-5N3P43MD.js → action-5I4XDPPG.js} +16 -15
- package/chunks/action-6M5PTDF6.js +100 -0
- package/chunks/{action-PAM2EZ22.js → action-73ELLN3T.js} +8 -7
- package/chunks/{action-XOADBXSX.js → action-7H3AWCHX.js} +17 -16
- package/chunks/{action-KDUFU7TZ.js → action-BRSLSOE5.js} +19 -16
- package/chunks/{action-7XOHYWYM.js → action-CQQCKSNS.js} +13 -15
- package/chunks/action-D5QWDNQ2.js +65 -0
- package/chunks/{action-5RL4NWUZ.js → action-DQDHBOLJ.js} +33 -30
- package/chunks/{action-DKDRAIKV.js → action-EYPYQQVM.js} +13 -15
- package/chunks/{action-ZFI77WA5.js → action-FMA5ECUA.js} +10 -10
- package/chunks/{action-DTEO4YNX.js → action-GXDJLF2G.js} +13 -11
- package/chunks/{action-657A4K2D.js → action-HUICEXJZ.js} +26 -23
- package/chunks/action-IH6G77C5.js +38 -0
- package/chunks/{action-H3RTILLM.js → action-IIQMZVRJ.js} +1 -1
- package/chunks/action-IQM54ITT.js +164 -0
- package/chunks/{action-EAUTQ77U.js → action-J5TO3UJW.js} +26 -24
- package/chunks/{action-UUL6SWV4.js → action-KC3ZCNDR.js} +12 -14
- package/chunks/{action-HT42NUUX.js → action-L7TMS3Q3.js} +40 -38
- package/chunks/{action-GWYYTUTM.js → action-LAAHRDSR.js} +5 -5
- package/chunks/{action-5LF4XYHX.js → action-LR75GHBA.js} +12 -12
- package/chunks/{action-PPTFYZWD.js → action-MJMLQFLT.js} +12 -12
- package/chunks/action-NHU4CUKT.js +130 -0
- package/chunks/{action-4GZI2M5B.js → action-NKTFNFU7.js} +19 -17
- package/chunks/{action-CB55NWAU.js → action-NMW5WPD2.js} +9 -9
- package/chunks/{action-GFLRD7LO.js → action-OTPXODUE.js} +8 -8
- package/chunks/{action-R4PGILN4.js → action-RPCDNGCI.js} +47 -36
- package/chunks/{action-TOBU74JH.js → action-RQCXSJPZ.js} +51 -27
- package/chunks/{action-JEYDBB3P.js → action-SOYSVG67.js} +15 -15
- package/chunks/action-Y7EBKCUU.js +16 -0
- package/chunks/{action-XLE37MZL.js → action-YN4TE7TG.js} +23 -22
- package/chunks/{action-CABLS46Q.js → action-ZGNVWTHZ.js} +11 -11
- package/chunks/{action-4W5GUGEG.js → action-ZKKRPLDK.js} +20 -19
- package/chunks/{action-ZKA3RR3S.js → action-ZUZL7R3H.js} +18 -17
- package/chunks/{actions-3SAMH7A5.js → actions-S6K76HCW.js} +23 -20
- package/chunks/{agent-2ESZI7NO.js → agent-IRNEV4K5.js} +44 -9
- package/chunks/{asyncapi-4HGVM3PR.js → asyncapi-WQPIQMEZ.js} +13 -12
- package/chunks/{build.action-VBGFGACM.js → build.action-CLBVKFWD.js} +28 -26
- package/chunks/chunk-25XERWCE.js +1058 -0
- package/chunks/{chunk-35Z7VTJT.js → chunk-3RIUDHLG.js} +52 -38
- package/chunks/{chunk-ZYBLQ5CT.js → chunk-3TFOA64C.js} +9 -4
- package/chunks/{chunk-CWVYOXXM.js → chunk-4JKXZ5CF.js} +11 -7
- package/chunks/{chunk-XAGJJNQW.js → chunk-5L7V7RCH.js} +10 -10
- package/chunks/{chunk-KZNRQVMY.js → chunk-ALYM4ZB2.js} +1 -1
- package/chunks/chunk-AVZFSWPD.js +37 -0
- package/chunks/{chunk-GYRQPDTK.js → chunk-BQYVSPAI.js} +14 -2
- package/chunks/{chunk-UDBSV3CK.js → chunk-CSSTCHHF.js} +6083 -4167
- package/chunks/{chunk-ZGNDXPLU.js → chunk-DQD2753S.js} +3 -3
- package/chunks/{action-F2ZJNURT.js → chunk-EBNFCIKS.js} +7 -10
- package/chunks/{chunk-ATNTXKMS.js → chunk-F3OPMYME.js} +118 -38
- package/chunks/{chunk-KHF2QXBG.js → chunk-FG5AOTDN.js} +1433 -641
- package/chunks/{chunk-K2HIB5BA.js → chunk-GKCVATQJ.js} +3 -3
- package/chunks/{chunk-BIMLCGKS.js → chunk-GMHIK5K2.js} +1 -1
- package/chunks/{chunk-5SMP756H.js → chunk-GYR5E6RB.js} +2 -2
- package/chunks/{chunk-MC4EMNOR.js → chunk-HZN6IIPZ.js} +7 -6
- package/chunks/{chunk-VVRUSQCY.js → chunk-I57ID5K7.js} +13 -0
- package/chunks/{chunk-VYFGRLVQ.js → chunk-KOD2HX5I.js} +1 -1
- package/chunks/{chunk-ZKJPLWRJ.js → chunk-LOLVJNI5.js} +4 -4
- package/chunks/{chunk-GLWTVLKM.js → chunk-MN2AFJXM.js} +9 -2
- package/chunks/{chunk-WB6PWTMU.js → chunk-N5CJ5MTY.js} +1 -1
- package/chunks/{chunk-JXGF5EHC.js → chunk-NWJ37GI2.js} +23 -13
- package/chunks/{chunk-3ZJYGGAA.js → chunk-ORCUZITN.js} +1 -1
- package/chunks/{chunk-H467HDVV.js → chunk-QMLRYD76.js} +1 -1
- package/chunks/{chunk-43WALAW3.js → chunk-SEURG74P.js} +64 -115
- package/chunks/{chunk-G4HRW2FZ.js → chunk-SOV4POMS.js} +366 -253
- package/chunks/chunk-T34TL6KL.js +222 -0
- package/chunks/{chunk-WDIWLXLV.js → chunk-U6VE6JOS.js} +3 -3
- package/chunks/{chunk-MMWSCTDB.js → chunk-UFSFY7Z4.js} +19 -19
- package/chunks/{chunk-WIEXQUTD.js → chunk-ULRJZXMS.js} +1 -1
- package/chunks/{chunk-DHZW7Q7U.js → chunk-US54KYOJ.js} +2 -4
- package/chunks/{chunk-36LXIJIZ.js → chunk-V6LUKXBV.js} +1 -16
- package/chunks/{chunk-6M7TL2G2.js → chunk-VRZSDUZK.js} +45 -5
- package/chunks/chunk-VUXPDHTQ.js +22 -0
- package/chunks/chunk-XP5UM7SF.js +21 -0
- package/chunks/{chunk-IPZP3VRA.js → chunk-Y6XGC4K5.js} +5 -21
- package/chunks/{create.action-DBNIS665.js → create.action-ITEOQ644.js} +34 -32
- package/chunks/{delete.action-K7BLK7DK.js → delete.action-77MFPLUN.js} +29 -27
- package/chunks/{delete.action-GBOZC45K.js → delete.action-C6VX4S5Q.js} +30 -28
- package/chunks/{get.action-N3JOY3OU.js → get.action-3BP4FHZC.js} +16 -15
- package/chunks/{get.action-QHKMYZBK.js → get.action-LNBOWUVE.js} +24 -20
- package/chunks/{list.action-6SSO3JVN.js → list.action-6CRFQPJT.js} +39 -29
- package/chunks/{list.action-TJCS6UEY.js → list.action-KR5YIDR4.js} +37 -26
- package/chunks/{publish.action-T24VHRMR.js → publish.action-YBORRPBM.js} +45 -43
- package/chunks/{scripts-VIBLGKYG.js → scripts-6CI6U32J.js} +1 -1
- package/chunks/{update.action-VOE6PH5F.js → update.action-O7TSXDGV.js} +29 -27
- package/chunks/{update.action-OGYNBXRU.js → update.action-QZI7M2MV.js} +30 -28
- package/index.js +283 -278
- package/package.json +2 -2
- package/skills/scalar-cli/SKILL.md +49 -49
- package/template.md +66 -253
- package/chunks/action-FBRY5JKU.js +0 -37
- package/chunks/action-LYCNT3KA.js +0 -73
- package/chunks/action-OJ2NK25F.js +0 -121
- package/chunks/action-U2L5DCFG.js +0 -91
- package/chunks/chunk-MNNGUUKJ.js +0 -405
- package/chunks/chunk-ZGVZU6L2.js +0 -422
- package/docs.html +0 -6977
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
config
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-N5CJ5MTY.js";
|
|
5
5
|
import {
|
|
6
6
|
roleSchema
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-BQYVSPAI.js";
|
|
8
8
|
import {
|
|
9
9
|
output
|
|
10
10
|
} from "./chunk-T5HJUAWB.js";
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
emailSchema,
|
|
13
13
|
external_exports,
|
|
14
14
|
zod_default
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-I57ID5K7.js";
|
|
16
16
|
|
|
17
17
|
// ../../packages/entities/dist/token/token.js
|
|
18
18
|
var accessTokenPayloadSchema = external_exports.object({
|
|
@@ -44,16 +44,6 @@ var personalTokenPayloadSchema = external_exports.object({
|
|
|
44
44
|
iat: external_exports.number(),
|
|
45
45
|
exp: external_exports.number()
|
|
46
46
|
}).meta({ id: "personal-token-payload" });
|
|
47
|
-
var docsAgentTokenSchema = external_exports.object({
|
|
48
|
-
uid: external_exports.string(),
|
|
49
|
-
publishUid: external_exports.string(),
|
|
50
|
-
projectUid: external_exports.string(),
|
|
51
|
-
teamUid: external_exports.string(),
|
|
52
|
-
mcpServerId: external_exports.string(),
|
|
53
|
-
mcpInstallationId: external_exports.string(),
|
|
54
|
-
iat: external_exports.number(),
|
|
55
|
-
exp: external_exports.number()
|
|
56
|
-
}).meta({ id: "docs-agent-token" });
|
|
57
47
|
|
|
58
48
|
// ../../packages/entities/dist/token/payload.js
|
|
59
49
|
var tokenResponseSchema = external_exports.object({
|
|
@@ -226,7 +216,10 @@ var setMetadata = async (metadata) => {
|
|
|
226
216
|
const currentMetadata = await getMetadata();
|
|
227
217
|
const updatedMetadata = { ...currentMetadata, ...metadata };
|
|
228
218
|
const tmpPath = `${METADATA_FILE_PATH}.${process.pid}.tmp`;
|
|
229
|
-
await fs.writeFile(tmpPath, JSON.stringify(updatedMetadata)
|
|
219
|
+
await fs.writeFile(tmpPath, JSON.stringify(updatedMetadata), {
|
|
220
|
+
mode: 384
|
|
221
|
+
});
|
|
222
|
+
await fs.chmod(tmpPath, 384);
|
|
230
223
|
await fs.rename(tmpPath, METADATA_FILE_PATH);
|
|
231
224
|
metadataCache = {
|
|
232
225
|
mtimeMs: await getMetadataMtimeMs(),
|
|
@@ -301,13 +294,16 @@ var consumerClaimsSchema = external_exports.object({
|
|
|
301
294
|
teamUid: external_exports.string().min(1),
|
|
302
295
|
/**
|
|
303
296
|
* What the reader was admitted to: one docs project, registry record or
|
|
304
|
-
* MCP
|
|
305
|
-
* host and so an audience, and access is granted to each on its
|
|
306
|
-
* resource server checks this against what is being read.
|
|
297
|
+
* MCP server environment, or the namespace's own pages. Several of these
|
|
298
|
+
* share a host and so an audience, and access is granted to each on its
|
|
299
|
+
* own, so a resource server checks this against what is being read.
|
|
307
300
|
*/
|
|
308
301
|
res: external_exports.object({
|
|
309
302
|
kind: external_exports.enum(["project", "registry", "mcp", "namespace"]),
|
|
310
|
-
uid
|
|
303
|
+
/** For `mcp`, the server uid; an installation uuid when `environment` is absent. */
|
|
304
|
+
uid: external_exports.string().min(1).optional(),
|
|
305
|
+
/** For `mcp`, the environment slug of the server named by `uid`. */
|
|
306
|
+
environment: external_exports.string().min(1).optional()
|
|
311
307
|
}),
|
|
312
308
|
/** How the person proved the address */
|
|
313
309
|
via: external_exports.enum(["email", "google", "microsoft", "sso", "scalar"]),
|
|
@@ -342,6 +338,17 @@ function isAccessToken(token) {
|
|
|
342
338
|
}
|
|
343
339
|
|
|
344
340
|
// src/helpers/auth.ts
|
|
341
|
+
var claimsOf = (accessToken) => {
|
|
342
|
+
const { email, role, teamUid } = decode3(accessToken, accessTokenPayloadSchema);
|
|
343
|
+
return { email, role, teamUid };
|
|
344
|
+
};
|
|
345
|
+
var claimsIfReadable = (accessToken) => {
|
|
346
|
+
try {
|
|
347
|
+
return claimsOf(accessToken);
|
|
348
|
+
} catch {
|
|
349
|
+
return {};
|
|
350
|
+
}
|
|
351
|
+
};
|
|
345
352
|
var eventListeners = [];
|
|
346
353
|
var addEventListener = (callback) => {
|
|
347
354
|
eventListeners.push(callback);
|
|
@@ -349,35 +356,37 @@ var addEventListener = (callback) => {
|
|
|
349
356
|
var fireCallbacks = (auth) => eventListeners.forEach((callback) => callback(auth));
|
|
350
357
|
var setAuthData = async (authData) => {
|
|
351
358
|
await setMetadata({ auth: authData });
|
|
352
|
-
fireCallbacks(authData);
|
|
359
|
+
fireCallbacks({ ...authData, ...claimsIfReadable(authData.accessToken) });
|
|
353
360
|
};
|
|
361
|
+
var RENEWAL_MARGIN_MS = 6e4;
|
|
362
|
+
var SESSION_EXPIRED = "Your session has expired. Run `scalar auth login` to log in again.";
|
|
363
|
+
var SESSION_MOVED = "Your session moved to another team while this command ran. Run it again.";
|
|
364
|
+
var needsRenewal = (accessToken, marginMs = 0) => {
|
|
365
|
+
if (!isAccessToken(accessToken)) return true;
|
|
366
|
+
try {
|
|
367
|
+
const { exp } = decode3(accessToken, accessTokenPayloadSchema);
|
|
368
|
+
return exp * 1e3 - marginMs < Date.now();
|
|
369
|
+
} catch {
|
|
370
|
+
return true;
|
|
371
|
+
}
|
|
372
|
+
};
|
|
373
|
+
var renewAuth = async (auth) => "refreshToken" in auth ? refreshToken(auth.refreshToken) : generateAccessByPersonalToken({ personalToken: auth.personalToken });
|
|
354
374
|
var getAuthData = async (opts) => {
|
|
355
375
|
const { noExit } = opts ?? {};
|
|
356
376
|
const { auth } = await getMetadata();
|
|
357
377
|
if (!auth) {
|
|
358
|
-
if (noExit) throw new Error("
|
|
359
|
-
return output.error().title("
|
|
378
|
+
if (noExit) throw new Error("Authentication required");
|
|
379
|
+
return output.error().title("Authentication required").message("Run `scalar auth login` before running this command.").exit("error");
|
|
360
380
|
}
|
|
361
|
-
|
|
362
|
-
auth.accessToken,
|
|
363
|
-
accessTokenPayloadSchema
|
|
364
|
-
);
|
|
365
|
-
const isExpired = exp * 1e3 < Date.now() || !isAccessToken(auth.accessToken);
|
|
366
|
-
if (!isExpired) {
|
|
367
|
-
return { ...auth, email, role, teamUid, addEventListener };
|
|
381
|
+
if (!needsRenewal(auth.accessToken)) {
|
|
382
|
+
return { ...auth, ...claimsOf(auth.accessToken), addEventListener };
|
|
368
383
|
}
|
|
369
384
|
try {
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
return { ...updatedAuth2, email, role, teamUid, addEventListener };
|
|
373
|
-
}
|
|
374
|
-
const updatedAuth = await generateAccessByPersonalToken({
|
|
375
|
-
personalToken: auth.personalToken
|
|
376
|
-
});
|
|
377
|
-
return { ...updatedAuth, email, role, teamUid, addEventListener };
|
|
385
|
+
const renewed = await renewAuth(auth);
|
|
386
|
+
return { ...renewed, ...claimsOf(renewed.accessToken), addEventListener };
|
|
378
387
|
} catch {
|
|
379
|
-
if (noExit) throw new Error(
|
|
380
|
-
return output.error().title("
|
|
388
|
+
if (noExit) throw new Error(SESSION_EXPIRED);
|
|
389
|
+
return output.error().title("Session expired").message(SESSION_EXPIRED).exit("error");
|
|
381
390
|
}
|
|
382
391
|
};
|
|
383
392
|
var clearAuthData = async () => {
|
|
@@ -444,6 +453,11 @@ export {
|
|
|
444
453
|
setMetadata,
|
|
445
454
|
getMetadata,
|
|
446
455
|
setAuthData,
|
|
456
|
+
RENEWAL_MARGIN_MS,
|
|
457
|
+
SESSION_EXPIRED,
|
|
458
|
+
SESSION_MOVED,
|
|
459
|
+
needsRenewal,
|
|
460
|
+
renewAuth,
|
|
447
461
|
getAuthData,
|
|
448
462
|
CLI_CLIENT_ID,
|
|
449
463
|
requestTokens,
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
emailAllowanceSchema,
|
|
4
4
|
teamImageSchema,
|
|
5
5
|
teamNameSchema
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-BQYVSPAI.js";
|
|
7
7
|
import {
|
|
8
8
|
brandedUid,
|
|
9
9
|
emailSchema,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
mintUid,
|
|
13
13
|
timestampSchema,
|
|
14
14
|
zod_default
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-I57ID5K7.js";
|
|
16
16
|
|
|
17
17
|
// ../../packages/entities/dist/user/bitbucket.js
|
|
18
18
|
var userBitbucketSchema = entitySchema.extend({
|
|
@@ -22,6 +22,12 @@ var userBitbucketSchema = entitySchema.extend({
|
|
|
22
22
|
refreshExpiry: timestampSchema
|
|
23
23
|
}).meta({ id: "user-bitbucket" });
|
|
24
24
|
|
|
25
|
+
// ../../packages/entities/dist/user/forgejo.js
|
|
26
|
+
var userForgejoSchema = entitySchema.extend({
|
|
27
|
+
/** Personal access token with repository read and write scope */
|
|
28
|
+
token: external_exports.string()
|
|
29
|
+
}).meta({ id: "user-forgejo" });
|
|
30
|
+
|
|
25
31
|
// ../../packages/entities/dist/user/github.js
|
|
26
32
|
var userGithubSchema = entitySchema.extend({
|
|
27
33
|
token: zod_default.string(),
|
|
@@ -33,6 +39,7 @@ var userGithubSchema = entitySchema.extend({
|
|
|
33
39
|
// ../../packages/entities/dist/user/password.js
|
|
34
40
|
var userPasswordSchema = entitySchema.extend({
|
|
35
41
|
passwordHash: external_exports.string().nullable().default(null),
|
|
42
|
+
passwordSetAt: external_exports.number().int().nullable().default(null),
|
|
36
43
|
salt: external_exports.string().nullable().default(null),
|
|
37
44
|
password: external_exports.string().nullable().default(null),
|
|
38
45
|
passwordDeprecatedExp: external_exports.number().nullable().default(null)
|
|
@@ -82,8 +89,6 @@ var userSchema = entitySchema.extend({
|
|
|
82
89
|
activeTeamId: zod_default.string().brand().nullable().meta({ examples: ["GakgbKJ5m9gl0JDMbcJqL"] }),
|
|
83
90
|
hasGithub: zod_default.boolean().optional().default(false).meta({ examples: [true] }),
|
|
84
91
|
hasBitbucket: zod_default.boolean().optional().default(false),
|
|
85
|
-
/** Forgejo personal access token for git operations */
|
|
86
|
-
forgejoToken: zod_default.string().optional(),
|
|
87
92
|
/**
|
|
88
93
|
* Invite emails this user has sent from teams without a paid plan, in the
|
|
89
94
|
* current day and month.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
safeNormalize
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-QMLRYD76.js";
|
|
5
5
|
import {
|
|
6
6
|
isUrl
|
|
7
7
|
} from "./chunk-4ORL4MST.js";
|
|
@@ -23,7 +23,11 @@ var printSpecificationBanner = (result) => {
|
|
|
23
23
|
);
|
|
24
24
|
output.info().title(
|
|
25
25
|
`${as.white.bold(schema?.info?.title)} ${as.grey(`(OpenAPI v${version})`)}`
|
|
26
|
-
).title(
|
|
26
|
+
).title(
|
|
27
|
+
as.grey(
|
|
28
|
+
`${pathsCount} ${pathsCount === 1 ? "path" : "paths"}, ${operationsCount} ${operationsCount === 1 ? "operation" : "operations"}`
|
|
29
|
+
)
|
|
30
|
+
).print();
|
|
27
31
|
};
|
|
28
32
|
|
|
29
33
|
// src/domains/document/helpers/is-document.ts
|
|
@@ -37,12 +41,12 @@ var getFileOrUrl = async (input) => {
|
|
|
37
41
|
if (isUrl(input)) {
|
|
38
42
|
const response = await fetch(input);
|
|
39
43
|
if (!response.ok) {
|
|
40
|
-
return output.error().title("
|
|
44
|
+
return output.error().title("Could not fetch the API description from the URL").exit("error");
|
|
41
45
|
}
|
|
42
46
|
return await response.text();
|
|
43
47
|
}
|
|
44
48
|
if (!fs.existsSync(input)) {
|
|
45
|
-
return output.error().title("Could not read file
|
|
49
|
+
return output.error().title("Could not read the API description file").exit("error");
|
|
46
50
|
}
|
|
47
51
|
return fs.readFileSync(input, "utf-8");
|
|
48
52
|
};
|
|
@@ -50,14 +54,14 @@ var loadOpenApiDocument = async (content) => {
|
|
|
50
54
|
try {
|
|
51
55
|
const document = safeNormalize(content);
|
|
52
56
|
if (!isDocument(document)) {
|
|
53
|
-
throw new Error("Could not parse
|
|
57
|
+
throw new Error("Could not parse the OpenAPI description.");
|
|
54
58
|
}
|
|
55
59
|
if (isDocument(document.info) && typeof document.info.version !== "string") {
|
|
56
60
|
document.info.version = "0.1.0";
|
|
57
61
|
}
|
|
58
62
|
const result = validate(document);
|
|
59
63
|
if (!result.valid) {
|
|
60
|
-
output.warn().title("
|
|
64
|
+
output.warn().title("API description does not match the OpenAPI specification").print();
|
|
61
65
|
result.errors.forEach((error) => {
|
|
62
66
|
output.warn().title(
|
|
63
67
|
error.path ? `${error.message} (${error.path})` : error.message
|
|
@@ -72,7 +76,7 @@ var loadOpenApiDocument = async (content) => {
|
|
|
72
76
|
schema: result.schema
|
|
73
77
|
};
|
|
74
78
|
} catch (error) {
|
|
75
|
-
output.error().title(error ? as2.red(error.toString()) : "
|
|
79
|
+
output.error().title(error ? as2.red(error.toString()) : "An unexpected error occurred").print();
|
|
76
80
|
const message = typeof error === "object" && error !== null && "message" in error ? String(error.message) : "Unknown error";
|
|
77
81
|
return {
|
|
78
82
|
valid: false,
|
|
@@ -2,16 +2,16 @@ import { createRequire as $$cR } from "node:module"; const require = $$cR(import
|
|
|
2
2
|
import {
|
|
3
3
|
findConfig,
|
|
4
4
|
parseConfig
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-CSSTCHHF.js";
|
|
6
6
|
import {
|
|
7
7
|
ConfigVersion
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-VRZSDUZK.js";
|
|
9
9
|
import {
|
|
10
10
|
output
|
|
11
11
|
} from "./chunk-T5HJUAWB.js";
|
|
12
12
|
import {
|
|
13
13
|
external_exports
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-I57ID5K7.js";
|
|
15
15
|
|
|
16
16
|
// src/domains/project/check-config/parse-config.ts
|
|
17
17
|
import fs from "node:fs";
|
|
@@ -23,7 +23,7 @@ function readAndParseConfig(configPath) {
|
|
|
23
23
|
success: false,
|
|
24
24
|
error: {
|
|
25
25
|
type: "file-not-found",
|
|
26
|
-
message: "Could not find the Scalar
|
|
26
|
+
message: "Could not find the Scalar configuration file",
|
|
27
27
|
inputPath: configPath
|
|
28
28
|
}
|
|
29
29
|
};
|
|
@@ -36,7 +36,7 @@ function readAndParseConfig(configPath) {
|
|
|
36
36
|
success: false,
|
|
37
37
|
error: {
|
|
38
38
|
type: "validation-error",
|
|
39
|
-
message: "
|
|
39
|
+
message: "Scalar configuration is invalid",
|
|
40
40
|
filePath: file,
|
|
41
41
|
prettyError: external_exports.prettifyError(parseConfigResult.error),
|
|
42
42
|
version: parseConfigResult.version
|
|
@@ -47,7 +47,7 @@ function readAndParseConfig(configPath) {
|
|
|
47
47
|
success: false,
|
|
48
48
|
error: {
|
|
49
49
|
type: "parse-error",
|
|
50
|
-
message: "Could not parse the Scalar
|
|
50
|
+
message: "Could not parse the Scalar configuration file",
|
|
51
51
|
filePath: file,
|
|
52
52
|
detail: typeof parseConfigResult.error === "string" ? parseConfigResult.error : parseConfigResult.error instanceof Error ? parseConfigResult.error.message : void 0
|
|
53
53
|
}
|
|
@@ -65,20 +65,20 @@ function readAndParseConfig(configPath) {
|
|
|
65
65
|
import as from "ansis";
|
|
66
66
|
function renderConfigError(error) {
|
|
67
67
|
if (error.type === "file-not-found") {
|
|
68
|
-
return output.error().title("Scalar
|
|
68
|
+
return output.error().title("Scalar configuration file not found").message(error.inputPath).line(
|
|
69
69
|
as.grey(
|
|
70
70
|
"Create a `scalar.config.json`, or pass the path to your configuration file as an argument."
|
|
71
71
|
)
|
|
72
72
|
).exit("error");
|
|
73
73
|
}
|
|
74
74
|
if (error.type === "parse-error") {
|
|
75
|
-
const block2 = output.error().title("Invalid configuration file").message("Could not parse the Scalar
|
|
75
|
+
const block2 = output.error().title("Invalid configuration file").message("Could not parse the Scalar configuration file:").line(error.filePath);
|
|
76
76
|
if (error.detail) {
|
|
77
77
|
block2.message(error.detail);
|
|
78
78
|
}
|
|
79
79
|
return block2.exit("error");
|
|
80
80
|
}
|
|
81
|
-
const block = output.error().title("
|
|
81
|
+
const block = output.error().title("Scalar configuration is invalid").message(error.filePath);
|
|
82
82
|
const note = versionNote(error.version);
|
|
83
83
|
if (note) {
|
|
84
84
|
block.line(note);
|
|
@@ -91,7 +91,7 @@ function renderConfigError(error) {
|
|
|
91
91
|
}
|
|
92
92
|
function versionNote(version) {
|
|
93
93
|
if (version === ConfigVersion.V2) {
|
|
94
|
-
return as.grey("Validated as Scalar
|
|
94
|
+
return as.grey("Validated as Scalar configuration v2.0.0.");
|
|
95
95
|
}
|
|
96
96
|
if (version === ConfigVersion.V1) {
|
|
97
97
|
return as.grey(
|
|
@@ -2,7 +2,7 @@ import { createRequire as $$cR } from "node:module"; const require = $$cR(import
|
|
|
2
2
|
import {
|
|
3
3
|
getPublishPreviewUrl,
|
|
4
4
|
getPublishUrl
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-UFSFY7Z4.js";
|
|
6
6
|
|
|
7
7
|
// src/domains/project/publish/url.ts
|
|
8
8
|
function getPublishDeploymentUrl(publish) {
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
external_exports
|
|
4
|
+
} from "./chunk-I57ID5K7.js";
|
|
5
|
+
|
|
6
|
+
// ../../packages/entities/dist/environment/schema.js
|
|
7
|
+
var DEFAULT_ENVIRONMENT = "production";
|
|
8
|
+
var RESERVED_ENVIRONMENT_SLUGS = ["latest", "all"];
|
|
9
|
+
var ENVIRONMENT_SLUG_PATTERN = /^[a-z][a-z0-9-]{0,62}[a-z0-9]$/;
|
|
10
|
+
var MAX_TEAM_ENVIRONMENTS = 20;
|
|
11
|
+
var environmentSlugSchema = external_exports.string().regex(ENVIRONMENT_SLUG_PATTERN, {
|
|
12
|
+
message: "Environment slugs are 2 to 64 lowercase letters, digits or hyphens, starting with a letter and ending with a letter or digit."
|
|
13
|
+
}).refine((slug) => !RESERVED_ENVIRONMENT_SLUGS.includes(slug), {
|
|
14
|
+
message: `Environment slugs cannot be ${RESERVED_ENVIRONMENT_SLUGS.join(" or ")}.`
|
|
15
|
+
}).meta({ id: "environment-slug", examples: ["staging"] });
|
|
16
|
+
var teamEnvironmentSchema = external_exports.object({
|
|
17
|
+
slug: environmentSlugSchema,
|
|
18
|
+
name: external_exports.string().max(50),
|
|
19
|
+
/** Git branch globs that resolve here. List order is match order. */
|
|
20
|
+
branches: external_exports.string().array().default([])
|
|
21
|
+
}).meta({ id: "team-environment" });
|
|
22
|
+
var defaultTeamEnvironments = () => [
|
|
23
|
+
{ slug: "development", name: "Development", branches: ["develop", "dev"] },
|
|
24
|
+
{ slug: "staging", name: "Staging", branches: ["staging", "release/*"] },
|
|
25
|
+
{
|
|
26
|
+
slug: DEFAULT_ENVIRONMENT,
|
|
27
|
+
name: "Production",
|
|
28
|
+
branches: ["main", "master"]
|
|
29
|
+
}
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
export {
|
|
33
|
+
MAX_TEAM_ENVIRONMENTS,
|
|
34
|
+
environmentSlugSchema,
|
|
35
|
+
teamEnvironmentSchema,
|
|
36
|
+
defaultTeamEnvironments
|
|
37
|
+
};
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
customProjectIconSchema
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-VRZSDUZK.js";
|
|
5
|
+
import {
|
|
6
|
+
MAX_TEAM_ENVIRONMENTS,
|
|
7
|
+
defaultTeamEnvironments,
|
|
8
|
+
teamEnvironmentSchema
|
|
9
|
+
} from "./chunk-AVZFSWPD.js";
|
|
5
10
|
import {
|
|
6
11
|
brandedUid,
|
|
7
12
|
emailSchema,
|
|
@@ -14,7 +19,7 @@ import {
|
|
|
14
19
|
slugSchema,
|
|
15
20
|
timestampSchema,
|
|
16
21
|
unixTimestamp
|
|
17
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-I57ID5K7.js";
|
|
18
23
|
|
|
19
24
|
// ../../packages/entities/dist/team/access.js
|
|
20
25
|
var ExternalAccessMethod;
|
|
@@ -378,6 +383,13 @@ var teamSchema = entitySchema.extend({
|
|
|
378
383
|
namespaces: namespaceSchema.array().refine((ns) => !ns.includes("share"), {
|
|
379
384
|
message: '"share" is a reserved namespace and cannot be used'
|
|
380
385
|
}).default([]),
|
|
386
|
+
/**
|
|
387
|
+
* The team's environment vocabulary, shared by every entity: each entity's
|
|
388
|
+
* own environments are a subset of it. `production` is always in it and
|
|
389
|
+
* cannot be removed; a version's tag names an environment only once it is
|
|
390
|
+
* listed here.
|
|
391
|
+
*/
|
|
392
|
+
environments: teamEnvironmentSchema.array().max(MAX_TEAM_ENVIRONMENTS).default(defaultTeamEnvironments),
|
|
381
393
|
users: userRefSchema.array(),
|
|
382
394
|
icons: customProjectIconSchema.array().default([]),
|
|
383
395
|
pendingInvites: pendingInviteSchema.array().default([]),
|