@scalar/cli 2.17.0 → 2.18.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.
Files changed (94) hide show
  1. package/README.md +77 -3
  2. package/chunks/{action-Y4L4OPPH.js → action-2WVJ2WEW.js} +15 -16
  3. package/chunks/{action-UOUS2G2B.js → action-4BDZ2CXP.js} +6 -7
  4. package/chunks/{action-52ZSECW2.js → action-5AXDB5VN.js} +14 -15
  5. package/chunks/{action-7PVWQJ7V.js → action-6I3TJLRO.js} +28 -26
  6. package/chunks/{action-MPBZUWQ2.js → action-6WZN63LT.js} +20 -19
  7. package/chunks/{action-5NYKJDBG.js → action-7GZGVTYI.js} +1067 -766
  8. package/chunks/{action-2Y6UTXAG.js → action-7ZCJAWI2.js} +5 -5
  9. package/chunks/{action-UWVZ6V7B.js → action-A6YOY24G.js} +5 -5
  10. package/chunks/{action-KJJ35X2T.js → action-AGGHY4N2.js} +21 -20
  11. package/chunks/{action-MKZYWAXH.js → action-BVZOA2G5.js} +9 -10
  12. package/chunks/{action-5TQHROY5.js → action-BYDJ4R4F.js} +14 -15
  13. package/chunks/{action-VJDK7ROI.js → action-CBAL5CYB.js} +16 -17
  14. package/chunks/action-COFGCCYS.js +89 -0
  15. package/chunks/action-CYU5Q5LT.js +254 -0
  16. package/chunks/{action-XMANK72Z.js → action-DTQH6CKR.js} +24 -23
  17. package/chunks/{action-AFZE62DU.js → action-ED5WLLIE.js} +6 -7
  18. package/chunks/action-F4CQ4DW3.js +654 -0
  19. package/chunks/{action-TA6VOPQ5.js → action-GVW5PSPT.js} +17 -18
  20. package/chunks/{action-TTDV5NIP.js → action-H5VRLFCY.js} +5 -5
  21. package/chunks/{action-2SZMLOYJ.js → action-IWEAWDT3.js} +9 -10
  22. package/chunks/{action-3EATJRIK.js → action-JN6JVQUV.js} +14 -15
  23. package/chunks/{action-WPUITVPF.js → action-KVM76ZKQ.js} +11 -11
  24. package/chunks/{action-PS4F4QWI.js → action-LLMFEBHH.js} +3 -4
  25. package/chunks/{action-WUMW2GH6.js → action-PEG7AUA6.js} +14 -13
  26. package/chunks/{action-UVWH2KZY.js → action-QC72LLYE.js} +7 -5
  27. package/chunks/{action-P5MGMJG3.js → action-QP6MRSQW.js} +15 -14
  28. package/chunks/{action-W47MFJSP.js → action-R53K22GE.js} +219 -45
  29. package/chunks/{action-RWITXLMW.js → action-SJPWL723.js} +5 -4
  30. package/chunks/{action-SBD4TFRS.js → action-T3R4SDAI.js} +5 -5
  31. package/chunks/{action-GOKWY3AQ.js → action-TT7ZJNST.js} +20 -19
  32. package/chunks/{action-LALZGEVR.js → action-UPVVJE26.js} +14 -15
  33. package/chunks/{action-RM4RZFZV.js → action-V35W4MRK.js} +10 -11
  34. package/chunks/{action-J3C4LAT5.js → action-W4KGRBRV.js} +5 -5
  35. package/chunks/{action-VWQNDXZT.js → action-ZIVYJCC2.js} +14 -15
  36. package/chunks/{action-LI6DZLDZ.js → action-ZU5X2KQX.js} +22 -21
  37. package/chunks/{actions-GWMW7V2B.js → actions-CERT7BL4.js} +16 -16
  38. package/chunks/{actions-4X5RTQCM.js → actions-RCIS37Y6.js} +14 -15
  39. package/chunks/{agent-LB5ZCVUN.js → agent-CT3RRYPJ.js} +7 -7
  40. package/chunks/{asyncapi-J6VAMIMO.js → asyncapi-DVBS23QW.js} +9 -10
  41. package/chunks/{build.action-YP46CGLS.js → build.action-7MKMMV6V.js} +16 -17
  42. package/chunks/{chunk-B3CMXTHQ.js → chunk-36UI2W7I.js} +1 -1
  43. package/chunks/{chunk-4TSZVWGM.js → chunk-4BMOCIYO.js} +19 -4
  44. package/chunks/{chunk-SKXMYIA2.js → chunk-5EO2CVAR.js} +4 -4
  45. package/chunks/{chunk-4YQNT5UH.js → chunk-5GZAGHKL.js} +1 -1
  46. package/chunks/{chunk-3BZ3VY6H.js → chunk-7LUXRNKV.js} +27 -2
  47. package/chunks/{chunk-KDEKIOIP.js → chunk-CWCRBWA6.js} +1 -1
  48. package/chunks/{chunk-YFUHTGGP.js → chunk-CYIGEQOJ.js} +2 -2
  49. package/chunks/{chunk-I4FQOD5L.js → chunk-DVA4NCCY.js} +3 -3
  50. package/chunks/{chunk-63AB5A5B.js → chunk-F6E7FJEC.js} +6 -6
  51. package/chunks/{chunk-2KMYC3ZI.js → chunk-FMPJSW6A.js} +2 -2
  52. package/chunks/{chunk-IZ3UMB7D.js → chunk-GCVB22TG.js} +2 -2
  53. package/chunks/{chunk-36AMOACU.js → chunk-GXKNYM54.js} +3 -3
  54. package/chunks/chunk-I25ZCHBJ.js +22 -0
  55. package/chunks/{chunk-KYCM5SL3.js → chunk-JBMHCTZD.js} +1 -0
  56. package/chunks/{chunk-57EMU765.js → chunk-JEOQ7LSA.js} +1 -1
  57. package/chunks/{chunk-DXEHHE6H.js → chunk-KI2AVDKM.js} +6 -4
  58. package/chunks/{chunk-QDT27U6O.js → chunk-KSY2GH53.js} +2 -2
  59. package/chunks/{chunk-LS6XOFVD.js → chunk-KWQVA66H.js} +11 -23
  60. package/chunks/{chunk-KJT4VYUO.js → chunk-LPWRG2MS.js} +1 -1
  61. package/chunks/{chunk-NKCM2UH5.js → chunk-LVUMNGVA.js} +1 -1
  62. package/chunks/{chunk-H6LOSAC7.js → chunk-M34HMQMV.js} +39 -83
  63. package/chunks/{chunk-XGKFAPON.js → chunk-MRZ5A7LB.js} +4 -4
  64. package/chunks/chunk-O3I3LTTJ.js +24 -0
  65. package/chunks/{chunk-XQPB4OGW.js → chunk-O4DJIA6Y.js} +2 -19
  66. package/chunks/{action-B3IDMFFO.js → chunk-OKLL5422.js} +5 -243
  67. package/chunks/{chunk-RVZZQKVE.js → chunk-PMDHYIB4.js} +4 -22
  68. package/chunks/{chunk-BIYCLKLZ.js → chunk-RELSIFIL.js} +1 -1
  69. package/chunks/{chunk-QLKBXVUV.js → chunk-RGJPENX7.js} +1 -1
  70. package/chunks/{chunk-3KK72EMO.js → chunk-RHAQ4XBA.js} +3 -3
  71. package/chunks/{action-S7DB6MBK.js → chunk-RQ7QBRJT.js} +1 -82
  72. package/chunks/chunk-S3LY7RKP.js +54 -0
  73. package/chunks/{chunk-X2NZINNR.js → chunk-S5OGPH2P.js} +3 -3
  74. package/chunks/{chunk-VNMVAJ6X.js → chunk-U36HEOGO.js} +17 -21
  75. package/chunks/{chunk-CAD672DX.js → chunk-Y3CXAIAG.js} +1 -1
  76. package/chunks/{chunk-HNWIIDGX.js → chunk-Z7EH7CJC.js} +3 -3
  77. package/chunks/{chunk-SVDXXGEO.js → chunk-ZMJW5UWU.js} +3 -3
  78. package/chunks/{chunk-UI5PWDNE.js → chunk-ZQDAPKWX.js} +9 -16
  79. package/chunks/{create.action-PRZKNQHM.js → create.action-VA2ISPIM.js} +16 -17
  80. package/chunks/{delete.action-G7OAQBR5.js → delete.action-AIWMDGXV.js} +16 -17
  81. package/chunks/{delete.action-2BLCOX6Y.js → delete.action-GEN6OD7A.js} +16 -17
  82. package/chunks/{diff.action-KDOJQVJ5.js → diff.action-LBK656RN.js} +15 -14
  83. package/chunks/{get.action-IKO22SCB.js → get.action-5SWRNQ3D.js} +15 -14
  84. package/chunks/{get.action-HSYV5TFY.js → get.action-UPPPGGI4.js} +17 -18
  85. package/chunks/{list.action-KYIFUM3C.js → list.action-YJZBC25S.js} +17 -18
  86. package/chunks/{list.action-IVJS7UFI.js → list.action-YOWWC4I4.js} +19 -20
  87. package/chunks/{publish.action-2QIOUMVY.js → publish.action-QMVDHDJZ.js} +22 -21
  88. package/chunks/{update.action-XZD6T5UR.js → update.action-GFDZIGEP.js} +17 -18
  89. package/chunks/{update.action-7QATFOGP.js → update.action-SNGKPS7A.js} +16 -17
  90. package/index.js +194 -154
  91. package/package.json +11 -11
  92. package/skills/scalar-cli/SKILL.md +3 -2
  93. package/template.md +76 -2
  94. package/chunks/chunk-YTJ67DWS.js +0 -32
