raffel 1.1.97-next.bfeab7f → 1.1.97

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 (97) hide show
  1. package/dist/docs/try-it-proxy.d.ts +0 -15
  2. package/dist/docs/try-it-proxy.d.ts.map +1 -1
  3. package/dist/docs/try-it-proxy.js +0 -54
  4. package/dist/docs/try-it-proxy.js.map +1 -1
  5. package/dist/docs/ui/assets/protocol-console.js +1 -13
  6. package/dist/docs/ui/assets/raffel-docs.js +1 -167
  7. package/dist/docs/ui/client-script/cards-and-code.d.ts +5 -0
  8. package/dist/docs/ui/client-script/cards-and-code.d.ts.map +1 -0
  9. package/dist/docs/ui/client-script/cards-and-code.js +5 -0
  10. package/dist/docs/ui/client-script/cards-and-code.js.map +1 -0
  11. package/dist/docs/ui/client-script/content.d.ts +5 -0
  12. package/dist/docs/ui/client-script/content.d.ts.map +1 -0
  13. package/dist/docs/ui/client-script/content.js +412 -0
  14. package/dist/docs/ui/client-script/content.js.map +1 -0
  15. package/dist/docs/ui/client-script/docs-pages.d.ts +5 -0
  16. package/dist/docs/ui/client-script/docs-pages.d.ts.map +1 -0
  17. package/dist/docs/ui/client-script/docs-pages.js +153 -0
  18. package/dist/docs/ui/client-script/docs-pages.js.map +1 -0
  19. package/dist/docs/ui/client-script/endpoint-details.d.ts +5 -0
  20. package/dist/docs/ui/client-script/endpoint-details.d.ts.map +1 -0
  21. package/dist/docs/ui/client-script/endpoint-details.js +5 -0
  22. package/dist/docs/ui/client-script/endpoint-details.js.map +1 -0
  23. package/dist/docs/ui/client-script/index.d.ts.map +1 -1
  24. package/dist/docs/ui/client-script/index.js +95 -3
  25. package/dist/docs/ui/client-script/index.js.map +1 -1
  26. package/dist/docs/ui/client-script/init.d.ts +5 -0
  27. package/dist/docs/ui/client-script/init.d.ts.map +1 -0
  28. package/dist/docs/ui/client-script/init.js +227 -0
  29. package/dist/docs/ui/client-script/init.js.map +1 -0
  30. package/dist/docs/ui/client-script/markdown.d.ts +5 -0
  31. package/dist/docs/ui/client-script/markdown.d.ts.map +1 -0
  32. package/dist/docs/ui/client-script/markdown.js +438 -0
  33. package/dist/docs/ui/client-script/markdown.js.map +1 -0
  34. package/dist/docs/ui/client-script/navigation.d.ts +5 -0
  35. package/dist/docs/ui/client-script/navigation.d.ts.map +1 -0
  36. package/dist/docs/ui/client-script/navigation.js +548 -0
  37. package/dist/docs/ui/client-script/navigation.js.map +1 -0
  38. package/dist/docs/ui/client-script/protocols.d.ts +5 -0
  39. package/dist/docs/ui/client-script/protocols.d.ts.map +1 -0
  40. package/dist/docs/ui/client-script/protocols.js +5 -0
  41. package/dist/docs/ui/client-script/protocols.js.map +1 -0
  42. package/dist/docs/ui/client-script/schema-rendering.d.ts +5 -0
  43. package/dist/docs/ui/client-script/schema-rendering.d.ts.map +1 -0
  44. package/dist/docs/ui/client-script/schema-rendering.js +5 -0
  45. package/dist/docs/ui/client-script/schema-rendering.js.map +1 -0
  46. package/dist/docs/ui/client-script/try-it.d.ts +5 -0
  47. package/dist/docs/ui/client-script/try-it.d.ts.map +1 -0
  48. package/dist/docs/ui/client-script/try-it.js +5 -0
  49. package/dist/docs/ui/client-script/try-it.js.map +1 -0
  50. package/dist/docs/ui/html-builder.d.ts.map +1 -1
  51. package/dist/docs/ui/html-builder.js +3 -6
  52. package/dist/docs/ui/html-builder.js.map +1 -1
  53. package/dist/docs/ui/runtime/index.js +1 -167
  54. package/dist/docs/ui/runtime/index.js.map +1 -1
  55. package/dist/docs/ui/runtime/protocol-console.d.ts +0 -2
  56. package/dist/docs/ui/runtime/protocol-console.d.ts.map +1 -1
  57. package/dist/docs/ui/runtime/protocol-console.js +1 -13
  58. package/dist/docs/ui/runtime/protocol-console.js.map +1 -1
  59. package/dist/docs/usd-middleware.d.ts +0 -2
  60. package/dist/docs/usd-middleware.d.ts.map +1 -1
  61. package/dist/docs/usd-middleware.js +1 -37
  62. package/dist/docs/usd-middleware.js.map +1 -1
  63. package/dist/server/builder/execution-http-docs.d.ts.map +1 -1
  64. package/dist/server/builder/execution-http-docs.js +0 -8
  65. package/dist/server/builder/execution-http-docs.js.map +1 -1
  66. package/dist/server/rest-middleware.d.ts.map +1 -1
  67. package/dist/server/rest-middleware.js +0 -26
  68. package/dist/server/rest-middleware.js.map +1 -1
  69. package/dist/ui/docs/try-it-proxy.d.ts +0 -15
  70. package/dist/ui/docs/try-it-proxy.d.ts.map +1 -1
  71. package/dist/ui/docs/ui/client-script/cards-and-code.d.ts +5 -0
  72. package/dist/ui/docs/ui/client-script/cards-and-code.d.ts.map +1 -0
  73. package/dist/ui/docs/ui/client-script/content.d.ts +5 -0
  74. package/dist/ui/docs/ui/client-script/content.d.ts.map +1 -0
  75. package/dist/ui/docs/ui/client-script/docs-pages.d.ts +5 -0
  76. package/dist/ui/docs/ui/client-script/docs-pages.d.ts.map +1 -0
  77. package/dist/ui/docs/ui/client-script/endpoint-details.d.ts +5 -0
  78. package/dist/ui/docs/ui/client-script/endpoint-details.d.ts.map +1 -0
  79. package/dist/ui/docs/ui/client-script/index.d.ts.map +1 -1
  80. package/dist/ui/docs/ui/client-script/init.d.ts +5 -0
  81. package/dist/ui/docs/ui/client-script/init.d.ts.map +1 -0
  82. package/dist/ui/docs/ui/client-script/markdown.d.ts +5 -0
  83. package/dist/ui/docs/ui/client-script/markdown.d.ts.map +1 -0
  84. package/dist/ui/docs/ui/client-script/navigation.d.ts +5 -0
  85. package/dist/ui/docs/ui/client-script/navigation.d.ts.map +1 -0
  86. package/dist/ui/docs/ui/client-script/protocols.d.ts +5 -0
  87. package/dist/ui/docs/ui/client-script/protocols.d.ts.map +1 -0
  88. package/dist/ui/docs/ui/client-script/schema-rendering.d.ts +5 -0
  89. package/dist/ui/docs/ui/client-script/schema-rendering.d.ts.map +1 -0
  90. package/dist/ui/docs/ui/client-script/try-it.d.ts +5 -0
  91. package/dist/ui/docs/ui/client-script/try-it.d.ts.map +1 -0
  92. package/dist/ui/docs/ui/html-builder.d.ts.map +1 -1
  93. package/dist/ui/docs/ui/runtime/protocol-console.d.ts +0 -2
  94. package/dist/ui/docs/ui/runtime/protocol-console.d.ts.map +1 -1
  95. package/dist/ui/docs/usd-middleware.d.ts +0 -2
  96. package/dist/ui/docs/usd-middleware.d.ts.map +1 -1
  97. package/package.json +1 -1
@@ -13,19 +13,4 @@ export interface DocsTryItProxyOptions {
13
13
  fetchImpl?: typeof fetch;
14
14
  }
15
15
  export declare function executeDocsTryItProxy(payload: DocsTryItRequest, options: DocsTryItProxyOptions): Promise<Response>;
16
- export interface DocsTryItStreamRequest {
17
- url: string;
18
- /** Optional bearer/authorization value forwarded upstream (EventSource cannot set headers itself). */
19
- authorization?: string;
20
- }
21
- /**
22
- * Same-origin proxy for a docs "try it out" SSE / EventSource console.
23
- *
24
- * Unlike {@link executeDocsTryItProxy} this does NOT buffer the response — it
25
- * pipes the upstream `text/event-stream` body straight back so an infinite
26
- * stream keeps flowing. The same origin allowlist applies: only declared USD
27
- * server origins (or explicitly configured `allowedOrigins`) are reachable, so
28
- * the console cannot be pointed at an arbitrary host.
29
- */
30
- export declare function executeDocsTryItStreamProxy(payload: DocsTryItStreamRequest, options: DocsTryItProxyOptions): Promise<Response>;
31
16
  //# sourceMappingURL=try-it-proxy.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"try-it-proxy.d.ts","sourceRoot":"","sources":["../../src/docs/try-it-proxy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAErD,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAChC,IAAI,CAAC,EAAE,OAAO,CAAA;CACf;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,CAAC,EAAE,SAAS,EAAE,CAAA;IACrB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;IACzB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,SAAS,CAAC,EAAE,OAAO,KAAK,CAAA;CACzB;AAED,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,gBAAgB,EACzB,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,QAAQ,CAAC,CA6DnB;AAED,MAAM,WAAW,sBAAsB;IACrC,GAAG,EAAE,MAAM,CAAA;IACX,sGAAsG;IACtG,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAED;;;;;;;;GAQG;AACH,wBAAsB,2BAA2B,CAC/C,OAAO,EAAE,sBAAsB,EAC/B,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,QAAQ,CAAC,CAsDnB"}
1
+ {"version":3,"file":"try-it-proxy.d.ts","sourceRoot":"","sources":["../../src/docs/try-it-proxy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAErD,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAChC,IAAI,CAAC,EAAE,OAAO,CAAA;CACf;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,CAAC,EAAE,SAAS,EAAE,CAAA;IACrB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;IACzB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,SAAS,CAAC,EAAE,OAAO,KAAK,CAAA;CACzB;AAED,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,gBAAgB,EACzB,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,QAAQ,CAAC,CA6DnB"}
@@ -60,60 +60,6 @@ export async function executeDocsTryItProxy(payload, options) {
60
60
  clearTimeout(timeout);
61
61
  }
62
62
  }
