@navios/adapter-xml 0.1.0 → 0.7.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.
Files changed (101) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.md +2 -1
  3. package/bun-plugin.mts +5 -3
  4. package/bunPlugin.cache +1 -1
  5. package/dist/bun-plugin.d.mts.map +1 -1
  6. package/dist/src/adapters/xml-stream-adapter.service.d.mts +63 -8
  7. package/dist/src/adapters/xml-stream-adapter.service.d.mts.map +1 -1
  8. package/dist/src/decorators/component.decorator.d.mts +68 -2
  9. package/dist/src/decorators/component.decorator.d.mts.map +1 -1
  10. package/dist/src/decorators/xml-stream.decorator.d.mts +58 -3
  11. package/dist/src/decorators/xml-stream.decorator.d.mts.map +1 -1
  12. package/dist/src/define-environment.d.mts +2 -2
  13. package/dist/src/define-environment.d.mts.map +1 -1
  14. package/dist/src/handlers/xml-stream.d.mts +25 -3
  15. package/dist/src/handlers/xml-stream.d.mts.map +1 -1
  16. package/dist/src/runtime/render-to-xml.d.mts +70 -2
  17. package/dist/src/runtime/render-to-xml.d.mts.map +1 -1
  18. package/dist/src/tags/define-tag.d.mts +8 -0
  19. package/dist/src/tags/define-tag.d.mts.map +1 -1
  20. package/dist/src/types/component.d.mts +46 -2
  21. package/dist/src/types/component.d.mts.map +1 -1
  22. package/dist/src/types/config.d.mts +22 -0
  23. package/dist/src/types/config.d.mts.map +1 -1
  24. package/dist/tsconfig.lib.tsbuildinfo +1 -1
  25. package/dist/tsconfig.spec.tsbuildinfo +1 -1
  26. package/dist/tsconfig.tsbuildinfo +1 -1
  27. package/dist/tsdown.config.d.mts +3 -0
  28. package/dist/tsdown.config.d.mts.map +1 -0
  29. package/dist/vitest.e2e.fastify.config.d.mts.map +1 -1
  30. package/lib/create-element--Gd2L8UR.d.cts +26 -0
  31. package/lib/create-element--Gd2L8UR.d.cts.map +1 -0
  32. package/lib/create-element-61MP7_99.d.mts +26 -0
  33. package/lib/create-element-61MP7_99.d.mts.map +1 -0
  34. package/lib/create-element-DiOt_-Vs.cjs +183 -0
  35. package/lib/create-element-DiOt_-Vs.cjs.map +1 -0
  36. package/lib/create-element-NZEYaRw5.mjs +124 -0
  37. package/lib/create-element-NZEYaRw5.mjs.map +1 -0
  38. package/lib/index.cjs +746 -0
  39. package/lib/index.cjs.map +1 -0
  40. package/lib/index.d.cts +520 -0
  41. package/lib/index.d.cts.map +1 -0
  42. package/lib/index.d.mts +520 -29
  43. package/lib/index.d.mts.map +1 -0
  44. package/lib/index.mjs +692 -223
  45. package/lib/index.mjs.map +1 -1
  46. package/lib/jsx-dev-runtime.cjs +11 -0
  47. package/lib/jsx-dev-runtime.cjs.map +1 -0
  48. package/lib/jsx-dev-runtime.d.cts +8 -0
  49. package/lib/jsx-dev-runtime.d.cts.map +1 -0
  50. package/lib/jsx-dev-runtime.d.mts +8 -4
  51. package/lib/jsx-dev-runtime.d.mts.map +1 -0
  52. package/lib/jsx-dev-runtime.mjs +5 -6
  53. package/lib/jsx-dev-runtime.mjs.map +1 -1
  54. package/lib/jsx-runtime.cjs +5 -0
  55. package/lib/jsx-runtime.d.cts +3 -0
  56. package/lib/jsx-runtime.d.mts +3 -3
  57. package/lib/jsx-runtime.mjs +3 -3
  58. package/lib/jsx.cjs +0 -0
  59. package/lib/jsx.d.cts +19 -0
  60. package/lib/jsx.d.cts.map +1 -0
  61. package/lib/jsx.d.mts +19 -1
  62. package/lib/jsx.d.mts.map +1 -0
  63. package/lib/jsx.mjs +1 -3
  64. package/lib/xml-node-BQA44ydQ.d.mts +96 -0
  65. package/lib/xml-node-BQA44ydQ.d.mts.map +1 -0
  66. package/lib/xml-node-CddziLym.d.cts +96 -0
  67. package/lib/xml-node-CddziLym.d.cts.map +1 -0
  68. package/package.json +20 -20
  69. package/project.json +2 -2
  70. package/src/adapters/xml-stream-adapter.service.mts +77 -16
  71. package/src/decorators/component.decorator.mts +72 -10
  72. package/src/decorators/component.decorator.spec.mts +40 -22
  73. package/src/decorators/xml-stream.decorator.mts +58 -3
  74. package/src/define-environment.mts +5 -6
  75. package/src/handlers/xml-stream.mts +25 -3
  76. package/src/runtime/render-to-xml.mts +72 -4
  77. package/src/tags/define-tag.mts +8 -0
  78. package/src/types/component.mts +46 -2
  79. package/src/types/config.mts +22 -0
  80. package/tsdown.config.mts +39 -0
  81. package/dist/tsup.config.d.mts +0 -3
  82. package/dist/tsup.config.d.mts.map +0 -1
  83. package/lib/_tsup-dts-rollup.d.mts +0 -414
  84. package/lib/_tsup-dts-rollup.d.ts +0 -414
  85. package/lib/chunk-6OR6LGJA.mjs +0 -153
  86. package/lib/chunk-6OR6LGJA.mjs.map +0 -1
  87. package/lib/index.d.ts +0 -29
  88. package/lib/index.js +0 -376
  89. package/lib/index.js.map +0 -1
  90. package/lib/jsx-dev-runtime.d.ts +0 -4
  91. package/lib/jsx-dev-runtime.js +0 -61
  92. package/lib/jsx-dev-runtime.js.map +0 -1
  93. package/lib/jsx-runtime.d.ts +0 -3
  94. package/lib/jsx-runtime.js +0 -57
  95. package/lib/jsx-runtime.js.map +0 -1
  96. package/lib/jsx-runtime.mjs.map +0 -1
  97. package/lib/jsx.d.ts +0 -1
  98. package/lib/jsx.js +0 -4
  99. package/lib/jsx.js.map +0 -1
  100. package/lib/jsx.mjs.map +0 -1
  101. package/tsup.config.mts +0 -18
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","names":["CDataSymbol","RawXmlSymbol","AsyncComponent","CDataSymbol","ClassComponent","Fragment","RawXmlSymbol","MissingContainerError","Error","componentName","name","renderToXml","node","options","declaration","encoding","pretty","container","xml","renderNode","indent","escapeXml","String","isClassComponentNode","componentClass","instance","get","props","result","render","resolved","Promise","isAsyncNode","promise","isCDataNode","renderCData","content","isRawXmlNode","type","children","renderedChildren","all","filter","c","map","join","prefix","repeat","newline","attrs","Object","entries","_","v","k","escapeAttr","length","childIndent","resolvedChildren","childContent","hasOnlySimpleContent","every","includes","escaped","replace","str","defineTag","name","propsSchema","component","props","children","rest","parse","type","Array","isArray","tagName","getEndpointMetadata","XmlStreamAdapterToken","XmlStream","endpoint","target","context","Error","kind","config","metadata","endpointMetadata","url","method","adapterToken","classMethod","name","httpMethod","declareXmlStream","config","inject","Injectable","StreamAdapterToken","XmlStreamAdapterToken","renderToXml","token","XmlStreamAdapterService","streamAdapter","prepareArguments","handlerMetadata","provideSchema","hasSchema","provideHandler","controller","getters","config","formatArguments","request","argument","promises","getter","res","Promise","push","all","contentType","context","reply","controllerInstance","get","xmlNode","classMethod","xml","declaration","xmlDeclaration","encoding","container","isHttpStandardEnvironment","undefined","headers","key","value","Object","entries","String","Response","status","successStatusCode","header","send","XmlStreamAdapterToken","XmlStreamAdapterService","defineXmlEnvironment","httpTokens","Map"],"sources":["../src/runtime/special-nodes.mts","../src/runtime/render-to-xml.mts","../src/tags/define-tag.mts","../src/decorators/xml-stream.decorator.mts","../src/handlers/xml-stream.mts","../src/adapters/xml-stream-adapter.service.mts","../src/define-environment.mts"],"sourcesContent":["import type { CDataNode, RawXmlNode } from '../types/xml-node.mjs'\nimport { CDataSymbol, RawXmlSymbol } from '../types/xml-node.mjs'\n\n/**\n * CDATA component - wraps content in <![CDATA[...]]>\n * Use for text content that may contain characters like < > &\n * that would otherwise need escaping.\n *\n * Note: If content contains \"]]>\", it will be split into multiple CDATA sections.\n */\nexport function CData({ children }: { children: string }): CDataNode {\n return {\n type: CDataSymbol,\n content: String(children),\n }\n}\n\n/**\n * DangerouslyInsertRawXml - inserts raw XML/HTML without any escaping or wrapping\n *\n * WARNING: This bypasses all XML escaping. Only use with trusted content!\n * Use cases:\n * - Pre-rendered XML fragments\n * - HTML content in RSS/Atom feeds (in description/content:encoded)\n * - Including XML from external sources that's already valid\n */\nexport function DangerouslyInsertRawXml({ children }: { children: string }): RawXmlNode {\n return {\n type: RawXmlSymbol,\n content: String(children),\n }\n}\n","import type { Container, ScopedContainer } from '@navios/core'\n\nimport type { XmlComponent } from '../types/component.mjs'\nimport type {\n AnyXmlNode,\n AsyncXmlNode,\n CDataNode,\n ClassComponentNode,\n RawXmlNode,\n} from '../types/xml-node.mjs'\n\nimport {\n AsyncComponent,\n CDataSymbol,\n ClassComponent,\n Fragment,\n RawXmlSymbol,\n} from '../types/xml-node.mjs'\n\n/**\n * Options for rendering XML from JSX nodes.\n *\n * @example\n * ```ts\n * const xml = await renderToXml(<rss version=\"2.0\">...</rss>, {\n * declaration: true,\n * encoding: 'UTF-8',\n * pretty: true,\n * container: myContainer, // Required for class components\n * })\n * ```\n */\nexport interface RenderOptions {\n /** Include XML declaration (<?xml version=\"1.0\"?>) - defaults to true */\n declaration?: boolean\n /** XML encoding, defaults to 'UTF-8' */\n encoding?: string\n /** Pretty print with indentation */\n pretty?: boolean\n /**\n * DI container for resolving class components.\n * Required if the tree contains any class components.\n */\n container?: Container | ScopedContainer\n}\n\n/**\n * Error thrown when attempting to render a class component without a container.\n *\n * Class components require a dependency injection container to be instantiated.\n * This error is thrown when `renderToXml` is called with a class component in\n * the tree but no container is provided in the options.\n *\n * @example\n * ```ts\n * try {\n * await renderToXml(<MyClassComponent />)\n * } catch (error) {\n * if (error instanceof MissingContainerError) {\n * // Provide a container\n * await renderToXml(<MyClassComponent />, { container })\n * }\n * }\n * ```\n */\nexport class MissingContainerError extends Error {\n constructor(componentName: string) {\n super(\n `[@navios/adapter-xml] Cannot render class component \"${componentName}\" without a container. ` +\n `Pass a container to renderToXml options: renderToXml(node, { container })`,\n )\n this.name = 'MissingContainerError'\n }\n}\n\n/**\n * Renders a JSX XML node tree to an XML string.\n *\n * This function handles:\n * - Regular XML nodes (tags with props and children)\n * - Async components (resolves promises in parallel)\n * - Class components (resolves via DI container)\n * - CDATA sections\n * - Raw XML content\n * - Fragments\n * - Text content with proper escaping\n *\n * @param node - The root XML node (JSX element) to render.\n * @param options - Rendering options including declaration, encoding, pretty printing, and container.\n * @returns A promise that resolves to the XML string.\n *\n * @throws {MissingContainerError} If the tree contains class components but no container is provided.\n *\n * @example\n * ```ts\n * // Simple rendering\n * const xml = await renderToXml(<rss version=\"2.0\"><channel>...</channel></rss>)\n *\n * // With options\n * const xml = await renderToXml(<feed>...</feed>, {\n * declaration: true,\n * encoding: 'UTF-8',\n * pretty: true,\n * })\n *\n * // With class components (requires container)\n * const container = new Container()\n * container.beginRequest('request-id')\n * const xml = await renderToXml(<MyClassComponent />, { container })\n * ```\n */\nexport async function renderToXml(\n node: AnyXmlNode,\n options: RenderOptions = {},\n): Promise<string> {\n const {\n declaration = true,\n encoding = 'UTF-8',\n pretty = false,\n container,\n } = options\n\n let xml = ''\n if (declaration) {\n xml += `<?xml version=\"1.0\" encoding=\"${encoding}\"?>`\n if (pretty) xml += '\\n'\n }\n\n xml += await renderNode(node, pretty ? 0 : -1, container)\n return xml\n}\n\nasync function renderNode(\n node: AnyXmlNode,\n indent: number,\n container: Container | ScopedContainer | undefined,\n): Promise<string> {\n if (node == null) return ''\n if (typeof node === 'string') return escapeXml(node)\n if (typeof node === 'number') return String(node)\n\n // Handle class components - resolve via DI container\n if (isClassComponentNode(node)) {\n if (!container) {\n throw new MissingContainerError(node.componentClass.name)\n }\n\n // Resolve the component instance from the container, passing props as schema args\n // This validates props via Zod schema if defined on the component\n const instance = (await container.get(\n node.componentClass as any,\n node.props,\n )) as XmlComponent\n\n // Call render() - no arguments, props are already in the instance\n const result = instance.render()\n\n // Handle async render methods\n const resolved = result instanceof Promise ? await result : result\n\n // Recursively render the result\n return renderNode(resolved, indent, container)\n }\n\n // Handle async components - resolve the promise first\n if (isAsyncNode(node)) {\n const resolved = await node.promise\n return renderNode(resolved, indent, container)\n }\n\n // Handle CDATA nodes\n if (isCDataNode(node)) {\n return renderCData(node.content)\n }\n\n // Handle Raw XML nodes - no escaping\n if (isRawXmlNode(node)) {\n return node.content\n }\n\n const { type, props, children } = node\n\n if (type === Fragment) {\n const renderedChildren = await Promise.all(\n children\n .filter((c) => c != null)\n .map((c) => renderNode(c, indent, container)),\n )\n return renderedChildren.join('')\n }\n\n const prefix = indent >= 0 ? ' '.repeat(indent) : ''\n const newline = indent >= 0 ? '\\n' : ''\n\n const attrs = Object.entries(props)\n .filter(([_, v]) => v != null)\n .map(([k, v]) => ` ${k}=\"${escapeAttr(String(v))}\"`)\n .join('')\n\n if (children.length === 0) {\n return `${prefix}<${type}${attrs}/>${newline}`\n }\n\n const childIndent = indent >= 0 ? indent + 1 : -1\n\n // Resolve all children (including async and class components) in parallel\n const resolvedChildren = await Promise.all(\n children\n .filter((c) => c != null)\n .map((c) => renderNode(c, childIndent, container)),\n )\n const childContent = resolvedChildren.join('')\n\n // Check if children are simple (text, numbers, CDATA, or raw XML)\n const hasOnlySimpleContent = children.every(\n (c) =>\n typeof c === 'string' ||\n typeof c === 'number' ||\n isCDataNode(c) ||\n isRawXmlNode(c),\n )\n if (hasOnlySimpleContent) {\n return `${prefix}<${type}${attrs}>${childContent}</${type}>${newline}`\n }\n\n return `${prefix}<${type}${attrs}>${newline}${childContent}${prefix}</${type}>${newline}`\n}\n\nfunction isClassComponentNode(node: unknown): node is ClassComponentNode {\n return (\n node !== null &&\n typeof node === 'object' &&\n 'type' in node &&\n node.type === ClassComponent\n )\n}\n\nfunction isAsyncNode(node: unknown): node is AsyncXmlNode {\n return (\n node !== null &&\n typeof node === 'object' &&\n 'type' in node &&\n node.type === AsyncComponent\n )\n}\n\nfunction isCDataNode(node: any): node is CDataNode {\n return node && typeof node === 'object' && node.type === CDataSymbol\n}\n\nfunction isRawXmlNode(node: any): node is RawXmlNode {\n return node && typeof node === 'object' && node.type === RawXmlSymbol\n}\n\n/**\n * Renders content as CDATA section.\n * If content contains \"]]>\", splits into multiple CDATA sections.\n * The technique is to end the CDATA section before ]]>, then start a new one.\n */\nfunction renderCData(content: string): string {\n // Handle the edge case where content contains \"]]>\"\n // We split on \"]]>\" and join with \"]]]]><![CDATA[>\" which effectively\n // ends the CDATA section after \"]]\" and starts a new one for \">\"\n if (content.includes(']]>')) {\n // Replace ]]> with ]]]]><![CDATA[> which closes CDATA before > and reopens it\n const escaped = content.replace(/]]>/g, ']]]]><![CDATA[>')\n return `<![CDATA[${escaped}]]>`\n }\n return `<![CDATA[${content}]]>`\n}\n\nfunction escapeXml(str: string): string {\n return str.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;')\n}\n\nfunction escapeAttr(str: string): string {\n return str\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n .replace(/\"/g, '&quot;')\n}\n","import type { ZodObject, ZodRawShape } from 'zod/v4'\nimport type { z } from 'zod/v4'\n\nimport type { AnyXmlNode, XmlNode } from '../types/xml-node.mjs'\n\n/**\n * Type for XML tag components created by `defineTag`.\n *\n * Tag components are functions that accept props and children, and return\n * an XML node. They also have a `tagName` property for identification.\n *\n * @template Props - The props type for the tag component.\n */\nexport interface TagComponent<Props extends Record<string, unknown>> {\n (props: Props & { children?: AnyXmlNode | AnyXmlNode[] }): XmlNode\n tagName: string\n}\n\n/**\n * Creates a type-safe XML tag component with optional Zod schema validation.\n *\n * @param name - The tag name (supports namespace prefixes like 'atom:link')\n * @param propsSchema - Optional Zod schema for validating props\n * @returns A component function that can be used in JSX\n *\n * @example\n * ```tsx\n * // Simple tag\n * const item = defineTag('item')\n * <item>Content</item>\n *\n * // Namespaced tag with Zod validation\n * const atomLink = defineTag('atom:link', z.object({\n * href: z.string().url(),\n * rel: z.enum(['self', 'alternate']),\n * type: z.string().optional(),\n * }))\n * <atomLink href=\"https://example.com/feed\" rel=\"self\" />\n * ```\n */\nexport function defineTag<T extends ZodRawShape>(\n name: string,\n propsSchema?: ZodObject<T>,\n): TagComponent<T extends ZodRawShape ? z.infer<ZodObject<T>> : Record<string, never>> {\n const component = (props: any): XmlNode => {\n const { children, ...rest } = props ?? {}\n\n // Validate props if schema provided\n if (propsSchema) {\n propsSchema.parse(rest)\n }\n\n return {\n type: name,\n props: rest,\n children: Array.isArray(children) ? children : children ? [children] : [],\n }\n }\n\n component.tagName = name\n return component as any\n}\n","import type { EndpointFunctionArgs, HttpMethod, Util_FlatObject } from '@navios/builder'\nimport type { ZodObject, ZodType } from 'zod/v4'\n\nimport { getEndpointMetadata, XmlStreamAdapterToken } from '@navios/core'\n\nimport type { BaseXmlStreamConfig } from '../types/config.mjs'\n\n/**\n * Type helper that extracts the parameter types for an XML Stream endpoint handler.\n *\n * This type automatically infers the correct parameter types based on the endpoint\n * configuration, including URL parameters, query parameters, and request body.\n *\n * @template EndpointDeclaration - The endpoint declaration type from `declareXmlStream`.\n * @template Url - The URL path pattern.\n * @template QuerySchema - The query parameter schema type.\n *\n * @example\n * ```typescript\n * const getFeed = declareXmlStream({\n * method: 'GET',\n * url: '/feed/:category',\n * querySchema: z.object({ page: z.string() }),\n * })\n *\n * // XmlStreamParams<typeof getFeed> resolves to:\n * // { urlParams: { category: string }, query: { page: string } }\n * ```\n */\nexport type XmlStreamParams<\n EndpointDeclaration extends {\n config: BaseXmlStreamConfig<any, any, any, any>\n },\n Url extends string = EndpointDeclaration['config']['url'],\n QuerySchema = EndpointDeclaration['config']['querySchema'],\n> = QuerySchema extends ZodObject\n ? EndpointDeclaration['config']['requestSchema'] extends ZodType\n ? Util_FlatObject<EndpointFunctionArgs<Url, QuerySchema, EndpointDeclaration['config']['requestSchema'], true>>\n : Util_FlatObject<EndpointFunctionArgs<Url, QuerySchema, undefined, true>>\n : EndpointDeclaration['config']['requestSchema'] extends ZodType\n ? Util_FlatObject<EndpointFunctionArgs<Url, undefined, EndpointDeclaration['config']['requestSchema'], true>>\n : Util_FlatObject<EndpointFunctionArgs<Url, undefined, undefined, true>>\n\n/**\n * Decorator for XML Stream endpoints that return JSX-based XML responses.\n *\n * This decorator marks controller methods that return JSX elements, which will be\n * automatically rendered to XML and sent with the appropriate Content-Type header.\n * The method can be async and can contain async components, class components, and\n * regular JSX elements.\n *\n * @template Method - The HTTP method (GET, POST, etc.).\n * @template Url - The URL path pattern (supports parameters like `/posts/:id`).\n * @template QuerySchema - Optional Zod schema for query parameter validation.\n * @template RequestSchema - Optional Zod schema for request body validation.\n *\n * @param endpoint - The endpoint declaration created with `declareXmlStream`.\n * @returns A method decorator function.\n *\n * @throws {Error} If used on a non-function or non-method.\n * @throws {Error} If the endpoint URL already exists.\n *\n * @example\n * ```typescript\n * import { XmlStream, declareXmlStream } from '@navios/adapter-xml'\n * import { Controller } from '@navios/core'\n *\n * const getRssFeed = declareXmlStream({\n * method: 'GET',\n * url: '/feed.xml',\n * contentType: 'application/rss+xml',\n * })\n *\n * @Controller('/api')\n * class FeedController {\n * @XmlStream(getRssFeed)\n * async getFeed() {\n * return (\n * <rss version=\"2.0\">\n * <channel>\n * <title>My Feed</title>\n * </channel>\n * </rss>\n * )\n * }\n * }\n * ```\n *\n * @example\n * ```typescript\n * // With query parameters\n * const getSitemap = declareXmlStream({\n * method: 'GET',\n * url: '/sitemap.xml',\n * querySchema: z.object({ page: z.string().optional() }),\n * })\n *\n * @Controller()\n * class SitemapController {\n * @XmlStream(getSitemap)\n * async getSitemap(params: { query?: { page?: string } }) {\n * const page = params.query?.page\n * return <urlset>...</urlset>\n * }\n * }\n * ```\n */\nexport function XmlStream<\n Method extends HttpMethod = HttpMethod,\n Url extends string = string,\n QuerySchema = undefined,\n RequestSchema = ZodType,\n>(endpoint: { config: BaseXmlStreamConfig<Method, Url, QuerySchema, RequestSchema> }) {\n return (\n target: (\n params: QuerySchema extends ZodObject\n ? RequestSchema extends ZodType\n ? Util_FlatObject<EndpointFunctionArgs<Url, QuerySchema, RequestSchema, true>>\n : Util_FlatObject<EndpointFunctionArgs<Url, QuerySchema, undefined, true>>\n : RequestSchema extends ZodType\n ? Util_FlatObject<EndpointFunctionArgs<Url, undefined, RequestSchema, true>>\n : Util_FlatObject<EndpointFunctionArgs<Url, undefined, undefined, true>>,\n ) => Promise<any>, // Returns XmlNode\n context: ClassMethodDecoratorContext,\n ) => {\n if (typeof target !== 'function') {\n throw new Error('[Navios] XmlStream decorator can only be used on functions.')\n }\n if (context.kind !== 'method') {\n throw new Error('[Navios] XmlStream decorator can only be used on methods.')\n }\n\n const config = endpoint.config\n if (context.metadata) {\n const endpointMetadata = getEndpointMetadata<BaseXmlStreamConfig>(target, context)\n if (endpointMetadata.config && endpointMetadata.config.url) {\n throw new Error(`[Navios] Endpoint ${config.method} ${config.url} already exists.`)\n }\n // @ts-expect-error We don't need to set correctly in the metadata\n endpointMetadata.config = config\n endpointMetadata.adapterToken = XmlStreamAdapterToken\n endpointMetadata.classMethod = target.name\n endpointMetadata.httpMethod = config.method\n endpointMetadata.url = config.url\n }\n return target\n }\n}\n","import type { HttpMethod } from '@navios/builder'\n\nimport type { BaseXmlStreamConfig } from '../types/config.mjs'\n\n/**\n * Declares an XML Stream endpoint configuration for use with `@XmlStream` decorator.\n *\n * This function creates an endpoint declaration that can be used with the `@XmlStream`\n * decorator to mark controller methods that return JSX-based XML responses.\n *\n * @template Method - The HTTP method (GET, POST, etc.).\n * @template Url - The URL path pattern (supports parameters like `/posts/:id`).\n * @template QuerySchema - Optional Zod schema for query parameter validation.\n * @template RequestSchema - Optional Zod schema for request body validation.\n *\n * @param config - The endpoint configuration including method, URL, schemas, and XML options.\n * @returns An endpoint declaration object to be used with `@XmlStream` decorator.\n *\n * @example\n * ```typescript\n * import { declareXmlStream } from '@navios/adapter-xml'\n * import { z } from 'zod/v4'\n *\n * // Simple endpoint\n * export const getRssFeed = declareXmlStream({\n * method: 'GET',\n * url: '/feed.xml',\n * contentType: 'application/rss+xml',\n * })\n *\n * // With query parameters\n * export const getSitemap = declareXmlStream({\n * method: 'GET',\n * url: '/sitemap.xml',\n * querySchema: z.object({\n * page: z.string().optional(),\n * }),\n * contentType: 'application/xml',\n * xmlDeclaration: true,\n * encoding: 'UTF-8',\n * })\n * ```\n */\nexport function declareXmlStream<\n Method extends HttpMethod,\n Url extends string,\n QuerySchema = undefined,\n RequestSchema = undefined,\n>(\n config: BaseXmlStreamConfig<Method, Url, QuerySchema, RequestSchema>,\n): { config: BaseXmlStreamConfig<Method, Url, QuerySchema, RequestSchema> } {\n return { config }\n}\n","import type {\n AbstractHttpHandlerAdapterInterface,\n ClassType,\n HandlerMetadata,\n ScopedContainer,\n} from '@navios/core'\n\nimport {\n inject,\n Injectable,\n StreamAdapterToken,\n XmlStreamAdapterToken,\n} from '@navios/core'\n\nimport type { BaseXmlStreamConfig } from '../types/config.mjs'\nimport type { AnyXmlNode } from '../types/xml-node.mjs'\n\nimport { renderToXml } from '../runtime/render-to-xml.mjs'\n\n/**\n * Adapter service for handling XML Stream endpoints in Navios.\n *\n * This service integrates with the base stream adapter (Fastify or Bun) to handle\n * XML endpoints that return JSX-based XML responses. It automatically renders JSX\n * nodes to XML strings and sends them with the appropriate Content-Type headers.\n *\n * The service supports:\n * - Async components (resolved in parallel)\n * - Class components (resolved via DI container)\n * - Regular JSX elements\n * - CDATA sections\n * - Raw XML content\n *\n * @implements {AbstractHttpHandlerAdapterInterface}\n *\n * @example\n * ```ts\n * // This service is automatically registered when using defineXmlEnvironment()\n * // and is used by endpoints decorated with @XmlStream()\n * ```\n */\n@Injectable({\n token: XmlStreamAdapterToken,\n})\nexport class XmlStreamAdapterService implements AbstractHttpHandlerAdapterInterface {\n /** Base stream adapter - we proxy hasSchema, prepareArguments, provideSchema to it */\n protected streamAdapter = inject(StreamAdapterToken)\n\n /**\n * Prepares argument getters for parsing request data.\n *\n * Proxies to the base stream adapter to reuse existing argument preparation logic\n * that handles query parameters, request body, and URL parameters for both\n * Fastify and Bun adapters.\n *\n * @param handlerMetadata - The handler metadata with schemas and configuration.\n * @returns An array of getter functions that populate request arguments.\n */\n prepareArguments(handlerMetadata: HandlerMetadata<BaseXmlStreamConfig>) {\n return this.streamAdapter.prepareArguments?.(handlerMetadata) ?? []\n }\n\n /**\n * Provides schema information for the handler.\n *\n * Proxies to the base stream adapter to reuse existing schema generation logic.\n * For Fastify, this enables built-in validation. For Bun, this returns an empty object.\n *\n * @param handlerMetadata - The handler metadata containing configuration and schemas.\n * @returns Schema information (Fastify route schema or empty object for Bun).\n */\n provideSchema(\n handlerMetadata: HandlerMetadata<BaseXmlStreamConfig>,\n ): Record<string, any> {\n if (\n 'provideSchema' in this.streamAdapter &&\n typeof this.streamAdapter.provideSchema === 'function'\n ) {\n return this.streamAdapter.provideSchema(handlerMetadata)\n }\n return {}\n }\n\n /**\n * Checks if the handler has any validation schemas defined.\n *\n * Proxies to the base stream adapter to check for query or request schemas.\n *\n * @param handlerMetadata - The handler metadata containing configuration.\n * @returns `true` if the handler has any schemas (query or request).\n */\n hasSchema(handlerMetadata: HandlerMetadata<any>): boolean {\n if (\n 'hasSchema' in this.streamAdapter &&\n typeof this.streamAdapter.hasSchema === 'function'\n ) {\n return this.streamAdapter.hasSchema(handlerMetadata)\n }\n return false\n }\n\n /**\n * Creates a request handler function for XML Stream endpoints.\n *\n * This method generates a handler that:\n * 1. Parses and validates request data (body, query, URL params) using the base adapter\n * 2. Invokes the controller method with validated arguments (returns JSX)\n * 3. Renders the JSX tree to XML string (resolves async and class components)\n * 4. Sends the XML response with appropriate Content-Type header\n *\n * The handler automatically detects the environment (Fastify vs Bun) and uses the\n * appropriate response mechanism (reply object vs Response object).\n *\n * @param controller - The controller class containing the handler method.\n * @param handlerMetadata - The handler metadata with configuration and schemas.\n * @returns A function that handles incoming requests and sends XML responses.\n */\n provideHandler(\n controller: ClassType,\n handlerMetadata: HandlerMetadata<BaseXmlStreamConfig>,\n ): (context: ScopedContainer, request: any, reply: any) => Promise<any> {\n const getters = this.prepareArguments(handlerMetadata)\n const config = handlerMetadata.config\n\n const formatArguments = async (request: any) => {\n const argument: Record<string, any> = {}\n const promises: Promise<void>[] = []\n for (const getter of getters) {\n const res = getter(argument, request)\n if (res instanceof Promise) {\n promises.push(res)\n }\n }\n await Promise.all(promises)\n return argument\n }\n\n const contentType = config.contentType ?? 'application/xml'\n\n return async (context: ScopedContainer, request: any, reply: any) => {\n const controllerInstance = await context.get(controller)\n const argument = await formatArguments(request)\n\n // Call controller method - returns XmlNode (JSX), may contain async/class components\n const xmlNode: AnyXmlNode =\n await controllerInstance[handlerMetadata.classMethod](argument)\n\n // Render JSX to XML string (async - resolves all async and class components)\n const xml = await renderToXml(xmlNode, {\n declaration: config.xmlDeclaration ?? true,\n encoding: config.encoding ?? 'UTF-8',\n container: context,\n })\n\n // Environment detection: Bun doesn't have reply\n const isHttpStandardEnvironment = reply === undefined\n\n if (isHttpStandardEnvironment) {\n // Bun: return Response object\n const headers: Record<string, string> = {\n 'Content-Type': contentType,\n }\n for (const [key, value] of Object.entries(handlerMetadata.headers)) {\n if (value != null) {\n headers[key] = String(value)\n }\n }\n return new Response(xml, {\n status: handlerMetadata.successStatusCode,\n headers,\n })\n } else {\n // Fastify: use reply object\n reply\n .status(handlerMetadata.successStatusCode)\n .header('Content-Type', contentType)\n .headers(handlerMetadata.headers)\n .send(xml)\n }\n }\n }\n}\n","import type { AnyInjectableType } from '@navios/core'\n\nimport { InjectionToken, XmlStreamAdapterToken } from '@navios/core'\n\nimport { XmlStreamAdapterService } from './adapters/index.mjs'\n\n/**\n * Creates the XML environment configuration to be merged with base adapter (Fastify/Bun).\n *\n * @example\n * ```typescript\n * import { defineFastifyEnvironment } from '@navios/adapter-fastify'\n * import { defineXmlEnvironment } from '@navios/adapter-xml'\n * import { NaviosFactory } from '@navios/core'\n *\n * const fastifyEnv = defineFastifyEnvironment()\n * const xmlEnv = defineXmlEnvironment()\n *\n * // Merge environments\n * const mergedEnv = {\n * httpTokens: new Map([\n * ...fastifyEnv.httpTokens,\n * ...xmlEnv.httpTokens,\n * ]),\n * }\n *\n * const app = await NaviosFactory.create(AppModule, {\n * adapter: mergedEnv,\n * })\n * ```\n */\nexport function defineXmlEnvironment() {\n const httpTokens = new Map<InjectionToken<any, undefined>, AnyInjectableType>(\n [[XmlStreamAdapterToken, XmlStreamAdapterService]],\n )\n return {\n httpTokens,\n }\n}\n"],"mappings":";;;;;;;;;;;AAUA,SAAgB,MAAM,EAAE,YAA6C;AACnE,QAAO;EACL,MAAMA;EACN,SAA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gBAAgB8B,QAAO,CAC/BU,KAAKjB,IAAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GClJhB,SAAgBoB,uBAAAA;AAId,QAAO,EACLC,YAJiB,IAAIC,IACrB,CAAC,CAACJ,oCAAuBC,yBAAwB,CAAC,CAAA,EAIpD"}
@@ -0,0 +1,520 @@
1
+ import { a as CDataSymbol, c as Fragment, d as XmlNode, f as ComponentClass, i as CDataNode, l as RawXmlNode, n as AsyncComponent, o as ClassComponent, p as XmlComponent, r as AsyncXmlNode, s as ClassComponentNode, t as AnyXmlNode, u as RawXmlSymbol } from "./xml-node-CddziLym.cjs";
2
+ import { t as createElement } from "./create-element--Gd2L8UR.cjs";
3
+ import { BaseStreamConfig, EndpointFunctionArgs, HttpMethod, Util_FlatObject } from "@navios/builder";
4
+ import { AbstractHttpHandlerAdapterInterface, AnyInjectableType, ClassType, Container, HandlerMetadata, InjectionToken, Registry, ScopedContainer } from "@navios/core";
5
+ import { ZodObject, ZodRawShape, ZodType, z } from "zod/v4";
6
+
7
+ //#region src/types/config.d.mts
8
+
9
+ /**
10
+ * Configuration interface for XML Stream endpoints.
11
+ *
12
+ * Extends the base stream configuration with XML-specific options including
13
+ * content type, XML declaration, and encoding settings.
14
+ *
15
+ * @template Method - The HTTP method (GET, POST, etc.).
16
+ * @template Url - The URL path pattern (supports parameters like `/posts/:id`).
17
+ * @template QuerySchema - Optional Zod schema for query parameter validation.
18
+ * @template RequestSchema - Optional Zod schema for request body validation.
19
+ *
20
+ * @example
21
+ * ```typescript
22
+ * const config: BaseXmlStreamConfig = {
23
+ * method: 'GET',
24
+ * url: '/feed.xml',
25
+ * contentType: 'application/rss+xml',
26
+ * xmlDeclaration: true,
27
+ * encoding: 'UTF-8',
28
+ * }
29
+ * ```
30
+ */
31
+ interface BaseXmlStreamConfig<Method extends HttpMethod = HttpMethod, Url extends string = string, QuerySchema = undefined, RequestSchema = undefined> extends BaseStreamConfig<Method, Url, QuerySchema, RequestSchema> {
32
+ /** Content-Type header, defaults to 'application/xml' */
33
+ contentType?: 'application/xml' | 'text/xml' | 'application/rss+xml' | 'application/atom+xml';
34
+ /** Include XML declaration (<?xml version="1.0"?>) - defaults to true */
35
+ xmlDeclaration?: boolean;
36
+ /** XML encoding, defaults to 'UTF-8' */
37
+ encoding?: string;
38
+ }
39
+ //#endregion
40
+ //#region src/runtime/special-nodes.d.mts
41
+ /**
42
+ * CDATA component - wraps content in <![CDATA[...]]>
43
+ * Use for text content that may contain characters like < > &
44
+ * that would otherwise need escaping.
45
+ *
46
+ * Note: If content contains "]]>", it will be split into multiple CDATA sections.
47
+ */
48
+ declare function CData({
49
+ children
50
+ }: {
51
+ children: string;
52
+ }): CDataNode;
53
+ /**
54
+ * DangerouslyInsertRawXml - inserts raw XML/HTML without any escaping or wrapping
55
+ *
56
+ * WARNING: This bypasses all XML escaping. Only use with trusted content!
57
+ * Use cases:
58
+ * - Pre-rendered XML fragments
59
+ * - HTML content in RSS/Atom feeds (in description/content:encoded)
60
+ * - Including XML from external sources that's already valid
61
+ */
62
+ declare function DangerouslyInsertRawXml({
63
+ children
64
+ }: {
65
+ children: string;
66
+ }): RawXmlNode;
67
+ //#endregion
68
+ //#region src/runtime/render-to-xml.d.mts
69
+ /**
70
+ * Options for rendering XML from JSX nodes.
71
+ *
72
+ * @example
73
+ * ```ts
74
+ * const xml = await renderToXml(<rss version="2.0">...</rss>, {
75
+ * declaration: true,
76
+ * encoding: 'UTF-8',
77
+ * pretty: true,
78
+ * container: myContainer, // Required for class components
79
+ * })
80
+ * ```
81
+ */
82
+ interface RenderOptions {
83
+ /** Include XML declaration (<?xml version="1.0"?>) - defaults to true */
84
+ declaration?: boolean;
85
+ /** XML encoding, defaults to 'UTF-8' */
86
+ encoding?: string;
87
+ /** Pretty print with indentation */
88
+ pretty?: boolean;
89
+ /**
90
+ * DI container for resolving class components.
91
+ * Required if the tree contains any class components.
92
+ */
93
+ container?: Container | ScopedContainer;
94
+ }
95
+ /**
96
+ * Error thrown when attempting to render a class component without a container.
97
+ *
98
+ * Class components require a dependency injection container to be instantiated.
99
+ * This error is thrown when `renderToXml` is called with a class component in
100
+ * the tree but no container is provided in the options.
101
+ *
102
+ * @example
103
+ * ```ts
104
+ * try {
105
+ * await renderToXml(<MyClassComponent />)
106
+ * } catch (error) {
107
+ * if (error instanceof MissingContainerError) {
108
+ * // Provide a container
109
+ * await renderToXml(<MyClassComponent />, { container })
110
+ * }
111
+ * }
112
+ * ```
113
+ */
114
+ declare class MissingContainerError extends Error {
115
+ constructor(componentName: string);
116
+ }
117
+ /**
118
+ * Renders a JSX XML node tree to an XML string.
119
+ *
120
+ * This function handles:
121
+ * - Regular XML nodes (tags with props and children)
122
+ * - Async components (resolves promises in parallel)
123
+ * - Class components (resolves via DI container)
124
+ * - CDATA sections
125
+ * - Raw XML content
126
+ * - Fragments
127
+ * - Text content with proper escaping
128
+ *
129
+ * @param node - The root XML node (JSX element) to render.
130
+ * @param options - Rendering options including declaration, encoding, pretty printing, and container.
131
+ * @returns A promise that resolves to the XML string.
132
+ *
133
+ * @throws {MissingContainerError} If the tree contains class components but no container is provided.
134
+ *
135
+ * @example
136
+ * ```ts
137
+ * // Simple rendering
138
+ * const xml = await renderToXml(<rss version="2.0"><channel>...</channel></rss>)
139
+ *
140
+ * // With options
141
+ * const xml = await renderToXml(<feed>...</feed>, {
142
+ * declaration: true,
143
+ * encoding: 'UTF-8',
144
+ * pretty: true,
145
+ * })
146
+ *
147
+ * // With class components (requires container)
148
+ * const container = new Container()
149
+ * container.beginRequest('request-id')
150
+ * const xml = await renderToXml(<MyClassComponent />, { container })
151
+ * ```
152
+ */
153
+ declare function renderToXml(node: AnyXmlNode, options?: RenderOptions): Promise<string>;
154
+ //#endregion
155
+ //#region src/tags/define-tag.d.mts
156
+ /**
157
+ * Type for XML tag components created by `defineTag`.
158
+ *
159
+ * Tag components are functions that accept props and children, and return
160
+ * an XML node. They also have a `tagName` property for identification.
161
+ *
162
+ * @template Props - The props type for the tag component.
163
+ */
164
+ interface TagComponent<Props extends Record<string, unknown>> {
165
+ (props: Props & {
166
+ children?: AnyXmlNode | AnyXmlNode[];
167
+ }): XmlNode;
168
+ tagName: string;
169
+ }
170
+ /**
171
+ * Creates a type-safe XML tag component with optional Zod schema validation.
172
+ *
173
+ * @param name - The tag name (supports namespace prefixes like 'atom:link')
174
+ * @param propsSchema - Optional Zod schema for validating props
175
+ * @returns A component function that can be used in JSX
176
+ *
177
+ * @example
178
+ * ```tsx
179
+ * // Simple tag
180
+ * const item = defineTag('item')
181
+ * <item>Content</item>
182
+ *
183
+ * // Namespaced tag with Zod validation
184
+ * const atomLink = defineTag('atom:link', z.object({
185
+ * href: z.string().url(),
186
+ * rel: z.enum(['self', 'alternate']),
187
+ * type: z.string().optional(),
188
+ * }))
189
+ * <atomLink href="https://example.com/feed" rel="self" />
190
+ * ```
191
+ */
192
+ declare function defineTag<T extends ZodRawShape>(name: string, propsSchema?: ZodObject<T>): TagComponent<T extends ZodRawShape ? z.infer<ZodObject<T>> : Record<string, never>>;
193
+ //#endregion
194
+ //#region src/decorators/xml-stream.decorator.d.mts
195
+ /**
196
+ * Type helper that extracts the parameter types for an XML Stream endpoint handler.
197
+ *
198
+ * This type automatically infers the correct parameter types based on the endpoint
199
+ * configuration, including URL parameters, query parameters, and request body.
200
+ *
201
+ * @template EndpointDeclaration - The endpoint declaration type from `declareXmlStream`.
202
+ * @template Url - The URL path pattern.
203
+ * @template QuerySchema - The query parameter schema type.
204
+ *
205
+ * @example
206
+ * ```typescript
207
+ * const getFeed = declareXmlStream({
208
+ * method: 'GET',
209
+ * url: '/feed/:category',
210
+ * querySchema: z.object({ page: z.string() }),
211
+ * })
212
+ *
213
+ * // XmlStreamParams<typeof getFeed> resolves to:
214
+ * // { urlParams: { category: string }, query: { page: string } }
215
+ * ```
216
+ */
217
+ type XmlStreamParams<EndpointDeclaration extends {
218
+ config: BaseXmlStreamConfig<any, any, any, any>;
219
+ }, Url extends string = EndpointDeclaration['config']['url'], QuerySchema = EndpointDeclaration['config']['querySchema']> = QuerySchema extends ZodObject ? EndpointDeclaration['config']['requestSchema'] extends ZodType ? Util_FlatObject<EndpointFunctionArgs<Url, QuerySchema, EndpointDeclaration['config']['requestSchema'], true>> : Util_FlatObject<EndpointFunctionArgs<Url, QuerySchema, undefined, true>> : EndpointDeclaration['config']['requestSchema'] extends ZodType ? Util_FlatObject<EndpointFunctionArgs<Url, undefined, EndpointDeclaration['config']['requestSchema'], true>> : Util_FlatObject<EndpointFunctionArgs<Url, undefined, undefined, true>>;
220
+ /**
221
+ * Decorator for XML Stream endpoints that return JSX-based XML responses.
222
+ *
223
+ * This decorator marks controller methods that return JSX elements, which will be
224
+ * automatically rendered to XML and sent with the appropriate Content-Type header.
225
+ * The method can be async and can contain async components, class components, and
226
+ * regular JSX elements.
227
+ *
228
+ * @template Method - The HTTP method (GET, POST, etc.).
229
+ * @template Url - The URL path pattern (supports parameters like `/posts/:id`).
230
+ * @template QuerySchema - Optional Zod schema for query parameter validation.
231
+ * @template RequestSchema - Optional Zod schema for request body validation.
232
+ *
233
+ * @param endpoint - The endpoint declaration created with `declareXmlStream`.
234
+ * @returns A method decorator function.
235
+ *
236
+ * @throws {Error} If used on a non-function or non-method.
237
+ * @throws {Error} If the endpoint URL already exists.
238
+ *
239
+ * @example
240
+ * ```typescript
241
+ * import { XmlStream, declareXmlStream } from '@navios/adapter-xml'
242
+ * import { Controller } from '@navios/core'
243
+ *
244
+ * const getRssFeed = declareXmlStream({
245
+ * method: 'GET',
246
+ * url: '/feed.xml',
247
+ * contentType: 'application/rss+xml',
248
+ * })
249
+ *
250
+ * @Controller('/api')
251
+ * class FeedController {
252
+ * @XmlStream(getRssFeed)
253
+ * async getFeed() {
254
+ * return (
255
+ * <rss version="2.0">
256
+ * <channel>
257
+ * <title>My Feed</title>
258
+ * </channel>
259
+ * </rss>
260
+ * )
261
+ * }
262
+ * }
263
+ * ```
264
+ *
265
+ * @example
266
+ * ```typescript
267
+ * // With query parameters
268
+ * const getSitemap = declareXmlStream({
269
+ * method: 'GET',
270
+ * url: '/sitemap.xml',
271
+ * querySchema: z.object({ page: z.string().optional() }),
272
+ * })
273
+ *
274
+ * @Controller()
275
+ * class SitemapController {
276
+ * @XmlStream(getSitemap)
277
+ * async getSitemap(params: { query?: { page?: string } }) {
278
+ * const page = params.query?.page
279
+ * return <urlset>...</urlset>
280
+ * }
281
+ * }
282
+ * ```
283
+ */
284
+ declare function XmlStream<Method extends HttpMethod = HttpMethod, Url extends string = string, QuerySchema = undefined, RequestSchema = ZodType>(endpoint: {
285
+ config: BaseXmlStreamConfig<Method, Url, QuerySchema, RequestSchema>;
286
+ }): (target: (params: QuerySchema extends ZodObject ? RequestSchema extends ZodType ? Util_FlatObject<EndpointFunctionArgs<Url, QuerySchema, RequestSchema, true>> : Util_FlatObject<EndpointFunctionArgs<Url, QuerySchema, undefined, true>> : RequestSchema extends ZodType ? Util_FlatObject<EndpointFunctionArgs<Url, undefined, RequestSchema, true>> : Util_FlatObject<EndpointFunctionArgs<Url, undefined, undefined, true>>) => Promise<any>,
287
+ // Returns XmlNode
288
+ context: ClassMethodDecoratorContext) => (params: QuerySchema extends ZodObject ? RequestSchema extends ZodType ? Util_FlatObject<EndpointFunctionArgs<Url, QuerySchema, RequestSchema, true>> : Util_FlatObject<EndpointFunctionArgs<Url, QuerySchema, undefined, true>> : RequestSchema extends ZodType ? Util_FlatObject<EndpointFunctionArgs<Url, undefined, RequestSchema, true>> : Util_FlatObject<EndpointFunctionArgs<Url, undefined, undefined, true>>) => Promise<any>;
289
+ //#endregion
290
+ //#region src/decorators/component.decorator.d.mts
291
+ /**
292
+ * Decorator for class-based XML components with dependency injection support.
293
+ *
294
+ * Class components must implement the `XmlComponent` interface with a `render()` method.
295
+ * They can optionally accept props via constructor, validated with a Zod schema.
296
+ *
297
+ * @overload
298
+ * Component without props (no schema).
299
+ *
300
+ * @example
301
+ * ```tsx
302
+ * @Component()
303
+ * class LatestPostsComponent implements XmlComponent {
304
+ * private readonly postService = inject(PostService)
305
+ *
306
+ * async render() {
307
+ * const posts = await this.postService.getLatestPosts()
308
+ * return <>{posts.map(post => <item>...</item>)}</>
309
+ * }
310
+ * }
311
+ * ```
312
+ *
313
+ * @overload
314
+ * Component with props schema for type-safe props.
315
+ *
316
+ * @param options - Configuration object with schema and optional registry.
317
+ * @param options.schema - Zod schema for validating and typing component props.
318
+ * @param options.registry - Optional custom DI registry (defaults to global registry).
319
+ *
320
+ * @example
321
+ * ```tsx
322
+ * const DescriptionSchema = z.object({
323
+ * content: z.string(),
324
+ * wrapInCData: z.boolean().optional(),
325
+ * })
326
+ *
327
+ * @Component({ schema: DescriptionSchema })
328
+ * class DescriptionComponent implements XmlComponent {
329
+ * constructor(private props: z.output<typeof DescriptionSchema>) {}
330
+ *
331
+ * async render() {
332
+ * return <description>{this.props.wrapInCData ? <CData>{this.props.content}</CData> : this.props.content}</description>
333
+ * }
334
+ * }
335
+ * ```
336
+ *
337
+ * @overload
338
+ * Component with custom registry only (no props).
339
+ *
340
+ * @param options - Configuration object with registry.
341
+ * @param options.registry - Custom DI registry to use for this component.
342
+ */
343
+ declare function Component(): <T extends ComponentClass>(target: T, context?: ClassDecoratorContext) => T;
344
+ declare function Component<Schema extends ZodObject<ZodRawShape>>(options: {
345
+ schema: Schema;
346
+ registry?: Registry;
347
+ }): <T extends new (props: z.output<Schema>, ...args: any[]) => XmlComponent>(target: T, context?: ClassDecoratorContext) => T;
348
+ declare function Component(options: {
349
+ registry: Registry;
350
+ }): <T extends ComponentClass>(target: T, context?: ClassDecoratorContext) => T;
351
+ /**
352
+ * Type guard to check if a value is a component class.
353
+ *
354
+ * Component classes are classes decorated with `@Component` that implement
355
+ * the `XmlComponent` interface.
356
+ *
357
+ * @param value - The value to check.
358
+ * @returns `true` if the value is a component class, `false` otherwise.
359
+ *
360
+ * @example
361
+ * ```ts
362
+ * if (isComponentClass(MyClass)) {
363
+ * // MyClass is a component class
364
+ * const instance = await container.get(MyClass)
365
+ * }
366
+ * ```
367
+ */
368
+ declare function isComponentClass(value: unknown): value is ComponentClass;
369
+ //#endregion
370
+ //#region src/handlers/xml-stream.d.mts
371
+ /**
372
+ * Declares an XML Stream endpoint configuration for use with `@XmlStream` decorator.
373
+ *
374
+ * This function creates an endpoint declaration that can be used with the `@XmlStream`
375
+ * decorator to mark controller methods that return JSX-based XML responses.
376
+ *
377
+ * @template Method - The HTTP method (GET, POST, etc.).
378
+ * @template Url - The URL path pattern (supports parameters like `/posts/:id`).
379
+ * @template QuerySchema - Optional Zod schema for query parameter validation.
380
+ * @template RequestSchema - Optional Zod schema for request body validation.
381
+ *
382
+ * @param config - The endpoint configuration including method, URL, schemas, and XML options.
383
+ * @returns An endpoint declaration object to be used with `@XmlStream` decorator.
384
+ *
385
+ * @example
386
+ * ```typescript
387
+ * import { declareXmlStream } from '@navios/adapter-xml'
388
+ * import { z } from 'zod/v4'
389
+ *
390
+ * // Simple endpoint
391
+ * export const getRssFeed = declareXmlStream({
392
+ * method: 'GET',
393
+ * url: '/feed.xml',
394
+ * contentType: 'application/rss+xml',
395
+ * })
396
+ *
397
+ * // With query parameters
398
+ * export const getSitemap = declareXmlStream({
399
+ * method: 'GET',
400
+ * url: '/sitemap.xml',
401
+ * querySchema: z.object({
402
+ * page: z.string().optional(),
403
+ * }),
404
+ * contentType: 'application/xml',
405
+ * xmlDeclaration: true,
406
+ * encoding: 'UTF-8',
407
+ * })
408
+ * ```
409
+ */
410
+ declare function declareXmlStream<Method extends HttpMethod, Url extends string, QuerySchema = undefined, RequestSchema = undefined>(config: BaseXmlStreamConfig<Method, Url, QuerySchema, RequestSchema>): {
411
+ config: BaseXmlStreamConfig<Method, Url, QuerySchema, RequestSchema>;
412
+ };
413
+ //#endregion
414
+ //#region src/adapters/xml-stream-adapter.service.d.mts
415
+ /**
416
+ * Adapter service for handling XML Stream endpoints in Navios.
417
+ *
418
+ * This service integrates with the base stream adapter (Fastify or Bun) to handle
419
+ * XML endpoints that return JSX-based XML responses. It automatically renders JSX
420
+ * nodes to XML strings and sends them with the appropriate Content-Type headers.
421
+ *
422
+ * The service supports:
423
+ * - Async components (resolved in parallel)
424
+ * - Class components (resolved via DI container)
425
+ * - Regular JSX elements
426
+ * - CDATA sections
427
+ * - Raw XML content
428
+ *
429
+ * @implements {AbstractHttpHandlerAdapterInterface}
430
+ *
431
+ * @example
432
+ * ```ts
433
+ * // This service is automatically registered when using defineXmlEnvironment()
434
+ * // and is used by endpoints decorated with @XmlStream()
435
+ * ```
436
+ */
437
+ declare class XmlStreamAdapterService implements AbstractHttpHandlerAdapterInterface {
438
+ /** Base stream adapter - we proxy hasSchema, prepareArguments, provideSchema to it */
439
+ protected streamAdapter: AbstractHttpHandlerAdapterInterface;
440
+ /**
441
+ * Prepares argument getters for parsing request data.
442
+ *
443
+ * Proxies to the base stream adapter to reuse existing argument preparation logic
444
+ * that handles query parameters, request body, and URL parameters for both
445
+ * Fastify and Bun adapters.
446
+ *
447
+ * @param handlerMetadata - The handler metadata with schemas and configuration.
448
+ * @returns An array of getter functions that populate request arguments.
449
+ */
450
+ prepareArguments(handlerMetadata: HandlerMetadata<BaseXmlStreamConfig>): ((target: Record<string, any>, request: any) => Promise<void> | void)[];
451
+ /**
452
+ * Provides schema information for the handler.
453
+ *
454
+ * Proxies to the base stream adapter to reuse existing schema generation logic.
455
+ * For Fastify, this enables built-in validation. For Bun, this returns an empty object.
456
+ *
457
+ * @param handlerMetadata - The handler metadata containing configuration and schemas.
458
+ * @returns Schema information (Fastify route schema or empty object for Bun).
459
+ */
460
+ provideSchema(handlerMetadata: HandlerMetadata<BaseXmlStreamConfig>): Record<string, any>;
461
+ /**
462
+ * Checks if the handler has any validation schemas defined.
463
+ *
464
+ * Proxies to the base stream adapter to check for query or request schemas.
465
+ *
466
+ * @param handlerMetadata - The handler metadata containing configuration.
467
+ * @returns `true` if the handler has any schemas (query or request).
468
+ */
469
+ hasSchema(handlerMetadata: HandlerMetadata<any>): boolean;
470
+ /**
471
+ * Creates a request handler function for XML Stream endpoints.
472
+ *
473
+ * This method generates a handler that:
474
+ * 1. Parses and validates request data (body, query, URL params) using the base adapter
475
+ * 2. Invokes the controller method with validated arguments (returns JSX)
476
+ * 3. Renders the JSX tree to XML string (resolves async and class components)
477
+ * 4. Sends the XML response with appropriate Content-Type header
478
+ *
479
+ * The handler automatically detects the environment (Fastify vs Bun) and uses the
480
+ * appropriate response mechanism (reply object vs Response object).
481
+ *
482
+ * @param controller - The controller class containing the handler method.
483
+ * @param handlerMetadata - The handler metadata with configuration and schemas.
484
+ * @returns A function that handles incoming requests and sends XML responses.
485
+ */
486
+ provideHandler(controller: ClassType, handlerMetadata: HandlerMetadata<BaseXmlStreamConfig>): (context: ScopedContainer, request: any, reply: any) => Promise<any>;
487
+ }
488
+ //#endregion
489
+ //#region src/define-environment.d.mts
490
+ /**
491
+ * Creates the XML environment configuration to be merged with base adapter (Fastify/Bun).
492
+ *
493
+ * @example
494
+ * ```typescript
495
+ * import { defineFastifyEnvironment } from '@navios/adapter-fastify'
496
+ * import { defineXmlEnvironment } from '@navios/adapter-xml'
497
+ * import { NaviosFactory } from '@navios/core'
498
+ *
499
+ * const fastifyEnv = defineFastifyEnvironment()
500
+ * const xmlEnv = defineXmlEnvironment()
501
+ *
502
+ * // Merge environments
503
+ * const mergedEnv = {
504
+ * httpTokens: new Map([
505
+ * ...fastifyEnv.httpTokens,
506
+ * ...xmlEnv.httpTokens,
507
+ * ]),
508
+ * }
509
+ *
510
+ * const app = await NaviosFactory.create(AppModule, {
511
+ * adapter: mergedEnv,
512
+ * })
513
+ * ```
514
+ */
515
+ declare function defineXmlEnvironment(): {
516
+ httpTokens: Map<InjectionToken<any, undefined, false>, AnyInjectableType>;
517
+ };
518
+ //#endregion
519
+ export { type AnyXmlNode, AsyncComponent, type AsyncXmlNode, type BaseXmlStreamConfig, CData, type CDataNode, CDataSymbol, ClassComponent, type ClassComponentNode, Component, type ComponentClass, DangerouslyInsertRawXml, Fragment, MissingContainerError, type RawXmlNode, RawXmlSymbol, type RenderOptions, type TagComponent, type XmlComponent, type XmlNode, XmlStream, XmlStreamAdapterService, type XmlStreamParams, createElement, declareXmlStream, defineTag, defineXmlEnvironment, isComponentClass, renderToXml };
520
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/types/config.mts","../src/runtime/special-nodes.mts","../src/runtime/render-to-xml.mts","../src/tags/define-tag.mts","../src/decorators/xml-stream.decorator.mts","../src/decorators/component.decorator.mts","../src/handlers/xml-stream.mts","../src/adapters/xml-stream-adapter.service.mts","../src/define-environment.mts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;AAwBA;;;;;;;;;;;;ACdA;AAgBA;;;UDFiB,mCACA,aAAa,qGAIpB,iBAAiB,QAAQ,KAAK,aAAa;EEGpC;EAiCJ,WAAA,CAAA,EAAA,iBAAsB,GAAA,UAAa,GAAA,qBAAA,GAAA,sBAAA;EA8C1B;EACd,cAAA,CAAA,EAAA,OAAA;EACG;EACR,QAAA,CAAA,EAAA,MAAA;;;;;;;;;;AF1FH;AACiB,iBCfD,KAAA,CDeC;EAAA;CAAA,EAAA;EAAa,QAAA,EAAA,MAAA;CAIH,CAAA,ECnBgC,SDmBhC;;;;;;;;;ACnB3B;AAgBgB,iBAAA,uBAAA,CAA0B;EAAA;CAAmC,EAAA;;IAAA;;;;;;;;ADF7E;;;;;;;;AAK0B,UEGT,aAAA,CFHS;;;;ECnBV,QAAK,CAAA,EAAA,MAAA;EAgBL;;;;ACMhB;AAiCA;EA8CsB,SAAA,CAAA,EApER,SAoEmB,GApEP,eAoEO;;;;;;;;AClGjC;;;;;;;AA2BA;;;;;;AAG0D,cDsB7C,qBAAA,SAA8B,KAAA,CCtBe;EAAV,WAAA,CAAA,aAAA,EAAA,MAAA;;;;;;;;ACdhD;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8EA;;;AAIkB,iBFAI,WAAA,CEAJ,IAAA,EFCV,UEDU,EAAA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