@@ -2,48 +2,13 @@ import { createRequire as $$cR } from "node:module"; const require = $$cR(import
2
2
  import {
3
3
  childReferenceContext
4
4
  } from "./chunk-DWWY3LPC.js";
5
- import {
6
- writeFileAtomic
7
- } from "./chunk-CNJ4TLU7.js";
8
5
  import {
9
6
  isDocument
10
7
  } from "./chunk-WGTZEX4Y.js";
11
- import "./chunk-KDEKIOIP.js";
12
- import {
13
- DEFAULT_FETCH_CONCURRENCY
14
- } from "./chunk-V7DBDXSJ.js";
15
- import "./chunk-A2MPF6GE.js";
16
- import "./chunk-FDW4LC45.js";
17
- import {
18
- confirm,
19
- requireInteractive
20
- } from "./chunk-XUX6JXU5.js";
21
- import "./chunk-IRQJDPZE.js";
22
- import {
23
- isUrl,
24
- isYamlFileName
25
- } from "./chunk-4ORL4MST.js";
26
- import "./chunk-QDT27U6O.js";
27
- import {
28
- output
29
- } from "./chunk-T5HJUAWB.js";
30
8
  import {
31
9
  err,
32
10
  ok
33
11
  } from "./chunk-DUIMDHQQ.js";
34
- import "./chunk-CAD672DX.js";
35
- import "./chunk-4YQNT5UH.js";
36
- import "./chunk-KYCM5SL3.js";
37
- import "./chunk-3MZYUBJ6.js";
38
-
39
- // src/domains/document/bundle/action.ts
40
- import fs2 from "node:fs/promises";
41
- import path2 from "node:path";
42
- import { cwd } from "node:process";
43
- import as from "ansis";
44
- import YAML from "yaml";
45
- import { fetchUrls, readFiles } from "@scalar/json-magic/bundle/plugins/node";
46
- import { isJsonObject } from "@scalar/json-magic/helpers/is-json-object";
47
12
 
48
13
  // src/domains/document/bundle/bundle-document.ts
49
14
  import { bundle } from "@scalar/json-magic/bundle";
@@ -90,24 +55,6 @@ var bundleDocument = async (inspected, origin, options) => {
90
55
  );
91
56
  };
