@fern-api/fdr-sdk 1.2.174-94f3833ee6 → 1.2.174-950bdb766f

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 (43) hide show
  1. package/dist/js/client/FdrClient.js +366 -303
  2. package/dist/js/client/FdrClient.js.map +1 -1
  3. package/dist/js/client/FdrClient.mjs +366 -303
  4. package/dist/js/client/FdrClient.mjs.map +1 -1
  5. package/dist/js/index.js +641 -578
  6. package/dist/js/index.js.map +1 -1
  7. package/dist/js/index.mjs +641 -578
  8. package/dist/js/index.mjs.map +1 -1
  9. package/dist/js/orpc-client/dashboard/sdkVersion.js +3 -1
  10. package/dist/js/orpc-client/dashboard/sdkVersion.js.map +1 -1
  11. package/dist/js/orpc-client/dashboard/sdkVersion.mjs +3 -1
  12. package/dist/js/orpc-client/dashboard/sdkVersion.mjs.map +1 -1
  13. package/dist/js/orpc-client.js +743 -634
  14. package/dist/js/orpc-client.js.map +1 -1
  15. package/dist/js/orpc-client.mjs +729 -634
  16. package/dist/js/orpc-client.mjs.map +1 -1
  17. package/dist/orpc-client/dashboard/sdkVersion.d.ts +3 -1
  18. package/dist/orpc-client/dashboard/sdkVersion.d.ts.map +1 -1
  19. package/dist/orpc-client/dashboard/sdkVersion.js +6 -2
  20. package/dist/orpc-client/dashboard/sdkVersion.js.map +1 -1
  21. package/dist/orpc-client/dashboard/sdkVersion.test.js +5 -1
  22. package/dist/orpc-client/dashboard/sdkVersion.test.js.map +1 -1
  23. package/dist/orpc-client/mcp-hosting/contract.d.ts +138 -0
  24. package/dist/orpc-client/mcp-hosting/contract.d.ts.map +1 -1
  25. package/dist/orpc-client/mcp-hosting/contract.js +17 -1
  26. package/dist/orpc-client/mcp-hosting/contract.js.map +1 -1
  27. package/dist/orpc-client/mcp-hosting/index.d.ts +1 -0
  28. package/dist/orpc-client/mcp-hosting/index.d.ts.map +1 -1
  29. package/dist/orpc-client/mcp-hosting/index.js +1 -0
  30. package/dist/orpc-client/mcp-hosting/index.js.map +1 -1
  31. package/dist/orpc-client/mcp-hosting/usage.d.ts +194 -0
  32. package/dist/orpc-client/mcp-hosting/usage.d.ts.map +1 -0
  33. package/dist/orpc-client/mcp-hosting/usage.js +116 -0
  34. package/dist/orpc-client/mcp-hosting/usage.js.map +1 -0
  35. package/dist/types/orpc-client/dashboard/sdkVersion.d.ts +3 -1
  36. package/dist/types/orpc-client/dashboard/sdkVersion.d.ts.map +1 -1
  37. package/dist/types/orpc-client/mcp-hosting/contract.d.ts +138 -0
  38. package/dist/types/orpc-client/mcp-hosting/contract.d.ts.map +1 -1
  39. package/dist/types/orpc-client/mcp-hosting/index.d.ts +1 -0
  40. package/dist/types/orpc-client/mcp-hosting/index.d.ts.map +1 -1
  41. package/dist/types/orpc-client/mcp-hosting/usage.d.ts +194 -0
  42. package/dist/types/orpc-client/mcp-hosting/usage.d.ts.map +1 -0
  43. package/package.json +1 -1
@@ -31,7 +31,9 @@ module.exports = __toCommonJS(sdkVersion_exports);
31
31
  var AUTO_VERSION_PLACEHOLDERS = [
32
32
  "0.0.0-fern-placeholder",
33
33
  "v0.0.0-fern-placeholder",
34
- "0.0.0.dev0"
34
+ "0.0.0.dev0",
35
+ "505.503.4455",
36
+ "v505.503.4455"
35
37
  ];
