zudoku 0.0.0-zacd7778d → 0.0.0-zc17c4c22
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/config/loader.js +3 -1
- package/dist/config/loader.js.map +1 -1
- package/dist/config/validators/InputNavigationSchema.d.ts +119 -119
- package/dist/config/validators/ProtectedRoutesSchema.d.ts +1 -1
- package/dist/config/validators/validate.d.ts +28 -10
- package/dist/config/validators/validate.js +6 -3
- package/dist/config/validators/validate.js.map +1 -1
- package/dist/flat-config.d.ts +28 -27
- package/dist/lib/components/Heading.d.ts +1 -1
- package/dist/lib/components/index.d.ts +18 -74
- package/dist/lib/components/index.js +19 -36
- package/dist/lib/components/index.js.map +1 -1
- package/dist/lib/core/plugins.d.ts +11 -1
- package/dist/lib/core/plugins.js +1 -0
- package/dist/lib/core/plugins.js.map +1 -1
- package/dist/lib/core/transform-config.d.ts +2 -0
- package/dist/lib/core/transform-config.js +22 -0
- package/dist/lib/core/transform-config.js.map +1 -0
- package/dist/lib/hooks/index.d.ts +7 -30
- package/dist/lib/hooks/index.js +7 -15
- package/dist/lib/hooks/index.js.map +1 -1
- package/dist/lib/oas/graphql/circular.d.ts +1 -1
- package/dist/lib/oas/graphql/circular.js +18 -35
- package/dist/lib/oas/graphql/circular.js.map +1 -1
- package/dist/lib/oas/graphql/circular.test.js +33 -2
- package/dist/lib/oas/graphql/circular.test.js.map +1 -1
- package/dist/lib/oas/parser/index.js +14 -5
- package/dist/lib/oas/parser/index.js.map +1 -1
- package/dist/lib/plugins/openapi/OasProvider.js +6 -2
- package/dist/lib/plugins/openapi/OasProvider.js.map +1 -1
- package/dist/lib/plugins/openapi/OperationList.js +4 -8
- package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
- package/dist/lib/plugins/openapi/interfaces.d.ts +3 -0
- package/dist/lib/plugins/openapi/util/getRoutes.d.ts +3 -0
- package/dist/lib/plugins/openapi/util/getRoutes.js +2 -1
- package/dist/lib/plugins/openapi/util/getRoutes.js.map +1 -1
- package/dist/lib/ui/Command.d.ts +3 -3
- package/dist/lib/util/flattenAllOf.d.ts +0 -2
- package/dist/lib/util/flattenAllOf.js +0 -46
- package/dist/lib/util/flattenAllOf.js.map +1 -1
- package/dist/lib/util/flattenAllOf.test.js +2 -1
- package/dist/lib/util/flattenAllOf.test.js.map +1 -1
- package/dist/lib/util/flattenAllOfProcessor.d.ts +2 -0
- package/dist/lib/util/flattenAllOfProcessor.js +48 -0
- package/dist/lib/util/flattenAllOfProcessor.js.map +1 -0
- package/dist/lib/util/readFrontmatter.js +2 -1
- package/dist/lib/util/readFrontmatter.js.map +1 -1
- package/dist/vite/api/SchemaManager.d.ts +11 -1
- package/dist/vite/api/SchemaManager.js +29 -18
- package/dist/vite/api/SchemaManager.js.map +1 -1
- package/dist/vite/api/SchemaManager.test.js +45 -1
- package/dist/vite/api/SchemaManager.test.js.map +1 -1
- package/dist/vite/build.js +91 -73
- package/dist/vite/build.js.map +1 -1
- package/dist/vite/error-handler.js +1 -5
- package/dist/vite/error-handler.js.map +1 -1
- package/dist/vite/mdx/remark-inject-filepath.js +5 -1
- package/dist/vite/mdx/remark-inject-filepath.js.map +1 -1
- package/dist/vite/mdx/remark-link-rewrite.js +3 -2
- package/dist/vite/mdx/remark-link-rewrite.js.map +1 -1
- package/dist/vite/plugin-api.js +5 -3
- package/dist/vite/plugin-api.js.map +1 -1
- package/dist/vite/plugin-docs.js +9 -7
- package/dist/vite/plugin-docs.js.map +1 -1
- package/dist/vite/plugin-markdown-export.js +4 -2
- package/dist/vite/plugin-markdown-export.js.map +1 -1
- package/lib/{ClaudeLogo-DHxJUhN_.js → ClaudeLogo-C6q-Xn_l.js} +26 -22
- package/lib/{ClaudeLogo-DHxJUhN_.js.map → ClaudeLogo-C6q-Xn_l.js.map} +1 -1
- package/lib/{MdxPage-CD36PJ17.js → MdxPage-B1G4W1TK.js} +8 -8
- package/lib/{MdxPage-CD36PJ17.js.map → MdxPage-B1G4W1TK.js.map} +1 -1
- package/lib/{Mermaid-Koc3z8mU.js → Mermaid-B1xNo-pf.js} +3 -2
- package/lib/{Mermaid-Koc3z8mU.js.map → Mermaid-B1xNo-pf.js.map} +1 -1
- package/lib/{OAuthErrorPage-4mN5DA86.js → OAuthErrorPage-01Ke086W.js} +20 -18
- package/lib/{OAuthErrorPage-4mN5DA86.js.map → OAuthErrorPage-01Ke086W.js.map} +1 -1
- package/lib/OasProvider-oHPiMJZg.js +48 -0
- package/lib/OasProvider-oHPiMJZg.js.map +1 -0
- package/lib/{OperationList-CaknPbvq.js → OperationList-CZ4OK8Pm.js} +1284 -1284
- package/lib/OperationList-CZ4OK8Pm.js.map +1 -0
- package/lib/{RouteGuard--A04ESy8.js → RouteGuard-B1lCR0C_.js} +5 -5
- package/lib/{RouteGuard--A04ESy8.js.map → RouteGuard-B1lCR0C_.js.map} +1 -1
- package/lib/{SchemaList-Dw3-CJPb.js → SchemaList-DoQFkJgM.js} +7 -7
- package/lib/{SchemaList-Dw3-CJPb.js.map → SchemaList-DoQFkJgM.js.map} +1 -1
- package/lib/{SchemaView-DyJkiQkD.js → SchemaView-D2k6ZJck.js} +3 -3
- package/lib/{SchemaView-DyJkiQkD.js.map → SchemaView-D2k6ZJck.js.map} +1 -1
- package/lib/{SignUp-DRvN-8cq.js → SignUp-8kDBaLbO.js} +31 -26
- package/lib/{SignUp-DRvN-8cq.js.map → SignUp-8kDBaLbO.js.map} +1 -1
- package/lib/{SyntaxHighlight-klTH8c6-.js → SyntaxHighlight-hZOFnYl0.js} +6 -5
- package/lib/SyntaxHighlight-hZOFnYl0.js.map +1 -0
- package/lib/{Toc-PbuF-u9x.js → Toc-qEIii_-W.js} +2 -2
- package/lib/{Toc-PbuF-u9x.js.map → Toc-qEIii_-W.js.map} +1 -1
- package/lib/{index-BDsEwofZ.js → Zudoku-DUsdmPME.js} +2250 -2268
- package/lib/Zudoku-DUsdmPME.js.map +1 -0
- package/lib/{ZudokuContext-BZB1TWdT.js → ZudokuContext-BBI06sOx.js} +5 -5
- package/lib/{ZudokuContext-BZB1TWdT.js.map → ZudokuContext-BBI06sOx.js.map} +1 -1
- package/lib/{circular-DFquXeY2.js → circular-D9tSKG2c.js} +1327 -1346
- package/lib/{circular-DFquXeY2.js.map → circular-D9tSKG2c.js.map} +1 -1
- package/lib/createServer-BprC4n85.js +13036 -0
- package/lib/createServer-BprC4n85.js.map +1 -0
- package/lib/{errors-rWHkzVTd.js → errors-7hgPDs1h.js} +3 -3
- package/lib/{errors-rWHkzVTd.js.map → errors-7hgPDs1h.js.map} +1 -1
- package/lib/{firebase-BmGU1FuD.js → firebase-Dwn-2ju-.js} +13 -13
- package/lib/firebase-Dwn-2ju-.js.map +1 -0
- package/lib/{hook-BGlHBdET.js → hook-ZEd1Es7D.js} +2 -2
- package/lib/{hook-BGlHBdET.js.map → hook-ZEd1Es7D.js.map} +1 -1
- package/lib/{index-BQB9hb6n.js → index-CyIW9rHv.js} +485 -480
- package/lib/{index-BQB9hb6n.js.map → index-CyIW9rHv.js.map} +1 -1
- package/lib/index-DAWHN3cH.js +86 -0
- package/lib/index-DAWHN3cH.js.map +1 -0
- package/lib/{index-DRBOFufT.js → index-Dxdhrp-I.js} +2 -2
- package/lib/{index-DRBOFufT.js.map → index-Dxdhrp-I.js.map} +1 -1
- package/lib/{index.esm-B_0dvNjB.js → index.esm-Ca5zvoff.js} +20 -20
- package/lib/{index.esm-B_0dvNjB.js.map → index.esm-Ca5zvoff.js.map} +1 -1
- package/lib/{index.esm-Cx8B1YJQ.js → index.esm-DG4KaDKR.js} +2 -2
- package/lib/index.esm-DG4KaDKR.js.map +1 -0
- package/lib/{invariant-BJAl77rw.js → invariant-B_t_F2s_.js} +3 -3
- package/lib/{invariant-BJAl77rw.js.map → invariant-B_t_F2s_.js.map} +1 -1
- package/lib/ui/SyntaxHighlight.js +3 -3
- package/lib/useExposedProps-CzTDfXfq.js +30 -0
- package/lib/useExposedProps-CzTDfXfq.js.map +1 -0
- package/lib/zudoku.__internal.js +1492 -1030
- package/lib/zudoku.__internal.js.map +1 -1
- package/lib/zudoku.auth-auth0.js +1 -1
- package/lib/zudoku.auth-azureb2c.js +4 -4
- package/lib/zudoku.auth-clerk.js +2 -2
- package/lib/zudoku.auth-firebase.js +5 -5
- package/lib/zudoku.auth-openid.js +5 -5
- package/lib/zudoku.auth-supabase.js +4 -4
- package/lib/zudoku.components.js +31 -29
- package/lib/zudoku.components.js.map +1 -1
- package/lib/zudoku.hooks.js +24 -11
- package/lib/zudoku.hooks.js.map +1 -1
- package/lib/zudoku.mermaid.js +4 -3
- package/lib/zudoku.mermaid.js.map +1 -1
- package/lib/zudoku.plugin-api-catalog.js +36 -32
- package/lib/zudoku.plugin-api-catalog.js.map +1 -1
- package/lib/zudoku.plugin-api-keys.js +131 -130
- package/lib/zudoku.plugin-api-keys.js.map +1 -1
- package/lib/zudoku.plugin-custom-pages.js +1 -1
- package/lib/zudoku.plugin-markdown.js +1 -1
- package/lib/zudoku.plugin-openapi.js +2 -2
- package/lib/zudoku.plugin-search-pagefind.js +2 -2
- package/lib/zudoku.plugins.js +9 -8
- package/lib/zudoku.plugins.js.map +1 -1
- package/package.json +12 -10
- package/src/lib/components/index.ts +19 -39
- package/src/lib/core/plugins.ts +21 -1
- package/src/lib/core/transform-config.ts +29 -0
- package/src/lib/hooks/index.ts +7 -16
- package/src/lib/oas/graphql/circular.test.ts +37 -2
- package/src/lib/oas/graphql/circular.ts +25 -51
- package/src/lib/oas/parser/index.ts +17 -6
- package/src/lib/plugins/openapi/OasProvider.tsx +10 -2
- package/src/lib/plugins/openapi/OperationList.tsx +4 -9
- package/src/lib/plugins/openapi/interfaces.ts +6 -1
- package/src/lib/plugins/openapi/util/getRoutes.tsx +4 -1
- package/src/lib/util/flattenAllOf.test.ts +2 -1
- package/src/lib/util/flattenAllOf.ts +0 -57
- package/src/lib/util/flattenAllOfProcessor.ts +58 -0
- package/src/lib/util/readFrontmatter.ts +2 -1
- package/src/shiki/langs/c3.js +1 -0
- package/src/shiki/langs/gn.js +1 -0
- package/src/shiki/langs/moonbit.js +1 -0
- package/src/zuplo/enrich-with-zuplo-mcp.ts +168 -0
- package/src/zuplo/enrich-with-zuplo.ts +254 -0
- package/src/zuplo/policy-types.ts +46 -0
- package/src/zuplo/with-zuplo-processors.ts +35 -0
- package/src/zuplo/with-zuplo.ts +14 -0
- package/lib/OasProvider-DSe-hk5Y.js +0 -40
- package/lib/OasProvider-DSe-hk5Y.js.map +0 -1
- package/lib/OperationList-CaknPbvq.js.map +0 -1
- package/lib/SyntaxHighlight-klTH8c6-.js.map +0 -1
- package/lib/___vite-browser-external_commonjs-proxy-BttVsNON.js +0 -9
- package/lib/___vite-browser-external_commonjs-proxy-BttVsNON.js.map +0 -1
- package/lib/createServer-BXZ0CAUn.js +0 -16693
- package/lib/createServer-BXZ0CAUn.js.map +0 -1
- package/lib/firebase-BmGU1FuD.js.map +0 -1
- package/lib/index-BDsEwofZ.js.map +0 -1
- package/lib/index-DBjOT2H1.js +0 -133
- package/lib/index-DBjOT2H1.js.map +0 -1
- package/lib/index.esm-Cx8B1YJQ.js.map +0 -1
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { $RefParser } from "@apidevtools/json-schema-ref-parser";
|
|
2
|
+
import type { Processor } from "../../config/validators/BuildSchema.js";
|
|
3
|
+
import type { OpenAPIDocument } from "../oas/parser/index.js";
|
|
4
|
+
import { flattenAllOf } from "./flattenAllOf.js";
|
|
5
|
+
import { type RecordAny, traverse } from "./traverse.js";
|
|
6
|
+
|
|
7
|
+
export const flattenAllOfProcessor: Processor = async ({ schema, file }) => {
|
|
8
|
+
try {
|
|
9
|
+
// Resolve refs once - creates a lookup table without modifying the schema
|
|
10
|
+
const parser = new $RefParser();
|
|
11
|
+
await parser.resolve(schema);
|
|
12
|
+
const $refs = parser.$refs;
|
|
13
|
+
|
|
14
|
+
const flattened = traverse(schema, (spec) => {
|
|
15
|
+
if (!spec || typeof spec !== "object" || Array.isArray(spec)) {
|
|
16
|
+
return spec;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const isSchemaObject =
|
|
20
|
+
"type" in spec ||
|
|
21
|
+
"properties" in spec ||
|
|
22
|
+
"allOf" in spec ||
|
|
23
|
+
"anyOf" in spec ||
|
|
24
|
+
"oneOf" in spec;
|
|
25
|
+
|
|
26
|
+
if (!isSchemaObject) return spec;
|
|
27
|
+
|
|
28
|
+
if ("allOf" in spec && Array.isArray(spec.allOf)) {
|
|
29
|
+
const resolvedAllOf = spec.allOf.map((item) => {
|
|
30
|
+
if (
|
|
31
|
+
item &&
|
|
32
|
+
typeof item === "object" &&
|
|
33
|
+
"$ref" in item &&
|
|
34
|
+
typeof item.$ref === "string"
|
|
35
|
+
) {
|
|
36
|
+
try {
|
|
37
|
+
return $refs.get(item.$ref) ?? item;
|
|
38
|
+
} catch {
|
|
39
|
+
return item;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return item;
|
|
43
|
+
});
|
|
44
|
+
return flattenAllOf({ ...spec, allOf: resolvedAllOf }) as RecordAny;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return flattenAllOf(spec) as RecordAny;
|
|
48
|
+
}) as OpenAPIDocument;
|
|
49
|
+
|
|
50
|
+
return flattened;
|
|
51
|
+
} catch (error) {
|
|
52
|
+
// biome-ignore lint/suspicious/noConsole: Logging allowed here
|
|
53
|
+
console.warn(
|
|
54
|
+
`Failed to flatten \`allOf\` in ${file}: ${error instanceof Error ? error.message : error}`,
|
|
55
|
+
);
|
|
56
|
+
return schema;
|
|
57
|
+
}
|
|
58
|
+
};
|
|
@@ -9,5 +9,6 @@ export const yaml = {
|
|
|
9
9
|
|
|
10
10
|
export const readFrontmatter = async (filePath: string) => {
|
|
11
11
|
const content = await readFile(filePath, "utf-8");
|
|
12
|
-
|
|
12
|
+
const normalizedContent = content.replace(/\r\n/g, "\n");
|
|
13
|
+
return matter(normalizedContent, { engines: { yaml } });
|
|
13
14
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@shikijs/langs/c3";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@shikijs/langs/gn";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@shikijs/langs/moonbit";
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import fs from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import type {
|
|
4
|
+
ExtensionMcpServer,
|
|
5
|
+
ExtensionMcpServerTool,
|
|
6
|
+
} from "@zuplo/mcp/openapi/types";
|
|
7
|
+
import {
|
|
8
|
+
DEFAULT_MCP_SERVER_NAME,
|
|
9
|
+
DEFAULT_MCP_SERVER_VERSION,
|
|
10
|
+
} from "@zuplo/mcp/server";
|
|
11
|
+
import type { OpenAPIV3_1 } from "openapi-types";
|
|
12
|
+
import type { ProcessorArg } from "../config/validators/BuildSchema.js";
|
|
13
|
+
import { traverse, traverseAsync } from "../lib/util/traverse.js";
|
|
14
|
+
import type { RecordAny } from "../lib/util/types.js";
|
|
15
|
+
import { operations } from "./enrich-with-zuplo.js";
|
|
16
|
+
|
|
17
|
+
// extracts x-mcp-server metadata from the operation using x-zuplo-mcp-tool
|
|
18
|
+
// as a first class citizen.
|
|
19
|
+
const extractOperationSchema = (
|
|
20
|
+
operation: OpenAPIV3_1.OperationObject & RecordAny,
|
|
21
|
+
): ExtensionMcpServerTool | null => {
|
|
22
|
+
if (!operation.operationId) return null;
|
|
23
|
+
|
|
24
|
+
// Check if tool is explicitly disabled
|
|
25
|
+
const mcpToolConfig = operation["x-zuplo-mcp-tool"];
|
|
26
|
+
if (mcpToolConfig?.enabled === false) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const tool: ExtensionMcpServerTool = {
|
|
31
|
+
// Use custom name from x-zuplo-mcp-tool or fallback to operationId
|
|
32
|
+
name: mcpToolConfig?.name || operation.operationId,
|
|
33
|
+
|
|
34
|
+
// Use custom description from x-zuplo-mcp-tool or fallback
|
|
35
|
+
// to operation description
|
|
36
|
+
description:
|
|
37
|
+
mcpToolConfig?.description ||
|
|
38
|
+
operation.summary ||
|
|
39
|
+
operation.description ||
|
|
40
|
+
`Operation ${operation.operationId}`,
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
// Grab valid request body JSON schema for the tool
|
|
44
|
+
const requestBody = operation.requestBody as
|
|
45
|
+
| OpenAPIV3_1.RequestBodyObject
|
|
46
|
+
| undefined;
|
|
47
|
+
|
|
48
|
+
const schema = requestBody?.content?.["application/json"]?.schema;
|
|
49
|
+
if (schema && typeof schema === "object") {
|
|
50
|
+
// TODO: @jpmcb - Zuplo also supports in-path parameters and query parameters
|
|
51
|
+
// as MCP "inputSchema" arguments. In order to document full argument params,
|
|
52
|
+
// Zudoku will need to more intelligently parse these elements of an operation.
|
|
53
|
+
tool.inputSchema = { body: schema };
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return tool;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
// Builds a lookup map of operationId -> operation for efficient access
|
|
60
|
+
const buildOperationLookup = (
|
|
61
|
+
document: OpenAPIV3_1.Document,
|
|
62
|
+
): Map<string, OpenAPIV3_1.OperationObject> => {
|
|
63
|
+
const operationMap = new Map<string, OpenAPIV3_1.OperationObject>();
|
|
64
|
+
|
|
65
|
+
traverse(document, (node, path) => {
|
|
66
|
+
// Check if we're at a path item level (paths -> /some/path -> method)
|
|
67
|
+
// and validate it's in allowed operations
|
|
68
|
+
if (
|
|
69
|
+
!path ||
|
|
70
|
+
path.length < 2 ||
|
|
71
|
+
path[0] !== "paths" ||
|
|
72
|
+
!operations.includes(path[path.length - 1] as string)
|
|
73
|
+
) {
|
|
74
|
+
return node;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (node.operationId) {
|
|
78
|
+
operationMap.set(node.operationId, node);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return node;
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
return operationMap;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
// Takes an OpenAPI document and returns the x-mcp-server tools list defined
|
|
88
|
+
// by an MCP server's options.files[x].operationIds array.
|
|
89
|
+
const findOperationsInDocument = (
|
|
90
|
+
document: OpenAPIV3_1.Document,
|
|
91
|
+
operationIds: string[],
|
|
92
|
+
): ExtensionMcpServerTool[] => {
|
|
93
|
+
const tools: ExtensionMcpServerTool[] = [];
|
|
94
|
+
const operationLookup = buildOperationLookup(document);
|
|
95
|
+
|
|
96
|
+
operationIds.forEach((operationId) => {
|
|
97
|
+
const operation = operationLookup.get(operationId);
|
|
98
|
+
if (operation) {
|
|
99
|
+
const tool = extractOperationSchema(operation);
|
|
100
|
+
if (tool) {
|
|
101
|
+
tools.push(tool);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
return tools;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
// Enriches an OpenAPI schema with x-mcp-server data based on the Zuplo MCP server handler
|
|
110
|
+
export const enrichWithZuploMcpServerData = ({
|
|
111
|
+
rootDir,
|
|
112
|
+
}: {
|
|
113
|
+
rootDir: string;
|
|
114
|
+
}) => {
|
|
115
|
+
return async ({ schema }: ProcessorArg) => {
|
|
116
|
+
if (!schema.paths) return schema;
|
|
117
|
+
const modifiedSchema = { ...schema };
|
|
118
|
+
if (!modifiedSchema?.paths) return modifiedSchema;
|
|
119
|
+
|
|
120
|
+
await traverseAsync(modifiedSchema, async (node, nodePath) => {
|
|
121
|
+
// Check if we're at a "post" operation (paths -> /some/path -> "post").
|
|
122
|
+
// HTTP MCP servers are only allow post operations.
|
|
123
|
+
if (!nodePath || nodePath.length !== 3 || nodePath[2] !== "post") {
|
|
124
|
+
return node;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const operation = node as RecordAny;
|
|
128
|
+
if (!operation?.["x-zuplo-route"]) return node;
|
|
129
|
+
|
|
130
|
+
const handler = operation["x-zuplo-route"]?.handler;
|
|
131
|
+
if (handler?.export !== "mcpServerHandler" || !handler.options?.files)
|
|
132
|
+
return node;
|
|
133
|
+
|
|
134
|
+
const tools: ExtensionMcpServerTool[] = [];
|
|
135
|
+
|
|
136
|
+
for (const fileConfig of handler.options.files) {
|
|
137
|
+
if (!fileConfig.path || !fileConfig.operationIds) continue;
|
|
138
|
+
|
|
139
|
+
const resolvedPath = path.resolve(rootDir, "../", fileConfig.path);
|
|
140
|
+
const fileContent = await fs.readFile(resolvedPath, "utf-8");
|
|
141
|
+
const document = JSON.parse(fileContent);
|
|
142
|
+
|
|
143
|
+
if (document) {
|
|
144
|
+
const fileTools = findOperationsInDocument(
|
|
145
|
+
document,
|
|
146
|
+
fileConfig.operationIds,
|
|
147
|
+
);
|
|
148
|
+
|
|
149
|
+
tools.push(...fileTools);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const mcpExtension: ExtensionMcpServer = {
|
|
154
|
+
name: DEFAULT_MCP_SERVER_NAME,
|
|
155
|
+
version: DEFAULT_MCP_SERVER_VERSION,
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
if (tools.length > 0) {
|
|
159
|
+
mcpExtension.tools = tools;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
node["x-mcp-server"] = mcpExtension;
|
|
163
|
+
return node;
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
return modifiedSchema;
|
|
167
|
+
};
|
|
168
|
+
};
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import type { OpenAPIV3_1 } from "openapi-types";
|
|
2
|
+
import type { ProcessorArg } from "../config/validators/BuildSchema.js";
|
|
3
|
+
import { objectEntries } from "../lib/util/objectEntries.js";
|
|
4
|
+
import type { RecordAny } from "../lib/util/traverse.js";
|
|
5
|
+
import type {
|
|
6
|
+
PoliciesConfigFile,
|
|
7
|
+
PolicyConfigurationFragment,
|
|
8
|
+
} from "./policy-types.js";
|
|
9
|
+
|
|
10
|
+
const API_KEY_REPLACEMENT_STRING = "YOUR_KEY_HERE";
|
|
11
|
+
|
|
12
|
+
const enrichWithApiKeyData = (
|
|
13
|
+
operationObject: RecordAny,
|
|
14
|
+
apiKeyPolicies: PolicyConfigurationFragment[],
|
|
15
|
+
) => {
|
|
16
|
+
if (apiKeyPolicies.length === 0) {
|
|
17
|
+
return operationObject;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const firstPolicy = apiKeyPolicies[0];
|
|
21
|
+
const authorizationHeader =
|
|
22
|
+
(firstPolicy?.handler.options?.authHeader as string) || "Authorization";
|
|
23
|
+
const authorizationScheme = (firstPolicy?.handler.options?.authScheme ??
|
|
24
|
+
"Bearer") as string;
|
|
25
|
+
const authSchemeExample =
|
|
26
|
+
authorizationScheme !== ""
|
|
27
|
+
? `${authorizationScheme} ${API_KEY_REPLACEMENT_STRING}`
|
|
28
|
+
: API_KEY_REPLACEMENT_STRING;
|
|
29
|
+
|
|
30
|
+
// Add API key header parameter
|
|
31
|
+
const apiKeyHeader: OpenAPIV3_1.ParameterObject = {
|
|
32
|
+
name: authorizationHeader,
|
|
33
|
+
in: "header",
|
|
34
|
+
required: true,
|
|
35
|
+
example: authSchemeExample,
|
|
36
|
+
schema: {
|
|
37
|
+
type: "string",
|
|
38
|
+
},
|
|
39
|
+
description: `The \`${authorizationHeader}\` header is used to authenticate with the API using your API key. Value is of the format \`${authSchemeExample}\`.`,
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const parameters = operationObject.parameters || [];
|
|
43
|
+
if (
|
|
44
|
+
!parameters.some((param: RecordAny) => param.name === authorizationHeader)
|
|
45
|
+
) {
|
|
46
|
+
operationObject.parameters = [apiKeyHeader, ...parameters];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Add security scheme and requirement
|
|
50
|
+
const apiSecuritySchemeId = "api_key";
|
|
51
|
+
const apiKeySecurityRequirement = { [apiSecuritySchemeId]: [] };
|
|
52
|
+
|
|
53
|
+
if (!operationObject.security) {
|
|
54
|
+
operationObject.security = [apiKeySecurityRequirement];
|
|
55
|
+
} else if (
|
|
56
|
+
!operationObject.security.some((req: RecordAny) => req[apiSecuritySchemeId])
|
|
57
|
+
) {
|
|
58
|
+
operationObject.security = [
|
|
59
|
+
apiKeySecurityRequirement,
|
|
60
|
+
...operationObject.security,
|
|
61
|
+
];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return operationObject;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const enrichWithRateLimitData = (
|
|
68
|
+
operationObject: RecordAny,
|
|
69
|
+
rateLimitPolicies: PolicyConfigurationFragment[],
|
|
70
|
+
) => {
|
|
71
|
+
if (rateLimitPolicies.length === 0) {
|
|
72
|
+
return operationObject;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const shouldIncludeHeader = rateLimitPolicies.some(
|
|
76
|
+
(policy) => policy.handler.options?.headerMode !== "none",
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
if (!operationObject.responses) {
|
|
80
|
+
operationObject.responses = {};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (!operationObject.responses["429"]) {
|
|
84
|
+
operationObject.responses["429"] = {
|
|
85
|
+
$ref: shouldIncludeHeader
|
|
86
|
+
? "#/components/responses/RateLimitWithRetryAfter"
|
|
87
|
+
: "#/components/responses/RateLimitNoRetryAfter",
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return operationObject;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
// biome-ignore format: for readability
|
|
95
|
+
export const operations = [
|
|
96
|
+
"get", "put", "post", "delete",
|
|
97
|
+
"options", "head", "patch", "trace",
|
|
98
|
+
];
|
|
99
|
+
|
|
100
|
+
const rateLimitingResponse: OpenAPIV3_1.ResponseObject = {
|
|
101
|
+
description: "Rate Limiting Response",
|
|
102
|
+
content: {
|
|
103
|
+
"application/json": {
|
|
104
|
+
schema: {
|
|
105
|
+
type: "object",
|
|
106
|
+
required: ["type", "title", "status"],
|
|
107
|
+
examples: [
|
|
108
|
+
{
|
|
109
|
+
type: "https://httpproblems.com/http-status/429",
|
|
110
|
+
title: "Too Many Requests",
|
|
111
|
+
status: 429,
|
|
112
|
+
instance: "/foo/bar",
|
|
113
|
+
},
|
|
114
|
+
],
|
|
115
|
+
properties: {
|
|
116
|
+
type: {
|
|
117
|
+
type: "string",
|
|
118
|
+
example: "https://httpproblems.com/http-status/429",
|
|
119
|
+
description: "A URI reference that identifies the problem.",
|
|
120
|
+
},
|
|
121
|
+
title: {
|
|
122
|
+
type: "string",
|
|
123
|
+
example: "Too Many Requests",
|
|
124
|
+
description: "A short, human-readable summary of the problem.",
|
|
125
|
+
},
|
|
126
|
+
status: {
|
|
127
|
+
type: "number",
|
|
128
|
+
example: 429,
|
|
129
|
+
description: "The HTTP status code.",
|
|
130
|
+
},
|
|
131
|
+
instance: {
|
|
132
|
+
type: "string",
|
|
133
|
+
example: "/foo/bar",
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
const rateLimitingResponseWithHeader: OpenAPIV3_1.ResponseObject = {
|
|
142
|
+
...rateLimitingResponse,
|
|
143
|
+
headers: {
|
|
144
|
+
"retry-after": {
|
|
145
|
+
description: "The number of seconds to wait before making a new request.",
|
|
146
|
+
schema: {
|
|
147
|
+
type: "integer",
|
|
148
|
+
example: 60,
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
export const enrichWithZuploData = ({
|
|
155
|
+
policiesConfig,
|
|
156
|
+
}: {
|
|
157
|
+
policiesConfig: PoliciesConfigFile;
|
|
158
|
+
}) => {
|
|
159
|
+
return ({ schema }: ProcessorArg) => {
|
|
160
|
+
if (!schema.paths) return schema;
|
|
161
|
+
|
|
162
|
+
let hasRateLimitPolicies = false;
|
|
163
|
+
|
|
164
|
+
for (const [, pathItem] of objectEntries<RecordAny>(schema.paths)) {
|
|
165
|
+
for (const method of operations) {
|
|
166
|
+
const operation = pathItem[method];
|
|
167
|
+
if (!operation?.["x-zuplo-route"]) continue;
|
|
168
|
+
|
|
169
|
+
const inboundPolicies = operation[
|
|
170
|
+
"x-zuplo-route"
|
|
171
|
+
]?.policies?.inbound?.reduce((acc: string[], policyName: string) => {
|
|
172
|
+
const policy = policiesConfig.policies?.find(
|
|
173
|
+
({ name }) => name === policyName,
|
|
174
|
+
);
|
|
175
|
+
if (!policy) return acc;
|
|
176
|
+
|
|
177
|
+
// Handle composite policies
|
|
178
|
+
if (policy.handler.export === "CompositeInboundPolicy") {
|
|
179
|
+
const childPolicies = policy.handler.options?.policies as
|
|
180
|
+
| string[]
|
|
181
|
+
| undefined;
|
|
182
|
+
return childPolicies ? [...acc, ...childPolicies] : acc;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
return [...acc, policyName];
|
|
186
|
+
}, []);
|
|
187
|
+
|
|
188
|
+
if (!inboundPolicies) continue;
|
|
189
|
+
|
|
190
|
+
// Find API key policies
|
|
191
|
+
const apiKeyPolicies =
|
|
192
|
+
policiesConfig.policies?.filter(
|
|
193
|
+
(policy) =>
|
|
194
|
+
inboundPolicies.includes(policy.name) &&
|
|
195
|
+
(policy.handler.export === "ApiAuthKeyInboundPolicy" ||
|
|
196
|
+
policy.handler.export === "ApiKeyInboundPolicy") &&
|
|
197
|
+
!policy.handler.options
|
|
198
|
+
?.disableAutomaticallyAddingKeyHeaderToOpenApi,
|
|
199
|
+
) ?? [];
|
|
200
|
+
|
|
201
|
+
// Find rate limit policies
|
|
202
|
+
const rateLimitPolicies =
|
|
203
|
+
policiesConfig.policies?.filter(
|
|
204
|
+
(policy) =>
|
|
205
|
+
inboundPolicies.includes(policy.name) &&
|
|
206
|
+
(policy.handler.export === "RateLimitInboundPolicy" ||
|
|
207
|
+
policy.handler.export === "ComplexRateLimitInboundPolicy"),
|
|
208
|
+
) ?? [];
|
|
209
|
+
|
|
210
|
+
if (rateLimitPolicies.length > 0) {
|
|
211
|
+
hasRateLimitPolicies = true;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// Apply enrichments directly to the operation
|
|
215
|
+
pathItem[method] = enrichWithApiKeyData(operation, apiKeyPolicies);
|
|
216
|
+
pathItem[method] = enrichWithRateLimitData(
|
|
217
|
+
pathItem[method],
|
|
218
|
+
rateLimitPolicies,
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// Add security scheme if we have API key policies
|
|
224
|
+
if (
|
|
225
|
+
policiesConfig.policies?.some(
|
|
226
|
+
(policy) =>
|
|
227
|
+
policy.handler.export === "ApiAuthKeyInboundPolicy" ||
|
|
228
|
+
policy.handler.export === "ApiKeyInboundPolicy",
|
|
229
|
+
)
|
|
230
|
+
) {
|
|
231
|
+
if (!schema.components) schema.components = {};
|
|
232
|
+
if (!schema.components.securitySchemes)
|
|
233
|
+
schema.components.securitySchemes = {};
|
|
234
|
+
|
|
235
|
+
if (!schema.components.securitySchemes.api_key) {
|
|
236
|
+
schema.components.securitySchemes.api_key = {
|
|
237
|
+
type: "http",
|
|
238
|
+
scheme: "bearer",
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// Add rate limiting responses only if we found rate limiting policies
|
|
244
|
+
if (hasRateLimitPolicies) {
|
|
245
|
+
if (!schema.components) schema.components = {};
|
|
246
|
+
if (!schema.components.responses) schema.components.responses = {};
|
|
247
|
+
schema.components.responses.RateLimitNoRetryAfter = rateLimitingResponse;
|
|
248
|
+
schema.components.responses.RateLimitWithRetryAfter =
|
|
249
|
+
rateLimitingResponseWithHeader;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
return schema;
|
|
253
|
+
};
|
|
254
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was automatically generated by json-schema-to-typescript.
|
|
3
|
+
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
|
4
|
+
* and run json-schema-to-typescript to regenerate this file.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export interface PoliciesConfigFile {
|
|
8
|
+
policies?: PolicyConfigurationFragment[];
|
|
9
|
+
corsPolicies?: CorsPolicyConfiguration[];
|
|
10
|
+
}
|
|
11
|
+
export interface PolicyConfigurationFragment {
|
|
12
|
+
name: string;
|
|
13
|
+
policyType: string;
|
|
14
|
+
handler: HandlerDefinition;
|
|
15
|
+
options?: {
|
|
16
|
+
[k: string]: unknown;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export interface HandlerDefinition {
|
|
20
|
+
module: string;
|
|
21
|
+
export: string;
|
|
22
|
+
options?: {
|
|
23
|
+
[k: string]: unknown;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export interface CorsPolicyConfiguration {
|
|
27
|
+
name: string;
|
|
28
|
+
allowCredentials?: boolean;
|
|
29
|
+
maxAge?: number;
|
|
30
|
+
allowedOrigins: string[] | string;
|
|
31
|
+
allowedMethods?:
|
|
32
|
+
| (
|
|
33
|
+
| "GET"
|
|
34
|
+
| "HEAD"
|
|
35
|
+
| "POST"
|
|
36
|
+
| "PUT"
|
|
37
|
+
| "DELETE"
|
|
38
|
+
| "CONNECT"
|
|
39
|
+
| "OPTIONS"
|
|
40
|
+
| "TRACE"
|
|
41
|
+
| "PATCH"
|
|
42
|
+
)[]
|
|
43
|
+
| string;
|
|
44
|
+
allowedHeaders?: string[] | string;
|
|
45
|
+
exposeHeaders?: string[] | string;
|
|
46
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import fs from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { ZuploEnv } from "../app/env.js";
|
|
4
|
+
import type {
|
|
5
|
+
Processor,
|
|
6
|
+
ProcessorArg,
|
|
7
|
+
} from "../config/validators/BuildSchema.js";
|
|
8
|
+
import { removeExtensions } from "../lib/plugins/openapi/processors/removeExtensions.js";
|
|
9
|
+
import { removeParameters } from "../lib/plugins/openapi/processors/removeParameters.js";
|
|
10
|
+
import { removePaths } from "../lib/plugins/openapi/processors/removePaths.js";
|
|
11
|
+
import { enrichWithZuploData } from "./enrich-with-zuplo.js";
|
|
12
|
+
import { enrichWithZuploMcpServerData } from "./enrich-with-zuplo-mcp.js";
|
|
13
|
+
|
|
14
|
+
export const getProcessors = async (rootDir: string): Promise<Processor[]> => {
|
|
15
|
+
const policiesConfig = JSON.parse(
|
|
16
|
+
await fs.readFile(path.join(rootDir, "../config/policies.json"), "utf-8"),
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
return [
|
|
20
|
+
removePaths({ shouldRemove: ({ operation }) => operation["x-internal"] }),
|
|
21
|
+
removeParameters({
|
|
22
|
+
shouldRemove: ({ parameter }) => parameter["x-internal"],
|
|
23
|
+
}),
|
|
24
|
+
enrichWithZuploData({ policiesConfig }),
|
|
25
|
+
enrichWithZuploMcpServerData({ rootDir }),
|
|
26
|
+
({ schema }: ProcessorArg) => {
|
|
27
|
+
const url = ZuploEnv.serverUrl;
|
|
28
|
+
if (!url) return schema;
|
|
29
|
+
return { ...schema, servers: [{ url }] };
|
|
30
|
+
},
|
|
31
|
+
removeExtensions({ shouldRemove: (key) => key.startsWith("x-zuplo") }),
|
|
32
|
+
];
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export default getProcessors;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ZudokuConfig } from "../config/validators/validate.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated `withZuplo` is no longer needed and will automatically be applied. It will be removed in a future version.
|
|
5
|
+
*/
|
|
6
|
+
const withZuplo = (config: ZudokuConfig): ZudokuConfig => {
|
|
7
|
+
// biome-ignore lint/suspicious/noConsole: Logging allowed here
|
|
8
|
+
console.warn(
|
|
9
|
+
"`withZuplo` is no longer needed and will automatically be applied. It will be removed in a future version.",
|
|
10
|
+
);
|
|
11
|
+
return config;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default withZuplo;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { j as s } from "./jsx-runtime-BzflLqGi.js";
|
|
2
|
-
import { useMemo as v } from "react";
|
|
3
|
-
import { O as f } from "./chunk-EPOLDU6W-C6C8jAwd.js";
|
|
4
|
-
import { j } from "./ZudokuContext-BZB1TWdT.js";
|
|
5
|
-
import { g as c, O as x, G as O } from "./index-BQB9hb6n.js";
|
|
6
|
-
const y = ({
|
|
7
|
-
basePath: e,
|
|
8
|
-
version: n,
|
|
9
|
-
config: r,
|
|
10
|
-
client: a
|
|
11
|
-
}) => {
|
|
12
|
-
const p = v(() => {
|
|
13
|
-
const { versions: i, labels: u } = c(r), o = n ?? i.at(0), m = Object.fromEntries(
|
|
14
|
-
i.map((t) => [
|
|
15
|
-
t,
|
|
16
|
-
{ path: j(e, t), label: u[t] ?? t }
|
|
17
|
-
])
|
|
18
|
-
);
|
|
19
|
-
return {
|
|
20
|
-
config: {
|
|
21
|
-
...r,
|
|
22
|
-
version: o,
|
|
23
|
-
versions: m,
|
|
24
|
-
input: (() => {
|
|
25
|
-
if (!Array.isArray(r.input))
|
|
26
|
-
return r.input;
|
|
27
|
-
const t = o ? r.input.find((l) => l.path === o) : r.input[0];
|
|
28
|
-
if (!t)
|
|
29
|
-
throw new Error(`No input found for version: ${o}`);
|
|
30
|
-
return t.input;
|
|
31
|
-
})()
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
}, [r, e, n]);
|
|
35
|
-
return /* @__PURE__ */ s.jsx(x, { value: p, children: /* @__PURE__ */ s.jsx(O, { client: a, children: /* @__PURE__ */ s.jsx(f, {}) }) });
|
|
36
|
-
};
|
|
37
|
-
export {
|
|
38
|
-
y as OasProvider
|
|
39
|
-
};
|
|
40
|
-
//# sourceMappingURL=OasProvider-DSe-hk5Y.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OasProvider-DSe-hk5Y.js","sources":["../src/lib/plugins/openapi/OasProvider.tsx"],"sourcesContent":["import { useMemo } from \"react\";\nimport { Outlet } from \"react-router\";\nimport { joinUrl } from \"../../util/joinUrl.js\";\nimport type { GraphQLClient } from \"./client/GraphQLClient.js\";\nimport { GraphQLProvider } from \"./client/GraphQLContext.js\";\nimport { OasConfigProvider } from \"./context.js\";\nimport type { OasPluginConfig } from \"./interfaces.js\";\nimport { getVersionMetadata } from \"./util/getRoutes.js\";\n\nexport const OasProvider = ({\n basePath,\n version,\n config,\n client,\n}: {\n basePath: string;\n version?: string;\n config: OasPluginConfig;\n client: GraphQLClient;\n}) => {\n const value = useMemo(() => {\n const { versions: availableVersions, labels } = getVersionMetadata(config);\n const currentVersion = version ?? availableVersions.at(0);\n\n const versionLinks = Object.fromEntries(\n availableVersions.map((id) => [\n id,\n { path: joinUrl(basePath, id), label: labels[id] ?? id },\n ]),\n );\n\n const resolveInput = (): string | (() => Promise<unknown>) => {\n if (!Array.isArray(config.input)) {\n return config.input;\n }\n\n const versionConfig = currentVersion\n ? config.input.find((v) => v.path === currentVersion)\n : config.input[0];\n\n if (!versionConfig) {\n throw new Error(`No input found for version: ${currentVersion}`);\n }\n\n return versionConfig.input;\n };\n\n return {\n config: {\n ...config,\n version: currentVersion,\n versions: versionLinks,\n input: resolveInput(),\n },\n };\n }, [config, basePath, version]);\n\n return (\n <OasConfigProvider value={value}>\n <GraphQLProvider client={client}>\n <Outlet />\n </GraphQLProvider>\n </OasConfigProvider>\n );\n};\n"],"names":["OasProvider","basePath","version","config","client","value","useMemo","availableVersions","labels","getVersionMetadata","currentVersion","versionLinks","id","joinUrl","versionConfig","v","jsx","OasConfigProvider","GraphQLProvider","Outlet"],"mappings":";;;;;AASO,MAAMA,IAAc,CAAC;AAAA,EAC1B,UAAAC;AAAA,EACA,SAAAC;AAAA,EACA,QAAAC;AAAA,EACA,QAAAC;AACF,MAKM;AACJ,QAAMC,IAAQC,EAAQ,MAAM;AAC1B,UAAM,EAAE,UAAUC,GAAmB,QAAAC,EAAA,IAAWC,EAAmBN,CAAM,GACnEO,IAAiBR,KAAWK,EAAkB,GAAG,CAAC,GAElDI,IAAe,OAAO;AAAA,MAC1BJ,EAAkB,IAAI,CAACK,MAAO;AAAA,QAC5BA;AAAA,QACA,EAAE,MAAMC,EAAQZ,GAAUW,CAAE,GAAG,OAAOJ,EAAOI,CAAE,KAAKA,EAAA;AAAA,MAAG,CACxD;AAAA,IAAA;AAmBH,WAAO;AAAA,MACL,QAAQ;AAAA,QACN,GAAGT;AAAA,QACH,SAASO;AAAA,QACT,UAAUC;AAAA,QACV,QArBiB,MAAyC;AAC5D,cAAI,CAAC,MAAM,QAAQR,EAAO,KAAK;AAC7B,mBAAOA,EAAO;AAGhB,gBAAMW,IAAgBJ,IAClBP,EAAO,MAAM,KAAK,CAACY,MAAMA,EAAE,SAASL,CAAc,IAClDP,EAAO,MAAM,CAAC;AAElB,cAAI,CAACW;AACH,kBAAM,IAAI,MAAM,+BAA+BJ,CAAc,EAAE;AAGjE,iBAAOI,EAAc;AAAA,QACvB,GAOW;AAAA,MAAa;AAAA,IACtB;AAAA,EAEJ,GAAG,CAACX,GAAQF,GAAUC,CAAO,CAAC;AAE9B,SACEc,gBAAAA,EAAAA,IAACC,KAAkB,OAAAZ,GACjB,UAAAW,gBAAAA,EAAAA,IAACE,KAAgB,QAAAd,GACf,UAAAY,gBAAAA,EAAAA,IAACG,GAAA,CAAA,CAAO,EAAA,CACV,EAAA,CACF;AAEJ;"}
|