92
57
 
93
- // src/domains/document/bundle/inspect-output.ts
94
- import fs from "node:fs/promises";
95
- async function inspectOutput(fileName) {
96
- if (!fileName || fileName === "-")
97
- return ok({ exists: false, isDirectory: false, isSpecial: false });
98
- return fs.stat(fileName).then(
99
- (stat) => ok({
100
- exists: true,
101
- isDirectory: stat.isDirectory(),
102
- isSpecial: !stat.isFile() && !stat.isDirectory()
103
- })
104
- ).catch((error) => {
105
- if (error.code === "ENOENT" || error.code === "ENOTDIR")
106
- return ok({ exists: false, isDirectory: false, isSpecial: false });
107
- return err(`Could not inspect output ${fileName}: ${error.message}`);
108
- });
109
- }
110
-
111
58
  // src/domains/document/bundle/references.ts
112
59
  import {
113
60
  resolveReferencePath
@@ -136,7 +83,7 @@ var inspectReferences = async (input, loaders) => {
136
83
  const visited = /* @__PURE__ */ new WeakMap();
137
84
  const swagger = root.data.swagger === "2.0";
138
85
  const visit = (location) => {
139
- const { value, context, path: path3, source } = location;
86
+ const { value, context, path, source } = location;
140
87
  if (value === null || typeof value !== "object" || context === "data")
141
88
  return;
142
89
  const contexts = visited.get(value) ?? /* @__PURE__ */ new Set();
@@ -148,7 +95,7 @@ var inspectReferences = async (input, loaders) => {
148
95
  visit({
149
96
  ...location,
150
97
  value: child,
151
- path: [...path3, String(index)],
98
+ path: [...path, String(index)],
152
99
  context: context === "messages" ? "message" : context === "objects" ? "object" : context === "schemas" ? "schema" : context
153
100
  });
154
101
  });
@@ -193,7 +140,7 @@ var inspectReferences = async (input, loaders) => {
193
140
  visit({
194
141
  value: child,
195
142
  source,
196
- path: [...path3, key],
143
+ path: [...path, key],
197
144
  origin,
198
145
  context: childContext
199
146
  });
@@ -310,192 +257,7 @@ var resolvePointer = (resource, fragment, exposed) => {
310
257
  }
311
258
  };
312
259
 
313
- // src/domains/document/bundle/resolve-output.ts
314
- import path from "node:path";
315
- function formatOf(extension) {
316
- return extension === "json" ? "json" : "yaml";
317
- }
318
- function formatOfFileName(fileName) {
319
- return isYamlFileName(fileName) ? "yaml" : "json";
320
- }
321
- function resolveOutput(input, output2, ext, state = {}, paths = path) {
322
- if (!output2) {
323
- const format = formatOfFileName(input);
324
- if (ext && formatOf(ext) !== format) {
325
- return err(
326
- "Changing the input format requires --output. Use --output <file> with --ext."
327
- );
328
- }
329
- return ok({ fileName: input, format, stdout: false });
330
- }
331
- if (output2 === "-") {
332
- return ok({
333
- fileName: "-",
334
- format: ext ? formatOf(ext) : "input",
335
- stdout: true
336
- });
337
- }
338
- const directory = state.isDirectory || (paths.sep === "\\" ? /[\\/]$/ : /\/$/).test(output2);
339
- const inputName = isUrl(input) ? urlFileName(input) : paths.basename(input);
340
- const fileName = directory ? paths.join(output2, inputName) : output2;
341
- const suffix = paths.extname(fileName);
342
- const recognized = suffix.toLowerCase() === ".json" || isYamlFileName(fileName);
343
- if (!directory && (state.isSpecial || state.exists && !ext)) {
344
- return ok({
345
- fileName,
346
- format: ext ? formatOf(ext) : formatOfFileName(fileName),
347
- stdout: false
348
- });
349
- }
350
- if (ext) {
351
- const stem = recognized ? fileName.slice(0, fileName.length - suffix.length) : fileName;
352
- return ok({
353
- fileName: `${stem}.${ext}`,
354
- format: formatOf(ext),
355
- stdout: false
356
- });
357
- }
358
- if (directory && !recognized || !suffix) {
359
- return ok({ fileName: `${fileName}.yaml`, format: "yaml", stdout: false });
360
- }
361
- return ok({ fileName, format: formatOfFileName(fileName), stdout: false });
362
- }
363
- function urlFileName(input) {
364
- const basename = path.posix.basename(new URL(input).pathname);
365
- const decoded = (() => {
366
- try {
367
- return decodeURIComponent(basename);
368
- } catch {
369
- return basename;
370
- }
371
- })();
372
- const name = decoded.replace(/[<>:"|?*\\/\p{Cc}]/gu, "_").replace(/[. ]+$/, "");
373
- if (!name) return "openapi";
374
- return /^(con|prn|aux|nul|com[1-9]|lpt[1-9])(?:\.|$)/i.test(name) ? `_${name}` : name;
375
- }
376
-
377
- // src/domains/document/bundle/action.ts
378
- function serializeBundle(value, isYaml) {
379
- try {
380
- return ok(isYaml ? YAML.stringify(value) : JSON.stringify(value));
381
- } catch (error) {
382
- return err(`Could not serialize bundle: ${String(error)}`);
383
- }
384
- }
385
- async function bundleAction(input, {
386
- output: outputFilePath,
387
- treeShake,
388
- urlMap,
389
- fetchLimit,
390
- force,
391
- ext
392
- }) {
393
- if (!input) {
394
- return output.error().title("Missing input").message("Provide a file path or URL to bundle.").exit("error");
395
- }
396
- const isUrlInput = isUrl(input);
397
- if (!outputFilePath && isUrlInput) {
398
- return output.error().message("URL input requires an output file. Use `--output <file>`.").exit("error");
399
- }
400
- const inspectedOutput = await inspectOutput(outputFilePath);
401
- if (!inspectedOutput.ok)
402
- return output.error().message(inspectedOutput.error).exit("error");
403
- const destination = resolveOutput(
404
- input,
405
- outputFilePath,
406
- ext,
407
- inspectedOutput.data
408
- );
409
- if (!destination.ok)
410
- return output.error().message(destination.error).exit("error");
411
- const resolvedInput = isUrlInput ? input : path2.resolve(cwd(), input);
412
- const resolvedOutput = destination.data.stdout ? void 0 : await fs2.realpath(destination.data.fileName).catch(() => path2.resolve(destination.data.fileName));
413
- const inputTarget = isUrlInput ? void 0 : await fs2.realpath(resolvedInput).catch(() => resolvedInput);
414
- if (!outputFilePath || inputTarget !== void 0 && resolvedOutput === inputTarget) {
415
- requireInteractive(
416
- "Pass --output with a different destination to bundle a document in non-interactive mode."
417
- );
418
- const shouldContinue = await confirm({
419
- message: `Overwrite "${input}"?`,
420
- initialValue: false
421
- });
422
- if (shouldContinue !== true) {
423
- return output.error().message("Operation cancelled.").exit("error");
424
- }
425
- }
426
- const {
427
- fileName: outputFileName,
428
- format,
429
- stdout: isStdout
430
- } = destination.data;
431
- const startedAt = performance.now();
432
- const inspected = await inspectReferences(resolvedInput, [
433
- readFiles(),
434
- fetchUrls({ limit: fetchLimit ?? DEFAULT_FETCH_CONCURRENCY })
435
- ]);
436
- if (!inspected.ok) {
437
- return output.error().message(inspected.error).exit("error");
438
- }
439
- const root = format === "input" ? await inspected.data.loader.exec(resolvedInput) : void 0;
440
- const isYaml = root?.ok ? !isJsonObject(root.raw.trimStart()) : format === "yaml";
441
- const { diagnostics } = inspected.data;
442
- for (const diagnostic of diagnostics) {
443
- const source = path2.isAbsolute(diagnostic.source) ? path2.relative(cwd(), diagnostic.source) || "." : diagnostic.source;
444
- if (isStdout) {
445
- process.stderr.write(
446
- `${source}${diagnostic.pointer}: ${diagnostic.message}
447
- Reference: ${diagnostic.reference}
448
- `
449
- );
450
- continue;
451
- }
452
- const report = force ? output.warn() : output.error();
453
- report.message(`${source}${diagnostic.pointer}: ${diagnostic.message}`).line(`Reference: ${diagnostic.reference}`).print();
454
- }
455
- if (diagnostics.length && !force) {
456
- return output.error().message(
457
- "Bundle not written. Fix unresolved references or use --force to write an incomplete document."
458
- ).exit("error");
459
- }
460
- if (diagnostics.length) {
461
- const warning = `Writing an incomplete API description.${treeShake ? " Skipping tree shaking because reference reachability is uncertain." : ""}`;
462
- if (isStdout) {
463
- process.stderr.write(`${warning}
464
- `);
465
- } else {
466
- output.warn().message(warning).print();
467
- }
468
- }
469
- const bundled = await bundleDocument(inspected.data, resolvedInput, {
470
- treeShake: !!treeShake,
471
- urlMap: !!urlMap
472
- });
473
- if (!bundled.ok) {
474
- return output.error().message(bundled.error).exit("error");
475
- }
476
- const result = bundled.data;
477
- const executionTimeMs = performance.now() - startedAt;
478
- const serialized = serializeBundle(result, isYaml);
479
- if (!serialized.ok) {
480
- return output.error().message(serialized.error).exit("error");
481
- }
482
- if (isStdout) {
483
- process.stdout.write(serialized.data);
484
- process.stderr.write(
485
- `${diagnostics.length ? "Incomplete API description bundled" : "API description bundled"} (${Math.round(executionTimeMs)} ms)
486
- `
487
- );
488
- return;
489
- }
490
- const written = await writeFileAtomic(outputFileName, serialized.data, {
491
- createParents: true
492
- });
493
- if (!written.ok)
494
- return output.error().message(`Could not write bundle to ${outputFileName}: ${written.error}`).exit("error");
495
- output.info().message(
496
- `${as.green(diagnostics.length ? "Incomplete API description bundled" : "API description bundled")} (${as.white(`${as.bold(`${Math.round(executionTimeMs)}`)} ms`)})`
497
- ).line(`Written to ${as.cyan(outputFileName)}`).print();
498
- }
499
260
  export {
500
- bundleAction
261
+ bundleDocument,
262
+ inspectReferences
501
263
  };
@@ -1,35 +1,19 @@
1
1
  import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
2
2
  import {
3
3
  MCP_BUILD_PATTERN
4
- } from "./chunk-XQPB4OGW.js";
4
+ } from "./chunk-O4DJIA6Y.js";
5
5
  import {
6
6
  RegistryAsset
7
- } from "./chunk-QDT27U6O.js";
7
+ } from "./chunk-KSY2GH53.js";
8
8
  import {
9
9
  contentShaSchema
10
- } from "./chunk-CAD672DX.js";
10
+ } from "./chunk-Y3CXAIAG.js";
11
11
  import {
12
12
  docVersionSchema,
13
13
  external_exports,
14
14
  namespaceSchema,
15
15
  nanoidSchema
16
- } from "./chunk-KYCM5SL3.js";
17
-
18
- // ../../packages/urls/dist/publish/full.js
19
- function getPublishUrl(domain, subpath) {
20
- const url = `https://${domain}${subpath ?? ""}`;
21
- return new URL(url).toString();
22
- }
23
-
24
- // ../../packages/urls/dist/publish/previews.js
25
- function getPublishPreviewUrl(publishUid, domain, subpath = "") {
26
- const url = `https://${getPublishPreviewDomain(publishUid, domain)}${subpath ?? ""}`;
27
- new URL(url);
28
- return url;
29
- }
30
- function getPublishPreviewDomain(publishUid, domain) {
31
- return `${publishUid}--${domain}`;
32
- }
16
+ } from "./chunk-JBMHCTZD.js";
33
17
 
