@elaraai/east-node-io 0.0.1-beta.1 → 0.0.1-beta.2

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 (114) hide show
  1. package/dist/compression/gzip.d.ts +108 -0
  2. package/dist/compression/gzip.d.ts.map +1 -0
  3. package/dist/compression/gzip.js +153 -0
  4. package/dist/compression/gzip.js.map +1 -0
  5. package/dist/compression/index.d.ts +308 -0
  6. package/dist/compression/index.d.ts.map +1 -0
  7. package/dist/compression/index.js +289 -0
  8. package/dist/compression/index.js.map +1 -0
  9. package/dist/compression/tar.d.ts +115 -0
  10. package/dist/compression/tar.d.ts.map +1 -0
  11. package/dist/compression/tar.js +254 -0
  12. package/dist/compression/tar.js.map +1 -0
  13. package/dist/compression/types.d.ts +124 -0
  14. package/dist/compression/types.d.ts.map +1 -0
  15. package/dist/compression/types.js +106 -0
  16. package/dist/compression/types.js.map +1 -0
  17. package/dist/compression/zip.d.ts +121 -0
  18. package/dist/compression/zip.d.ts.map +1 -0
  19. package/dist/compression/zip.js +200 -0
  20. package/dist/compression/zip.js.map +1 -0
  21. package/dist/connection/index.d.ts +78 -0
  22. package/dist/connection/index.d.ts.map +1 -0
  23. package/dist/connection/index.js +134 -0
  24. package/dist/connection/index.js.map +1 -0
  25. package/dist/format/csv.d.ts +210 -0
  26. package/dist/format/csv.d.ts.map +1 -0
  27. package/dist/format/csv.js +729 -0
  28. package/dist/format/csv.js.map +1 -0
  29. package/dist/format/index.d.ts +641 -0
  30. package/dist/format/index.d.ts.map +1 -0
  31. package/dist/format/index.js +463 -0
  32. package/dist/format/index.js.map +1 -0
  33. package/dist/format/types.d.ts +176 -0
  34. package/dist/format/types.d.ts.map +1 -0
  35. package/dist/format/types.js +122 -0
  36. package/dist/format/types.js.map +1 -0
  37. package/dist/format/xlsx.d.ts +178 -0
  38. package/dist/format/xlsx.d.ts.map +1 -0
  39. package/dist/format/xlsx.js +313 -0
  40. package/dist/format/xlsx.js.map +1 -0
  41. package/dist/format/xml.d.ts +302 -0
  42. package/dist/format/xml.d.ts.map +1 -0
  43. package/dist/format/xml.js +602 -0
  44. package/dist/format/xml.js.map +1 -0
  45. package/dist/index.d.ts +25 -0
  46. package/dist/index.d.ts.map +1 -0
  47. package/dist/index.js +32 -0
  48. package/dist/index.js.map +1 -0
  49. package/dist/nosql/index.d.ts +503 -0
  50. package/dist/nosql/index.d.ts.map +1 -0
  51. package/dist/nosql/index.js +483 -0
  52. package/dist/nosql/index.js.map +1 -0
  53. package/dist/nosql/mongodb.d.ts +306 -0
  54. package/dist/nosql/mongodb.d.ts.map +1 -0
  55. package/dist/nosql/mongodb.js +552 -0
  56. package/dist/nosql/mongodb.js.map +1 -0
  57. package/dist/nosql/redis.d.ts +268 -0
  58. package/dist/nosql/redis.d.ts.map +1 -0
  59. package/dist/nosql/redis.js +371 -0
  60. package/dist/nosql/redis.js.map +1 -0
  61. package/dist/nosql/types.d.ts +70 -0
  62. package/dist/nosql/types.d.ts.map +1 -0
  63. package/dist/nosql/types.js +79 -0
  64. package/dist/nosql/types.js.map +1 -0
  65. package/dist/sql/index.d.ts +777 -0
  66. package/dist/sql/index.d.ts.map +1 -0
  67. package/dist/sql/index.js +515 -0
  68. package/dist/sql/index.js.map +1 -0
  69. package/dist/sql/mysql.d.ts +238 -0
  70. package/dist/sql/mysql.d.ts.map +1 -0
  71. package/dist/sql/mysql.js +396 -0
  72. package/dist/sql/mysql.js.map +1 -0
  73. package/dist/sql/postgres.d.ts +237 -0
  74. package/dist/sql/postgres.d.ts.map +1 -0
  75. package/dist/sql/postgres.js +381 -0
  76. package/dist/sql/postgres.js.map +1 -0
  77. package/dist/sql/sqlite.d.ts +217 -0
  78. package/dist/sql/sqlite.d.ts.map +1 -0
  79. package/dist/sql/sqlite.js +366 -0
  80. package/dist/sql/sqlite.js.map +1 -0
  81. package/dist/sql/types.d.ts +205 -0
  82. package/dist/sql/types.d.ts.map +1 -0
  83. package/dist/sql/types.js +175 -0
  84. package/dist/sql/types.js.map +1 -0
  85. package/dist/storage/index.d.ts +304 -0
  86. package/dist/storage/index.d.ts.map +1 -0
  87. package/dist/storage/index.js +234 -0
  88. package/dist/storage/index.js.map +1 -0
  89. package/dist/storage/s3.d.ts +373 -0
  90. package/dist/storage/s3.d.ts.map +1 -0
  91. package/dist/storage/s3.js +502 -0
  92. package/dist/storage/s3.js.map +1 -0
  93. package/dist/storage/types.d.ts +117 -0
  94. package/dist/storage/types.d.ts.map +1 -0
  95. package/dist/storage/types.js +94 -0
  96. package/dist/storage/types.js.map +1 -0
  97. package/dist/transfer/ftp.d.ts +333 -0
  98. package/dist/transfer/ftp.d.ts.map +1 -0
  99. package/dist/transfer/ftp.js +437 -0
  100. package/dist/transfer/ftp.js.map +1 -0
  101. package/dist/transfer/index.d.ts +456 -0
  102. package/dist/transfer/index.d.ts.map +1 -0
  103. package/dist/transfer/index.js +414 -0
  104. package/dist/transfer/index.js.map +1 -0
  105. package/dist/transfer/sftp.d.ts +333 -0
  106. package/dist/transfer/sftp.d.ts.map +1 -0
  107. package/dist/transfer/sftp.js +436 -0
  108. package/dist/transfer/sftp.js.map +1 -0
  109. package/dist/transfer/types.d.ts +108 -0
  110. package/dist/transfer/types.d.ts.map +1 -0
  111. package/dist/transfer/types.js +110 -0
  112. package/dist/transfer/types.js.map +1 -0
  113. package/dist/tsconfig.tsbuildinfo +1 -0
  114. package/package.json +6 -6
