apiuikit 2.3.0 → 2.4.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.
@@ -1,6 +1,6 @@
1
1
  import { jsxs as nr, jsx as qe } from "react/jsx-runtime";
2
2
  import { useId as kn, useMemo as Ve, useState as gt, useEffect as or } from "react";
3
- import { g as An, c as nt, a as Rn, u as Nn, b as ir, e as qn, o as _n, C as Ln, h as In } from "./index-DCUxUfs9.js";
3
+ import { g as An, c as nt, a as Rn, u as Nn, b as ir, e as qn, o as _n, C as Ln, h as In } from "./index-D1eDZSHR.js";
4
4
  function Kr(t, e = /* @__PURE__ */ new Set()) {
5
5
  if (e.has(t)) return t;
6
6
  if (t.type === "object" && t.properties && typeof t.properties == "object") {
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const be=require("react/jsx-runtime"),oe=require("react"),Q=require("./index-C2-zxpuU.cjs");function Gr(t,e=new Set){if(e.has(t))return t;if(t.type==="object"&&t.properties&&typeof t.properties=="object"){e.add(t);try{const r={};for(const[n,s]of Object.entries(t.properties)){const o=/id$/i.test(n)&&s.type==="string"&&!s.format&&!s.examples,a=s.type==="string"&&!s.format&&!s.examples&&!s.enum;r[n]=o?{...s,format:"uuid"}:a?{...s,examples:["string"]}:Gr(s,e)}return{...t,properties:r}}finally{e.delete(t)}}return t}async function En(t){try{const{generate:e}=await Promise.resolve().then(()=>require("./index-Ccy_JZ0T.cjs"));return await e(Gr(t),{seed:42,useExamplesValue:!0,optionalsProbability:1})}catch{return}}const rr="",nr=`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const be=require("react/jsx-runtime"),oe=require("react"),Q=require("./index-Dgi7m_9C.cjs");function Gr(t,e=new Set){if(e.has(t))return t;if(t.type==="object"&&t.properties&&typeof t.properties=="object"){e.add(t);try{const r={};for(const[n,s]of Object.entries(t.properties)){const o=/id$/i.test(n)&&s.type==="string"&&!s.format&&!s.examples,a=s.type==="string"&&!s.format&&!s.examples&&!s.enum;r[n]=o?{...s,format:"uuid"}:a?{...s,examples:["string"]}:Gr(s,e)}return{...t,properties:r}}finally{e.delete(t)}}return t}async function En(t){try{const{generate:e}=await Promise.resolve().then(()=>require("./index-Ccy_JZ0T.cjs"));return await e(Gr(t),{seed:42,useExamplesValue:!0,optionalsProbability:1})}catch{return}}const rr="",nr=`
2
2
  `;var j=class{constructor({indent:t,join:e}={}){this.postProcessors=[],this.code=[],this.indentationCharacter=rr,this.lineJoin=nr,this.indentLine=(r,n=0)=>`${this.indentationCharacter.repeat(n)}${r}`,this.unshift=(r,n)=>{const s=this.indentLine(r,n);this.code.unshift(s)},this.push=(r,n)=>{const s=this.indentLine(r,n);this.code.push(s)},this.pushToLast=r=>{this.code||this.push(r);const n=`${this.code[this.code.length-1]}${r}`;this.code[this.code.length-1]=n},this.blank=()=>{this.code.push("")},this.join=()=>{const r=this.code.join(this.lineJoin);return this.postProcessors.reduce((n,s)=>s(n),r)},this.addPostProcessor=r=>{this.postProcessors=[...this.postProcessors,r]},this.indentationCharacter=t||rr,this.lineJoin=e??nr}},jn=function(t){return Object.prototype.toString.call(t)==="[object RegExp]"},Pn=function(t){var e=typeof t;return t!==null&&(e==="object"||e==="function")},Kt={};Object.defineProperty(Kt,"__esModule",{value:!0});Kt.default=t=>Object.getOwnPropertySymbols(t).filter(e=>Object.prototype.propertyIsEnumerable.call(t,e));const Cn=jn,kn=Pn,An=Kt.default;var Rn=(t,e,r)=>{const n=[];return(function s(o,a,i){a=a||{},a.indent=a.indent||" ",i=i||"";let c;a.inlineCharacterLimit===void 0?c={newLine:`
3
3
  `,newLineOrSpace:`
4
4
  `,pad:i,indent:i+a.indent}:c={newLine:"@@__STRINGIFY_OBJECT_NEW_LINE__@@",newLineOrSpace:"@@__STRINGIFY_OBJECT_NEW_LINE_OR_SPACE__@@",pad:"@@__STRINGIFY_OBJECT_PAD__@@",indent:"@@__STRINGIFY_OBJECT_INDENT__@@"};const l=f=>{if(a.inlineCharacterLimit===void 0)return f;const u=f.replace(new RegExp(c.newLine,"g"),"").replace(new RegExp(c.newLineOrSpace,"g")," ").replace(new RegExp(c.pad+"|"+c.indent,"g"),"");return u.length<=a.inlineCharacterLimit?u:f.replace(new RegExp(c.newLine+"|"+c.newLineOrSpace,"g"),`
@@ -1,5 +1,5 @@
1
1
  import { jsx as t } from "react/jsx-runtime";
2
- import { d as l } from "./index-DCUxUfs9.js";
2
+ import { d as l } from "./index-D1eDZSHR.js";
3
3
  function e({ value: r }) {
4
4
  const o = l(r);
5
5
  return o ? /* @__PURE__ */ t(
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),t=require("./index-C2-zxpuU.cjs");function n({value:e}){const o=t.resolveLogo(e);return o?r.jsx("img",{src:o.url,alt:o.altText??"logo",style:o.backgroundColor?{backgroundColor:o.backgroundColor}:void 0,className:"max-h-24 max-w-24 object-contain"}):null}exports.default=n;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),t=require("./index-Dgi7m_9C.cjs");function n({value:e}){const o=t.resolveLogo(e);return o?r.jsx("img",{src:o.url,alt:o.altText??"logo",style:o.backgroundColor?{backgroundColor:o.backgroundColor}:void 0,className:"max-h-24 max-w-24 object-contain"}):null}exports.default=n;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./index-C2-zxpuU.cjs");exports.AsyncAPI=e.AsyncAPI;exports.AsyncAPIInfo=e.AsyncAPIInfo;exports.AsyncAPIMessage=e.AsyncAPIMessage;exports.AsyncAPIMessages=e.AsyncAPIMessages;exports.AsyncAPIOperation=e.AsyncAPIOperation;exports.AsyncAPIOperations=e.AsyncAPIOperations;exports.AsyncAPIProvider=e.AsyncAPIProvider;exports.AsyncAPIRenderer=e.AsyncAPIRenderer;exports.AsyncAPISchemas=e.AsyncAPISchemas;exports.AsyncAPIServers=e.AsyncAPIServers;exports.ErrorBoundary=e.ErrorBoundary;exports.OpenAPI=e.OpenAPI;exports.OpenAPIEndpoint=e.OpenAPIEndpoint;exports.OpenAPIEndpoints=e.OpenAPIEndpoints;exports.OpenAPIInfo=e.OpenAPIInfo;exports.OpenAPIProvider=e.OpenAPIProvider;exports.OpenAPIRenderer=e.OpenAPIRenderer;exports.OpenAPISchemas=e.OpenAPISchemas;exports.OpenAPIServers=e.OpenAPIServers;exports.OpenAPIWebhook=e.OpenAPIWebhook;exports.OpenAPIWebhooks=e.OpenAPIWebhooks;exports.PluginSlot=e.PluginSlot;exports.Schema=e.Schema;exports.SchemaTab=e.SchemaTabs;exports.SchemaTree=e.SchemaTree;exports.Schemas=e.Schemas;exports.asyncApiOperationToMarkdown=e.asyncApiOperationToMarkdown;exports.asyncApiToMarkdown=e.asyncApiToMarkdown;exports.default=e.AsyncAPI;exports.defaultConfig=e.defaultConfig;exports.documentToLlmsTxt=e.documentToLlmsTxt;exports.documentToMarkdown=e.documentToMarkdown;exports.listDocumentTargets=e.listDocumentTargets;exports.markdownForLlm=e.markdownForLlm;exports.openApiEndpointToMarkdown=e.openApiEndpointToMarkdown;exports.openApiToMarkdown=e.openApiToMarkdown;exports.parseAndRender=e.parseAndRender;exports.parseAndRenderOpenAPI=e.parseAndRender$1;exports.targetSlug=e.targetSlug;exports.useAsyncAPIDocument=e.useAsyncAPIDocument;exports.useAsyncAPIDocumentContext=e.useAsyncAPIDocumentContext;exports.useDocumentContext=e.useDocumentContext;exports.useOpenAPIDocumentContext=e.useOpenAPIDocumentContext;exports.useOperationTabPlugins=e.useOperationTabPlugins;exports.usePluginSlot=e.usePluginSlot;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./index-Dgi7m_9C.cjs");exports.AsyncAPI=e.AsyncAPI;exports.AsyncAPIInfo=e.AsyncAPIInfo;exports.AsyncAPIMessage=e.AsyncAPIMessage;exports.AsyncAPIMessages=e.AsyncAPIMessages;exports.AsyncAPIOperation=e.AsyncAPIOperation;exports.AsyncAPIOperations=e.AsyncAPIOperations;exports.AsyncAPIProvider=e.AsyncAPIProvider;exports.AsyncAPIRenderer=e.AsyncAPIRenderer;exports.AsyncAPISchemas=e.AsyncAPISchemas;exports.AsyncAPIServers=e.AsyncAPIServers;exports.ErrorBoundary=e.ErrorBoundary;exports.OpenAPI=e.OpenAPI;exports.OpenAPIEndpoint=e.OpenAPIEndpoint;exports.OpenAPIEndpoints=e.OpenAPIEndpoints;exports.OpenAPIInfo=e.OpenAPIInfo;exports.OpenAPIProvider=e.OpenAPIProvider;exports.OpenAPIRenderer=e.OpenAPIRenderer;exports.OpenAPISchemas=e.OpenAPISchemas;exports.OpenAPIServers=e.OpenAPIServers;exports.OpenAPIWebhook=e.OpenAPIWebhook;exports.OpenAPIWebhooks=e.OpenAPIWebhooks;exports.PluginSlot=e.PluginSlot;exports.Schema=e.Schema;exports.SchemaTab=e.SchemaTabs;exports.SchemaTree=e.SchemaTree;exports.Schemas=e.Schemas;exports.asyncApiOperationToMarkdown=e.asyncApiOperationToMarkdown;exports.asyncApiToMarkdown=e.asyncApiToMarkdown;exports.default=e.AsyncAPI;exports.defaultConfig=e.defaultConfig;exports.documentToLlmsTxt=e.documentToLlmsTxt;exports.documentToMarkdown=e.documentToMarkdown;exports.listDocumentTargets=e.listDocumentTargets;exports.markdownForLlm=e.markdownForLlm;exports.openApiEndpointToMarkdown=e.openApiEndpointToMarkdown;exports.openApiToMarkdown=e.openApiToMarkdown;exports.parseAndRender=e.parseAndRender;exports.parseAndRenderOpenAPI=e.parseAndRender$1;exports.targetSlug=e.targetSlug;exports.useAsyncAPIDocument=e.useAsyncAPIDocument;exports.useAsyncAPIDocumentContext=e.useAsyncAPIDocumentContext;exports.useDocumentContext=e.useDocumentContext;exports.useOpenAPIDocumentContext=e.useOpenAPIDocumentContext;exports.useOperationTabPlugins=e.useOperationTabPlugins;exports.usePluginSlot=e.usePluginSlot;
@@ -1,4 +1,4 @@
1
- import { A as e, f as n, j as o, k as A, l as r, m as t, n as P, p, q as c, s as I, E as d, O as u, t as i, v as m, w as O, x as y, y as l, z as S, B as T, D as g, F as k, P as h, S as M, G as f, H as w, I as x, J as D, K as v, A as E, L as R, M as b, N as C, Q as L, R as W, o as B, T as F, U as j, V as q, W as z, Y as G, Z as H, u as J, _ as K, $ as N, a0 as Q } from "./index-DCUxUfs9.js";
1
+ import { A as e, f as n, j as o, k as A, l as r, m as t, n as P, p, q as c, s as I, E as d, O as u, t as i, v as m, w as O, x as y, y as l, z as S, B as T, D as g, F as k, P as h, S as M, G as f, H as w, I as x, J as D, K as v, A as E, L as R, M as b, N as C, Q as L, R as W, o as B, T as F, U as j, V as q, W as z, Y as G, Z as H, u as J, _ as K, $ as N, a0 as Q } from "./index-D1eDZSHR.js";
2
2
  export {
3
3
  e as AsyncAPI,
4
4
  n as AsyncAPIInfo,
@@ -1,8 +1,9 @@
1
1
  import { Operation as OperationType } from '../../types/asyncapi/Operation';
2
2
  /**
3
- * An operation's identity: action badge and channel address. Shared by the
4
- * list's side-panel title (Operations.tsx) and the inline single-operation
5
- * card. Falls back to the operation key for a channel without an address.
3
+ * An operation's identity: action badge and its title, or the channel address
4
+ * when it has none. Shared by the list's side-panel title (Operations.tsx) and
5
+ * the inline single-operation card. Falls back to the operation key for an
6
+ * untitled operation on a channel without an address.
6
7
  */
7
8
  export declare function OperationTitle({ op, operationKey }: {
8
9
  op: OperationType;
@@ -0,0 +1,23 @@
1
+ /** JSON Schema keywords whose values are subschemas (or maps/lists of them). */
2
+ export declare const SCHEMA_STRUCTURAL_KEYS: Set<string>;
3
+ /** The component schema a JSON Pointer is or points inside of (`#/components/schemas/<name>/…`), if any. */
4
+ export declare const componentSchemaContaining: (pointer: string) => string | undefined;
5
+ /**
6
+ * Names a document's component schemas wherever they've been inlined, so a
7
+ * walker can stop at one instead of re-expanding it at every reference site.
8
+ * In densely linked specs that re-expansion is what blows up: Stripe's
9
+ * response schemas are ~9k distinct objects but tens of millions of nodes
10
+ * walked as a tree.
11
+ *
12
+ * Matched by identity, two ways: resolveDocument inlines a `$ref` as the
13
+ * target object itself (its `copies`), while @scalar/openapi-parser inlines a
14
+ * fresh shallow copy of the target whose structural children (`properties`,
15
+ * `items`, …) are still the target's own — so a node also matches when one of
16
+ * those children is the same object, under the same key, on a named schema of
17
+ * the same `type`. Where such a copy sits inside its own target, resolveDocument
18
+ * cuts the cycle by replacing that child with a `$ref` stub to wherever the
19
+ * child first appeared — often deep under `#/paths`, not under the schema —
20
+ * so with `deref` (against the same resolved document) a stub child is
21
+ * followed and matched the same way.
22
+ */
23
+ export declare const createNamedSchemaLookup: (schemas: Record<string, unknown> | undefined, deref?: (ref: string) => unknown) => ((node: unknown) => string | undefined);
@@ -16,6 +16,14 @@ export interface SearchEntry {
16
16
  schemaFocusTokens?: string[];
17
17
  }
18
18
  export declare const normalizeString: (value: unknown) => string;
19
- /** Walks a single JSON Schema node into flat search entries — spec-agnostic (AsyncAPI and OpenAPI schemas share the same shape), reused by openapiSearchIndex.ts. */
20
- export declare const addSchemaEntries: (entries: SearchEntry[], schema: unknown, schemaKey: string, schemaName: string) => void;
19
+ /**
20
+ * Walks a single JSON Schema node into flat search entries — spec-agnostic (AsyncAPI and OpenAPI schemas share the same shape), reused by openapiSearchIndex.ts.
21
+ *
22
+ * `namedSchemaOf` (createNamedSchemaLookup) recognizes the document's
23
+ * component schemas, each indexed by its own call. A reference to one still gets an entry where it occurs, but the
24
+ * walk doesn't descend into it — otherwise every schema re-indexes everything
25
+ * it can reach: on a densely linked spec like Stripe's, 271k entries for ~10k
26
+ * distinct nodes.
27
+ */
28
+ export declare const addSchemaEntries: (entries: SearchEntry[], schema: unknown, schemaKey: string, schemaName: string, namedSchemaOf?: (node: unknown) => string | undefined) => void;
21
29
  export declare function buildSearchIndex(asyncapi: AsyncAPIDocumentData): SearchEntry[];
@@ -11,8 +11,8 @@ export declare function openApiToMarkdown(doc: OpenAPIDocumentData, deref?: Dere
11
11
  /**
12
12
  * Builds a self-contained Markdown snippet for a single OpenAPI endpoint:
13
13
  * doc info + servers (so the snippet stands alone without the rest of the
14
- * document) followed by that one endpoint's fully-dereferenced parameters,
15
- * request body, and responses, as opposed to `openApiToMarkdown`'s
14
+ * document) followed by that one endpoint's parameters, request body, and
15
+ * responses, then every component schema those reference, as opposed to `openApiToMarkdown`'s
16
16
  * whole-document export. Backs the "Agent Prompt" entry in the endpoint's
17
17
  * code-sample dropdown (components/CodeSamples.tsx).
18
18
  */
@@ -5,7 +5,7 @@ var Vp = (_i) => {
5
5
  var bd = (_i, Oi, Ai) => Oi in _i ? gd(_i, Oi, { enumerable: !0, configurable: !0, writable: !0, value: Ai }) : _i[Oi] = Ai;
6
6
  var Np = (_i, Oi, Ai) => bd(_i, typeof Oi != "symbol" ? Oi + "" : Oi, Ai), Fp = (_i, Oi, Ai) => Oi.has(_i) || Vp("Cannot " + Ai);
7
7
  var pr = (_i, Oi, Ai) => (Fp(_i, Oi, "read from private field"), Ai ? Ai.call(_i) : Oi.get(_i)), co = (_i, Oi, Ai) => Oi.has(_i) ? Vp("Cannot add the same private member more than once") : Oi instanceof WeakSet ? Oi.add(_i) : Oi.set(_i, Ai), ca = (_i, Oi, Ai, cn) => (Fp(_i, Oi, "write to private field"), cn ? cn.call(_i, Ai) : Oi.set(_i, Ai), Ai);
8
- import { g as vd } from "./index-DCUxUfs9.js";
8
+ import { g as vd } from "./index-D1eDZSHR.js";
9
9
  function jd(_i, Oi) {
10
10
  for (var Ai = 0; Ai < Oi.length; Ai++) {
11
11
  const cn = Oi[Ai];
@@ -1,7 +1,7 @@
1
1
  var Jl = Object.defineProperty;
2
2
  var Wl = (t, e, r) => e in t ? Jl(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
3
3
  var Xe = (t, e, r) => Wl(t, typeof e != "symbol" ? e + "" : e, r);
4
- import { g as zn } from "./index-DCUxUfs9.js";
4
+ import { g as zn } from "./index-D1eDZSHR.js";
5
5
  function pi(t) {
6
6
  return t.replace(/~/g, "~0").replace(/\//g, "~1");
7
7
  }