34
18
  // ../../packages/urls/dist/registry/path-generators.js
35
19
  function versionFormat(version) {
@@ -213,7 +197,5 @@ var artifactLanguageSchema = external_exports.string().regex(/^[a-z0-9]+$/, "Art
213
197
  var BUILD_SEGMENT = new RegExp(`^${MCP_BUILD_PATTERN}$`);
214
198
 
215
199
  export {
216
- getPublishUrl,
217
- getPublishPreviewUrl,
218
200
  registry
219
201
  };
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-DUIMDHQQ.js";
9
9
  import {
10
10
  external_exports
11
- } from "./chunk-KYCM5SL3.js";
11
+ } from "./chunk-JBMHCTZD.js";
12
12
 
13
13
  // src/helpers/visibility.ts
14
14
  var normalizeVisibility = (options) => {
@@ -9,7 +9,7 @@ import {
9
9
  scalarSet,
10
10
  slugSchema,
11
11
  timestampSchema
12
- } from "./chunk-KYCM5SL3.js";
12
+ } from "./chunk-JBMHCTZD.js";
13
13
 
14
14
  // ../../packages/entities/dist/project/active-deployment.js
15
15
  var activeDeploymentSchema = external_exports.object({
@@ -1,13 +1,13 @@
1
1
  import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
2
2
  import {
3
3
  fetchFromRegistry
4
- } from "./chunk-KJT4VYUO.js";
4
+ } from "./chunk-LPWRG2MS.js";
5
5
  import {
6
6
  registry
7
- } from "./chunk-RVZZQKVE.js";
7
+ } from "./chunk-PMDHYIB4.js";
8
8
  import {
9
9
  getAuthData
10
- } from "./chunk-SVDXXGEO.js";
10
+ } from "./chunk-ZMJW5UWU.js";
11
11
 