@@ -0,0 +1,602 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ import { East, BlobType, RecursiveType, StructType, StringType, DictType, ArrayType, VariantType, BooleanType, OptionType, variant } from "@elaraai/east";
6
+ import { EastError } from "@elaraai/east/internal";
7
+ // XML Type Definitions
8
+ /**
9
+ * XmlNode represents an XML element with its tag, attributes, and children.
10
+ *
11
+ * Children can be either TEXT nodes (string content) or ELEMENT nodes (nested XML elements).
12
+ * This recursive structure allows representing arbitrary XML trees.
13
+ */
14
+ export const XmlNode = RecursiveType(self => StructType({
15
+ tag: StringType, // Element tag name (e.g., "book")
16
+ attributes: DictType(StringType, StringType), // Attributes map (e.g., {"id": "123"})
17
+ children: ArrayType(VariantType({
18
+ TEXT: StringType, // Text content
19
+ ELEMENT: self, // Nested element (recursive)
20
+ })),
21
+ }));
22
+ // Configuration Types
23
+ export const XmlParseConfig = StructType({
24
+ preserveWhitespace: BooleanType, // Default: false (trim text nodes)
25
+ decodeEntities: BooleanType, // Default: true (&lt; -> <, etc.)
26
+ });
27
+ export const XmlSerializeConfig = StructType({
28
+ indent: OptionType(StringType), // Default: none, Example: " " for 2 spaces
29
+ includeXmlDeclaration: BooleanType, // Default: true (<?xml version="1.0"?>)
30
+ encodeEntities: BooleanType, // Default: true (< -> &lt;, etc.)
31
+ selfClosingTags: BooleanType, // Default: true (<br/> vs <br></br>)
32
+ });
33
+ // Platform Functions
34
+ /**
35
+ * Parses XML data from a binary blob into a recursive tree structure.
36
+ *
37
+ * Converts XML-formatted binary data into an {@link XmlNode} recursive structure,
38
+ * where each node contains a tag name, attributes dictionary, and children array.
39
+ * Children can be either TEXT nodes (string content) or ELEMENT nodes (nested elements).
40
+ *
41
+ * Supports XML declarations, namespaces (as attributes), CDATA sections,
42
+ * entity decoding, comments (ignored), processing instructions (ignored),
43
+ * and configurable whitespace handling.
44
+ *
45
+ * This is a platform function for the East language, enabling XML parsing
46
+ * in East programs running on Node.js.
47
+ *
48
+ * @param blob - The XML data as a binary blob (UTF-8 encoded)
49
+ * @param config - Parsing configuration including whitespace and entity handling options
50
+ * @returns An {@link XmlNode} representing the root element of the XML document
51
+ *
52
+ * @throws {EastError} When XML is malformed with specific error messages:
53
+ * - "Expected '<' at line N, column M" - Missing opening tag bracket
54
+ * - "Invalid tag name at line N, column M" - Tag name contains invalid characters
55
+ * - "Expected '=' after attribute name at line N, column M" - Missing equals in attribute
56
+ * - "Expected quote for attribute value at line N, column M" - Attribute value not quoted
57
+ * - "Unclosed attribute value at line N, column M" - Missing closing quote
58
+ * - "Expected '>' at line N, column M" - Missing closing bracket
59
+ * - "Mismatched closing tag: expected '</X>', found '</Y>' at line N, column M" - Tag mismatch
60
+ * - "Expected '>' in closing tag at line N, column M" - Malformed closing tag
61
+ * - "Unclosed comment at line N, column M" - Comment not properly closed
62
+ * - "Unclosed CDATA section at line N, column M" - CDATA not properly closed
63
+ * - "Empty XML document" - No root element found
64
+ *
65
+ * @example
66
+ * ```ts
67
+ * const parseXML = East.function([BlobType], XmlNode, ($, xmlBlob) => {
68
+ * const config = $.const(East.value({
69
+ * preserveWhitespace: false,
70
+ * decodeEntities: true,
71
+ * }, XmlParseConfig));
72
+ *
73
+ * return xml_parse(xmlBlob, config);
74
+ * // Returns: { tag: "book", attributes: {"id": "123"}, children: [...] }
75
+ * });
76
+ * ```
77
+ *
78
+ * @remarks
79
+ * - Skips XML declarations (`<?xml version="1.0"?>`) and processing instructions
80
+ * - Ignores comments (`<!-- comment -->`) - they are not preserved
81
+ * - Handles CDATA sections (`<![CDATA[...]]>`) as text without entity decoding
82
+ * - Decodes predefined entities (`&lt;`, `&gt;`, `&amp;`, `&quot;`, `&apos;`)
83
+ * - Decodes numeric entities (decimal `&#65;` and hexadecimal `&#x41;`)
84
+ * - Namespaces are treated as regular attributes (e.g., `xmlns:foo="..."`)
85
+ * - Preserves namespace prefixes in tag names (e.g., `foo:element`)
86
+ * - Skips UTF-8 BOM (0xEF 0xBB 0xBF) if present at start
87
+ * - Tracks line and column numbers for precise error reporting
88
+ */
89
+ export const xml_parse = East.platform("xml_parse", [BlobType, XmlParseConfig], XmlNode);
90
+ /**
91
+ * Serializes a recursive XML tree structure into XML-formatted binary data.
92
+ *
93
+ * Converts an {@link XmlNode} recursive structure into XML-formatted binary data.
94
+ * Supports configurable indentation, XML declarations, entity encoding,
95
+ * and self-closing tag formatting.
96
+ *
97
+ * This is a platform function for the East language, enabling XML serialization
98
+ * in East programs running on Node.js.
99
+ *
100
+ * @param node - The {@link XmlNode} root element to serialize
101
+ * @param config - Serialization configuration including indentation and formatting options
102
+ * @returns A binary blob containing the XML-formatted data (UTF-8 encoded)
103
+ *
104
+ * @example
105
+ * ```ts
106
+ * const serializeXML = East.function([XmlNode], BlobType, ($, doc) => {
107
+ * const config = $.const(East.value({
108
+ * indent: variant('some', " "),
109
+ * includeXmlDeclaration: true,
110
+ * encodeEntities: true,
111
+ * selfClosingTags: true,
112
+ * }, XmlSerializeConfig));
113
+ *
114
+ * return xml_serialize(doc, config);
115
+ * // Returns blob that decodes to:
116
+ * // <?xml version="1.0" encoding="UTF-8"?>
117
+ * // <book id="123">
118
+ * // <title>East Guide</title>
119
+ * // </book>
120
+ * });
121
+ * ```
122
+ *
123
+ * @remarks
124
+ * - Automatically encodes special characters (`<`, `>`, `&`, `"`, `'`) when encodeEntities is true
125
+ * - Attributes are serialized in the order they appear in the dictionary (sorted)
126
+ * - Empty elements are serialized as self-closing tags (`<br/>`) when selfClosingTags is true
127
+ * - Mixed content (text and elements) avoids extra newlines for simple text-only content
128
+ * - Indentation is applied recursively to nested elements
129
+ * - XML declaration includes `version="1.0"` and `encoding="UTF-8"` when enabled
130
+ */
131
+ export const xml_serialize = East.platform("xml_serialize", [XmlNode, XmlSerializeConfig], BlobType);
132
+ /**
133
+ * Node.js implementation of XML platform functions.
134
+ *
135
+ * Pass this array to {@link East.compile} to enable XML operations.
136
+ */
137
+ const XmlImpl = [
138
+ xml_parse.implement((blob, config) => {
139
+ try {
140
+ return parseXml(blob, config);
141
+ }
142
+ catch (err) {
143
+ if (err instanceof EastError)
144
+ throw err;
145
+ throw new EastError(`XML parsing failed: ${err.message}`, {
146
+ location: { filename: "xml_parse", line: 0n, column: 0n },
147
+ cause: err
148
+ });
149
+ }
150
+ }),
151
+ xml_serialize.implement((node, config) => {
152
+ try {
153
+ return serializeXml(node, config);
154
+ }
155
+ catch (err) {
156
+ if (err instanceof EastError)
157
+ throw err;
158
+ throw new EastError(`XML serialization failed: ${err.message}`, {
159
+ location: { filename: "xml_serialize", line: 0n, column: 0n },
160
+ cause: err
161
+ });
162
+ }
163
+ }),
164
+ ];
165
+ /**
166
+ * Grouped XML platform functions.
167
+ *
168
+ * Provides XML parsing and serialization operations for East programs.
169
+ *
170
+ * @example
171
+ * ```ts
172
+ * import { East, BlobType } from "@elaraai/east";
173
+ * import { XML, XmlParseConfig, XmlNode } from "@elaraai/east-node-std";
174
+ *
175
+ * const parseXML = East.function([BlobType], XmlNode, ($, xmlBlob) => {
176
+ * const config = $.const(East.value({
177
+ * preserveWhitespace: false,
178
+ * decodeEntities: true,
179
+ * }, XmlParseConfig));
180
+ *
181
+ * return XML.parse(xmlBlob, config);
182
+ * });
183
+ *
184
+ * const compiled = East.compile(parseXML.toIR(), XML.Implementation);
185
+ * const xmlData = new TextEncoder().encode("<book id='123'><title>East Guide</title></book>");
186
+ * compiled(xmlData); // Returns parsed XML tree
187
+ * ```
188
+ */
189
+ export const XML = {
190
+ /**
191
+ * Parses XML data from a binary blob into a recursive tree structure.
192
+ *
193
+ * Converts XML-formatted binary data into an XmlNode recursive structure.
194
+ * Supports XML declarations, namespaces, CDATA, entity decoding, and comments.
195
+ *
196
+ * @param blob - The XML data as a binary blob (UTF-8 encoded)
197
+ * @param config - Parsing configuration
198
+ * @returns An XmlNode representing the root element
199
+ * @throws {EastError} When XML is malformed
200
+ *
201
+ * @example
202
+ * ```ts
203
+ * const parseXML = East.function([BlobType], XmlNode, ($, xmlBlob) => {
204
+ * const config = $.const(East.value({
205
+ * preserveWhitespace: false,
206
+ * decodeEntities: true,
207
+ * }, XmlParseConfig));
208
+ *
209
+ * return XML.parse(xmlBlob, config);
210
+ * });
211
+ *
212
+ * const compiled = East.compile(parseXML.toIR(), XML.Implementation);
213
+ * const xmlData = new TextEncoder().encode("<book><title>East</title></book>");
214
+ * compiled(xmlData); // Returns: { tag: "book", attributes: Map{}, children: [...] }
215
+ * ```
216
+ */
217
+ parse: xml_parse,
218
+ /**
219
+ * Serializes a recursive XML tree structure into XML-formatted binary data.
220
+ *
221
+ * Converts an XmlNode recursive structure into XML-formatted binary data.
222
+ * Supports indentation, XML declarations, entity encoding, and self-closing tags.
223
+ *
224
+ * @param node - The XmlNode root element to serialize
225
+ * @param config - Serialization configuration
226
+ * @returns A binary blob containing the XML-formatted data
227
+ *
228
+ * @example
229
+ * ```ts
230
+ * const serializeXML = East.function([XmlNode], BlobType, ($, doc) => {
231
+ * const config = $.const(East.value({
232
+ * indent: variant('some', " "),
233
+ * includeXmlDeclaration: true,
234
+ * encodeEntities: true,
235
+ * selfClosingTags: true,
236
+ * }, XmlSerializeConfig));
237
+ *
238
+ * return XML.serialize(doc, config);
239
+ * });
240
+ *
241
+ * const compiled = East.compile(serializeXML.toIR(), XML.Implementation);
242
+ * const xmlNode = { tag: "book", attributes: new Map(), children: [] };
243
+ * compiled(xmlNode); // Returns blob: "<?xml version=\"1.0\"?>\n<book/>"
244
+ * ```
245
+ */
246
+ serialize: xml_serialize,
247
+ /**
248
+ * Node.js implementation of XML platform functions.
249
+ *
250
+ * Pass this to {@link East.compile} to enable XML operations.
251
+ */
252
+ Implementation: XmlImpl,
253
+ /**
254
+ * Type definitions for XML operations.
255
+ */
256
+ Types: {
257
+ /**
258
+ * XML parsing configuration type.
259
+ */
260
+ ParseConfig: XmlParseConfig,
261
+ /**
262
+ * XML serialization configuration type.
263
+ */
264
+ SerializeConfig: XmlSerializeConfig,
265
+ /**
266
+ * XML node recursive type (element with tag, attributes, and children).
267
+ */
268
+ Node: XmlNode,
269
+ },
270
+ };
271
+ // Export for backwards compatibility
272
+ export { XmlImpl };
273
+ // Helper Functions
274
+ function parseXml(blob, config) {
275
+ const decoder = new TextDecoder();
276
+ let xml = decoder.decode(blob);
277
+ // Skip UTF-8 BOM if present
278
+ if (xml.charCodeAt(0) === 0xFEFF) {
279
+ xml = xml.substring(1);
280
+ }
281
+ const { preserveWhitespace, decodeEntities } = config;
282
+ let pos = 0;
283
+ let line = 1n;
284
+ let column = 1n;
285
+ // Helper: advance position tracking
286
+ const advance = (count = 1) => {
287
+ for (let i = 0; i < count; i++) {
288
+ if (xml[pos + i] === '\n') {
289
+ line++;
290
+ column = 1n;
291
+ }
292
+ else {
293
+ column++;
294
+ }
295
+ }
296
+ pos += count;
297
+ };
298
+ // Helper: skip whitespace
299
+ const skipWhitespace = () => {
300
+ while (pos < xml.length && /\s/.test(xml[pos])) {
301
+ advance();
302
+ }
303
+ };
304
+ // Helper: decode XML entities
305
+ const decodeXmlEntities = (text) => {
306
+ if (!decodeEntities)
307
+ return text;
308
+ return text
309
+ .replace(/&lt;/g, '<')
310
+ .replace(/&gt;/g, '>')
311
+ .replace(/&amp;/g, '&')
312
+ .replace(/&quot;/g, '"')
313
+ .replace(/&apos;/g, "'")
314
+ .replace(/&#(\d+);/g, (_, num) => String.fromCharCode(parseInt(num, 10)))
315
+ .replace(/&#x([0-9a-fA-F]+);/g, (_, hex) => String.fromCharCode(parseInt(hex, 16)));
316
+ };
317
+ // Helper: parse element
318
+ const parseElement = () => {
319
+ // Expect '<'
320
+ if (xml[pos] !== '<') {
321
+ throw new EastError(`Expected '<' at line ${line}, column ${column}`, {
322
+ location: { filename: "xml_parse", line, column }
323
+ });
324
+ }
325
+ advance(); // skip '<'
326
+ // Parse tag name
327
+ const tagStart = pos;
328
+ while (pos < xml.length && /[a-zA-Z0-9:_-]/.test(xml[pos])) {
329
+ advance();
330
+ }
331
+ const tag = xml.substring(tagStart, pos);
332
+ if (tag.length === 0) {
333
+ throw new EastError(`Invalid tag name at line ${line}, column ${column}`, {
334
+ location: { filename: "xml_parse", line, column }
335
+ });
336
+ }
337
+ // Parse attributes
338
+ const attributes = new Map();
339
+ while (pos < xml.length) {
340
+ skipWhitespace();
341
+ // Check for end of opening tag
342
+ if (xml[pos] === '>' || (xml[pos] === '/' && xml[pos + 1] === '>')) {
343
+ break;
344
+ }
345
+ // Parse attribute name
346
+ const attrNameStart = pos;
347
+ while (pos < xml.length && /[a-zA-Z0-9:_-]/.test(xml[pos])) {
348
+ advance();
349
+ }
350
+ const attrName = xml.substring(attrNameStart, pos);
351
+ if (attrName.length === 0) {
352
+ throw new EastError(`Invalid attribute name at line ${line}, column ${column}`, {
353
+ location: { filename: "xml_parse", line, column }
354
+ });
355
+ }
356
+ skipWhitespace();
357
+ // Expect '='
358
+ if (xml[pos] !== '=') {
359
+ throw new EastError(`Expected '=' after attribute name at line ${line}, column ${column}`, {
360
+ location: { filename: "xml_parse", line, column }
361
+ });
362
+ }
363
+ advance(); // skip '='
364
+ skipWhitespace();
365
+ // Parse attribute value
366
+ const quote = xml[pos];
367
+ if (quote !== '"' && quote !== "'") {
368
+ throw new EastError(`Expected quote for attribute value at line ${line}, column ${column}`, {
369
+ location: { filename: "xml_parse", line, column }
370
+ });
371
+ }
372
+ advance(); // skip opening quote
373
+ const valueStart = pos;
374
+ while (pos < xml.length && xml[pos] !== quote) {
375
+ advance();
376
+ }
377
+ if (pos >= xml.length) {
378
+ throw new EastError(`Unclosed attribute value at line ${line}, column ${column}`, {
379
+ location: { filename: "xml_parse", line, column }
380
+ });
381
+ }
382
+ const attrValue = decodeXmlEntities(xml.substring(valueStart, pos));
383
+ advance(); // skip closing quote
384
+ attributes.set(attrName, attrValue);
385
+ }
386
+ // Check for self-closing tag
387
+ if (xml[pos] === '/' && xml[pos + 1] === '>') {
388
+ advance(2); // skip '/>'
389
+ return {
390
+ tag,
391
+ attributes,
392
+ children: [],
393
+ };
394
+ }
395
+ // Expect '>'
396
+ if (xml[pos] !== '>') {
397
+ throw new EastError(`Expected '>' at line ${line}, column ${column}`, {
398
+ location: { filename: "xml_parse", line, column }
399
+ });
400
+ }
401
+ advance(); // skip '>'
402
+ // Parse children
403
+ const children = [];
404
+ while (pos < xml.length) {
405
+ // Check for closing tag
406
+ if (xml[pos] === '<' && xml[pos + 1] === '/') {
407
+ advance(2); // skip '</'
408
+ // Parse closing tag name
409
+ const closeTagStart = pos;
410
+ while (pos < xml.length && /[a-zA-Z0-9:_-]/.test(xml[pos])) {
411
+ advance();
412
+ }
413
+ const closeTag = xml.substring(closeTagStart, pos);
414
+ if (closeTag !== tag) {
415
+ throw new EastError(`Mismatched closing tag: expected '</${tag}>', found '</${closeTag}>' at line ${line}, column ${column}`, {
416
+ location: { filename: "xml_parse", line, column }
417
+ });
418
+ }
419
+ skipWhitespace();
420
+ if (xml[pos] !== '>') {
421
+ throw new EastError(`Expected '>' in closing tag at line ${line}, column ${column}`, {
422
+ location: { filename: "xml_parse", line, column }
423
+ });
424
+ }
425
+ advance(); // skip '>'
426
+ break;
427
+ }
428
+ // Check for CDATA section
429
+ else if (xml.substring(pos, pos + 9) === '<![CDATA[') {
430
+ advance(9); // skip '<![CDATA['
431
+ const cdataStart = pos;
432
+ while (pos < xml.length && xml.substring(pos, pos + 3) !== ']]>') {
433
+ advance();
434
+ }
435
+ if (pos >= xml.length) {
436
+ throw new EastError(`Unclosed CDATA section at line ${line}, column ${column}`, {
437
+ location: { filename: "xml_parse", line, column }
438
+ });
439
+ }
440
+ let cdataText = xml.substring(cdataStart, pos);
441
+ advance(3); // skip ']]>'
442
+ // CDATA content is preserved as-is, no entity decoding
443
+ // But whitespace trimming still applies based on config
444
+ if (!preserveWhitespace) {
445
+ cdataText = cdataText.trim();
446
+ }
447
+ if (cdataText.length > 0) {
448
+ children.push(variant('TEXT', cdataText));
449
+ }
450
+ }
451
+ // Check for comment
452
+ else if (xml.substring(pos, pos + 4) === '<!--') {
453
+ advance(4); // skip '<!--'
454
+ while (pos < xml.length && xml.substring(pos, pos + 3) !== '-->') {
455
+ advance();
456
+ }
457
+ if (pos >= xml.length) {
458
+ throw new EastError(`Unclosed comment at line ${line}, column ${column}`, {
459
+ location: { filename: "xml_parse", line, column }
460
+ });
461
+ }
462
+ advance(3); // skip '-->'
463
+ // Comments are ignored by default
464
+ }
465
+ // Check for nested element
466
+ else if (xml[pos] === '<') {
467
+ const childElement = parseElement();
468
+ children.push(variant('ELEMENT', childElement));
469
+ }
470
+ // Parse text content
471
+ else {
472
+ const textStart = pos;
473
+ while (pos < xml.length && xml[pos] !== '<') {
474
+ advance();
475
+ }
476
+ let text = xml.substring(textStart, pos);
477
+ if (!preserveWhitespace) {
478
+ text = text.trim();
479
+ }
480
+ if (text.length > 0) {
481
+ text = decodeXmlEntities(text);
482
+ children.push(variant('TEXT', text));
483
+ }
484
+ }
485
+ }
486
+ return {
487
+ tag,
488
+ attributes,
489
+ children,
490
+ };
491
+ };
492
+ // Skip XML declaration and processing instructions
493
+ while (pos < xml.length) {
494
+ skipWhitespace();
495
+ if (xml.substring(pos, pos + 2) === '<?') {
496
+ // Skip processing instruction
497
+ while (pos < xml.length && xml.substring(pos, pos + 2) !== '?>') {
498
+ advance();
499
+ }
500
+ if (pos < xml.length) {
501
+ advance(2); // skip '?>'
502
+ }
503
+ }
504
+ else if (xml.substring(pos, pos + 4) === '<!--') {
505
+ // Skip comment
506
+ advance(4);
507
+ while (pos < xml.length && xml.substring(pos, pos + 3) !== '-->') {
508
+ advance();
509
+ }
510
+ if (pos < xml.length) {
511
+ advance(3); // skip '-->'
512
+ }
513
+ }
514
+ else {
515
+ break;
516
+ }
517
+ }
518
+ skipWhitespace();
519
+ if (pos >= xml.length) {
520
+ throw new EastError('Empty XML document', {
521
+ location: { filename: "xml_parse", line: 1n, column: 1n }
522
+ });
523
+ }
524
+ return parseElement();
525
+ }
526
+ function serializeXml(node, config) {
527
+ const { indent, includeXmlDeclaration, encodeEntities, selfClosingTags } = config;
528
+ const indentStr = indent.type === 'some' ? indent.value : '';
529
+ const useIndent = indentStr.length > 0;
530
+ // Helper: encode XML entities
531
+ const encodeXmlEntities = (text) => {
532
+ if (!encodeEntities)
533
+ return text;
534
+ return text
535
+ .replace(/&/g, '&amp;')
536
+ .replace(/</g, '&lt;')
537
+ .replace(/>/g, '&gt;')
538
+ .replace(/"/g, '&quot;')
539
+ .replace(/'/g, '&apos;');
540
+ };
541
+ // Helper: serialize element recursively
542
+ const serializeElement = (node, depth) => {
543
+ const currentIndent = useIndent ? indentStr.repeat(depth) : '';
544
+ const nextIndent = useIndent ? indentStr.repeat(depth + 1) : '';
545
+ let result = currentIndent + '<' + node.tag;
546
+ // Serialize attributes (Dict keys are sorted alphabetically)
547
+ const attrs = Array.from(node.attributes.entries());
548
+ for (const [name, value] of attrs) {
549
+ result += ' ' + name + '="' + encodeXmlEntities(value) + '"';
550
+ }
551
+ // Check if element has children
552
+ if (node.children.length === 0) {
553
+ if (selfClosingTags) {
554
+ result += '/>';
555
+ }
556
+ else {
557
+ result += '></' + node.tag + '>';
558
+ }
559
+ return result;
560
+ }
561
+ result += '>';
562
+ // Check if children are all text (avoid extra newlines for simple text content)
563
+ const allText = node.children.every(child => child.type === 'TEXT');
564
+ if (!allText && useIndent) {
565
+ result += '\n';
566
+ }
567
+ // Serialize children
568
+ for (const child of node.children) {
569
+ if (child.type === 'TEXT') {
570
+ const text = encodeXmlEntities(child.value);
571
+ if (allText) {
572
+ result += text;
573
+ }
574
+ else if (useIndent) {
575
+ result += nextIndent + text + '\n';
576
+ }
577
+ else {
578
+ result += text;
579
+ }
580
+ }
581
+ else {
582
+ // ELEMENT
583
+ result += serializeElement(child.value, depth + 1);
584
+ if (useIndent) {
585
+ result += '\n';
586
+ }
587
+ }
588
+ }
589
+ if (!allText && useIndent) {
590
+ result += currentIndent;
591
+ }
592
+ result += '</' + node.tag + '>';
593
+ return result;
594
+ };
595
+ let xml = '';
596
+ if (includeXmlDeclaration) {
597
+ xml += '<?xml version="1.0" encoding="UTF-8"?>\n';
598
+ }
599
+ xml += serializeElement(node, 0);
600
+ return new TextEncoder().encode(xml);
601
+ }
602
+ //# sourceMappingURL=xml.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xml.js","sourceRoot":"","sources":["../../src/format/xml.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,aAAa,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,WAA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I,gBAAgB,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IAEjC,OAAO,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AACzC,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ /**
6
+ * East Node IO - I/O platform functions for the East language on Node.js
7
+ *
8
+ * Provides type-safe I/O operations for East programs including:
9
+ * - SQL databases (SQLite, PostgreSQL, MySQL)
10
+ * - Cloud storage (S3)
11
+ * - File transfer (FTP, SFTP)
12
+ * - NoSQL databases (Redis, MongoDB)
13
+ * - File formats (XLSX/Excel, CSV, XML)
14
+ * - Compression (gzip, zip, tar)
15
+ *
16
+ * @packageDocumentation
17
+ */
18
+ export * from "./sql/index.js";
19
+ export * from "./storage/index.js";
20
+ export * from "./transfer/index.js";
21
+ export * from "./nosql/index.js";
22
+ export * from "./format/index.js";
23
+ export * from "./compression/index.js";
24
+ export * as EastNodeIO from './index.js';
25
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;GAYG;AAGH,cAAc,gBAAgB,CAAC;AAG/B,cAAc,oBAAoB,CAAC;AAGnC,cAAc,qBAAqB,CAAC;AAGpC,cAAc,kBAAkB,CAAC;AAGjC,cAAc,mBAAmB,CAAC;AAGlC,cAAc,wBAAwB,CAAC;AAGvC,OAAO,KAAK,UAAU,MAAM,YAAY,CAAC"}