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

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 (110) 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/index.d.ts +421 -0
  26. package/dist/format/index.d.ts.map +1 -0
  27. package/dist/format/index.js +326 -0
  28. package/dist/format/index.js.map +1 -0
  29. package/dist/format/types.d.ts +176 -0
  30. package/dist/format/types.d.ts.map +1 -0
  31. package/dist/format/types.js +122 -0
  32. package/dist/format/types.js.map +1 -0
  33. package/dist/format/xlsx.d.ts +178 -0
  34. package/dist/format/xlsx.d.ts.map +1 -0
  35. package/dist/format/xlsx.js +313 -0
  36. package/dist/format/xlsx.js.map +1 -0
  37. package/dist/format/xml.d.ts +302 -0
  38. package/dist/format/xml.d.ts.map +1 -0
  39. package/dist/format/xml.js +602 -0
  40. package/dist/format/xml.js.map +1 -0
  41. package/dist/index.d.ts +25 -0
  42. package/dist/index.d.ts.map +1 -0
  43. package/dist/index.js +32 -0
  44. package/dist/index.js.map +1 -0
  45. package/dist/nosql/index.d.ts +503 -0
  46. package/dist/nosql/index.d.ts.map +1 -0
  47. package/dist/nosql/index.js +483 -0
  48. package/dist/nosql/index.js.map +1 -0
  49. package/dist/nosql/mongodb.d.ts +306 -0
  50. package/dist/nosql/mongodb.d.ts.map +1 -0
  51. package/dist/nosql/mongodb.js +552 -0
  52. package/dist/nosql/mongodb.js.map +1 -0
  53. package/dist/nosql/redis.d.ts +268 -0
  54. package/dist/nosql/redis.d.ts.map +1 -0
  55. package/dist/nosql/redis.js +371 -0
  56. package/dist/nosql/redis.js.map +1 -0
  57. package/dist/nosql/types.d.ts +70 -0
  58. package/dist/nosql/types.d.ts.map +1 -0
  59. package/dist/nosql/types.js +79 -0
  60. package/dist/nosql/types.js.map +1 -0
  61. package/dist/sql/index.d.ts +777 -0
  62. package/dist/sql/index.d.ts.map +1 -0
  63. package/dist/sql/index.js +515 -0
  64. package/dist/sql/index.js.map +1 -0
  65. package/dist/sql/mysql.d.ts +238 -0
  66. package/dist/sql/mysql.d.ts.map +1 -0
  67. package/dist/sql/mysql.js +396 -0
  68. package/dist/sql/mysql.js.map +1 -0
  69. package/dist/sql/postgres.d.ts +237 -0
  70. package/dist/sql/postgres.d.ts.map +1 -0
  71. package/dist/sql/postgres.js +381 -0
  72. package/dist/sql/postgres.js.map +1 -0
  73. package/dist/sql/sqlite.d.ts +217 -0
  74. package/dist/sql/sqlite.d.ts.map +1 -0
  75. package/dist/sql/sqlite.js +366 -0
  76. package/dist/sql/sqlite.js.map +1 -0
  77. package/dist/sql/types.d.ts +205 -0
  78. package/dist/sql/types.d.ts.map +1 -0
  79. package/dist/sql/types.js +175 -0
  80. package/dist/sql/types.js.map +1 -0
  81. package/dist/storage/index.d.ts +304 -0
  82. package/dist/storage/index.d.ts.map +1 -0
  83. package/dist/storage/index.js +234 -0
  84. package/dist/storage/index.js.map +1 -0
  85. package/dist/storage/s3.d.ts +373 -0
  86. package/dist/storage/s3.d.ts.map +1 -0
  87. package/dist/storage/s3.js +502 -0
  88. package/dist/storage/s3.js.map +1 -0
  89. package/dist/storage/types.d.ts +117 -0
  90. package/dist/storage/types.d.ts.map +1 -0
  91. package/dist/storage/types.js +94 -0
  92. package/dist/storage/types.js.map +1 -0
  93. package/dist/transfer/ftp.d.ts +333 -0
  94. package/dist/transfer/ftp.d.ts.map +1 -0
  95. package/dist/transfer/ftp.js +437 -0
  96. package/dist/transfer/ftp.js.map +1 -0
  97. package/dist/transfer/index.d.ts +456 -0
  98. package/dist/transfer/index.d.ts.map +1 -0
  99. package/dist/transfer/index.js +414 -0
  100. package/dist/transfer/index.js.map +1 -0
  101. package/dist/transfer/sftp.d.ts +333 -0
  102. package/dist/transfer/sftp.d.ts.map +1 -0
  103. package/dist/transfer/sftp.js +436 -0
  104. package/dist/transfer/sftp.js.map +1 -0
  105. package/dist/transfer/types.d.ts +108 -0
  106. package/dist/transfer/types.d.ts.map +1 -0
  107. package/dist/transfer/types.js +110 -0
  108. package/dist/transfer/types.js.map +1 -0
  109. package/dist/tsconfig.tsbuildinfo +1 -0
  110. package/package.json +7 -7