12
12
  // src/domains/schema/download.ts
13
13
  async function downloadSchema(input) {
@@ -2,38 +2,10 @@ import { createRequire as $$cR } from "node:module"; const require = $$cR(import
2
2
  import {
3
3
  childReferenceContext
4
4
  } from "./chunk-DWWY3LPC.js";
5
- import {
6
- isDocument
7
- } from "./chunk-WGTZEX4Y.js";
8
- import {
9
- isAsyncApiDocument
10
- } from "./chunk-KDEKIOIP.js";
11
- import "./chunk-A2MPF6GE.js";
12
- import "./chunk-FDW4LC45.js";
13
- import {
14
- isUrl
15
- } from "./chunk-4ORL4MST.js";
16
- import "./chunk-QDT27U6O.js";
17
- import {
18
- output
19
- } from "./chunk-T5HJUAWB.js";
20
5
  import {
21
6
  err,
22
7
  ok
23
8
  } from "./chunk-DUIMDHQQ.js";
24
- import "./chunk-CAD672DX.js";
25
- import "./chunk-4YQNT5UH.js";
26
- import "./chunk-KYCM5SL3.js";
27
- import "./chunk-3MZYUBJ6.js";
28
-
29
- // src/domains/document/validate/action.ts
30
- import path from "node:path";
31
- import as from "ansis";
32
- import prettyjson from "prettyjson";
33
- import { validate as validateAsyncApi } from "@scalar/asyncapi-validator";
34
- import { bundle } from "@scalar/json-magic/bundle";
35
- import { fetchUrls, readFiles } from "@scalar/json-magic/bundle/plugins/node";
36
- import { validate as validateOpenApi } from "@scalar/openapi-validator";
37
9
 
38
10
  // src/domains/document/validate/resolve-for-validation.ts
39
11
  import { createMagicProxy, getRaw } from "@scalar/json-magic/magic-proxy";
@@ -116,59 +88,6 @@ var resolveForValidation = (document) => {
116
88
  return ok(result);
117
89
  };
118
90
 
119
- // src/domains/document/validate/action.ts
120
- async function validateAction(inputArgument) {
121
- const startTime = performance.now();
122
- if (!inputArgument) {
123
- return output.error().title("Invalid argument").message("Provide a file path or URL.").exit("error");
124
- }
125
- const document = await bundle(
126
- isUrl(inputArgument) ? inputArgument : path.resolve(inputArgument),
127
- {
128
- plugins: [readFiles(), fetchUrls()],
129
- treeShake: false
130
- }
131
- ).catch((error) => {
132
- return output.error().title("Invalid input").message(error instanceof Error ? error.message : String(error)).exit("error");
133
- });
134
- if (!isDocument(document)) {
135
- return output.error().title("Invalid input").message("Provide a valid JSON or YAML document.").exit("error");
136
- }
137
- const resolved = resolveForValidation(document);
138
- if (!resolved.ok) {
139
- return output.error().title("Invalid reference").message(resolved.error).exit("error");
140
- }
141
- const isAsyncApi = isAsyncApiDocument(document);
142
- const specification = isAsyncApi ? "AsyncAPI" : "OpenAPI";
143
- const initialResult = isAsyncApi ? validateAsyncApi(document) : validateOpenApi(document);
144
- const result = isAsyncApi || !initialResult.valid ? initialResult : validateOpenApi(resolved.data, { checkPathParameters: true });
145
- if (result.valid && result.version) {
146
- const endTime = performance.now();
147
- output.info().line(
148
- as.green(
149
- `Matches the ${specification} specification${as.white(` (${specification} ${as.bold(result.version)})`)}
150
- `
151
- )
152
- ).line(
153
- `${as.green("API description validated")} ${as.grey(
154
- `(${as.white(`${as.bold(`${Math.round(endTime - startTime)}`)} ms`)})
155
- `
156
- )}`
157
- ).print();
158
- } else {
159
- output.error().message(prettyjson.render(result.errors)).message(
160
- as.red(
161
- `File does not match the ${specification} ${result.version ? `${result.version} ` : ""}specification.`
162
- )
163
- ).message(
164
- as.red(
165
- `${as.bold(
166
- `${result.errors?.length ?? 0} error${result.errors?.length === 1 ? "" : "s"}`
167
- )} found.`
168
- )
169
- ).exit("error");
170
- }
171
- }
172
91
  export {
173
- validateAction
92
+ resolveForValidation
174
93
  };
@@ -0,0 +1,54 @@
1
+ import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
2
+ import {
3
+ CONFIG_FILE_NAME,
4
+ isConfigFileName
5
+ } from "./chunk-M34HMQMV.js";
6
+
7
+ // src/domains/project/helpers.ts
8
+ import fs from "node:fs";
9
+ import path from "node:path";
10
+ var DEFAULT_MARKDOWN_FILE_NAME = "docs-quickstart.md";
11
+ var DEFAULT_OPENAPI_FILE_NAME = "docs-openapi.json";
12
+ var DEFAULT_CONFIG_EXTENSION = ".json";
13
+ var CONFIG_FILE_DEFAULT = CONFIG_FILE_NAME + DEFAULT_CONFIG_EXTENSION;
14
+ function findConfig(searchPath) {
15
+ if (!searchPath) {
16
+ return searchInDirectory(process.cwd());
17
+ }
18
+ const searchPathResolved = path.resolve(searchPath);
19
+ const stat = fs.statSync(searchPathResolved, { throwIfNoEntry: false });
20
+ if (!stat) {
21
+ return null;
22
+ }
23
+ if (stat.isDirectory()) {
24
+ return searchInDirectory(searchPathResolved);
25
+ }
26
+ if (stat.isFile()) {
27
+ return searchPathResolved;
28
+ }
29
+ return null;
30
+ }
31
+ function getCurrentFolderName() {
32
+ return path.basename(process.cwd());
33
+ }
34
+ function searchInDirectory(directory) {
35
+ try {
36
+ const entries = fs.readdirSync(directory);
37
+ for (const entry of entries) {
38
+ if (isConfigFileName(entry)) {
39
+ return path.join(directory, entry);
40
+ }
41
+ }
42
+ return null;
43
+ } catch (_) {
44
+ return null;
45
+ }
46
+ }
47
+
48
+ export {
49
+ DEFAULT_MARKDOWN_FILE_NAME,
50
+ DEFAULT_OPENAPI_FILE_NAME,
51
+ CONFIG_FILE_DEFAULT,
52
+ findConfig,
53
+ getCurrentFolderName
54
+ };
@@ -1,13 +1,13 @@
1
1
  import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
2
2
  import {
3
3
  BaseCollections
4
- } from "./chunk-LS6XOFVD.js";
4
+ } from "./chunk-KWQVA66H.js";
5
5
  import {
6
6
  getDatabaseClient
7
- } from "./chunk-HNWIIDGX.js";
7
+ } from "./chunk-Z7EH7CJC.js";
8
8
  import {
9
9
  publishRecordSchema
10
- } from "./chunk-QLKBXVUV.js";
10
+ } from "./chunk-RGJPENX7.js";
11
11
 