36
38
  function isPlaceholderVersion(version) {
37
39
  const trimmed = version?.trim().split("+")[0];
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/orpc-client/dashboard/sdkVersion.ts"],"sourcesContent":["/**\n * How the SDK pages read an SDK's versions, shared by FDR (which picks an SDK's\n * `latestVersion`) and the dashboard (which holds that against the registry's),\n * so the two never disagree on which version is newer, which is a release, or\n * which is no version at all. Pure: no I/O, safe in the browser.\n */\n\n/**\n * The version Fern's AUTO versioning generates under before it settles the real\n * one. Fiddle uploads snippets before it autoversions, so every AUTO run lands\n * on (and overwrites) a row with this version: a generation, never a release.\n * Per language, as Fiddle's VersionMapper and fern's\n * `generator-cli/src/autoversion/VersionUtils.ts` map it: Go adds a `v`, Python\n * uses the PEP 440 form; fern also counts any `.N` after one.\n */\nexport const AUTO_VERSION_PLACEHOLDERS: readonly string[] = [\n \"0.0.0-fern-placeholder\",\n \"v0.0.0-fern-placeholder\",\n \"0.0.0.dev0\"\n];\n\n/** An AUTO placeholder (see `AUTO_VERSION_PLACEHOLDERS`): not shown as a version, never the latest, never compared. */\nexport function isPlaceholderVersion(version: string | null | undefined): boolean {\n const trimmed = version?.trim().split(\"+\")[0];\n return (\n trimmed != null &&\n AUTO_VERSION_PLACEHOLDERS.some(\n (placeholder) => trimmed === placeholder || trimmed.startsWith(`${placeholder}.`)\n )\n );\n}\n\nexport interface ParsedSdkVersion {\n /** The dotted numbers: `46.0.0.20260916` has four, compared part by part. */\n release: number[];\n /** Semver's prerelease identifiers, or PEP 440's pre-release; empty for a release. */\n prerelease: Array<number | string>;\n /** PEP 440's `.postN`: after its release. */\n post: number | null;\n /** PEP 440's `.devN`: before the version it is a development build of. */\n dev: number | null;\n}\n\n/** PEP 440's short names, read as semver's long ones so `a1` and `alpha.1` agree. */\nconst PRERELEASE_ALIASES: Record<string, string> = { a: \"alpha\", b: \"beta\", c: \"rc\", pre: \"rc\", preview: \"rc\" };\n\n/**\n * A version in any spelling Fern's generators and the registries write: a `v`\n * prefix, any number of numeric parts, semver prereleases (`-rc.2`), PEP 440's\n * (`rc2`, `.dev3`, `.post1`) and RubyGems' (`.pre.rc.2`, how it publishes\n * `-rc.2`). Build metadata (`+…`) is dropped. Null for an AUTO placeholder and\n * for anything that does not start with a number.\n */\nexport function parseSdkVersion(version: string): ParsedSdkVersion | null {\n if (isPlaceholderVersion(version)) {\n return null;\n }\n const match = /^v?(\\d+(?:\\.\\d+)*)(.*)$/i.exec(version.trim().split(\"+\")[0] ?? \"\");\n if (match?.[1] == null) {\n return null;\n }\n const parsed: ParsedSdkVersion = {\n release: match[1].split(\".\").map(Number),\n prerelease: [],\n post: null,\n dev: null\n };\n // `-rc.2`, `rc2`, `.rc2` and `.pre.rc.2` all read as [\"rc\", 2]; `post` and `dev` take the number after them.\n const identifiers = ((match[2] ?? \"\").match(/\\d+|[a-z]+/gi) ?? []).map((part) =>\n /^\\d+$/.test(part) ? Number(part) : part.toLowerCase()\n );\n for (let index = 0; index < identifiers.length; index++) {\n const identifier = identifiers[index];\n const next = identifiers[index + 1];\n if (identifier === \"post\" || identifier === \"dev\") {\n parsed[identifier] = typeof next === \"number\" ? next : 0;\n index += typeof next === \"number\" ? 1 : 0;\n } else if (identifier === \"pre\" && typeof next === \"string\") {\n // RubyGems' separator, not a prerelease of its own: `1.0.0.pre.beta.3` is `1.0.0-beta.3`.\n continue;\n } else if (identifier != null) {\n parsed.prerelease.push(\n typeof identifier === \"string\" ? (PRERELEASE_ALIASES[identifier] ?? identifier) : identifier\n );\n }\n }\n return parsed;\n}\n\n/** A release, or a release's post-release: no prerelease identifiers and no development build. */\nexport function isStableVersion(version: string): boolean {\n const parsed = parseSdkVersion(version);\n return parsed != null && parsed.prerelease.length === 0 && parsed.dev == null;\n}\n\n/**\n * Semver precedence, widened to the spellings `parseSdkVersion` reads: -1 when\n * `a` is older than `b`, 1 when newer, 0 when they are the same version however\n * spelled (`6.0.0rc2` and `v6.0.0-rc.2`), null when either is not a version (a\n * placeholder included). PEP 440's order holds: `.dev0` < `a1` < `b1` < `rc1`\n * < the release < `.post1`.\n */\nexport function compareSdkVersions(a: string, b: string): number | null {\n const left = parseSdkVersion(a);\n const right = parseSdkVersion(b);\n if (left == null || right == null) {\n return null;\n }\n for (let index = 0; index < Math.max(left.release.length, right.release.length); index++) {\n const difference = (left.release[index] ?? 0) - (right.release[index] ?? 0);\n if (difference !== 0) {\n return Math.sign(difference);\n }\n }\n return (\n comparePrerelease(left, right) ||\n // No post-release is the release itself, before any; no dev build is the version itself, after its own.\n compareNumbers(left.post, right.post, Number.NEGATIVE_INFINITY) ||\n compareNumbers(left.dev, right.dev, Number.POSITIVE_INFINITY)\n );\n}\n\n/** The highest of `versions` that is a release (see `isStableVersion`); null when none is. */\nexport function newestStableVersion(versions: Iterable<string>): string | null {\n let newest: string | null = null;\n for (const version of versions) {\n if (isStableVersion(version) && (newest == null || (compareSdkVersions(version, newest) ?? 0) > 0)) {\n newest = version;\n }\n }\n return newest;\n}\n\n/**\n * A development build of a release (`1.0.0.dev0`) comes before its\n * prereleases, which come before the release (or its post-releases).\n * Prereleases in semver's order: numbers numerically and below words, fewer\n * identifiers first.\n */\nfunction comparePrerelease(left: ParsedSdkVersion, right: ParsedSdkVersion): number {\n // PEP 440: 0 is a release's dev build; 1 is a prerelease (including its dev builds); 2 is a release or post-release.\n const stage = ({ prerelease, post, dev }: ParsedSdkVersion) =>\n prerelease.length > 0 ? 1 : dev != null && post == null ? 0 : 2;\n if (stage(left) !== stage(right) || stage(left) !== 1) {\n return Math.sign(stage(left) - stage(right));\n }\n const a = left.prerelease;\n const b = right.prerelease;\n for (let index = 0; index < Math.max(a.length, b.length); index++) {\n const x = a[index];\n const y = b[index];\n if (x === y) {\n continue;\n }\n if (x == null || y == null) {\n return x == null ? -1 : 1;\n }\n if (typeof x === \"number\" && typeof y === \"number\") {\n return Math.sign(x - y);\n }\n if (typeof x === \"number\" || typeof y === \"number\") {\n return typeof x === \"number\" ? -1 : 1;\n }\n return x < y ? -1 : 1;\n }\n return 0;\n}\n\n/** Compares two optional numbers, reading a missing one as `missing`. */\nfunction compareNumbers(a: number | null, b: number | null, missing: number): number {\n const x = a ?? missing;\n const y = b ?? missing;\n return x === y ? 0 : x < y ? -1 : 1;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAeO,IAAM,4BAA+C;AAAA,EACxD;AAAA,EACA;AAAA,EACA;AACJ;AAGO,SAAS,qBAAqB,SAA6C;AAC9E,QAAM,UAAU,SAAS,KAAK,EAAE,MAAM,GAAG,EAAE,CAAC;AAC5C,SACI,WAAW,QACX,0BAA0B;AAAA,IACtB,CAAC,g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,GAAG,SAAS;AAC/D,UAAM,IAAI,EAAE,KAAK;AACjB,UAAM,IAAI,EAAE,KAAK;AACjB,QAAI,MAAM,GAAG;AACT;AAAA,IACJ;AACA,QAAI,KAAK,QAAQ,KAAK,MAAM;AACxB,aAAO,KAAK,OAAO,KAAK;AAAA,IAC5B;AACA,QAAI,OAAO,MAAM,YAAY,OAAO,MAAM,UAAU;AAChD,aAAO,KAAK,KAAK,IAAI,CAAC;AAAA,IAC1B;AACA,QAAI,OAAO,MAAM,YAAY,OAAO,MAAM,UAAU;AAChD,aAAO,OAAO,MAAM,WAAW,KAAK;AAAA,IACxC;AACA,WAAO,IAAI,IAAI,KAAK;AAAA,EACxB;AACA,SAAO;AACX;AAGA,SAAS,eAAe,GAAkB,GAAkB,SAAyB;AACjF,QAAM,IAAI,KAAK;AACf,QAAM,IAAI,KAAK;AACf,SAAO,MAAM,IAAI,IAAI,IAAI,IAAI,KAAK;AACtC;","names":[]}
1
+ {"version":3,"sources":["../../../../src/orpc-client/dashboard/sdkVersion.ts"],"sourcesContent":["/**\n * How the SDK pages read an SDK's versions, shared by FDR (which picks an SDK's\n * `latestVersion`) and the dashboard (which holds that against the registry's),\n * so the two never disagree on which version is newer, which is a release, or\n * which is no version at all. Pure: no I/O, safe in the browser.\n */\n\n/**\n * The version Fern's AUTO versioning generates under before it settles the real\n * one. Fiddle uploads snippets before it autoversions, so every AUTO run lands\n * on (and overwrites) a row with this version: a generation, never a release.\n * Per language, as Fiddle's VersionMapper and fern's\n * `generator-cli/src/autoversion/VersionUtils.ts` map it: Go adds a `v`, Python\n * uses the PEP 440 form; fern also counts any `.N` after one. Before 2026-03-19\n * (fern-api/fern#13706) it was 505.503.4455, which a project pinned to an older\n * Fern CLI still generates under: FDR recorded it as recently as 2026-10-27.\n */\nexport const AUTO_VERSION_PLACEHOLDERS: readonly string[] = [\n \"0.0.0-fern-placeholder\",\n \"v0.0.0-fern-placeholder\",\n \"0.0.0.dev0\",\n \"505.503.4455\",\n \"v505.503.4455\"\n];\n\n/** An AUTO placeholder (see `AUTO_VERSION_PLACEHOLDERS`): not shown as a version, never the latest, never compared. */\nexport function isPlaceholderVersion(version: string | null | undefined): boolean {\n const trimmed = version?.trim().split(\"+\")[0];\n return (\n trimmed != null &&\n AUTO_VERSION_PLACEHOLDERS.some(\n (placeholder) => trimmed === placeholder || trimmed.startsWith(`${placeholder}.`)\n )\n );\n}\n\nexport interface ParsedSdkVersion {\n /** The dotted numbers: `46.0.0.20260916` has four, compared part by part. */\n release: number[];\n /** Semver's prerelease identifiers, or PEP 440's pre-release; empty for a release. */\n prerelease: Array<number | string>;\n /** PEP 440's `.postN`: after its release. */\n post: number | null;\n /** PEP 440's `.devN`: before the version it is a development build of. */\n dev: number | null;\n}\n\n/** PEP 440's short names, read as semver's long ones so `a1` and `alpha.1` agree. */\nconst PRERELEASE_ALIASES: Record<string, string> = { a: \"alpha\", b: \"beta\", c: \"rc\", pre: \"rc\", preview: \"rc\" };\n\n/**\n * A version in any spelling Fern's generators and the registries write: a `v`\n * prefix, any number of numeric parts, semver prereleases (`-rc.2`), PEP 440's\n * (`rc2`, `.dev3`, `.post1`) and RubyGems' (`.pre.rc.2`, how it publishes\n * `-rc.2`). Build metadata (`+…`) is dropped. Null for an AUTO placeholder and\n * for anything that does not start with a number.\n */\nexport function parseSdkVersion(version: string): ParsedSdkVersion | null {\n if (isPlaceholderVersion(version)) {\n return null;\n }\n const match = /^v?(\\d+(?:\\.\\d+)*)(.*)$/i.exec(version.trim().split(\"+\")[0] ?? \"\");\n if (match?.[1] == null) {\n return null;\n }\n const parsed: ParsedSdkVersion = {\n release: match[1].split(\".\").map(Number),\n prerelease: [],\n post: null,\n dev: null\n };\n // `-rc.2`, `rc2`, `.rc2` and `.pre.rc.2` all read as [\"rc\", 2]; `post` and `dev` take the number after them.\n const identifiers = ((match[2] ?? \"\").match(/\\d+|[a-z]+/gi) ?? []).map((part) =>\n /^\\d+$/.test(part) ? Number(part) : part.toLowerCase()\n );\n for (let index = 0; index < identifiers.length; index++) {\n const identifier = identifiers[index];\n const next = identifiers[index + 1];\n if (identifier === \"post\" || identifier === \"dev\") {\n parsed[identifier] = typeof next === \"number\" ? next : 0;\n index += typeof next === \"number\" ? 1 : 0;\n } else if (identifier === \"pre\" && typeof next === \"string\") {\n // RubyGems' separator, not a prerelease of its own: `1.0.0.pre.beta.3` is `1.0.0-beta.3`.\n continue;\n } else if (identifier != null) {\n parsed.prerelease.push(\n typeof identifier === \"string\" ? (PRERELEASE_ALIASES[identifier] ?? identifier) : identifier\n );\n }\n }\n return parsed;\n}\n\n/** A release, or a release's post-release: no prerelease identifiers and no development build. */\nexport function isStableVersion(version: string): boolean {\n const parsed = parseSdkVersion(version);\n return parsed != null && parsed.prerelease.length === 0 && parsed.dev == null;\n}\n\n/**\n * Semver precedence, widened to the spellings `parseSdkVersion` reads: -1 when\n * `a` is older than `b`, 1 when newer, 0 when they are the same version however\n * spelled (`6.0.0rc2` and `v6.0.0-rc.2`), null when either is not a version (a\n * placeholder included). PEP 440's order holds: `.dev0` < `a1` < `b1` < `rc1`\n * < the release < `.post1`.\n */\nexport function compareSdkVersions(a: string, b: string): number | null {\n const left = parseSdkVersion(a);\n const right = parseSdkVersion(b);\n if (left == null || right == null) {\n return null;\n }\n for (let index = 0; index < Math.max(left.release.length, right.release.length); index++) {\n const difference = (left.release[index] ?? 0) - (right.release[index] ?? 0);\n if (difference !== 0) {\n return Math.sign(difference);\n }\n }\n return (\n comparePrerelease(left, right) ||\n // No post-release is the release itself, before any; no dev build is the version itself, after its own.\n compareNumbers(left.post, right.post, Number.NEGATIVE_INFINITY) ||\n compareNumbers(left.dev, right.dev, Number.POSITIVE_INFINITY)\n );\n}\n\n/** The highest of `versions` that is a release (see `isStableVersion`); null when none is. */\nexport function newestStableVersion(versions: Iterable<string>): string | null {\n let newest: string | null = null;\n for (const version of versions) {\n if (isStableVersion(version) && (newest == null || (compareSdkVersions(version, newest) ?? 0) > 0)) {\n newest = version;\n }\n }\n return newest;\n}\n\n/**\n * A development build of a release (`1.0.0.dev0`) comes before its\n * prereleases, which come before the release (or its post-releases).\n * Prereleases in semver's order: numbers numerically and below words, fewer\n * identifiers first.\n */\nfunction comparePrerelease(left: ParsedSdkVersion, right: ParsedSdkVersion): number {\n // PEP 440: 0 is a release's dev build; 1 is a prerelease (including its dev builds); 2 is a release or post-release.\n const stage = ({ prerelease, post, dev }: ParsedSdkVersion) =>\n prerelease.length > 0 ? 1 : dev != null && post == null ? 0 : 2;\n if (stage(left) !== stage(right) || stage(left) !== 1) {\n return Math.sign(stage(left) - stage(right));\n }\n const a = left.prerelease;\n const b = right.prerelease;\n for (let index = 0; index < Math.max(a.length, b.length); index++) {\n const x = a[index];\n const y = b[index];\n if (x === y) {\n continue;\n }\n if (x == null || y == null) {\n return x == null ? -1 : 1;\n }\n if (typeof x === \"number\" && typeof y === \"number\") {\n return Math.sign(x - y);\n }\n if (typeof x === \"number\" || typeof y === \"number\") {\n return typeof x === \"number\" ? -1 : 1;\n }\n return x < y ? -1 : 1;\n }\n return 0;\n}\n\n/** Compares two optional numbers, reading a missing one as `missing`. */\nfunction compareNumbers(a: number | null, b: number | null, missing: number): number {\n const x = a ?? missing;\n const y = b ?? missing;\n return x === y ? 0 : x < y ? -1 : 1;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBO,IAAM,4BAA+C;AAAA,EACxD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ;AAGO,SAAS,qBAAqB,SAA6C;AAC9E,QAAM,UAAU,SAAS,KAAK,EAAE,MAAM,GAAG,EAAE,CAAC;AAC5C,SACI,WAAW,QACX,0BAA0B;AAAA,IACtB,CAAC,gBAAgB,YAAY,eAAe,QAAQ,WAAW,GAAG,WAAW,GAAG;AAAA,EACpF;AAER;AAcA,IAAM,qBAA6C,EAAE,GAAG,SAAS,GAAG,QAAQ,GAAG,M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KAAK,QAAQ,KAAK,MAAM;AACxB,aAAO,KAAK,OAAO,KAAK;AAAA,IAC5B;AACA,QAAI,OAAO,MAAM,YAAY,OAAO,MAAM,UAAU;AAChD,aAAO,KAAK,KAAK,IAAI,CAAC;AAAA,IAC1B;AACA,QAAI,OAAO,MAAM,YAAY,OAAO,MAAM,UAAU;AAChD,aAAO,OAAO,MAAM,WAAW,KAAK;AAAA,IACxC;AACA,WAAO,IAAI,IAAI,KAAK;AAAA,EACxB;AACA,SAAO;AACX;AAGA,SAAS,eAAe,GAAkB,GAAkB,SAAyB;AACjF,QAAM,IAAI,KAAK;AACf,QAAM,IAAI,KAAK;AACf,SAAO,MAAM,IAAI,IAAI,IAAI,IAAI,KAAK;AACtC;","names":[]}
@@ -2,7 +2,9 @@
2
2
  var AUTO_VERSION_PLACEHOLDERS = [
3
3
  "0.0.0-fern-placeholder",
4
4
  "v0.0.0-fern-placeholder",
5
- "0.0.0.dev0"
5
+ "0.0.0.dev0",
6
+ "505.503.4455",
7
+ "v505.503.4455"
6
8
  ];
7
9
  function isPlaceholderVersion(version) {
8
10
  const trimmed = version?.trim().split("+")[0];
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/orpc-client/dashboard/sdkVersion.ts"],"sourcesContent":["/**\n * How the SDK pages read an SDK's versions, shared by FDR (which picks an SDK's\n * `latestVersion`) and the dashboard (which holds that against the registry's),\n * so the two never disagree on which version is newer, which is a release, or\n * which is no version at all. Pure: no I/O, safe in the browser.\n */\n\n/**\n * The version Fern's AUTO versioning generates under before it settles the real\n * one. Fiddle uploads snippets before it autoversions, so every AUTO run lands\n * on (and overwrites) a row with this version: a generation, never a release.\n * Per language, as Fiddle's VersionMapper and fern's\n * `generator-cli/src/autoversion/VersionUtils.ts` map it: Go adds a `v`, Python\n * uses the PEP 440 form; fern also counts any `.N` after one.\n */\nexport const AUTO_VERSION_PLACEHOLDERS: readonly string[] = [\n \"0.0.0-fern-placeholder\",\n \"v0.0.0-fern-placeholder\",\n \"0.0.0.dev0\"\n];\n\n/** An AUTO placeholder (see `AUTO_VERSION_PLACEHOLDERS`): not shown as a version, never the latest, never compared. */\nexport function isPlaceholderVersion(version: string | null | undefined): boolean {\n const trimmed = version?.trim().split(\"+\")[0];\n return (\n trimmed != null &&\n AUTO_VERSION_PLACEHOLDERS.some(\n (placeholder) => trimmed === placeholder || trimmed.startsWith(`${placeholder}.`)\n )\n );\n}\n\nexport interface ParsedSdkVersion {\n /** The dotted numbers: `46.0.0.20260916` has four, compared part by part. */\n release: number[];\n /** Semver's prerelease identifiers, or PEP 440's pre-release; empty for a release. */\n prerelease: Array<number | string>;\n /** PEP 440's `.postN`: after its release. */\n post: number | null;\n /** PEP 440's `.devN`: before the version it is a development build of. */\n dev: number | null;\n}\n\n/** PEP 440's short names, read as semver's long ones so `a1` and `alpha.1` agree. */\nconst PRERELEASE_ALIASES: Record<string, string> = { a: \"alpha\", b: \"beta\", c: \"rc\", pre: \"rc\", preview: \"rc\" };\n\n/**\n * A version in any spelling Fern's generators and the registries write: a `v`\n * prefix, any number of numeric parts, semver prereleases (`-rc.2`), PEP 440's\n * (`rc2`, `.dev3`, `.post1`) and RubyGems' (`.pre.rc.2`, how it publishes\n * `-rc.2`). Build metadata (`+…`) is dropped. Null for an AUTO placeholder and\n * for anything that does not start with a number.\n */\nexport function parseSdkVersion(version: string): ParsedSdkVersion | null {\n if (isPlaceholderVersion(version)) {\n return null;\n }\n const match = /^v?(\\d+(?:\\.\\d+)*)(.*)$/i.exec(version.trim().split(\"+\")[0] ?? \"\");\n if (match?.[1] == null) {\n return null;\n }\n const parsed: ParsedSdkVersion = {\n release: match[1].split(\".\").map(Number),\n prerelease: [],\n post: null,\n dev: null\n };\n // `-rc.2`, `rc2`, `.rc2` and `.pre.rc.2` all read as [\"rc\", 2]; `post` and `dev` take the number after them.\n const identifiers = ((match[2] ?? \"\").match(/\\d+|[a-z]+/gi) ?? []).map((part) =>\n /^\\d+$/.test(part) ? Number(part) : part.toLowerCase()\n );\n for (let index = 0; index < identifiers.length; index++) {\n const identifier = identifiers[index];\n const next = identifiers[index + 1];\n if (identifier === \"post\" || identifier === \"dev\") {\n parsed[identifier] = typeof next === \"number\" ? next : 0;\n index += typeof next === \"number\" ? 1 : 0;\n } else if (identifier === \"pre\" && typeof next === \"string\") {\n // RubyGems' separator, not a prerelease of its own: `1.0.0.pre.beta.3` is `1.0.0-beta.3`.\n continue;\n } else if (identifier != null) {\n parsed.prerelease.push(\n typeof identifier === \"string\" ? (PRERELEASE_ALIASES[identifier] ?? identifier) : identifier\n );\n }\n }\n return parsed;\n}\n\n/** A release, or a release's post-release: no prerelease identifiers and no development build. */\nexport function isStableVersion(version: string): boolean {\n const parsed = parseSdkVersion(version);\n return parsed != null && parsed.prerelease.length === 0 && parsed.dev == null;\n}\n\n/**\n * Semver precedence, widened to the spellings `parseSdkVersion` reads: -1 when\n * `a` is older than `b`, 1 when newer, 0 when they are the same version however\n * spelled (`6.0.0rc2` and `v6.0.0-rc.2`), null when either is not a version (a\n * placeholder included). PEP 440's order holds: `.dev0` < `a1` < `b1` < `rc1`\n * < the release < `.post1`.\n */\nexport function compareSdkVersions(a: string, b: string): number | null {\n const left = parseSdkVersion(a);\n const right = parseSdkVersion(b);\n if (left == null || right == null) {\n return null;\n }\n for (let index = 0; index < Math.max(left.release.length, right.release.length); index++) {\n const difference = (left.release[index] ?? 0) - (right.release[index] ?? 0);\n if (difference !== 0) {\n return Math.sign(difference);\n }\n }\n return (\n comparePrerelease(left, right) ||\n // No post-release is the release itself, before any; no dev build is the version itself, after its own.\n compareNumbers(left.post, right.post, Number.NEGATIVE_INFINITY) ||\n compareNumbers(left.dev, right.dev, Number.POSITIVE_INFINITY)\n );\n}\n\n/** The highest of `versions` that is a release (see `isStableVersion`); null when none is. */\nexport function newestStableVersion(versions: Iterable<string>): string | null {\n let newest: string | null = null;\n for (const version of versions) {\n if (isStableVersion(version) && (newest == null || (compareSdkVersions(version, newest) ?? 0) > 0)) {\n newest = version;\n }\n }\n return newest;\n}\n\n/**\n * A development build of a release (`1.0.0.dev0`) comes before its\n * prereleases, which come before the release (or its post-releases).\n * Prereleases in semver's order: numbers numerically and below words, fewer\n * identifiers first.\n */\nfunction comparePrerelease(left: ParsedSdkVersion, right: ParsedSdkVersion): number {\n // PEP 440: 0 is a release's dev build; 1 is a prerelease (including its dev builds); 2 is a release or post-release.\n const stage = ({ prerelease, post, dev }: ParsedSdkVersion) =>\n prerelease.length > 0 ? 1 : dev != null && post == null ? 0 : 2;\n if (stage(left) !== stage(right) || stage(left) !== 1) {\n return Math.sign(stage(left) - stage(right));\n }\n const a = left.prerelease;\n const b = right.prerelease;\n for (let index = 0; index < Math.max(a.length, b.length); index++) {\n const x = a[index];\n const y = b[index];\n if (x === y) {\n continue;\n }\n if (x == null || y == null) {\n return x == null ? -1 : 1;\n }\n if (typeof x === \"number\" && typeof y === \"number\") {\n return Math.sign(x - y);\n }\n if (typeof x === \"number\" || typeof y === \"number\") {\n return typeof x === \"number\" ? -1 : 1;\n }\n return x < y ? -1 : 1;\n }\n return 0;\n}\n\n/** Compares two optional numbers, reading a missing one as `missing`. */\nfunction compareNumbers(a: number | null, b: number | null, missing: number): number {\n const x = a ?? missing;\n const y = b ?? missing;\n return x === y ? 0 : x < y ? -1 : 1;\n}\n"],"mappings":";AAeO,IAAM,4BAA+C;AAAA,EACxD;AAAA,EACA;AAAA,EACA;AACJ;AAGO,SAAS,qBAAqB,SAA6C;AAC9E,QAAM,UAAU,SAAS,KAAK,EAAE,MAAM,GAAG,EAAE,CAAC;AAC5C,SACI,WAAW,QACX,0BAA0B;AAAA,IACtB,CAAC,gBAAgB,YAAY,eAAe,QAAQ,WAAW,GAAG,WAAW,GAAG;AAAA,EACpF;AAER;AAcA,IAAM,qBAA6C,EAAE,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,KAAK,MAAM,SAAS,KAAK;AASvG,SAAS,gBAAgB,SAA0C;AACtE,MAAI,qBAAqB,OAAO,GAAG;AAC/B,WAA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AO,MAAM,UAAU;AAChD,aAAO,KAAK,KAAK,IAAI,CAAC;AAAA,IAC1B;AACA,QAAI,OAAO,MAAM,YAAY,OAAO,MAAM,UAAU;AAChD,aAAO,OAAO,MAAM,WAAW,KAAK;AAAA,IACxC;AACA,WAAO,IAAI,IAAI,KAAK;AAAA,EACxB;AACA,SAAO;AACX;AAGA,SAAS,eAAe,GAAkB,GAAkB,SAAyB;AACjF,QAAM,IAAI,KAAK;AACf,QAAM,IAAI,KAAK;AACf,SAAO,MAAM,IAAI,IAAI,IAAI,IAAI,KAAK;AACtC;","names":[]}
1
+ {"version":3,"sources":["../../../../src/orpc-client/dashboard/sdkVersion.ts"],"sourcesContent":["/**\n * How the SDK pages read an SDK's versions, shared by FDR (which picks an SDK's\n * `latestVersion`) and the dashboard (which holds that against the registry's),\n * so the two never disagree on which version is newer, which is a release, or\n * which is no version at all. Pure: no I/O, safe in the browser.\n */\n\n/**\n * The version Fern's AUTO versioning generates under before it settles the real\n * one. Fiddle uploads snippets before it autoversions, so every AUTO run lands\n * on (and overwrites) a row with this version: a generation, never a release.\n * Per language, as Fiddle's VersionMapper and fern's\n * `generator-cli/src/autoversion/VersionUtils.ts` map it: Go adds a `v`, Python\n * uses the PEP 440 form; fern also counts any `.N` after one. Before 2026-03-19\n * (fern-api/fern#13706) it was 505.503.4455, which a project pinned to an older\n * Fern CLI still generates under: FDR recorded it as recently as 2026-10-27.\n */\nexport const AUTO_VERSION_PLACEHOLDERS: readonly string[] = [\n \"0.0.0-fern-placeholder\",\n \"v0.0.0-fern-placeholder\",\n \"0.0.0.dev0\",\n \"505.503.4455\",\n \"v505.503.4455\"\n];\n\n/** An AUTO placeholder (see `AUTO_VERSION_PLACEHOLDERS`): not shown as a version, never the latest, never compared. */\nexport function isPlaceholderVersion(version: string | null | undefined): boolean {\n const trimmed = version?.trim().split(\"+\")[0];\n return (\n trimmed != null &&\n AUTO_VERSION_PLACEHOLDERS.some(\n (placeholder) => trimmed === placeholder || trimmed.startsWith(`${placeholder}.`)\n )\n );\n}\n\nexport interface ParsedSdkVersion {\n /** The dotted numbers: `46.0.0.20260916` has four, compared part by part. */\n release: number[];\n /** Semver's prerelease identifiers, or PEP 440's pre-release; empty for a release. */\n prerelease: Array<number | string>;\n /** PEP 440's `.postN`: after its release. */\n post: number | null;\n /** PEP 440's `.devN`: before the version it is a development build of. */\n dev: number | null;\n}\n\n/** PEP 440's short names, read as semver's long ones so `a1` and `alpha.1` agree. */\nconst PRERELEASE_ALIASES: Record<string, string> = { a: \"alpha\", b: \"beta\", c: \"rc\", pre: \"rc\", preview: \"rc\" };\n\n/**\n * A version in any spelling Fern's generators and the registries write: a `v`\n * prefix, any number of numeric parts, semver prereleases (`-rc.2`), PEP 440's\n * (`rc2`, `.dev3`, `.post1`) and RubyGems' (`.pre.rc.2`, how it publishes\n * `-rc.2`). Build metadata (`+…`) is dropped. Null for an AUTO placeholder and\n * for anything that does not start with a number.\n */\nexport function parseSdkVersion(version: string): ParsedSdkVersion | null {\n if (isPlaceholderVersion(version)) {\n return null;\n }\n const match = /^v?(\\d+(?:\\.\\d+)*)(.*)$/i.exec(version.trim().split(\"+\")[0] ?? \"\");\n if (match?.[1] == null) {\n return null;\n }\n const parsed: ParsedSdkVersion = {\n release: match[1].split(\".\").map(Number),\n prerelease: [],\n post: null,\n dev: null\n };\n // `-rc.2`, `rc2`, `.rc2` and `.pre.rc.2` all read as [\"rc\", 2]; `post` and `dev` take the number after them.\n const identifiers = ((match[2] ?? \"\").match(/\\d+|[a-z]+/gi) ?? []).map((part) =>\n /^\\d+$/.test(part) ? Number(part) : part.toLowerCase()\n );\n for (let index = 0; index < identifiers.length; index++) {\n const identifier = identifiers[index];\n const next = identifiers[index + 1];\n if (identifier === \"post\" || identifier === \"dev\") {\n parsed[identifier] = typeof next === \"number\" ? next : 0;\n index += typeof next === \"number\" ? 1 : 0;\n } else if (identifier === \"pre\" && typeof next === \"string\") {\n // RubyGems' separator, not a prerelease of its own: `1.0.0.pre.beta.3` is `1.0.0-beta.3`.\n continue;\n } else if (identifier != null) {\n parsed.prerelease.push(\n typeof identifier === \"string\" ? (PRERELEASE_ALIASES[identifier] ?? identifier) : identifier\n );\n }\n }\n return parsed;\n}\n\n/** A release, or a release's post-release: no prerelease identifiers and no development build. */\nexport function isStableVersion(version: string): boolean {\n const parsed = parseSdkVersion(version);\n return parsed != null && parsed.prerelease.length === 0 && parsed.dev == null;\n}\n\n/**\n * Semver precedence, widened to the spellings `parseSdkVersion` reads: -1 when\n * `a` is older than `b`, 1 when newer, 0 when they are the same version however\n * spelled (`6.0.0rc2` and `v6.0.0-rc.2`), null when either is not a version (a\n * placeholder included). PEP 440's order holds: `.dev0` < `a1` < `b1` < `rc1`\n * < the release < `.post1`.\n */\nexport function compareSdkVersions(a: string, b: string): number | null {\n const left = parseSdkVersion(a);\n const right = parseSdkVersion(b);\n if (left == null || right == null) {\n return null;\n }\n for (let index = 0; index < Math.max(left.release.length, right.release.length); index++) {\n const difference = (left.release[index] ?? 0) - (right.release[index] ?? 0);\n if (difference !== 0) {\n return Math.sign(difference);\n }\n }\n return (\n comparePrerelease(left, right) ||\n // No post-release is the release itself, before any; no dev build is the version itself, after its own.\n compareNumbers(left.post, right.post, Number.NEGATIVE_INFINITY) ||\n compareNumbers(left.dev, right.dev, Number.POSITIVE_INFINITY)\n );\n}\n\n/** The highest of `versions` that is a release (see `isStableVersion`); null when none is. */\nexport function newestStableVersion(versions: Iterable<string>): string | null {\n let newest: string | null = null;\n for (const version of versions) {\n if (isStableVersion(version) && (newest == null || (compareSdkVersions(version, newest) ?? 0) > 0)) {\n newest = version;\n }\n }\n return newest;\n}\n\n/**\n * A development build of a release (`1.0.0.dev0`) comes before its\n * prereleases, which come before the release (or its post-releases).\n * Prereleases in semver's order: numbers numerically and below words, fewer\n * identifiers first.\n */\nfunction comparePrerelease(left: ParsedSdkVersion, right: ParsedSdkVersion): number {\n // PEP 440: 0 is a release's dev build; 1 is a prerelease (including its dev builds); 2 is a release or post-release.\n const stage = ({ prerelease, post, dev }: ParsedSdkVersion) =>\n prerelease.length > 0 ? 1 : dev != null && post == null ? 0 : 2;\n if (stage(left) !== stage(right) || stage(left) !== 1) {\n return Math.sign(stage(left) - stage(right));\n }\n const a = left.prerelease;\n const b = right.prerelease;\n for (let index = 0; index < Math.max(a.length, b.length); index++) {\n const x = a[index];\n const y = b[index];\n if (x === y) {\n continue;\n }\n if (x == null || y == null) {\n return x == null ? -1 : 1;\n }\n if (typeof x === \"number\" && typeof y === \"number\") {\n return Math.sign(x - y);\n }\n if (typeof x === \"number\" || typeof y === \"number\") {\n return typeof x === \"number\" ? -1 : 1;\n }\n return x < y ? -1 : 1;\n }\n return 0;\n}\n\n/** Compares two optional numbers, reading a missing one as `missing`. */\nfunction compareNumbers(a: number | null, b: number | null, missing: number): number {\n const x = a ?? missing;\n const y = b ?? missing;\n return x === y ? 0 : x < y ? -1 : 1;\n}\n"],"mappings":";AAiBO,IAAM,4BAA+C;AAAA,EACxD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ;AAGO,SAAS,qBAAqB,SAA6C;AAC9E,QAAM,UAAU,SAAS,KAAK,EAAE,MAAM,GAAG,EAAE,CAAC;AAC5C,SACI,WAAW,QACX,0BAA0B;AAAA,IACtB,CAAC,gBAAgB,YAAY,eAAe,QAAQ,WAAW,GAAG,WAAW,GAAG;AAAA,EACpF;AAER;AAcA,IAAM,qBAA6C,EAAE,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,KAAK,MAAM,SAAS,KAAK;AASvG,SAAS,gBAAgB,SAA0C;AACtE,MAAI,qBAAqB,OAAO,GAAG;AAC/B,WAAO;AAAA,EACX;AACA,QAAM,QAAQ,2BAA2B,KAAK,QAAQ,KAAK,EAAE,MAAM,GAAG,EAAE,CAAC,KAAK,EAAE;AAChF,MAAI,QAAQ,CAAC,KAAK,MAAM;AACpB,WAAO;AAAA,EACX;AACA,QAAM,SAA2B;AAAA,IAC7B,SAAS,MAAM,CAAC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