@elaraai/east-node-io 0.0.1-beta.2 → 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.
- package/dist/compression/tar.d.ts.map +1 -1
- package/dist/compression/tar.js +2 -2
- package/dist/compression/tar.js.map +1 -1
- package/dist/compression/zip.d.ts.map +1 -1
- package/dist/compression/zip.js +2 -2
- package/dist/compression/zip.js.map +1 -1
- package/dist/format/index.d.ts +1 -221
- package/dist/format/index.d.ts.map +1 -1
- package/dist/format/index.js +1 -138
- package/dist/format/index.js.map +1 -1
- package/dist/format/xml.d.ts.map +1 -1
- package/dist/format/xml.js +2 -2
- package/dist/format/xml.js.map +1 -1
- package/dist/sql/mysql.js +1 -1
- package/dist/sql/mysql.js.map +1 -1
- package/dist/sql/postgres.js +1 -1
- package/dist/sql/postgres.js.map +1 -1
- package/dist/sql/sqlite.js +1 -1
- package/dist/sql/sqlite.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/dist/format/csv.d.ts +0 -210
- package/dist/format/csv.d.ts.map +0 -1
- package/dist/format/csv.js +0 -729
- package/dist/format/csv.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elaraai/east-node-io",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
3
|
+
"version": "0.0.1-beta.3",
|
|
4
4
|
"description": "I/O platform functions for the East language on Node.js",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"node": ">=22.0.0"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
|
-
"@elaraai/east-node-std": "^0.0.1-beta.
|
|
83
|
+
"@elaraai/east-node-std": "^0.0.1-beta.3",
|
|
84
84
|
"@types/adm-zip": "^0.5.7",
|
|
85
85
|
"@types/better-sqlite3": "^7.6.12",
|
|
86
86
|
"@types/node": "^22.18.1",
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
"dependencies": {
|
|
98
98
|
"@aws-sdk/client-s3": "^3.713.0",
|
|
99
99
|
"@aws-sdk/s3-request-presigner": "^3.713.0",
|
|
100
|
-
"@elaraai/east": "^0.0.1-beta.
|
|
100
|
+
"@elaraai/east": "^0.0.1-beta.5",
|
|
101
101
|
"adm-zip": "^0.5.16",
|
|
102
102
|
"basic-ftp": "^5.0.5",
|
|
103
103
|
"better-sqlite3": "^11.0.0",
|
package/dist/format/csv.d.ts
DELETED
|
@@ -1,210 +0,0 @@
|
|
|
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 { BlobType, ArrayType, DictType, StringType, OptionType, BooleanType, StructType, VariantType, NullType } from "@elaraai/east";
|
|
6
|
-
import type { PlatformFunction } from "@elaraai/east/internal";
|
|
7
|
-
export declare const CsvColumnType: VariantType<{
|
|
8
|
-
Null: NullType;
|
|
9
|
-
Boolean: NullType;
|
|
10
|
-
Integer: NullType;
|
|
11
|
-
Float: NullType;
|
|
12
|
-
String: NullType;
|
|
13
|
-
DateTime: NullType;
|
|
14
|
-
Blob: NullType;
|
|
15
|
-
}>;
|
|
16
|
-
export declare const CsvParseConfig: StructType<{
|
|
17
|
-
columns: OptionType<DictType<StringType, VariantType<{
|
|
18
|
-
Null: NullType;
|
|
19
|
-
Boolean: NullType;
|
|
20
|
-
Integer: NullType;
|
|
21
|
-
Float: NullType;
|
|
22
|
-
String: NullType;
|
|
23
|
-
DateTime: NullType;
|
|
24
|
-
Blob: NullType;
|
|
25
|
-
}>>>;
|
|
26
|
-
delimiter: OptionType<StringType>;
|
|
27
|
-
quoteChar: OptionType<StringType>;
|
|
28
|
-
escapeChar: OptionType<StringType>;
|
|
29
|
-
newline: OptionType<StringType>;
|
|
30
|
-
hasHeader: BooleanType;
|
|
31
|
-
nullString: OptionType<StringType>;
|
|
32
|
-
skipEmptyLines: BooleanType;
|
|
33
|
-
trimFields: BooleanType;
|
|
34
|
-
}>;
|
|
35
|
-
export declare const CsvSerializeConfig: StructType<{
|
|
36
|
-
delimiter: StringType;
|
|
37
|
-
quoteChar: StringType;
|
|
38
|
-
escapeChar: StringType;
|
|
39
|
-
newline: StringType;
|
|
40
|
-
includeHeader: BooleanType;
|
|
41
|
-
nullString: StringType;
|
|
42
|
-
alwaysQuote: BooleanType;
|
|
43
|
-
}>;
|
|
44
|
-
/** Represents a single CSV row as a dictionary mapping column names to optional string values. */
|
|
45
|
-
export declare const CsvRowType: DictType<StringType, VariantType<{
|
|
46
|
-
Null: NullType;
|
|
47
|
-
Boolean: BooleanType;
|
|
48
|
-
Integer: import("@elaraai/east").IntegerType;
|
|
49
|
-
Float: import("@elaraai/east").FloatType;
|
|
50
|
-
String: StringType;
|
|
51
|
-
DateTime: import("@elaraai/east").DateTimeType;
|
|
52
|
-
Blob: BlobType;
|
|
53
|
-
}>>;
|
|
54
|
-
/** Represents CSV data as an array of row dictionaries. */
|
|
55
|
-
export declare const CsvDataType: ArrayType<DictType<StringType, VariantType<{
|
|
56
|
-
Null: NullType;
|
|
57
|
-
Boolean: BooleanType;
|
|
58
|
-
Integer: import("@elaraai/east").IntegerType;
|
|
59
|
-
Float: import("@elaraai/east").FloatType;
|
|
60
|
-
String: StringType;
|
|
61
|
-
DateTime: import("@elaraai/east").DateTimeType;
|
|
62
|
-
Blob: BlobType;
|
|
63
|
-
}>>>;
|
|
64
|
-
/**
|
|
65
|
-
* Parses CSV data from a binary blob into structured row data.
|
|
66
|
-
*
|
|
67
|
-
* Converts CSV-formatted binary data into an array of row dictionaries,
|
|
68
|
-
* where each dictionary maps column names to optional string values.
|
|
69
|
-
* Supports configurable delimiters, quote characters, escape sequences,
|
|
70
|
-
* and header handling.
|
|
71
|
-
*
|
|
72
|
-
* This is a platform function for the East language, enabling CSV parsing
|
|
73
|
-
* in East programs running on Node.js.
|
|
74
|
-
*
|
|
75
|
-
* @param blob - The CSV data as a binary blob (UTF-8 encoded)
|
|
76
|
-
* @param config - Parsing configuration including delimiter, quote characters, and header options
|
|
77
|
-
* @returns An array of row dictionaries, each mapping column names to optional string values
|
|
78
|
-
*
|
|
79
|
-
* @throws {EastError} When CSV is malformed with specific error messages:
|
|
80
|
-
* - "Unclosed quote in row N, column M" - Quote not properly closed
|
|
81
|
-
* - "Too many fields in row N (expected X columns, found at least Y)" - More fields than header
|
|
82
|
-
* - "Too few fields in row N (expected X columns, got Y)" - Fewer fields than header
|
|
83
|
-
* - "Invalid escape sequence in row N, column M" - Invalid escape character usage
|
|
84
|
-
* - "Expected delimiter or newline after closing quote in row N, column M" - Invalid data after quote
|
|
85
|
-
* - "quoteChar must have length 1" - Invalid configuration
|
|
86
|
-
* - "escapeChar must have length 1" - Invalid configuration
|
|
87
|
-
* - "delimiter must not be empty" - Invalid configuration
|
|
88
|
-
*
|
|
89
|
-
* @example
|
|
90
|
-
* ```ts
|
|
91
|
-
* const parseCSV = East.function([BlobType], CsvDataType, ($, csvBlob) => {
|
|
92
|
-
* const config = $.const(East.value({
|
|
93
|
-
* delimiter: variant('some', ','),
|
|
94
|
-
* quoteChar: variant('some', '"'),
|
|
95
|
-
* escapeChar: variant('some', '"'),
|
|
96
|
-
* newline: variant('none', null),
|
|
97
|
-
* hasHeader: true,
|
|
98
|
-
* nullString: variant('some', ''),
|
|
99
|
-
* skipEmptyLines: true,
|
|
100
|
-
* trimFields: false,
|
|
101
|
-
* }, CsvParseConfig));
|
|
102
|
-
*
|
|
103
|
-
* return csv_parse(csvBlob, config);
|
|
104
|
-
* // Returns: [{"name": some("Alice"), "age": some("30")}, ...]
|
|
105
|
-
* });
|
|
106
|
-
* ```
|
|
107
|
-
*
|
|
108
|
-
* @remarks
|
|
109
|
-
* - Handles quoted fields with embedded delimiters and newlines
|
|
110
|
-
* - Supports both quote-as-escape ("") and backslash-escape (\") modes
|
|
111
|
-
* - Auto-detects newline format (CRLF, LF, or CR) when newline option is none
|
|
112
|
-
* - Validates column counts when hasHeader is true
|
|
113
|
-
* - Skips UTF-8 BOM (0xEF 0xBB 0xBF) if present at start
|
|
114
|
-
* - When hasHeader is false, generates column names as "column_0", "column_1", etc.
|
|
115
|
-
*/
|
|
116
|
-
export declare const csv_parse: import("@elaraai/east").PlatformDefinition<[BlobType, StructType<{
|
|
117
|
-
columns: OptionType<DictType<StringType, VariantType<{
|
|
118
|
-
Null: NullType;
|
|
119
|
-
Boolean: NullType;
|
|
120
|
-
Integer: NullType;
|
|
121
|
-
Float: NullType;
|
|
122
|
-
String: NullType;
|
|
123
|
-
DateTime: NullType;
|
|
124
|
-
Blob: NullType;
|
|
125
|
-
}>>>;
|
|
126
|
-
delimiter: OptionType<StringType>;
|
|
127
|
-
quoteChar: OptionType<StringType>;
|
|
128
|
-
escapeChar: OptionType<StringType>;
|
|
129
|
-
newline: OptionType<StringType>;
|
|
130
|
-
hasHeader: BooleanType;
|
|
131
|
-
nullString: OptionType<StringType>;
|
|
132
|
-
skipEmptyLines: BooleanType;
|
|
133
|
-
trimFields: BooleanType;
|
|
134
|
-
}>], ArrayType<DictType<StringType, VariantType<{
|
|
135
|
-
Null: NullType;
|
|
136
|
-
Boolean: BooleanType;
|
|
137
|
-
Integer: import("@elaraai/east").IntegerType;
|
|
138
|
-
Float: import("@elaraai/east").FloatType;
|
|
139
|
-
String: StringType;
|
|
140
|
-
DateTime: import("@elaraai/east").DateTimeType;
|
|
141
|
-
Blob: BlobType;
|
|
142
|
-
}>>>>;
|
|
143
|
-
/**
|
|
144
|
-
* Serializes structured row data into CSV-formatted binary data.
|
|
145
|
-
*
|
|
146
|
-
* Converts an array of row dictionaries into CSV-formatted binary data.
|
|
147
|
-
* Supports configurable delimiters, quote characters, escape sequences,
|
|
148
|
-
* and formatting options.
|
|
149
|
-
*
|
|
150
|
-
* This is a platform function for the East language, enabling CSV serialization
|
|
151
|
-
* in East programs running on Node.js.
|
|
152
|
-
*
|
|
153
|
-
* @param data - An array of row dictionaries to serialize
|
|
154
|
-
* @param config - Serialization configuration including delimiter, quote characters, and formatting options
|
|
155
|
-
* @returns A binary blob containing the CSV-formatted data (UTF-8 encoded)
|
|
156
|
-
*
|
|
157
|
-
* @throws {EastError} When configuration is invalid:
|
|
158
|
-
* - "quoteChar must have length 1" - Invalid configuration
|
|
159
|
-
* - "escapeChar must have length 1" - Invalid configuration
|
|
160
|
-
* - "delimiter must not be empty" - Invalid configuration
|
|
161
|
-
*
|
|
162
|
-
* @example
|
|
163
|
-
* ```ts
|
|
164
|
-
* const serializeCSV = East.function([CsvDataType], BlobType, ($, data) => {
|
|
165
|
-
* const config = $.const(East.value({
|
|
166
|
-
* delimiter: ',',
|
|
167
|
-
* quoteChar: '"',
|
|
168
|
-
* escapeChar: '"',
|
|
169
|
-
* newline: '\n',
|
|
170
|
-
* includeHeader: true,
|
|
171
|
-
* nullString: '',
|
|
172
|
-
* alwaysQuote: false,
|
|
173
|
-
* }, CsvSerializeConfig));
|
|
174
|
-
*
|
|
175
|
-
* return csv_serialize(data, config);
|
|
176
|
-
* // Returns blob that decodes to: "name,age\nAlice,30\nBob,25"
|
|
177
|
-
* });
|
|
178
|
-
* ```
|
|
179
|
-
*
|
|
180
|
-
* @remarks
|
|
181
|
-
* - Automatically quotes fields containing delimiter, quote char, newline, or null string
|
|
182
|
-
* - Escapes quote characters within quoted fields using escapeChar
|
|
183
|
-
* - Column order is determined by the first row's dictionary keys
|
|
184
|
-
* - Null values are serialized as nullString
|
|
185
|
-
* - Use alwaysQuote: true to force quoting of all fields
|
|
186
|
-
*/
|
|
187
|
-
export declare const csv_serialize: import("@elaraai/east").PlatformDefinition<[ArrayType<DictType<StringType, VariantType<{
|
|
188
|
-
Null: NullType;
|
|
189
|
-
Boolean: BooleanType;
|
|
190
|
-
Integer: import("@elaraai/east").IntegerType;
|
|
191
|
-
Float: import("@elaraai/east").FloatType;
|
|
192
|
-
String: StringType;
|
|
193
|
-
DateTime: import("@elaraai/east").DateTimeType;
|
|
194
|
-
Blob: BlobType;
|
|
195
|
-
}>>>, StructType<{
|
|
196
|
-
delimiter: StringType;
|
|
197
|
-
quoteChar: StringType;
|
|
198
|
-
escapeChar: StringType;
|
|
199
|
-
newline: StringType;
|
|
200
|
-
includeHeader: BooleanType;
|
|
201
|
-
nullString: StringType;
|
|
202
|
-
alwaysQuote: BooleanType;
|
|
203
|
-
}>], BlobType>;
|
|
204
|
-
/**
|
|
205
|
-
* Node.js implementation of CSV platform functions.
|
|
206
|
-
*
|
|
207
|
-
* Pass this array to {@link East.compile} to enable CSV operations.
|
|
208
|
-
*/
|
|
209
|
-
export declare const CsvImpl: PlatformFunction[];
|
|
210
|
-
//# sourceMappingURL=csv.d.ts.map
|
package/dist/format/csv.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"csv.d.ts","sourceRoot":"","sources":["../../src/format/csv.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAQ,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAA6B,WAAW,EAAE,QAAQ,EAAS,MAAM,eAAe,CAAC;AAC9K,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAI/D,eAAO,MAAM,aAAa;;;;;;;;EAQxB,CAAA;AAEF,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;EAUzB,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;EAQ7B,CAAC;AAIH,kGAAkG;AAClG,eAAO,MAAM,UAAU;;;;;;;;GAAyC,CAAC;AAEjE,2DAA2D;AAC3D,eAAO,MAAM,WAAW;;;;;;;;IAAwB,CAAC;AAEjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;KAAsE,CAAC;AAE7F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;cAA8E,CAAC;AAEzG;;;;GAIG;AACH,eAAO,MAAM,OAAO,EAAE,gBAAgB,EAwBrC,CAAC"}
|