@elaraai/east-node-io 0.0.1-beta.9 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLA.md +1 -1
- package/CONTRIBUTING.md +3 -3
- package/LICENSE.md +31 -0
- package/README.md +56 -19
- package/dist/{compression → src/compression}/gzip.d.ts +1 -1
- package/dist/src/compression/gzip.d.ts.map +1 -0
- package/dist/{compression → src/compression}/gzip.js +3 -3
- package/dist/src/compression/gzip.js.map +1 -0
- package/dist/{compression → src/compression}/index.d.ts +16 -16
- package/dist/src/compression/index.d.ts.map +1 -0
- package/dist/src/compression/index.js.map +1 -0
- package/dist/{compression → src/compression}/tar.d.ts +2 -2
- package/dist/src/compression/tar.d.ts.map +1 -0
- package/dist/{compression → src/compression}/tar.js +7 -7
- package/dist/src/compression/tar.js.map +1 -0
- package/dist/{compression → src/compression}/types.d.ts +10 -10
- package/dist/src/compression/types.d.ts.map +1 -0
- package/dist/src/compression/types.js.map +1 -0
- package/dist/{compression → src/compression}/zip.d.ts +3 -3
- package/dist/src/compression/zip.d.ts.map +1 -0
- package/dist/{compression → src/compression}/zip.js +4 -4
- package/dist/src/compression/zip.js.map +1 -0
- package/dist/src/connection/index.d.ts.map +1 -0
- package/dist/{connection → src/connection}/index.js +2 -2
- package/dist/src/connection/index.js.map +1 -0
- package/dist/{format → src/format}/index.d.ts +77 -77
- package/dist/src/format/index.d.ts.map +1 -0
- package/dist/src/format/index.js.map +1 -0
- package/dist/{format → src/format}/types.d.ts +53 -53
- package/dist/src/format/types.d.ts.map +1 -0
- package/dist/src/format/types.js.map +1 -0
- package/dist/{format → src/format}/xlsx.d.ts +20 -20
- package/dist/src/format/xlsx.d.ts.map +1 -0
- package/dist/{format → src/format}/xlsx.js +6 -6
- package/dist/src/format/xlsx.js.map +1 -0
- package/dist/{format → src/format}/xml.d.ts +54 -54
- package/dist/src/format/xml.d.ts.map +1 -0
- package/dist/{format → src/format}/xml.js +14 -14
- package/dist/src/format/xml.js.map +1 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js.map +1 -0
- package/dist/{nosql → src/nosql}/index.d.ts +20 -20
- package/dist/src/nosql/index.d.ts.map +1 -0
- package/dist/src/nosql/index.js.map +1 -0
- package/dist/{nosql → src/nosql}/mongodb.d.ts +5 -5
- package/dist/src/nosql/mongodb.d.ts.map +1 -0
- package/dist/{nosql → src/nosql}/mongodb.js +8 -8
- package/dist/src/nosql/mongodb.js.map +1 -0
- package/dist/{nosql → src/nosql}/redis.d.ts +5 -5
- package/dist/src/nosql/redis.d.ts.map +1 -0
- package/dist/{nosql → src/nosql}/redis.js +6 -6
- package/dist/src/nosql/redis.js.map +1 -0
- package/dist/{nosql → src/nosql}/types.d.ts +10 -10
- package/dist/src/nosql/types.d.ts.map +1 -0
- package/dist/src/nosql/types.js.map +1 -0
- package/dist/src/platform.d.ts.map +1 -0
- package/dist/{platform.js → src/platform.js} +2 -0
- package/dist/src/platform.js.map +1 -0
- package/dist/src/sql/access.d.ts +243 -0
- package/dist/src/sql/access.d.ts.map +1 -0
- package/dist/src/sql/access.js +427 -0
- package/dist/src/sql/access.js.map +1 -0
- package/dist/src/sql/index.d.ts +1112 -0
- package/dist/src/sql/index.d.ts.map +1 -0
- package/dist/{sql → src/sql}/index.js +296 -4
- package/dist/src/sql/index.js.map +1 -0
- package/dist/{sql → src/sql}/mysql.d.ts +110 -32
- package/dist/src/sql/mysql.d.ts.map +1 -0
- package/dist/{sql → src/sql}/mysql.js +207 -6
- package/dist/src/sql/mysql.js.map +1 -0
- package/dist/{sql → src/sql}/postgres.d.ts +110 -32
- package/dist/src/sql/postgres.d.ts.map +1 -0
- package/dist/{sql → src/sql}/postgres.js +199 -6
- package/dist/src/sql/postgres.js.map +1 -0
- package/dist/{sql → src/sql}/sqlite.d.ts +108 -30
- package/dist/src/sql/sqlite.d.ts.map +1 -0
- package/dist/{sql → src/sql}/sqlite.js +209 -6
- package/dist/src/sql/sqlite.js.map +1 -0
- package/dist/src/sql/types.d.ts +269 -0
- package/dist/src/sql/types.d.ts.map +1 -0
- package/dist/{sql → src/sql}/types.js +65 -1
- package/dist/src/sql/types.js.map +1 -0
- package/dist/{storage → src/storage}/index.d.ts +63 -63
- package/dist/src/storage/index.d.ts.map +1 -0
- package/dist/{storage → src/storage}/index.js +1 -1
- package/dist/src/storage/index.js.map +1 -0
- package/dist/{storage → src/storage}/s3.d.ts +56 -49
- package/dist/src/storage/s3.d.ts.map +1 -0
- package/dist/{storage → src/storage}/s3.js +24 -15
- package/dist/src/storage/s3.js.map +1 -0
- package/dist/{storage → src/storage}/types.d.ts +18 -18
- package/dist/src/storage/types.d.ts.map +1 -0
- package/dist/src/storage/types.js.map +1 -0
- package/dist/{transfer → src/transfer}/ftp.d.ts +10 -10
- package/dist/src/transfer/ftp.d.ts.map +1 -0
- package/dist/{transfer → src/transfer}/ftp.js +6 -6
- package/dist/src/transfer/ftp.js.map +1 -0
- package/dist/{transfer → src/transfer}/index.d.ts +40 -40
- package/dist/src/transfer/index.d.ts.map +1 -0
- package/dist/src/transfer/index.js.map +1 -0
- package/dist/{transfer → src/transfer}/sftp.d.ts +10 -10
- package/dist/src/transfer/sftp.d.ts.map +1 -0
- package/dist/{transfer → src/transfer}/sftp.js +6 -6
- package/dist/src/transfer/sftp.js.map +1 -0
- package/dist/{transfer → src/transfer}/types.d.ts +15 -15
- package/dist/src/transfer/types.d.ts.map +1 -0
- package/dist/src/transfer/types.js.map +1 -0
- package/package.json +35 -54
- package/dist/compression/gzip.d.ts.map +0 -1
- package/dist/compression/gzip.js.map +0 -1
- package/dist/compression/index.d.ts.map +0 -1
- package/dist/compression/index.js.map +0 -1
- package/dist/compression/tar.d.ts.map +0 -1
- package/dist/compression/tar.js.map +0 -1
- package/dist/compression/types.d.ts.map +0 -1
- package/dist/compression/types.js.map +0 -1
- package/dist/compression/zip.d.ts.map +0 -1
- package/dist/compression/zip.js.map +0 -1
- package/dist/connection/index.d.ts.map +0 -1
- package/dist/connection/index.js.map +0 -1
- package/dist/format/index.d.ts.map +0 -1
- package/dist/format/index.js.map +0 -1
- package/dist/format/types.d.ts.map +0 -1
- package/dist/format/types.js.map +0 -1
- package/dist/format/xlsx.d.ts.map +0 -1
- package/dist/format/xlsx.js.map +0 -1
- package/dist/format/xml.d.ts.map +0 -1
- package/dist/format/xml.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/nosql/index.d.ts.map +0 -1
- package/dist/nosql/index.js.map +0 -1
- package/dist/nosql/mongodb.d.ts.map +0 -1
- package/dist/nosql/mongodb.js.map +0 -1
- package/dist/nosql/redis.d.ts.map +0 -1
- package/dist/nosql/redis.js.map +0 -1
- package/dist/nosql/types.d.ts.map +0 -1
- package/dist/nosql/types.js.map +0 -1
- package/dist/platform.d.ts.map +0 -1
- package/dist/platform.js.map +0 -1
- package/dist/sql/index.d.ts +0 -777
- package/dist/sql/index.d.ts.map +0 -1
- package/dist/sql/index.js.map +0 -1
- package/dist/sql/mysql.d.ts.map +0 -1
- package/dist/sql/mysql.js.map +0 -1
- package/dist/sql/postgres.d.ts.map +0 -1
- package/dist/sql/postgres.js.map +0 -1
- package/dist/sql/sqlite.d.ts.map +0 -1
- package/dist/sql/sqlite.js.map +0 -1
- package/dist/sql/types.d.ts +0 -205
- package/dist/sql/types.d.ts.map +0 -1
- package/dist/sql/types.js.map +0 -1
- package/dist/storage/index.d.ts.map +0 -1
- package/dist/storage/index.js.map +0 -1
- package/dist/storage/s3.d.ts.map +0 -1
- package/dist/storage/s3.js.map +0 -1
- package/dist/storage/types.d.ts.map +0 -1
- package/dist/storage/types.js.map +0 -1
- package/dist/transfer/ftp.d.ts.map +0 -1
- package/dist/transfer/ftp.js.map +0 -1
- package/dist/transfer/index.d.ts.map +0 -1
- package/dist/transfer/index.js.map +0 -1
- package/dist/transfer/sftp.d.ts.map +0 -1
- package/dist/transfer/sftp.js.map +0 -1
- package/dist/transfer/types.d.ts.map +0 -1
- package/dist/transfer/types.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- /package/dist/{compression → src/compression}/index.js +0 -0
- /package/dist/{compression → src/compression}/types.js +0 -0
- /package/dist/{connection → src/connection}/index.d.ts +0 -0
- /package/dist/{format → src/format}/index.js +0 -0
- /package/dist/{format → src/format}/types.js +0 -0
- /package/dist/{index.d.ts → src/index.d.ts} +0 -0
- /package/dist/{index.js → src/index.js} +0 -0
- /package/dist/{nosql → src/nosql}/index.js +0 -0
- /package/dist/{nosql → src/nosql}/types.js +0 -0
- /package/dist/{platform.d.ts → src/platform.d.ts} +0 -0
- /package/dist/{storage → src/storage}/types.js +0 -0
- /package/dist/{transfer → src/transfer}/index.js +0 -0
- /package/dist/{transfer → src/transfer}/types.js +0 -0
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*
|
|
11
11
|
* @packageDocumentation
|
|
12
12
|
*/
|
|
13
|
-
import { match, BlobType, BooleanType, DateTimeType, East, FloatType, IntegerType, isValueOf, NullType, SortedMap, variant } from "@elaraai/east";
|
|
13
|
+
import { match, ArrayType, BlobType, BooleanType, DateTimeType, East, FloatType, IntegerType, isTypeValueEqual, isValueOf, NullType, OptionType, SortedMap, StringType as EastStringType, toEastTypeValue, variant } from "@elaraai/east";
|
|
14
14
|
import { EastError } from "@elaraai/east/internal";
|
|
15
15
|
import Database from 'better-sqlite3';
|
|
16
16
|
import { createHandle, getConnection, closeHandle, closeAllHandles } from '../connection/index.js';
|
|
@@ -117,6 +117,76 @@ export const sqlite_connect = East.asyncPlatform("sqlite_connect", [SqliteConfig
|
|
|
117
117
|
* - All queries are synchronous but wrapped in async for consistency
|
|
118
118
|
*/
|
|
119
119
|
export const sqlite_query = East.asyncPlatform("sqlite_query", [ConnectionHandleType, StringType, SqlParametersType], SqlResultType);
|
|
120
|
+
/**
|
|
121
|
+
* Executes a SELECT query with user-defined return type.
|
|
122
|
+
*
|
|
123
|
+
* Runs a SELECT query against a SQLite database with parameter binding and
|
|
124
|
+
* returns results as an array of typed rows. The return type is generic,
|
|
125
|
+
* allowing users to specify the expected row structure for type-safe access.
|
|
126
|
+
*
|
|
127
|
+
* This is a generic platform function for the East language, enabling type-safe
|
|
128
|
+
* SELECT queries in East programs running on Node.js.
|
|
129
|
+
*
|
|
130
|
+
* @typeParam T - The expected row type for query results
|
|
131
|
+
* @param handle - Connection handle from sqlite_connect()
|
|
132
|
+
* @param sql - SQL SELECT query string with ? placeholders
|
|
133
|
+
* @param params - Query parameters as SqlParameterType array
|
|
134
|
+
* @returns Array of rows matching the specified type T
|
|
135
|
+
*
|
|
136
|
+
* @throws {EastError} When query fails due to:
|
|
137
|
+
* - Invalid connection handle (location: "sqlite_select")
|
|
138
|
+
* - SQL syntax errors (location: "sqlite_select")
|
|
139
|
+
* - Query is not a SELECT (location: "sqlite_select")
|
|
140
|
+
* - Type coercion failure (location: "sqlite_select")
|
|
141
|
+
*
|
|
142
|
+
* @example
|
|
143
|
+
* ```ts
|
|
144
|
+
* import { East, NullType, StructType, StringType, IntegerType, variant } from "@elaraai/east";
|
|
145
|
+
* import { SQL } from "@elaraai/east-node-io";
|
|
146
|
+
*
|
|
147
|
+
* // Define the expected row type
|
|
148
|
+
* const UserRowType = StructType({
|
|
149
|
+
* id: IntegerType,
|
|
150
|
+
* name: StringType,
|
|
151
|
+
* email: StringType,
|
|
152
|
+
* });
|
|
153
|
+
*
|
|
154
|
+
* const queryUsers = East.function([], NullType, ($) => {
|
|
155
|
+
* const config = $.let({
|
|
156
|
+
* path: ":memory:",
|
|
157
|
+
* readOnly: variant('none', null),
|
|
158
|
+
* memory: variant('some', true),
|
|
159
|
+
* });
|
|
160
|
+
*
|
|
161
|
+
* const conn = $.let(SQL.SQLite.connect(config));
|
|
162
|
+
*
|
|
163
|
+
* // Create table and insert data
|
|
164
|
+
* $(SQL.SQLite.query(conn, "CREATE TABLE users (id INTEGER, name TEXT, email TEXT)", []));
|
|
165
|
+
* $(SQL.SQLite.query(conn, "INSERT INTO users VALUES (1, 'Alice', 'alice@example.com')", []));
|
|
166
|
+
*
|
|
167
|
+
* // Query with typed results - returns Array<UserRowType>
|
|
168
|
+
* const users = $.let(SQL.SQLite.select([UserRowType], conn,
|
|
169
|
+
* "SELECT id, name, email FROM users",
|
|
170
|
+
* []
|
|
171
|
+
* ));
|
|
172
|
+
* // users is typed as Array<{ id: bigint, name: string, email: string }>
|
|
173
|
+
*
|
|
174
|
+
* $(SQL.SQLite.close(conn));
|
|
175
|
+
* $.return(null);
|
|
176
|
+
* });
|
|
177
|
+
*
|
|
178
|
+
* const compiled = East.compileAsync(queryUsers.toIR(), SQL.SQLite.Implementation);
|
|
179
|
+
* await compiled();
|
|
180
|
+
* ```
|
|
181
|
+
*
|
|
182
|
+
* @remarks
|
|
183
|
+
* - Only SELECT queries are supported (use sqlite_query for INSERT/UPDATE/DELETE)
|
|
184
|
+
* - Uses `?` placeholders for parameters (not $1, $2 like PostgreSQL)
|
|
185
|
+
* - Row type T should match the structure of selected columns
|
|
186
|
+
* - All SQLite data types are mapped to appropriate East types
|
|
187
|
+
* - NULL values are preserved in the result
|
|
188
|
+
*/
|
|
189
|
+
export const sqlite_select = East.asyncGenericPlatform("sqlite_select", ["T"], [ConnectionHandleType, StringType, SqlParametersType], ArrayType("T"));
|
|
120
190
|
/**
|
|
121
191
|
* Closes a SQLite database connection.
|
|
122
192
|
*
|
|
@@ -261,7 +331,7 @@ export const SqliteImpl = [
|
|
|
261
331
|
}
|
|
262
332
|
catch (err) {
|
|
263
333
|
throw new EastError(`SQLite connection failed: ${err.message}`, {
|
|
264
|
-
location: { filename: "sqlite_connect", line: 0n, column: 0n },
|
|
334
|
+
location: [{ filename: "sqlite_connect", line: 0n, column: 0n }],
|
|
265
335
|
cause: err
|
|
266
336
|
});
|
|
267
337
|
}
|
|
@@ -280,7 +350,7 @@ export const SqliteImpl = [
|
|
|
280
350
|
const rows = stmt.all(...nativeParams);
|
|
281
351
|
if (!Array.isArray(rows)) {
|
|
282
352
|
throw new EastError('SQLite all() did not return an array', {
|
|
283
|
-
location: { filename: "sqlite_query", line: 0n, column: 0n }
|
|
353
|
+
location: [{ filename: "sqlite_query", line: 0n, column: 0n }]
|
|
284
354
|
});
|
|
285
355
|
}
|
|
286
356
|
// Get column metadata for type information
|
|
@@ -306,7 +376,7 @@ export const SqliteImpl = [
|
|
|
306
376
|
// Validate RunResult structure
|
|
307
377
|
if (typeof info !== 'object' || info === null || !('changes' in info)) {
|
|
308
378
|
throw new EastError('SQLite run() did not return valid RunResult', {
|
|
309
|
-
location: { filename: "sqlite_query", line: 0n, column: 0n }
|
|
379
|
+
location: [{ filename: "sqlite_query", line: 0n, column: 0n }]
|
|
310
380
|
});
|
|
311
381
|
}
|
|
312
382
|
// Determine query type from SQL to return the appropriate variant
|
|
@@ -339,7 +409,140 @@ export const SqliteImpl = [
|
|
|
339
409
|
}
|
|
340
410
|
catch (err) {
|
|
341
411
|
throw new EastError(`SQLite query failed: ${err.message}`, {
|
|
342
|
-
location: { filename: "sqlite_query", line: 0n, column: 0n },
|
|
412
|
+
location: [{ filename: "sqlite_query", line: 0n, column: 0n }],
|
|
413
|
+
cause: err
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
}),
|
|
417
|
+
sqlite_select.implement((T) => async (...args) => {
|
|
418
|
+
const handle = args[0];
|
|
419
|
+
const sql = args[1];
|
|
420
|
+
const params = args[2];
|
|
421
|
+
const rowType = T;
|
|
422
|
+
try {
|
|
423
|
+
const db = await Promise.resolve(getConnection(handle));
|
|
424
|
+
// Convert East parameters to native values
|
|
425
|
+
const nativeParams = params.map(convertParamToNative);
|
|
426
|
+
// Prepare the statement
|
|
427
|
+
const stmt = db.prepare(sql);
|
|
428
|
+
// Verify this is a SELECT query
|
|
429
|
+
if (!stmt.reader) {
|
|
430
|
+
throw new EastError('sqlite_select only supports SELECT queries. Use sqlite_query for INSERT/UPDATE/DELETE.', {
|
|
431
|
+
location: [{ filename: "sqlite_select", line: 0n, column: 0n }]
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
// Validate row type is a Struct
|
|
435
|
+
if (rowType.type !== 'Struct') {
|
|
436
|
+
throw new EastError(`Expected row type must be a Struct, got ${rowType.type}`, { location: [{ filename: "sqlite_select", line: 0n, column: 0n }] });
|
|
437
|
+
}
|
|
438
|
+
// Get column metadata
|
|
439
|
+
const columns = stmt.columns();
|
|
440
|
+
const columnMetaMap = new Map();
|
|
441
|
+
for (const col of columns) {
|
|
442
|
+
columnMetaMap.set(col.name, { type: col.type?.toUpperCase() || null });
|
|
443
|
+
}
|
|
444
|
+
// Validate field types and determine which are OptionTypes
|
|
445
|
+
// Note: T is EastTypeValue (IR format), not EastType (runtime format)
|
|
446
|
+
const structTypeValue = rowType;
|
|
447
|
+
const fieldInfo = new Map();
|
|
448
|
+
for (const field of structTypeValue.value) {
|
|
449
|
+
const fieldName = field.name;
|
|
450
|
+
const fieldType = field.type;
|
|
451
|
+
const colMeta = columnMetaMap.get(fieldName);
|
|
452
|
+
if (!colMeta) {
|
|
453
|
+
throw new EastError(`Column '${fieldName}' not found in query result`, { location: [{ filename: "sqlite_select", line: 0n, column: 0n }] });
|
|
454
|
+
}
|
|
455
|
+
// Determine expected base type from SQLite column type
|
|
456
|
+
let expectedBaseType;
|
|
457
|
+
const colType = colMeta.type;
|
|
458
|
+
if (colType === 'INTEGER' || colType === 'INT' || colType === 'TINYINT' || colType === 'SMALLINT' ||
|
|
459
|
+
colType === 'MEDIUMINT' || colType === 'BIGINT' || colType === 'UNSIGNED BIG INT' ||
|
|
460
|
+
colType === 'INT2' || colType === 'INT8') {
|
|
461
|
+
expectedBaseType = IntegerType;
|
|
462
|
+
}
|
|
463
|
+
else if (colType === 'REAL' || colType === 'DOUBLE' || colType === 'DOUBLE PRECISION' ||
|
|
464
|
+
colType === 'FLOAT' || colType === 'NUMERIC' || colType === 'DECIMAL') {
|
|
465
|
+
expectedBaseType = FloatType;
|
|
466
|
+
}
|
|
467
|
+
else if (colType === 'TEXT' || colType === 'CHARACTER' || colType === 'VARCHAR' ||
|
|
468
|
+
colType === 'VARYING CHARACTER' || colType === 'NCHAR' || colType === 'NATIVE CHARACTER' ||
|
|
469
|
+
colType === 'NVARCHAR' || colType === 'CLOB' || colType === 'DATE') {
|
|
470
|
+
expectedBaseType = EastStringType;
|
|
471
|
+
}
|
|
472
|
+
else if (colType === 'DATETIME') {
|
|
473
|
+
expectedBaseType = DateTimeType;
|
|
474
|
+
}
|
|
475
|
+
else if (colType === 'BLOB') {
|
|
476
|
+
expectedBaseType = BlobType;
|
|
477
|
+
}
|
|
478
|
+
else if (colType === 'BOOLEAN') {
|
|
479
|
+
expectedBaseType = BooleanType;
|
|
480
|
+
}
|
|
481
|
+
else {
|
|
482
|
+
// Unknown column type - skip type validation, rely on isValueOf later
|
|
483
|
+
fieldInfo.set(fieldName, { isOption: false, expectedBaseType: IntegerType });
|
|
484
|
+
continue;
|
|
485
|
+
}
|
|
486
|
+
// Check if field type matches base type or OptionType(base type)
|
|
487
|
+
const isBase = isTypeValueEqual(fieldType, toEastTypeValue(expectedBaseType));
|
|
488
|
+
const isOption = isTypeValueEqual(fieldType, toEastTypeValue(OptionType(expectedBaseType)));
|
|
489
|
+
if (!isBase && !isOption) {
|
|
490
|
+
throw new EastError(`Type mismatch for column '${fieldName}': SQLite column is ${colType}, got ${fieldType.type} but expected ${expectedBaseType.type} or OptionType(${expectedBaseType.type})`, { location: [{ filename: "sqlite_select", line: 0n, column: 0n }] });
|
|
491
|
+
}
|
|
492
|
+
fieldInfo.set(fieldName, { isOption, expectedBaseType });
|
|
493
|
+
}
|
|
494
|
+
// Execute the query
|
|
495
|
+
const rawRows = stmt.all(...nativeParams);
|
|
496
|
+
if (!Array.isArray(rawRows)) {
|
|
497
|
+
throw new EastError('SQLite all() did not return an array', {
|
|
498
|
+
location: [{ filename: "sqlite_select", line: 0n, column: 0n }]
|
|
499
|
+
});
|
|
500
|
+
}
|
|
501
|
+
// Convert values based on column metadata and handle nulls
|
|
502
|
+
const rows = rawRows.map((row, rowIndex) => {
|
|
503
|
+
const converted = {};
|
|
504
|
+
for (const [key, value] of Object.entries(row)) {
|
|
505
|
+
const info = fieldInfo.get(key);
|
|
506
|
+
const colMeta = columnMetaMap.get(key);
|
|
507
|
+
const colType = colMeta?.type;
|
|
508
|
+
if (value === null) {
|
|
509
|
+
if (info?.isOption) {
|
|
510
|
+
converted[key] = variant('none', null);
|
|
511
|
+
}
|
|
512
|
+
else {
|
|
513
|
+
throw new EastError(`null value at row[${rowIndex}] for required field '${key}' - use OptionType(${info?.expectedBaseType.type ?? 'T'}) for nullable columns`, { location: [{ filename: "sqlite_select", line: 0n, column: 0n }] });
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
else {
|
|
517
|
+
// Convert based on column type
|
|
518
|
+
let convertedValue;
|
|
519
|
+
if (colType === 'INTEGER' || colType === 'INT' || colType === 'TINYINT' ||
|
|
520
|
+
colType === 'SMALLINT' || colType === 'MEDIUMINT' || colType === 'BIGINT' ||
|
|
521
|
+
colType === 'UNSIGNED BIG INT' || colType === 'INT2' || colType === 'INT8') {
|
|
522
|
+
convertedValue = BigInt(value);
|
|
523
|
+
}
|
|
524
|
+
else if (colType === 'DATETIME') {
|
|
525
|
+
convertedValue = new Date(value);
|
|
526
|
+
}
|
|
527
|
+
else if (colType === 'BLOB' && Buffer.isBuffer(value)) {
|
|
528
|
+
convertedValue = new Uint8Array(value);
|
|
529
|
+
}
|
|
530
|
+
else {
|
|
531
|
+
convertedValue = value;
|
|
532
|
+
}
|
|
533
|
+
converted[key] = info?.isOption ? variant('some', convertedValue) : convertedValue;
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
return converted;
|
|
537
|
+
});
|
|
538
|
+
// Type validation is already done field-by-field above during column metadata validation
|
|
539
|
+
return rows;
|
|
540
|
+
}
|
|
541
|
+
catch (err) {
|
|
542
|
+
if (err instanceof EastError)
|
|
543
|
+
throw err;
|
|
544
|
+
throw new EastError(`SQLite select failed: ${err.message}`, {
|
|
545
|
+
location: [{ filename: "sqlite_select", line: 0n, column: 0n }],
|
|
343
546
|
cause: err
|
|
344
547
|
});
|
|
345
548
|
}
|
|
@@ -353,7 +556,7 @@ export const SqliteImpl = [
|
|
|
353
556
|
}
|
|
354
557
|
catch (err) {
|
|
355
558
|
throw new EastError(`SQLite close failed: ${err.message}`, {
|
|
356
|
-
location: { filename: "sqlite_close", line: 0n, column: 0n },
|
|
559
|
+
location: [{ filename: "sqlite_close", line: 0n, column: 0n }],
|
|
357
560
|
cause: err
|
|
358
561
|
});
|
|
359
562
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sqlite.js","sourceRoot":"","sources":["../../../src/sql/sqlite.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;GAOG;AAEH,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,gBAAgB,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,IAAI,cAAc,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAG1O,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACnG,OAAO,EACH,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,aAAa,EACb,UAAU,EACV,gBAAgB,EACnB,MAAM,YAAY,CAAC;AAyBpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAC,aAAa,CAAC,gBAAgB,EAAE,CAAC,gBAAgB,CAAC,EAAE,oBAAoB,CAAC,CAAC;AAE7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YAAY,SAAS;gBAAE,MAAM,GAAG,CAAC;YACxC,MAAM,IAAI,SAAS,CAAC,yBAAyB,GAAG,CAAC,OAAO,EAAE,EAAE;gBACxD,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,eAAe,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;gBAC/D,KAAK,EAAE,GAAG;aACb,CAAC,CAAC;QACP,CAAC;IACL,CAAC,CAAC;IAEF,YAAY,CAAC,SAAS,CAAC,KAAK,EAAE,MAAgD,EAAE,EAAE;QAC9E,IAAI,CAAC;YACD,MAAM,EAAE,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,aAAa,CAAoB,MAAM,CAAC,CAAC,CAAC;YAC3E,EAAE,CAAC,KAAK,EAAE,CAAC;YACX,WAAW,CAAC,MAAM,CAAC,CAAC;YACpB,OAAO,IAAI,CAAC;QAChB,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAChB,MAAM,IAAI,SAAS,CAAC,wBAAwB,GAAG,CAAC,OAAO,EAAE,EAAE;gBACvD,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;gBAC9D,KAAK,EAAE,GAAG;aACb,CAAC,CAAC;QACP,CAAC;IACL,CAAC,CAAC;IAEF,gBAAgB,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE;QAClC,MAAM,eAAe,EAAE,CAAC;QACxB,OAAO,IAAI,CAAC;IAChB,CAAC,CAAC;CACL,CAAC"}
|
|
@@ -0,0 +1,269 @@
|
|
|
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
|
+
* Shared SQL type definitions for East Node IO.
|
|
7
|
+
*
|
|
8
|
+
* Provides East type definitions for SQL database operations including
|
|
9
|
+
* connection configurations, query parameters, and result types.
|
|
10
|
+
*
|
|
11
|
+
* @packageDocumentation
|
|
12
|
+
*/
|
|
13
|
+
import { StructType, VariantType, OptionType, ArrayType, DictType, StringType, IntegerType, BooleanType, BlobType } from "@elaraai/east";
|
|
14
|
+
export { StringType } from "@elaraai/east";
|
|
15
|
+
/**
|
|
16
|
+
* SQLite database connection configuration.
|
|
17
|
+
*
|
|
18
|
+
* Configures a connection to a SQLite database file or in-memory database.
|
|
19
|
+
*/
|
|
20
|
+
export declare const SqliteConfigType: StructType<{
|
|
21
|
+
/**
|
|
22
|
+
* Path to the SQLite database file.
|
|
23
|
+
* Use ":memory:" for in-memory database.
|
|
24
|
+
*/
|
|
25
|
+
readonly path: StringType;
|
|
26
|
+
/**
|
|
27
|
+
* Open database in read-only mode.
|
|
28
|
+
* Optional, defaults to false (read-write).
|
|
29
|
+
*/
|
|
30
|
+
readonly readOnly: OptionType<BooleanType>;
|
|
31
|
+
/**
|
|
32
|
+
* Use in-memory database.
|
|
33
|
+
* Optional, defaults to false.
|
|
34
|
+
*/
|
|
35
|
+
readonly memory: OptionType<BooleanType>;
|
|
36
|
+
}>;
|
|
37
|
+
/**
|
|
38
|
+
* PostgreSQL database connection configuration.
|
|
39
|
+
*
|
|
40
|
+
* Configures a connection pool to a PostgreSQL database server.
|
|
41
|
+
*/
|
|
42
|
+
export declare const PostgresConfigType: StructType<{
|
|
43
|
+
/** PostgreSQL server hostname or IP address */
|
|
44
|
+
readonly host: StringType;
|
|
45
|
+
/** PostgreSQL server port (typically 5432) */
|
|
46
|
+
readonly port: IntegerType;
|
|
47
|
+
/** Database name to connect to */
|
|
48
|
+
readonly database: StringType;
|
|
49
|
+
/** Username for authentication */
|
|
50
|
+
readonly user: StringType;
|
|
51
|
+
/** Password for authentication */
|
|
52
|
+
readonly password: StringType;
|
|
53
|
+
/**
|
|
54
|
+
* Enable SSL/TLS connection.
|
|
55
|
+
* Optional, defaults to false.
|
|
56
|
+
*/
|
|
57
|
+
readonly ssl: OptionType<BooleanType>;
|
|
58
|
+
/**
|
|
59
|
+
* Maximum number of connections in the pool.
|
|
60
|
+
* Optional, defaults to 10.
|
|
61
|
+
*/
|
|
62
|
+
readonly maxConnections: OptionType<IntegerType>;
|
|
63
|
+
}>;
|
|
64
|
+
/**
|
|
65
|
+
* MySQL database connection configuration.
|
|
66
|
+
*
|
|
67
|
+
* Configures a connection pool to a MySQL database server.
|
|
68
|
+
*/
|
|
69
|
+
export declare const MySqlConfigType: StructType<{
|
|
70
|
+
/** MySQL server hostname or IP address */
|
|
71
|
+
readonly host: StringType;
|
|
72
|
+
/** MySQL server port (typically 3306) */
|
|
73
|
+
readonly port: IntegerType;
|
|
74
|
+
/** Database name to connect to */
|
|
75
|
+
readonly database: StringType;
|
|
76
|
+
/** Username for authentication */
|
|
77
|
+
readonly user: StringType;
|
|
78
|
+
/** Password for authentication */
|
|
79
|
+
readonly password: StringType;
|
|
80
|
+
/**
|
|
81
|
+
* Enable SSL/TLS connection.
|
|
82
|
+
* Optional, defaults to false.
|
|
83
|
+
*/
|
|
84
|
+
readonly ssl: OptionType<BooleanType>;
|
|
85
|
+
/**
|
|
86
|
+
* Maximum number of connections in the pool.
|
|
87
|
+
* Optional, defaults to 10.
|
|
88
|
+
*/
|
|
89
|
+
readonly maxConnections: OptionType<IntegerType>;
|
|
90
|
+
}>;
|
|
91
|
+
/**
|
|
92
|
+
* SQL query parameter value type.
|
|
93
|
+
*
|
|
94
|
+
* Represents a typed value that can be used as a parameter in SQL queries.
|
|
95
|
+
* Supports all common SQL types with proper type safety.
|
|
96
|
+
*
|
|
97
|
+
* @remarks
|
|
98
|
+
* Use East.variant() to create parameter values:
|
|
99
|
+
* - `East.variant("string", "text")`
|
|
100
|
+
* - `East.variant("int", 42n)`
|
|
101
|
+
* - `East.variant("float", 3.14)`
|
|
102
|
+
* - `East.variant("bool", true)`
|
|
103
|
+
* - `East.variant("null", {})`
|
|
104
|
+
* - `East.variant("blob", new Uint8Array([1, 2, 3]))`
|
|
105
|
+
*/
|
|
106
|
+
export declare const SqlParameterType: VariantType<{
|
|
107
|
+
readonly Null: import("@elaraai/east").NullType;
|
|
108
|
+
readonly Boolean: BooleanType;
|
|
109
|
+
readonly Integer: IntegerType;
|
|
110
|
+
readonly Float: import("@elaraai/east").FloatType;
|
|
111
|
+
readonly String: StringType;
|
|
112
|
+
readonly DateTime: import("@elaraai/east").DateTimeType;
|
|
113
|
+
readonly Blob: BlobType;
|
|
114
|
+
}>;
|
|
115
|
+
/**
|
|
116
|
+
* Array of SQL query parameters.
|
|
117
|
+
*
|
|
118
|
+
* Used to pass parameters to parameterized SQL queries.
|
|
119
|
+
*/
|
|
120
|
+
export declare const SqlParametersType: ArrayType<VariantType<{
|
|
121
|
+
readonly Null: import("@elaraai/east").NullType;
|
|
122
|
+
readonly Boolean: BooleanType;
|
|
123
|
+
readonly Integer: IntegerType;
|
|
124
|
+
readonly Float: import("@elaraai/east").FloatType;
|
|
125
|
+
readonly String: StringType;
|
|
126
|
+
readonly DateTime: import("@elaraai/east").DateTimeType;
|
|
127
|
+
readonly Blob: BlobType;
|
|
128
|
+
}>>;
|
|
129
|
+
/**
|
|
130
|
+
* SQL query result row.
|
|
131
|
+
*
|
|
132
|
+
* Represents a single row from a query result as a dictionary mapping
|
|
133
|
+
* column names to typed values.
|
|
134
|
+
*/
|
|
135
|
+
export declare const SqlRowType: DictType<StringType, VariantType<{
|
|
136
|
+
readonly Null: import("@elaraai/east").NullType;
|
|
137
|
+
readonly Boolean: BooleanType;
|
|
138
|
+
readonly Integer: IntegerType;
|
|
139
|
+
readonly Float: import("@elaraai/east").FloatType;
|
|
140
|
+
readonly String: StringType;
|
|
141
|
+
readonly DateTime: import("@elaraai/east").DateTimeType;
|
|
142
|
+
readonly Blob: BlobType;
|
|
143
|
+
}>>;
|
|
144
|
+
/**
|
|
145
|
+
* SQL query execution result.
|
|
146
|
+
*
|
|
147
|
+
* A variant type representing different query result types:
|
|
148
|
+
* - `select`: Results from SELECT queries with rows
|
|
149
|
+
* - `insert`: Results from INSERT with affected rows and optional last insert ID
|
|
150
|
+
* - `update`: Results from UPDATE with affected rows
|
|
151
|
+
* - `delete`: Results from DELETE with affected rows
|
|
152
|
+
*
|
|
153
|
+
* @remarks
|
|
154
|
+
* Using variants allows type-safe handling of different query types.
|
|
155
|
+
*/
|
|
156
|
+
export declare const SqlResultType: VariantType<{
|
|
157
|
+
/**
|
|
158
|
+
* SELECT query result with rows.
|
|
159
|
+
*/
|
|
160
|
+
readonly select: StructType<{
|
|
161
|
+
/** Array of rows returned by the query */
|
|
162
|
+
readonly rows: ArrayType<DictType<StringType, VariantType<{
|
|
163
|
+
readonly Null: import("@elaraai/east").NullType;
|
|
164
|
+
readonly Boolean: BooleanType;
|
|
165
|
+
readonly Integer: IntegerType;
|
|
166
|
+
readonly Float: import("@elaraai/east").FloatType;
|
|
167
|
+
readonly String: StringType;
|
|
168
|
+
readonly DateTime: import("@elaraai/east").DateTimeType;
|
|
169
|
+
readonly Blob: BlobType;
|
|
170
|
+
}>>>;
|
|
171
|
+
}>;
|
|
172
|
+
/**
|
|
173
|
+
* INSERT query result with metadata.
|
|
174
|
+
*/
|
|
175
|
+
readonly insert: StructType<{
|
|
176
|
+
/** Number of rows inserted */
|
|
177
|
+
readonly rowsAffected: IntegerType;
|
|
178
|
+
/** Last inserted row ID (database-specific, may be None) */
|
|
179
|
+
readonly lastInsertId: OptionType<IntegerType>;
|
|
180
|
+
}>;
|
|
181
|
+
/**
|
|
182
|
+
* UPDATE query result with metadata.
|
|
183
|
+
*/
|
|
184
|
+
readonly update: StructType<{
|
|
185
|
+
/** Number of rows updated */
|
|
186
|
+
readonly rowsAffected: IntegerType;
|
|
187
|
+
}>;
|
|
188
|
+
/**
|
|
189
|
+
* DELETE query result with metadata.
|
|
190
|
+
*/
|
|
191
|
+
readonly delete: StructType<{
|
|
192
|
+
/** Number of rows deleted */
|
|
193
|
+
readonly rowsAffected: IntegerType;
|
|
194
|
+
}>;
|
|
195
|
+
}>;
|
|
196
|
+
/**
|
|
197
|
+
* Opaque connection handle type.
|
|
198
|
+
*
|
|
199
|
+
* Represents an active database connection.
|
|
200
|
+
* Handles are created by connect() functions and used in query operations.
|
|
201
|
+
*
|
|
202
|
+
* @internal
|
|
203
|
+
*/
|
|
204
|
+
export declare const ConnectionHandleType: StringType;
|
|
205
|
+
/**
|
|
206
|
+
* Microsoft Access database connection configuration.
|
|
207
|
+
*
|
|
208
|
+
* Configures a connection to a Microsoft Access database file (.mdb or .accdb).
|
|
209
|
+
*/
|
|
210
|
+
export declare const AccessConfigType: StructType<{
|
|
211
|
+
/**
|
|
212
|
+
* Path to the Access database file (.mdb or .accdb).
|
|
213
|
+
*/
|
|
214
|
+
readonly path: StringType;
|
|
215
|
+
/**
|
|
216
|
+
* Password for encrypted databases.
|
|
217
|
+
* Optional, only required for password-protected databases.
|
|
218
|
+
*/
|
|
219
|
+
readonly password: OptionType<StringType>;
|
|
220
|
+
}>;
|
|
221
|
+
/**
|
|
222
|
+
* Microsoft Access database blob configuration.
|
|
223
|
+
*
|
|
224
|
+
* Configures opening a Microsoft Access database from binary data (Blob).
|
|
225
|
+
* Useful for opening databases fetched from URLs without writing to disk.
|
|
226
|
+
*/
|
|
227
|
+
export declare const AccessBlobConfigType: StructType<{
|
|
228
|
+
/**
|
|
229
|
+
* Binary data containing the Access database (.mdb or .accdb).
|
|
230
|
+
*/
|
|
231
|
+
readonly data: BlobType;
|
|
232
|
+
/**
|
|
233
|
+
* Password for encrypted databases.
|
|
234
|
+
* Optional, only required for password-protected databases.
|
|
235
|
+
*/
|
|
236
|
+
readonly password: OptionType<StringType>;
|
|
237
|
+
}>;
|
|
238
|
+
/**
|
|
239
|
+
* Access query options for filtering and pagination.
|
|
240
|
+
*/
|
|
241
|
+
export declare const AccessQueryOptionsType: StructType<{
|
|
242
|
+
/**
|
|
243
|
+
* Table name to query (case-sensitive).
|
|
244
|
+
*/
|
|
245
|
+
readonly table: StringType;
|
|
246
|
+
/**
|
|
247
|
+
* Specific columns to retrieve.
|
|
248
|
+
* Optional, defaults to all columns.
|
|
249
|
+
*/
|
|
250
|
+
readonly columns: OptionType<ArrayType<StringType>>;
|
|
251
|
+
/**
|
|
252
|
+
* Number of rows to skip.
|
|
253
|
+
* Optional, defaults to 0.
|
|
254
|
+
*/
|
|
255
|
+
readonly rowOffset: OptionType<IntegerType>;
|
|
256
|
+
/**
|
|
257
|
+
* Maximum number of rows to return.
|
|
258
|
+
* Optional, defaults to all rows.
|
|
259
|
+
*/
|
|
260
|
+
readonly rowLimit: OptionType<IntegerType>;
|
|
261
|
+
}>;
|
|
262
|
+
/**
|
|
263
|
+
* Access table list result.
|
|
264
|
+
*/
|
|
265
|
+
export declare const AccessTablesResultType: StructType<{
|
|
266
|
+
/** Array of table names in the database */
|
|
267
|
+
readonly tables: ArrayType<StringType>;
|
|
268
|
+
}>;
|
|
269
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/sql/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;GAOG;AAEH,OAAO,EACH,UAAU,EACV,WAAW,EACX,UAAU,EACV,SAAS,EACT,QAAQ,EACR,UAAU,EACV,WAAW,EACX,WAAW,EACX,QAAQ,EACX,MAAM,eAAe,CAAC;AAIvB,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C;;;;GAIG;AACH,eAAO,MAAM,gBAAgB;IACzB;;;OAGG;;IAGH;;;OAGG;;IAGH;;;OAGG;;EAEL,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,kBAAkB;IAC3B,+CAA+C;;IAG/C,8CAA8C;;IAG9C,kCAAkC;;IAGlC,kCAAkC;;IAGlC,kCAAkC;;IAGlC;;;OAGG;;IAGH;;;OAGG;;EAEL,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,eAAe;IACxB,0CAA0C;;IAG1C,yCAAyC;;IAGzC,kCAAkC;;IAGlC,kCAAkC;;IAGlC,kCAAkC;;IAGlC;;;OAGG;;IAGH;;;OAGG;;EAEL,CAAC;AAEH;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;EAAmB,CAAC;AAEjD;;;;GAIG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;GAA8B,CAAC;AAE7D;;;;;GAKG;AACH,eAAO,MAAM,UAAU;;;;;;;;GAAyC,CAAC;AAEjE;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,aAAa;IACtB;;OAEG;;QAEC,0CAA0C;;;;;;;;;;;IAI9C;;OAEG;;QAEC,8BAA8B;;QAE9B,4DAA4D;;;IAIhE;;OAEG;;QAEC,6BAA6B;;;IAIjC;;OAEG;;QAEC,6BAA6B;;;EAGnC,CAAC;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,YAAa,CAAC;AAE/C;;;;GAIG;AACH,eAAO,MAAM,gBAAgB;IACzB;;OAEG;;IAGH;;;OAGG;;EAEL,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB;IAC7B;;OAEG;;IAGH;;;OAGG;;EAEL,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,sBAAsB;IAC/B;;OAEG;;IAGH;;;OAGG;;IAGH;;;OAGG;;IAGH;;;OAGG;;EAEL,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,sBAAsB;IAC/B,2CAA2C;;EAE7C,CAAC"}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*
|
|
11
11
|
* @packageDocumentation
|
|
12
12
|
*/
|
|
13
|
-
import { StructType, VariantType, OptionType, ArrayType, DictType, StringType, IntegerType, BooleanType, } from "@elaraai/east";
|
|
13
|
+
import { StructType, VariantType, OptionType, ArrayType, DictType, StringType, IntegerType, BooleanType, BlobType, } from "@elaraai/east";
|
|
14
14
|
import { LiteralValueType } from "@elaraai/east/internal";
|
|
15
15
|
// Re-export StringType for use in other SQL modules
|
|
16
16
|
export { StringType } from "@elaraai/east";
|
|
@@ -172,4 +172,68 @@ export const SqlResultType = VariantType({
|
|
|
172
172
|
* @internal
|
|
173
173
|
*/
|
|
174
174
|
export const ConnectionHandleType = StringType;
|
|
175
|
+
/**
|
|
176
|
+
* Microsoft Access database connection configuration.
|
|
177
|
+
*
|
|
178
|
+
* Configures a connection to a Microsoft Access database file (.mdb or .accdb).
|
|
179
|
+
*/
|
|
180
|
+
export const AccessConfigType = StructType({
|
|
181
|
+
/**
|
|
182
|
+
* Path to the Access database file (.mdb or .accdb).
|
|
183
|
+
*/
|
|
184
|
+
path: StringType,
|
|
185
|
+
/**
|
|
186
|
+
* Password for encrypted databases.
|
|
187
|
+
* Optional, only required for password-protected databases.
|
|
188
|
+
*/
|
|
189
|
+
password: OptionType(StringType),
|
|
190
|
+
});
|
|
191
|
+
/**
|
|
192
|
+
* Microsoft Access database blob configuration.
|
|
193
|
+
*
|
|
194
|
+
* Configures opening a Microsoft Access database from binary data (Blob).
|
|
195
|
+
* Useful for opening databases fetched from URLs without writing to disk.
|
|
196
|
+
*/
|
|
197
|
+
export const AccessBlobConfigType = StructType({
|
|
198
|
+
/**
|
|
199
|
+
* Binary data containing the Access database (.mdb or .accdb).
|
|
200
|
+
*/
|
|
201
|
+
data: BlobType,
|
|
202
|
+
/**
|
|
203
|
+
* Password for encrypted databases.
|
|
204
|
+
* Optional, only required for password-protected databases.
|
|
205
|
+
*/
|
|
206
|
+
password: OptionType(StringType),
|
|
207
|
+
});
|
|
208
|
+
/**
|
|
209
|
+
* Access query options for filtering and pagination.
|
|
210
|
+
*/
|
|
211
|
+
export const AccessQueryOptionsType = StructType({
|
|
212
|
+
/**
|
|
213
|
+
* Table name to query (case-sensitive).
|
|
214
|
+
*/
|
|
215
|
+
table: StringType,
|
|
216
|
+
/**
|
|
217
|
+
* Specific columns to retrieve.
|
|
218
|
+
* Optional, defaults to all columns.
|
|
219
|
+
*/
|
|
220
|
+
columns: OptionType(ArrayType(StringType)),
|
|
221
|
+
/**
|
|
222
|
+
* Number of rows to skip.
|
|
223
|
+
* Optional, defaults to 0.
|
|
224
|
+
*/
|
|
225
|
+
rowOffset: OptionType(IntegerType),
|
|
226
|
+
/**
|
|
227
|
+
* Maximum number of rows to return.
|
|
228
|
+
* Optional, defaults to all rows.
|
|
229
|
+
*/
|
|
230
|
+
rowLimit: OptionType(IntegerType),
|
|
231
|
+
});
|
|
232
|
+
/**
|
|
233
|
+
* Access table list result.
|
|
234
|
+
*/
|
|
235
|
+
export const AccessTablesResultType = StructType({
|
|
236
|
+
/** Array of table names in the database */
|
|
237
|
+
tables: ArrayType(StringType),
|
|
238
|
+
});
|
|
175
239
|
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/sql/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;GAOG;AAEH,OAAO,EACH,UAAU,EACV,WAAW,EACX,UAAU,EACV,SAAS,EACT,QAAQ,EACR,UAAU,EACV,WAAW,EACX,WAAW,EACX,QAAQ,GACX,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,oDAAoD;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,UAAU,CAAC;IACvC;;;OAGG;IACH,IAAI,EAAE,UAAU;IAEhB;;;OAGG;IACH,QAAQ,EAAE,UAAU,CAAC,WAAW,CAAC;IAEjC;;;OAGG;IACH,MAAM,EAAE,UAAU,CAAC,WAAW,CAAC;CAClC,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,UAAU,CAAC;IACzC,+CAA+C;IAC/C,IAAI,EAAE,UAAU;IAEhB,8CAA8C;IAC9C,IAAI,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