sourcey 3.4.9 → 3.4.10
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.
|
@@ -23,7 +23,7 @@ function statusColorClass(code) {
|
|
|
23
23
|
export function ResponsesCopy({ responses }) {
|
|
24
24
|
if (!responses.length)
|
|
25
25
|
return null;
|
|
26
|
-
return (_jsx("div", { class: "params-list", children: responses.map((r) => (_jsxs("div", { class: "param-item", children: [_jsxs("div", { class: "param-header font-mono text-sm", children: [_jsx("span", { class: `px-1.5 py-0.5 rounded-md text-xs font-bold ${statusColorClass(r.statusCode)}`, children: r.statusCode }), _jsx("span", { class: "font-medium text-[rgb(var(--color-gray-900))] dark:text-[rgb(var(--color-gray-200))]", children: httpStatusText(r.statusCode) }), r.content && (_jsx("span", { class: "param-type", children: renderResponseType(r) }))] }), r.description && (_jsx("div", { class: "param-description", children: _jsx(Markdown, { content: r.description }) }))] }, r.statusCode))) }));
|
|
26
|
+
return (_jsx("div", { class: "params-list", children: responses.map((r) => (_jsxs("div", { class: "param-item", children: [_jsxs("div", { class: "param-header font-mono text-sm", children: [_jsx("span", { class: `px-1.5 py-0.5 rounded-md text-xs font-bold ${statusColorClass(r.statusCode)}`, children: r.statusCode }), _jsx("span", { class: "font-medium text-[rgb(var(--color-gray-900))] dark:text-[rgb(var(--color-gray-200))]", children: httpStatusText(r.statusCode) }), r.content && (_jsx("span", { class: "param-type", children: renderResponseType(r) }))] }), r.description && (_jsx("div", { class: "param-description", children: _jsx(Markdown, { content: r.description, class: "prose-sm" }) }))] }, r.statusCode))) }));
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
29
|
* Response examples with status code tabs on the code block card.
|
|
@@ -15,7 +15,7 @@ export function SecurityCopy({ security }) {
|
|
|
15
15
|
return null;
|
|
16
16
|
return (_jsxs("div", { class: "mt-6", children: [_jsx(SectionLabel, { children: "Authorization" }), _jsx("div", { children: security.map((req, i) => (_jsx("div", { class: "params-list", children: Object.entries(req).map(([name, scopes]) => {
|
|
17
17
|
const scheme = spec.securitySchemes[name];
|
|
18
|
-
return (_jsxs("div", { class: "param-item", children: [_jsxs("div", { class: "param-header", children: [_jsx("code", { class: "param-name", children: name }), scheme && (_jsx("span", { class: "param-type", children: _jsxs("span", { class: "json-property-type", children: [scheme.type, scheme.scheme && ` (${scheme.scheme})`, scheme.in && ` in ${scheme.in}`] }) }))] }), (scheme?.description || scopes.length > 0) && (_jsxs("div", { class: "param-description", children: [scheme?.description && _jsx(Markdown, { content: scheme.description }), scopes.length > 0 && (_jsxs("p", { class: "mt-1", children: ["Scopes: ", _jsx("code", { class: "text-xs font-medium", children: scopes.join(", ") })] }))] }))] }, name));
|
|
18
|
+
return (_jsxs("div", { class: "param-item", children: [_jsxs("div", { class: "param-header", children: [_jsx("code", { class: "param-name", children: name }), scheme && (_jsx("span", { class: "param-type", children: _jsxs("span", { class: "json-property-type", children: [scheme.type, scheme.scheme && ` (${scheme.scheme})`, scheme.in && ` in ${scheme.in}`] }) }))] }), (scheme?.description || scopes.length > 0) && (_jsxs("div", { class: "param-description", children: [scheme?.description && _jsx(Markdown, { content: scheme.description, class: "prose-sm" }), scopes.length > 0 && (_jsxs("p", { class: "mt-1", children: ["Scopes: ", _jsx("code", { class: "text-xs font-medium", children: scopes.join(", ") })] }))] }))] }, name));
|
|
19
19
|
}) }, i))) })] }));
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
@@ -26,5 +26,5 @@ export function SecurityDefinitions() {
|
|
|
26
26
|
const schemes = Object.entries(spec.securitySchemes);
|
|
27
27
|
if (!schemes.length)
|
|
28
28
|
return null;
|
|
29
|
-
return (_jsxs("div", { id: "authentication", class: "py-8 border-t border-[rgb(var(--color-gray-100))] dark:border-[rgb(var(--color-gray-800))]", "data-traverse-target": "authentication", children: [_jsx("h2", { class: "text-xl font-bold text-[rgb(var(--color-gray-900))] dark:text-[rgb(var(--color-gray-200))] mb-4", children: "Authentication" }), _jsx("div", { class: "params-list", children: schemes.map(([name, scheme]) => (_jsxs("div", { class: "param-item", children: [_jsxs("div", { class: "param-header", children: [_jsx("code", { class: "param-name", children: name }), _jsx("span", { class: "param-type", children: _jsx("span", { class: "json-property-type", children: scheme.type }) })] }), _jsxs("div", { class: "param-description", children: [scheme.description && _jsx(Markdown, { content: scheme.description }), scheme.type === "apiKey" && (_jsxs("p", { class: "mt-1", children: ["API Key: ", _jsx("code", { class: "text-xs font-medium", children: scheme.name }), " in ", scheme.in] })), scheme.type === "http" && (_jsxs("p", { class: "mt-1", children: ["Scheme: ", scheme.scheme, scheme.bearerFormat && ` (${scheme.bearerFormat})`] })), scheme.type === "oauth2" && scheme.flows && (_jsx("div", { class: "mt-2 space-y-4", children: Object.entries(scheme.flows).map(([flowType, flow]) => (_jsxs("div", { children: [_jsx("strong", { class: "text-[rgb(var(--color-gray-900))] dark:text-[rgb(var(--color-gray-200))]", children: flowType }), _jsxs("dl", { class: "mt-2 text-sm", children: [flow?.authorizationUrl && (_jsxs(_Fragment, { children: [_jsx("dt", { class: "text-[rgb(var(--color-gray-500))] mt-2", children: "Authorization URL" }), _jsx("dd", { children: _jsx("code", { class: "text-xs", children: flow.authorizationUrl }) })] })), flow?.tokenUrl && (_jsxs(_Fragment, { children: [_jsx("dt", { class: "text-[rgb(var(--color-gray-500))] mt-2", children: "Token URL" }), _jsx("dd", { children: _jsx("code", { class: "text-xs", children: flow.tokenUrl }) })] }))] }), flow?.scopes && Object.keys(flow.scopes).length > 0 && (_jsxs("div", { class: "mt-3", children: [_jsx("span", { class: "text-sm text-[rgb(var(--color-gray-500))]", children: "Scopes" }), _jsx("ul", { class: "mt-1 space-y-1", children: Object.entries(flow.scopes).map(([s, desc]) => (_jsxs("li", { class: "text-sm", children: [_jsx("code", { class: "text-xs font-medium text-[rgb(var(--color-gray-800))] dark:text-[rgb(var(--color-gray-200))]", children: s }), _jsxs("span", { class: "text-[rgb(var(--color-gray-500))] ml-2", children: ["\u2014 ", desc] })] }, s))) })] }))] }, flowType))) })), scheme.type === "openIdConnect" && scheme.openIdConnectUrl && (_jsxs("p", { class: "mt-1", children: ["OpenID Connect:", " ", _jsx("a", { href: scheme.openIdConnectUrl, class: "text-[rgb(var(--color-primary-ink))] dark:text-[rgb(var(--color-primary-light))]", children: scheme.openIdConnectUrl })] }))] })] }, name))) })] }));
|
|
29
|
+
return (_jsxs("div", { id: "authentication", class: "py-8 border-t border-[rgb(var(--color-gray-100))] dark:border-[rgb(var(--color-gray-800))]", "data-traverse-target": "authentication", children: [_jsx("h2", { class: "text-xl font-bold text-[rgb(var(--color-gray-900))] dark:text-[rgb(var(--color-gray-200))] mb-4", children: "Authentication" }), _jsx("div", { class: "params-list", children: schemes.map(([name, scheme]) => (_jsxs("div", { class: "param-item", children: [_jsxs("div", { class: "param-header", children: [_jsx("code", { class: "param-name", children: name }), _jsx("span", { class: "param-type", children: _jsx("span", { class: "json-property-type", children: scheme.type }) })] }), _jsxs("div", { class: "param-description", children: [scheme.description && _jsx(Markdown, { content: scheme.description, class: "prose-sm" }), scheme.type === "apiKey" && (_jsxs("p", { class: "mt-1", children: ["API Key: ", _jsx("code", { class: "text-xs font-medium", children: scheme.name }), " in ", scheme.in] })), scheme.type === "http" && (_jsxs("p", { class: "mt-1", children: ["Scheme: ", scheme.scheme, scheme.bearerFormat && ` (${scheme.bearerFormat})`] })), scheme.type === "oauth2" && scheme.flows && (_jsx("div", { class: "mt-2 space-y-4", children: Object.entries(scheme.flows).map(([flowType, flow]) => (_jsxs("div", { children: [_jsx("strong", { class: "text-[rgb(var(--color-gray-900))] dark:text-[rgb(var(--color-gray-200))]", children: flowType }), _jsxs("dl", { class: "mt-2 text-sm", children: [flow?.authorizationUrl && (_jsxs(_Fragment, { children: [_jsx("dt", { class: "text-[rgb(var(--color-gray-500))] mt-2", children: "Authorization URL" }), _jsx("dd", { children: _jsx("code", { class: "text-xs", children: flow.authorizationUrl }) })] })), flow?.tokenUrl && (_jsxs(_Fragment, { children: [_jsx("dt", { class: "text-[rgb(var(--color-gray-500))] mt-2", children: "Token URL" }), _jsx("dd", { children: _jsx("code", { class: "text-xs", children: flow.tokenUrl }) })] }))] }), flow?.scopes && Object.keys(flow.scopes).length > 0 && (_jsxs("div", { class: "mt-3", children: [_jsx("span", { class: "text-sm text-[rgb(var(--color-gray-500))]", children: "Scopes" }), _jsx("ul", { class: "mt-1 space-y-1", children: Object.entries(flow.scopes).map(([s, desc]) => (_jsxs("li", { class: "text-sm", children: [_jsx("code", { class: "text-xs font-medium text-[rgb(var(--color-gray-800))] dark:text-[rgb(var(--color-gray-200))]", children: s }), _jsxs("span", { class: "text-[rgb(var(--color-gray-500))] ml-2", children: ["\u2014 ", desc] })] }, s))) })] }))] }, flowType))) })), scheme.type === "openIdConnect" && scheme.openIdConnectUrl && (_jsxs("p", { class: "mt-1", children: ["OpenID Connect:", " ", _jsx("a", { href: scheme.openIdConnectUrl, class: "text-[rgb(var(--color-primary-ink))] dark:text-[rgb(var(--color-primary-light))]", children: scheme.openIdConnectUrl })] }))] })] }, name))) })] }));
|
|
30
30
|
}
|
|
@@ -24,12 +24,12 @@ export function SchemaView({ schema, requiredFields, depth = 0, maxDepth = MAX_D
|
|
|
24
24
|
// Object with properties
|
|
25
25
|
if (schema.properties) {
|
|
26
26
|
const required = new Set(schema.required ?? requiredFields ?? []);
|
|
27
|
-
return (_jsxs("div", { children: [schema.description && (_jsx("div", { class: "schema-description", children: _jsx(Markdown, { content: schema.description }) })), _jsx("div", { class: "params-list", children: Object.entries(schema.properties).map(([name, prop]) => (_jsx(PropertyRow, { name: name, schema: prop, required: required.has(name), depth: depth, maxDepth: maxDepth }, name))) }), schema.additionalProperties &&
|
|
27
|
+
return (_jsxs("div", { children: [depth === 0 && schema.description && (_jsx("div", { class: "schema-description", children: _jsx(Markdown, { content: schema.description }) })), _jsx("div", { class: "params-list", children: Object.entries(schema.properties).map(([name, prop]) => (_jsx(PropertyRow, { name: name, schema: prop, required: required.has(name), depth: depth, maxDepth: maxDepth }, name))) }), schema.additionalProperties &&
|
|
28
28
|
typeof schema.additionalProperties !== "boolean" && (_jsx("div", { class: "param-item", children: _jsxs("div", { class: "param-header", children: [_jsx("code", { class: "param-name", children: "[key: string]" }), _jsx("span", { class: "param-type", children: _jsx(SchemaDatatype, { schema: schema.additionalProperties }) })] }) }))] }));
|
|
29
29
|
}
|
|
30
30
|
// Array
|
|
31
31
|
if (schema.type === "array" && schema.items) {
|
|
32
|
-
return (_jsxs("div", { children: [schema.description && (_jsx("div", { class: "schema-description", children: _jsx(Markdown, { content: schema.description }) })), _jsx("div", { class: "schema-array-info", children: _jsx(SchemaDatatype, { schema: schema }) }), schema.items.properties && (_jsxs("details", { class: "schema-expandable", children: [_jsxs("summary", { class: "schema-expandable-toggle", children: [_jsx("svg", { class: "schema-expandable-icon", viewBox: "0 0 256 512", width: "8", height: "8", children: _jsx("path", { fill: "currentColor", d: "M249.3 235.8c10.2 12.6 9.5 31.1-2.2 42.8l-128 128c-9.2 9.2-22.9 11.9-34.9 6.9S64.5 396.9 64.5 384l0-256c0-12.9 7.8-24.6 19.8-29.6s25.7-2.2 34.9 6.9l128 128 2.2 2.4z" }) }), "Show child attributes"] }), _jsx("div", { class: "schema-expandable-content", children: _jsx(SchemaView, { schema: schema.items, depth: depth + 1, maxDepth: maxDepth }) })] }))] }));
|
|
32
|
+
return (_jsxs("div", { children: [depth === 0 && schema.description && (_jsx("div", { class: "schema-description", children: _jsx(Markdown, { content: schema.description }) })), _jsx("div", { class: "schema-array-info", children: _jsx(SchemaDatatype, { schema: schema }) }), schema.items.properties && (_jsxs("details", { class: "schema-expandable", children: [_jsxs("summary", { class: "schema-expandable-toggle", children: [_jsx("svg", { class: "schema-expandable-icon", viewBox: "0 0 256 512", width: "8", height: "8", children: _jsx("path", { fill: "currentColor", d: "M249.3 235.8c10.2 12.6 9.5 31.1-2.2 42.8l-128 128c-9.2 9.2-22.9 11.9-34.9 6.9S64.5 396.9 64.5 384l0-256c0-12.9 7.8-24.6 19.8-29.6s25.7-2.2 34.9 6.9l128 128 2.2 2.4z" }) }), "Show child attributes"] }), _jsx("div", { class: "schema-expandable-content", children: _jsx(SchemaView, { schema: schema.items, depth: depth + 1, maxDepth: maxDepth }) })] }))] }));
|
|
33
33
|
}
|
|
34
34
|
// Simple type
|
|
35
35
|
return (_jsxs("div", { children: [schema.description && (_jsx("div", { class: "schema-description", children: _jsx(Markdown, { content: schema.description }) })), _jsx(SchemaDatatype, { schema: schema })] }));
|
|
@@ -39,5 +39,5 @@ function PropertyRow({ name, schema, required, depth, maxDepth, }) {
|
|
|
39
39
|
(schema.type === "array" &&
|
|
40
40
|
schema.items &&
|
|
41
41
|
(schema.items.properties || schema.items.allOf || schema.items.oneOf || schema.items.anyOf));
|
|
42
|
-
return (_jsxs("div", { class: "param-item", children: [_jsxs("div", { class: "param-header", children: [_jsx("code", { class: "param-name", children: name }), _jsx("span", { class: "param-type", children: _jsx(SchemaDatatype, { schema: schema }) }), required && _jsx(RequiredBadge, {}), schema.readOnly && _jsx(ReadOnlyBadge, {}), schema.writeOnly && _jsx(Badge, { children: "write only" }), schema.deprecated && _jsx(DeprecatedBadge, {})] }), schema.description && (_jsx("div", { class: "param-description", children: _jsx(Markdown, { content: schema.description }) })), hasInner && (_jsxs("details", { class: "schema-expandable", children: [_jsxs("summary", { class: "schema-expandable-toggle", children: [_jsx("svg", { class: "schema-expandable-icon", viewBox: "0 0 256 512", width: "8", height: "8", children: _jsx("path", { fill: "currentColor", d: "M249.3 235.8c10.2 12.6 9.5 31.1-2.2 42.8l-128 128c-9.2 9.2-22.9 11.9-34.9 6.9S64.5 396.9 64.5 384l0-256c0-12.9 7.8-24.6 19.8-29.6s25.7-2.2 34.9 6.9l128 128 2.2 2.4z" }) }), "Show child attributes"] }), _jsx("div", { class: "schema-expandable-content", children: _jsx(SchemaView, { schema: schema.type === "array" && schema.items ? schema.items : schema, depth: depth + 1, maxDepth: maxDepth }) })] }))] }));
|
|
42
|
+
return (_jsxs("div", { class: "param-item", children: [_jsxs("div", { class: "param-header", children: [_jsx("code", { class: "param-name", children: name }), _jsx("span", { class: "param-type", children: _jsx(SchemaDatatype, { schema: schema }) }), required && _jsx(RequiredBadge, {}), schema.readOnly && _jsx(ReadOnlyBadge, {}), schema.writeOnly && _jsx(Badge, { children: "write only" }), schema.deprecated && _jsx(DeprecatedBadge, {})] }), schema.description && (_jsx("div", { class: "param-description", children: _jsx(Markdown, { content: schema.description, class: "prose-sm" }) })), hasInner && (_jsxs("details", { class: "schema-expandable", children: [_jsxs("summary", { class: "schema-expandable-toggle", children: [_jsx("svg", { class: "schema-expandable-icon", viewBox: "0 0 256 512", width: "8", height: "8", children: _jsx("path", { fill: "currentColor", d: "M249.3 235.8c10.2 12.6 9.5 31.1-2.2 42.8l-128 128c-9.2 9.2-22.9 11.9-34.9 6.9S64.5 396.9 64.5 384l0-256c0-12.9 7.8-24.6 19.8-29.6s25.7-2.2 34.9 6.9l128 128 2.2 2.4z" }) }), "Show child attributes"] }), _jsx("div", { class: "schema-expandable-content", children: _jsx(SchemaView, { schema: schema.type === "array" && schema.items ? schema.items : schema, depth: depth + 1, maxDepth: maxDepth }) })] }))] }));
|
|
43
43
|
}
|