@apiboost/omnispec 1.0.0 → 1.1.0-next.1
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.
- package/dist/cjs/asyncapi/index.js +3 -3
- package/dist/cjs/chunks/AsyncApiSpec-CHvM1swf.js +1880 -0
- package/dist/cjs/chunks/AsyncApiSpec-CHvM1swf.js.map +1 -0
- package/dist/cjs/chunks/{Collapsible-BHAHk_Ep.js → Collapsible-Jlb_vtdW.js} +286 -225
- package/dist/cjs/chunks/Collapsible-Jlb_vtdW.js.map +1 -0
- package/dist/cjs/chunks/{OmniSpecRenderer-CE4wxVTL.js → OmniSpecRenderer-Dj6Z6W2J.js} +3 -3
- package/dist/cjs/chunks/{OmniSpecRenderer-CE4wxVTL.js.map → OmniSpecRenderer-Dj6Z6W2J.js.map} +1 -1
- package/dist/cjs/chunks/{OpenApiSpec-D0JtmOVQ.js → OpenApiSpec-BPtXvk7C.js} +8 -8
- package/dist/cjs/chunks/{OpenApiSpec-D0JtmOVQ.js.map → OpenApiSpec-BPtXvk7C.js.map} +1 -1
- package/dist/cjs/chunks/{OpenIdConnectManual-oEnN0QJ-.js → OpenIdConnectManual-DBP0Do-3.js} +6 -67
- package/dist/cjs/chunks/OpenIdConnectManual-DBP0Do-3.js.map +1 -0
- package/dist/cjs/chunks/{ref-resolver-DWu6Q6E5.js → ref-resolver-0A8GNRI3.js} +6 -2
- package/dist/cjs/chunks/{ref-resolver-DWu6Q6E5.js.map → ref-resolver-0A8GNRI3.js.map} +1 -1
- package/dist/cjs/core/public.js +2 -2
- package/dist/cjs/index.js +6 -6
- package/dist/cjs/openapi/index.js +4 -4
- package/dist/cjs/wc/index.js +1 -1
- package/dist/esm/asyncapi/index.js +3 -3
- package/dist/esm/chunks/AsyncApiSpec-BPiA9b5T.js +1878 -0
- package/dist/esm/chunks/AsyncApiSpec-BPiA9b5T.js.map +1 -0
- package/dist/esm/chunks/{Collapsible-DA6-nS46.js → Collapsible-0ryLh6wX.js} +286 -227
- package/dist/esm/chunks/Collapsible-0ryLh6wX.js.map +1 -0
- package/dist/esm/chunks/{OmniSpecRenderer-MqsQFXro.js → OmniSpecRenderer-yF2Zw_B9.js} +3 -3
- package/dist/esm/chunks/{OmniSpecRenderer-MqsQFXro.js.map → OmniSpecRenderer-yF2Zw_B9.js.map} +1 -1
- package/dist/esm/chunks/{OpenApiSpec-Cy-oW6jA.js → OpenApiSpec-MGJ3oFHZ.js} +4 -4
- package/dist/esm/chunks/{OpenApiSpec-Cy-oW6jA.js.map → OpenApiSpec-MGJ3oFHZ.js.map} +1 -1
- package/dist/esm/chunks/{OpenIdConnectManual-COfITasf.js → OpenIdConnectManual-BS-n811Z.js} +5 -64
- package/dist/esm/chunks/OpenIdConnectManual-BS-n811Z.js.map +1 -0
- package/dist/esm/chunks/{ref-resolver-BIrHJOjz.js → ref-resolver-B0C36NuQ.js} +6 -3
- package/dist/esm/chunks/{ref-resolver-BIrHJOjz.js.map → ref-resolver-B0C36NuQ.js.map} +1 -1
- package/dist/esm/core/public.js +2 -2
- package/dist/esm/index.js +6 -6
- package/dist/esm/openapi/index.js +4 -4
- package/dist/esm/wc/index.js +1 -1
- package/dist/types/asyncapi/AsyncApiSpec.d.ts.map +1 -1
- package/dist/types/asyncapi/components/BindingsSection.d.ts +26 -0
- package/dist/types/asyncapi/components/BindingsSection.d.ts.map +1 -0
- package/dist/types/asyncapi/components/ChannelDetail.d.ts +1 -1
- package/dist/types/asyncapi/components/ChannelDetail.d.ts.map +1 -1
- package/dist/types/asyncapi/components/ComponentsSection.d.ts +1 -1
- package/dist/types/asyncapi/components/ComponentsSection.d.ts.map +1 -1
- package/dist/types/asyncapi/components/MessagePayload.d.ts +22 -0
- package/dist/types/asyncapi/components/MessagePayload.d.ts.map +1 -0
- package/dist/types/asyncapi/components/SecurityRequirementBadges.d.ts +22 -0
- package/dist/types/asyncapi/components/SecurityRequirementBadges.d.ts.map +1 -0
- package/dist/types/asyncapi/components/SecuritySchemesSection.d.ts +23 -0
- package/dist/types/asyncapi/components/SecuritySchemesSection.d.ts.map +1 -0
- package/dist/types/asyncapi/components/ServerList.d.ts +1 -1
- package/dist/types/asyncapi/components/ServerList.d.ts.map +1 -1
- package/dist/types/asyncapi/components/TagGroupHeader.d.ts +18 -0
- package/dist/types/asyncapi/components/TagGroupHeader.d.ts.map +1 -0
- package/dist/types/asyncapi/components/field-display.d.ts +20 -0
- package/dist/types/asyncapi/components/field-display.d.ts.map +1 -0
- package/dist/types/asyncapi/parser/asyncapi-parser.d.ts.map +1 -1
- package/dist/types/asyncapi/schema-formats.d.ts +26 -0
- package/dist/types/asyncapi/schema-formats.d.ts.map +1 -0
- package/dist/types/asyncapi/tag-grouping.d.ts +39 -0
- package/dist/types/asyncapi/tag-grouping.d.ts.map +1 -0
- package/dist/types/asyncapi/types/asyncapi.types.d.ts +35 -0
- package/dist/types/asyncapi/types/asyncapi.types.d.ts.map +1 -1
- package/dist/types/openapi/parser/ref-resolver.d.ts +8 -0
- package/dist/types/openapi/parser/ref-resolver.d.ts.map +1 -1
- package/dist/wc/standalone.js +1 -1
- package/dist/wc/standalone.js.map +1 -1
- package/package.json +2 -2
- package/dist/cjs/chunks/AsyncApiSpec-TBlyRxTP.js +0 -819
- package/dist/cjs/chunks/AsyncApiSpec-TBlyRxTP.js.map +0 -1
- package/dist/cjs/chunks/Collapsible-BHAHk_Ep.js.map +0 -1
- package/dist/cjs/chunks/OpenIdConnectManual-oEnN0QJ-.js.map +0 -1
- package/dist/esm/chunks/AsyncApiSpec-C3lsUpZk.js +0 -817
- package/dist/esm/chunks/AsyncApiSpec-C3lsUpZk.js.map +0 -1
- package/dist/esm/chunks/Collapsible-DA6-nS46.js.map +0 -1
- package/dist/esm/chunks/OpenIdConnectManual-COfITasf.js.map +0 -1
|
@@ -0,0 +1,1878 @@
|
|
|
1
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { useCallback, useState, useMemo } from 'react';
|
|
3
|
+
import { css, cx } from '@emotion/css';
|
|
4
|
+
import { a as useSpecFetcher, I as Icon, m as mq, r as resolveSchemaStyle, S as SpecType, T as ThemeProvider, L as LoadingScreen, b as SpecStatusScreen, E as ErrorMessage, N as NavTree, h as buildSidebar, C as ConfigProvider, e as DocLayout } from './useSpecFetcher-CZvAnU7Z.js';
|
|
5
|
+
import { M as MarkdownRenderer, T as Tabs, t as SchemaTree, A as schemaToNodes, x as generateExample, H as ExampleSelector, C as CodeBlock, d as ExpandableCard, f as MethodBar, I as buildConstraints, S as SchemaBadge, a as Collapsible, D as useHashScroll, y as requestExpand, w as flattenNavItemIds, G as useScrollSpy, u as SearchBar, J as ExpandProvider, v as SpecToolbar, z as resolveDownloadLink } from './Collapsible-0ryLh6wX.js';
|
|
6
|
+
import { E as ErrorBoundary } from './ErrorBoundary-posRNrbt.js';
|
|
7
|
+
import { r as resolveRefs, p as parse, d as decodeJsonPointerSegment } from './ref-resolver-B0C36NuQ.js';
|
|
8
|
+
import '@emotion/styled';
|
|
9
|
+
import './ssrf-guard-CsZoYdEq.js';
|
|
10
|
+
|
|
11
|
+
function unionTags(a, b) {
|
|
12
|
+
if (!a && !b) return void 0;
|
|
13
|
+
const byName = /* @__PURE__ */ new Map();
|
|
14
|
+
for (const tag of [...a ?? [], ...b ?? []]) {
|
|
15
|
+
if (!byName.has(tag.name)) byName.set(tag.name, tag);
|
|
16
|
+
}
|
|
17
|
+
return Array.from(byName.values());
|
|
18
|
+
}
|
|
19
|
+
function mergeSchema(base, override) {
|
|
20
|
+
if (!base) return override;
|
|
21
|
+
if (!override) return base;
|
|
22
|
+
const result = { ...base, ...override };
|
|
23
|
+
const baseProps = base.properties;
|
|
24
|
+
const overrideProps = override.properties;
|
|
25
|
+
if (baseProps || overrideProps) {
|
|
26
|
+
result.properties = { ...baseProps ?? {}, ...overrideProps ?? {} };
|
|
27
|
+
}
|
|
28
|
+
const required = Array.from(
|
|
29
|
+
/* @__PURE__ */ new Set([...base.required ?? [], ...override.required ?? []])
|
|
30
|
+
);
|
|
31
|
+
if (required.length > 0) result.required = required;
|
|
32
|
+
return result;
|
|
33
|
+
}
|
|
34
|
+
function mergeMessageLayer(base, override) {
|
|
35
|
+
const result = { ...base };
|
|
36
|
+
for (const [key, value] of Object.entries(override)) {
|
|
37
|
+
if (key === "traits" || value === void 0) continue;
|
|
38
|
+
if (key === "tags") {
|
|
39
|
+
result.tags = unionTags(base.tags, value);
|
|
40
|
+
} else if (key === "headers") {
|
|
41
|
+
result.headers = mergeSchema(base.headers, value);
|
|
42
|
+
} else if (key === "examples") {
|
|
43
|
+
result.examples = [...base.examples ?? [], ...value ?? []];
|
|
44
|
+
} else if (key === "bindings") {
|
|
45
|
+
result.bindings = { ...base.bindings ?? {}, ...value };
|
|
46
|
+
} else {
|
|
47
|
+
result[key] = value;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return result;
|
|
51
|
+
}
|
|
52
|
+
function applyMessageTraits(msg) {
|
|
53
|
+
if (!msg.traits || msg.traits.length === 0) return msg;
|
|
54
|
+
let acc = {};
|
|
55
|
+
for (const trait of msg.traits) acc = mergeMessageLayer(acc, trait);
|
|
56
|
+
return mergeMessageLayer(acc, msg);
|
|
57
|
+
}
|
|
58
|
+
function mergeOperationLayer(base, override) {
|
|
59
|
+
const result = { ...base };
|
|
60
|
+
for (const [key, value] of Object.entries(override)) {
|
|
61
|
+
if (key === "traits" || value === void 0) continue;
|
|
62
|
+
if (key === "tags") {
|
|
63
|
+
result.tags = unionTags(base.tags, value);
|
|
64
|
+
} else if (key === "bindings") {
|
|
65
|
+
result.bindings = { ...base.bindings ?? {}, ...value };
|
|
66
|
+
} else {
|
|
67
|
+
result[key] = value;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return result;
|
|
71
|
+
}
|
|
72
|
+
function applyOperationTraits(op) {
|
|
73
|
+
if (!op.traits || op.traits.length === 0) return op;
|
|
74
|
+
let acc = {};
|
|
75
|
+
for (const trait of op.traits) acc = mergeOperationLayer(acc, trait);
|
|
76
|
+
return mergeOperationLayer(acc, op);
|
|
77
|
+
}
|
|
78
|
+
async function parseAsyncApiSpec(specInput) {
|
|
79
|
+
const raw = typeof specInput === "string" ? parseSpecString(specInput) : specInput;
|
|
80
|
+
const api = await resolveRefs(raw);
|
|
81
|
+
const majorVersion = parseInt(api.asyncapi.split(".")[0], 10);
|
|
82
|
+
const isV3 = majorVersion >= 3;
|
|
83
|
+
const servers = extractServers(api, raw);
|
|
84
|
+
const rawApi = raw;
|
|
85
|
+
const channels = isV3 ? extractChannelsV3(api, rawApi) : extractChannelsV2(api);
|
|
86
|
+
const components = extractComponents(api);
|
|
87
|
+
const root = api;
|
|
88
|
+
const tags = api.tags?.map((tag) => {
|
|
89
|
+
const raw2 = tag;
|
|
90
|
+
return {
|
|
91
|
+
name: tag.name,
|
|
92
|
+
description: tag.description,
|
|
93
|
+
displayName: raw2["x-displayName"],
|
|
94
|
+
externalDocs: raw2.externalDocs
|
|
95
|
+
};
|
|
96
|
+
})?.filter((tag) => !tag["x-internal"]);
|
|
97
|
+
return {
|
|
98
|
+
title: api.info.title,
|
|
99
|
+
description: api.info.description,
|
|
100
|
+
version: api.info.version,
|
|
101
|
+
specVersion: api.asyncapi,
|
|
102
|
+
servers,
|
|
103
|
+
channels: channels.filter((ch) => !ch.xInternal),
|
|
104
|
+
components,
|
|
105
|
+
tags,
|
|
106
|
+
tagGroups: root["x-tagGroups"],
|
|
107
|
+
externalDocs: api.externalDocs,
|
|
108
|
+
contact: api.info.contact,
|
|
109
|
+
license: api.info.license,
|
|
110
|
+
termsOfService: api.info.termsOfService,
|
|
111
|
+
logo: api.info["x-logo"]
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
function extractServers(api, rawApi) {
|
|
115
|
+
if (!api.servers) return [];
|
|
116
|
+
const toServer = (s, name, rawSecurity) => ({
|
|
117
|
+
name,
|
|
118
|
+
url: s.host ? `${s.protocol}://${s.host}${s.pathname ?? ""}` : s.url ?? "",
|
|
119
|
+
protocol: s.protocol,
|
|
120
|
+
protocolVersion: s.protocolVersion,
|
|
121
|
+
description: s.description,
|
|
122
|
+
variables: s.variables,
|
|
123
|
+
security: s.security,
|
|
124
|
+
securityNames: deriveSecurityNames(rawSecurity, s.security),
|
|
125
|
+
bindings: s.bindings
|
|
126
|
+
});
|
|
127
|
+
if (Array.isArray(api.servers)) {
|
|
128
|
+
const rawServers2 = Array.isArray(rawApi.servers) ? rawApi.servers : [];
|
|
129
|
+
return api.servers.map((s, idx) => toServer(s, s.name ?? `server-${idx}`, rawServers2[idx]?.security));
|
|
130
|
+
}
|
|
131
|
+
const rawServers = !Array.isArray(rawApi.servers) && rawApi.servers || {};
|
|
132
|
+
return Object.entries(api.servers).map(([name, s]) => toServer(s, name, rawServers[name]?.security));
|
|
133
|
+
}
|
|
134
|
+
function extractChannelsV2(api) {
|
|
135
|
+
if (!api.channels) return [];
|
|
136
|
+
return Object.entries(api.channels).map(([channelName, ch]) => {
|
|
137
|
+
const operations = [];
|
|
138
|
+
if (ch.publish) {
|
|
139
|
+
operations.push(convertOperationV2("publish", ch.publish));
|
|
140
|
+
}
|
|
141
|
+
if (ch.subscribe) {
|
|
142
|
+
operations.push(convertOperationV2("subscribe", ch.subscribe));
|
|
143
|
+
}
|
|
144
|
+
const raw = ch;
|
|
145
|
+
return {
|
|
146
|
+
name: channelName,
|
|
147
|
+
address: channelName,
|
|
148
|
+
description: ch.description,
|
|
149
|
+
operations: operations.filter((op) => !op.xInternal),
|
|
150
|
+
parameters: ch.parameters,
|
|
151
|
+
bindings: ch.bindings,
|
|
152
|
+
xInternal: raw["x-internal"]
|
|
153
|
+
};
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
function convertOperationV2(action, rawOp) {
|
|
157
|
+
const op = applyOperationTraits(rawOp);
|
|
158
|
+
const messages = [];
|
|
159
|
+
if (op.message) {
|
|
160
|
+
if ("oneOf" in op.message) {
|
|
161
|
+
for (const m of op.message.oneOf) {
|
|
162
|
+
messages.push(convertMessage(m));
|
|
163
|
+
}
|
|
164
|
+
} else {
|
|
165
|
+
messages.push(convertMessage(op.message));
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
const raw = op;
|
|
169
|
+
return {
|
|
170
|
+
action,
|
|
171
|
+
operationId: op.operationId,
|
|
172
|
+
summary: op.summary,
|
|
173
|
+
description: op.description,
|
|
174
|
+
messages,
|
|
175
|
+
message: messages[0],
|
|
176
|
+
tags: op.tags,
|
|
177
|
+
bindings: op.bindings,
|
|
178
|
+
securityNames: deriveSecurityNames(void 0, op.security),
|
|
179
|
+
xBadges: raw["x-badges"],
|
|
180
|
+
xInternal: raw["x-internal"]
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
function resolveChannelName(rawChannel, resolvedChannel, addressToName) {
|
|
184
|
+
const refString = rawChannel && typeof rawChannel === "object" && "$ref" in rawChannel && typeof rawChannel.$ref === "string" ? rawChannel.$ref : resolvedChannel && typeof resolvedChannel === "object" && "$ref" in resolvedChannel && typeof resolvedChannel.$ref === "string" ? resolvedChannel.$ref : void 0;
|
|
185
|
+
if (refString) {
|
|
186
|
+
const last = refString.split("/").pop();
|
|
187
|
+
return last !== void 0 ? decodeJsonPointerSegment(last) : void 0;
|
|
188
|
+
}
|
|
189
|
+
const address = resolvedChannel?.address;
|
|
190
|
+
if (address && addressToName.has(address)) {
|
|
191
|
+
return addressToName.get(address);
|
|
192
|
+
}
|
|
193
|
+
return void 0;
|
|
194
|
+
}
|
|
195
|
+
function extractChannelsV3(api, rawApi) {
|
|
196
|
+
if (!api.channels) return [];
|
|
197
|
+
const channelMap = /* @__PURE__ */ new Map();
|
|
198
|
+
const addressToName = /* @__PURE__ */ new Map();
|
|
199
|
+
for (const [channelName, ch] of Object.entries(api.channels)) {
|
|
200
|
+
const raw = ch;
|
|
201
|
+
const address = ch.address ?? channelName;
|
|
202
|
+
addressToName.set(address, channelName);
|
|
203
|
+
channelMap.set(channelName, {
|
|
204
|
+
name: channelName,
|
|
205
|
+
address,
|
|
206
|
+
description: ch.description,
|
|
207
|
+
operations: [],
|
|
208
|
+
parameters: ch.parameters,
|
|
209
|
+
bindings: ch.bindings,
|
|
210
|
+
xInternal: raw["x-internal"]
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
if (api.operations) {
|
|
214
|
+
for (const [opKey, resolvedOp] of Object.entries(api.operations)) {
|
|
215
|
+
const op = applyOperationTraits(resolvedOp);
|
|
216
|
+
const rawOp = rawApi.operations?.[opKey];
|
|
217
|
+
const channelName = resolveChannelName(rawOp?.channel, op.channel, addressToName);
|
|
218
|
+
const collectMessages = (list) => {
|
|
219
|
+
const out = [];
|
|
220
|
+
for (const msg of list ?? []) {
|
|
221
|
+
if (msg && typeof msg === "object" && "$ref" in msg) continue;
|
|
222
|
+
out.push(convertMessage(msg));
|
|
223
|
+
}
|
|
224
|
+
return out;
|
|
225
|
+
};
|
|
226
|
+
const messages = collectMessages(op.messages);
|
|
227
|
+
const replyMessages = collectMessages(op.reply?.messages);
|
|
228
|
+
const raw = op;
|
|
229
|
+
const operation = {
|
|
230
|
+
action: op.action,
|
|
231
|
+
summary: op.summary,
|
|
232
|
+
description: op.description,
|
|
233
|
+
messages,
|
|
234
|
+
message: messages[0],
|
|
235
|
+
tags: op.tags,
|
|
236
|
+
bindings: op.bindings,
|
|
237
|
+
securityNames: deriveSecurityNames(rawOp?.security, op.security),
|
|
238
|
+
reply: replyMessages.length > 0 ? { messages: replyMessages } : void 0,
|
|
239
|
+
xBadges: raw["x-badges"],
|
|
240
|
+
xInternal: raw["x-internal"]
|
|
241
|
+
};
|
|
242
|
+
if (operation.xInternal) continue;
|
|
243
|
+
if (channelName && channelMap.has(channelName)) {
|
|
244
|
+
channelMap.get(channelName).operations.push(operation);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
return Array.from(channelMap.values());
|
|
249
|
+
}
|
|
250
|
+
function convertMessage(rawMsg) {
|
|
251
|
+
const msg = applyMessageTraits(rawMsg);
|
|
252
|
+
return {
|
|
253
|
+
name: msg.name,
|
|
254
|
+
title: msg.title,
|
|
255
|
+
summary: msg.summary,
|
|
256
|
+
description: msg.description,
|
|
257
|
+
contentType: msg.contentType,
|
|
258
|
+
schemaFormat: msg.schemaFormat,
|
|
259
|
+
payload: msg.payload,
|
|
260
|
+
headers: msg.headers,
|
|
261
|
+
correlationId: msg.correlationId,
|
|
262
|
+
tags: msg.tags,
|
|
263
|
+
examples: msg.examples,
|
|
264
|
+
bindings: msg.bindings
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
function extractComponents(api) {
|
|
268
|
+
const components = api.components;
|
|
269
|
+
const rawMessages = api.components?.messages ?? {};
|
|
270
|
+
const messages = {};
|
|
271
|
+
for (const [name, msg] of Object.entries(rawMessages)) {
|
|
272
|
+
messages[name] = convertMessage(msg);
|
|
273
|
+
}
|
|
274
|
+
return {
|
|
275
|
+
schemas: api.components?.schemas ?? {},
|
|
276
|
+
messages,
|
|
277
|
+
securitySchemes: components?.securitySchemes ?? {}
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
function deriveSecurityNames(raw, resolved) {
|
|
281
|
+
const rawArr = raw ?? [];
|
|
282
|
+
const resArr = resolved ?? [];
|
|
283
|
+
const count = Math.max(rawArr.length, resArr.length);
|
|
284
|
+
if (count === 0) return void 0;
|
|
285
|
+
const names = [];
|
|
286
|
+
for (let i = 0; i < count; i++) {
|
|
287
|
+
const rawEntry = rawArr[i];
|
|
288
|
+
const resEntry = resArr[i];
|
|
289
|
+
if (rawEntry && typeof rawEntry === "object" && typeof rawEntry.$ref === "string") {
|
|
290
|
+
names.push(decodeJsonPointerSegment(rawEntry.$ref.split("/").pop()));
|
|
291
|
+
} else if (resEntry && typeof resEntry === "object") {
|
|
292
|
+
if (typeof resEntry.type === "string") {
|
|
293
|
+
names.push(resEntry.type);
|
|
294
|
+
} else {
|
|
295
|
+
names.push(...Object.keys(resEntry));
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
return names.length > 0 ? names : void 0;
|
|
300
|
+
}
|
|
301
|
+
function parseSpecString(input) {
|
|
302
|
+
const trimmed = input.trim();
|
|
303
|
+
if (trimmed.startsWith("{")) {
|
|
304
|
+
try {
|
|
305
|
+
return JSON.parse(trimmed);
|
|
306
|
+
} catch {
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
return parse(trimmed);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
function useAsyncApiSpec(spec) {
|
|
313
|
+
const parser = useCallback(async (raw) => {
|
|
314
|
+
return parseAsyncApiSpec(raw);
|
|
315
|
+
}, []);
|
|
316
|
+
return useSpecFetcher(spec, parser);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
const containerStyle$4 = css({
|
|
320
|
+
marginBottom: "2rem",
|
|
321
|
+
paddingBottom: "1.5rem",
|
|
322
|
+
borderBottom: "1px solid var(--omnispec-border-color)"
|
|
323
|
+
});
|
|
324
|
+
const titleStyle$5 = css({
|
|
325
|
+
margin: "0 0 0.25rem",
|
|
326
|
+
fontSize: "var(--omnispec-h2-font-size)",
|
|
327
|
+
color: "var(--omnispec-h2-color)",
|
|
328
|
+
fontWeight: 700,
|
|
329
|
+
display: "inline"
|
|
330
|
+
});
|
|
331
|
+
const versionStyle$1 = css({
|
|
332
|
+
fontSize: "var(--omnispec-font-size-sm)",
|
|
333
|
+
color: "var(--omnispec-fg-muted)",
|
|
334
|
+
marginLeft: "0.75rem",
|
|
335
|
+
fontFamily: "var(--omnispec-font-mono)"
|
|
336
|
+
});
|
|
337
|
+
const specBadgeStyle = css({
|
|
338
|
+
fontSize: "var(--omnispec-font-size-xs)",
|
|
339
|
+
color: "var(--omnispec-color-primary)",
|
|
340
|
+
border: "1px solid var(--omnispec-color-primary)",
|
|
341
|
+
borderRadius: "0.25rem",
|
|
342
|
+
padding: "1px 0.375rem",
|
|
343
|
+
marginLeft: "0.5rem",
|
|
344
|
+
fontFamily: "var(--omnispec-font-mono)"
|
|
345
|
+
});
|
|
346
|
+
const metaStyle = css({
|
|
347
|
+
fontSize: "var(--omnispec-font-size-sm)",
|
|
348
|
+
color: "var(--omnispec-fg-secondary)",
|
|
349
|
+
marginTop: "0.25rem"
|
|
350
|
+
});
|
|
351
|
+
const linkStyle = css({
|
|
352
|
+
color: "var(--omnispec-fg-link)",
|
|
353
|
+
textDecoration: "none",
|
|
354
|
+
"&:hover": {
|
|
355
|
+
textDecoration: "underline"
|
|
356
|
+
}
|
|
357
|
+
});
|
|
358
|
+
function AsyncOverview({ spec }) {
|
|
359
|
+
return /* @__PURE__ */ jsxs("div", { className: cx("omnispec-async-overview", containerStyle$4), children: [
|
|
360
|
+
/* @__PURE__ */ jsx("h1", { className: titleStyle$5, children: spec.title }),
|
|
361
|
+
/* @__PURE__ */ jsxs("span", { className: versionStyle$1, children: [
|
|
362
|
+
"v",
|
|
363
|
+
spec.version
|
|
364
|
+
] }),
|
|
365
|
+
/* @__PURE__ */ jsxs("span", { className: specBadgeStyle, children: [
|
|
366
|
+
"AsyncAPI ",
|
|
367
|
+
spec.specVersion
|
|
368
|
+
] }),
|
|
369
|
+
spec.description && /* @__PURE__ */ jsx(MarkdownRenderer, { content: spec.description }),
|
|
370
|
+
spec.contact && /* @__PURE__ */ jsxs("div", { className: metaStyle, children: [
|
|
371
|
+
spec.contact.name && /* @__PURE__ */ jsxs("span", { children: [
|
|
372
|
+
"Contact: ",
|
|
373
|
+
spec.contact.name
|
|
374
|
+
] }),
|
|
375
|
+
spec.contact.email && /* @__PURE__ */ jsxs("span", { children: [
|
|
376
|
+
" <",
|
|
377
|
+
/* @__PURE__ */ jsx("a", { href: `mailto:${spec.contact.email}`, className: linkStyle, children: spec.contact.email }),
|
|
378
|
+
">"
|
|
379
|
+
] }),
|
|
380
|
+
spec.contact.url && /* @__PURE__ */ jsxs("span", { children: [
|
|
381
|
+
" \xB7 ",
|
|
382
|
+
/* @__PURE__ */ jsx("a", { href: spec.contact.url, target: "_blank", rel: "noopener noreferrer", className: linkStyle, children: spec.contact.url })
|
|
383
|
+
] })
|
|
384
|
+
] }),
|
|
385
|
+
spec.license && /* @__PURE__ */ jsxs("div", { className: metaStyle, children: [
|
|
386
|
+
"License: ",
|
|
387
|
+
spec.license.url ? /* @__PURE__ */ jsx("a", { href: spec.license.url, target: "_blank", rel: "noopener noreferrer", className: linkStyle, children: spec.license.name }) : spec.license.name
|
|
388
|
+
] }),
|
|
389
|
+
spec.externalDocs && /* @__PURE__ */ jsx("div", { className: metaStyle, children: /* @__PURE__ */ jsx("a", { href: spec.externalDocs.url, target: "_blank", rel: "noopener noreferrer", className: linkStyle, children: spec.externalDocs.description ?? "External Documentation" }) })
|
|
390
|
+
] });
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
const protocolColors = {
|
|
394
|
+
kafka: "#231F20",
|
|
395
|
+
"kafka-secure": "#231F20",
|
|
396
|
+
mqtt: "#660066",
|
|
397
|
+
"mqtt5": "#660066",
|
|
398
|
+
amqp: "#FF6600",
|
|
399
|
+
"amqp1": "#FF6600",
|
|
400
|
+
ws: "#4A90D9",
|
|
401
|
+
wss: "#4A90D9",
|
|
402
|
+
http: "var(--omnispec-color-get)",
|
|
403
|
+
https: "var(--omnispec-color-get)",
|
|
404
|
+
nats: "#27AAE1",
|
|
405
|
+
redis: "#DC382D",
|
|
406
|
+
sns: "#FF9900",
|
|
407
|
+
sqs: "#FF9900",
|
|
408
|
+
stomp: "#6DB33F",
|
|
409
|
+
mercure: "#1D1D1D"
|
|
410
|
+
};
|
|
411
|
+
const badgeBase = css({
|
|
412
|
+
display: "inline-block",
|
|
413
|
+
padding: "0.125rem 0.5rem",
|
|
414
|
+
borderRadius: "0.25rem",
|
|
415
|
+
fontSize: "0.625rem",
|
|
416
|
+
fontWeight: 700,
|
|
417
|
+
fontFamily: "var(--omnispec-font-mono)",
|
|
418
|
+
color: "#ffffff",
|
|
419
|
+
letterSpacing: "0.0313rem"
|
|
420
|
+
});
|
|
421
|
+
const versionStyle = css({
|
|
422
|
+
fontWeight: 400,
|
|
423
|
+
opacity: 0.8
|
|
424
|
+
});
|
|
425
|
+
function ProtocolBadge({ protocol, version }) {
|
|
426
|
+
const color = protocolColors[protocol.toLowerCase()] ?? "var(--omnispec-fg-muted)";
|
|
427
|
+
return /* @__PURE__ */ jsxs("span", { className: cx(badgeBase, css({ backgroundColor: color })), children: [
|
|
428
|
+
protocol.toUpperCase(),
|
|
429
|
+
version && /* @__PURE__ */ jsxs("span", { className: versionStyle, children: [
|
|
430
|
+
" ",
|
|
431
|
+
version
|
|
432
|
+
] })
|
|
433
|
+
] });
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
function humanizeField(field) {
|
|
437
|
+
const spaced = field.replace(/[_-]+/g, " ").replace(/([a-z0-9])([A-Z])/g, "$1 $2").trim();
|
|
438
|
+
return spaced.charAt(0).toUpperCase() + spaced.slice(1);
|
|
439
|
+
}
|
|
440
|
+
function renderValue(value) {
|
|
441
|
+
if (value === null) return /* @__PURE__ */ jsx("span", { className: mutedStyle, children: "null" });
|
|
442
|
+
if (typeof value === "boolean") return /* @__PURE__ */ jsx("code", { className: codeStyle, children: value ? "true" : "false" });
|
|
443
|
+
if (typeof value === "number") return /* @__PURE__ */ jsx("code", { className: codeStyle, children: String(value) });
|
|
444
|
+
if (typeof value === "string") return /* @__PURE__ */ jsx("span", { children: value });
|
|
445
|
+
return /* @__PURE__ */ jsx("code", { className: jsonStyle, children: JSON.stringify(value) });
|
|
446
|
+
}
|
|
447
|
+
function FieldRows({ fields }) {
|
|
448
|
+
if (fields.length === 0) return null;
|
|
449
|
+
return /* @__PURE__ */ jsx("dl", { className: listStyle$1, children: fields.map(([field, value]) => /* @__PURE__ */ jsxs("div", { className: rowStyle$1, children: [
|
|
450
|
+
/* @__PURE__ */ jsx("dt", { className: nameStyle$1, children: humanizeField(field) }),
|
|
451
|
+
/* @__PURE__ */ jsx("dd", { className: valueStyle, children: renderValue(value) })
|
|
452
|
+
] }, field)) });
|
|
453
|
+
}
|
|
454
|
+
const listStyle$1 = css({
|
|
455
|
+
display: "grid",
|
|
456
|
+
gridTemplateColumns: "max-content 1fr",
|
|
457
|
+
gap: "0.25rem 1rem",
|
|
458
|
+
margin: "0.25rem 0 0"
|
|
459
|
+
});
|
|
460
|
+
const rowStyle$1 = css({ display: "contents" });
|
|
461
|
+
const nameStyle$1 = css({
|
|
462
|
+
fontSize: "var(--omnispec-font-size-xs)",
|
|
463
|
+
fontWeight: 600,
|
|
464
|
+
color: "var(--omnispec-fg-secondary)"
|
|
465
|
+
});
|
|
466
|
+
const valueStyle = css({
|
|
467
|
+
fontSize: "var(--omnispec-font-size-xs)",
|
|
468
|
+
color: "var(--omnispec-fg-primary)",
|
|
469
|
+
margin: 0,
|
|
470
|
+
minWidth: 0,
|
|
471
|
+
wordBreak: "break-word"
|
|
472
|
+
});
|
|
473
|
+
const codeStyle = css({
|
|
474
|
+
fontFamily: "var(--omnispec-font-mono)",
|
|
475
|
+
fontSize: "var(--omnispec-font-size-xs)"
|
|
476
|
+
});
|
|
477
|
+
const jsonStyle = css({
|
|
478
|
+
fontFamily: "var(--omnispec-font-mono)",
|
|
479
|
+
fontSize: "var(--omnispec-font-size-xs)",
|
|
480
|
+
color: "var(--omnispec-fg-code)",
|
|
481
|
+
wordBreak: "break-all"
|
|
482
|
+
});
|
|
483
|
+
const mutedStyle = css({
|
|
484
|
+
color: "var(--omnispec-fg-muted)"
|
|
485
|
+
});
|
|
486
|
+
|
|
487
|
+
const HIDDEN_KEYS = /* @__PURE__ */ new Set(["bindingVersion"]);
|
|
488
|
+
function BindingsSection({ bindings, title = "Bindings" }) {
|
|
489
|
+
if (!bindings || Object.keys(bindings).length === 0) return null;
|
|
490
|
+
const protocols = Object.entries(bindings).filter(
|
|
491
|
+
([, cfg]) => cfg && typeof cfg === "object"
|
|
492
|
+
);
|
|
493
|
+
if (protocols.length === 0) return null;
|
|
494
|
+
return /* @__PURE__ */ jsxs("div", { className: containerStyle$3, children: [
|
|
495
|
+
/* @__PURE__ */ jsx("h4", { className: titleStyle$4, children: title }),
|
|
496
|
+
/* @__PURE__ */ jsx("div", { className: protocolListStyle, children: protocols.map(([protocol, cfg]) => {
|
|
497
|
+
const rows = Object.entries(cfg).filter(
|
|
498
|
+
([key, value]) => !HIDDEN_KEYS.has(key) && value !== void 0
|
|
499
|
+
);
|
|
500
|
+
return /* @__PURE__ */ jsxs("div", { className: protocolCardStyle, children: [
|
|
501
|
+
/* @__PURE__ */ jsx("div", { className: protocolHeaderStyle, children: /* @__PURE__ */ jsx(ProtocolBadge, { protocol }) }),
|
|
502
|
+
rows.length > 0 ? /* @__PURE__ */ jsx(FieldRows, { fields: rows }) : /* @__PURE__ */ jsx("p", { className: emptyStyle, children: "No binding fields." })
|
|
503
|
+
] }, protocol);
|
|
504
|
+
}) })
|
|
505
|
+
] });
|
|
506
|
+
}
|
|
507
|
+
const containerStyle$3 = css({
|
|
508
|
+
marginTop: "1rem"
|
|
509
|
+
});
|
|
510
|
+
const titleStyle$4 = css({
|
|
511
|
+
margin: "0 0 0.75rem",
|
|
512
|
+
fontSize: "var(--omnispec-font-size-md)",
|
|
513
|
+
fontWeight: 700,
|
|
514
|
+
color: "var(--omnispec-fg-primary)",
|
|
515
|
+
letterSpacing: "0.02em"
|
|
516
|
+
});
|
|
517
|
+
const protocolListStyle = css({
|
|
518
|
+
display: "flex",
|
|
519
|
+
flexDirection: "column",
|
|
520
|
+
gap: "0.5rem"
|
|
521
|
+
});
|
|
522
|
+
const protocolCardStyle = css({
|
|
523
|
+
padding: "0.625rem 0.75rem",
|
|
524
|
+
borderRadius: "var(--omnispec-border-radius)",
|
|
525
|
+
backgroundColor: "var(--omnispec-bg-secondary)"
|
|
526
|
+
});
|
|
527
|
+
const protocolHeaderStyle = css({
|
|
528
|
+
marginBottom: "0.5rem"
|
|
529
|
+
});
|
|
530
|
+
const emptyStyle = css({
|
|
531
|
+
margin: 0,
|
|
532
|
+
fontSize: "var(--omnispec-font-size-xs)",
|
|
533
|
+
color: "var(--omnispec-fg-muted)"
|
|
534
|
+
});
|
|
535
|
+
|
|
536
|
+
function SecurityRequirementBadges({ names, label = "Security" }) {
|
|
537
|
+
if (!names || names.length === 0) return null;
|
|
538
|
+
return /* @__PURE__ */ jsxs("div", { className: rowStyle, children: [
|
|
539
|
+
/* @__PURE__ */ jsx("span", { className: labelStyle, children: label }),
|
|
540
|
+
names.map((name) => /* @__PURE__ */ jsxs("a", { href: `#security-${name}`, className: badgeStyle, children: [
|
|
541
|
+
/* @__PURE__ */ jsx(Icon, { name: "lock", size: "0.625rem", strokeWidth: 2.5 }),
|
|
542
|
+
name
|
|
543
|
+
] }, name))
|
|
544
|
+
] });
|
|
545
|
+
}
|
|
546
|
+
const rowStyle = css({
|
|
547
|
+
display: "flex",
|
|
548
|
+
alignItems: "center",
|
|
549
|
+
gap: "0.375rem",
|
|
550
|
+
flexWrap: "wrap",
|
|
551
|
+
marginTop: "0.5rem"
|
|
552
|
+
});
|
|
553
|
+
const labelStyle = css({
|
|
554
|
+
fontSize: "var(--omnispec-font-size-xxs)",
|
|
555
|
+
fontWeight: 600,
|
|
556
|
+
textTransform: "uppercase",
|
|
557
|
+
letterSpacing: "0.05em",
|
|
558
|
+
color: "var(--omnispec-fg-muted)"
|
|
559
|
+
});
|
|
560
|
+
const badgeStyle = css({
|
|
561
|
+
display: "inline-flex",
|
|
562
|
+
alignItems: "center",
|
|
563
|
+
gap: "0.3125rem",
|
|
564
|
+
fontSize: "var(--omnispec-font-size-xs)",
|
|
565
|
+
fontFamily: "var(--omnispec-font-mono)",
|
|
566
|
+
color: "var(--omnispec-fg-primary)",
|
|
567
|
+
backgroundColor: "var(--omnispec-bg-tertiary)",
|
|
568
|
+
padding: "0.1875rem 0.625rem",
|
|
569
|
+
borderRadius: "var(--omnispec-border-radius)",
|
|
570
|
+
fontWeight: 500,
|
|
571
|
+
textDecoration: "none",
|
|
572
|
+
"&:hover": {
|
|
573
|
+
textDecoration: "underline"
|
|
574
|
+
}
|
|
575
|
+
});
|
|
576
|
+
|
|
577
|
+
const containerStyle$2 = css({
|
|
578
|
+
marginBottom: "1.5rem"
|
|
579
|
+
});
|
|
580
|
+
const titleStyle$3 = css({
|
|
581
|
+
margin: "0 0 0.75rem",
|
|
582
|
+
fontSize: "var(--omnispec-h3-font-size)",
|
|
583
|
+
color: "var(--omnispec-h3-color)",
|
|
584
|
+
fontWeight: 600
|
|
585
|
+
});
|
|
586
|
+
const tabStripStyle = css({
|
|
587
|
+
display: "flex",
|
|
588
|
+
flexWrap: "wrap",
|
|
589
|
+
gap: "0.25rem",
|
|
590
|
+
marginBottom: "0.5rem"
|
|
591
|
+
});
|
|
592
|
+
const tabStyle = css({
|
|
593
|
+
padding: "0.25rem 0.75rem",
|
|
594
|
+
border: "none",
|
|
595
|
+
borderRadius: "var(--omnispec-border-radius)",
|
|
596
|
+
backgroundColor: "var(--omnispec-bg-tertiary)",
|
|
597
|
+
color: "var(--omnispec-fg-secondary)",
|
|
598
|
+
fontSize: "var(--omnispec-font-size-sm)",
|
|
599
|
+
fontFamily: "var(--omnispec-font-mono)",
|
|
600
|
+
cursor: "pointer",
|
|
601
|
+
"&:hover": {
|
|
602
|
+
color: "var(--omnispec-fg-primary)"
|
|
603
|
+
}
|
|
604
|
+
});
|
|
605
|
+
const tabActiveStyle = css({
|
|
606
|
+
backgroundColor: "var(--omnispec-color-primary)",
|
|
607
|
+
color: "#ffffff",
|
|
608
|
+
"&:hover": {
|
|
609
|
+
color: "#ffffff"
|
|
610
|
+
}
|
|
611
|
+
});
|
|
612
|
+
const cardStyle$1 = css({
|
|
613
|
+
padding: "0.75rem",
|
|
614
|
+
border: "1px solid var(--omnispec-border-color)",
|
|
615
|
+
borderRadius: "var(--omnispec-border-radius)",
|
|
616
|
+
backgroundColor: "var(--omnispec-bg-secondary)",
|
|
617
|
+
"&:hover": {
|
|
618
|
+
borderColor: "var(--omnispec-color-primary)"
|
|
619
|
+
}
|
|
620
|
+
});
|
|
621
|
+
const cardHeaderStyle = css({
|
|
622
|
+
display: "flex",
|
|
623
|
+
alignItems: "center",
|
|
624
|
+
gap: "0.5rem",
|
|
625
|
+
marginBottom: "0.375rem"
|
|
626
|
+
});
|
|
627
|
+
const serverNameStyle = css({
|
|
628
|
+
fontWeight: 600,
|
|
629
|
+
fontSize: "var(--omnispec-font-size-sm)",
|
|
630
|
+
color: "var(--omnispec-fg-primary)"
|
|
631
|
+
});
|
|
632
|
+
const urlStyle = css({
|
|
633
|
+
fontFamily: "var(--omnispec-font-mono)",
|
|
634
|
+
fontSize: "var(--omnispec-font-size-sm)",
|
|
635
|
+
color: "var(--omnispec-fg-code)",
|
|
636
|
+
display: "block",
|
|
637
|
+
marginBottom: "0.25rem"
|
|
638
|
+
});
|
|
639
|
+
const descriptionStyle = css({
|
|
640
|
+
margin: "0.25rem 0 0",
|
|
641
|
+
fontSize: "var(--omnispec-font-size-xs)",
|
|
642
|
+
color: "var(--omnispec-fg-secondary)"
|
|
643
|
+
});
|
|
644
|
+
const variablesStyle = css({
|
|
645
|
+
marginTop: "0.5rem",
|
|
646
|
+
fontSize: "var(--omnispec-font-size-xs)"
|
|
647
|
+
});
|
|
648
|
+
const varRowStyle = css({
|
|
649
|
+
display: "flex",
|
|
650
|
+
gap: "0.375rem",
|
|
651
|
+
marginBottom: "0.125rem"
|
|
652
|
+
});
|
|
653
|
+
const varNameStyle = css({
|
|
654
|
+
fontFamily: "var(--omnispec-font-mono)",
|
|
655
|
+
color: "var(--omnispec-fg-primary)",
|
|
656
|
+
fontWeight: 600
|
|
657
|
+
});
|
|
658
|
+
const varDefaultStyle = css({
|
|
659
|
+
fontFamily: "var(--omnispec-font-mono)",
|
|
660
|
+
color: "var(--omnispec-fg-muted)"
|
|
661
|
+
});
|
|
662
|
+
const varDescStyle = css({
|
|
663
|
+
color: "var(--omnispec-fg-secondary)"
|
|
664
|
+
});
|
|
665
|
+
const varEnumStyle = css({
|
|
666
|
+
fontFamily: "var(--omnispec-font-mono)",
|
|
667
|
+
color: "var(--omnispec-color-info)"
|
|
668
|
+
});
|
|
669
|
+
const varTokenStyle = css({
|
|
670
|
+
color: "var(--omnispec-color-primary)",
|
|
671
|
+
backgroundColor: "color-mix(in srgb, var(--omnispec-color-primary) 12%, transparent)",
|
|
672
|
+
borderRadius: "var(--omnispec-border-radius)",
|
|
673
|
+
padding: "0 0.125rem",
|
|
674
|
+
"&::before": { content: '"{"' },
|
|
675
|
+
"&::after": { content: '"}"' }
|
|
676
|
+
});
|
|
677
|
+
function highlightVariables(url) {
|
|
678
|
+
const parts = url.split(/(\{[^}]+\})/g);
|
|
679
|
+
return parts.map(
|
|
680
|
+
(part, i) => /^\{[^}]+\}$/.test(part) ? /* @__PURE__ */ jsx("span", { className: varTokenStyle, children: part.slice(1, -1) }, i) : /* @__PURE__ */ jsx("span", { children: part }, i)
|
|
681
|
+
);
|
|
682
|
+
}
|
|
683
|
+
function ServerCard({ server }) {
|
|
684
|
+
return /* @__PURE__ */ jsxs("div", { className: cardStyle$1, children: [
|
|
685
|
+
/* @__PURE__ */ jsxs("div", { className: cardHeaderStyle, children: [
|
|
686
|
+
/* @__PURE__ */ jsx("span", { className: serverNameStyle, children: server.name }),
|
|
687
|
+
/* @__PURE__ */ jsx(ProtocolBadge, { protocol: server.protocol, version: server.protocolVersion })
|
|
688
|
+
] }),
|
|
689
|
+
/* @__PURE__ */ jsx("code", { className: urlStyle, children: highlightVariables(server.url) }),
|
|
690
|
+
server.description && /* @__PURE__ */ jsx("p", { className: descriptionStyle, children: server.description }),
|
|
691
|
+
server.variables && Object.entries(server.variables).length > 0 && /* @__PURE__ */ jsx("div", { className: variablesStyle, children: Object.entries(server.variables).map(([name, variable]) => /* @__PURE__ */ jsxs("div", { className: varRowStyle, children: [
|
|
692
|
+
/* @__PURE__ */ jsx("code", { className: varNameStyle, children: name }),
|
|
693
|
+
variable.default && /* @__PURE__ */ jsxs("span", { className: varDefaultStyle, children: [
|
|
694
|
+
"= ",
|
|
695
|
+
variable.default
|
|
696
|
+
] }),
|
|
697
|
+
variable.enum && variable.enum.length > 0 && /* @__PURE__ */ jsxs("span", { className: varEnumStyle, children: [
|
|
698
|
+
"enum: ",
|
|
699
|
+
variable.enum.join(" | ")
|
|
700
|
+
] }),
|
|
701
|
+
variable.description && /* @__PURE__ */ jsx("span", { className: varDescStyle, children: variable.description })
|
|
702
|
+
] }, name)) }),
|
|
703
|
+
/* @__PURE__ */ jsx(SecurityRequirementBadges, { names: server.securityNames }),
|
|
704
|
+
/* @__PURE__ */ jsx(BindingsSection, { bindings: server.bindings, title: "Server Bindings" })
|
|
705
|
+
] });
|
|
706
|
+
}
|
|
707
|
+
function ServerList({ servers }) {
|
|
708
|
+
const [selected, setSelected] = useState(0);
|
|
709
|
+
if (servers.length === 0) return null;
|
|
710
|
+
const activeIndex = Math.min(selected, servers.length - 1);
|
|
711
|
+
return /* @__PURE__ */ jsxs("div", { className: cx("omnispec-async-servers", containerStyle$2), children: [
|
|
712
|
+
/* @__PURE__ */ jsx("h3", { className: titleStyle$3, children: "Servers" }),
|
|
713
|
+
servers.length > 1 ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
714
|
+
/* @__PURE__ */ jsx("div", { className: tabStripStyle, role: "tablist", "aria-label": "Servers", children: servers.map((server, idx) => /* @__PURE__ */ jsx(
|
|
715
|
+
"button",
|
|
716
|
+
{
|
|
717
|
+
type: "button",
|
|
718
|
+
role: "tab",
|
|
719
|
+
"aria-selected": idx === activeIndex,
|
|
720
|
+
className: cx(tabStyle, idx === activeIndex && tabActiveStyle),
|
|
721
|
+
onClick: () => setSelected(idx),
|
|
722
|
+
children: server.name
|
|
723
|
+
},
|
|
724
|
+
server.name
|
|
725
|
+
)) }),
|
|
726
|
+
/* @__PURE__ */ jsx(ServerCard, { server: servers[activeIndex] })
|
|
727
|
+
] }) : /* @__PURE__ */ jsx(ServerCard, { server: servers[0] })
|
|
728
|
+
] });
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
function detectSchemaFormat(schemaFormat) {
|
|
732
|
+
if (!schemaFormat) return "json";
|
|
733
|
+
const f = schemaFormat.toLowerCase();
|
|
734
|
+
if (f.includes("avro")) return "avro";
|
|
735
|
+
if (f.includes("protobuf") || f.includes("proto")) return "protobuf";
|
|
736
|
+
return "json";
|
|
737
|
+
}
|
|
738
|
+
function avroToJsonSchema(avro) {
|
|
739
|
+
return convert(avro);
|
|
740
|
+
}
|
|
741
|
+
function convert(node) {
|
|
742
|
+
if (typeof node === "string") return primitive(node);
|
|
743
|
+
if (Array.isArray(node)) {
|
|
744
|
+
const nonNull = node.filter((n) => n !== "null");
|
|
745
|
+
const nullable = node.length !== nonNull.length;
|
|
746
|
+
if (nonNull.length === 1) {
|
|
747
|
+
return { ...convert(nonNull[0]), nullable };
|
|
748
|
+
}
|
|
749
|
+
return { oneOf: nonNull.map(convert), nullable };
|
|
750
|
+
}
|
|
751
|
+
if (node && typeof node === "object") {
|
|
752
|
+
const obj = node;
|
|
753
|
+
const type = obj.type;
|
|
754
|
+
if (type === "record") {
|
|
755
|
+
const fields = obj.fields ?? [];
|
|
756
|
+
const properties = {};
|
|
757
|
+
const required = [];
|
|
758
|
+
for (const field of fields) {
|
|
759
|
+
const name = field.name;
|
|
760
|
+
const schema = convert(field.type);
|
|
761
|
+
if (field.doc) schema.description = field.doc;
|
|
762
|
+
if (field.default !== void 0) schema.default = field.default;
|
|
763
|
+
properties[name] = schema;
|
|
764
|
+
if (field.default === void 0 && !schema.nullable) required.push(name);
|
|
765
|
+
}
|
|
766
|
+
const result = { type: "object", properties };
|
|
767
|
+
if (obj.doc) result.description = obj.doc;
|
|
768
|
+
if (required.length > 0) result.required = required;
|
|
769
|
+
return result;
|
|
770
|
+
}
|
|
771
|
+
if (type === "enum") {
|
|
772
|
+
return { type: "string", enum: obj.symbols ?? [] };
|
|
773
|
+
}
|
|
774
|
+
if (type === "array") {
|
|
775
|
+
return { type: "array", items: convert(obj.items) };
|
|
776
|
+
}
|
|
777
|
+
if (type === "map") {
|
|
778
|
+
return { type: "object", additionalProperties: convert(obj.values) };
|
|
779
|
+
}
|
|
780
|
+
if (type === "fixed") {
|
|
781
|
+
return { type: "string", format: `fixed(${obj.size ?? "?"})` };
|
|
782
|
+
}
|
|
783
|
+
if (typeof type === "string") {
|
|
784
|
+
const base = primitive(type);
|
|
785
|
+
if (obj.logicalType) base.format = String(obj.logicalType);
|
|
786
|
+
return base;
|
|
787
|
+
}
|
|
788
|
+
if (type && typeof type === "object") return convert(type);
|
|
789
|
+
}
|
|
790
|
+
return { type: "object" };
|
|
791
|
+
}
|
|
792
|
+
const AVRO_PRIMITIVES = {
|
|
793
|
+
null: { type: "null" },
|
|
794
|
+
boolean: { type: "boolean" },
|
|
795
|
+
int: { type: "integer", format: "int32" },
|
|
796
|
+
long: { type: "integer", format: "int64" },
|
|
797
|
+
float: { type: "number", format: "float" },
|
|
798
|
+
double: { type: "number", format: "double" },
|
|
799
|
+
bytes: { type: "string", format: "byte" },
|
|
800
|
+
string: { type: "string" }
|
|
801
|
+
};
|
|
802
|
+
function primitive(name) {
|
|
803
|
+
return { ...AVRO_PRIMITIVES[name] ?? { type: name } };
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
function MessagePayload({ message, idx }) {
|
|
807
|
+
const rawPayload = message.payload;
|
|
808
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
809
|
+
message.schemaFormat && /* @__PURE__ */ jsx("span", { className: schemaFormatBadgeStyle, children: message.schemaFormat }),
|
|
810
|
+
rawPayload && /* @__PURE__ */ jsx(PayloadBody, { rawPayload, schemaFormat: message.schemaFormat, message, idx })
|
|
811
|
+
] });
|
|
812
|
+
}
|
|
813
|
+
function PayloadBody({
|
|
814
|
+
rawPayload,
|
|
815
|
+
schemaFormat,
|
|
816
|
+
message,
|
|
817
|
+
idx
|
|
818
|
+
}) {
|
|
819
|
+
if (typeof rawPayload.$ref === "string") {
|
|
820
|
+
return /* @__PURE__ */ jsxs("div", { className: unresolvedRefStyle, role: "alert", children: [
|
|
821
|
+
/* @__PURE__ */ jsx(Icon, { name: "warning", size: "0.875rem" }),
|
|
822
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
823
|
+
"Unresolved reference: ",
|
|
824
|
+
/* @__PURE__ */ jsx("code", { className: unresolvedRefCodeStyle, children: rawPayload.$ref })
|
|
825
|
+
] })
|
|
826
|
+
] });
|
|
827
|
+
}
|
|
828
|
+
const schema = detectSchemaFormat(schemaFormat) === "avro" ? avroToJsonSchema(rawPayload) : rawPayload;
|
|
829
|
+
return /* @__PURE__ */ jsx(
|
|
830
|
+
Tabs,
|
|
831
|
+
{
|
|
832
|
+
tabs: [
|
|
833
|
+
{
|
|
834
|
+
id: `schema-${idx}`,
|
|
835
|
+
label: "Payload Schema",
|
|
836
|
+
content: /* @__PURE__ */ jsx(SchemaTree, { nodes: schemaToNodes(schema) })
|
|
837
|
+
},
|
|
838
|
+
{
|
|
839
|
+
id: `example-${idx}`,
|
|
840
|
+
label: "Example",
|
|
841
|
+
content: /* @__PURE__ */ jsx(MessageExample, { message, schema })
|
|
842
|
+
}
|
|
843
|
+
]
|
|
844
|
+
}
|
|
845
|
+
);
|
|
846
|
+
}
|
|
847
|
+
function MessageExample({ message, schema }) {
|
|
848
|
+
const named = (message.examples ?? []).filter((ex) => ex.payload !== void 0).map((ex, i) => ({
|
|
849
|
+
name: ex.name ?? `example ${i + 1}`,
|
|
850
|
+
summary: ex.summary,
|
|
851
|
+
value: ex.payload
|
|
852
|
+
}));
|
|
853
|
+
const [selectedName, setSelectedName] = useState(named[0]?.name ?? "");
|
|
854
|
+
const active = named.find((ex) => ex.name === selectedName) ?? named[0];
|
|
855
|
+
const exampleSchema = schema ?? message.payload;
|
|
856
|
+
const code = active?.value !== void 0 ? JSON.stringify(active.value, null, 2) : exampleSchema ? JSON.stringify(generateExample(exampleSchema), null, 2) : "{}";
|
|
857
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
858
|
+
/* @__PURE__ */ jsx(ExampleSelector, { examples: named, selectedName: selectedName || (named[0]?.name ?? ""), onSelect: setSelectedName }),
|
|
859
|
+
/* @__PURE__ */ jsx(CodeBlock, { code, language: "json" })
|
|
860
|
+
] });
|
|
861
|
+
}
|
|
862
|
+
const schemaFormatBadgeStyle = css({
|
|
863
|
+
display: "inline-block",
|
|
864
|
+
fontFamily: "var(--omnispec-font-mono)",
|
|
865
|
+
fontSize: "var(--omnispec-font-size-xxs)",
|
|
866
|
+
color: "var(--omnispec-fg-secondary)",
|
|
867
|
+
backgroundColor: "var(--omnispec-bg-tertiary)",
|
|
868
|
+
padding: "0.0625rem 0.375rem",
|
|
869
|
+
borderRadius: "var(--omnispec-border-radius)",
|
|
870
|
+
marginBottom: "0.5rem"
|
|
871
|
+
});
|
|
872
|
+
const unresolvedRefStyle = css({
|
|
873
|
+
display: "flex",
|
|
874
|
+
alignItems: "center",
|
|
875
|
+
gap: "0.5rem",
|
|
876
|
+
padding: "0.5rem 0.75rem",
|
|
877
|
+
borderRadius: "var(--omnispec-border-radius)",
|
|
878
|
+
backgroundColor: "color-mix(in srgb, var(--omnispec-color-warning) 12%, transparent)",
|
|
879
|
+
color: "var(--omnispec-color-warning)",
|
|
880
|
+
fontSize: "var(--omnispec-font-size-sm)"
|
|
881
|
+
});
|
|
882
|
+
const unresolvedRefCodeStyle = css({
|
|
883
|
+
fontFamily: "var(--omnispec-font-mono)",
|
|
884
|
+
fontSize: "var(--omnispec-font-size-xs)"
|
|
885
|
+
});
|
|
886
|
+
|
|
887
|
+
const actionLabels = {
|
|
888
|
+
publish: "PUB",
|
|
889
|
+
subscribe: "SUB",
|
|
890
|
+
send: "SEND",
|
|
891
|
+
receive: "RECV"
|
|
892
|
+
};
|
|
893
|
+
const actionColors = {
|
|
894
|
+
publish: "var(--omnispec-color-publish)",
|
|
895
|
+
subscribe: "var(--omnispec-color-subscribe)",
|
|
896
|
+
send: "var(--omnispec-color-publish)",
|
|
897
|
+
receive: "var(--omnispec-color-subscribe)"
|
|
898
|
+
};
|
|
899
|
+
function ChannelDetail({ channel, id, expandAll, expandGeneration }) {
|
|
900
|
+
const primaryAction = channel.operations[0]?.action;
|
|
901
|
+
const primaryLabel = actionLabels[primaryAction] ?? primaryAction?.toUpperCase() ?? "";
|
|
902
|
+
const primaryColor = actionColors[primaryAction] ?? "var(--omnispec-fg-muted)";
|
|
903
|
+
return /* @__PURE__ */ jsxs(
|
|
904
|
+
ExpandableCard,
|
|
905
|
+
{
|
|
906
|
+
id,
|
|
907
|
+
title: channel.address,
|
|
908
|
+
rightLabel: `${channel.operations.length} ${channel.operations.length === 1 ? "operation" : "operations"}`,
|
|
909
|
+
expandAll,
|
|
910
|
+
expandGeneration,
|
|
911
|
+
children: [
|
|
912
|
+
/* @__PURE__ */ jsx(MethodBar, { label: primaryLabel, path: channel.address, color: primaryColor }),
|
|
913
|
+
/* @__PURE__ */ jsxs("div", { className: bodyStyle, children: [
|
|
914
|
+
channel.description && /* @__PURE__ */ jsx("div", { className: sectionStyle, children: /* @__PURE__ */ jsx(MarkdownRenderer, { content: channel.description }) }),
|
|
915
|
+
channel.parameters && Object.keys(channel.parameters).length > 0 && /* @__PURE__ */ jsxs("div", { className: sectionStyle, children: [
|
|
916
|
+
/* @__PURE__ */ jsx("h4", { className: sectionTitleStyle, children: "Parameters" }),
|
|
917
|
+
/* @__PURE__ */ jsx("div", { className: paramListStyle, children: Object.entries(channel.parameters).map(([name, param]) => {
|
|
918
|
+
const schema = param.schema ?? {};
|
|
919
|
+
const paramType = schema.type;
|
|
920
|
+
const paramFormat = schema.format;
|
|
921
|
+
const paramEnum = schema.enum;
|
|
922
|
+
const constraintBadges = buildConstraints(schema);
|
|
923
|
+
return /* @__PURE__ */ jsxs("div", { className: paramRowStyle, children: [
|
|
924
|
+
/* @__PURE__ */ jsxs("div", { className: paramHeaderStyle, children: [
|
|
925
|
+
/* @__PURE__ */ jsx("span", { className: paramNameStyle, children: name }),
|
|
926
|
+
paramType && /* @__PURE__ */ jsx("pre", { className: typeBadgeStyle$1, children: paramType })
|
|
927
|
+
] }),
|
|
928
|
+
(paramFormat || constraintBadges.length > 0 || paramEnum && paramEnum.length > 0) && /* @__PURE__ */ jsxs("div", { className: paramConstraintsStyle, children: [
|
|
929
|
+
paramFormat && /* @__PURE__ */ jsx(SchemaBadge, { variant: "constraint", children: paramFormat }),
|
|
930
|
+
constraintBadges.map((c) => /* @__PURE__ */ jsx(SchemaBadge, { variant: "constraint", children: c }, c)),
|
|
931
|
+
paramEnum && paramEnum.length > 0 && /* @__PURE__ */ jsxs(SchemaBadge, { variant: "enum", children: [
|
|
932
|
+
"enum: ",
|
|
933
|
+
paramEnum.map(String).join(" | ")
|
|
934
|
+
] })
|
|
935
|
+
] }),
|
|
936
|
+
param.description && /* @__PURE__ */ jsx("p", { className: paramDescStyle, children: param.description })
|
|
937
|
+
] }, name);
|
|
938
|
+
}) })
|
|
939
|
+
] }),
|
|
940
|
+
/* @__PURE__ */ jsx(BindingsSection, { bindings: channel.bindings, title: "Channel Bindings" }),
|
|
941
|
+
channel.operations.map((op, idx) => /* @__PURE__ */ jsxs("div", { id: id ? `${id}-op-${idx}` : void 0, className: operationStyle, children: [
|
|
942
|
+
/* @__PURE__ */ jsxs("div", { className: opHeaderStyle, children: [
|
|
943
|
+
/* @__PURE__ */ jsx(
|
|
944
|
+
"span",
|
|
945
|
+
{
|
|
946
|
+
className: cx(actionBadgeBase, css({
|
|
947
|
+
backgroundColor: actionColors[op.action] ?? "var(--omnispec-fg-muted)"
|
|
948
|
+
})),
|
|
949
|
+
children: actionLabels[op.action] ?? op.action.toUpperCase()
|
|
950
|
+
}
|
|
951
|
+
),
|
|
952
|
+
op.operationId && /* @__PURE__ */ jsx("span", { className: opIdStyle, children: op.operationId }),
|
|
953
|
+
op.summary && /* @__PURE__ */ jsx("span", { className: opSummaryStyle, children: op.summary })
|
|
954
|
+
] }),
|
|
955
|
+
op.tags && op.tags.length > 0 && /* @__PURE__ */ jsx("div", { className: tagChipsStyle, children: op.tags.map((tag) => /* @__PURE__ */ jsx("span", { className: tagChipStyle, title: tag.description, children: tag.name }, tag.name)) }),
|
|
956
|
+
op.description && /* @__PURE__ */ jsx("div", { className: sectionStyle, children: /* @__PURE__ */ jsx(MarkdownRenderer, { content: op.description }) }),
|
|
957
|
+
/* @__PURE__ */ jsx(SecurityRequirementBadges, { names: op.securityNames }),
|
|
958
|
+
/* @__PURE__ */ jsx(OperationMessages, { operation: op, idx }),
|
|
959
|
+
op.reply && op.reply.messages.length > 0 && /* @__PURE__ */ jsxs("div", { className: replyStyle, children: [
|
|
960
|
+
/* @__PURE__ */ jsx("h4", { className: replyTitleStyle, children: "Reply" }),
|
|
961
|
+
op.reply.messages.map((replyMsg, i) => /* @__PURE__ */ jsx(MessageView, { message: replyMsg, idx: `${idx}-reply-${i}` }, i))
|
|
962
|
+
] }),
|
|
963
|
+
/* @__PURE__ */ jsx(BindingsSection, { bindings: op.bindings, title: "Operation Bindings" })
|
|
964
|
+
] }, idx))
|
|
965
|
+
] })
|
|
966
|
+
]
|
|
967
|
+
}
|
|
968
|
+
);
|
|
969
|
+
}
|
|
970
|
+
function messageLabel(message, index) {
|
|
971
|
+
return message.title ?? message.name ?? `Message ${index + 1}`;
|
|
972
|
+
}
|
|
973
|
+
function OperationMessages({ operation, idx }) {
|
|
974
|
+
const messages = operation.messages ?? [];
|
|
975
|
+
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
976
|
+
if (messages.length === 0) return null;
|
|
977
|
+
const active = messages[Math.min(selectedIndex, messages.length - 1)];
|
|
978
|
+
return /* @__PURE__ */ jsxs("div", { className: sectionStyle, children: [
|
|
979
|
+
messages.length > 1 && /* @__PURE__ */ jsxs("div", { className: messageSelectorStyle, children: [
|
|
980
|
+
/* @__PURE__ */ jsx("label", { htmlFor: `msg-select-${idx}`, className: messageSelectorLabelStyle, children: "Message" }),
|
|
981
|
+
/* @__PURE__ */ jsx(
|
|
982
|
+
"select",
|
|
983
|
+
{
|
|
984
|
+
id: `msg-select-${idx}`,
|
|
985
|
+
className: messageSelectStyle,
|
|
986
|
+
value: selectedIndex,
|
|
987
|
+
onChange: (e) => setSelectedIndex(Number(e.target.value)),
|
|
988
|
+
children: messages.map((m, i) => /* @__PURE__ */ jsx("option", { value: i, children: messageLabel(m, i) }, i))
|
|
989
|
+
}
|
|
990
|
+
),
|
|
991
|
+
/* @__PURE__ */ jsxs("span", { className: messageCountStyle, children: [
|
|
992
|
+
messages.length,
|
|
993
|
+
" messages"
|
|
994
|
+
] })
|
|
995
|
+
] }),
|
|
996
|
+
/* @__PURE__ */ jsx(MessageView, { message: active, idx })
|
|
997
|
+
] });
|
|
998
|
+
}
|
|
999
|
+
function MessageView({ message, idx }) {
|
|
1000
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
1001
|
+
/* @__PURE__ */ jsxs("h4", { className: sectionTitleStyle, children: [
|
|
1002
|
+
"Message",
|
|
1003
|
+
(message.title ?? message.name) && /* @__PURE__ */ jsxs("span", { className: messageTitleStyle, children: [
|
|
1004
|
+
" \u2014 ",
|
|
1005
|
+
message.title ?? message.name
|
|
1006
|
+
] })
|
|
1007
|
+
] }),
|
|
1008
|
+
message.summary && /* @__PURE__ */ jsx("p", { className: messageSummaryStyle$1, children: message.summary }),
|
|
1009
|
+
message.contentType && /* @__PURE__ */ jsx("code", { className: contentTypeStyle$1, children: message.contentType }),
|
|
1010
|
+
/* @__PURE__ */ jsx(MessagePayload, { message, idx }),
|
|
1011
|
+
message.correlationId && /* @__PURE__ */ jsxs("div", { className: correlationIdStyle, children: [
|
|
1012
|
+
/* @__PURE__ */ jsx("span", { className: correlationIdLabelStyle, children: "correlationId" }),
|
|
1013
|
+
/* @__PURE__ */ jsx("code", { className: correlationIdLocationStyle, children: message.correlationId.location }),
|
|
1014
|
+
message.correlationId.description && /* @__PURE__ */ jsx("span", { className: correlationIdDescStyle, children: message.correlationId.description })
|
|
1015
|
+
] }),
|
|
1016
|
+
message.headers && /* @__PURE__ */ jsxs("div", { className: headersWrapStyle, children: [
|
|
1017
|
+
/* @__PURE__ */ jsx("h4", { className: sectionTitleStyle, children: "Headers" }),
|
|
1018
|
+
/* @__PURE__ */ jsx(SchemaTree, { nodes: schemaToNodes(message.headers) })
|
|
1019
|
+
] }),
|
|
1020
|
+
/* @__PURE__ */ jsx(BindingsSection, { bindings: message.bindings, title: "Message Bindings" })
|
|
1021
|
+
] });
|
|
1022
|
+
}
|
|
1023
|
+
const bodyStyle = css({
|
|
1024
|
+
padding: "0.75rem 1rem",
|
|
1025
|
+
[mq.desktop]: {
|
|
1026
|
+
padding: "1rem 1.25rem"
|
|
1027
|
+
}
|
|
1028
|
+
});
|
|
1029
|
+
const sectionStyle = css({
|
|
1030
|
+
marginBottom: "1.5rem"
|
|
1031
|
+
});
|
|
1032
|
+
const sectionTitleStyle = css({
|
|
1033
|
+
margin: "0 0 0.75rem",
|
|
1034
|
+
fontSize: "var(--omnispec-font-size-md)",
|
|
1035
|
+
fontWeight: 700,
|
|
1036
|
+
color: "var(--omnispec-fg-primary)",
|
|
1037
|
+
letterSpacing: "0.02em"
|
|
1038
|
+
});
|
|
1039
|
+
const paramListStyle = css({
|
|
1040
|
+
display: "flex",
|
|
1041
|
+
flexDirection: "column"
|
|
1042
|
+
});
|
|
1043
|
+
const paramRowStyle = css({
|
|
1044
|
+
padding: "0.75rem 0"
|
|
1045
|
+
});
|
|
1046
|
+
const paramHeaderStyle = css({
|
|
1047
|
+
display: "flex",
|
|
1048
|
+
alignItems: "center",
|
|
1049
|
+
gap: "0.5rem",
|
|
1050
|
+
flexWrap: "wrap"
|
|
1051
|
+
});
|
|
1052
|
+
const paramNameStyle = css({
|
|
1053
|
+
fontSize: "var(--omnispec-font-size-sm)",
|
|
1054
|
+
fontWeight: 700,
|
|
1055
|
+
backgroundColor: "transparent",
|
|
1056
|
+
padding: 0
|
|
1057
|
+
});
|
|
1058
|
+
const typeBadgeStyle$1 = css({
|
|
1059
|
+
fontSize: "var(--omnispec-font-size-xs)",
|
|
1060
|
+
fontWeight: 400
|
|
1061
|
+
});
|
|
1062
|
+
const paramDescStyle = css({
|
|
1063
|
+
margin: "0.25rem 0 0",
|
|
1064
|
+
fontSize: "var(--omnispec-font-size-base)",
|
|
1065
|
+
color: "var(--omnispec-fg-secondary)",
|
|
1066
|
+
lineHeight: 1.5
|
|
1067
|
+
});
|
|
1068
|
+
const paramConstraintsStyle = css({
|
|
1069
|
+
display: "flex",
|
|
1070
|
+
flexWrap: "wrap",
|
|
1071
|
+
gap: "0.375rem",
|
|
1072
|
+
marginTop: "0.375rem"
|
|
1073
|
+
});
|
|
1074
|
+
const operationStyle = css({
|
|
1075
|
+
padding: "0.75rem 0",
|
|
1076
|
+
borderTop: "1px solid var(--omnispec-border-color)"
|
|
1077
|
+
});
|
|
1078
|
+
const opHeaderStyle = css({
|
|
1079
|
+
display: "flex",
|
|
1080
|
+
alignItems: "center",
|
|
1081
|
+
gap: "0.5rem",
|
|
1082
|
+
marginBottom: "0.5rem"
|
|
1083
|
+
});
|
|
1084
|
+
const actionBadgeBase = css({
|
|
1085
|
+
display: "inline-block",
|
|
1086
|
+
padding: "0.125rem 0.375rem",
|
|
1087
|
+
borderRadius: "0.1875rem",
|
|
1088
|
+
fontSize: "0.5625rem",
|
|
1089
|
+
fontWeight: 700,
|
|
1090
|
+
fontFamily: "var(--omnispec-font-mono)",
|
|
1091
|
+
color: "#ffffff",
|
|
1092
|
+
letterSpacing: "0.0313rem"
|
|
1093
|
+
});
|
|
1094
|
+
const opIdStyle = css({
|
|
1095
|
+
fontSize: "var(--omnispec-font-size-sm)",
|
|
1096
|
+
fontWeight: 700,
|
|
1097
|
+
backgroundColor: "transparent",
|
|
1098
|
+
padding: 0
|
|
1099
|
+
});
|
|
1100
|
+
const opSummaryStyle = css({
|
|
1101
|
+
fontSize: "var(--omnispec-font-size-sm)",
|
|
1102
|
+
color: "var(--omnispec-fg-secondary)"
|
|
1103
|
+
});
|
|
1104
|
+
const messageTitleStyle = css({
|
|
1105
|
+
fontWeight: 400,
|
|
1106
|
+
color: "var(--omnispec-fg-primary)"
|
|
1107
|
+
});
|
|
1108
|
+
const messageSummaryStyle$1 = css({
|
|
1109
|
+
margin: "0 0 0.5rem",
|
|
1110
|
+
fontSize: "var(--omnispec-font-size-base)",
|
|
1111
|
+
color: "var(--omnispec-fg-secondary)"
|
|
1112
|
+
});
|
|
1113
|
+
const contentTypeStyle$1 = css({
|
|
1114
|
+
fontFamily: "var(--omnispec-font-mono)",
|
|
1115
|
+
fontSize: "var(--omnispec-font-size-xs)",
|
|
1116
|
+
color: "var(--omnispec-fg-muted)",
|
|
1117
|
+
display: "block",
|
|
1118
|
+
marginBottom: "0.5rem",
|
|
1119
|
+
backgroundColor: "transparent",
|
|
1120
|
+
padding: 0
|
|
1121
|
+
});
|
|
1122
|
+
const headersWrapStyle = css({
|
|
1123
|
+
marginTop: "1rem"
|
|
1124
|
+
});
|
|
1125
|
+
const messageSelectorStyle = css({
|
|
1126
|
+
display: "flex",
|
|
1127
|
+
alignItems: "center",
|
|
1128
|
+
gap: "0.5rem",
|
|
1129
|
+
flexWrap: "wrap",
|
|
1130
|
+
marginBottom: "0.75rem"
|
|
1131
|
+
});
|
|
1132
|
+
const messageSelectorLabelStyle = css({
|
|
1133
|
+
fontSize: "var(--omnispec-font-size-xs)",
|
|
1134
|
+
fontWeight: 600,
|
|
1135
|
+
color: "var(--omnispec-fg-muted)",
|
|
1136
|
+
textTransform: "uppercase",
|
|
1137
|
+
letterSpacing: "0.0313rem",
|
|
1138
|
+
whiteSpace: "nowrap"
|
|
1139
|
+
});
|
|
1140
|
+
const messageSelectStyle = css({
|
|
1141
|
+
padding: "0.375rem 0.625rem",
|
|
1142
|
+
border: "1px solid var(--omnispec-input-border)",
|
|
1143
|
+
borderRadius: "var(--omnispec-border-radius)",
|
|
1144
|
+
backgroundColor: "var(--omnispec-input-bg)",
|
|
1145
|
+
color: "var(--omnispec-fg-primary)",
|
|
1146
|
+
fontSize: "var(--omnispec-font-size-sm)",
|
|
1147
|
+
fontFamily: "var(--omnispec-font-mono)"
|
|
1148
|
+
});
|
|
1149
|
+
const messageCountStyle = css({
|
|
1150
|
+
fontSize: "var(--omnispec-font-size-xs)",
|
|
1151
|
+
color: "var(--omnispec-fg-muted)"
|
|
1152
|
+
});
|
|
1153
|
+
const correlationIdStyle = css({
|
|
1154
|
+
display: "flex",
|
|
1155
|
+
alignItems: "center",
|
|
1156
|
+
gap: "0.5rem",
|
|
1157
|
+
flexWrap: "wrap",
|
|
1158
|
+
marginTop: "0.75rem"
|
|
1159
|
+
});
|
|
1160
|
+
const correlationIdLabelStyle = css({
|
|
1161
|
+
fontSize: "var(--omnispec-font-size-xs)",
|
|
1162
|
+
fontWeight: 700,
|
|
1163
|
+
color: "var(--omnispec-fg-primary)",
|
|
1164
|
+
fontFamily: "var(--omnispec-font-mono)"
|
|
1165
|
+
});
|
|
1166
|
+
const correlationIdLocationStyle = css({
|
|
1167
|
+
fontFamily: "var(--omnispec-font-mono)",
|
|
1168
|
+
fontSize: "var(--omnispec-font-size-xs)",
|
|
1169
|
+
color: "var(--omnispec-fg-code)",
|
|
1170
|
+
backgroundColor: "var(--omnispec-bg-tertiary)",
|
|
1171
|
+
padding: "1px 0.375rem",
|
|
1172
|
+
borderRadius: "0.1875rem"
|
|
1173
|
+
});
|
|
1174
|
+
const correlationIdDescStyle = css({
|
|
1175
|
+
fontSize: "var(--omnispec-font-size-xs)",
|
|
1176
|
+
color: "var(--omnispec-fg-secondary)"
|
|
1177
|
+
});
|
|
1178
|
+
const replyStyle = css({
|
|
1179
|
+
marginTop: "1rem",
|
|
1180
|
+
paddingLeft: "0.75rem",
|
|
1181
|
+
borderLeft: "0.125rem solid var(--omnispec-border-color)"
|
|
1182
|
+
});
|
|
1183
|
+
const replyTitleStyle = css({
|
|
1184
|
+
margin: "0 0 0.5rem",
|
|
1185
|
+
fontSize: "var(--omnispec-font-size-md)",
|
|
1186
|
+
fontWeight: 700,
|
|
1187
|
+
color: "var(--omnispec-fg-primary)",
|
|
1188
|
+
letterSpacing: "0.02em"
|
|
1189
|
+
});
|
|
1190
|
+
const tagChipsStyle = css({
|
|
1191
|
+
display: "flex",
|
|
1192
|
+
flexWrap: "wrap",
|
|
1193
|
+
gap: "0.25rem",
|
|
1194
|
+
marginBottom: "0.5rem"
|
|
1195
|
+
});
|
|
1196
|
+
const tagChipStyle = css({
|
|
1197
|
+
fontSize: "var(--omnispec-font-size-xxs)",
|
|
1198
|
+
fontFamily: "var(--omnispec-font-mono)",
|
|
1199
|
+
color: "var(--omnispec-fg-secondary)",
|
|
1200
|
+
backgroundColor: "var(--omnispec-bg-tertiary)",
|
|
1201
|
+
padding: "1px 0.5rem",
|
|
1202
|
+
borderRadius: "0.625rem"
|
|
1203
|
+
});
|
|
1204
|
+
|
|
1205
|
+
function ComponentsSection({ components }) {
|
|
1206
|
+
const schemas = Object.entries(components.schemas);
|
|
1207
|
+
const messages = Object.entries(components.messages ?? {});
|
|
1208
|
+
if (schemas.length === 0 && messages.length === 0) return null;
|
|
1209
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1210
|
+
messages.length > 0 && /* @__PURE__ */ jsxs("div", { className: `omnispec-async-messages ${containerStyle$1}`, id: "messages", children: [
|
|
1211
|
+
/* @__PURE__ */ jsx("h2", { className: titleStyle$2, children: "Messages" }),
|
|
1212
|
+
/* @__PURE__ */ jsx("div", { className: schemaWrapperStyle, children: messages.map(([name, message]) => /* @__PURE__ */ jsx("div", { className: schemaStyle, id: `message-${name}`, children: /* @__PURE__ */ jsxs(
|
|
1213
|
+
Collapsible,
|
|
1214
|
+
{
|
|
1215
|
+
title: /* @__PURE__ */ jsx("code", { className: schemaNameStyle, children: name }),
|
|
1216
|
+
defaultOpen: false,
|
|
1217
|
+
children: [
|
|
1218
|
+
message.title && /* @__PURE__ */ jsx("p", { className: messageSummaryStyle, children: message.title }),
|
|
1219
|
+
message.summary && /* @__PURE__ */ jsx("p", { className: messageSummaryStyle, children: message.summary }),
|
|
1220
|
+
message.contentType && /* @__PURE__ */ jsx("code", { className: contentTypeStyle, children: message.contentType }),
|
|
1221
|
+
/* @__PURE__ */ jsx(MessagePayload, { message, idx: `message-${name}` }),
|
|
1222
|
+
message.headers && /* @__PURE__ */ jsx(SchemaTree, { nodes: schemaToNodes(message.headers) })
|
|
1223
|
+
]
|
|
1224
|
+
}
|
|
1225
|
+
) }, name)) })
|
|
1226
|
+
] }),
|
|
1227
|
+
schemas.length > 0 && /* @__PURE__ */ jsxs("div", { className: `omnispec-async-components ${containerStyle$1}`, id: "schemas", children: [
|
|
1228
|
+
/* @__PURE__ */ jsx("h2", { className: titleStyle$2, children: "Schemas" }),
|
|
1229
|
+
/* @__PURE__ */ jsx("div", { className: schemaWrapperStyle, children: schemas.map(([name, schema]) => /* @__PURE__ */ jsx("div", { className: schemaStyle, id: `schema-${name}`, children: /* @__PURE__ */ jsx(
|
|
1230
|
+
Collapsible,
|
|
1231
|
+
{
|
|
1232
|
+
title: /* @__PURE__ */ jsx("code", { className: schemaNameStyle, children: name }),
|
|
1233
|
+
defaultOpen: false,
|
|
1234
|
+
children: /* @__PURE__ */ jsx(SchemaTree, { nodes: schemaToNodes(schema) })
|
|
1235
|
+
}
|
|
1236
|
+
) }, name)) })
|
|
1237
|
+
] })
|
|
1238
|
+
] });
|
|
1239
|
+
}
|
|
1240
|
+
const containerStyle$1 = css({
|
|
1241
|
+
marginTop: "2rem",
|
|
1242
|
+
paddingTop: "1.5rem",
|
|
1243
|
+
borderTop: "1px solid var(--omnispec-border-color)",
|
|
1244
|
+
[mq.mobile]: {
|
|
1245
|
+
borderTop: "none",
|
|
1246
|
+
marginTop: "1.5rem",
|
|
1247
|
+
paddingTop: "1rem"
|
|
1248
|
+
}
|
|
1249
|
+
});
|
|
1250
|
+
const titleStyle$2 = css({
|
|
1251
|
+
margin: "0 0 1rem",
|
|
1252
|
+
fontSize: "var(--omnispec-h2-font-size)",
|
|
1253
|
+
color: "var(--omnispec-h2-color)",
|
|
1254
|
+
fontWeight: 700
|
|
1255
|
+
});
|
|
1256
|
+
const schemaWrapperStyle = css({
|
|
1257
|
+
border: "1px solid var(--omnispec-border-color)",
|
|
1258
|
+
borderRadius: "0.5rem",
|
|
1259
|
+
padding: "1.5rem 1rem"
|
|
1260
|
+
});
|
|
1261
|
+
const schemaStyle = css({
|
|
1262
|
+
marginBottom: "0.5rem"
|
|
1263
|
+
});
|
|
1264
|
+
const schemaNameStyle = css({
|
|
1265
|
+
fontFamily: "var(--omnispec-font-mono)",
|
|
1266
|
+
fontSize: "var(--omnispec-font-size-base)",
|
|
1267
|
+
fontWeight: 600,
|
|
1268
|
+
color: "var(--omnispec-color-primary)",
|
|
1269
|
+
backgroundColor: "transparent",
|
|
1270
|
+
padding: 0,
|
|
1271
|
+
"&:hover": {
|
|
1272
|
+
textDecoration: "underline"
|
|
1273
|
+
}
|
|
1274
|
+
});
|
|
1275
|
+
const messageSummaryStyle = css({
|
|
1276
|
+
margin: "0 0 0.5rem",
|
|
1277
|
+
fontSize: "var(--omnispec-font-size-sm)",
|
|
1278
|
+
color: "var(--omnispec-fg-secondary)"
|
|
1279
|
+
});
|
|
1280
|
+
const contentTypeStyle = css({
|
|
1281
|
+
display: "block",
|
|
1282
|
+
fontFamily: "var(--omnispec-font-mono)",
|
|
1283
|
+
fontSize: "var(--omnispec-font-size-xs)",
|
|
1284
|
+
color: "var(--omnispec-fg-muted)",
|
|
1285
|
+
marginBottom: "0.5rem"
|
|
1286
|
+
});
|
|
1287
|
+
|
|
1288
|
+
const SPECIAL_KEYS = /* @__PURE__ */ new Set(["type", "description", "flows"]);
|
|
1289
|
+
function SecuritySchemesSection({ securitySchemes }) {
|
|
1290
|
+
const entries = Object.entries(securitySchemes ?? {});
|
|
1291
|
+
if (entries.length === 0) return null;
|
|
1292
|
+
return /* @__PURE__ */ jsxs("div", { className: `omnispec-async-security ${containerStyle}`, id: "security", children: [
|
|
1293
|
+
/* @__PURE__ */ jsx("h2", { className: titleStyle$1, children: "Security Schemes" }),
|
|
1294
|
+
/* @__PURE__ */ jsx("div", { className: listStyle, children: entries.map(([name, scheme]) => /* @__PURE__ */ jsxs("div", { className: cardStyle, id: `security-${name}`, children: [
|
|
1295
|
+
/* @__PURE__ */ jsxs("div", { className: headerStyle$1, children: [
|
|
1296
|
+
/* @__PURE__ */ jsx(Icon, { name: "lock", size: "0.875rem" }),
|
|
1297
|
+
/* @__PURE__ */ jsx("code", { className: nameStyle, children: name }),
|
|
1298
|
+
/* @__PURE__ */ jsx("span", { className: typeBadgeStyle, children: scheme.type })
|
|
1299
|
+
] }),
|
|
1300
|
+
scheme.description && /* @__PURE__ */ jsx("p", { className: descStyle$1, children: scheme.description }),
|
|
1301
|
+
/* @__PURE__ */ jsx(
|
|
1302
|
+
FieldRows,
|
|
1303
|
+
{
|
|
1304
|
+
fields: Object.entries(scheme).filter(
|
|
1305
|
+
([key, value]) => !SPECIAL_KEYS.has(key) && value !== void 0 && typeof value !== "object"
|
|
1306
|
+
)
|
|
1307
|
+
}
|
|
1308
|
+
),
|
|
1309
|
+
scheme.flows && Object.keys(scheme.flows).length > 0 && /* @__PURE__ */ jsx("div", { className: flowsStyle, children: Object.entries(scheme.flows).map(([flowName, flow]) => /* @__PURE__ */ jsx(OAuthFlow, { name: flowName, flow }, flowName)) })
|
|
1310
|
+
] }, name)) })
|
|
1311
|
+
] });
|
|
1312
|
+
}
|
|
1313
|
+
function OAuthFlow({ name, flow }) {
|
|
1314
|
+
const scopes = flow.availableScopes ?? flow.scopes ?? {};
|
|
1315
|
+
const urls = Object.entries(flow).filter(
|
|
1316
|
+
([key, value]) => key !== "availableScopes" && key !== "scopes" && typeof value === "string"
|
|
1317
|
+
);
|
|
1318
|
+
return /* @__PURE__ */ jsxs("div", { className: flowCardStyle, children: [
|
|
1319
|
+
/* @__PURE__ */ jsx("div", { className: flowNameStyle, children: name }),
|
|
1320
|
+
/* @__PURE__ */ jsx(FieldRows, { fields: urls }),
|
|
1321
|
+
Object.keys(scopes).length > 0 && /* @__PURE__ */ jsxs("div", { className: scopesStyle, children: [
|
|
1322
|
+
/* @__PURE__ */ jsx("span", { className: scopesLabelStyle, children: "Scopes" }),
|
|
1323
|
+
/* @__PURE__ */ jsx("ul", { className: scopeListStyle, children: Object.entries(scopes).map(([scope, desc]) => /* @__PURE__ */ jsxs("li", { className: scopeRowStyle, children: [
|
|
1324
|
+
/* @__PURE__ */ jsx("code", { className: scopeNameStyle, children: scope }),
|
|
1325
|
+
desc && /* @__PURE__ */ jsx("span", { className: scopeDescStyle, children: desc })
|
|
1326
|
+
] }, scope)) })
|
|
1327
|
+
] })
|
|
1328
|
+
] });
|
|
1329
|
+
}
|
|
1330
|
+
const containerStyle = css({
|
|
1331
|
+
marginTop: "1.5rem",
|
|
1332
|
+
paddingTop: "1rem",
|
|
1333
|
+
[mq.desktop]: {
|
|
1334
|
+
marginTop: "2rem",
|
|
1335
|
+
paddingTop: "1.5rem",
|
|
1336
|
+
borderTop: "1px solid var(--omnispec-border-color)"
|
|
1337
|
+
}
|
|
1338
|
+
});
|
|
1339
|
+
const titleStyle$1 = css({
|
|
1340
|
+
margin: "0 0 1rem",
|
|
1341
|
+
fontSize: "var(--omnispec-h2-font-size)",
|
|
1342
|
+
color: "var(--omnispec-h2-color)",
|
|
1343
|
+
fontWeight: 700
|
|
1344
|
+
});
|
|
1345
|
+
const listStyle = css({
|
|
1346
|
+
display: "flex",
|
|
1347
|
+
flexDirection: "column",
|
|
1348
|
+
gap: "0.75rem"
|
|
1349
|
+
});
|
|
1350
|
+
const cardStyle = css({
|
|
1351
|
+
padding: "0.75rem 0.875rem",
|
|
1352
|
+
borderRadius: "var(--omnispec-border-radius)",
|
|
1353
|
+
backgroundColor: "var(--omnispec-bg-secondary)"
|
|
1354
|
+
});
|
|
1355
|
+
const headerStyle$1 = css({
|
|
1356
|
+
display: "flex",
|
|
1357
|
+
alignItems: "center",
|
|
1358
|
+
gap: "0.5rem",
|
|
1359
|
+
marginBottom: "0.375rem"
|
|
1360
|
+
});
|
|
1361
|
+
const nameStyle = css({
|
|
1362
|
+
fontFamily: "var(--omnispec-font-mono)",
|
|
1363
|
+
fontSize: "var(--omnispec-font-size-sm)",
|
|
1364
|
+
fontWeight: 700,
|
|
1365
|
+
color: "var(--omnispec-color-primary)",
|
|
1366
|
+
backgroundColor: "transparent",
|
|
1367
|
+
padding: 0
|
|
1368
|
+
});
|
|
1369
|
+
const typeBadgeStyle = css({
|
|
1370
|
+
fontSize: "var(--omnispec-font-size-xxs)",
|
|
1371
|
+
fontFamily: "var(--omnispec-font-mono)",
|
|
1372
|
+
color: "var(--omnispec-fg-secondary)",
|
|
1373
|
+
backgroundColor: "var(--omnispec-bg-tertiary)",
|
|
1374
|
+
padding: "0.0625rem 0.375rem",
|
|
1375
|
+
borderRadius: "var(--omnispec-border-radius)"
|
|
1376
|
+
});
|
|
1377
|
+
const descStyle$1 = css({
|
|
1378
|
+
margin: "0 0 0.5rem",
|
|
1379
|
+
fontSize: "var(--omnispec-font-size-sm)",
|
|
1380
|
+
color: "var(--omnispec-fg-secondary)"
|
|
1381
|
+
});
|
|
1382
|
+
const flowsStyle = css({
|
|
1383
|
+
marginTop: "0.625rem",
|
|
1384
|
+
display: "flex",
|
|
1385
|
+
flexDirection: "column",
|
|
1386
|
+
gap: "0.5rem"
|
|
1387
|
+
});
|
|
1388
|
+
const flowCardStyle = css({
|
|
1389
|
+
padding: "0.5rem 0.625rem",
|
|
1390
|
+
borderRadius: "var(--omnispec-border-radius)",
|
|
1391
|
+
backgroundColor: "var(--omnispec-bg-tertiary)"
|
|
1392
|
+
});
|
|
1393
|
+
const flowNameStyle = css({
|
|
1394
|
+
fontFamily: "var(--omnispec-font-mono)",
|
|
1395
|
+
fontSize: "var(--omnispec-font-size-xs)",
|
|
1396
|
+
fontWeight: 700,
|
|
1397
|
+
color: "var(--omnispec-fg-primary)"
|
|
1398
|
+
});
|
|
1399
|
+
const scopesStyle = css({
|
|
1400
|
+
marginTop: "0.375rem"
|
|
1401
|
+
});
|
|
1402
|
+
const scopesLabelStyle = css({
|
|
1403
|
+
fontSize: "var(--omnispec-font-size-xxs)",
|
|
1404
|
+
fontWeight: 600,
|
|
1405
|
+
textTransform: "uppercase",
|
|
1406
|
+
letterSpacing: "0.05em",
|
|
1407
|
+
color: "var(--omnispec-fg-muted)"
|
|
1408
|
+
});
|
|
1409
|
+
const scopeListStyle = css({
|
|
1410
|
+
listStyle: "none",
|
|
1411
|
+
margin: "0.25rem 0 0",
|
|
1412
|
+
padding: 0,
|
|
1413
|
+
display: "flex",
|
|
1414
|
+
flexDirection: "column",
|
|
1415
|
+
gap: "0.125rem"
|
|
1416
|
+
});
|
|
1417
|
+
const scopeRowStyle = css({
|
|
1418
|
+
display: "flex",
|
|
1419
|
+
gap: "0.5rem",
|
|
1420
|
+
alignItems: "baseline",
|
|
1421
|
+
flexWrap: "wrap"
|
|
1422
|
+
});
|
|
1423
|
+
const scopeNameStyle = css({
|
|
1424
|
+
fontFamily: "var(--omnispec-font-mono)",
|
|
1425
|
+
fontSize: "var(--omnispec-font-size-xs)",
|
|
1426
|
+
color: "var(--omnispec-color-primary)"
|
|
1427
|
+
});
|
|
1428
|
+
const scopeDescStyle = css({
|
|
1429
|
+
fontSize: "var(--omnispec-font-size-xs)",
|
|
1430
|
+
color: "var(--omnispec-fg-secondary)"
|
|
1431
|
+
});
|
|
1432
|
+
|
|
1433
|
+
const UNTAGGED_LABEL = "Untagged";
|
|
1434
|
+
function slugify(value) {
|
|
1435
|
+
return value.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || "tag";
|
|
1436
|
+
}
|
|
1437
|
+
function channelTagNames(channel) {
|
|
1438
|
+
const names = /* @__PURE__ */ new Set();
|
|
1439
|
+
for (const op of channel.operations) {
|
|
1440
|
+
for (const tag of op.tags ?? []) names.add(tag.name);
|
|
1441
|
+
}
|
|
1442
|
+
return Array.from(names);
|
|
1443
|
+
}
|
|
1444
|
+
function hasAnyTags(channels) {
|
|
1445
|
+
return channels.some((ch) => channelTagNames(ch).length > 0);
|
|
1446
|
+
}
|
|
1447
|
+
function groupChannelsByTag(channels, specTags) {
|
|
1448
|
+
const byName = /* @__PURE__ */ new Map();
|
|
1449
|
+
const untagged = [];
|
|
1450
|
+
for (const channel of channels) {
|
|
1451
|
+
const names = channelTagNames(channel);
|
|
1452
|
+
if (names.length === 0) {
|
|
1453
|
+
untagged.push(channel);
|
|
1454
|
+
continue;
|
|
1455
|
+
}
|
|
1456
|
+
for (const name of names) {
|
|
1457
|
+
const list = byName.get(name) ?? [];
|
|
1458
|
+
list.push(channel);
|
|
1459
|
+
byName.set(name, list);
|
|
1460
|
+
}
|
|
1461
|
+
}
|
|
1462
|
+
const declared = (specTags ?? []).map((t) => t.name);
|
|
1463
|
+
const operationOnly = Array.from(byName.keys()).filter((name) => !declared.includes(name)).sort();
|
|
1464
|
+
const orderedNames = [...declared.filter((name) => byName.has(name)), ...operationOnly];
|
|
1465
|
+
const tagMetaByName = new Map((specTags ?? []).map((t) => [t.name, t]));
|
|
1466
|
+
const usedIds = /* @__PURE__ */ new Set();
|
|
1467
|
+
const uniqueId = (base) => {
|
|
1468
|
+
let id = base;
|
|
1469
|
+
let n = 2;
|
|
1470
|
+
while (usedIds.has(id)) id = `${base}-${n++}`;
|
|
1471
|
+
usedIds.add(id);
|
|
1472
|
+
return id;
|
|
1473
|
+
};
|
|
1474
|
+
const groups = orderedNames.map((name) => ({
|
|
1475
|
+
tag: tagMetaByName.get(name) ?? { name },
|
|
1476
|
+
id: uniqueId(slugify(name)),
|
|
1477
|
+
label: tagMetaByName.get(name)?.displayName ?? name,
|
|
1478
|
+
channels: byName.get(name) ?? []
|
|
1479
|
+
}));
|
|
1480
|
+
if (untagged.length > 0) {
|
|
1481
|
+
groups.push({ tag: void 0, id: uniqueId("untagged"), label: UNTAGGED_LABEL, channels: untagged });
|
|
1482
|
+
}
|
|
1483
|
+
return groups;
|
|
1484
|
+
}
|
|
1485
|
+
|
|
1486
|
+
function TagGroupHeader({ group }) {
|
|
1487
|
+
return /* @__PURE__ */ jsxs("div", { className: headerStyle, children: [
|
|
1488
|
+
/* @__PURE__ */ jsxs("h3", { className: titleStyle, children: [
|
|
1489
|
+
group.label,
|
|
1490
|
+
/* @__PURE__ */ jsx("span", { className: countStyle, children: group.channels.length })
|
|
1491
|
+
] }),
|
|
1492
|
+
group.tag?.description && /* @__PURE__ */ jsx("div", { className: descStyle, children: /* @__PURE__ */ jsx(MarkdownRenderer, { content: group.tag.description }) }),
|
|
1493
|
+
group.tag?.externalDocs && /* @__PURE__ */ jsxs(
|
|
1494
|
+
"a",
|
|
1495
|
+
{
|
|
1496
|
+
href: group.tag.externalDocs.url,
|
|
1497
|
+
target: "_blank",
|
|
1498
|
+
rel: "noopener noreferrer",
|
|
1499
|
+
className: docsStyle,
|
|
1500
|
+
children: [
|
|
1501
|
+
group.tag.externalDocs.description ?? "External docs",
|
|
1502
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: " \u2197" })
|
|
1503
|
+
]
|
|
1504
|
+
}
|
|
1505
|
+
)
|
|
1506
|
+
] });
|
|
1507
|
+
}
|
|
1508
|
+
const headerStyle = css({
|
|
1509
|
+
marginBottom: "0.75rem",
|
|
1510
|
+
paddingBottom: "0.5rem",
|
|
1511
|
+
borderBottom: "0.125rem solid var(--omnispec-border-color)"
|
|
1512
|
+
});
|
|
1513
|
+
const titleStyle = css({
|
|
1514
|
+
display: "flex",
|
|
1515
|
+
alignItems: "center",
|
|
1516
|
+
gap: "0.625rem",
|
|
1517
|
+
margin: 0,
|
|
1518
|
+
fontSize: "var(--omnispec-h3-font-size)",
|
|
1519
|
+
fontWeight: 800,
|
|
1520
|
+
color: "var(--omnispec-h3-color)"
|
|
1521
|
+
});
|
|
1522
|
+
const countStyle = css({
|
|
1523
|
+
fontSize: "var(--omnispec-font-size-xs)",
|
|
1524
|
+
fontWeight: 500,
|
|
1525
|
+
color: "var(--omnispec-fg-muted)",
|
|
1526
|
+
backgroundColor: "var(--omnispec-bg-tertiary)",
|
|
1527
|
+
padding: "0.125rem 0.5rem",
|
|
1528
|
+
borderRadius: "0.625rem",
|
|
1529
|
+
fontFamily: "var(--omnispec-font-mono)"
|
|
1530
|
+
});
|
|
1531
|
+
const descStyle = css({
|
|
1532
|
+
marginTop: "0.5rem",
|
|
1533
|
+
fontSize: "var(--omnispec-font-size-sm)",
|
|
1534
|
+
color: "var(--omnispec-fg-secondary)",
|
|
1535
|
+
lineHeight: 1.6
|
|
1536
|
+
});
|
|
1537
|
+
const docsStyle = css({
|
|
1538
|
+
display: "inline-flex",
|
|
1539
|
+
alignItems: "center",
|
|
1540
|
+
gap: "0.25rem",
|
|
1541
|
+
marginTop: "0.5rem",
|
|
1542
|
+
fontSize: "var(--omnispec-font-size-xs)",
|
|
1543
|
+
color: "var(--omnispec-fg-link)",
|
|
1544
|
+
textDecoration: "none",
|
|
1545
|
+
"&:hover": {
|
|
1546
|
+
textDecoration: "underline"
|
|
1547
|
+
}
|
|
1548
|
+
});
|
|
1549
|
+
|
|
1550
|
+
function AsyncApiSpec({
|
|
1551
|
+
spec,
|
|
1552
|
+
theme,
|
|
1553
|
+
layout = "sidebar",
|
|
1554
|
+
sidebarPosition = "left",
|
|
1555
|
+
defaultExpandOperations = false,
|
|
1556
|
+
downloadLink,
|
|
1557
|
+
sidebarNav,
|
|
1558
|
+
slots = {},
|
|
1559
|
+
schemaStyle,
|
|
1560
|
+
pro,
|
|
1561
|
+
onSpecLoaded,
|
|
1562
|
+
className
|
|
1563
|
+
}) {
|
|
1564
|
+
const resolvedSchemaStyle = resolveSchemaStyle(schemaStyle, pro?.advancedSchemaStyles ?? false);
|
|
1565
|
+
const { data: parsedSpec, state } = useAsyncApiSpec(spec);
|
|
1566
|
+
const [searchQuery, setSearchQuery] = useState("");
|
|
1567
|
+
const [allExpanded, setAllExpanded] = useState(defaultExpandOperations);
|
|
1568
|
+
const [expandGeneration, setExpandGeneration] = useState(0);
|
|
1569
|
+
const [navGrouping, setNavGrouping] = useState("channel");
|
|
1570
|
+
const handleToggleExpand = useCallback(() => {
|
|
1571
|
+
setAllExpanded((prev) => !prev);
|
|
1572
|
+
setExpandGeneration((prev) => prev + 1);
|
|
1573
|
+
}, []);
|
|
1574
|
+
useMemo(() => {
|
|
1575
|
+
if (parsedSpec && onSpecLoaded) {
|
|
1576
|
+
const major = parseInt(parsedSpec.specVersion.split(".")[0], 10);
|
|
1577
|
+
onSpecLoaded({
|
|
1578
|
+
title: parsedSpec.title,
|
|
1579
|
+
version: parsedSpec.version,
|
|
1580
|
+
type: major >= 3 ? SpecType.ASYNCAPI_3 : SpecType.ASYNCAPI_2
|
|
1581
|
+
});
|
|
1582
|
+
}
|
|
1583
|
+
}, [parsedSpec, onSpecLoaded]);
|
|
1584
|
+
const filteredChannels = useMemo(() => {
|
|
1585
|
+
if (!parsedSpec || !searchQuery.trim()) return parsedSpec?.channels ?? [];
|
|
1586
|
+
const q = searchQuery.toLowerCase();
|
|
1587
|
+
return parsedSpec.channels.filter(
|
|
1588
|
+
(ch) => ch.address.toLowerCase().includes(q) || ch.description?.toLowerCase().includes(q) || ch.operations.some(
|
|
1589
|
+
(op) => op.operationId?.toLowerCase().includes(q) || op.summary?.toLowerCase().includes(q) || (op.tags ?? []).some((t) => t.name.toLowerCase().includes(q))
|
|
1590
|
+
)
|
|
1591
|
+
);
|
|
1592
|
+
}, [parsedSpec, searchQuery]);
|
|
1593
|
+
const grouped = useMemo(() => hasAnyTags(filteredChannels), [filteredChannels]);
|
|
1594
|
+
const tagGroups = useMemo(
|
|
1595
|
+
() => grouped ? groupChannelsByTag(filteredChannels, parsedSpec?.tags) : [],
|
|
1596
|
+
[grouped, filteredChannels, parsedSpec]
|
|
1597
|
+
);
|
|
1598
|
+
const channelDomId = useMemo(() => {
|
|
1599
|
+
const map = /* @__PURE__ */ new Map();
|
|
1600
|
+
if (grouped) {
|
|
1601
|
+
for (const group of tagGroups) {
|
|
1602
|
+
for (const ch of group.channels) {
|
|
1603
|
+
if (!map.has(ch.name)) map.set(ch.name, `${group.id}-channel-${ch.name}`);
|
|
1604
|
+
}
|
|
1605
|
+
}
|
|
1606
|
+
} else {
|
|
1607
|
+
for (const ch of filteredChannels) map.set(ch.name, `channel-${ch.name}`);
|
|
1608
|
+
}
|
|
1609
|
+
return map;
|
|
1610
|
+
}, [grouped, tagGroups, filteredChannels]);
|
|
1611
|
+
const operationDomId = useCallback(
|
|
1612
|
+
(channelName, idx) => `${channelDomId.get(channelName) ?? `channel-${channelName}`}-op-${idx}`,
|
|
1613
|
+
[channelDomId]
|
|
1614
|
+
);
|
|
1615
|
+
const opToCard = useMemo(() => {
|
|
1616
|
+
const map = /* @__PURE__ */ new Map();
|
|
1617
|
+
for (const ch of filteredChannels) {
|
|
1618
|
+
const card = channelDomId.get(ch.name) ?? `channel-${ch.name}`;
|
|
1619
|
+
ch.operations.forEach((_, idx) => map.set(`${card}-op-${idx}`, card));
|
|
1620
|
+
}
|
|
1621
|
+
return map;
|
|
1622
|
+
}, [filteredChannels, channelDomId]);
|
|
1623
|
+
const hasOperations = useMemo(
|
|
1624
|
+
() => filteredChannels.some((ch) => ch.operations.length > 0),
|
|
1625
|
+
[filteredChannels]
|
|
1626
|
+
);
|
|
1627
|
+
const navItems = useMemo(() => {
|
|
1628
|
+
if (!parsedSpec) return [];
|
|
1629
|
+
const actionLabel = (action) => action.toUpperCase();
|
|
1630
|
+
const actionColor = (action) => action === "subscribe" || action === "receive" ? "var(--omnispec-color-subscribe)" : "var(--omnispec-color-publish)";
|
|
1631
|
+
const channelNavItem = (ch, idPrefix) => ({
|
|
1632
|
+
id: `${idPrefix}channel-${ch.name}`,
|
|
1633
|
+
label: ch.address,
|
|
1634
|
+
badge: ch.operations.map((op) => actionLabel(op.action)).join("/") || void 0,
|
|
1635
|
+
badgeColor: actionColor(ch.operations[0]?.action ?? "")
|
|
1636
|
+
});
|
|
1637
|
+
const operationNavItems = () => filteredChannels.flatMap(
|
|
1638
|
+
(ch) => ch.operations.map((op, idx) => ({
|
|
1639
|
+
id: operationDomId(ch.name, idx),
|
|
1640
|
+
label: op.operationId ?? op.summary ?? `${actionLabel(op.action)} ${ch.address}`,
|
|
1641
|
+
badge: actionLabel(op.action),
|
|
1642
|
+
badgeColor: actionColor(op.action)
|
|
1643
|
+
}))
|
|
1644
|
+
);
|
|
1645
|
+
const tagGroupNavItem = (group) => ({
|
|
1646
|
+
id: `taggroup-${group.id}`,
|
|
1647
|
+
label: group.label,
|
|
1648
|
+
badge: String(group.channels.length),
|
|
1649
|
+
children: group.channels.map((ch) => channelNavItem(ch, `${group.id}-`))
|
|
1650
|
+
});
|
|
1651
|
+
const channelChildren = navGrouping === "operation" ? operationNavItems() : grouped ? nestByTagGroups(tagGroups, parsedSpec.tagGroups, tagGroupNavItem) : filteredChannels.map((ch) => channelNavItem(ch, ""));
|
|
1652
|
+
const items = [];
|
|
1653
|
+
if (parsedSpec.servers.length > 0) {
|
|
1654
|
+
items.push({ id: "servers", label: "Servers" });
|
|
1655
|
+
}
|
|
1656
|
+
items.push({
|
|
1657
|
+
id: "channels",
|
|
1658
|
+
label: navGrouping === "operation" ? "Operations" : "Channels",
|
|
1659
|
+
children: channelChildren
|
|
1660
|
+
});
|
|
1661
|
+
if (Object.keys(parsedSpec.components.messages ?? {}).length > 0) {
|
|
1662
|
+
items.push({
|
|
1663
|
+
id: "messages",
|
|
1664
|
+
label: "Messages",
|
|
1665
|
+
children: Object.keys(parsedSpec.components.messages).map((name) => ({
|
|
1666
|
+
id: `message-${name}`,
|
|
1667
|
+
label: name
|
|
1668
|
+
}))
|
|
1669
|
+
});
|
|
1670
|
+
}
|
|
1671
|
+
if (Object.keys(parsedSpec.components.schemas).length > 0) {
|
|
1672
|
+
items.push({
|
|
1673
|
+
id: "schemas",
|
|
1674
|
+
label: "Schemas",
|
|
1675
|
+
children: Object.keys(parsedSpec.components.schemas).map((name) => ({
|
|
1676
|
+
id: `schema-${name}`,
|
|
1677
|
+
label: name
|
|
1678
|
+
}))
|
|
1679
|
+
});
|
|
1680
|
+
}
|
|
1681
|
+
if (Object.keys(parsedSpec.components.securitySchemes).length > 0) {
|
|
1682
|
+
items.push({ id: "security", label: "Security Schemes" });
|
|
1683
|
+
}
|
|
1684
|
+
return items;
|
|
1685
|
+
}, [parsedSpec, grouped, tagGroups, filteredChannels, navGrouping, operationDomId]);
|
|
1686
|
+
const { navigateTo } = useHashScroll(filteredChannels.length);
|
|
1687
|
+
const handleNavSelect = useCallback((id) => {
|
|
1688
|
+
const cardId = opToCard.get(id);
|
|
1689
|
+
if (cardId) {
|
|
1690
|
+
requestExpand(cardId);
|
|
1691
|
+
navigateTo(id);
|
|
1692
|
+
return;
|
|
1693
|
+
}
|
|
1694
|
+
navigateTo(id);
|
|
1695
|
+
}, [navigateTo, opToCard]);
|
|
1696
|
+
const navSectionIds = useMemo(() => flattenNavItemIds(navItems), [navItems]);
|
|
1697
|
+
const activeSection = useScrollSpy(navSectionIds);
|
|
1698
|
+
if (state.status === "loading") {
|
|
1699
|
+
return /* @__PURE__ */ jsx(ThemeProvider, { theme, children: /* @__PURE__ */ jsx("div", { className: `omnispec-asyncapi ${className ?? ""}`, children: /* @__PURE__ */ jsx(LoadingScreen, {}) }) });
|
|
1700
|
+
}
|
|
1701
|
+
if (state.status === "error") {
|
|
1702
|
+
return /* @__PURE__ */ jsx(
|
|
1703
|
+
SpecStatusScreen,
|
|
1704
|
+
{
|
|
1705
|
+
theme,
|
|
1706
|
+
layout,
|
|
1707
|
+
sidebarPosition,
|
|
1708
|
+
slots,
|
|
1709
|
+
sidebarNav,
|
|
1710
|
+
premiumThemingEnabled: pro?.premiumThemingEnabled ?? false,
|
|
1711
|
+
className: `omnispec-asyncapi ${className ?? ""}`,
|
|
1712
|
+
children: /* @__PURE__ */ jsx(ErrorMessage, { title: "Failed to load specification", message: state.error })
|
|
1713
|
+
}
|
|
1714
|
+
);
|
|
1715
|
+
}
|
|
1716
|
+
if (!parsedSpec) return null;
|
|
1717
|
+
const specNav = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1718
|
+
/* @__PURE__ */ jsx(
|
|
1719
|
+
SearchBar,
|
|
1720
|
+
{
|
|
1721
|
+
placeholder: "Filter channels...",
|
|
1722
|
+
onSearch: setSearchQuery
|
|
1723
|
+
}
|
|
1724
|
+
),
|
|
1725
|
+
hasOperations && /* @__PURE__ */ jsxs("div", { className: groupToggleStyle, role: "group", "aria-label": "Sidebar grouping", children: [
|
|
1726
|
+
/* @__PURE__ */ jsx("span", { className: groupToggleLabelStyle, children: "Group by" }),
|
|
1727
|
+
/* @__PURE__ */ jsxs("div", { className: groupToggleButtonsStyle, children: [
|
|
1728
|
+
/* @__PURE__ */ jsx(
|
|
1729
|
+
"button",
|
|
1730
|
+
{
|
|
1731
|
+
type: "button",
|
|
1732
|
+
className: cx(groupToggleButtonStyle, navGrouping === "channel" && groupToggleActiveStyle),
|
|
1733
|
+
"aria-pressed": navGrouping === "channel",
|
|
1734
|
+
"aria-label": "Group by channel",
|
|
1735
|
+
onClick: () => setNavGrouping("channel"),
|
|
1736
|
+
children: "Channel"
|
|
1737
|
+
}
|
|
1738
|
+
),
|
|
1739
|
+
/* @__PURE__ */ jsx(
|
|
1740
|
+
"button",
|
|
1741
|
+
{
|
|
1742
|
+
type: "button",
|
|
1743
|
+
className: cx(groupToggleButtonStyle, navGrouping === "operation" && groupToggleActiveStyle),
|
|
1744
|
+
"aria-pressed": navGrouping === "operation",
|
|
1745
|
+
"aria-label": "Group by operation",
|
|
1746
|
+
onClick: () => setNavGrouping("operation"),
|
|
1747
|
+
children: "Operation"
|
|
1748
|
+
}
|
|
1749
|
+
)
|
|
1750
|
+
] })
|
|
1751
|
+
] }),
|
|
1752
|
+
/* @__PURE__ */ jsx(
|
|
1753
|
+
NavTree,
|
|
1754
|
+
{
|
|
1755
|
+
items: navItems,
|
|
1756
|
+
activeId: activeSection,
|
|
1757
|
+
onSelect: handleNavSelect
|
|
1758
|
+
}
|
|
1759
|
+
)
|
|
1760
|
+
] });
|
|
1761
|
+
const sidebar = buildSidebar(sidebarNav, specNav);
|
|
1762
|
+
const resolvedDownloadLink = resolveDownloadLink(downloadLink, spec);
|
|
1763
|
+
return /* @__PURE__ */ jsx(ConfigProvider, { config: { allowTryIt: false, layout, sidebarPosition, defaultExpandOperations, schemaStyle: resolvedSchemaStyle, slots, proRenderers: pro?.renderers ?? /* @__PURE__ */ new Map(), premiumThemingEnabled: pro?.premiumThemingEnabled ?? false }, children: /* @__PURE__ */ jsx(ExpandProvider, { expandAll: allExpanded, expandGeneration, children: /* @__PURE__ */ jsx(ThemeProvider, { theme, children: /* @__PURE__ */ jsx("div", { className: `omnispec-asyncapi ${className ?? ""}`, children: /* @__PURE__ */ jsx(ErrorBoundary, { title: "Failed to render this API reference", children: /* @__PURE__ */ jsxs(
|
|
1764
|
+
DocLayout,
|
|
1765
|
+
{
|
|
1766
|
+
layout,
|
|
1767
|
+
sidebarPosition,
|
|
1768
|
+
sidebar,
|
|
1769
|
+
sidebarHeader: slots.sidebarHeader,
|
|
1770
|
+
sidebarFooter: slots.sidebarFooter,
|
|
1771
|
+
header: slots.header,
|
|
1772
|
+
footer: slots.footer,
|
|
1773
|
+
children: [
|
|
1774
|
+
/* @__PURE__ */ jsx(
|
|
1775
|
+
SpecToolbar,
|
|
1776
|
+
{
|
|
1777
|
+
overview: /* @__PURE__ */ jsx(AsyncOverview, { spec: parsedSpec }),
|
|
1778
|
+
expandLabel: "channels",
|
|
1779
|
+
allExpanded,
|
|
1780
|
+
onToggleExpand: handleToggleExpand,
|
|
1781
|
+
downloadLink: resolvedDownloadLink
|
|
1782
|
+
}
|
|
1783
|
+
),
|
|
1784
|
+
/* @__PURE__ */ jsx("div", { id: "servers", children: /* @__PURE__ */ jsx(ServerList, { servers: parsedSpec.servers }) }),
|
|
1785
|
+
/* @__PURE__ */ jsxs("div", { id: "channels", children: [
|
|
1786
|
+
/* @__PURE__ */ jsx("h2", { className: css({ margin: "0 0 1rem", fontSize: "var(--omnispec-h2-font-size)", fontWeight: "var(--omnispec-h2-font-weight)", color: "var(--omnispec-h2-color)" }), children: "Channels" }),
|
|
1787
|
+
filteredChannels.length === 0 ? /* @__PURE__ */ jsx("p", { className: emptyStateStyle, children: parsedSpec.channels.length === 0 ? "No channels are defined for this API." : "No channels match your filter." }) : grouped ? tagGroups.map((group) => /* @__PURE__ */ jsxs("section", { id: `taggroup-${group.id}`, className: tagSectionStyle, children: [
|
|
1788
|
+
/* @__PURE__ */ jsx(TagGroupHeader, { group }),
|
|
1789
|
+
group.channels.map((channel) => /* @__PURE__ */ jsx(
|
|
1790
|
+
ChannelDetail,
|
|
1791
|
+
{
|
|
1792
|
+
id: `${group.id}-channel-${channel.name}`,
|
|
1793
|
+
channel,
|
|
1794
|
+
expandAll: allExpanded,
|
|
1795
|
+
expandGeneration
|
|
1796
|
+
},
|
|
1797
|
+
`${group.id}-${channel.name}`
|
|
1798
|
+
))
|
|
1799
|
+
] }, group.id)) : filteredChannels.map((channel) => /* @__PURE__ */ jsx(
|
|
1800
|
+
ChannelDetail,
|
|
1801
|
+
{
|
|
1802
|
+
id: `channel-${channel.name}`,
|
|
1803
|
+
channel,
|
|
1804
|
+
expandAll: allExpanded,
|
|
1805
|
+
expandGeneration
|
|
1806
|
+
},
|
|
1807
|
+
channel.name
|
|
1808
|
+
))
|
|
1809
|
+
] }),
|
|
1810
|
+
/* @__PURE__ */ jsx(ComponentsSection, { components: parsedSpec.components }),
|
|
1811
|
+
/* @__PURE__ */ jsx(SecuritySchemesSection, { securitySchemes: parsedSpec.components.securitySchemes })
|
|
1812
|
+
]
|
|
1813
|
+
}
|
|
1814
|
+
) }) }) }) }) });
|
|
1815
|
+
}
|
|
1816
|
+
function nestByTagGroups(groups, xTagGroups, toNav) {
|
|
1817
|
+
if (!xTagGroups?.length) return groups.map(toNav);
|
|
1818
|
+
const byTagName = /* @__PURE__ */ new Map();
|
|
1819
|
+
for (const g of groups) if (g.tag?.name) byTagName.set(g.tag.name, g);
|
|
1820
|
+
const used = /* @__PURE__ */ new Set();
|
|
1821
|
+
const grouped = xTagGroups.map((xg) => {
|
|
1822
|
+
const children = xg.tags.map((t) => byTagName.get(t)).filter((g) => !!g);
|
|
1823
|
+
children.forEach((g) => used.add(g));
|
|
1824
|
+
return {
|
|
1825
|
+
id: `xtaggroup-${xg.name.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || "group"}`,
|
|
1826
|
+
label: xg.name,
|
|
1827
|
+
children: children.map(toNav)
|
|
1828
|
+
};
|
|
1829
|
+
}).filter((item) => (item.children?.length ?? 0) > 0);
|
|
1830
|
+
const leftover = groups.filter((g) => !used.has(g)).map(toNav);
|
|
1831
|
+
return [...grouped, ...leftover];
|
|
1832
|
+
}
|
|
1833
|
+
const emptyStateStyle = css({
|
|
1834
|
+
fontSize: "var(--omnispec-font-size-sm)",
|
|
1835
|
+
color: "var(--omnispec-fg-muted)",
|
|
1836
|
+
fontStyle: "italic"
|
|
1837
|
+
});
|
|
1838
|
+
const groupToggleStyle = css({
|
|
1839
|
+
display: "flex",
|
|
1840
|
+
alignItems: "center",
|
|
1841
|
+
gap: "0.5rem",
|
|
1842
|
+
padding: "0.5rem 0.75rem 0.25rem",
|
|
1843
|
+
flexWrap: "wrap"
|
|
1844
|
+
});
|
|
1845
|
+
const groupToggleLabelStyle = css({
|
|
1846
|
+
fontSize: "var(--omnispec-font-size-xxs)",
|
|
1847
|
+
fontWeight: 600,
|
|
1848
|
+
textTransform: "uppercase",
|
|
1849
|
+
letterSpacing: "0.05em",
|
|
1850
|
+
color: "var(--omnispec-fg-muted)"
|
|
1851
|
+
});
|
|
1852
|
+
const groupToggleButtonsStyle = css({
|
|
1853
|
+
display: "inline-flex",
|
|
1854
|
+
borderRadius: "var(--omnispec-border-radius)",
|
|
1855
|
+
backgroundColor: "var(--omnispec-bg-tertiary)",
|
|
1856
|
+
padding: "0.125rem"
|
|
1857
|
+
});
|
|
1858
|
+
const groupToggleButtonStyle = css({
|
|
1859
|
+
border: "none",
|
|
1860
|
+
background: "transparent",
|
|
1861
|
+
color: "var(--omnispec-fg-secondary)",
|
|
1862
|
+
fontSize: "var(--omnispec-font-size-xs)",
|
|
1863
|
+
padding: "0.125rem 0.625rem",
|
|
1864
|
+
borderRadius: "calc(var(--omnispec-border-radius) - 1px)",
|
|
1865
|
+
cursor: "pointer"
|
|
1866
|
+
});
|
|
1867
|
+
const groupToggleActiveStyle = css({
|
|
1868
|
+
backgroundColor: "var(--omnispec-bg-primary)",
|
|
1869
|
+
color: "var(--omnispec-fg-primary)",
|
|
1870
|
+
fontWeight: 600,
|
|
1871
|
+
boxShadow: "var(--omnispec-shadow-sm, 0 1px 0.125rem rgba(0,0,0,0.1))"
|
|
1872
|
+
});
|
|
1873
|
+
const tagSectionStyle = css({
|
|
1874
|
+
marginBottom: "2rem"
|
|
1875
|
+
});
|
|
1876
|
+
|
|
1877
|
+
export { AsyncApiSpec };
|
|
1878
|
+
//# sourceMappingURL=AsyncApiSpec-BPiA9b5T.js.map
|