@scalar/cli 2.15.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 (112) hide show
  1. package/README.md +121 -25
  2. package/chunks/{action-3W4IC7QL.js → action-2WVJ2WEW.js} +26 -27
  3. package/chunks/{action-HOCCP353.js → action-4BDZ2CXP.js} +12 -13
  4. package/chunks/{action-3QQSKGM3.js → action-5AXDB5VN.js} +21 -23
  5. package/chunks/{action-LD5B5QQ4.js → action-6I3TJLRO.js} +34 -33
  6. package/chunks/{action-T7SD3ETN.js → action-6WZN63LT.js} +299 -75
  7. package/chunks/{action-IUAYC2SC.js → action-7GZGVTYI.js} +1071 -775
  8. package/chunks/{action-2BGAMGXU.js → action-7ZCJAWI2.js} +9 -9
  9. package/chunks/{action-6HFH7DAW.js → action-A6YOY24G.js} +14 -10
  10. package/chunks/{action-IU2AVNOW.js → action-AGGHY4N2.js} +26 -26
  11. package/chunks/{action-B2WWTOF6.js → action-BVZOA2G5.js} +15 -16
  12. package/chunks/{action-2UZWKMSJ.js → action-BYDJ4R4F.js} +18 -19
  13. package/chunks/{action-HDT7EO7W.js → action-CBAL5CYB.js} +19 -21
  14. package/chunks/action-COFGCCYS.js +89 -0
  15. package/chunks/action-CYU5Q5LT.js +254 -0
  16. package/chunks/{action-MJHLG7AE.js → action-DTQH6CKR.js} +33 -33
  17. package/chunks/{action-P2RPH5R2.js → action-ED5WLLIE.js} +11 -12
  18. package/chunks/action-F4CQ4DW3.js +654 -0
  19. package/chunks/{action-SRFBOLDL.js → action-GQDQU2WE.js} +1 -1
  20. package/chunks/{action-PDSSIW2A.js → action-GVW5PSPT.js} +26 -28
  21. package/chunks/{action-WOLNPEUQ.js → action-H5VRLFCY.js} +16 -12
  22. package/chunks/{action-G2WBTXOK.js → action-IWEAWDT3.js} +19 -19
  23. package/chunks/{action-NZJ4Z64U.js → action-JN6JVQUV.js} +16 -18
  24. package/chunks/{action-PNSWHIHC.js → action-KVM76ZKQ.js} +20 -20
  25. package/chunks/{action-JNH4DCZX.js → action-LLMFEBHH.js} +3 -4
  26. package/chunks/{action-QJMRAFOF.js → action-PEG7AUA6.js} +20 -19
  27. package/chunks/{action-2HPMP473.js → action-QC72LLYE.js} +13 -11
  28. package/chunks/{action-ZTLOQZTT.js → action-QP6MRSQW.js} +16 -15
  29. package/chunks/{action-4HXB3YQR.js → action-R53K22GE.js} +230 -52
  30. package/chunks/{action-U2RJ3ZAU.js → action-SJPWL723.js} +6 -5
  31. package/chunks/{action-57SV3ZBM.js → action-T3R4SDAI.js} +9 -9
  32. package/chunks/{action-777R7LOG.js → action-TT7ZJNST.js} +25 -25
  33. package/chunks/{action-TY4BZEMN.js → action-UPVVJE26.js} +18 -19
  34. package/chunks/{action-MBAAYXKK.js → action-V35W4MRK.js} +18 -19
  35. package/chunks/{action-TR2T2UYB.js → action-W4KGRBRV.js} +9 -9
  36. package/chunks/{action-ENDUKGWS.js → action-ZIVYJCC2.js} +16 -18
  37. package/chunks/{action-7LK4RUDP.js → action-ZU5X2KQX.js} +52 -49
  38. package/chunks/{actions-D5OHPBWC.js → actions-CERT7BL4.js} +25 -26
  39. package/chunks/{actions-RI42JY6H.js → actions-RCIS37Y6.js} +22 -24
  40. package/chunks/{agent-NA3QFKJX.js → agent-CT3RRYPJ.js} +7 -7
  41. package/chunks/{asyncapi-YBTWMTW6.js → asyncapi-DVBS23QW.js} +17 -18
  42. package/chunks/{build.action-4YDNDBXC.js → build.action-7MKMMV6V.js} +38 -32
  43. package/chunks/{chunk-MGGMCT77.js → chunk-36UI2W7I.js} +1 -1
  44. package/chunks/chunk-4BMOCIYO.js +536 -0
  45. package/chunks/{chunk-ADQ6B6QI.js → chunk-5DRLDTTU.js} +1 -1
  46. package/chunks/{chunk-G5WWW7VD.js → chunk-5EO2CVAR.js} +6 -6
  47. package/chunks/{chunk-Q26DFKTY.js → chunk-5GZAGHKL.js} +1 -1
  48. package/chunks/{chunk-DWJMPHLY.js → chunk-7LUXRNKV.js} +27 -2
  49. package/chunks/{chunk-BY4NGQ5D.js → chunk-A2MPF6GE.js} +7 -3
  50. package/chunks/{chunk-5D3T63G4.js → chunk-BIQFYZP6.js} +1 -1
  51. package/chunks/chunk-CNJ4TLU7.js +83 -0
  52. package/chunks/{chunk-UM3WZUGF.js → chunk-CWCRBWA6.js} +7 -3
  53. package/chunks/{chunk-Z6HOHGUJ.js → chunk-CYIGEQOJ.js} +2 -2
  54. package/chunks/{chunk-4S3DGMMZ.js → chunk-DUIMDHQQ.js} +1 -1
  55. package/chunks/{chunk-W7P6VTCG.js → chunk-DVA4NCCY.js} +6 -4
  56. package/chunks/chunk-DWWY3LPC.js +85 -0
  57. package/chunks/{chunk-USVU6AC2.js → chunk-F6E7FJEC.js} +18 -12
  58. package/chunks/{chunk-E24BNP6E.js → chunk-FDW4LC45.js} +1 -1
  59. package/chunks/{chunk-TW2UASEW.js → chunk-FMPJSW6A.js} +4 -4
  60. package/chunks/{chunk-IPWJEGPD.js → chunk-GCVB22TG.js} +2 -2
  61. package/chunks/{chunk-6BQHLHBE.js → chunk-GXKNYM54.js} +3 -3
  62. package/chunks/chunk-I25ZCHBJ.js +22 -0
  63. package/chunks/{chunk-I57ID5K7.js → chunk-JBMHCTZD.js} +8 -1
  64. package/chunks/{chunk-KOLEQNLG.js → chunk-JEOQ7LSA.js} +1 -1
  65. package/chunks/{chunk-QMERQSPM.js → chunk-KI2AVDKM.js} +8 -6
  66. package/chunks/{chunk-2KSOARE4.js → chunk-KSY2GH53.js} +3 -3
  67. package/chunks/{chunk-SHRUJFQI.js → chunk-KWQVA66H.js} +105 -18
  68. package/chunks/{chunk-DLYMDGFW.js → chunk-LPWRG2MS.js} +4 -4
  69. package/chunks/{chunk-Y6GKZ2FM.js → chunk-LVUMNGVA.js} +1 -1
  70. package/chunks/{chunk-PIDLENYN.js → chunk-M34HMQMV.js} +42 -83
  71. package/chunks/{chunk-7FS7BAUX.js → chunk-MRZ5A7LB.js} +133 -19
  72. package/chunks/chunk-O3I3LTTJ.js +24 -0
  73. package/chunks/{chunk-VBHPHAGS.js → chunk-O4DJIA6Y.js} +2 -18
  74. package/chunks/chunk-OKLL5422.js +263 -0
  75. package/chunks/{chunk-HIDIW2FN.js → chunk-OQE3WKI3.js} +1 -1
  76. package/chunks/{chunk-ERZ3HYB5.js → chunk-PMDHYIB4.js} +9 -21
  77. package/chunks/{chunk-IDGT5RAQ.js → chunk-RELSIFIL.js} +2 -2
  78. package/chunks/{chunk-BOCMOHQA.js → chunk-RGJPENX7.js} +1 -1
  79. package/chunks/{chunk-7FGJIUDN.js → chunk-RHAQ4XBA.js} +3 -3
  80. package/chunks/chunk-RQ7QBRJT.js +93 -0
  81. package/chunks/chunk-S3LY7RKP.js +54 -0
  82. package/chunks/{chunk-T76K7QNX.js → chunk-S5OGPH2P.js} +3 -3
  83. package/chunks/{chunk-ANP5XF26.js → chunk-U36HEOGO.js} +12625 -1369
  84. package/chunks/{chunk-IPUJEBMI.js → chunk-UWRJCJVG.js} +1 -1
  85. package/chunks/chunk-V7DBDXSJ.js +24 -0
  86. package/chunks/{chunk-RRYUCZYO.js → chunk-WGTZEX4Y.js} +7 -3
  87. package/chunks/{chunk-7PNOYE6B.js → chunk-Y3CXAIAG.js} +30 -3
  88. package/chunks/{chunk-GOKHFNB2.js → chunk-Z7EH7CJC.js} +3 -3
  89. package/chunks/{chunk-42MIV6WF.js → chunk-ZMJW5UWU.js} +6 -5
  90. package/chunks/chunk-ZQDAPKWX.js +111 -0
  91. package/chunks/{create.action-52K3XAYN.js → create.action-VA2ISPIM.js} +27 -29
  92. package/chunks/{delete.action-47LPLTOX.js → delete.action-AIWMDGXV.js} +26 -28
  93. package/chunks/{delete.action-3NMOQPIR.js → delete.action-GEN6OD7A.js} +26 -28
  94. package/chunks/{diff.action-5TLC2EHT.js → diff.action-LBK656RN.js} +32 -27
  95. package/chunks/{get.action-BCMLG7C7.js → get.action-5SWRNQ3D.js} +20 -19
  96. package/chunks/{get.action-TOZ474GO.js → get.action-UPPPGGI4.js} +29 -23
  97. package/chunks/{list.action-6ZWEENT6.js → list.action-YJZBC25S.js} +26 -28
  98. package/chunks/{list.action-CMAA5KTY.js → list.action-YOWWC4I4.js} +54 -25
  99. package/chunks/{publish.action-U3VIU5LZ.js → publish.action-QMVDHDJZ.js} +52 -49
  100. package/chunks/{update.action-UQHZYVTP.js → update.action-GFDZIGEP.js} +27 -29
  101. package/chunks/{update.action-QZOP25ME.js → update.action-SNGKPS7A.js} +26 -28
  102. package/index.js +688 -212
  103. package/package.json +11 -11
  104. package/skills/scalar-cli/SKILL.md +4 -3
  105. package/template.md +120 -24
  106. package/chunks/action-3KP3WVPZ.js +0 -112
  107. package/chunks/action-APBLB3IU.js +0 -235
  108. package/chunks/chunk-BLY2CF4S.js +0 -58
  109. package/chunks/chunk-BMQFEKHA.js +0 -3534
  110. package/chunks/chunk-EOTD7HAV.js +0 -318
  111. package/chunks/chunk-QXOUDBFK.js +0 -92
  112. package/chunks/chunk-TR5U7G7T.js +0 -32
