@navios/adapter-xml 0.1.0
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/LICENSE +7 -0
- package/README.md +532 -0
- package/bun-plugin.mts +129 -0
- package/bunPlugin.cache +1 -0
- package/bunfig.toml +3 -0
- package/dist/bun-plugin.d.mts +4 -0
- package/dist/bun-plugin.d.mts.map +1 -0
- package/dist/e2e/bun/xml-stream.spec.d.ts +2 -0
- package/dist/e2e/bun/xml-stream.spec.d.ts.map +1 -0
- package/dist/e2e/fastify/xml-stream.spec.d.ts +2 -0
- package/dist/e2e/fastify/xml-stream.spec.d.ts.map +1 -0
- package/dist/src/adapters/index.d.mts +2 -0
- package/dist/src/adapters/index.d.mts.map +1 -0
- package/dist/src/adapters/xml-stream-adapter.service.d.mts +21 -0
- package/dist/src/adapters/xml-stream-adapter.service.d.mts.map +1 -0
- package/dist/src/decorators/component.decorator.d.mts +17 -0
- package/dist/src/decorators/component.decorator.d.mts.map +1 -0
- package/dist/src/decorators/component.decorator.spec.d.mts +2 -0
- package/dist/src/decorators/component.decorator.spec.d.mts.map +1 -0
- package/dist/src/decorators/index.d.mts +4 -0
- package/dist/src/decorators/index.d.mts.map +1 -0
- package/dist/src/decorators/xml-stream.decorator.d.mts +42 -0
- package/dist/src/decorators/xml-stream.decorator.d.mts.map +1 -0
- package/dist/src/define-environment.d.mts +31 -0
- package/dist/src/define-environment.d.mts.map +1 -0
- package/dist/src/handlers/index.d.mts +2 -0
- package/dist/src/handlers/index.d.mts.map +1 -0
- package/dist/src/handlers/xml-stream.d.mts +23 -0
- package/dist/src/handlers/xml-stream.d.mts.map +1 -0
- package/dist/src/index.d.mts +12 -0
- package/dist/src/index.d.mts.map +1 -0
- package/dist/src/jsx-dev-runtime.d.mts +5 -0
- package/dist/src/jsx-dev-runtime.d.mts.map +1 -0
- package/dist/src/jsx-runtime.d.mts +3 -0
- package/dist/src/jsx-runtime.d.mts.map +1 -0
- package/dist/src/jsx.d.mts +18 -0
- package/dist/src/jsx.d.mts.map +1 -0
- package/dist/src/runtime/create-element.d.mts +25 -0
- package/dist/src/runtime/create-element.d.mts.map +1 -0
- package/dist/src/runtime/fragment.d.mts +2 -0
- package/dist/src/runtime/fragment.d.mts.map +1 -0
- package/dist/src/runtime/index.d.mts +5 -0
- package/dist/src/runtime/index.d.mts.map +1 -0
- package/dist/src/runtime/render-to-xml.d.mts +20 -0
- package/dist/src/runtime/render-to-xml.d.mts.map +1 -0
- package/dist/src/runtime/render-to-xml.spec.d.mts +2 -0
- package/dist/src/runtime/render-to-xml.spec.d.mts.map +1 -0
- package/dist/src/runtime/special-nodes.d.mts +24 -0
- package/dist/src/runtime/special-nodes.d.mts.map +1 -0
- package/dist/src/tags/define-tag.d.mts +33 -0
- package/dist/src/tags/define-tag.d.mts.map +1 -0
- package/dist/src/tags/define-tag.spec.d.mts +2 -0
- package/dist/src/tags/define-tag.spec.d.mts.map +1 -0
- package/dist/src/tags/index.d.mts +3 -0
- package/dist/src/tags/index.d.mts.map +1 -0
- package/dist/src/types/component.d.mts +15 -0
- package/dist/src/types/component.d.mts.map +1 -0
- package/dist/src/types/config.d.mts +10 -0
- package/dist/src/types/config.d.mts.map +1 -0
- package/dist/src/types/index.d.mts +5 -0
- package/dist/src/types/index.d.mts.map +1 -0
- package/dist/src/types/xml-node.d.mts +35 -0
- package/dist/src/types/xml-node.d.mts.map +1 -0
- package/dist/tsconfig.lib.tsbuildinfo +1 -0
- package/dist/tsconfig.spec.tsbuildinfo +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/tsup.config.d.mts +3 -0
- package/dist/tsup.config.d.mts.map +1 -0
- package/dist/vitest.config.d.mts +3 -0
- package/dist/vitest.config.d.mts.map +1 -0
- package/dist/vitest.e2e.fastify.config.d.mts +3 -0
- package/dist/vitest.e2e.fastify.config.d.mts.map +1 -0
- package/e2e/bun/xml-stream.spec.tsx +553 -0
- package/e2e/fastify/xml-stream.spec.tsx +569 -0
- package/jsx.d.ts +42 -0
- package/lib/_tsup-dts-rollup.d.mts +414 -0
- package/lib/_tsup-dts-rollup.d.ts +414 -0
- package/lib/chunk-6OR6LGJA.mjs +153 -0
- package/lib/chunk-6OR6LGJA.mjs.map +1 -0
- package/lib/index.d.mts +29 -0
- package/lib/index.d.ts +29 -0
- package/lib/index.js +376 -0
- package/lib/index.js.map +1 -0
- package/lib/index.mjs +256 -0
- package/lib/index.mjs.map +1 -0
- package/lib/jsx-dev-runtime.d.mts +4 -0
- package/lib/jsx-dev-runtime.d.ts +4 -0
- package/lib/jsx-dev-runtime.js +61 -0
- package/lib/jsx-dev-runtime.js.map +1 -0
- package/lib/jsx-dev-runtime.mjs +9 -0
- package/lib/jsx-dev-runtime.mjs.map +1 -0
- package/lib/jsx-runtime.d.mts +3 -0
- package/lib/jsx-runtime.d.ts +3 -0
- package/lib/jsx-runtime.js +57 -0
- package/lib/jsx-runtime.js.map +1 -0
- package/lib/jsx-runtime.mjs +3 -0
- package/lib/jsx-runtime.mjs.map +1 -0
- package/lib/jsx.d.mts +1 -0
- package/lib/jsx.d.ts +1 -0
- package/lib/jsx.js +4 -0
- package/lib/jsx.js.map +1 -0
- package/lib/jsx.mjs +3 -0
- package/lib/jsx.mjs.map +1 -0
- package/package.json +80 -0
- package/project.json +91 -0
- package/src/adapters/index.mts +1 -0
- package/src/adapters/xml-stream-adapter.service.mts +121 -0
- package/src/decorators/component.decorator.mts +102 -0
- package/src/decorators/component.decorator.spec.mts +345 -0
- package/src/decorators/index.mts +4 -0
- package/src/decorators/xml-stream.decorator.mts +93 -0
- package/src/define-environment.mts +40 -0
- package/src/handlers/index.mts +1 -0
- package/src/handlers/xml-stream.mts +31 -0
- package/src/index.mts +41 -0
- package/src/jsx-dev-runtime.mts +8 -0
- package/src/jsx-runtime.mts +2 -0
- package/src/jsx.mts +25 -0
- package/src/runtime/create-element.mts +113 -0
- package/src/runtime/fragment.mts +1 -0
- package/src/runtime/index.mts +4 -0
- package/src/runtime/render-to-xml.mts +214 -0
- package/src/runtime/render-to-xml.spec.mts +360 -0
- package/src/runtime/special-nodes.mts +32 -0
- package/src/tags/define-tag.mts +54 -0
- package/src/tags/define-tag.spec.mts +250 -0
- package/src/tags/index.mts +2 -0
- package/src/types/component.mts +16 -0
- package/src/types/config.mts +15 -0
- package/src/types/index.mts +23 -0
- package/src/types/jsx.d.ts +21 -0
- package/src/types/xml-node.mts +50 -0
- package/tsconfig.json +24 -0
- package/tsconfig.lib.json +8 -0
- package/tsconfig.spec.json +25 -0
- package/tsup.config.mts +18 -0
- package/vitest.config.mts +9 -0
- package/vitest.e2e.fastify.config.mts +29 -0
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
import type { AbstractHttpHandlerAdapterInterface } from '@navios/core';
|
|
2
|
+
import type { AnyInjectableType } from '@navios/di';
|
|
3
|
+
import type { BaseStreamConfig } from '@navios/builder';
|
|
4
|
+
import type { ClassType } from '@navios/di';
|
|
5
|
+
import { Container } from '@navios/di';
|
|
6
|
+
import type { EndpointFunctionArgs } from '@navios/builder';
|
|
7
|
+
import type { HandlerMetadata } from '@navios/core';
|
|
8
|
+
import type { HttpMethod } from '@navios/builder';
|
|
9
|
+
import { InjectionToken } from '@navios/di';
|
|
10
|
+
import type { Registry } from '@navios/di';
|
|
11
|
+
import type { RequestContextHolder } from '@navios/di';
|
|
12
|
+
import type { Util_FlatObject } from '@navios/builder';
|
|
13
|
+
import type { z } from 'zod/v4';
|
|
14
|
+
import type { ZodObject } from 'zod/v4';
|
|
15
|
+
import type { ZodRawShape } from 'zod/v4';
|
|
16
|
+
import type { ZodType } from 'zod/v4';
|
|
17
|
+
|
|
18
|
+
/** Union type for all possible node types */
|
|
19
|
+
declare type AnyXmlNode = XmlNode | AsyncXmlNode | CDataNode | RawXmlNode | ClassComponentNode | string | number | null | undefined;
|
|
20
|
+
export { AnyXmlNode }
|
|
21
|
+
export { AnyXmlNode as AnyXmlNode_alias_1 }
|
|
22
|
+
export { AnyXmlNode as AnyXmlNode_alias_2 }
|
|
23
|
+
|
|
24
|
+
declare const AsyncComponent: unique symbol;
|
|
25
|
+
export { AsyncComponent }
|
|
26
|
+
export { AsyncComponent as AsyncComponent_alias_1 }
|
|
27
|
+
export { AsyncComponent as AsyncComponent_alias_2 }
|
|
28
|
+
|
|
29
|
+
declare type AsyncComponentFn = (props: any) => Promise<XmlNode | AsyncXmlNode | ClassComponentNode>;
|
|
30
|
+
|
|
31
|
+
/** Represents an async component that needs to be resolved before rendering */
|
|
32
|
+
declare interface AsyncXmlNode {
|
|
33
|
+
type: typeof AsyncComponent;
|
|
34
|
+
promise: Promise<AnyXmlNode>;
|
|
35
|
+
}
|
|
36
|
+
export { AsyncXmlNode }
|
|
37
|
+
export { AsyncXmlNode as AsyncXmlNode_alias_1 }
|
|
38
|
+
export { AsyncXmlNode as AsyncXmlNode_alias_2 }
|
|
39
|
+
|
|
40
|
+
declare interface BaseXmlStreamConfig<Method extends HttpMethod = HttpMethod, Url extends string = string, QuerySchema = undefined, RequestSchema = undefined> extends BaseStreamConfig<Method, Url, QuerySchema, RequestSchema> {
|
|
41
|
+
/** Content-Type header, defaults to 'application/xml' */
|
|
42
|
+
contentType?: 'application/xml' | 'text/xml' | 'application/rss+xml' | 'application/atom+xml';
|
|
43
|
+
/** Include XML declaration (<?xml version="1.0"?>) - defaults to true */
|
|
44
|
+
xmlDeclaration?: boolean;
|
|
45
|
+
/** XML encoding, defaults to 'UTF-8' */
|
|
46
|
+
encoding?: string;
|
|
47
|
+
}
|
|
48
|
+
export { BaseXmlStreamConfig }
|
|
49
|
+
export { BaseXmlStreamConfig as BaseXmlStreamConfig_alias_1 }
|
|
50
|
+
export { BaseXmlStreamConfig as BaseXmlStreamConfig_alias_2 }
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* CDATA component - wraps content in <![CDATA[...]]>
|
|
54
|
+
* Use for text content that may contain characters like < > &
|
|
55
|
+
* that would otherwise need escaping.
|
|
56
|
+
*
|
|
57
|
+
* Note: If content contains "]]>", it will be split into multiple CDATA sections.
|
|
58
|
+
*/
|
|
59
|
+
declare function CData({ children }: {
|
|
60
|
+
children: string;
|
|
61
|
+
}): CDataNode;
|
|
62
|
+
export { CData }
|
|
63
|
+
export { CData as CData_alias_1 }
|
|
64
|
+
export { CData as CData_alias_2 }
|
|
65
|
+
|
|
66
|
+
/** Represents a CDATA section - content is wrapped in <![CDATA[...]]> */
|
|
67
|
+
declare interface CDataNode {
|
|
68
|
+
type: typeof CDataSymbol;
|
|
69
|
+
content: string;
|
|
70
|
+
}
|
|
71
|
+
export { CDataNode }
|
|
72
|
+
export { CDataNode as CDataNode_alias_1 }
|
|
73
|
+
export { CDataNode as CDataNode_alias_2 }
|
|
74
|
+
|
|
75
|
+
declare const CDataSymbol: unique symbol;
|
|
76
|
+
export { CDataSymbol }
|
|
77
|
+
export { CDataSymbol as CDataSymbol_alias_1 }
|
|
78
|
+
export { CDataSymbol as CDataSymbol_alias_2 }
|
|
79
|
+
|
|
80
|
+
declare const ClassComponent: unique symbol;
|
|
81
|
+
export { ClassComponent }
|
|
82
|
+
export { ClassComponent as ClassComponent_alias_1 }
|
|
83
|
+
export { ClassComponent as ClassComponent_alias_2 }
|
|
84
|
+
|
|
85
|
+
/** Represents a class component that needs to be resolved via DI */
|
|
86
|
+
declare interface ClassComponentNode {
|
|
87
|
+
type: typeof ClassComponent;
|
|
88
|
+
componentClass: ComponentClass;
|
|
89
|
+
props: Record<string, unknown>;
|
|
90
|
+
}
|
|
91
|
+
export { ClassComponentNode }
|
|
92
|
+
export { ClassComponentNode as ClassComponentNode_alias_1 }
|
|
93
|
+
export { ClassComponentNode as ClassComponentNode_alias_2 }
|
|
94
|
+
|
|
95
|
+
declare function Component(): <T extends ComponentClass>(target: T, context?: ClassDecoratorContext) => T;
|
|
96
|
+
|
|
97
|
+
declare function Component<Schema extends ZodObject<ZodRawShape>>(options: {
|
|
98
|
+
schema: Schema;
|
|
99
|
+
registry?: Registry;
|
|
100
|
+
}): <T extends new (props: z.output<Schema>, ...args: any[]) => XmlComponent>(target: T, context?: ClassDecoratorContext) => T;
|
|
101
|
+
|
|
102
|
+
declare function Component(options: {
|
|
103
|
+
registry: Registry;
|
|
104
|
+
}): <T extends ComponentClass>(target: T, context?: ClassDecoratorContext) => T;
|
|
105
|
+
export { Component }
|
|
106
|
+
export { Component as Component_alias_1 }
|
|
107
|
+
export { Component as Component_alias_2 }
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Type for class component constructors.
|
|
111
|
+
*/
|
|
112
|
+
declare interface ComponentClass {
|
|
113
|
+
new (...args: any[]): XmlComponent;
|
|
114
|
+
}
|
|
115
|
+
export { ComponentClass }
|
|
116
|
+
export { ComponentClass as ComponentClass_alias_1 }
|
|
117
|
+
export { ComponentClass as ComponentClass_alias_2 }
|
|
118
|
+
|
|
119
|
+
declare const ComponentMeta: unique symbol;
|
|
120
|
+
export { ComponentMeta }
|
|
121
|
+
export { ComponentMeta as ComponentMeta_alias_1 }
|
|
122
|
+
|
|
123
|
+
declare type ComponentType = FunctionalComponent | ComponentClass;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Classic createElement for manual usage.
|
|
127
|
+
* Children are passed as rest arguments.
|
|
128
|
+
*/
|
|
129
|
+
declare function createElement(type: string | typeof Fragment | ComponentType, props: Record<string, unknown> | null, ...children: any[]): XmlNode | AsyncXmlNode | ClassComponentNode;
|
|
130
|
+
export { createElement }
|
|
131
|
+
export { createElement as createElement_alias_1 }
|
|
132
|
+
export { createElement as createElement_alias_2 }
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* DangerouslyInsertRawXml - inserts raw XML/HTML without any escaping or wrapping
|
|
136
|
+
*
|
|
137
|
+
* WARNING: This bypasses all XML escaping. Only use with trusted content!
|
|
138
|
+
* Use cases:
|
|
139
|
+
* - Pre-rendered XML fragments
|
|
140
|
+
* - HTML content in RSS/Atom feeds (in description/content:encoded)
|
|
141
|
+
* - Including XML from external sources that's already valid
|
|
142
|
+
*/
|
|
143
|
+
declare function DangerouslyInsertRawXml({ children }: {
|
|
144
|
+
children: string;
|
|
145
|
+
}): RawXmlNode;
|
|
146
|
+
export { DangerouslyInsertRawXml }
|
|
147
|
+
export { DangerouslyInsertRawXml as DangerouslyInsertRawXml_alias_1 }
|
|
148
|
+
export { DangerouslyInsertRawXml as DangerouslyInsertRawXml_alias_2 }
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Declares an XML Stream endpoint configuration for use with @XmlStream decorator.
|
|
152
|
+
*
|
|
153
|
+
* @example
|
|
154
|
+
* ```typescript
|
|
155
|
+
* import { declareXmlStream } from '@navios/adapter-xml'
|
|
156
|
+
*
|
|
157
|
+
* export const getRssFeed = declareXmlStream({
|
|
158
|
+
* method: 'GET',
|
|
159
|
+
* url: '/feed.xml',
|
|
160
|
+
* querySchema: undefined,
|
|
161
|
+
* requestSchema: undefined,
|
|
162
|
+
* contentType: 'application/rss+xml',
|
|
163
|
+
* xmlDeclaration: true,
|
|
164
|
+
* })
|
|
165
|
+
* ```
|
|
166
|
+
*/
|
|
167
|
+
declare function declareXmlStream<Method extends HttpMethod, Url extends string, QuerySchema = undefined, RequestSchema = undefined>(config: BaseXmlStreamConfig<Method, Url, QuerySchema, RequestSchema>): {
|
|
168
|
+
config: BaseXmlStreamConfig<Method, Url, QuerySchema, RequestSchema>;
|
|
169
|
+
};
|
|
170
|
+
export { declareXmlStream }
|
|
171
|
+
export { declareXmlStream as declareXmlStream_alias_1 }
|
|
172
|
+
export { declareXmlStream as declareXmlStream_alias_2 }
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Creates a type-safe XML tag component with optional Zod schema validation.
|
|
176
|
+
*
|
|
177
|
+
* @param name - The tag name (supports namespace prefixes like 'atom:link')
|
|
178
|
+
* @param propsSchema - Optional Zod schema for validating props
|
|
179
|
+
* @returns A component function that can be used in JSX
|
|
180
|
+
*
|
|
181
|
+
* @example
|
|
182
|
+
* ```tsx
|
|
183
|
+
* // Simple tag
|
|
184
|
+
* const item = defineTag('item')
|
|
185
|
+
* <item>Content</item>
|
|
186
|
+
*
|
|
187
|
+
* // Namespaced tag with Zod validation
|
|
188
|
+
* const atomLink = defineTag('atom:link', z.object({
|
|
189
|
+
* href: z.string().url(),
|
|
190
|
+
* rel: z.enum(['self', 'alternate']),
|
|
191
|
+
* type: z.string().optional(),
|
|
192
|
+
* }))
|
|
193
|
+
* <atomLink href="https://example.com/feed" rel="self" />
|
|
194
|
+
* ```
|
|
195
|
+
*/
|
|
196
|
+
declare function defineTag<T extends ZodRawShape>(name: string, propsSchema?: ZodObject<T>): TagComponent<T extends ZodRawShape ? z.infer<ZodObject<T>> : Record<string, never>>;
|
|
197
|
+
export { defineTag }
|
|
198
|
+
export { defineTag as defineTag_alias_1 }
|
|
199
|
+
export { defineTag as defineTag_alias_2 }
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Creates the XML environment configuration to be merged with base adapter (Fastify/Bun).
|
|
203
|
+
*
|
|
204
|
+
* @example
|
|
205
|
+
* ```typescript
|
|
206
|
+
* import { defineFastifyEnvironment } from '@navios/adapter-fastify'
|
|
207
|
+
* import { defineXmlEnvironment } from '@navios/adapter-xml'
|
|
208
|
+
* import { NaviosFactory } from '@navios/core'
|
|
209
|
+
*
|
|
210
|
+
* const fastifyEnv = defineFastifyEnvironment()
|
|
211
|
+
* const xmlEnv = defineXmlEnvironment()
|
|
212
|
+
*
|
|
213
|
+
* // Merge environments
|
|
214
|
+
* const mergedEnv = {
|
|
215
|
+
* httpTokens: new Map([
|
|
216
|
+
* ...fastifyEnv.httpTokens,
|
|
217
|
+
* ...xmlEnv.httpTokens,
|
|
218
|
+
* ]),
|
|
219
|
+
* }
|
|
220
|
+
*
|
|
221
|
+
* const app = await NaviosFactory.create(AppModule, {
|
|
222
|
+
* adapter: mergedEnv,
|
|
223
|
+
* })
|
|
224
|
+
* ```
|
|
225
|
+
*/
|
|
226
|
+
declare function defineXmlEnvironment(): {
|
|
227
|
+
httpTokens: Map<InjectionToken<any, undefined, false>, AnyInjectableType>;
|
|
228
|
+
};
|
|
229
|
+
export { defineXmlEnvironment }
|
|
230
|
+
export { defineXmlEnvironment as defineXmlEnvironment_alias_1 }
|
|
231
|
+
|
|
232
|
+
declare const Fragment: unique symbol;
|
|
233
|
+
export { Fragment }
|
|
234
|
+
export { Fragment as Fragment_alias_1 }
|
|
235
|
+
export { Fragment as Fragment_alias_2 }
|
|
236
|
+
export { Fragment as Fragment_alias_3 }
|
|
237
|
+
export { Fragment as Fragment_alias_4 }
|
|
238
|
+
export { Fragment as Fragment_alias_5 }
|
|
239
|
+
export { Fragment as Fragment_alias_6 }
|
|
240
|
+
export { Fragment as Fragment_alias_7 }
|
|
241
|
+
|
|
242
|
+
declare type FunctionalComponent = SyncComponent | AsyncComponentFn;
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Type guard to check if a class is a component
|
|
246
|
+
*/
|
|
247
|
+
declare function isComponentClass(value: unknown): value is ComponentClass;
|
|
248
|
+
export { isComponentClass }
|
|
249
|
+
export { isComponentClass as isComponentClass_alias_1 }
|
|
250
|
+
export { isComponentClass as isComponentClass_alias_2 }
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* JSX automatic runtime function.
|
|
254
|
+
* Used by the JSX transformer when jsxImportSource is set.
|
|
255
|
+
* Children are passed as part of props.children.
|
|
256
|
+
*/
|
|
257
|
+
declare function jsx(type: string | typeof Fragment | ComponentType, props: Record<string, unknown> | null): XmlNode | AsyncXmlNode | ClassComponentNode;
|
|
258
|
+
export { jsx }
|
|
259
|
+
export { jsx as jsx_alias_1 }
|
|
260
|
+
export { jsx as jsx_alias_2 }
|
|
261
|
+
|
|
262
|
+
export declare const jsxDEV: typeof jsx;
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* JSX automatic runtime function for static children.
|
|
266
|
+
* Identical to jsx() for XML - React uses this for optimization hints.
|
|
267
|
+
*/
|
|
268
|
+
declare const jsxs: typeof jsx;
|
|
269
|
+
export { jsxs }
|
|
270
|
+
export { jsxs as jsxs_alias_1 }
|
|
271
|
+
export { jsxs as jsxs_alias_2 }
|
|
272
|
+
|
|
273
|
+
declare class MissingContainerError extends Error {
|
|
274
|
+
constructor(componentName: string);
|
|
275
|
+
}
|
|
276
|
+
export { MissingContainerError }
|
|
277
|
+
export { MissingContainerError as MissingContainerError_alias_1 }
|
|
278
|
+
export { MissingContainerError as MissingContainerError_alias_2 }
|
|
279
|
+
|
|
280
|
+
/** Represents raw XML content - inserted without any escaping or wrapping */
|
|
281
|
+
declare interface RawXmlNode {
|
|
282
|
+
type: typeof RawXmlSymbol;
|
|
283
|
+
content: string;
|
|
284
|
+
}
|
|
285
|
+
export { RawXmlNode }
|
|
286
|
+
export { RawXmlNode as RawXmlNode_alias_1 }
|
|
287
|
+
export { RawXmlNode as RawXmlNode_alias_2 }
|
|
288
|
+
|
|
289
|
+
declare const RawXmlSymbol: unique symbol;
|
|
290
|
+
export { RawXmlSymbol }
|
|
291
|
+
export { RawXmlSymbol as RawXmlSymbol_alias_1 }
|
|
292
|
+
export { RawXmlSymbol as RawXmlSymbol_alias_2 }
|
|
293
|
+
|
|
294
|
+
declare interface RenderOptions {
|
|
295
|
+
/** Include XML declaration (<?xml version="1.0"?>) - defaults to true */
|
|
296
|
+
declaration?: boolean;
|
|
297
|
+
/** XML encoding, defaults to 'UTF-8' */
|
|
298
|
+
encoding?: string;
|
|
299
|
+
/** Pretty print with indentation */
|
|
300
|
+
pretty?: boolean;
|
|
301
|
+
/**
|
|
302
|
+
* DI container for resolving class components.
|
|
303
|
+
* Required if the tree contains any class components.
|
|
304
|
+
*/
|
|
305
|
+
container?: Container;
|
|
306
|
+
}
|
|
307
|
+
export { RenderOptions }
|
|
308
|
+
export { RenderOptions as RenderOptions_alias_1 }
|
|
309
|
+
export { RenderOptions as RenderOptions_alias_2 }
|
|
310
|
+
|
|
311
|
+
declare function renderToXml(node: AnyXmlNode, options?: RenderOptions): Promise<string>;
|
|
312
|
+
export { renderToXml }
|
|
313
|
+
export { renderToXml as renderToXml_alias_1 }
|
|
314
|
+
export { renderToXml as renderToXml_alias_2 }
|
|
315
|
+
|
|
316
|
+
declare type SyncComponent = (props: any) => XmlNode | AsyncXmlNode | ClassComponentNode;
|
|
317
|
+
|
|
318
|
+
declare interface TagComponent<Props extends Record<string, unknown>> {
|
|
319
|
+
(props: Props & {
|
|
320
|
+
children?: AnyXmlNode | AnyXmlNode[];
|
|
321
|
+
}): XmlNode;
|
|
322
|
+
tagName: string;
|
|
323
|
+
}
|
|
324
|
+
export { TagComponent }
|
|
325
|
+
export { TagComponent as TagComponent_alias_1 }
|
|
326
|
+
export { TagComponent as TagComponent_alias_2 }
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* Base interface for class components.
|
|
330
|
+
* The render method takes no arguments - props are received via constructor.
|
|
331
|
+
*/
|
|
332
|
+
declare interface XmlComponent {
|
|
333
|
+
render(): AnyXmlNode | Promise<AnyXmlNode>;
|
|
334
|
+
}
|
|
335
|
+
export { XmlComponent }
|
|
336
|
+
export { XmlComponent as XmlComponent_alias_1 }
|
|
337
|
+
export { XmlComponent as XmlComponent_alias_2 }
|
|
338
|
+
|
|
339
|
+
declare interface XmlNode {
|
|
340
|
+
type: string | typeof Fragment;
|
|
341
|
+
props: Record<string, unknown>;
|
|
342
|
+
children: AnyXmlNode[];
|
|
343
|
+
}
|
|
344
|
+
export { XmlNode }
|
|
345
|
+
export { XmlNode as XmlNode_alias_1 }
|
|
346
|
+
export { XmlNode as XmlNode_alias_2 }
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* Decorator for XML Stream endpoints that return JSX-based XML responses.
|
|
350
|
+
*
|
|
351
|
+
* @example
|
|
352
|
+
* ```typescript
|
|
353
|
+
* import { XmlStream } from '@navios/adapter-xml'
|
|
354
|
+
* import { Controller } from '@navios/core'
|
|
355
|
+
*
|
|
356
|
+
* const getRssFeed = declareXmlStream({
|
|
357
|
+
* method: 'GET',
|
|
358
|
+
* url: '/feed.xml',
|
|
359
|
+
* querySchema: undefined,
|
|
360
|
+
* requestSchema: undefined,
|
|
361
|
+
* contentType: 'application/rss+xml',
|
|
362
|
+
* })
|
|
363
|
+
*
|
|
364
|
+
* @Controller('/api')
|
|
365
|
+
* class FeedController {
|
|
366
|
+
* @XmlStream(getRssFeed)
|
|
367
|
+
* async getFeed() {
|
|
368
|
+
* return (
|
|
369
|
+
* <rss version="2.0">
|
|
370
|
+
* <channel>
|
|
371
|
+
* <title>My Feed</title>
|
|
372
|
+
* </channel>
|
|
373
|
+
* </rss>
|
|
374
|
+
* )
|
|
375
|
+
* }
|
|
376
|
+
* }
|
|
377
|
+
* ```
|
|
378
|
+
*/
|
|
379
|
+
declare function XmlStream<Method extends HttpMethod = HttpMethod, Url extends string = string, QuerySchema = undefined, RequestSchema = ZodType>(endpoint: {
|
|
380
|
+
config: BaseXmlStreamConfig<Method, Url, QuerySchema, RequestSchema>;
|
|
381
|
+
}): (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>, // Returns XmlNode
|
|
382
|
+
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>;
|
|
383
|
+
export { XmlStream }
|
|
384
|
+
export { XmlStream as XmlStream_alias_1 }
|
|
385
|
+
export { XmlStream as XmlStream_alias_2 }
|
|
386
|
+
|
|
387
|
+
declare class XmlStreamAdapterService implements AbstractHttpHandlerAdapterInterface {
|
|
388
|
+
protected container: Container;
|
|
389
|
+
/** Base stream adapter - we proxy hasSchema, prepareArguments, provideSchema to it */
|
|
390
|
+
protected streamAdapter: AbstractHttpHandlerAdapterInterface;
|
|
391
|
+
/**
|
|
392
|
+
* Proxy to base StreamAdapter - reuses existing argument preparation logic
|
|
393
|
+
* (handles querySchema, requestSchema, URL params for both Fastify and Bun)
|
|
394
|
+
*/
|
|
395
|
+
prepareArguments(handlerMetadata: HandlerMetadata<BaseXmlStreamConfig>): ((target: Record<string, any>, request: any) => Promise<void> | void)[];
|
|
396
|
+
provideSchema(handlerMetadata: HandlerMetadata<BaseXmlStreamConfig>): Record<string, any>;
|
|
397
|
+
hasSchema(handlerMetadata: HandlerMetadata<any>): boolean;
|
|
398
|
+
/**
|
|
399
|
+
* Custom handler - renders JSX to XML and handles response for both Fastify and Bun
|
|
400
|
+
*/
|
|
401
|
+
provideHandler(controller: ClassType, handlerMetadata: HandlerMetadata<BaseXmlStreamConfig>): (context: RequestContextHolder, request: any, reply: any) => Promise<any>;
|
|
402
|
+
}
|
|
403
|
+
export { XmlStreamAdapterService }
|
|
404
|
+
export { XmlStreamAdapterService as XmlStreamAdapterService_alias_1 }
|
|
405
|
+
export { XmlStreamAdapterService as XmlStreamAdapterService_alias_2 }
|
|
406
|
+
|
|
407
|
+
declare type XmlStreamParams<EndpointDeclaration extends {
|
|
408
|
+
config: BaseXmlStreamConfig<any, any, any, any>;
|
|
409
|
+
}, 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>>;
|
|
410
|
+
export { XmlStreamParams }
|
|
411
|
+
export { XmlStreamParams as XmlStreamParams_alias_1 }
|
|
412
|
+
export { XmlStreamParams as XmlStreamParams_alias_2 }
|
|
413
|
+
|
|
414
|
+
export { }
|