12
12
  // src/domains/project/deployments/get-deployments.ts
13
13
  function orderDeployments(records) {
@@ -16,10 +16,10 @@ import {
16
16
  webhookSubscriptionSchema,
17
17
  workspaceSchema,
18
18
  workspaceVersionSchema
19
- } from "./chunk-XGKFAPON.js";
19
+ } from "./chunk-MRZ5A7LB.js";
20
20
  import {
21
21
  userSchema
22
- } from "./chunk-YFUHTGGP.js";
22
+ } from "./chunk-CYIGEQOJ.js";
23
23
  import {
24
24
  SDK_PRODUCTION_ENVIRONMENT,
25
25
  SdkLanguage,
@@ -30,15 +30,15 @@ import {
30
30
  sdkLanguageCurrentsSchema,
31
31
  sdkLanguagePoliciesSchema,
32
32
  sdkSchema
33
- } from "./chunk-4TSZVWGM.js";
33
+ } from "./chunk-4BMOCIYO.js";
34
34
  import {
35
35
  mcpEnvironmentSchema
36
- } from "./chunk-I4FQOD5L.js";
36
+ } from "./chunk-DVA4NCCY.js";
37
37
  import {
38
38
  managedDocSchema,
39
39
  managedDocVersionSchema,
40
40
  ruleSchema
41
- } from "./chunk-QDT27U6O.js";
41
+ } from "./chunk-KSY2GH53.js";
42
42
  import {
43
43
  RENEWAL_MARGIN_MS,
44
44
  SESSION_EXPIRED,
@@ -48,10 +48,10 @@ import {
48
48
  needsRenewal,
49
49
  refreshToken,
50
50
  renewAuth
51
- } from "./chunk-SVDXXGEO.js";
51
+ } from "./chunk-ZMJW5UWU.js";
52
52
  import {
53
53
  config
54
- } from "./chunk-YTJ67DWS.js";
54
+ } from "./chunk-7LUXRNKV.js";
55
55
  import {
56
56
  contentShaSchema,
57
57
  createdMcpServerSchema,
@@ -62,7 +62,7 @@ import {
62
62
  registryGitBindingSchema,
63
63
  registryPublishRecordSchema,
64
64
  secretMetadataSchema
65
- } from "./chunk-CAD672DX.js";
65
+ } from "./chunk-Y3CXAIAG.js";
66
66
  import {
67
67
  UnifiedDocsMigrationStatus,
68
68
  pendingInviteSchema,
@@ -72,16 +72,16 @@ import {
72
72
  teamNameSchema,
73
73
  teamSdkPricing,
74
74
  userRefSchema
75
- } from "./chunk-36AMOACU.js";
75
+ } from "./chunk-GXKNYM54.js";
76
76
  import {
77
77
  docsProjectSchema,
78
78
  githubInstallSchema,
79
79
  githubProjectSchema,
80
80
  themeSchema
81
- } from "./chunk-QLKBXVUV.js";
81
+ } from "./chunk-RGJPENX7.js";
82
82
  import {
83
83
  teamEnvironmentSchema
84
- } from "./chunk-4YQNT5UH.js";
84
+ } from "./chunk-5GZAGHKL.js";
85
85
  import {
86
86
  docVersionSchema,
87
87
  external_exports,
@@ -90,7 +90,7 @@ import {
90
90
  schemaModel,
91
91
  slugSchema,
92
92
  timestampSchema
93
- } from "./chunk-KYCM5SL3.js";
93
+ } from "./chunk-JBMHCTZD.js";
94
94
 