@@ -1,17 +1,16 @@
1
1
  import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
2
2
  import {
3
- SdkLanguage,
4
- sdkVersionStatusSchema,
5
- sdkVersionTargetStateSchema
6
- } from "./chunk-EOTD7HAV.js";
3
+ SDK_PRODUCTION_ENVIRONMENT,
4
+ sdkLanguagePointersSchema
5
+ } from "./chunk-4BMOCIYO.js";
7
6
  import {
8
7
  cloudflareHostnameStateSchema
9
- } from "./chunk-W7P6VTCG.js";
8
+ } from "./chunk-DVA4NCCY.js";
10
9
  import {
11
10
  RegistryResourceTypes,
12
11
  baseRegistrySchema,
13
12
  contentShaSchema
14
- } from "./chunk-7PNOYE6B.js";
13
+ } from "./chunk-Y3CXAIAG.js";
15
14
  import {
16
15
  brandedUid,
17
16
  docVersionSchema,
@@ -21,13 +20,14 @@ import {
21
20
  mintUid,
22
21
  nanoid,
23
22
  nanoidSchema,
23
+ nullAsDefault,
24
24
  randomAccessGroupSlug,
25
25
  registryMetaSchema,
26
26
  scalarSet,
27
27
  slugSchema,
28
28
  timestampSchema,
29
29
  unixTimestamp
30
- } from "./chunk-I57ID5K7.js";
30
+ } from "./chunk-JBMHCTZD.js";
31
31
 