63
- /**
64
- * Same-origin proxy for a docs "try it out" SSE / EventSource console.
65
- *
66
- * Unlike {@link executeDocsTryItProxy} this does NOT buffer the response — it
67
- * pipes the upstream `text/event-stream` body straight back so an infinite
68
- * stream keeps flowing. The same origin allowlist applies: only declared USD
69
- * server origins (or explicitly configured `allowedOrigins`) are reachable, so
70
- * the console cannot be pointed at an arbitrary host.
71
- */
72
- export async function executeDocsTryItStreamProxy(payload, options) {
73
- const target = parseTarget(payload?.url ?? '');
74
- const allowedServers = resolveServerUrls(options.servers ?? []);
75
- const allowedOrigins = new Set((options.allowedOrigins ?? []).flatMap(origin => {
76
- const parsed = parseTarget(origin);
77
- return parsed ? [parsed.origin] : [];
78
- }));
79
- if (!target || (!allowedOrigins.has(target.origin) && !allowedServers.some(server => isWithinServer(target, server)))) {
80
- return problem(403, 'Request target is not allowed', 'The documentation proxy only connects to declared API server origins.');
81
- }
82
- const headers = new Headers({ accept: 'text/event-stream' });
83
- if (payload.authorization)
84
- headers.set('authorization', payload.authorization);
85
- // Guard only the connection handshake; once headers arrive we stop the timer
86
- // so the (potentially infinite) stream body is never aborted mid-flight.
87
- const controller = new AbortController();
88
- const timeout = setTimeout(() => controller.abort(), options.timeoutMs ?? 15_000);
89
- let upstream;
90
- try {
91
- upstream = await (options.fetchImpl ?? fetch)(target.toString(), {
92
- method: 'GET',
93
- headers,
94
- redirect: 'manual',
95
- signal: controller.signal,
96
- });
97
- }
98
- catch {
99
- clearTimeout(timeout);
100
- const timedOut = controller.signal.aborted;
101
- return problem(timedOut ? 504 : 502, timedOut ? 'Upstream stream timed out' : 'Upstream stream failed', timedOut
102
- ? 'The declared upstream server did not start the stream before the configured timeout.'
103
- : 'The declared upstream server could not open the stream.');
104
- }
105
- clearTimeout(timeout);
106
- if (!upstream.ok || !upstream.body) {
107
- return problem(upstream.status >= 400 ? upstream.status : 502, 'Upstream stream unavailable', 'The declared upstream server did not return a readable event stream.');
108
- }
109
- return new Response(upstream.body, {
110
- status: 200,
111
- headers: {
112
- 'Content-Type': 'text/event-stream; charset=utf-8',
113
- 'Cache-Control': 'no-store',
114
- },
115
- });
116
- }
117
63
  const HOP_BY_HOP_HEADERS = new Set([
118
64
  'connection', 'keep-alive', 'proxy-authenticate', 'proxy-authorization',
119
65
  'te', 'trailer', 'transfer-encoding', 'upgrade', 'host', 'content-length',
@@ -1 +1 @@
1
- {"version":3,"file":"try-it-proxy.js","sourceRoot":"","sources":["../../src/docs/try-it-proxy.ts"],"names":[],"mappings":"AAiBA,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,OAAyB,EACzB,OAA8B;IAE9B,MAAM,MAAM,GAAG,WAAW,CAAC,OAAO,EAAE,GAAG,CAAC,CAAA;IACxC,MAAM,cAAc,GAAG,iBAAiB,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC,CAAA;IAC/D,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,CAAC,cAAc,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;QAC7E,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,CAAA;QAClC,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;IACtC,CAAC,CAAC,CAAC,CAAA;IACH,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;QACtH,OAAO,OAAO,CAAC,GAAG,EAAE,+BAA+B,EAAE,uEAAuE,CAAC,CAAA;IAC/H,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,IAAI,KAAK,CAAC,CAAC,WAAW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E,MAAM,EAAE,CAAC,EAAE;QAClF,MAAM;QACN,OAAO,EAAE,EAAE,cAAc,EAAE,yCAAyC,EAAE;KACvE,CAAC,CAAA;AACJ,CAAC"}
@@ -1,15 +1,3 @@
1
- /**
2
- * Resolve the URL an EventSource should open: the raw upstream in `direct`
3
- * mode, or the same-origin `-/stream` proxy (with the upstream passed as a
4
- * `url` query param) when the docs are configured for `proxy` mode. Routing
5
- * through the proxy avoids CORS and keeps the stream on the declared origin.
6
- */
7
- function resolveStreamUrl(tryItConfig, target) {
8
- if (tryItConfig?.mode === 'proxy' && tryItConfig.streamProxyUrl) {
9
- return `${tryItConfig.streamProxyUrl}?url=${encodeURIComponent(target)}`;
10
- }
11
- return target;
12
- }
13
1
  export function appendProtocolConsole(container, deps) {
14
2
  if (deps.activeProtocol === 'http')
15
3
  return;
@@ -88,7 +76,7 @@ function bindLiveConsole(panel, deps) {
88
76
  run.textContent = 'Connect';
89
77
  return;
90
78
  }
91
- events = new EventSource(resolveStreamUrl(deps.tryItConfig, url.value));
79
+ events = new EventSource(url.value);
92
80
  events.onopen = () => { run.textContent = 'Close'; write('connected'); };
93
81
  events.onmessage = (event) => write(`event ${event.data}`);
94
82
  events.onerror = () => write('stream error');
@@ -2287,168 +2287,11 @@ function renderAsyncContracts(title, entries, callbacks = false) {
2287
2287
  });
2288
2288
  return section;
2289
2289
  }
2290
- // Merge content-type declarations across the three USD layers (operation →
2291
- // protocol → global) the same way the reference generator does, so a console
2292
- // row shows the effective default plus every supported media type.
2293
- function resolveEffectiveContentTypes(operationTypes, protocolTypes) {
2294
- const globalTypes = (xUsd && xUsd.contentTypes) ? xUsd.contentTypes : {};
2295
- const defaultType = (operationTypes && operationTypes.default)
2296
- || (protocolTypes && protocolTypes.default)
2297
- || globalTypes.default
2298
- || 'application/json';
2299
- const supportedList = (operationTypes && operationTypes.supported)
2300
- || (protocolTypes && protocolTypes.supported)
2301
- || globalTypes.supported
2302
- || [];
2303
- const supported = Array.isArray(supportedList) ? supportedList.slice() : [];
2304
- if (defaultType && supported.indexOf(defaultType) === -1)
2305
- supported.unshift(defaultType);
2306
- return { default: defaultType, supported };
2307
- }
2308
- function appendContentTypesSection(container, label, contentTypes) {
2309
- if (!contentTypes)
2310
- return;
2311
- const section = doc.createElement('div');
2312
- section.className = 'endpoint-subsection';
2313
- section.innerHTML = `<div class="subsection-label">${esc(label)}</div>`;
2314
- const grid = doc.createElement('div');
2315
- grid.className = 'info-grid';
2316
- const supportedText = (contentTypes.supported && contentTypes.supported.length > 0)
2317
- ? contentTypes.supported.join(', ')
2318
- : contentTypes.default;
2319
- grid.innerHTML =
2320
- `<div class="info-card"><div class="info-card-title">Default</div><div class="info-card-value">${esc(contentTypes.default || 'application/json')}</div></div>` +
2321
- `<div class="info-card"><div class="info-card-title">Supported</div><div class="info-card-value">${esc(supportedText || 'application/json')}</div></div>`;
2322
- section.appendChild(grid);
2323
- container.appendChild(section);
2324
- }
2325
- // Multi-language client snippets for WebSocket channels.
2326
- function generateWsCodeSample(lang, url, path, data) {
2327
- const channelType = data?.type || 'public';
2328
- const subscribeMsg = { type: 'subscribe', channel: path, id: '1' };
2329
- const subscribeMsgStr = JSON.stringify(subscribeMsg, null, 2);
2330
- const publishMsg = data?.publish?.message?.payload
2331
- ? { type: 'publish', channel: path, event: 'message', data: generateExampleFromSchema(data.publish.message.payload), id: '2' }
2332
- : null;
2333
- const needsAuth = channelType === 'private' || channelType === 'presence';
2334
- const authUrl = needsAuth ? `${url}?token=YOUR_TOKEN` : url;
2335
- const indent = (value, pad) => value.split('\n').map((line, i) => i === 0 ? line : pad + line).join('\n');
2336
- switch (lang) {
2337
- case 'wscat': {
2338
- let out = `wscat -c "${authUrl}"\n\n# Subscribe to channel:\n> ${JSON.stringify(subscribeMsg)}`;
2339
- if (publishMsg)
2340
- out += `\n\n# Publish a message:\n> ${JSON.stringify(publishMsg)}`;
2341
- return out;
2342
- }
2343
- case 'javascript': {
2344
- let out = `const ws = new WebSocket("${authUrl}");\n\n`;
2345
- out += `ws.onopen = () => {\n console.log("Connected");\n // Subscribe to channel\n ws.send(JSON.stringify(${indent(subscribeMsgStr, ' ')}));\n};\n\n`;
2346
- out += `ws.onmessage = (event) => {\n const msg = JSON.parse(event.data);\n console.log("Received:", msg);\n`;
2347
- if (publishMsg)
2348
- out += `\n // After subscribed, you can publish:\n // ws.send(JSON.stringify(${JSON.stringify(publishMsg)}));\n`;
2349
- out += `};\n\nws.onclose = () => {\n console.log("Disconnected");\n};`;
2350
- return out;
2351
- }
2352
- case 'recker': {
2353
- let out = `import { ws } from "recker";\n\n`;
2354
- out += needsAuth
2355
- ? `const socket = await ws("${url}", {\n query: { token: "YOUR_TOKEN" }\n});\n\n`
2356
- : `const socket = await ws("${url}");\n\n`;
2357
- out += `// Subscribe to channel\nsocket.send(${indent(subscribeMsgStr, ' ')});\n\n`;
2358
- out += `// Listen for messages\nsocket.on("message", (data) => {\n console.log("Received:", data);\n});\n`;
2359
- if (publishMsg)
2360
- out += `\n// Publish a message\n// socket.send(${JSON.stringify(publishMsg)});\n`;
2361
- return out;
2362
- }
2363
- case 'python': {
2364
- let out = `import asyncio\nimport websockets\nimport json\n\n`;
2365
- out += `async def connect():\n async with websockets.connect("${authUrl}") as ws:\n`;
2366
- out += ` # Subscribe to channel\n await ws.send(json.dumps(${indent(subscribeMsgStr, ' ')}))\n \n`;
2367
- out += ` # Wait for messages\n async for message in ws:\n data = json.loads(message)\n print(f"Received: {data}")\n\n`;
2368
- out += `asyncio.run(connect())`;
2369
- return out;
2370
- }
2371
- default:
2372
- return '// Not implemented';
2373
- }
2374
- }
2375
- // Multi-language client snippets for SSE / EventSource streams.
2376
- function generateStreamCodeSample(lang, url) {
2377
- switch (lang) {
2378
- case 'curl':
2379
- return `curl -N "${url}"\n\n# -N disables buffering for streaming output`;
2380
- case 'eventsource':
2381
- return `const eventSource = new EventSource("${url}");\n\neventSource.onmessage = (event) => {\n console.log("Received:", event.data);\n};\n\neventSource.onerror = (error) => {\n console.error("Error:", error);\n eventSource.close();\n};\n\n// To close the connection:\n// eventSource.close();`;
2382
- case 'recker':
2383
- return `import { sse } from "recker";\n\nconst stream = sse("${url}");\n\nfor await (const event of stream) {\n console.log("Received:", event.data);\n}`;
2384
- case 'python':
2385
- return `import sseclient\nimport requests\n\nresponse = requests.get("${url}", stream=True)\nclient = sseclient.SSEClient(response)\n\nfor event in client.events():\n print(f"Event: {event.event}, Data: {event.data}")`;
2386
- default:
2387
- return '// Not implemented';
2388
- }
2389
- }
2390
- // Tabbed client-code panel for the non-HTTP protocols that carry a live console
2391
- // (WebSocket, streams). Mirrors renderCodeExamples' markup so the shared code
2392
- // tab / copy styling applies.
2393
- function renderProtocolCodeSamples(kind, endpoint, data) {
2394
- const base = String(spec.servers?.[0]?.url ?? 'http://localhost:3000').replace(/\/$/, '');
2395
- const isWs = kind === 'websocket';
2396
- const url = isWs
2397
- ? `${base.replace(/^http/, 'ws')}${wsSpec.path ?? '/ws'}`
2398
- : `${base}/${streamsSpec.pathPrefix ?? 'streams'}/${endpoint.path}`.replace(/([^:]\/)\/+/g, '$1');
2399
- const langs = isWs
2400
- ? [['wscat', 'wscat', 'bash'], ['javascript', 'WebSocket', 'javascript'], ['recker', 'Recker', 'typescript'], ['python', 'Python', 'python']]
2401
- : [['curl', 'cURL', 'bash'], ['eventsource', 'EventSource', 'javascript'], ['recker', 'Recker', 'typescript'], ['python', 'Python', 'python']];
2402
- const section = doc.createElement('div');
2403
- section.className = 'endpoint-subsection';
2404
- section.innerHTML = '<div class="subsection-label">Client examples</div>';
2405
- const wrap = doc.createElement('div');
2406
- wrap.className = 'http-code-samples';
2407
- const tabs = doc.createElement('div');
2408
- tabs.className = 'code-tabs';
2409
- const contents = doc.createElement('div');
2410
- contents.className = 'code-contents';
2411
- langs.forEach(([key, label, language], index) => {
2412
- const tab = doc.createElement('button');
2413
- tab.type = 'button';
2414
- tab.className = `code-tab${index === 0 ? ' active' : ''}`;
2415
- tab.textContent = label;
2416
- const content = doc.createElement('div');
2417
- content.className = `code-content${index === 0 ? ' active' : ''}`;
2418
- const pre = doc.createElement('pre');
2419
- pre.className = 'http-code-sample-pre';
2420
- pre.setAttribute('data-code-toolbar', 'managed');
2421
- const code = doc.createElement('code');
2422
- code.className = `language-${language}`;
2423
- code.textContent = isWs
2424
- ? generateWsCodeSample(key, url, endpoint.path, data)
2425
- : generateStreamCodeSample(key, url);
2426
- pre.appendChild(code);
2427
- content.appendChild(pre);
2428
- tab.onclick = () => {
2429
- tabs.querySelectorAll('.code-tab').forEach((t) => t.classList.remove('active'));
2430
- contents.querySelectorAll('.code-content').forEach((c) => c.classList.remove('active'));
2431
- tab.classList.add('active');
2432
- content.classList.add('active');
2433
- };
2434
- tabs.appendChild(tab);
2435
- contents.appendChild(content);
2436
- });
2437
- const copy = createSampleCopyButton('http-code-copy', () => {
2438
- const active = contents.querySelector('.code-content.active pre');
2439
- return active?.textContent ?? '';
2440
- });
2441
- tabs.appendChild(copy);
2442
- wrap.appendChild(tabs);
2443
- wrap.appendChild(contents);
2444
- section.appendChild(wrap);
2445
- return section;
2446
- }
2447
2290
  function renderEndpointDetails(endpoint) {
2448
2291
  const container = doc.createElement('div');
2449
2292
  container.className = 'endpoint-details';
2450
2293
  const data = (endpoint.data ?? {});
2451
- appendProtocolConsole(container, { doc, spec, wsSpec, streamsSpec, jsonrpcSpec, activeProtocol, endpoint, data, esc, escapeAttr, tryItConfig });
2294
+ appendProtocolConsole(container, { doc, spec, wsSpec, streamsSpec, jsonrpcSpec, activeProtocol, endpoint, data, esc, escapeAttr });
2452
2295
  const appendMany = (items) => items.forEach(([title, value]) => appendSchemaSubsection(container, title, value));
2453
2296
  if (activeProtocol === 'http') {
2454
2297
  // Two-column operation layout (ReDoc-style): the left column carries the
@@ -2574,9 +2417,6 @@ function renderEndpointDetails(endpoint) {
2574
2417
  if (activeProtocol === 'websocket') {
2575
2418
  appendInfoGrid(container, [['Channel Type', data.type], ['Path', endpoint.path]]);
2576
2419
  appendMany([['Parameters', parameterMapToSchema(data.parameters)], ['Subscribe Message', resolveMessagePayload(data.subscribe?.message)], ['Publish Message', resolveMessagePayload(data.publish?.message)]]);
2577
- appendContentTypesSection(container, 'Subscribe Content Types', resolveEffectiveContentTypes(data.subscribe?.contentTypes, wsSpec?.contentTypes));
2578
- appendContentTypesSection(container, 'Publish Content Types', resolveEffectiveContentTypes(data.publish?.contentTypes, wsSpec?.contentTypes));
2579
- container.appendChild(renderProtocolCodeSamples('websocket', endpoint, data));
2580
2420
  }
2581
2421
  if (activeProtocol === 'graphql') {
2582
2422
  appendInfoGrid(container, [['Endpoint', graphqlSpec.endpoint], ['Kind', data.kind], ['Resource', data.resource ?? data.name], ['Source', data.source]]);
@@ -2593,29 +2433,23 @@ function renderEndpointDetails(endpoint) {
2593
2433
  ]);
2594
2434
  appendStreamProjectionDiagnostics(container, resumable?.projections);
2595
2435
  appendMany([['Parameters', parameterMapToSchema(data.parameters)], ['Message Schema', resolveMessagePayload(data.message)]]);
2596
- appendContentTypesSection(container, 'Content Types', resolveEffectiveContentTypes(data.contentTypes, streamsSpec?.contentTypes));
2597
- container.appendChild(renderProtocolCodeSamples('streams', endpoint, data));
2598
2436
  }
2599
2437
  if (activeProtocol === 'jsonrpc') {
2600
2438
  appendInfoGrid(container, [['Method', endpoint.path], ['Notification', data['x-usd-notification'] === true ? 'yes' : undefined], ['Streaming', data['x-usd-streaming'] === true ? 'yes' : undefined]]);
2601
2439
  appendMany([['Parameters', data.params], ['Result', data.result], ['Errors', data.errors]]);
2602
- appendContentTypesSection(container, 'Content Types', resolveEffectiveContentTypes(data.contentTypes, jsonrpcSpec?.contentTypes));
2603
2440
  }
2604
2441
  if (activeProtocol === 'grpc') {
2605
2442
  const method = data.method ?? {};
2606
2443
  appendInfoGrid(container, [['Service', data.serviceName], ['Method', data.methodName], ['Type', getGrpcMethodType(method).replace(/_/g, ' ')]]);
2607
2444
  appendMany([['Request', method.input], ['Response', method.output]]);
2608
- appendContentTypesSection(container, 'Content Types', resolveEffectiveContentTypes(method.contentTypes, grpcSpec?.contentTypes));
2609
2445
  }
2610
2446
  if (activeProtocol === 'tcp') {
2611
2447
  appendInfoGrid(container, [['Host', data.host ?? 'localhost'], ['Port', data.port], ['TLS', data.tls?.enabled === true ? 'enabled' : undefined]]);
2612
2448
  appendMany([['Framing', data.framing], ['Inbound Message', resolveMessagePayload(data.messages?.inbound)], ['Outbound Message', resolveMessagePayload(data.messages?.outbound)]]);
2613
- appendContentTypesSection(container, 'Content Types', resolveEffectiveContentTypes(data.contentTypes, tcpSpec?.contentTypes));
2614
2449
  }
2615
2450
  if (activeProtocol === 'udp') {
2616
2451
  appendInfoGrid(container, [['Host', data.host ?? '127.0.0.1'], ['Port', data.port], ['Max Packet', data.maxPacketSize ? `${data.maxPacketSize} bytes` : undefined]]);
2617
2452
  appendMany([['Inbound Message', resolveMessagePayload(data.messages?.inbound)], ['Outbound Message', resolveMessagePayload(data.messages?.outbound)], ['Message Schema', resolveMessagePayload(data.message)]]);
2618
- appendContentTypesSection(container, 'Content Types', resolveEffectiveContentTypes(data.contentTypes, udpSpec?.contentTypes));
2619
2453
  }
2620
2454
  return container;
2621
2455
  }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Embedded docs UI client script chunk.
3
+ */
4
+ export declare const cardsAndCodeClientScript = " function createEndpointCard(ep) {\n const section = document.createElement('div');\n section.className = 'endpoint-section';\n section.id = ep.id;\n\n // Header with method + path\n const header = document.createElement('div');\n header.className = 'endpoint-header';\n\n const methodPath = document.createElement('div');\n methodPath.className = 'endpoint-method-path';\n\n const badge = document.createElement('span');\n badge.className = 'badge badge-' + ep.method.toLowerCase();\n badge.textContent = ep.method;\n\n const path = document.createElement('span');\n path.className = 'endpoint-path';\n path.textContent = ep.path;\n\n methodPath.appendChild(badge);\n methodPath.appendChild(path);\n header.appendChild(methodPath);\n\n section.appendChild(header);\n\n // Title (operation summary)\n if (ep.summary) {\n const title = document.createElement('h3');\n title.className = 'endpoint-title';\n title.textContent = ep.summary;\n section.appendChild(title);\n }\n\n // Description if available (rendered as markdown)\n const opData = ep.data;\n if (opData?.description && opData.description !== ep.summary) {\n const desc = document.createElement('div');\n desc.className = 'endpoint-description markdown-content';\n desc.innerHTML = parseMarkdown(opData.description);\n section.appendChild(desc);\n }\n\n // Two-column content layout\n const content = document.createElement('div');\n content.className = 'endpoint-content';\n\n const leftCol = document.createElement('div');\n leftCol.className = 'endpoint-left';\n\n const rightCol = document.createElement('div');\n rightCol.className = 'endpoint-right';\n\n // Render details into left column\n leftCol.appendChild(renderEndpointDetails(ep));\n\n // Render right column content (Request + Response samples)\n rightCol.appendChild(renderRightPanelContent(ep));\n\n content.appendChild(leftCol);\n content.appendChild(rightCol);\n section.appendChild(content);\n\n return section;\n }\n\n // ========== RIGHT PANEL CONTENT (Request + Response Samples) ==========\n\n function renderRightPanelContent(ep) {\n const container = document.createElement('div');\n container.className = 'right-panel-content';\n\n if (activeProtocol === 'http') {\n // Try It Out section\n const tryItSection = document.createElement('div');\n tryItSection.className = 'right-section try-it-section';\n tryItSection.appendChild(renderTryItOut(ep));\n container.appendChild(tryItSection);\n\n // Request section\n const requestSection = document.createElement('div');\n requestSection.className = 'right-section request-section';\n\n const requestHeader = document.createElement('div');\n requestHeader.className = 'right-section-header';\n requestHeader.textContent = 'Request samples';\n requestSection.appendChild(requestHeader);\n\n // Add curl example\n requestSection.appendChild(renderCodeExample(ep));\n container.appendChild(requestSection);\n\n // Response samples section\n const data = ep.data || {};\n const responses = data.responses || {};\n const statusCodes = Object.keys(responses).sort();\n\n if (statusCodes.length > 0) {\n const responseSection = document.createElement('div');\n responseSection.className = 'right-section response-samples-section';\n\n const responseHeader = document.createElement('div');\n responseHeader.className = 'right-section-header';\n responseHeader.textContent = 'Response samples';\n responseSection.appendChild(responseHeader);\n\n // Tabs for status codes\n const tabsContainer = document.createElement('div');\n tabsContainer.className = 'sample-tabs';\n\n const contentContainer = document.createElement('div');\n contentContainer.className = 'sample-contents';\n\n statusCodes.forEach((status, idx) => {\n // Tab button\n const tab = document.createElement('button');\n tab.className = 'sample-tab' + (idx === 0 ? ' active' : '');\n const statusClass = status.startsWith('2') ? 'status-2xx' :\n status.startsWith('4') ? 'status-4xx' :\n status.startsWith('5') ? 'status-5xx' : '';\n tab.innerHTML = '<span class=\"tab-status ' + statusClass + '\">' + esc(status) + '</span>';\n tab.onclick = () => {\n // Remove active from all tabs\n tabsContainer.querySelectorAll('.sample-tab').forEach(t => t.classList.remove('active'));\n tab.classList.add('active');\n // Show corresponding content\n contentContainer.querySelectorAll('.sample-content').forEach((c, i) => {\n c.style.display = i === idx ? 'block' : 'none';\n });\n };\n tabsContainer.appendChild(tab);\n\n // Content for this status\n const content = document.createElement('div');\n content.className = 'sample-content';\n content.style.display = idx === 0 ? 'block' : 'none';\n\n const response = responses[status];\n const respContent = response.content || {};\n const contentType = Object.keys(respContent)[0];\n\n if (contentType && respContent[contentType]) {\n const mediaType = respContent[contentType];\n let example = null;\n\n // Try to get example from various places\n if (mediaType.example) {\n example = mediaType.example;\n } else if (mediaType.examples) {\n const firstExKey = Object.keys(mediaType.examples)[0];\n if (firstExKey && mediaType.examples[firstExKey]) {\n example = mediaType.examples[firstExKey].value;\n }\n } else if (mediaType.schema) {\n // Build example from schema\n example = buildExampleFromSchema(mediaType.schema);\n }\n\n if (example !== null) {\n const pre = document.createElement('pre');\n pre.className = 'sample-json';\n const code = document.createElement('code');\n code.innerHTML = syntaxHighlightJSON(JSON.stringify(example, null, 2));\n pre.appendChild(code);\n content.appendChild(pre);\n } else {\n const noExample = document.createElement('div');\n noExample.className = 'no-example';\n noExample.textContent = 'No example available';\n content.appendChild(noExample);\n }\n } else {\n // No content, just description\n const desc = document.createElement('div');\n desc.className = 'response-desc-only';\n desc.textContent = response.description || 'No content';\n content.appendChild(desc);\n }\n\n contentContainer.appendChild(content);\n });\n\n responseSection.appendChild(tabsContainer);\n responseSection.appendChild(contentContainer);\n container.appendChild(responseSection);\n }\n } else if (activeProtocol === 'websocket') {\n // WebSocket Try It Out\n const tryItSection = document.createElement('div');\n tryItSection.className = 'right-section try-it-section';\n tryItSection.appendChild(renderTryItOutWebSocket(ep));\n container.appendChild(tryItSection);\n\n // Request samples (wscat)\n const requestSection = document.createElement('div');\n requestSection.className = 'right-section request-section';\n const requestHeader = document.createElement('div');\n requestHeader.className = 'right-section-header';\n requestHeader.textContent = 'Request samples';\n requestSection.appendChild(requestHeader);\n requestSection.appendChild(renderCodeExampleWebSocket(ep));\n container.appendChild(requestSection);\n } else if (activeProtocol === 'streams') {\n // Streams (SSE) Try It Out\n const tryItSection = document.createElement('div');\n tryItSection.className = 'right-section try-it-section';\n tryItSection.appendChild(renderTryItOutStreams(ep));\n container.appendChild(tryItSection);\n\n // Request samples (curl, EventSource)\n const requestSection = document.createElement('div');\n requestSection.className = 'right-section request-section';\n const requestHeader = document.createElement('div');\n requestHeader.className = 'right-section-header';\n requestHeader.textContent = 'Request samples';\n requestSection.appendChild(requestHeader);\n requestSection.appendChild(renderCodeExampleStreams(ep));\n container.appendChild(requestSection);\n } else {\n // For other protocols, just show basic code example\n container.appendChild(renderCodeExample(ep));\n }\n\n return container;\n }\n\n // WebSocket code examples (wscat, etc.)\n function renderCodeExampleWebSocket(ep) {\n const container = document.createElement('div');\n container.className = 'code-example';\n\n const baseUrl = (spec.servers && spec.servers[0]?.url) || 'http://localhost:3000';\n // WebSocket URL uses the ws:// scheme and the configured WebSocket path (default: /ws)\n const wsPath = wsSpec?.path || '/ws';\n const wsUrl = baseUrl.replace(/^http/, 'ws') + wsPath;\n\n // Language tabs\n const languages = ['wscat', 'javascript', 'recker', 'python'];\n const tabs = document.createElement('div');\n tabs.className = 'code-tabs';\n\n const contents = document.createElement('div');\n contents.className = 'code-contents';\n\n const langLabels = {\n wscat: 'wscat',\n javascript: 'WebSocket',\n recker: 'Recker',\n python: 'Python'\n };\n\n languages.forEach((lang, i) => {\n // Tab button\n const tab = document.createElement('button');\n tab.className = 'code-tab' + (i === 0 ? ' active' : '');\n tab.textContent = langLabels[lang] || lang;\n tab.onclick = () => {\n tabs.querySelectorAll('.code-tab').forEach(t => t.classList.remove('active'));\n tab.classList.add('active');\n contents.querySelectorAll('.code-content').forEach(c => c.classList.remove('active'));\n contents.querySelector('.code-content[data-lang=\"' + lang + '\"]').classList.add('active');\n };\n tabs.appendChild(tab);\n\n // Content\n const content = document.createElement('div');\n content.className = 'code-content' + (i === 0 ? ' active' : '');\n content.setAttribute('data-lang', lang);\n\n const pre = document.createElement('pre');\n const code = document.createElement('code');\n code.textContent = generateWsCodeSample(lang, wsUrl, ep);\n pre.appendChild(code);\n content.appendChild(pre);\n contents.appendChild(content);\n });\n\n container.appendChild(tabs);\n container.appendChild(contents);\n\n return container;\n }\n\n function generateWsCodeSample(lang, url, ep) {\n const channelName = ep.path;\n const channelType = ep.data?.type || 'public';\n\n // Build subscribe message\n const subscribeMsg = { type: 'subscribe', channel: channelName, id: '1' };\n const subscribeMsgStr = JSON.stringify(subscribeMsg, null, 2);\n\n // Build example publish message if channel supports it\n let publishMsg = null;\n if (ep.data?.publish?.message?.payload) {\n const payload = buildExampleFromSchema(ep.data.publish.message.payload);\n publishMsg = { type: 'publish', channel: channelName, event: 'message', data: payload, id: '2' };\n }\n const publishMsgStr = publishMsg ? JSON.stringify(publishMsg, null, 2) : null;\n\n // For private/presence channels, add token to URL\n const needsAuth = channelType === 'private' || channelType === 'presence';\n const authUrl = needsAuth ? url + '?token=YOUR_TOKEN' : url;\n\n switch (lang) {\n case 'wscat':\n let wscatCode = 'wscat -c \"' + authUrl + '\"\\\\n\\\\n';\n wscatCode += '# Subscribe to channel:\\\\n> ' + JSON.stringify(subscribeMsg);\n if (publishMsgStr) {\n wscatCode += '\\\\n\\\\n# Publish a message:\\\\n> ' + JSON.stringify(publishMsg);\n }\n return wscatCode;\n\n case 'javascript':\n let jsCode = 'const ws = new WebSocket(\"' + authUrl + '\");\\\\n\\\\n';\n jsCode += 'ws.onopen = () => {\\\\n';\n jsCode += ' console.log(\"Connected\");\\\\n';\n jsCode += ' // Subscribe to channel\\\\n';\n jsCode += ' ws.send(JSON.stringify(' + subscribeMsgStr.split('\\\\n').map((l, i) => i === 0 ? l : ' ' + l).join('\\\\n') + '));\\\\n';\n jsCode += '};\\\\n\\\\n';\n jsCode += 'ws.onmessage = (event) => {\\\\n';\n jsCode += ' const msg = JSON.parse(event.data);\\\\n';\n jsCode += ' console.log(\"Received:\", msg);\\\\n';\n if (publishMsgStr) {\n jsCode += '\\\\n // After subscribed, you can publish:\\\\n';\n jsCode += ' // ws.send(JSON.stringify(' + JSON.stringify(publishMsg) + '));\\\\n';\n }\n jsCode += '};\\\\n\\\\n';\n jsCode += 'ws.onclose = () => {\\\\n';\n jsCode += ' console.log(\"Disconnected\");\\\\n';\n jsCode += '};';\n return jsCode;\n\n case 'recker':\n let reckerCode = 'import { ws } from \"recker\";\\\\n\\\\n';\n if (needsAuth) {\n reckerCode += 'const socket = await ws(\"' + url + '\", {\\\\n';\n reckerCode += ' query: { token: \"YOUR_TOKEN\" }\\\\n';\n reckerCode += '});\\\\n\\\\n';\n } else {\n reckerCode += 'const socket = await ws(\"' + url + '\");\\\\n\\\\n';\n }\n reckerCode += '// Subscribe to channel\\\\n';\n reckerCode += 'socket.send(' + subscribeMsgStr.split('\\\\n').map((l, i) => i === 0 ? l : ' ' + l).join('\\\\n') + ');\\\\n\\\\n';\n reckerCode += '// Listen for messages\\\\n';\n reckerCode += 'socket.on(\"message\", (data) => {\\\\n';\n reckerCode += ' console.log(\"Received:\", data);\\\\n';\n reckerCode += '});\\\\n';\n if (publishMsgStr) {\n reckerCode += '\\\\n// Publish a message\\\\n';\n reckerCode += '// socket.send(' + JSON.stringify(publishMsg) + ');\\\\n';\n }\n return reckerCode;\n\n case 'python':\n let pyCode = 'import asyncio\\\\n';\n pyCode += 'import websockets\\\\n';\n pyCode += 'import json\\\\n\\\\n';\n pyCode += 'async def connect():\\\\n';\n pyCode += ' async with websockets.connect(\"' + authUrl + '\") as ws:\\\\n';\n pyCode += ' # Subscribe to channel\\\\n';\n pyCode += ' await ws.send(json.dumps(' + subscribeMsgStr.split('\\\\n').map((l, i) => i === 0 ? l : ' ' + l).join('\\\\n') + '))\\\\n';\n pyCode += ' \\\\n';\n pyCode += ' # Wait for messages\\\\n';\n pyCode += ' async for message in ws:\\\\n';\n pyCode += ' data = json.loads(message)\\\\n';\n pyCode += ' print(f\"Received: {data}\")\\\\n\\\\n';\n pyCode += 'asyncio.run(connect())';\n return pyCode;\n\n default:\n return '// Not implemented';\n }\n }\n\n // Streams (SSE) code examples\n function renderCodeExampleStreams(ep) {\n const container = document.createElement('div');\n container.className = 'code-example';\n\n const baseUrl = (spec.servers && spec.servers[0]?.url) || 'http://localhost:3000';\n // SSE streams are accessed via GET /streams/<procedure-name>\n const streamUrl = baseUrl + '/streams/' + ep.path;\n\n // Language tabs\n const languages = ['curl', 'eventsource', 'recker', 'python'];\n const tabs = document.createElement('div');\n tabs.className = 'code-tabs';\n\n const contents = document.createElement('div');\n contents.className = 'code-contents';\n\n const langLabels = {\n curl: 'cURL',\n eventsource: 'EventSource',\n recker: 'Recker',\n python: 'Python'\n };\n\n languages.forEach((lang, i) => {\n // Tab button\n const tab = document.createElement('button');\n tab.className = 'code-tab' + (i === 0 ? ' active' : '');\n tab.textContent = langLabels[lang] || lang;\n tab.onclick = () => {\n tabs.querySelectorAll('.code-tab').forEach(t => t.classList.remove('active'));\n tab.classList.add('active');\n contents.querySelectorAll('.code-content').forEach(c => c.classList.remove('active'));\n contents.querySelector('.code-content[data-lang=\"' + lang + '\"]').classList.add('active');\n };\n tabs.appendChild(tab);\n\n // Content\n const content = document.createElement('div');\n content.className = 'code-content' + (i === 0 ? ' active' : '');\n content.setAttribute('data-lang', lang);\n\n const pre = document.createElement('pre');\n const code = document.createElement('code');\n code.textContent = generateStreamCodeSample(lang, streamUrl, ep);\n pre.appendChild(code);\n content.appendChild(pre);\n contents.appendChild(content);\n });\n\n container.appendChild(tabs);\n container.appendChild(contents);\n\n return container;\n }\n\n function generateStreamCodeSample(lang, url, ep) {\n switch (lang) {\n case 'curl':\n return 'curl -N \"' + url + '\"\\\\n\\\\n# -N disables buffering for streaming output';\n\n case 'eventsource':\n return 'const eventSource = new EventSource(\"' + url + '\");\\\\n\\\\n' +\n 'eventSource.onmessage = (event) => {\\\\n' +\n ' console.log(\"Received:\", event.data);\\\\n' +\n '};\\\\n\\\\n' +\n 'eventSource.onerror = (error) => {\\\\n' +\n ' console.error(\"Error:\", error);\\\\n' +\n ' eventSource.close();\\\\n' +\n '};\\\\n\\\\n' +\n '// To close the connection:\\\\n' +\n '// eventSource.close();';\n\n case 'recker':\n return 'import { sse } from \"recker\";\\\\n\\\\n' +\n 'const stream = sse(\"' + url + '\");\\\\n\\\\n' +\n 'for await (const event of stream) {\\\\n' +\n ' console.log(\"Received:\", event.data);\\\\n' +\n '}';\n\n case 'python':\n return 'import sseclient\\\\n' +\n 'import requests\\\\n\\\\n' +\n 'response = requests.get(\"' + url + '\", stream=True)\\\\n' +\n 'client = sseclient.SSEClient(response)\\\\n\\\\n' +\n 'for event in client.events():\\\\n' +\n ' print(f\"Event: {event.event}, Data: {event.data}\")';\n\n default:\n return '// Not implemented';\n }\n }\n\n // JSON syntax highlighting\n function syntaxHighlightJSON(json) {\n return json\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n .replace(/(\"(\\\\\\\\u[a-zA-Z0-9]{4}|\\\\\\\\[^u]|[^\\\\\\\\\"])*\"(\\\\s*:)?)/g, function(match) {\n let cls = 'json-string';\n if (/:$/.test(match)) {\n cls = 'json-key';\n match = match.replace(/:$/, '') + ':';\n }\n return '<span class=\"' + cls + '\">' + match + '</span>';\n })\n .replace(/\\\\b(true|false|null)\\\\b/g, '<span class=\"json-boolean\">$1</span>')\n .replace(/\\\\b(-?\\\\d+\\\\.?\\\\d*)\\\\b/g, '<span class=\"json-number\">$1</span>');\n }\n\n function renderCodeExample(ep) {\n const container = document.createElement('div');\n container.className = 'code-example';\n\n // Build request details\n const method = ep.method.toUpperCase();\n const path = ep.path;\n const baseUrl = (spec.servers && spec.servers[0]?.url) || 'http://localhost:3000';\n\n // Handle JSON-RPC methods specially\n const isJsonRpc = method === 'RPC';\n let fullUrl;\n let exampleBody = null;\n let actualMethod = method;\n\n if (isJsonRpc) {\n // For JSON-RPC, use the /rpc endpoint and POST method\n const rpcEndpoint = jsonrpcSpec?.endpoint || '/rpc';\n fullUrl = baseUrl + rpcEndpoint;\n actualMethod = 'POST';\n\n // Build JSON-RPC request body\n const opData = ep.data;\n let params = {};\n if (opData && opData.params) {\n params = buildExampleFromSchema(opData.params);\n }\n exampleBody = {\n jsonrpc: '2.0',\n method: path, // The method name like \"tasks.list\"\n params: params,\n id: 1\n };\n } else {\n // Ensure path has leading slash for proper URL construction\n const normalizedPath = path.startsWith('/') ? path : '/' + path;\n fullUrl = baseUrl + normalizedPath;\n\n // Get request body if exists\n const opData = ep.data;\n if (opData && opData.requestBody && opData.requestBody.content) {\n const jsonContent = opData.requestBody.content['application/json'];\n if (jsonContent && jsonContent.schema) {\n exampleBody = buildExampleFromSchema(jsonContent.schema);\n }\n }\n }\n\n // Language tabs\n const languages = ['curl', 'fetch', 'recker', 'python', 'go'];\n const tabs = document.createElement('div');\n tabs.className = 'code-tabs';\n\n const contents = document.createElement('div');\n contents.className = 'code-contents';\n\n const langLabels = {\n curl: 'cURL',\n fetch: 'Fetch',\n recker: 'Recker',\n python: 'Python',\n go: 'Go'\n };\n\n languages.forEach((lang, i) => {\n // Tab button\n const tab = document.createElement('button');\n tab.className = 'code-tab' + (i === 0 ? ' active' : '');\n tab.textContent = langLabels[lang] || lang;\n tab.onclick = () => {\n tabs.querySelectorAll('.code-tab').forEach(t => t.classList.remove('active'));\n tab.classList.add('active');\n contents.querySelectorAll('.code-content').forEach(c => c.classList.remove('active'));\n contents.querySelector('.code-content[data-lang=\"' + lang + '\"]').classList.add('active');\n };\n tabs.appendChild(tab);\n\n // Content\n const content = document.createElement('div');\n content.className = 'code-content' + (i === 0 ? ' active' : '');\n content.setAttribute('data-lang', lang);\n\n const pre = document.createElement('pre');\n const code = document.createElement('code');\n code.textContent = generateCodeSample(lang, actualMethod, fullUrl, exampleBody);\n pre.appendChild(code);\n content.appendChild(pre);\n contents.appendChild(content);\n });\n\n container.appendChild(tabs);\n container.appendChild(contents);\n\n return container;\n }\n\n function generateCodeSample(lang, method, url, body) {\n const hasBody = body && ['POST', 'PUT', 'PATCH'].includes(method);\n const bodyStr = body ? JSON.stringify(body, null, 2) : '';\n\n switch (lang) {\n case 'curl':\n const curlLines = [];\n curlLines.push('curl' + (method !== 'GET' ? ' -X ' + method : ''));\n curlLines.push(' \"' + url + '\"');\n if (hasBody) {\n curlLines.push(' -H \"Content-Type: application/json\"');\n curlLines.push(\" -d '\" + bodyStr + \"'\");\n }\n return curlLines.join(' \\\\\\\\\\\\n');\n\n case 'fetch':\n if (hasBody) {\n return 'const response = await fetch(\"' + url + '\", {\\\\n' +\n ' method: \"' + method + '\",\\\\n' +\n ' headers: {\\\\n' +\n ' \"Content-Type\": \"application/json\",\\\\n' +\n ' },\\\\n' +\n ' body: JSON.stringify(' + bodyStr.split('\\\\n').map((l, i) => i === 0 ? l : ' ' + l).join('\\\\n') + '),\\\\n' +\n '});\\\\n\\\\n' +\n 'const data = await response.json();\\\\n' +\n 'console.log(data);';\n }\n return 'const response = await fetch(\"' + url + '\"' +\n (method !== 'GET' ? ', {\\\\n method: \"' + method + '\",\\\\n}' : '') + ');\\\\n\\\\n' +\n 'const data = await response.json();\\\\n' +\n 'console.log(data);';\n\n case 'recker':\n if (hasBody) {\n return 'import { ' + method.toLowerCase() + ' } from \"recker\";\\\\n\\\\n' +\n 'const data = await ' + method.toLowerCase() + '(\"' + url + '\")\\\\n' +\n ' .json(' + bodyStr.split('\\\\n').map((l, i) => i === 0 ? l : ' ' + l).join('\\\\n') + ')\\\\n' +\n ' .json();\\\\n\\\\n' +\n 'console.log(data);';\n }\n return 'import { ' + method.toLowerCase() + ' } from \"recker\";\\\\n\\\\n' +\n 'const data = await ' + method.toLowerCase() + '(\"' + url + '\").json();\\\\n\\\\n' +\n 'console.log(data);';\n\n case 'python':\n if (hasBody) {\n return 'import requests\\\\n\\\\n' +\n 'response = requests.' + method.toLowerCase() + '(\\\\n' +\n ' \"' + url + '\",\\\\n' +\n ' json=' + bodyStr.split('\\\\n').map((l, i) => i === 0 ? l : ' ' + l).join('\\\\n') + ',\\\\n' +\n ')\\\\n\\\\n' +\n 'print(response.json())';\n }\n return 'import requests\\\\n\\\\n' +\n 'response = requests.' + method.toLowerCase() + '(\"' + url + '\")\\\\n\\\\n' +\n 'print(response.json())';\n\n case 'go':\n if (hasBody) {\n return 'package main\\\\n\\\\n' +\n 'import (\\\\n' +\n ' \"bytes\"\\\\n' +\n ' \"encoding/json\"\\\\n' +\n ' \"fmt\"\\\\n' +\n ' \"net/http\"\\\\n' +\n ' \"io\"\\\\n' +\n ')\\\\n\\\\n' +\n 'func main() {\\\\n' +\n ' body, _ := json.Marshal(map[string]interface{}{\\\\n' +\n generateGoMapBody(body) +\n ' })\\\\n\\\\n' +\n ' req, _ := http.NewRequest(\"' + method + '\", \"' + url + '\", bytes.NewBuffer(body))\\\\n' +\n ' req.Header.Set(\"Content-Type\", \"application/json\")\\\\n\\\\n' +\n ' client := &http.Client{}\\\\n' +\n ' resp, _ := client.Do(req)\\\\n' +\n ' defer resp.Body.Close()\\\\n\\\\n' +\n ' data, _ := io.ReadAll(resp.Body)\\\\n' +\n ' fmt.Println(string(data))\\\\n' +\n '}';\n }\n return 'package main\\\\n\\\\n' +\n 'import (\\\\n' +\n ' \"fmt\"\\\\n' +\n ' \"net/http\"\\\\n' +\n ' \"io\"\\\\n' +\n ')\\\\n\\\\n' +\n 'func main() {\\\\n' +\n ' resp, _ := http.Get(\"' + url + '\")\\\\n' +\n ' defer resp.Body.Close()\\\\n\\\\n' +\n ' body, _ := io.ReadAll(resp.Body)\\\\n' +\n ' fmt.Println(string(body))\\\\n' +\n '}';\n\n default:\n return '// Not implemented';\n }\n }\n\n function generateGoMapBody(body) {\n if (!body || typeof body !== 'object') return '';\n const lines = [];\n for (const [key, value] of Object.entries(body)) {\n const goValue = typeof value === 'string' ? '\"' + value + '\"' :\n typeof value === 'number' ? String(value) :\n typeof value === 'boolean' ? String(value) :\n 'nil';\n lines.push(' \"' + key + '\": ' + goValue + ',');\n }\n return lines.join('\\\\n') + '\\\\n';\n }\n\n function buildExampleFromSchema(schema) {\n if (!schema) return null;\n\n // Resolve $ref\n if (schema.$ref) {\n const resolved = resolveRef(schema.$ref);\n return buildExampleFromSchema(resolved);\n }\n\n // Normalize non-standard format\n schema = normalizeSchema(schema);\n\n if (schema.example !== undefined) return schema.example;\n if (schema.default !== undefined) return schema.default;\n\n if (schema.type === 'object' && schema.properties) {\n const obj = {};\n for (const [key, prop] of Object.entries(schema.properties)) {\n obj[key] = buildExampleFromSchema(prop);\n }\n return obj;\n }\n\n if (schema.type === 'array' && schema.items) {\n return [buildExampleFromSchema(schema.items)];\n }\n\n // Primitive defaults\n switch (schema.type) {\n case 'string': return schema.format === 'email' ? 'user@example.com' : 'string';\n case 'number': return 0;\n case 'integer': return 0;\n case 'boolean': return true;\n default: return null;\n }\n }\n\n";
5
+ //# sourceMappingURL=cards-and-code.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cards-and-code.d.ts","sourceRoot":"","sources":["../../../../src/docs/ui/client-script/cards-and-code.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,eAAO,MAAM,wBAAwB,sx6BAAsx6B,CAAA"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Embedded docs UI client script chunk.
3
+ */
4
+ export const cardsAndCodeClientScript = " function createEndpointCard(ep) {\n const section = document.createElement('div');\n section.className = 'endpoint-section';\n section.id = ep.id;\n\n // Header with method + path\n const header = document.createElement('div');\n header.className = 'endpoint-header';\n\n const methodPath = document.createElement('div');\n methodPath.className = 'endpoint-method-path';\n\n const badge = document.createElement('span');\n badge.className = 'badge badge-' + ep.method.toLowerCase();\n badge.textContent = ep.method;\n\n const path = document.createElement('span');\n path.className = 'endpoint-path';\n path.textContent = ep.path;\n\n methodPath.appendChild(badge);\n methodPath.appendChild(path);\n header.appendChild(methodPath);\n\n section.appendChild(header);\n\n // Title (operation summary)\n if (ep.summary) {\n const title = document.createElement('h3');\n title.className = 'endpoint-title';\n title.textContent = ep.summary;\n section.appendChild(title);\n }\n\n // Description if available (rendered as markdown)\n const opData = ep.data;\n if (opData?.description && opData.description !== ep.summary) {\n const desc = document.createElement('div');\n desc.className = 'endpoint-description markdown-content';\n desc.innerHTML = parseMarkdown(opData.description);\n section.appendChild(desc);\n }\n\n // Two-column content layout\n const content = document.createElement('div');\n content.className = 'endpoint-content';\n\n const leftCol = document.createElement('div');\n leftCol.className = 'endpoint-left';\n\n const rightCol = document.createElement('div');\n rightCol.className = 'endpoint-right';\n\n // Render details into left column\n leftCol.appendChild(renderEndpointDetails(ep));\n\n // Render right column content (Request + Response samples)\n rightCol.appendChild(renderRightPanelContent(ep));\n\n content.appendChild(leftCol);\n content.appendChild(rightCol);\n section.appendChild(content);\n\n return section;\n }\n\n // ========== RIGHT PANEL CONTENT (Request + Response Samples) ==========\n\n function renderRightPanelContent(ep) {\n const container = document.createElement('div');\n container.className = 'right-panel-content';\n\n if (activeProtocol === 'http') {\n // Try It Out section\n const tryItSection = document.createElement('div');\n tryItSection.className = 'right-section try-it-section';\n tryItSection.appendChild(renderTryItOut(ep));\n container.appendChild(tryItSection);\n\n // Request section\n const requestSection = document.createElement('div');\n requestSection.className = 'right-section request-section';\n\n const requestHeader = document.createElement('div');\n requestHeader.className = 'right-section-header';\n requestHeader.textContent = 'Request samples';\n requestSection.appendChild(requestHeader);\n\n // Add curl example\n requestSection.appendChild(renderCodeExample(ep));\n container.appendChild(requestSection);\n\n // Response samples section\n const data = ep.data || {};\n const responses = data.responses || {};\n const statusCodes = Object.keys(responses).sort();\n\n if (statusCodes.length > 0) {\n const responseSection = document.createElement('div');\n responseSection.className = 'right-section response-samples-section';\n\n const responseHeader = document.createElement('div');\n responseHeader.className = 'right-section-header';\n responseHeader.textContent = 'Response samples';\n responseSection.appendChild(responseHeader);\n\n // Tabs for status codes\n const tabsContainer = document.createElement('div');\n tabsContainer.className = 'sample-tabs';\n\n const contentContainer = document.createElement('div');\n contentContainer.className = 'sample-contents';\n\n statusCodes.forEach((status, idx) => {\n // Tab button\n const tab = document.createElement('button');\n tab.className = 'sample-tab' + (idx === 0 ? ' active' : '');\n const statusClass = status.startsWith('2') ? 'status-2xx' :\n status.startsWith('4') ? 'status-4xx' :\n status.startsWith('5') ? 'status-5xx' : '';\n tab.innerHTML = '<span class=\"tab-status ' + statusClass + '\">' + esc(status) + '</span>';\n tab.onclick = () => {\n // Remove active from all tabs\n tabsContainer.querySelectorAll('.sample-tab').forEach(t => t.classList.remove('active'));\n tab.classList.add('active');\n // Show corresponding content\n contentContainer.querySelectorAll('.sample-content').forEach((c, i) => {\n c.style.display = i === idx ? 'block' : 'none';\n });\n };\n tabsContainer.appendChild(tab);\n\n // Content for this status\n const content = document.createElement('div');\n content.className = 'sample-content';\n content.style.display = idx === 0 ? 'block' : 'none';\n\n const response = responses[status];\n const respContent = response.content || {};\n const contentType = Object.keys(respContent)[0];\n\n if (contentType && respContent[contentType]) {\n const mediaType = respContent[contentType];\n let example = null;\n\n // Try to get example from various places\n if (mediaType.example) {\n example = mediaType.example;\n } else if (mediaType.examples) {\n const firstExKey = Object.keys(mediaType.examples)[0];\n if (firstExKey && mediaType.examples[firstExKey]) {\n example = mediaType.examples[firstExKey].value;\n }\n } else if (mediaType.schema) {\n // Build example from schema\n example = buildExampleFromSchema(mediaType.schema);\n }\n\n if (example !== null) {\n const pre = document.createElement('pre');\n pre.className = 'sample-json';\n const code = document.createElement('code');\n code.innerHTML = syntaxHighlightJSON(JSON.stringify(example, null, 2));\n pre.appendChild(code);\n content.appendChild(pre);\n } else {\n const noExample = document.createElement('div');\n noExample.className = 'no-example';\n noExample.textContent = 'No example available';\n content.appendChild(noExample);\n }\n } else {\n // No content, just description\n const desc = document.createElement('div');\n desc.className = 'response-desc-only';\n desc.textContent = response.description || 'No content';\n content.appendChild(desc);\n }\n\n contentContainer.appendChild(content);\n });\n\n responseSection.appendChild(tabsContainer);\n responseSection.appendChild(contentContainer);\n container.appendChild(responseSection);\n }\n } else if (activeProtocol === 'websocket') {\n // WebSocket Try It Out\n const tryItSection = document.createElement('div');\n tryItSection.className = 'right-section try-it-section';\n tryItSection.appendChild(renderTryItOutWebSocket(ep));\n container.appendChild(tryItSection);\n\n // Request samples (wscat)\n const requestSection = document.createElement('div');\n requestSection.className = 'right-section request-section';\n const requestHeader = document.createElement('div');\n requestHeader.className = 'right-section-header';\n requestHeader.textContent = 'Request samples';\n requestSection.appendChild(requestHeader);\n requestSection.appendChild(renderCodeExampleWebSocket(ep));\n container.appendChild(requestSection);\n } else if (activeProtocol === 'streams') {\n // Streams (SSE) Try It Out\n const tryItSection = document.createElement('div');\n tryItSection.className = 'right-section try-it-section';\n tryItSection.appendChild(renderTryItOutStreams(ep));\n container.appendChild(tryItSection);\n\n // Request samples (curl, EventSource)\n const requestSection = document.createElement('div');\n requestSection.className = 'right-section request-section';\n const requestHeader = document.createElement('div');\n requestHeader.className = 'right-section-header';\n requestHeader.textContent = 'Request samples';\n requestSection.appendChild(requestHeader);\n requestSection.appendChild(renderCodeExampleStreams(ep));\n container.appendChild(requestSection);\n } else {\n // For other protocols, just show basic code example\n container.appendChild(renderCodeExample(ep));\n }\n\n return container;\n }\n\n // WebSocket code examples (wscat, etc.)\n function renderCodeExampleWebSocket(ep) {\n const container = document.createElement('div');\n container.className = 'code-example';\n\n const baseUrl = (spec.servers && spec.servers[0]?.url) || 'http://localhost:3000';\n // WebSocket URL uses the ws:// scheme and the configured WebSocket path (default: /ws)\n const wsPath = wsSpec?.path || '/ws';\n const wsUrl = baseUrl.replace(/^http/, 'ws') + wsPath;\n\n // Language tabs\n const languages = ['wscat', 'javascript', 'recker', 'python'];\n const tabs = document.createElement('div');\n tabs.className = 'code-tabs';\n\n const contents = document.createElement('div');\n contents.className = 'code-contents';\n\n const langLabels = {\n wscat: 'wscat',\n javascript: 'WebSocket',\n recker: 'Recker',\n python: 'Python'\n };\n\n languages.forEach((lang, i) => {\n // Tab button\n const tab = document.createElement('button');\n tab.className = 'code-tab' + (i === 0 ? ' active' : '');\n tab.textContent = langLabels[lang] || lang;\n tab.onclick = () => {\n tabs.querySelectorAll('.code-tab').forEach(t => t.classList.remove('active'));\n tab.classList.add('active');\n contents.querySelectorAll('.code-content').forEach(c => c.classList.remove('active'));\n contents.querySelector('.code-content[data-lang=\"' + lang + '\"]').classList.add('active');\n };\n tabs.appendChild(tab);\n\n // Content\n const content = document.createElement('div');\n content.className = 'code-content' + (i === 0 ? ' active' : '');\n content.setAttribute('data-lang', lang);\n\n const pre = document.createElement('pre');\n const code = document.createElement('code');\n code.textContent = generateWsCodeSample(lang, wsUrl, ep);\n pre.appendChild(code);\n content.appendChild(pre);\n contents.appendChild(content);\n });\n\n container.appendChild(tabs);\n container.appendChild(contents);\n\n return container;\n }\n\n function generateWsCodeSample(lang, url, ep) {\n const channelName = ep.path;\n const channelType = ep.data?.type || 'public';\n\n // Build subscribe message\n const subscribeMsg = { type: 'subscribe', channel: channelName, id: '1' };\n const subscribeMsgStr = JSON.stringify(subscribeMsg, null, 2);\n\n // Build example publish message if channel supports it\n let publishMsg = null;\n if (ep.data?.publish?.message?.payload) {\n const payload = buildExampleFromSchema(ep.data.publish.message.payload);\n publishMsg = { type: 'publish', channel: channelName, event: 'message', data: payload, id: '2' };\n }\n const publishMsgStr = publishMsg ? JSON.stringify(publishMsg, null, 2) : null;\n\n // For private/presence channels, add token to URL\n const needsAuth = channelType === 'private' || channelType === 'presence';\n const authUrl = needsAuth ? url + '?token=YOUR_TOKEN' : url;\n\n switch (lang) {\n case 'wscat':\n let wscatCode = 'wscat -c \"' + authUrl + '\"\\\\n\\\\n';\n wscatCode += '# Subscribe to channel:\\\\n> ' + JSON.stringify(subscribeMsg);\n if (publishMsgStr) {\n wscatCode += '\\\\n\\\\n# Publish a message:\\\\n> ' + JSON.stringify(publishMsg);\n }\n return wscatCode;\n\n case 'javascript':\n let jsCode = 'const ws = new WebSocket(\"' + authUrl + '\");\\\\n\\\\n';\n jsCode += 'ws.onopen = () => {\\\\n';\n jsCode += ' console.log(\"Connected\");\\\\n';\n jsCode += ' // Subscribe to channel\\\\n';\n jsCode += ' ws.send(JSON.stringify(' + subscribeMsgStr.split('\\\\n').map((l, i) => i === 0 ? l : ' ' + l).join('\\\\n') + '));\\\\n';\n jsCode += '};\\\\n\\\\n';\n jsCode += 'ws.onmessage = (event) => {\\\\n';\n jsCode += ' const msg = JSON.parse(event.data);\\\\n';\n jsCode += ' console.log(\"Received:\", msg);\\\\n';\n if (publishMsgStr) {\n jsCode += '\\\\n // After subscribed, you can publish:\\\\n';\n jsCode += ' // ws.send(JSON.stringify(' + JSON.stringify(publishMsg) + '));\\\\n';\n }\n jsCode += '};\\\\n\\\\n';\n jsCode += 'ws.onclose = () => {\\\\n';\n jsCode += ' console.log(\"Disconnected\");\\\\n';\n jsCode += '};';\n return jsCode;\n\n case 'recker':\n let reckerCode = 'import { ws } from \"recker\";\\\\n\\\\n';\n if (needsAuth) {\n reckerCode += 'const socket = await ws(\"' + url + '\", {\\\\n';\n reckerCode += ' query: { token: \"YOUR_TOKEN\" }\\\\n';\n reckerCode += '});\\\\n\\\\n';\n } else {\n reckerCode += 'const socket = await ws(\"' + url + '\");\\\\n\\\\n';\n }\n reckerCode += '// Subscribe to channel\\\\n';\n reckerCode += 'socket.send(' + subscribeMsgStr.split('\\\\n').map((l, i) => i === 0 ? l : ' ' + l).join('\\\\n') + ');\\\\n\\\\n';\n reckerCode += '// Listen for messages\\\\n';\n reckerCode += 'socket.on(\"message\", (data) => {\\\\n';\n reckerCode += ' console.log(\"Received:\", data);\\\\n';\n reckerCode += '});\\\\n';\n if (publishMsgStr) {\n reckerCode += '\\\\n// Publish a message\\\\n';\n reckerCode += '// socket.send(' + JSON.stringify(publishMsg) + ');\\\\n';\n }\n return reckerCode;\n\n case 'python':\n let pyCode = 'import asyncio\\\\n';\n pyCode += 'import websockets\\\\n';\n pyCode += 'import json\\\\n\\\\n';\n pyCode += 'async def connect():\\\\n';\n pyCode += ' async with websockets.connect(\"' + authUrl + '\") as ws:\\\\n';\n pyCode += ' # Subscribe to channel\\\\n';\n pyCode += ' await ws.send(json.dumps(' + subscribeMsgStr.split('\\\\n').map((l, i) => i === 0 ? l : ' ' + l).join('\\\\n') + '))\\\\n';\n pyCode += ' \\\\n';\n pyCode += ' # Wait for messages\\\\n';\n pyCode += ' async for message in ws:\\\\n';\n pyCode += ' data = json.loads(message)\\\\n';\n pyCode += ' print(f\"Received: {data}\")\\\\n\\\\n';\n pyCode += 'asyncio.run(connect())';\n return pyCode;\n\n default:\n return '// Not implemented';\n }\n }\n\n // Streams (SSE) code examples\n function renderCodeExampleStreams(ep) {\n const container = document.createElement('div');\n container.className = 'code-example';\n\n const baseUrl = (spec.servers && spec.servers[0]?.url) || 'http://localhost:3000';\n // SSE streams are accessed via GET /streams/<procedure-name>\n const streamUrl = baseUrl + '/streams/' + ep.path;\n\n // Language tabs\n const languages = ['curl', 'eventsource', 'recker', 'python'];\n const tabs = document.createElement('div');\n tabs.className = 'code-tabs';\n\n const contents = document.createElement('div');\n contents.className = 'code-contents';\n\n const langLabels = {\n curl: 'cURL',\n eventsource: 'EventSource',\n recker: 'Recker',\n python: 'Python'\n };\n\n languages.forEach((lang, i) => {\n // Tab button\n const tab = document.createElement('button');\n tab.className = 'code-tab' + (i === 0 ? ' active' : '');\n tab.textContent = langLabels[lang] || lang;\n tab.onclick = () => {\n tabs.querySelectorAll('.code-tab').forEach(t => t.classList.remove('active'));\n tab.classList.add('active');\n contents.querySelectorAll('.code-content').forEach(c => c.classList.remove('active'));\n contents.querySelector('.code-content[data-lang=\"' + lang + '\"]').classList.add('active');\n };\n tabs.appendChild(tab);\n\n // Content\n const content = document.createElement('div');\n content.className = 'code-content' + (i === 0 ? ' active' : '');\n content.setAttribute('data-lang', lang);\n\n const pre = document.createElement('pre');\n const code = document.createElement('code');\n code.textContent = generateStreamCodeSample(lang, streamUrl, ep);\n pre.appendChild(code);\n content.appendChild(pre);\n contents.appendChild(content);\n });\n\n container.appendChild(tabs);\n container.appendChild(contents);\n\n return container;\n }\n\n function generateStreamCodeSample(lang, url, ep) {\n switch (lang) {\n case 'curl':\n return 'curl -N \"' + url + '\"\\\\n\\\\n# -N disables buffering for streaming output';\n\n case 'eventsource':\n return 'const eventSource = new EventSource(\"' + url + '\");\\\\n\\\\n' +\n 'eventSource.onmessage = (event) => {\\\\n' +\n ' console.log(\"Received:\", event.data);\\\\n' +\n '};\\\\n\\\\n' +\n 'eventSource.onerror = (error) => {\\\\n' +\n ' console.error(\"Error:\", error);\\\\n' +\n ' eventSource.close();\\\\n' +\n '};\\\\n\\\\n' +\n '// To close the connection:\\\\n' +\n '// eventSource.close();';\n\n case 'recker':\n return 'import { sse } from \"recker\";\\\\n\\\\n' +\n 'const stream = sse(\"' + url + '\");\\\\n\\\\n' +\n 'for await (const event of stream) {\\\\n' +\n ' console.log(\"Received:\", event.data);\\\\n' +\n '}';\n\n case 'python':\n return 'import sseclient\\\\n' +\n 'import requests\\\\n\\\\n' +\n 'response = requests.get(\"' + url + '\", stream=True)\\\\n' +\n 'client = sseclient.SSEClient(response)\\\\n\\\\n' +\n 'for event in client.events():\\\\n' +\n ' print(f\"Event: {event.event}, Data: {event.data}\")';\n\n default:\n return '// Not implemented';\n }\n }\n\n // JSON syntax highlighting\n function syntaxHighlightJSON(json) {\n return json\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n .replace(/(\"(\\\\\\\\u[a-zA-Z0-9]{4}|\\\\\\\\[^u]|[^\\\\\\\\\"])*\"(\\\\s*:)?)/g, function(match) {\n let cls = 'json-string';\n if (/:$/.test(match)) {\n cls = 'json-key';\n match = match.replace(/:$/, '') + ':';\n }\n return '<span class=\"' + cls + '\">' + match + '</span>';\n })\n .replace(/\\\\b(true|false|null)\\\\b/g, '<span class=\"json-boolean\">$1</span>')\n .replace(/\\\\b(-?\\\\d+\\\\.?\\\\d*)\\\\b/g, '<span class=\"json-number\">$1</span>');\n }\n\n function renderCodeExample(ep) {\n const container = document.createElement('div');\n container.className = 'code-example';\n\n // Build request details\n const method = ep.method.toUpperCase();\n const path = ep.path;\n const baseUrl = (spec.servers && spec.servers[0]?.url) || 'http://localhost:3000';\n\n // Handle JSON-RPC methods specially\n const isJsonRpc = method === 'RPC';\n let fullUrl;\n let exampleBody = null;\n let actualMethod = method;\n\n if (isJsonRpc) {\n // For JSON-RPC, use the /rpc endpoint and POST method\n const rpcEndpoint = jsonrpcSpec?.endpoint || '/rpc';\n fullUrl = baseUrl + rpcEndpoint;\n actualMethod = 'POST';\n\n // Build JSON-RPC request body\n const opData = ep.data;\n let params = {};\n if (opData && opData.params) {\n params = buildExampleFromSchema(opData.params);\n }\n exampleBody = {\n jsonrpc: '2.0',\n method: path, // The method name like \"tasks.list\"\n params: params,\n id: 1\n };\n } else {\n // Ensure path has leading slash for proper URL construction\n const normalizedPath = path.startsWith('/') ? path : '/' + path;\n fullUrl = baseUrl + normalizedPath;\n\n // Get request body if exists\n const opData = ep.data;\n if (opData && opData.requestBody && opData.requestBody.content) {\n const jsonContent = opData.requestBody.content['application/json'];\n if (jsonContent && jsonContent.schema) {\n exampleBody = buildExampleFromSchema(jsonContent.schema);\n }\n }\n }\n\n // Language tabs\n const languages = ['curl', 'fetch', 'recker', 'python', 'go'];\n const tabs = document.createElement('div');\n tabs.className = 'code-tabs';\n\n const contents = document.createElement('div');\n contents.className = 'code-contents';\n\n const langLabels = {\n curl: 'cURL',\n fetch: 'Fetch',\n recker: 'Recker',\n python: 'Python',\n go: 'Go'\n };\n\n languages.forEach((lang, i) => {\n // Tab button\n const tab = document.createElement('button');\n tab.className = 'code-tab' + (i === 0 ? ' active' : '');\n tab.textContent = langLabels[lang] || lang;\n tab.onclick = () => {\n tabs.querySelectorAll('.code-tab').forEach(t => t.classList.remove('active'));\n tab.classList.add('active');\n contents.querySelectorAll('.code-content').forEach(c => c.classList.remove('active'));\n contents.querySelector('.code-content[data-lang=\"' + lang + '\"]').classList.add('active');\n };\n tabs.appendChild(tab);\n\n // Content\n const content = document.createElement('div');\n content.className = 'code-content' + (i === 0 ? ' active' : '');\n content.setAttribute('data-lang', lang);\n\n const pre = document.createElement('pre');\n const code = document.createElement('code');\n code.textContent = generateCodeSample(lang, actualMethod, fullUrl, exampleBody);\n pre.appendChild(code);\n content.appendChild(pre);\n contents.appendChild(content);\n });\n\n container.appendChild(tabs);\n container.appendChild(contents);\n\n return container;\n }\n\n function generateCodeSample(lang, method, url, body) {\n const hasBody = body && ['POST', 'PUT', 'PATCH'].includes(method);\n const bodyStr = body ? JSON.stringify(body, null, 2) : '';\n\n switch (lang) {\n case 'curl':\n const curlLines = [];\n curlLines.push('curl' + (method !== 'GET' ? ' -X ' + method : ''));\n curlLines.push(' \"' + url + '\"');\n if (hasBody) {\n curlLines.push(' -H \"Content-Type: application/json\"');\n curlLines.push(\" -d '\" + bodyStr + \"'\");\n }\n return curlLines.join(' \\\\\\\\\\\\n');\n\n case 'fetch':\n if (hasBody) {\n return 'const response = await fetch(\"' + url + '\", {\\\\n' +\n ' method: \"' + method + '\",\\\\n' +\n ' headers: {\\\\n' +\n ' \"Content-Type\": \"application/json\",\\\\n' +\n ' },\\\\n' +\n ' body: JSON.stringify(' + bodyStr.split('\\\\n').map((l, i) => i === 0 ? l : ' ' + l).join('\\\\n') + '),\\\\n' +\n '});\\\\n\\\\n' +\n 'const data = await response.json();\\\\n' +\n 'console.log(data);';\n }\n return 'const response = await fetch(\"' + url + '\"' +\n (method !== 'GET' ? ', {\\\\n method: \"' + method + '\",\\\\n}' : '') + ');\\\\n\\\\n' +\n 'const data = await response.json();\\\\n' +\n 'console.log(data);';\n\n case 'recker':\n if (hasBody) {\n return 'import { ' + method.toLowerCase() + ' } from \"recker\";\\\\n\\\\n' +\n 'const data = await ' + method.toLowerCase() + '(\"' + url + '\")\\\\n' +\n ' .json(' + bodyStr.split('\\\\n').map((l, i) => i === 0 ? l : ' ' + l).join('\\\\n') + ')\\\\n' +\n ' .json();\\\\n\\\\n' +\n 'console.log(data);';\n }\n return 'import { ' + method.toLowerCase() + ' } from \"recker\";\\\\n\\\\n' +\n 'const data = await ' + method.toLowerCase() + '(\"' + url + '\").json();\\\\n\\\\n' +\n 'console.log(data);';\n\n case 'python':\n if (hasBody) {\n return 'import requests\\\\n\\\\n' +\n 'response = requests.' + method.toLowerCase() + '(\\\\n' +\n ' \"' + url + '\",\\\\n' +\n ' json=' + bodyStr.split('\\\\n').map((l, i) => i === 0 ? l : ' ' + l).join('\\\\n') + ',\\\\n' +\n ')\\\\n\\\\n' +\n 'print(response.json())';\n }\n return 'import requests\\\\n\\\\n' +\n 'response = requests.' + method.toLowerCase() + '(\"' + url + '\")\\\\n\\\\n' +\n 'print(response.json())';\n\n case 'go':\n if (hasBody) {\n return 'package main\\\\n\\\\n' +\n 'import (\\\\n' +\n ' \"bytes\"\\\\n' +\n ' \"encoding/json\"\\\\n' +\n ' \"fmt\"\\\\n' +\n ' \"net/http\"\\\\n' +\n ' \"io\"\\\\n' +\n ')\\\\n\\\\n' +\n 'func main() {\\\\n' +\n ' body, _ := json.Marshal(map[string]interface{}{\\\\n' +\n generateGoMapBody(body) +\n ' })\\\\n\\\\n' +\n ' req, _ := http.NewRequest(\"' + method + '\", \"' + url + '\", bytes.NewBuffer(body))\\\\n' +\n ' req.Header.Set(\"Content-Type\", \"application/json\")\\\\n\\\\n' +\n ' client := &http.Client{}\\\\n' +\n ' resp, _ := client.Do(req)\\\\n' +\n ' defer resp.Body.Close()\\\\n\\\\n' +\n ' data, _ := io.ReadAll(resp.Body)\\\\n' +\n ' fmt.Println(string(data))\\\\n' +\n '}';\n }\n return 'package main\\\\n\\\\n' +\n 'import (\\\\n' +\n ' \"fmt\"\\\\n' +\n ' \"net/http\"\\\\n' +\n ' \"io\"\\\\n' +\n ')\\\\n\\\\n' +\n 'func main() {\\\\n' +\n ' resp, _ := http.Get(\"' + url + '\")\\\\n' +\n ' defer resp.Body.Close()\\\\n\\\\n' +\n ' body, _ := io.ReadAll(resp.Body)\\\\n' +\n ' fmt.Println(string(body))\\\\n' +\n '}';\n\n default:\n return '// Not implemented';\n }\n }\n\n function generateGoMapBody(body) {\n if (!body || typeof body !== 'object') return '';\n const lines = [];\n for (const [key, value] of Object.entries(body)) {\n const goValue = typeof value === 'string' ? '\"' + value + '\"' :\n typeof value === 'number' ? String(value) :\n typeof value === 'boolean' ? String(value) :\n 'nil';\n lines.push(' \"' + key + '\": ' + goValue + ',');\n }\n return lines.join('\\\\n') + '\\\\n';\n }\n\n function buildExampleFromSchema(schema) {\n if (!schema) return null;\n\n // Resolve $ref\n if (schema.$ref) {\n const resolved = resolveRef(schema.$ref);\n return buildExampleFromSchema(resolved);\n }\n\n // Normalize non-standard format\n schema = normalizeSchema(schema);\n\n if (schema.example !== undefined) return schema.example;\n if (schema.default !== undefined) return schema.default;\n\n if (schema.type === 'object' && schema.properties) {\n const obj = {};\n for (const [key, prop] of Object.entries(schema.properties)) {\n obj[key] = buildExampleFromSchema(prop);\n }\n return obj;\n }\n\n if (schema.type === 'array' && schema.items) {\n return [buildExampleFromSchema(schema.items)];\n }\n\n // Primitive defaults\n switch (schema.type) {\n case 'string': return schema.format === 'email' ? 'user@example.com' : 'string';\n case 'number': return 0;\n case 'integer': return 0;\n case 'boolean': return true;\n default: return null;\n }\n }\n\n";
5
+ //# sourceMappingURL=cards-and-code.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cards-and-code.js","sourceRoot":"","sources":["../../../../src/docs/ui/client-script/cards-and-code.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,CAAC,MAAM,wBAAwB,GAAG,mx6BAAmx6B,CAAA"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Embedded docs UI client script chunk.
3
+ */
4
+ export declare const contentClientScript: string;
5
+ //# sourceMappingURL=content.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../../../src/docs/ui/client-script/content.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,eAAO,MAAM,mBAAmB,QAuZ/B,CAAA"}