95
95
  // ../../packages/entities/dist/sdk/scalar-config.js
96
96
  import yaml from "yaml";
@@ -33870,10 +33870,6 @@ var WEBHOOK_KEY_PARAM_PATTERN = new RegExp(scalar_sdk_config_schema_default.$def
33870
33870
 
33871
33871
  // ../../packages/entities/dist/sdk/scalar-config.js
33872
33872
  var sdkScalarTargetSchema = external_exports.enum(SdkLanguage).meta({ id: "sdk-scalar-target" });
33873
- var SdkLanguageLabels = Object.freeze(Object.fromEntries(Object.values(SdkLanguage).map((language) => [
33874
- language,
33875
- TARGETS[language].displayName
33876
- ])));
33877
33873
  var PUBLISHED_NAME_REDUCTIONS = {
33878
33874
  [SdkLanguage.Dart]: dartPackageIdentifier,
33879
33875
  [SdkLanguage.CSharp]: dotnetPackageIdentifier,
@@ -33951,9 +33947,9 @@ function sdkDeclaredLanguages(config2) {
33951
33947
  return sdkDeclaredLanguagesOf(readSdkConfig(config2));
33952
33948
  }
33953
33949
  var sdkLanguageDeclared = (declared, language) => !declared || declared.includes(language);
33954
- var servedTargets = (declared, targets) => targets.filter(({ language }) => sdkLanguageDeclared(declared, language));
33955
- function sdkServedTargets(sdk) {
33956
- return servedTargets(sdkDeclaredLanguages(sdk.config), sdk.targets);
33950
+ function sdkDeclaredTargets(sdk) {
33951
+ const declared = sdkDeclaredLanguages(sdk.config);
33952
+ return sdk.targets.filter(({ language }) => sdkLanguageDeclared(declared, language));
33957
33953
  }
33958
33954
  var sdkVersionsHighestFirst = (rows) => [...rows].sort((a, b) => {
33959
33955
  if (a.sortKey !== b.sortKey)
@@ -37427,7 +37423,7 @@ function createLazyClient(loadDefinition, service) {
37427
37423
 
37428
37424
  // ../../packages/service-api/dist/apis/agent.js
37429
37425
  function createAgentClient(options) {
37430
- return createLazyClient(() => import("./agent-LB5ZCVUN.js").then((m) => m.agentApi), requestServiceFactory(options.baseUrl, options.getAuthToken));
37426
+ return createLazyClient(() => import("./agent-CT3RRYPJ.js").then((m) => m.agentApi), requestServiceFactory(options.baseUrl, options.getAuthToken));
37431
37427
  }
37432
37428
 
37433
37429
  // ../../packages/service-api/dist/index.js
@@ -37525,7 +37521,7 @@ async function mcpClients() {
37525
37521
  }
37526
37522
 
37527
37523
  export {
37528
- sdkServedTargets,
37524
+ sdkDeclaredTargets,
37529
37525
  sdkVersionsHighestFirst,
37530
37526
  apiService,
37531
37527
  mcpClients
@@ -12,7 +12,7 @@ import {
12
12
  slugSchema,
13
13
  timestampSchema,
14
14
  zod_default
15
- } from "./chunk-KYCM5SL3.js";
15
+ } from "./chunk-JBMHCTZD.js";
16
16
 
17
17
  // ../../packages/entities/dist/auth/secret.js
18
18
  var SECRET_NAME_PATTERN = "[A-Z0-9_]{1,64}";