@elaraai/east-node-io 0.0.1-beta.1 → 0.0.1-beta.11
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/README.md +38 -0
- package/dist/compression/gzip.d.ts +108 -0
- package/dist/compression/gzip.d.ts.map +1 -0
- package/dist/compression/gzip.js +153 -0
- package/dist/compression/gzip.js.map +1 -0
- package/dist/compression/index.d.ts +308 -0
- package/dist/compression/index.d.ts.map +1 -0
- package/dist/compression/index.js +289 -0
- package/dist/compression/index.js.map +1 -0
- package/dist/compression/tar.d.ts +115 -0
- package/dist/compression/tar.d.ts.map +1 -0
- package/dist/compression/tar.js +254 -0
- package/dist/compression/tar.js.map +1 -0
- package/dist/compression/types.d.ts +124 -0
- package/dist/compression/types.d.ts.map +1 -0
- package/dist/compression/types.js +106 -0
- package/dist/compression/types.js.map +1 -0
- package/dist/compression/zip.d.ts +121 -0
- package/dist/compression/zip.d.ts.map +1 -0
- package/dist/compression/zip.js +200 -0
- package/dist/compression/zip.js.map +1 -0
- package/dist/connection/index.d.ts +78 -0
- package/dist/connection/index.d.ts.map +1 -0
- package/dist/connection/index.js +134 -0
- package/dist/connection/index.js.map +1 -0
- package/dist/format/index.d.ts +421 -0
- package/dist/format/index.d.ts.map +1 -0
- package/dist/format/index.js +326 -0
- package/dist/format/index.js.map +1 -0
- package/dist/format/types.d.ts +176 -0
- package/dist/format/types.d.ts.map +1 -0
- package/dist/format/types.js +122 -0
- package/dist/format/types.js.map +1 -0
- package/dist/format/xlsx.d.ts +178 -0
- package/dist/format/xlsx.d.ts.map +1 -0
- package/dist/format/xlsx.js +313 -0
- package/dist/format/xlsx.js.map +1 -0
- package/dist/format/xml.d.ts +302 -0
- package/dist/format/xml.d.ts.map +1 -0
- package/dist/format/xml.js +602 -0
- package/dist/format/xml.js.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +32 -0
- package/dist/index.js.map +1 -0
- package/dist/nosql/index.d.ts +503 -0
- package/dist/nosql/index.d.ts.map +1 -0
- package/dist/nosql/index.js +483 -0
- package/dist/nosql/index.js.map +1 -0
- package/dist/nosql/mongodb.d.ts +306 -0
- package/dist/nosql/mongodb.d.ts.map +1 -0
- package/dist/nosql/mongodb.js +552 -0
- package/dist/nosql/mongodb.js.map +1 -0
- package/dist/nosql/redis.d.ts +268 -0
- package/dist/nosql/redis.d.ts.map +1 -0
- package/dist/nosql/redis.js +371 -0
- package/dist/nosql/redis.js.map +1 -0
- package/dist/nosql/types.d.ts +70 -0
- package/dist/nosql/types.d.ts.map +1 -0
- package/dist/nosql/types.js +79 -0
- package/dist/nosql/types.js.map +1 -0
- package/dist/platform.d.ts +12 -0
- package/dist/platform.d.ts.map +1 -0
- package/dist/platform.js +51 -0
- package/dist/platform.js.map +1 -0
- package/dist/sql/index.d.ts +777 -0
- package/dist/sql/index.d.ts.map +1 -0
- package/dist/sql/index.js +515 -0
- package/dist/sql/index.js.map +1 -0
- package/dist/sql/mysql.d.ts +238 -0
- package/dist/sql/mysql.d.ts.map +1 -0
- package/dist/sql/mysql.js +396 -0
- package/dist/sql/mysql.js.map +1 -0
- package/dist/sql/postgres.d.ts +237 -0
- package/dist/sql/postgres.d.ts.map +1 -0
- package/dist/sql/postgres.js +381 -0
- package/dist/sql/postgres.js.map +1 -0
- package/dist/sql/sqlite.d.ts +217 -0
- package/dist/sql/sqlite.d.ts.map +1 -0
- package/dist/sql/sqlite.js +366 -0
- package/dist/sql/sqlite.js.map +1 -0
- package/dist/sql/types.d.ts +205 -0
- package/dist/sql/types.d.ts.map +1 -0
- package/dist/sql/types.js +175 -0
- package/dist/sql/types.js.map +1 -0
- package/dist/storage/index.d.ts +304 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +234 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/s3.d.ts +373 -0
- package/dist/storage/s3.d.ts.map +1 -0
- package/dist/storage/s3.js +502 -0
- package/dist/storage/s3.js.map +1 -0
- package/dist/storage/types.d.ts +117 -0
- package/dist/storage/types.d.ts.map +1 -0
- package/dist/storage/types.js +94 -0
- package/dist/storage/types.js.map +1 -0
- package/dist/transfer/ftp.d.ts +333 -0
- package/dist/transfer/ftp.d.ts.map +1 -0
- package/dist/transfer/ftp.js +437 -0
- package/dist/transfer/ftp.js.map +1 -0
- package/dist/transfer/index.d.ts +456 -0
- package/dist/transfer/index.d.ts.map +1 -0
- package/dist/transfer/index.js +414 -0
- package/dist/transfer/index.js.map +1 -0
- package/dist/transfer/sftp.d.ts +333 -0
- package/dist/transfer/sftp.d.ts.map +1 -0
- package/dist/transfer/sftp.js +436 -0
- package/dist/transfer/sftp.js.map +1 -0
- package/dist/transfer/types.d.ts +108 -0
- package/dist/transfer/types.d.ts.map +1 -0
- package/dist/transfer/types.js +110 -0
- package/dist/transfer/types.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +17 -9
|
@@ -0,0 +1,326 @@
|
|
|
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 types
|
|
33
|
+
export * from "./types.js";
|
|
34
|
+
// Export platform functions and implementation
|
|
35
|
+
export { xlsx_read, xlsx_write, xlsx_info, XlsxImpl } from "./xlsx.js";
|
|
36
|
+
export { xml_parse, xml_serialize, XmlImpl, XmlParseConfig, XmlSerializeConfig, XmlNode } from "./xml.js";
|
|
37
|
+
// Import for grouped exports
|
|
38
|
+
import { xlsx_read, xlsx_write, xlsx_info, XlsxImpl } from "./xlsx.js";
|
|
39
|
+
import { xml_parse, xml_serialize, XmlImpl, XmlParseConfig, XmlSerializeConfig, XmlNode } from "./xml.js";
|
|
40
|
+
import { XlsxCellType, XlsxRowType, XlsxSheetType, XlsxReadOptionsType, XlsxWriteOptionsType, XlsxSheetInfoType, XlsxInfoType, } from "./types.js";
|
|
41
|
+
/**
|
|
42
|
+
* File format platform functions grouped by format type.
|
|
43
|
+
*
|
|
44
|
+
* Provides organized access to format-specific operations for reading and
|
|
45
|
+
* writing structured data files in East programs.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```ts
|
|
49
|
+
* import { East, BlobType } from "@elaraai/east";
|
|
50
|
+
* import { Format } from "@elaraai/east-node-io";
|
|
51
|
+
*
|
|
52
|
+
* const createExcel = East.function([], BlobType, $ => {
|
|
53
|
+
* const data = $.let([
|
|
54
|
+
* [East.variant('String', "Name"), East.variant('String', "Age")],
|
|
55
|
+
* [East.variant('String', "Alice"), East.variant('Float', 30)],
|
|
56
|
+
* [East.variant('String', "Bob"), East.variant('Float', 25)],
|
|
57
|
+
* ]);
|
|
58
|
+
*
|
|
59
|
+
* const options = $.let({
|
|
60
|
+
* sheetName: { tag: "some", value: "People" },
|
|
61
|
+
* });
|
|
62
|
+
*
|
|
63
|
+
* const blob = $.let(Format.XLSX.write(data, options));
|
|
64
|
+
* return $.return(blob);
|
|
65
|
+
* });
|
|
66
|
+
*
|
|
67
|
+
* const compiled = East.compile(createExcel.toIR(), Format.XLSX.Implementation);
|
|
68
|
+
* const xlsxBlob = compiled(); // Uint8Array with XLSX file bytes
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
export const Format = {
|
|
72
|
+
/**
|
|
73
|
+
* XLSX (Excel) file format operations.
|
|
74
|
+
*
|
|
75
|
+
* Provides functions for reading and writing Excel files as 2D arrays
|
|
76
|
+
* of literal values (strings, numbers, booleans, null).
|
|
77
|
+
*/
|
|
78
|
+
XLSX: {
|
|
79
|
+
/**
|
|
80
|
+
* Reads an XLSX file and returns a 2D array of cell values.
|
|
81
|
+
*
|
|
82
|
+
* Parses an Excel file from a blob and extracts data as ArrayType<ArrayType<LiteralValueType>>.
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```ts
|
|
86
|
+
* import { East, BlobType, IntegerType, variant } from "@elaraai/east";
|
|
87
|
+
* import { Format } from "@elaraai/east-node-io";
|
|
88
|
+
*
|
|
89
|
+
* const countRows = East.function([BlobType], IntegerType, ($, xlsxBlob) => {
|
|
90
|
+
* const options = $.let({
|
|
91
|
+
* sheetName: variant('none', null),
|
|
92
|
+
* });
|
|
93
|
+
*
|
|
94
|
+
* const sheet = $.let(Format.XLSX.read(xlsxBlob, options));
|
|
95
|
+
* $.return(sheet.size());
|
|
96
|
+
* });
|
|
97
|
+
*
|
|
98
|
+
* const compiled = East.compile(countRows.toIR(), Format.XLSX.Implementation);
|
|
99
|
+
* const blob = new Uint8Array([]);
|
|
100
|
+
* compiled(blob); // 100n
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
read: xlsx_read,
|
|
104
|
+
/**
|
|
105
|
+
* Writes a 2D array of cell values to an XLSX file.
|
|
106
|
+
*
|
|
107
|
+
* Creates an Excel file from a 2D array of literal values.
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* ```ts
|
|
111
|
+
* import { East, BlobType, variant } from "@elaraai/east";
|
|
112
|
+
* import { Format } from "@elaraai/east-node-io";
|
|
113
|
+
*
|
|
114
|
+
* const createExcel = East.function([], BlobType, $ => {
|
|
115
|
+
* const data = $.let([
|
|
116
|
+
* [variant('String', "Name"), variant('String', "Age")],
|
|
117
|
+
* [variant('String', "Alice"), variant('Float', 30)],
|
|
118
|
+
* ], Format.XLSX.Types.Sheet);
|
|
119
|
+
*
|
|
120
|
+
* const options = $.let({
|
|
121
|
+
* sheetName: variant('some', "People"),
|
|
122
|
+
* });
|
|
123
|
+
*
|
|
124
|
+
* const blob = $.let(Format.XLSX.write(data, options));
|
|
125
|
+
* $.return(blob);
|
|
126
|
+
* });
|
|
127
|
+
*
|
|
128
|
+
* const compiled = East.compile(createExcel.toIR(), Format.XLSX.Implementation);
|
|
129
|
+
* const xlsxBlob = compiled();
|
|
130
|
+
* ```
|
|
131
|
+
*/
|
|
132
|
+
write: xlsx_write,
|
|
133
|
+
/**
|
|
134
|
+
* Gets metadata about an XLSX file.
|
|
135
|
+
*
|
|
136
|
+
* Returns sheet names and approximate sizes without reading all data.
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
* ```ts
|
|
140
|
+
* import { East, BlobType, IntegerType, variant } from "@elaraai/east";
|
|
141
|
+
* import { Format } from "@elaraai/east-node-io";
|
|
142
|
+
*
|
|
143
|
+
* const countSheets = East.function([BlobType], IntegerType, ($, xlsxBlob) => {
|
|
144
|
+
* const info = $.let(Format.XLSX.info(xlsxBlob));
|
|
145
|
+
* $.return(info.sheets.size());
|
|
146
|
+
* });
|
|
147
|
+
*
|
|
148
|
+
* const compiled = East.compile(countSheets.toIR(), Format.XLSX.Implementation);
|
|
149
|
+
* const blob = new Uint8Array([]);
|
|
150
|
+
* compiled(blob); // 3n
|
|
151
|
+
* ```
|
|
152
|
+
*/
|
|
153
|
+
info: xlsx_info,
|
|
154
|
+
/**
|
|
155
|
+
* Node.js implementation of XLSX platform functions.
|
|
156
|
+
*
|
|
157
|
+
* Pass this to {@link East.compile} to enable XLSX operations.
|
|
158
|
+
*
|
|
159
|
+
* @example
|
|
160
|
+
* ```ts
|
|
161
|
+
* import { East, BlobType, NullType, variant } from "@elaraai/east";
|
|
162
|
+
* import { Format } from "@elaraai/east-node-io";
|
|
163
|
+
*
|
|
164
|
+
* const myFunction = East.function([BlobType], NullType, ($, xlsxBlob) => {
|
|
165
|
+
* const options = $.let({
|
|
166
|
+
* sheetName: variant('none', null),
|
|
167
|
+
* });
|
|
168
|
+
* const sheet = $.let(Format.XLSX.read(xlsxBlob, options));
|
|
169
|
+
* $.return(null);
|
|
170
|
+
* });
|
|
171
|
+
*
|
|
172
|
+
* const compiled = East.compile(myFunction.toIR(), Format.XLSX.Implementation);
|
|
173
|
+
* const blob = new Uint8Array([]);
|
|
174
|
+
* compiled(blob);
|
|
175
|
+
* ```
|
|
176
|
+
*/
|
|
177
|
+
Implementation: XlsxImpl,
|
|
178
|
+
/**
|
|
179
|
+
* Type definitions for XLSX operations.
|
|
180
|
+
*/
|
|
181
|
+
Types: {
|
|
182
|
+
/**
|
|
183
|
+
* A single cell value in a spreadsheet (LiteralValueType).
|
|
184
|
+
*/
|
|
185
|
+
Cell: XlsxCellType,
|
|
186
|
+
/**
|
|
187
|
+
* A row of cells in a spreadsheet.
|
|
188
|
+
*/
|
|
189
|
+
Row: XlsxRowType,
|
|
190
|
+
/**
|
|
191
|
+
* A 2D array representing a complete worksheet.
|
|
192
|
+
*/
|
|
193
|
+
Sheet: XlsxSheetType,
|
|
194
|
+
/**
|
|
195
|
+
* XLSX read options configuration.
|
|
196
|
+
*/
|
|
197
|
+
ReadOptions: XlsxReadOptionsType,
|
|
198
|
+
/**
|
|
199
|
+
* XLSX write options configuration.
|
|
200
|
+
*/
|
|
201
|
+
WriteOptions: XlsxWriteOptionsType,
|
|
202
|
+
/**
|
|
203
|
+
* Information about a single sheet in an XLSX file.
|
|
204
|
+
*/
|
|
205
|
+
SheetInfo: XlsxSheetInfoType,
|
|
206
|
+
/**
|
|
207
|
+
* XLSX file metadata with sheet listing.
|
|
208
|
+
*/
|
|
209
|
+
Info: XlsxInfoType,
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
/**
|
|
213
|
+
* XML (Extensible Markup Language) file format operations.
|
|
214
|
+
*
|
|
215
|
+
* Provides functions for parsing and serializing XML files as recursive tree structures,
|
|
216
|
+
* where each node contains a tag name, attributes dictionary, and children array.
|
|
217
|
+
*/
|
|
218
|
+
XML: {
|
|
219
|
+
/**
|
|
220
|
+
* Parses XML data from a binary blob into a recursive tree structure.
|
|
221
|
+
*
|
|
222
|
+
* Converts XML-formatted binary data into an XmlNode recursive structure.
|
|
223
|
+
* Supports XML declarations, namespaces, CDATA, entity decoding, and comments.
|
|
224
|
+
*
|
|
225
|
+
* @example
|
|
226
|
+
* ```ts
|
|
227
|
+
* import { East, BlobType } from "@elaraai/east";
|
|
228
|
+
* import { Format } from "@elaraai/east-node-io";
|
|
229
|
+
*
|
|
230
|
+
* const parseXML = East.function([BlobType], Format.XML.Types.Node, ($, xmlBlob) => {
|
|
231
|
+
* const config = $.let({
|
|
232
|
+
* preserveWhitespace: false,
|
|
233
|
+
* decodeEntities: true,
|
|
234
|
+
* });
|
|
235
|
+
*
|
|
236
|
+
* return $.return(Format.XML.parse(xmlBlob, config));
|
|
237
|
+
* });
|
|
238
|
+
*
|
|
239
|
+
* const compiled = East.compile(parseXML.toIR(), Format.XML.Implementation);
|
|
240
|
+
* const xmlBlob = new TextEncoder().encode("<book id='123'><title>East Guide</title></book>");
|
|
241
|
+
* compiled(xmlBlob); // Returns parsed XML tree
|
|
242
|
+
* ```
|
|
243
|
+
*/
|
|
244
|
+
parse: xml_parse,
|
|
245
|
+
/**
|
|
246
|
+
* Serializes a recursive XML tree structure into XML-formatted binary data.
|
|
247
|
+
*
|
|
248
|
+
* Converts an XmlNode recursive structure into XML-formatted binary data.
|
|
249
|
+
* Supports indentation, XML declarations, entity encoding, and self-closing tags.
|
|
250
|
+
*
|
|
251
|
+
* @example
|
|
252
|
+
* ```ts
|
|
253
|
+
* import { East, BlobType, variant } from "@elaraai/east";
|
|
254
|
+
* import { Format } from "@elaraai/east-node-io";
|
|
255
|
+
*
|
|
256
|
+
* const serializeXML = East.function([Format.XML.Types.Node], BlobType, ($, doc) => {
|
|
257
|
+
* const config = $.let({
|
|
258
|
+
* indent: variant('some', " "),
|
|
259
|
+
* includeXmlDeclaration: true,
|
|
260
|
+
* encodeEntities: true,
|
|
261
|
+
* selfClosingTags: true,
|
|
262
|
+
* });
|
|
263
|
+
*
|
|
264
|
+
* return $.return(Format.XML.serialize(doc, config));
|
|
265
|
+
* });
|
|
266
|
+
*
|
|
267
|
+
* const compiled = East.compile(serializeXML.toIR(), Format.XML.Implementation);
|
|
268
|
+
* const xmlNode = { tag: "book", attributes: new Map([["id", "123"]]), children: [] };
|
|
269
|
+
* compiled(xmlNode); // Returns XML blob
|
|
270
|
+
* ```
|
|
271
|
+
*/
|
|
272
|
+
serialize: xml_serialize,
|
|
273
|
+
/**
|
|
274
|
+
* Node.js implementation of XML platform functions.
|
|
275
|
+
*
|
|
276
|
+
* Pass this to {@link East.compile} to enable XML operations.
|
|
277
|
+
*
|
|
278
|
+
* @example
|
|
279
|
+
* ```ts
|
|
280
|
+
* import { East, BlobType, variant } from "@elaraai/east";
|
|
281
|
+
* import { Format } from "@elaraai/east-node-io";
|
|
282
|
+
*
|
|
283
|
+
* const myFunction = East.function([BlobType], BlobType, ($, xmlBlob) => {
|
|
284
|
+
* const parseConfig = $.let({
|
|
285
|
+
* preserveWhitespace: false,
|
|
286
|
+
* decodeEntities: true,
|
|
287
|
+
* });
|
|
288
|
+
*
|
|
289
|
+
* const doc = $.let(Format.XML.parse(xmlBlob, parseConfig));
|
|
290
|
+
*
|
|
291
|
+
* const serializeConfig = $.let({
|
|
292
|
+
* indent: variant('some', " "),
|
|
293
|
+
* includeXmlDeclaration: true,
|
|
294
|
+
* encodeEntities: true,
|
|
295
|
+
* selfClosingTags: true,
|
|
296
|
+
* });
|
|
297
|
+
*
|
|
298
|
+
* return $.return(Format.XML.serialize(doc, serializeConfig));
|
|
299
|
+
* });
|
|
300
|
+
*
|
|
301
|
+
* const compiled = East.compile(myFunction.toIR(), Format.XML.Implementation);
|
|
302
|
+
* const xmlBlob = new TextEncoder().encode("<book><title>East</title></book>");
|
|
303
|
+
* compiled(xmlBlob);
|
|
304
|
+
* ```
|
|
305
|
+
*/
|
|
306
|
+
Implementation: XmlImpl,
|
|
307
|
+
/**
|
|
308
|
+
* Type definitions for XML operations.
|
|
309
|
+
*/
|
|
310
|
+
Types: {
|
|
311
|
+
/**
|
|
312
|
+
* XML parsing configuration type.
|
|
313
|
+
*/
|
|
314
|
+
ParseConfig: XmlParseConfig,
|
|
315
|
+
/**
|
|
316
|
+
* XML serialization configuration type.
|
|
317
|
+
*/
|
|
318
|
+
SerializeConfig: XmlSerializeConfig,
|
|
319
|
+
/**
|
|
320
|
+
* XML node recursive type (element with tag, attributes, and children).
|
|
321
|
+
*/
|
|
322
|
+
Node: XmlNode,
|
|
323
|
+
},
|
|
324
|
+
},
|
|
325
|
+
};
|
|
326
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/format/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,eAAe;AACf,cAAc,YAAY,CAAC;AAE3B,+CAA+C;AAC/C,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,6BAA6B;AAC7B,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;AAC1G,OAAO,EACH,YAAY,EACZ,WAAW,EACX,aAAa,EACb,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,YAAY,GACf,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG;IAClB;;;;;OAKG;IACH,IAAI,EAAE;QACF;;;;;;;;;;;;;;;;;;;;;;;WAuBG;QACH,IAAI,EAAE,SAAS;QAEf;;;;;;;;;;;;;;;;;;;;;;;;;;;WA2BG;QACH,KAAK,EAAE,UAAU;QAEjB;;;;;;;;;;;;;;;;;;;WAmBG;QACH,IAAI,EAAE,SAAS;QAEf;;;;;;;;;;;;;;;;;;;;;;WAsBG;QACH,cAAc,EAAE,QAAQ;QAExB;;WAEG;QACH,KAAK,EAAE;YACH;;eAEG;YACH,IAAI,EAAE,YAAY;YAElB;;eAEG;YACH,GAAG,EAAE,WAAW;YAEhB;;eAEG;YACH,KAAK,EAAE,aAAa;YAEpB;;eAEG;YACH,WAAW,EAAE,mBAAmB;YAEhC;;eAEG;YACH,YAAY,EAAE,oBAAoB;YAElC;;eAEG;YACH,SAAS,EAAE,iBAAiB;YAE5B;;eAEG;YACH,IAAI,EAAE,YAAY;SACrB;KACJ;IAED;;;;;OAKG;IACH,GAAG,EAAE;QACD;;;;;;;;;;;;;;;;;;;;;;;;WAwBG;QACH,KAAK,EAAE,SAAS;QAEhB;;;;;;;;;;;;;;;;;;;;;;;;;;WA0BG;QACH,SAAS,EAAE,aAAa;QAExB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAgCG;QACH,cAAc,EAAE,OAAO;QAEvB;;WAEG;QACH,KAAK,EAAE;YACH;;eAEG;YACH,WAAW,EAAE,cAAc;YAE3B;;eAEG;YACH,eAAe,EAAE,kBAAkB;YAEnC;;eAEG;YACH,IAAI,EAAE,OAAO;SAChB;KACJ;CACK,CAAC"}
|
|
@@ -0,0 +1,176 @@
|
|
|
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
|
+
* XLSX type definitions for East Node IO.
|
|
7
|
+
*
|
|
8
|
+
* Provides East type definitions for reading and writing Excel (XLSX) files,
|
|
9
|
+
* representing spreadsheets as 2D arrays of literal values.
|
|
10
|
+
*
|
|
11
|
+
* @packageDocumentation
|
|
12
|
+
*/
|
|
13
|
+
import { StructType, OptionType, ArrayType, DictType, StringType, IntegerType } from "@elaraai/east";
|
|
14
|
+
/**
|
|
15
|
+
* A single cell value in a spreadsheet.
|
|
16
|
+
*
|
|
17
|
+
* Can be a string, number, boolean, or null. Matches the LiteralValueType
|
|
18
|
+
* which supports all primitive JavaScript values that can appear in Excel cells.
|
|
19
|
+
*/
|
|
20
|
+
export declare const XlsxCellType: import("@elaraai/east").VariantType<{
|
|
21
|
+
Null: import("@elaraai/east").NullType;
|
|
22
|
+
Boolean: import("@elaraai/east").BooleanType;
|
|
23
|
+
Integer: IntegerType;
|
|
24
|
+
Float: import("@elaraai/east").FloatType;
|
|
25
|
+
String: StringType;
|
|
26
|
+
DateTime: import("@elaraai/east").DateTimeType;
|
|
27
|
+
Blob: import("@elaraai/east").BlobType;
|
|
28
|
+
}>;
|
|
29
|
+
/**
|
|
30
|
+
* A row of cells in a spreadsheet.
|
|
31
|
+
*
|
|
32
|
+
* Represents a single row as an array of cell values.
|
|
33
|
+
*/
|
|
34
|
+
export declare const XlsxRowType: ArrayType<import("@elaraai/east").VariantType<{
|
|
35
|
+
Null: import("@elaraai/east").NullType;
|
|
36
|
+
Boolean: import("@elaraai/east").BooleanType;
|
|
37
|
+
Integer: IntegerType;
|
|
38
|
+
Float: import("@elaraai/east").FloatType;
|
|
39
|
+
String: StringType;
|
|
40
|
+
DateTime: import("@elaraai/east").DateTimeType;
|
|
41
|
+
Blob: import("@elaraai/east").BlobType;
|
|
42
|
+
}>>;
|
|
43
|
+
/**
|
|
44
|
+
* A 2D array representing a complete worksheet.
|
|
45
|
+
*
|
|
46
|
+
* Array of rows, where each row is an array of cell values.
|
|
47
|
+
* This is the main data structure for reading/writing XLSX files.
|
|
48
|
+
*/
|
|
49
|
+
export declare const XlsxSheetType: ArrayType<ArrayType<import("@elaraai/east").VariantType<{
|
|
50
|
+
Null: import("@elaraai/east").NullType;
|
|
51
|
+
Boolean: import("@elaraai/east").BooleanType;
|
|
52
|
+
Integer: IntegerType;
|
|
53
|
+
Float: import("@elaraai/east").FloatType;
|
|
54
|
+
String: StringType;
|
|
55
|
+
DateTime: import("@elaraai/east").DateTimeType;
|
|
56
|
+
Blob: import("@elaraai/east").BlobType;
|
|
57
|
+
}>>>;
|
|
58
|
+
/**
|
|
59
|
+
* XLSX read options configuration.
|
|
60
|
+
*
|
|
61
|
+
* Controls how Excel files are parsed when reading.
|
|
62
|
+
*/
|
|
63
|
+
export declare const XlsxReadOptionsType: StructType<{
|
|
64
|
+
/**
|
|
65
|
+
* Name of the sheet to read.
|
|
66
|
+
* If not specified, reads the first sheet.
|
|
67
|
+
*/
|
|
68
|
+
sheetName: OptionType<StringType>;
|
|
69
|
+
}>;
|
|
70
|
+
/**
|
|
71
|
+
* XLSX write options configuration.
|
|
72
|
+
*
|
|
73
|
+
* Controls how data is written to Excel files.
|
|
74
|
+
*/
|
|
75
|
+
export declare const XlsxWriteOptionsType: StructType<{
|
|
76
|
+
/**
|
|
77
|
+
* Name of the sheet to create.
|
|
78
|
+
* Defaults to "Sheet1" if not specified.
|
|
79
|
+
*/
|
|
80
|
+
sheetName: OptionType<StringType>;
|
|
81
|
+
}>;
|
|
82
|
+
/**
|
|
83
|
+
* Information about sheets in an XLSX file.
|
|
84
|
+
*/
|
|
85
|
+
export declare const XlsxSheetInfoType: StructType<{
|
|
86
|
+
/** Sheet name */
|
|
87
|
+
name: StringType;
|
|
88
|
+
/** Number of rows (approximate) */
|
|
89
|
+
rowCount: IntegerType;
|
|
90
|
+
/** Number of columns (approximate) */
|
|
91
|
+
columnCount: IntegerType;
|
|
92
|
+
}>;
|
|
93
|
+
/**
|
|
94
|
+
* XLSX file metadata and sheet listing.
|
|
95
|
+
*/
|
|
96
|
+
export declare const XlsxInfoType: StructType<{
|
|
97
|
+
/** List of sheets in the workbook */
|
|
98
|
+
sheets: ArrayType<StructType<{
|
|
99
|
+
/** Sheet name */
|
|
100
|
+
name: StringType;
|
|
101
|
+
/** Number of rows (approximate) */
|
|
102
|
+
rowCount: IntegerType;
|
|
103
|
+
/** Number of columns (approximate) */
|
|
104
|
+
columnCount: IntegerType;
|
|
105
|
+
}>>;
|
|
106
|
+
}>;
|
|
107
|
+
/**
|
|
108
|
+
* A single cell value in a CSV file.
|
|
109
|
+
*
|
|
110
|
+
* Can be a string, number, boolean, or null. Matches the LiteralValueType
|
|
111
|
+
* which supports all primitive JavaScript values that can appear in CSV cells.
|
|
112
|
+
*/
|
|
113
|
+
export declare const CsvCellType: import("@elaraai/east").VariantType<{
|
|
114
|
+
Null: import("@elaraai/east").NullType;
|
|
115
|
+
Boolean: import("@elaraai/east").BooleanType;
|
|
116
|
+
Integer: IntegerType;
|
|
117
|
+
Float: import("@elaraai/east").FloatType;
|
|
118
|
+
String: StringType;
|
|
119
|
+
DateTime: import("@elaraai/east").DateTimeType;
|
|
120
|
+
Blob: import("@elaraai/east").BlobType;
|
|
121
|
+
}>;
|
|
122
|
+
/**
|
|
123
|
+
* A row of cells in a CSV file represented as a dictionary.
|
|
124
|
+
*
|
|
125
|
+
* Maps column names (from the header row) to cell values.
|
|
126
|
+
* This allows accessing cells by name rather than index.
|
|
127
|
+
*/
|
|
128
|
+
export declare const CsvRowType: DictType<StringType, import("@elaraai/east").VariantType<{
|
|
129
|
+
Null: import("@elaraai/east").NullType;
|
|
130
|
+
Boolean: import("@elaraai/east").BooleanType;
|
|
131
|
+
Integer: IntegerType;
|
|
132
|
+
Float: import("@elaraai/east").FloatType;
|
|
133
|
+
String: StringType;
|
|
134
|
+
DateTime: import("@elaraai/east").DateTimeType;
|
|
135
|
+
Blob: import("@elaraai/east").BlobType;
|
|
136
|
+
}>>;
|
|
137
|
+
/**
|
|
138
|
+
* CSV data as an array of rows.
|
|
139
|
+
*
|
|
140
|
+
* Each row is a dictionary mapping column names to values.
|
|
141
|
+
* The first row of the CSV file is used as column headers.
|
|
142
|
+
*/
|
|
143
|
+
export declare const CsvDataType: ArrayType<DictType<StringType, import("@elaraai/east").VariantType<{
|
|
144
|
+
Null: import("@elaraai/east").NullType;
|
|
145
|
+
Boolean: import("@elaraai/east").BooleanType;
|
|
146
|
+
Integer: IntegerType;
|
|
147
|
+
Float: import("@elaraai/east").FloatType;
|
|
148
|
+
String: StringType;
|
|
149
|
+
DateTime: import("@elaraai/east").DateTimeType;
|
|
150
|
+
Blob: import("@elaraai/east").BlobType;
|
|
151
|
+
}>>>;
|
|
152
|
+
/**
|
|
153
|
+
* CSV read options configuration.
|
|
154
|
+
*
|
|
155
|
+
* Controls how CSV files are parsed when reading.
|
|
156
|
+
*/
|
|
157
|
+
export declare const CsvReadOptionsType: StructType<{
|
|
158
|
+
/**
|
|
159
|
+
* Delimiter character.
|
|
160
|
+
* Defaults to "," if not specified.
|
|
161
|
+
*/
|
|
162
|
+
delimiter: OptionType<StringType>;
|
|
163
|
+
}>;
|
|
164
|
+
/**
|
|
165
|
+
* CSV write options configuration.
|
|
166
|
+
*
|
|
167
|
+
* Controls how data is written to CSV files.
|
|
168
|
+
*/
|
|
169
|
+
export declare const CsvWriteOptionsType: StructType<{
|
|
170
|
+
/**
|
|
171
|
+
* Delimiter character.
|
|
172
|
+
* Defaults to "," if not specified.
|
|
173
|
+
*/
|
|
174
|
+
delimiter: OptionType<StringType>;
|
|
175
|
+
}>;
|
|
176
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/format/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;GAOG;AAEH,OAAO,EACH,UAAU,EACV,UAAU,EACV,SAAS,EACT,QAAQ,EACR,UAAU,EACV,WAAW,EACd,MAAM,eAAe,CAAC;AAGvB;;;;;GAKG;AACH,eAAO,MAAM,YAAY;;;;;;;;EAAmB,CAAC;AAE7C;;;;GAIG;AACH,eAAO,MAAM,WAAW;;;;;;;;GAA0B,CAAC;AAEnD;;;;;GAKG;AACH,eAAO,MAAM,aAAa;;;;;;;;IAAyB,CAAC;AAEpD;;;;GAIG;AACH,eAAO,MAAM,mBAAmB;IAC5B;;;OAGG;;EAEL,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,oBAAoB;IAC7B;;;OAGG;;EAEL,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,iBAAiB;IAC1B,iBAAiB;;IAGjB,mCAAmC;;IAGnC,sCAAsC;;EAExC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,YAAY;IACrB,qCAAqC;;QAdrC,iBAAiB;;QAGjB,mCAAmC;;QAGnC,sCAAsC;;;EAUxC,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,WAAW;;;;;;;;EAAmB,CAAC;AAE5C;;;;;GAKG;AACH,eAAO,MAAM,UAAU;;;;;;;;GAAoC,CAAC;AAE5D;;;;;GAKG;AACH,eAAO,MAAM,WAAW;;;;;;;;IAAwB,CAAC;AAEjD;;;;GAIG;AACH,eAAO,MAAM,kBAAkB;IAC3B;;;OAGG;;EAEL,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,mBAAmB;IAC5B;;;OAGG;;EAEL,CAAC"}
|
|
@@ -0,0 +1,122 @@
|
|
|
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
|
+
* XLSX type definitions for East Node IO.
|
|
7
|
+
*
|
|
8
|
+
* Provides East type definitions for reading and writing Excel (XLSX) files,
|
|
9
|
+
* representing spreadsheets as 2D arrays of literal values.
|
|
10
|
+
*
|
|
11
|
+
* @packageDocumentation
|
|
12
|
+
*/
|
|
13
|
+
import { StructType, OptionType, ArrayType, DictType, StringType, IntegerType, } from "@elaraai/east";
|
|
14
|
+
import { LiteralValueType } from "@elaraai/east/internal";
|
|
15
|
+
/**
|
|
16
|
+
* A single cell value in a spreadsheet.
|
|
17
|
+
*
|
|
18
|
+
* Can be a string, number, boolean, or null. Matches the LiteralValueType
|
|
19
|
+
* which supports all primitive JavaScript values that can appear in Excel cells.
|
|
20
|
+
*/
|
|
21
|
+
export const XlsxCellType = LiteralValueType;
|
|
22
|
+
/**
|
|
23
|
+
* A row of cells in a spreadsheet.
|
|
24
|
+
*
|
|
25
|
+
* Represents a single row as an array of cell values.
|
|
26
|
+
*/
|
|
27
|
+
export const XlsxRowType = ArrayType(XlsxCellType);
|
|
28
|
+
/**
|
|
29
|
+
* A 2D array representing a complete worksheet.
|
|
30
|
+
*
|
|
31
|
+
* Array of rows, where each row is an array of cell values.
|
|
32
|
+
* This is the main data structure for reading/writing XLSX files.
|
|
33
|
+
*/
|
|
34
|
+
export const XlsxSheetType = ArrayType(XlsxRowType);
|
|
35
|
+
/**
|
|
36
|
+
* XLSX read options configuration.
|
|
37
|
+
*
|
|
38
|
+
* Controls how Excel files are parsed when reading.
|
|
39
|
+
*/
|
|
40
|
+
export const XlsxReadOptionsType = StructType({
|
|
41
|
+
/**
|
|
42
|
+
* Name of the sheet to read.
|
|
43
|
+
* If not specified, reads the first sheet.
|
|
44
|
+
*/
|
|
45
|
+
sheetName: OptionType(StringType),
|
|
46
|
+
});
|
|
47
|
+
/**
|
|
48
|
+
* XLSX write options configuration.
|
|
49
|
+
*
|
|
50
|
+
* Controls how data is written to Excel files.
|
|
51
|
+
*/
|
|
52
|
+
export const XlsxWriteOptionsType = StructType({
|
|
53
|
+
/**
|
|
54
|
+
* Name of the sheet to create.
|
|
55
|
+
* Defaults to "Sheet1" if not specified.
|
|
56
|
+
*/
|
|
57
|
+
sheetName: OptionType(StringType),
|
|
58
|
+
});
|
|
59
|
+
/**
|
|
60
|
+
* Information about sheets in an XLSX file.
|
|
61
|
+
*/
|
|
62
|
+
export const XlsxSheetInfoType = StructType({
|
|
63
|
+
/** Sheet name */
|
|
64
|
+
name: StringType,
|
|
65
|
+
/** Number of rows (approximate) */
|
|
66
|
+
rowCount: IntegerType,
|
|
67
|
+
/** Number of columns (approximate) */
|
|
68
|
+
columnCount: IntegerType,
|
|
69
|
+
});
|
|
70
|
+
/**
|
|
71
|
+
* XLSX file metadata and sheet listing.
|
|
72
|
+
*/
|
|
73
|
+
export const XlsxInfoType = StructType({
|
|
74
|
+
/** List of sheets in the workbook */
|
|
75
|
+
sheets: ArrayType(XlsxSheetInfoType),
|
|
76
|
+
});
|
|
77
|
+
/**
|
|
78
|
+
* A single cell value in a CSV file.
|
|
79
|
+
*
|
|
80
|
+
* Can be a string, number, boolean, or null. Matches the LiteralValueType
|
|
81
|
+
* which supports all primitive JavaScript values that can appear in CSV cells.
|
|
82
|
+
*/
|
|
83
|
+
export const CsvCellType = LiteralValueType;
|
|
84
|
+
/**
|
|
85
|
+
* A row of cells in a CSV file represented as a dictionary.
|
|
86
|
+
*
|
|
87
|
+
* Maps column names (from the header row) to cell values.
|
|
88
|
+
* This allows accessing cells by name rather than index.
|
|
89
|
+
*/
|
|
90
|
+
export const CsvRowType = DictType(StringType, CsvCellType);
|
|
91
|
+
/**
|
|
92
|
+
* CSV data as an array of rows.
|
|
93
|
+
*
|
|
94
|
+
* Each row is a dictionary mapping column names to values.
|
|
95
|
+
* The first row of the CSV file is used as column headers.
|
|
96
|
+
*/
|
|
97
|
+
export const CsvDataType = ArrayType(CsvRowType);
|
|
98
|
+
/**
|
|
99
|
+
* CSV read options configuration.
|
|
100
|
+
*
|
|
101
|
+
* Controls how CSV files are parsed when reading.
|
|
102
|
+
*/
|
|
103
|
+
export const CsvReadOptionsType = StructType({
|
|
104
|
+
/**
|
|
105
|
+
* Delimiter character.
|
|
106
|
+
* Defaults to "," if not specified.
|
|
107
|
+
*/
|
|
108
|
+
delimiter: OptionType(StringType),
|
|
109
|
+
});
|
|
110
|
+
/**
|
|
111
|
+
* CSV write options configuration.
|
|
112
|
+
*
|
|
113
|
+
* Controls how data is written to CSV files.
|
|
114
|
+
*/
|
|
115
|
+
export const CsvWriteOptionsType = StructType({
|
|
116
|
+
/**
|
|
117
|
+
* Delimiter character.
|
|
118
|
+
* Defaults to "," if not specified.
|
|
119
|
+
*/
|
|
120
|
+
delimiter: OptionType(StringType),
|
|
121
|
+
});
|
|
122
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/format/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;GAOG;AAEH,OAAO,EACH,UAAU,EACV,UAAU,EACV,SAAS,EACT,QAAQ,EACR,UAAU,EACV,WAAW,GACd,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,gBAAgB,CAAC;AAE7C;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,SAAS,CAAC,YAAY,CAAC,CAAC;AAEnD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,SAAS,CAAC,WAAW,CAAC,CAAC;AAEpD;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,UAAU,CAAC;IAC1C;;;OAGG;IACH,SAAS,EAAE,UAAU,CAAC,UAAU,CAAC;CACpC,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,UAAU,CAAC;IAC3C;;;OAGG;IACH,SAAS,EAAE,UAAU,CAAC,UAAU,CAAC;CACpC,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,UAAU,CAAC;IACxC,iBAAiB;IACjB,IAAI,EAAE,UAAU;IAEhB,mCAAmC;IACnC,QAAQ,EAAE,WAAW;IAErB,sCAAsC;IACtC,WAAW,EAAE,WAAW;CAC3B,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,UAAU,CAAC;IACnC,qCAAqC;IACrC,MAAM,EAAE,SAAS,CAAC,iBAAiB,CAAC;CACvC,CAAC,CAAC;AAEH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,gBAAgB,CAAC;AAE5C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;AAE5D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC;AAEjD;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,UAAU,CAAC;IACzC;;;OAGG;IACH,SAAS,EAAE,UAAU,CAAC,UAAU,CAAC;CACpC,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,UAAU,CAAC;IAC1C;;;OAGG;IACH,SAAS,EAAE,UAAU,CAAC,UAAU,CAAC;CACpC,CAAC,CAAC"}
|