32
32
  // ../../packages/entities/dist/access-group/schema.js
33
33
  var emailDomainRegex = /^([A-Za-z0-9]+(-[A-Za-z0-9]+)*\.)+[A-Za-z]{2,}$/i;
@@ -350,6 +350,14 @@ var vcsLinkStateSchema = external_exports.object({
350
350
  expiresAt: external_exports.date()
351
351
  }).meta({ id: "vcs-link-state" });
352
352
 
353
+ // ../../packages/entities/dist/auth/desktop-login.js
354
+ var desktopLoginProofSchema = external_exports.string().regex(/^[A-Za-z0-9_-]{43}$/);
355
+ var desktopLoginRedirectSchema = external_exports.object({
356
+ callback: external_exports.literal("redirect"),
357
+ state: desktopLoginProofSchema,
358
+ codeChallenge: desktopLoginProofSchema
359
+ });
360
+
353
361
  // ../../packages/entities/dist/auth/domains.js
354
362
  var AuthDomains;
355
363
  (function(AuthDomains2) {
@@ -393,6 +401,8 @@ var relayStateSchema = external_exports.object({
393
401
  }).meta({ id: "relay-state", default: "nanoid()" });
394
402
 
395
403
  // ../../packages/entities/dist/login-portals/customization.js
404
+ var DEFAULT_PORTAL_EMAIL_TITLE = "Private Docs";
405
+ var DEFAULT_PORTAL_EMAIL_MESSAGE = "Click to access private documentation hosted by scalar.com";
396
406
  var loginPortalEmailSchema = external_exports.object({
397
407
  /** @deprecated No longer rendered in the email template */
398
408
  logo: external_exports.string().default("").meta({
@@ -401,8 +411,8 @@ var loginPortalEmailSchema = external_exports.object({
401
411
  /** @deprecated No longer rendered in the email template */
402
412
  logoSize: external_exports.string().default("100").meta({ examples: ["100"] }),
403
413
  buttonText: external_exports.string().max(50).default("Login").meta({ examples: ["Access documentation"] }),
404
- message: external_exports.string().max(1e3).default("Click to access private documentation hosted by scalar.com").meta({ examples: ["Click to access Acme private API documentation."] }),
405
- title: external_exports.string().max(100).default("Private Docs").meta({ examples: ["Acme API"] }),
414
+ message: external_exports.string().max(1e3).default(DEFAULT_PORTAL_EMAIL_MESSAGE).meta({ examples: ["Click to access Acme private API documentation."] }),
415
+ title: external_exports.string().max(100).default(DEFAULT_PORTAL_EMAIL_TITLE).meta({ examples: ["Acme API"] }),
406
416
  mainColor: external_exports.string().max(100).default("#2a2f45").meta({ examples: ["#1f2937"] }),
407
417
  mainBackground: external_exports.string().max(100).default("#f6f6f6").meta({ examples: ["#f9fafb"] }),
408
418
  cardColor: external_exports.string().max(100).default("#2a2f45").meta({ examples: ["#1f2937"] }),
@@ -574,22 +584,124 @@ var webhookEventClaimRecordSchema = entitySchema.extend({
574
584
  expiresAt: external_exports.date()
575
585
  }).meta({ id: "webhook-event-claim-record" });
576
586
 
587
+ // ../../packages/entities/dist/sdk/migration-backup.js
588
+ var SDK_BACKED_UP_MIGRATIONS = ["78", "79"];
589
+ var storedFieldsSchema = external_exports.record(external_exports.string(), external_exports.unknown());
590
+ var sdkMigrationBackupSchema = entitySchema.extend({
591
+ teamUid: nanoidSchema,
592
+ sdkUid: nanoidSchema,
593
+ migration: external_exports.enum(SDK_BACKED_UP_MIGRATIONS),
594
+ /** When the backup was written, in epoch milliseconds. */
595
+ backedUpAt: external_exports.number().int().nonnegative(),
596
+ /** The SDK's top-level fields, by name; a field that was not stored is left out. */
597
+ fields: storedFieldsSchema,
598
+ /** The SDK's top-level fields the migration wrote where none was stored. */
599
+ absentFields: external_exports.string().array().default(() => []),
600
+ /** Per version record uid, its fields by name. */
601
+ records: external_exports.record(external_exports.string(), storedFieldsSchema).default(() => ({})),
602
+ /** The uids of the version records the migration inserted. */
603
+ insertedRecords: external_exports.string().array().default(() => []),
604
+ /**
605
+ * Per build uid, its fields by name; a field stored on each target is
606
+ * kept as a map from the target's language to its value.
607
+ */
608
+ builds: external_exports.record(external_exports.string(), storedFieldsSchema).default(() => ({}))
609
+ }).meta({ id: "sdk-migration-backup" });
610
+
611
+ // ../../packages/entities/dist/sdk/sort-key.js
612
+ import semver from "semver";
613
+ var NUMBER_WIDTH = 16;
614
+ var LONG_NUMBER_MARK = ":";
615
+ var PUNCTUATION_ORDER = " _-,;:!?.'\"()[]{}@*/\\&#%`^+<=>|~$";
616
+ var NUMBER_MARK = "^";
617
+ var LEVEL_SEPARATOR = " ";
618
+ var IDENTIFIER_SEPARATOR = ",";
619
+ var WORD_IDENTIFIER_MARK = "~";
620
+ var RELEASE_MARK = "~";
621
+ function encodeNumber(digits) {
622
+ const value = digits.replace(/^0+(?=\d)/, "");
623
+ if (value.length <= NUMBER_WIDTH)
624
+ return value.padStart(NUMBER_WIDTH, "0");
625
+ return `${LONG_NUMBER_MARK}${String(value.length).padStart(3, "0")}${value}`;
626
+ }
627
+ function semverSortKey(version) {
628
+ const core = [version.major, version.minor, version.patch].map((part) => encodeNumber(String(part))).join(".");
629
+ if (!version.prerelease.length)
630
+ return `1${core}${RELEASE_MARK}`;
631
+ const identifiers = version.prerelease.map((identifier) => /^\d+$/.test(String(identifier)) ? encodeNumber(String(identifier)) : `${WORD_IDENTIFIER_MARK}${identifier}`);
632
+ return `1${core}-${identifiers.join(IDENTIFIER_SEPARATOR)}`;
633
+ }
634
+ function textSortKey(label) {
635
+ let primary = "";
636
+ let cases = "";
637
+ for (const [token] of label.matchAll(/\d+|[\s\S]/gu)) {
638
+ if (/^\d/.test(token)) {
639
+ primary += `${NUMBER_MARK}${encodeNumber(token)}`;
640
+ continue;
641
+ }
642
+ const punctuation = PUNCTUATION_ORDER.indexOf(token);
643
+ if (punctuation >= 0) {
644
+ primary += String.fromCharCode(33 + punctuation);
645
+ continue;
646
+ }
647
+ if (token < " ")
648
+ continue;
649
+ const lower = token.toLowerCase();
650
+ primary += lower;
651
+ if (/^[a-z]$/i.test(token))
652
+ cases += token === lower ? "0" : "1";
653
+ }
654
+ return `0${primary}${LEVEL_SEPARATOR}${cases}`;
655
+ }
656
+ var SDK_VERSION_FAMILIES = ["legacy", "document"];
657
+ var SDK_VERSION_UNMARKED_FAMILY = "legacy";
658
+ var FAMILY_MARK = {
659
+ legacy: "0",
660
+ document: "1"
661
+ };
662
+ function sdkVersionSortKey(label, family) {
663
+ const version = semver.parse(label);
664
+ return `${FAMILY_MARK[family]}${version ? semverSortKey(version) : textSortKey(label)}`;
665
+ }
666
+
577
667
  // ../../packages/entities/dist/sdk/version.js
578
668
  var sdkVersionRecordSchema = entitySchema.extend({
579
669
  /** Own uid, branded so it cannot be confused with another entity's uid */
580
670
  uid: brandedUid().default(mintUid).meta({ default: "nanoid()" }),
671
+ /** The label: the linked document's version label at the build's commit. */
581
672
  version: docVersionSchema,
582
- /** The exact API version this SDK version was created against. */
583
- apiVersion: docVersionSchema,
584
- apiDocumentHash: external_exports.string().nullish(),
585
- status: sdkVersionStatusSchema,
586
- publishedAt: timestampSchema.nullish(),
587
- changeSource: external_exports.enum(["user", "api-version", "created"]).nullish(),
588
- /** SHA-256 of the config string, naming its blob under the SDK's artifacts. */
589
- configSha: contentShaSchema,
590
- languages: external_exports.enum(SdkLanguage).array(),
591
- targets: external_exports.partialRecord(external_exports.enum(SdkLanguage), sdkVersionTargetStateSchema)
673
+ /**
674
+ * `legacy` for a version migration 79 carried over from before labels
675
+ * followed the document, `document` for a label a build took from the
676
+ * linked document. A document build of a label a legacy record holds
677
+ * joins that record and moves it to `document` (`mintSdkVersionRecord`).
678
+ * A record stored without one reads as {@link SDK_VERSION_UNMARKED_FAMILY}.
679
+ */
680
+ family: external_exports.enum(SDK_VERSION_FAMILIES).default(SDK_VERSION_UNMARKED_FAMILY),
681
+ /**
682
+ * `sdkVersionSortKey(version, family)`, so Mongo and D1 order and compare
683
+ * labels as `compareVersionsDesc` does, every document label above every
684
+ * legacy one.
685
+ */
686
+ sortKey: external_exports.string(),
687
+ /** The environment the label serves. */
688
+ environment: external_exports.string().default(SDK_PRODUCTION_ENVIRONMENT),
689
+ /** The label without an environment tag; absent on a record stored before it. */
690
+ base: external_exports.string().nullish(),
691
+ /**
692
+ * Per language, the label's newest triggered succeeded build, which
693
+ * `@label` serves, and its `triggeredAt` in epoch milliseconds. A write
694
+ * moves it only for a later `at`. Always stored as an object, a stored
695
+ * null reading as empty, so a dotted `$set` of one language never meets
696
+ * a null parent.
697
+ */
698
+ active: nullAsDefault(sdkLanguagePointersSchema.default(() => ({})))
592
699
  }).meta({ id: "sdk-version-record" });
700
+ var storedSdkVersionRecordSchema = external_exports.pipe(external_exports.transform(({ sortKey, ...record }) => ({
701
+ ...record,
702
+ sortKey: typeof sortKey === "string" || typeof record.version !== "string" ? sortKey : sdkVersionSortKey(record.version, record.family ?? SDK_VERSION_UNMARKED_FAMILY)
703
+ })), sdkVersionRecordSchema);
704
+ var SDK_VERSIONS_BATCH_MAX = 100;
593
705
 
594
706
  // ../../packages/entities/dist/waitlist/index.js
595
707
  var WaitlistProducts;
@@ -890,6 +1002,8 @@ export {
890
1002
  mcpDomainCheckSchema,
891
1003
  mcpServerDomainSchema,
892
1004
  linkedRepositorySchema,
1005
+ sdkVersionRecordSchema,
1006
+ SDK_VERSIONS_BATCH_MAX,
893
1007
  WaitlistProducts,
894
1008
  WaitlistSources,
895
1009
  webhookSubscriptionSchema,
@@ -0,0 +1,24 @@
1
+ import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
2
+ import {
3
+ MCP_BUILD_PATTERN
4
+ } from "./chunk-O4DJIA6Y.js";
5
+
6
+ // ../../packages/urls/dist/mcp/address.js
7
+ var DEFAULT_ENVIRONMENT = "production";
8
+ var BUILD_SEGMENT = new RegExp(`^${MCP_BUILD_PATTERN}$`);
9
+ function buildSuffix(build) {
10
+ return build ? `+${build}` : "";
11
+ }
12
+ function withEnvironmentSuffix(version, environment) {
13
+ return environment === DEFAULT_ENVIRONMENT ? version : `${version}-${environment}`;
14
+ }
15
+ function buildMcpAddressUrl({ baseUrl, namespace, slug, environment = DEFAULT_ENVIRONMENT, version, build }) {
16
+ const base = `${baseUrl.replace(/\/+$/, "")}/@${namespace}/${slug}`;
17
+ if (version && version !== "latest")
18
+ return `${base}@${withEnvironmentSuffix(version, environment)}${buildSuffix(build)}`;
19
+ return environment === DEFAULT_ENVIRONMENT ? base : `${base}?env=${encodeURIComponent(environment)}`;
20
+ }
21
+
22
+ export {
23
+ buildMcpAddressUrl
24
+ };
@@ -1,7 +1,7 @@
1
1
  import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
2
2
  import {
3
3
  MCP_DOWNLOAD_PATH_PREFIX
4
- } from "./chunk-7PNOYE6B.js";
4
+ } from "./chunk-Y3CXAIAG.js";
5
5
 
6
6
  // ../../packages/entities/dist/agent/mcp-edge-routes.js
7
7
  var MCP_BUILD_PATTERN = "[0-9a-f]{7,64}";
@@ -93,22 +93,6 @@ var UNSUPPORTED_MEDIA_TYPE_BODY = JSON.stringify({
93
93
  id: null
94
94
  });
95
95
 
96
- // ../../packages/urls/dist/mcp/address.js
97
- var DEFAULT_ENVIRONMENT = "production";
98
- var BUILD_SEGMENT = new RegExp(`^${MCP_BUILD_PATTERN}$`);
99
- function buildSuffix(build) {
100
- return build ? `+${build}` : "";
101
- }
102
- function withEnvironmentSuffix(version, environment) {
103
- return environment === DEFAULT_ENVIRONMENT ? version : `${version}-${environment}`;
104
- }
105
- function buildMcpAddressUrl({ baseUrl, namespace, slug, environment = DEFAULT_ENVIRONMENT, version, build }) {
106
- const base = `${baseUrl.replace(/\/+$/, "")}/@${namespace}/${slug}`;
107
- if (version && version !== "latest")
108
- return `${base}@${withEnvironmentSuffix(version, environment)}${buildSuffix(build)}`;
109
- return environment === DEFAULT_ENVIRONMENT ? base : `${base}?env=${encodeURIComponent(environment)}`;
110
- }
111
-
112
96
  export {
113
- buildMcpAddressUrl
97
+ MCP_BUILD_PATTERN
114
98
  };
@@ -0,0 +1,263 @@
1
+ import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
2
+ import {
3
+ childReferenceContext
4
+ } from "./chunk-DWWY3LPC.js";
5
+ import {
6
+ isDocument
7
+ } from "./chunk-WGTZEX4Y.js";
8
+ import {
9
+ err,
10
+ ok
11
+ } from "./chunk-DUIMDHQQ.js";
12
+
13
+ // src/domains/document/bundle/bundle-document.ts
14
+ import { bundle } from "@scalar/json-magic/bundle";
15
+ var bundleDocument = async (inspected, origin, options) => {
16
+ const visitedNodes = /* @__PURE__ */ new Set();
17
+ const plugins = [inspected.loader];
18
+ const treeShake = options.treeShake && inspected.diagnostics.length === 0;
19
+ const hooks = {
20
+ type: "lifecycle",
21
+ onAfterNodeProcess: async (node, context) => {
22
+ if (typeof node.$ref !== "string") return;
23
+ const children = Object.fromEntries(
24
+ Object.entries(node).filter(
25
+ ([key, value]) => key !== "$ref" && key !== "$id" && value !== null && typeof value === "object"
26
+ )
27
+ );
28
+ if (!Object.keys(children).length) return;
29
+ await bundle(
30
+ { ...children, $id: context.origin },
31
+ {
32
+ origin,
33
+ root: context.rootNode,
34
+ cache: context.resolutionCache,
35
+ visitedNodes,
36
+ plugins: [...plugins, hooks],
37
+ treeShake,
38
+ // Keep mappings for collision tracking across partial bundles; the outer bundle strips them when disabled.
39
+ urlMap: true
40
+ }
41
+ );
42
+ }
43
+ };
44
+ return bundle(inspected.document, {
45
+ origin,
46
+ plugins: [...plugins, hooks],
47
+ visitedNodes,
48
+ treeShake,
49
+ urlMap: options.urlMap
50
+ }).then((result) => {
51
+ inspected.restore(result);
52
+ return ok(result);
53
+ }).catch(
54
+ (error) => err(error instanceof Error ? error.message : String(error))
55
+ );
56
+ };
57
+
58
+ // src/domains/document/bundle/references.ts
59
+ import {
60
+ resolveReferencePath
61
+ } from "@scalar/json-magic/bundle";
62
+ import { escapeJsonPointer } from "@scalar/json-magic/helpers/escape-json-pointer";
63
+ var inspectReferences = async (input, loaders) => {
64
+ const documents = /* @__PURE__ */ new Map();
65
+ const load = (source) => {
66
+ const cached = documents.get(source);
67
+ if (cached) return cached;
68
+ const loader = loaders.find((candidate) => candidate.validate(source));
69
+ const pending = loader ? loader.exec(source).catch(() => ({ ok: false })) : Promise.resolve({ ok: false });
70
+ documents.set(source, pending);
71
+ return pending;
72
+ };
73
+ const root = await load(input);
74
+ if (!root.ok || !isDocument(root.data)) {
75
+ return err(`Could not read or parse API description: ${input}`);
76
+ }
77
+ const resources = /* @__PURE__ */ new Map();
78
+ const documentRoots = /* @__PURE__ */ new Map();
79
+ const references = /* @__PURE__ */ new Map();
80
+ const literals = /* @__PURE__ */ new Map();
81
+ const origins = /* @__PURE__ */ new WeakMap();
82
+ const exposed = /* @__PURE__ */ new WeakSet();
83
+ const visited = /* @__PURE__ */ new WeakMap();
84
+ const swagger = root.data.swagger === "2.0";
85
+ const visit = (location) => {
86
+ const { value, context, path, source } = location;
87
+ if (value === null || typeof value !== "object" || context === "data")
88
+ return;
89
+ const contexts = visited.get(value) ?? /* @__PURE__ */ new Set();
90
+ if (contexts.has(context)) return;
91
+ contexts.add(context);
92
+ visited.set(value, contexts);
93
+ if (Array.isArray(value)) {
94
+ value.forEach((child, index) => {
95
+ visit({
96
+ ...location,
97
+ value: child,
98
+ path: [...path, String(index)],
99
+ context: context === "messages" ? "message" : context === "objects" ? "object" : context === "schemas" ? "schema" : context
100
+ });
101
+ });
102
+ return;
103
+ }
104
+ const node = value;
105
+ const origin = origins.get(node) ?? (typeof node.$id === "string" ? resolveReferencePath(location.origin, node.$id) : location.origin);
106
+ origins.set(node, origin);
107
+ const current = { ...location, origin };
108
+ if (typeof node.$id === "string") resources.set(origin, current);
109
+ if (typeof node.$anchor === "string")
110
+ resources.set(`${origin}#${node.$anchor}`, current);
111
+ if (typeof node.$ref === "string" && ![
112
+ "objects",
113
+ "schemas",
114
+ "responses",
115
+ "links",
116
+ "path-items",
117
+ "callbacks",
118
+ "messages"
119
+ ].includes(context)) {
120
+ references.set(node, { ...current, value: node, reference: node.$ref });
121
+ }
122
+ for (const [key, child] of Object.entries(node)) {
123
+ if (["$ref", "$id", "$anchor"].includes(key) && typeof child === "string")
124
+ continue;
125
+ const childContext = childReferenceContext(
126
+ context,
127
+ key,
128
+ swagger,
129
+ "bundle"
130
+ );
131
+ if (childContext === "data") {
132
+ if (child !== null && typeof child === "object") {
133
+ const keys = literals.get(node) ?? /* @__PURE__ */ new Set();
134
+ keys.add(key);
135
+ literals.set(node, keys);
136
+ }
137
+ continue;
138
+ }
139
+ literals.get(node)?.delete(key);
140
+ visit({
141
+ value: child,
142
+ source,
143
+ path: [...path, key],
144
+ origin,
145
+ context: childContext
146
+ });
147
+ }
148
+ };
149
+ const register = (value, source, context, origin = source) => {
150
+ const location = { value, source, path: [], origin, context };
151
+ documentRoots.set(source, resources.get(origin) ?? location);
152
+ resources.set(source, location);
153
+ visit(location);
154
+ };
155
+ register(root.data, input, "object");
156
+ const diagnostics = [];
157
+ const unresolved = /* @__PURE__ */ new Set();
158
+ const inspected = /* @__PURE__ */ new Set();
159
+ const check = async (reference) => {
160
+ const [prefix, fragment = ""] = reference.reference.split("#", 2);
161
+ const source = prefix ? resolveReferencePath(reference.origin, prefix) : reference.origin;
162
+ if (!resources.has(source)) {
163
+ const loaded = await load(source);
164
+ if (loaded.ok && loaded.data !== void 0 && loaded.data !== null) {
165
+ const context = !isApiDescription(loaded.data) && reference.context === "schema" ? "schema" : !fragment && !isApiDescription(loaded.data) ? reference.context : "object";
166
+ register(
167
+ loaded.data,
168
+ source,
169
+ context,
170
+ reference.value.$global === true ? reference.origin : source
171
+ );
172
+ }
173
+ }
174
+ const resource = resources.get(source);
175
+ const resourceTarget = fragment && !fragment.startsWith("/") ? resources.get(`${source}#${fragment}`) : resource && resolvePointer(resource, fragment, exposed);
176
+ const documentRoot = documentRoots.get(reference.source);
177
+ const target = resourceTarget?.value !== void 0 ? resourceTarget : !prefix && fragment.startsWith("/") && documentRoot ? resolvePointer(documentRoot, fragment, exposed) : void 0;
178
+ if (!target || target.value === void 0) {
179
+ diagnostics.push({
180
+ kind: resource ? "missing-target" : "unresolved-document",
181
+ reference: reference.reference,
182
+ source: reference.source,
183
+ pointer: `#/${[...reference.path, "$ref"].map(escapeJsonPointer).join("/")}`,
184
+ message: resource ? "Reference target does not exist." : "Could not load the referenced document."
185
+ });
186
+ unresolved.add(reference);
187
+ return;
188
+ }
189
+ visit({ ...target, context: reference.context });
190
+ };
191
+ while ([...references.keys()].some((node) => !inspected.has(node))) {
192
+ const pending = [...references.values()].filter(
193
+ ({ value }) => !inspected.has(value)
194
+ );
195
+ pending.forEach(({ value }) => {
196
+ inspected.add(value);
197
+ });
198
+ await Promise.all(pending.map(check));
199
+ }
200
+ const hidden = /* @__PURE__ */ new Map();
201
+ const hide = (node, key) => {
202
+ const token = Symbol(key);
203
+ hidden.set(token, node[key]);
204
+ node[key] = token;
205
+ };
206
+ for (const [node, keys] of literals) {
207
+ for (const key of keys) {
208
+ const child = node[key];
209
+ if (child !== null && typeof child === "object" && (exposed.has(child) || visited.has(child)))
210
+ continue;
211
+ hide(node, key);
212
+ }
213
+ }
214
+ for (const reference of unresolved) hide(reference.value, "$ref");
215
+ const restore = (value, seen = /* @__PURE__ */ new WeakSet()) => {
216
+ if (value === null || typeof value !== "object" || seen.has(value)) return;
217
+ seen.add(value);
218
+ for (const [key, child] of Object.entries(value)) {
219
+ if (typeof child === "symbol" && hidden.has(child)) {
220
+ Object.defineProperty(value, key, {
221
+ value: hidden.get(child),
222
+ enumerable: true,
223
+ configurable: true,
224
+ writable: true
225
+ });
226
+ } else restore(child, seen);
227
+ }
228
+ };
229
+ return ok({
230
+ document: root.data,
231
+ diagnostics,
232
+ loader: { type: "loader", validate: () => true, exec: load },
233
+ restore
234
+ });
235
+ };
236
+ var isApiDescription = (value) => isDocument(value) && ("openapi" in value || "swagger" in value || "asyncapi" in value);
237
+ var resolvePointer = (resource, fragment, exposed) => {
238
+ try {
239
+ const segments = fragment ? decodeURIComponent(fragment).slice(1).split("/").map((segment) => segment.replace(/~1/g, "/").replace(/~0/g, "~")) : [];
240
+ return segments.reduce((location, key) => {
241
+ if (!location || location.value === null || typeof location.value !== "object" || !Object.hasOwn(location.value, key))
242
+ return void 0;
243
+ exposed.add(location.value);
244
+ const value = location.value[key];
245
+ const origin = isDocument(value) && typeof value.$id === "string" ? resolveReferencePath(location.origin, value.$id) : location.origin;
246
+ if (value !== null && typeof value === "object") exposed.add(value);
247
+ return {
248
+ source: location.source,
249
+ context: location.context,
250
+ value,
251
+ origin,
252
+ path: [...location.path, key]
253
+ };
254
+ }, resource);
255
+ } catch {
256
+ return void 0;
257
+ }
258
+ };
259
+
260
+ export {
261
+ bundleDocument,
262
+ inspectReferences
263
+ };
@@ -5,7 +5,7 @@ import {
5
5
  import {
6
6
  err,
7
7
  ok
8
- } from "./chunk-4S3DGMMZ.js";
8
+ } from "./chunk-DUIMDHQQ.js";
9
9
 
10
10
  // src/helpers/url-opener.ts
11
11
  import { spawn } from "node:child_process";
@@ -1,32 +1,19 @@
1
1
  import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
2
+ import {
3
+ MCP_BUILD_PATTERN
4
+ } from "./chunk-O4DJIA6Y.js";
2
5
  import {
3
6
  RegistryAsset
4
- } from "./chunk-2KSOARE4.js";
7
+ } from "./chunk-KSY2GH53.js";
5
8
  import {
6
9
  contentShaSchema
7
- } from "./chunk-7PNOYE6B.js";
10
+ } from "./chunk-Y3CXAIAG.js";
8
11
  import {
9
12
  docVersionSchema,
10
13
  external_exports,
11
14
  namespaceSchema,
12
15
  nanoidSchema
13
- } from "./chunk-I57ID5K7.js";
14
-
15
- // ../../packages/urls/dist/publish/full.js
16
- function getPublishUrl(domain, subpath) {
17
- const url = `https://${domain}${subpath ?? ""}`;
18
- return new URL(url).toString();
19
- }
20
-
21
- // ../../packages/urls/dist/publish/previews.js
22
- function getPublishPreviewUrl(publishUid, domain, subpath = "") {
23
- const url = `https://${getPublishPreviewDomain(publishUid, domain)}${subpath ?? ""}`;
24
- new URL(url);
25
- return url;
26
- }
27
- function getPublishPreviewDomain(publishUid, domain) {
28
- return `${publishUid}--${domain}`;
29
- }
16
+ } from "./chunk-JBMHCTZD.js";
30
17
 
31
18
  // ../../packages/urls/dist/registry/path-generators.js
32
19
  function versionFormat(version) {
@@ -206,8 +193,9 @@ function registry(teamNamespace) {
206
193
  var artifactUidSchema = nanoidSchema.regex(/^[a-zA-Z0-9_-]+$/, "Artifact uids must be a single path segment");
207
194
  var artifactLanguageSchema = external_exports.string().regex(/^[a-z0-9]+$/, "Artifact languages must be a single path segment");
208
195
 
196
+ // ../../packages/urls/dist/registry/sdk-address.js
197
+ var BUILD_SEGMENT = new RegExp(`^${MCP_BUILD_PATTERN}$`);
198
+
209
199
  export {
210
- getPublishUrl,
211
- getPublishPreviewUrl,
212
200
  registry
213
201
  };
@@ -5,10 +5,10 @@ import {
5
5
  import {
6
6
  err,
7
7
  ok
8
- } from "./chunk-4S3DGMMZ.js";
8
+ } from "./chunk-DUIMDHQQ.js";
9
9
  import {
10
10
  external_exports
11
- } from "./chunk-I57ID5K7.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-I57ID5K7.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-DLYMDGFW.js";
4
+ } from "./chunk-LPWRG2MS.js";
5
5
  import {
6
6
  registry
7
- } from "./chunk-ERZ3HYB5.js";
7
+ } from "./chunk-PMDHYIB4.js";
8
8
  import {
9
9
  getAuthData
10
- } from "./chunk-42MIV6WF.js";
10
+ } from "./chunk-ZMJW5UWU.js";
11
11
 
12
12
  // src/domains/schema/download.ts
13
13
  async function downloadSchema(input) {