@@ -0,0 +1,134 @@
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
+ * Connection management utilities for East Node IO.
7
+ *
8
+ * Provides opaque handle-based connection management for databases,
9
+ * storage services, and file transfer protocols.
10
+ *
11
+ * @packageDocumentation
12
+ */
13
+ import { randomUUID } from 'node:crypto';
14
+ import { EastError } from "@elaraai/east/internal";
15
+ /**
16
+ * Internal connection handle storage.
17
+ * Maps handle UUIDs to connection objects and their cleanup functions.
18
+ *
19
+ * @internal
20
+ */
21
+ const connectionHandles = new Map();
22
+ /**
23
+ * Creates an opaque handle for a connection object.
24
+ *
25
+ * Generates a UUID handle and stores the connection in internal storage.
26
+ * The handle can be used to retrieve the connection later.
27
+ *
28
+ * @param connection - The connection object to store
29
+ * @param cleanup - Optional cleanup function to call when closing all handles
30
+ * @returns Opaque handle (UUID string) for the connection
31
+ *
32
+ * @example
33
+ * ```ts
34
+ * const pool = new pg.Pool(config);
35
+ * const handle = createHandle(pool, async () => await pool.end());
36
+ * ```
37
+ */
38
+ export function createHandle(connection, cleanup) {
39
+ const handle = randomUUID();
40
+ const entry = { connection };
41
+ if (cleanup) {
42
+ entry.cleanup = cleanup;
43
+ }
44
+ connectionHandles.set(handle, entry);
45
+ return handle;
46
+ }
47
+ /**
48
+ * Retrieves a connection object by its handle.
49
+ *
50
+ * Looks up the connection associated with the given handle.
51
+ * Throws an error if the handle is invalid or not found.
52
+ *
53
+ * @typeParam T - The expected type of the connection object
54
+ * @param handle - The opaque handle for the connection
55
+ * @returns The connection object cast to type T
56
+ *
57
+ * @throws {EastError} When handle is invalid or not found (location: "connection_handle")
58
+ *
59
+ * @example
60
+ * ```ts
61
+ * const pool = getConnection<pg.Pool>(handle);
62
+ * const result = await pool.query(sql, params);
63
+ * ```
64
+ */
65
+ export function getConnection(handle) {
66
+ const entry = connectionHandles.get(handle);
67
+ if (!entry) {
68
+ throw new EastError(`Invalid connection handle: ${handle}`, {
69
+ location: { filename: "connection_handle", line: 0n, column: 0n }
70
+ });
71
+ }
72
+ return entry.connection;
73
+ }
74
+ /**
75
+ * Closes and removes a connection handle.
76
+ *
77
+ * Removes the connection from internal storage. The connection object
78
+ * itself should be closed by the caller before calling this function.
79
+ *
80
+ * @param handle - The opaque handle to close
81
+ *
82
+ * @throws {EastError} When handle is invalid or not found (location: "connection_close")
83
+ *
84
+ * @example
85
+ * ```ts
86
+ * const pool = getConnection<pg.Pool>(handle);
87
+ * await pool.end();
88
+ * closeHandle(handle);
89
+ * ```
90
+ */
91
+ export function closeHandle(handle) {
92
+ const entry = connectionHandles.get(handle);
93
+ if (!entry) {
94
+ throw new EastError(`Cannot close invalid handle: ${handle}`, {
95
+ location: { filename: "connection_close", line: 0n, column: 0n }
96
+ });
97
+ }
98
+ connectionHandles.delete(handle);
99
+ }
100
+ /**
101
+ * Gets the current number of active connection handles.
102
+ *
103
+ * Useful for debugging and testing to ensure connections are properly cleaned up.
104
+ *
105
+ * @returns Number of active connection handles
106
+ *
107
+ * @internal
108
+ */
109
+ export function getHandleCount() {
110
+ return connectionHandles.size;
111
+ }
112
+ /**
113
+ * Closes all active connection handles.
114
+ *
115
+ * Useful for test cleanup to ensure all connections are closed even if tests fail.
116
+ * Calls each connection's registered cleanup function, then clears all handles.
117
+ *
118
+ * @internal
119
+ */
120
+ export async function closeAllHandles() {
121
+ for (const [handle, entry] of connectionHandles.entries()) {
122
+ try {
123
+ if (entry.cleanup) {
124
+ await entry.cleanup();
125
+ }
126
+ }
127
+ catch (err) {
128
+ // Ignore errors during cleanup
129
+ console.error(`Error closing handle ${handle}:`, err);
130
+ }
131
+ }
132
+ connectionHandles.clear();
133
+ }
134
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/connection/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;GAOG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD;;;;;GAKG;AACH,MAAM,iBAAiB,GAAG,IAAI,GAAG,EAA8D,CAAC;AAEhG;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,YAAY,CAAC,UAAe,EAAE,OAA6B;IACvE,MAAM,MAAM,GAAG,UAAU,EAAE,CAAC;IAC5B,MAAM,KAAK,GAAuD,EAAE,UAAU,EAAE,CAAC;IACjF,IAAI,OAAO,EAAE,CAAC;QACV,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;IAC5B,CAAC;IACD,iBAAiB,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACrC,OAAO,MAAM,CAAC;AAClB,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,aAAa,CAAI,MAAc;IAC3C,MAAM,KAAK,GAAG,iBAAiB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC5C,IAAI,CAAC,KAAK,EAAE,CAAC;QACT,MAAM,IAAI,SAAS,CAAC,8BAA8B,MAAM,EAAE,EAAE;YACxD,QAAQ,EAAE,EAAE,QAAQ,EAAE,mBAAmB,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;SACpE,CAAC,CAAC;IACP,CAAC;IACD,OAAO,KAAK,CAAC,UAAe,CAAC;AACjC,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,WAAW,CAAC,MAAc;IACtC,MAAM,KAAK,GAAG,iBAAiB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC5C,IAAI,CAAC,KAAK,EAAE,CAAC;QACT,MAAM,IAAI,SAAS,CAAC,gCAAgC,MAAM,EAAE,EAAE;YAC1D,QAAQ,EAAE,EAAE,QAAQ,EAAE,kBAAkB,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;SACnE,CAAC,CAAC;IACP,CAAC;IACD,iBAAiB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AACrC,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,cAAc;IAC1B,OAAO,iBAAiB,CAAC,IAAI,CAAC;AAClC,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe;IACjC,KAAK,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,iBAAiB,CAAC,OAAO,EAAE,EAAE,CAAC;QACxD,IAAI,CAAC;YACD,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;gBAChB,MAAM,KAAK,CAAC,OAAO,EAAE,CAAC;YAC1B,CAAC;QACL,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACX,+BAA+B;YAC/B,OAAO,CAAC,KAAK,CAAC,wBAAwB,MAAM,GAAG,EAAE,GAAG,CAAC,CAAC;QAC1D,CAAC;IACL,CAAC;IACD,iBAAiB,CAAC,KAAK,EAAE,CAAC;AAC9B,CAAC"}
@@ -0,0 +1,421 @@
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
+ * File format platform functions for East Node IO.
7
+ *
8
+ * Provides functions for reading and writing structured file formats like
9
+ * Excel (XLSX), XML, and more.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * import { East, BlobType, IntegerType } from "@elaraai/east";
14
+ * import { Format } from "@elaraai/east-node-io";
15
+ *
16
+ * const countRows = East.function([BlobType], IntegerType, ($, xlsxBlob) => {
17
+ * const options = $.let({
18
+ * sheetName: { tag: "none", value: {} },
19
+ * });
20
+ *
21
+ * const sheet = $.let(Format.XLSX.read(xlsxBlob, options));
22
+ * return $.return(sheet.size());
23
+ * });
24
+ *
25
+ * const compiled = East.compile(countRows.toIR(), Format.XLSX.Implementation);
26
+ * const xlsxBlob = new Uint8Array([]); // XLSX file bytes
27
+ * compiled(xlsxBlob); // 100n
28
+ * ```
29
+ *
30
+ * @packageDocumentation
31
+ */
32
+ export * from "./types.js";
33
+ export { xlsx_read, xlsx_write, xlsx_info, XlsxImpl } from "./xlsx.js";
34
+ export { xml_parse, xml_serialize, XmlImpl, XmlParseConfig, XmlSerializeConfig, XmlNode } from "./xml.js";
35
+ /**
36
+ * File format platform functions grouped by format type.
37
+ *
38
+ * Provides organized access to format-specific operations for reading and
39
+ * writing structured data files in East programs.
40
+ *
41
+ * @example
42
+ * ```ts
43
+ * import { East, BlobType } from "@elaraai/east";
44
+ * import { Format } from "@elaraai/east-node-io";
45
+ *
46
+ * const createExcel = East.function([], BlobType, $ => {
47
+ * const data = $.let([
48
+ * [East.variant('String', "Name"), East.variant('String', "Age")],
49
+ * [East.variant('String', "Alice"), East.variant('Float', 30)],
50
+ * [East.variant('String', "Bob"), East.variant('Float', 25)],
51
+ * ]);
52
+ *
53
+ * const options = $.let({
54
+ * sheetName: { tag: "some", value: "People" },
55
+ * });
56
+ *
57
+ * const blob = $.let(Format.XLSX.write(data, options));
58
+ * return $.return(blob);
59
+ * });
60
+ *
61
+ * const compiled = East.compile(createExcel.toIR(), Format.XLSX.Implementation);
62
+ * const xlsxBlob = compiled(); // Uint8Array with XLSX file bytes
63
+ * ```
64
+ */
65
+ export declare const Format: {
66
+ /**
67
+ * XLSX (Excel) file format operations.
68
+ *
69
+ * Provides functions for reading and writing Excel files as 2D arrays
70
+ * of literal values (strings, numbers, booleans, null).
71
+ */
72
+ readonly XLSX: {
73
+ /**
74
+ * Reads an XLSX file and returns a 2D array of cell values.
75
+ *
76
+ * Parses an Excel file from a blob and extracts data as ArrayType<ArrayType<LiteralValueType>>.
77
+ *
78
+ * @example
79
+ * ```ts
80
+ * import { East, BlobType, IntegerType, variant } from "@elaraai/east";
81
+ * import { Format } from "@elaraai/east-node-io";
82
+ *
83
+ * const countRows = East.function([BlobType], IntegerType, ($, xlsxBlob) => {
84
+ * const options = $.let({
85
+ * sheetName: variant('none', null),
86
+ * });
87
+ *
88
+ * const sheet = $.let(Format.XLSX.read(xlsxBlob, options));
89
+ * $.return(sheet.size());
90
+ * });
91
+ *
92
+ * const compiled = East.compile(countRows.toIR(), Format.XLSX.Implementation);
93
+ * const blob = new Uint8Array([]);
94
+ * compiled(blob); // 100n
95
+ * ```
96
+ */
97
+ readonly read: import("@elaraai/east").PlatformDefinition<[import("@elaraai/east").BlobType, import("@elaraai/east").StructType<{
98
+ sheetName: import("@elaraai/east").OptionType<import("@elaraai/east").StringType>;
99
+ }>], import("@elaraai/east").ArrayType<import("@elaraai/east").ArrayType<import("@elaraai/east").VariantType<{
100
+ Null: import("@elaraai/east").NullType;
101
+ Boolean: import("@elaraai/east").BooleanType;
102
+ Integer: import("@elaraai/east").IntegerType;
103
+ Float: import("@elaraai/east").FloatType;
104
+ String: import("@elaraai/east").StringType;
105
+ DateTime: import("@elaraai/east").DateTimeType;
106
+ Blob: import("@elaraai/east").BlobType;
107
+ }>>>>;
108
+ /**
109
+ * Writes a 2D array of cell values to an XLSX file.
110
+ *
111
+ * Creates an Excel file from a 2D array of literal values.
112
+ *
113
+ * @example
114
+ * ```ts
115
+ * import { East, BlobType, variant } from "@elaraai/east";
116
+ * import { Format } from "@elaraai/east-node-io";
117
+ *
118
+ * const createExcel = East.function([], BlobType, $ => {
119
+ * const data = $.let([
120
+ * [variant('String', "Name"), variant('String', "Age")],
121
+ * [variant('String', "Alice"), variant('Float', 30)],
122
+ * ], Format.XLSX.Types.Sheet);
123
+ *
124
+ * const options = $.let({
125
+ * sheetName: variant('some', "People"),
126
+ * });
127
+ *
128
+ * const blob = $.let(Format.XLSX.write(data, options));
129
+ * $.return(blob);
130
+ * });
131
+ *
132
+ * const compiled = East.compile(createExcel.toIR(), Format.XLSX.Implementation);
133
+ * const xlsxBlob = compiled();
134
+ * ```
135
+ */
136
+ readonly write: import("@elaraai/east").PlatformDefinition<[import("@elaraai/east").ArrayType<import("@elaraai/east").ArrayType<import("@elaraai/east").VariantType<{
137
+ Null: import("@elaraai/east").NullType;
138
+ Boolean: import("@elaraai/east").BooleanType;
139
+ Integer: import("@elaraai/east").IntegerType;
140
+ Float: import("@elaraai/east").FloatType;
141
+ String: import("@elaraai/east").StringType;
142
+ DateTime: import("@elaraai/east").DateTimeType;
143
+ Blob: import("@elaraai/east").BlobType;
144
+ }>>>, import("@elaraai/east").StructType<{
145
+ sheetName: import("@elaraai/east").OptionType<import("@elaraai/east").StringType>;
146
+ }>], import("@elaraai/east").BlobType>;
147
+ /**
148
+ * Gets metadata about an XLSX file.
149
+ *
150
+ * Returns sheet names and approximate sizes without reading all data.
151
+ *
152
+ * @example
153
+ * ```ts
154
+ * import { East, BlobType, IntegerType, variant } from "@elaraai/east";
155
+ * import { Format } from "@elaraai/east-node-io";
156
+ *
157
+ * const countSheets = East.function([BlobType], IntegerType, ($, xlsxBlob) => {
158
+ * const info = $.let(Format.XLSX.info(xlsxBlob));
159
+ * $.return(info.sheets.size());
160
+ * });
161
+ *
162
+ * const compiled = East.compile(countSheets.toIR(), Format.XLSX.Implementation);
163
+ * const blob = new Uint8Array([]);
164
+ * compiled(blob); // 3n
165
+ * ```
166
+ */
167
+ readonly info: import("@elaraai/east").PlatformDefinition<[import("@elaraai/east").BlobType], import("@elaraai/east").StructType<{
168
+ sheets: import("@elaraai/east").ArrayType<import("@elaraai/east").StructType<{
169
+ name: import("@elaraai/east").StringType;
170
+ rowCount: import("@elaraai/east").IntegerType;
171
+ columnCount: import("@elaraai/east").IntegerType;
172
+ }>>;
173
+ }>>;
174
+ /**
175
+ * Node.js implementation of XLSX platform functions.
176
+ *
177
+ * Pass this to {@link East.compile} to enable XLSX operations.
178
+ *
179
+ * @example
180
+ * ```ts
181
+ * import { East, BlobType, NullType, variant } from "@elaraai/east";
182
+ * import { Format } from "@elaraai/east-node-io";
183
+ *
184
+ * const myFunction = East.function([BlobType], NullType, ($, xlsxBlob) => {
185
+ * const options = $.let({
186
+ * sheetName: variant('none', null),
187
+ * });
188
+ * const sheet = $.let(Format.XLSX.read(xlsxBlob, options));
189
+ * $.return(null);
190
+ * });
191
+ *
192
+ * const compiled = East.compile(myFunction.toIR(), Format.XLSX.Implementation);
193
+ * const blob = new Uint8Array([]);
194
+ * compiled(blob);
195
+ * ```
196
+ */
197
+ readonly Implementation: import("@elaraai/east/internal").PlatformFunction[];
198
+ /**
199
+ * Type definitions for XLSX operations.
200
+ */
201
+ readonly Types: {
202
+ /**
203
+ * A single cell value in a spreadsheet (LiteralValueType).
204
+ */
205
+ readonly Cell: import("@elaraai/east").VariantType<{
206
+ Null: import("@elaraai/east").NullType;
207
+ Boolean: import("@elaraai/east").BooleanType;
208
+ Integer: import("@elaraai/east").IntegerType;
209
+ Float: import("@elaraai/east").FloatType;
210
+ String: import("@elaraai/east").StringType;
211
+ DateTime: import("@elaraai/east").DateTimeType;
212
+ Blob: import("@elaraai/east").BlobType;
213
+ }>;
214
+ /**
215
+ * A row of cells in a spreadsheet.
216
+ */
217
+ readonly Row: import("@elaraai/east").ArrayType<import("@elaraai/east").VariantType<{
218
+ Null: import("@elaraai/east").NullType;
219
+ Boolean: import("@elaraai/east").BooleanType;
220
+ Integer: import("@elaraai/east").IntegerType;
221
+ Float: import("@elaraai/east").FloatType;
222
+ String: import("@elaraai/east").StringType;
223
+ DateTime: import("@elaraai/east").DateTimeType;
224
+ Blob: import("@elaraai/east").BlobType;
225
+ }>>;
226
+ /**
227
+ * A 2D array representing a complete worksheet.
228
+ */
229
+ readonly Sheet: import("@elaraai/east").ArrayType<import("@elaraai/east").ArrayType<import("@elaraai/east").VariantType<{
230
+ Null: import("@elaraai/east").NullType;
231
+ Boolean: import("@elaraai/east").BooleanType;
232
+ Integer: import("@elaraai/east").IntegerType;
233
+ Float: import("@elaraai/east").FloatType;
234
+ String: import("@elaraai/east").StringType;
235
+ DateTime: import("@elaraai/east").DateTimeType;
236
+ Blob: import("@elaraai/east").BlobType;
237
+ }>>>;
238
+ /**
239
+ * XLSX read options configuration.
240
+ */
241
+ readonly ReadOptions: import("@elaraai/east").StructType<{
242
+ sheetName: import("@elaraai/east").OptionType<import("@elaraai/east").StringType>;
243
+ }>;
244
+ /**
245
+ * XLSX write options configuration.
246
+ */
247
+ readonly WriteOptions: import("@elaraai/east").StructType<{
248
+ sheetName: import("@elaraai/east").OptionType<import("@elaraai/east").StringType>;
249
+ }>;
250
+ /**
251
+ * Information about a single sheet in an XLSX file.
252
+ */
253
+ readonly SheetInfo: import("@elaraai/east").StructType<{
254
+ name: import("@elaraai/east").StringType;
255
+ rowCount: import("@elaraai/east").IntegerType;
256
+ columnCount: import("@elaraai/east").IntegerType;
257
+ }>;
258
+ /**
259
+ * XLSX file metadata with sheet listing.
260
+ */
261
+ readonly Info: import("@elaraai/east").StructType<{
262
+ sheets: import("@elaraai/east").ArrayType<import("@elaraai/east").StructType<{
263
+ name: import("@elaraai/east").StringType;
264
+ rowCount: import("@elaraai/east").IntegerType;
265
+ columnCount: import("@elaraai/east").IntegerType;
266
+ }>>;
267
+ }>;
268
+ };
269
+ };
270
+ /**
271
+ * XML (Extensible Markup Language) file format operations.
272
+ *
273
+ * Provides functions for parsing and serializing XML files as recursive tree structures,
274
+ * where each node contains a tag name, attributes dictionary, and children array.
275
+ */
276
+ readonly XML: {
277
+ /**
278
+ * Parses XML data from a binary blob into a recursive tree structure.
279
+ *
280
+ * Converts XML-formatted binary data into an XmlNode recursive structure.
281
+ * Supports XML declarations, namespaces, CDATA, entity decoding, and comments.
282
+ *
283
+ * @example
284
+ * ```ts
285
+ * import { East, BlobType } from "@elaraai/east";
286
+ * import { Format } from "@elaraai/east-node-io";
287
+ *
288
+ * const parseXML = East.function([BlobType], Format.XML.Types.Node, ($, xmlBlob) => {
289
+ * const config = $.let({
290
+ * preserveWhitespace: false,
291
+ * decodeEntities: true,
292
+ * });
293
+ *
294
+ * return $.return(Format.XML.parse(xmlBlob, config));
295
+ * });
296
+ *
297
+ * const compiled = East.compile(parseXML.toIR(), Format.XML.Implementation);
298
+ * const xmlBlob = new TextEncoder().encode("<book id='123'><title>East Guide</title></book>");
299
+ * compiled(xmlBlob); // Returns parsed XML tree
300
+ * ```
301
+ */
302
+ readonly parse: import("@elaraai/east").PlatformDefinition<[import("@elaraai/east").BlobType, import("@elaraai/east").StructType<{
303
+ preserveWhitespace: import("@elaraai/east").BooleanType;
304
+ decodeEntities: import("@elaraai/east").BooleanType;
305
+ }>], import("@elaraai/east").RecursiveType<import("@elaraai/east").StructType<{
306
+ tag: import("@elaraai/east").StringType;
307
+ attributes: import("@elaraai/east").DictType<import("@elaraai/east").StringType, import("@elaraai/east").StringType>;
308
+ children: import("@elaraai/east").ArrayType<import("@elaraai/east").VariantType<{
309
+ TEXT: import("@elaraai/east").StringType;
310
+ ELEMENT: import("@elaraai/east").RecursiveTypeMarker;
311
+ }>>;
312
+ }>>>;
313
+ /**
314
+ * Serializes a recursive XML tree structure into XML-formatted binary data.
315
+ *
316
+ * Converts an XmlNode recursive structure into XML-formatted binary data.
317
+ * Supports indentation, XML declarations, entity encoding, and self-closing tags.
318
+ *
319
+ * @example
320
+ * ```ts
321
+ * import { East, BlobType, variant } from "@elaraai/east";
322
+ * import { Format } from "@elaraai/east-node-io";
323
+ *
324
+ * const serializeXML = East.function([Format.XML.Types.Node], BlobType, ($, doc) => {
325
+ * const config = $.let({
326
+ * indent: variant('some', " "),
327
+ * includeXmlDeclaration: true,
328
+ * encodeEntities: true,
329
+ * selfClosingTags: true,
330
+ * });
331
+ *
332
+ * return $.return(Format.XML.serialize(doc, config));
333
+ * });
334
+ *
335
+ * const compiled = East.compile(serializeXML.toIR(), Format.XML.Implementation);
336
+ * const xmlNode = { tag: "book", attributes: new Map([["id", "123"]]), children: [] };
337
+ * compiled(xmlNode); // Returns XML blob
338
+ * ```
339
+ */
340
+ readonly serialize: import("@elaraai/east").PlatformDefinition<[import("@elaraai/east").RecursiveType<import("@elaraai/east").StructType<{
341
+ tag: import("@elaraai/east").StringType;
342
+ attributes: import("@elaraai/east").DictType<import("@elaraai/east").StringType, import("@elaraai/east").StringType>;
343
+ children: import("@elaraai/east").ArrayType<import("@elaraai/east").VariantType<{
344
+ TEXT: import("@elaraai/east").StringType;
345
+ ELEMENT: import("@elaraai/east").RecursiveTypeMarker;
346
+ }>>;
347
+ }>>, import("@elaraai/east").StructType<{
348
+ indent: import("@elaraai/east").OptionType<import("@elaraai/east").StringType>;
349
+ includeXmlDeclaration: import("@elaraai/east").BooleanType;
350
+ encodeEntities: import("@elaraai/east").BooleanType;
351
+ selfClosingTags: import("@elaraai/east").BooleanType;
352
+ }>], import("@elaraai/east").BlobType>;
353
+ /**
354
+ * Node.js implementation of XML platform functions.
355
+ *
356
+ * Pass this to {@link East.compile} to enable XML operations.
357
+ *
358
+ * @example
359
+ * ```ts
360
+ * import { East, BlobType, variant } from "@elaraai/east";
361
+ * import { Format } from "@elaraai/east-node-io";
362
+ *
363
+ * const myFunction = East.function([BlobType], BlobType, ($, xmlBlob) => {
364
+ * const parseConfig = $.let({
365
+ * preserveWhitespace: false,
366
+ * decodeEntities: true,
367
+ * });
368
+ *
369
+ * const doc = $.let(Format.XML.parse(xmlBlob, parseConfig));
370
+ *
371
+ * const serializeConfig = $.let({
372
+ * indent: variant('some', " "),
373
+ * includeXmlDeclaration: true,
374
+ * encodeEntities: true,
375
+ * selfClosingTags: true,
376
+ * });
377
+ *
378
+ * return $.return(Format.XML.serialize(doc, serializeConfig));
379
+ * });
380
+ *
381
+ * const compiled = East.compile(myFunction.toIR(), Format.XML.Implementation);
382
+ * const xmlBlob = new TextEncoder().encode("<book><title>East</title></book>");
383
+ * compiled(xmlBlob);
384
+ * ```
385
+ */
386
+ readonly Implementation: import("@elaraai/east/internal").PlatformFunction[];
387
+ /**
388
+ * Type definitions for XML operations.
389
+ */
390
+ readonly Types: {
391
+ /**
392
+ * XML parsing configuration type.
393
+ */
394
+ readonly ParseConfig: import("@elaraai/east").StructType<{
395
+ preserveWhitespace: import("@elaraai/east").BooleanType;
396
+ decodeEntities: import("@elaraai/east").BooleanType;
397
+ }>;
398
+ /**
399
+ * XML serialization configuration type.
400
+ */
401
+ readonly SerializeConfig: import("@elaraai/east").StructType<{
402
+ indent: import("@elaraai/east").OptionType<import("@elaraai/east").StringType>;
403
+ includeXmlDeclaration: import("@elaraai/east").BooleanType;
404
+ encodeEntities: import("@elaraai/east").BooleanType;
405
+ selfClosingTags: import("@elaraai/east").BooleanType;
406
+ }>;
407
+ /**
408
+ * XML node recursive type (element with tag, attributes, and children).
409
+ */
410
+ readonly Node: import("@elaraai/east").RecursiveType<import("@elaraai/east").StructType<{
411
+ tag: import("@elaraai/east").StringType;
412
+ attributes: import("@elaraai/east").DictType<import("@elaraai/east").StringType, import("@elaraai/east").StringType>;
413
+ children: import("@elaraai/east").ArrayType<import("@elaraai/east").VariantType<{
414
+ TEXT: import("@elaraai/east").StringType;
415
+ ELEMENT: import("@elaraai/east").RecursiveTypeMarker;
416
+ }>>;
417
+ }>>;
418
+ };
419
+ };
420
+ };
421
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/format/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAGH,cAAc,YAAY,CAAC;AAG3B,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAe1G;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,eAAO,MAAM,MAAM;IACf;;;;;OAKG;;QAEC;;;;;;;;;;;;;;;;;;;;;;;WAuBG;;;;;;;;;;;;QAGH;;;;;;;;;;;;;;;;;;;;;;;;;;;WA2BG;;;;;;;;;;;;QAGH;;;;;;;;;;;;;;;;;;;WAmBG;;;;;;;;QAGH;;;;;;;;;;;;;;;;;;;;;;WAsBG;;QAGH;;WAEG;;YAEC;;eAEG;;;;;;;;;;YAGH;;eAEG;;;;;;;;;;YAGH;;eAEG;;;;;;;;;;YAGH;;eAEG;;;;YAGH;;eAEG;;;;YAGH;;eAEG;;;;;;YAGH;;eAEG;;;;;;;;;;IAKX;;;;;OAKG;;QAEC;;;;;;;;;;;;;;;;;;;;;;;;WAwBG;;;;;;;;;;;;QAGH;;;;;;;;;;;;;;;;;;;;;;;;;;WA0BG;;;;;;;;;;;;;;QAGH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAgCG;;QAGH;;WAEG;;YAEC;;eAEG;;;;;YAGH;;eAEG;;;;;;;YAGH;;eAEG;;;;;;;;;;;CAIL,CAAC"}