@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.
Files changed (115) hide show
  1. package/README.md +38 -0
  2. package/dist/compression/gzip.d.ts +108 -0
  3. package/dist/compression/gzip.d.ts.map +1 -0
  4. package/dist/compression/gzip.js +153 -0
  5. package/dist/compression/gzip.js.map +1 -0
  6. package/dist/compression/index.d.ts +308 -0
  7. package/dist/compression/index.d.ts.map +1 -0
  8. package/dist/compression/index.js +289 -0
  9. package/dist/compression/index.js.map +1 -0
  10. package/dist/compression/tar.d.ts +115 -0
  11. package/dist/compression/tar.d.ts.map +1 -0
  12. package/dist/compression/tar.js +254 -0
  13. package/dist/compression/tar.js.map +1 -0
  14. package/dist/compression/types.d.ts +124 -0
  15. package/dist/compression/types.d.ts.map +1 -0
  16. package/dist/compression/types.js +106 -0
  17. package/dist/compression/types.js.map +1 -0
  18. package/dist/compression/zip.d.ts +121 -0
  19. package/dist/compression/zip.d.ts.map +1 -0
  20. package/dist/compression/zip.js +200 -0
  21. package/dist/compression/zip.js.map +1 -0
  22. package/dist/connection/index.d.ts +78 -0
  23. package/dist/connection/index.d.ts.map +1 -0
  24. package/dist/connection/index.js +134 -0
  25. package/dist/connection/index.js.map +1 -0
  26. package/dist/format/index.d.ts +421 -0
  27. package/dist/format/index.d.ts.map +1 -0
  28. package/dist/format/index.js +326 -0
  29. package/dist/format/index.js.map +1 -0
  30. package/dist/format/types.d.ts +176 -0
  31. package/dist/format/types.d.ts.map +1 -0
  32. package/dist/format/types.js +122 -0
  33. package/dist/format/types.js.map +1 -0
  34. package/dist/format/xlsx.d.ts +178 -0
  35. package/dist/format/xlsx.d.ts.map +1 -0
  36. package/dist/format/xlsx.js +313 -0
  37. package/dist/format/xlsx.js.map +1 -0
  38. package/dist/format/xml.d.ts +302 -0
  39. package/dist/format/xml.d.ts.map +1 -0
  40. package/dist/format/xml.js +602 -0
  41. package/dist/format/xml.js.map +1 -0
  42. package/dist/index.d.ts +25 -0
  43. package/dist/index.d.ts.map +1 -0
  44. package/dist/index.js +32 -0
  45. package/dist/index.js.map +1 -0
  46. package/dist/nosql/index.d.ts +503 -0
  47. package/dist/nosql/index.d.ts.map +1 -0
  48. package/dist/nosql/index.js +483 -0
  49. package/dist/nosql/index.js.map +1 -0
  50. package/dist/nosql/mongodb.d.ts +306 -0
  51. package/dist/nosql/mongodb.d.ts.map +1 -0
  52. package/dist/nosql/mongodb.js +552 -0
  53. package/dist/nosql/mongodb.js.map +1 -0
  54. package/dist/nosql/redis.d.ts +268 -0
  55. package/dist/nosql/redis.d.ts.map +1 -0
  56. package/dist/nosql/redis.js +371 -0
  57. package/dist/nosql/redis.js.map +1 -0
  58. package/dist/nosql/types.d.ts +70 -0
  59. package/dist/nosql/types.d.ts.map +1 -0
  60. package/dist/nosql/types.js +79 -0
  61. package/dist/nosql/types.js.map +1 -0
  62. package/dist/platform.d.ts +12 -0
  63. package/dist/platform.d.ts.map +1 -0
  64. package/dist/platform.js +51 -0
  65. package/dist/platform.js.map +1 -0
  66. package/dist/sql/index.d.ts +777 -0
  67. package/dist/sql/index.d.ts.map +1 -0
  68. package/dist/sql/index.js +515 -0
  69. package/dist/sql/index.js.map +1 -0
  70. package/dist/sql/mysql.d.ts +238 -0
  71. package/dist/sql/mysql.d.ts.map +1 -0
  72. package/dist/sql/mysql.js +396 -0
  73. package/dist/sql/mysql.js.map +1 -0
  74. package/dist/sql/postgres.d.ts +237 -0
  75. package/dist/sql/postgres.d.ts.map +1 -0
  76. package/dist/sql/postgres.js +381 -0
  77. package/dist/sql/postgres.js.map +1 -0
  78. package/dist/sql/sqlite.d.ts +217 -0
  79. package/dist/sql/sqlite.d.ts.map +1 -0
  80. package/dist/sql/sqlite.js +366 -0
  81. package/dist/sql/sqlite.js.map +1 -0
  82. package/dist/sql/types.d.ts +205 -0
  83. package/dist/sql/types.d.ts.map +1 -0
  84. package/dist/sql/types.js +175 -0
  85. package/dist/sql/types.js.map +1 -0
  86. package/dist/storage/index.d.ts +304 -0
  87. package/dist/storage/index.d.ts.map +1 -0
  88. package/dist/storage/index.js +234 -0
  89. package/dist/storage/index.js.map +1 -0
  90. package/dist/storage/s3.d.ts +373 -0
  91. package/dist/storage/s3.d.ts.map +1 -0
  92. package/dist/storage/s3.js +502 -0
  93. package/dist/storage/s3.js.map +1 -0
  94. package/dist/storage/types.d.ts +117 -0
  95. package/dist/storage/types.d.ts.map +1 -0
  96. package/dist/storage/types.js +94 -0
  97. package/dist/storage/types.js.map +1 -0
  98. package/dist/transfer/ftp.d.ts +333 -0
  99. package/dist/transfer/ftp.d.ts.map +1 -0
  100. package/dist/transfer/ftp.js +437 -0
  101. package/dist/transfer/ftp.js.map +1 -0
  102. package/dist/transfer/index.d.ts +456 -0
  103. package/dist/transfer/index.d.ts.map +1 -0
  104. package/dist/transfer/index.js +414 -0
  105. package/dist/transfer/index.js.map +1 -0
  106. package/dist/transfer/sftp.d.ts +333 -0
  107. package/dist/transfer/sftp.d.ts.map +1 -0
  108. package/dist/transfer/sftp.js +436 -0
  109. package/dist/transfer/sftp.js.map +1 -0
  110. package/dist/transfer/types.d.ts +108 -0
  111. package/dist/transfer/types.d.ts.map +1 -0
  112. package/dist/transfer/types.js +110 -0
  113. package/dist/transfer/types.js.map +1 -0
  114. package/dist/tsconfig.tsbuildinfo +1 -0
  115. package/package.json +17 -9
@@ -0,0 +1,238 @@
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
+ * MySQL platform functions for East Node IO.
7
+ *
8
+ * Provides MySQL database operations for East programs, including
9
+ * connection pooling and parameterized query execution.
10
+ *
11
+ * @packageDocumentation
12
+ */
13
+ import { BlobType, BooleanType, DateTimeType, FloatType, IntegerType, NullType, StringType as EastStringType } from "@elaraai/east";
14
+ import type { PlatformFunction } from "@elaraai/east/internal";
15
+ import { StringType } from './types.js';
16
+ /**
17
+ * Connects to a MySQL database.
18
+ *
19
+ * Creates a connection pool to a MySQL database and returns an
20
+ * opaque handle for use in queries. The connection pool is managed
21
+ * automatically and supports concurrent queries.
22
+ *
23
+ * This is a platform function for the East language, enabling MySQL database
24
+ * operations in East programs running on Node.js.
25
+ *
26
+ * @param config - MySQL connection configuration
27
+ * @returns Connection handle (opaque string)
28
+ *
29
+ * @throws {EastError} When connection fails due to:
30
+ * - Network errors (location: "mysql_connect")
31
+ * - Authentication failures (location: "mysql_connect")
32
+ * - Invalid configuration (location: "mysql_connect")
33
+ * - Database does not exist (location: "mysql_connect")
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * import { East, StringType, IntegerType } from "@elaraai/east";
38
+ * import { SQL } from "@elaraai/east-node-io";
39
+ *
40
+ * const getUserById = East.function([IntegerType], NullType, ($, userId) => {
41
+ * const config = $.let({
42
+ * host: "localhost",
43
+ * port: 3306n,
44
+ * database: "myapp",
45
+ * user: "root",
46
+ * password: "secret",
47
+ * ssl: variant('none', null),
48
+ * maxConnections: variant('none', null),
49
+ * });
50
+ *
51
+ * const conn = $.let(SQL.MySQL.connect(config));
52
+ * $(SQL.MySQL.query(
53
+ * conn,
54
+ * "SELECT name FROM users WHERE id = ?",
55
+ * [variant('Integer', userId)]
56
+ * ));
57
+ * $(SQL.MySQL.close(conn));
58
+ * $.return(null);
59
+ * });
60
+ *
61
+ * const compiled = East.compileAsync(getUserById.toIR(), SQL.MySQL.Implementation);
62
+ * await compiled(42n);
63
+ * ```
64
+ *
65
+ * @remarks
66
+ * - Uses connection pooling for better performance
67
+ * - Default pool size is 10 connections
68
+ * - All queries are asynchronous
69
+ * - Connections are automatically returned to the pool after queries
70
+ */
71
+ export declare const mysql_connect: import("@elaraai/east").AsyncPlatformDefinition<[import("@elaraai/east").StructType<{
72
+ host: EastStringType;
73
+ port: IntegerType;
74
+ database: EastStringType;
75
+ user: EastStringType;
76
+ password: EastStringType;
77
+ ssl: import("@elaraai/east").OptionType<BooleanType>;
78
+ maxConnections: import("@elaraai/east").OptionType<IntegerType>;
79
+ }>], EastStringType>;
80
+ /**
81
+ * Executes a SQL query with parameterized values.
82
+ *
83
+ * Runs a SQL query against a MySQL database with parameter binding for
84
+ * safe, injection-free queries. Returns rows as dictionaries mapping column
85
+ * names to typed values, along with metadata about affected rows.
86
+ *
87
+ * This is a platform function for the East language, enabling SQL database
88
+ * operations in East programs running on Node.js.
89
+ *
90
+ * @param handle - Connection handle from mysql_connect()
91
+ * @param sql - SQL query string with ? placeholders
92
+ * @param params - Query parameters as SqlParameterType array
93
+ * @returns Query results with rows and metadata
94
+ *
95
+ * @throws {EastError} When query fails due to:
96
+ * - Invalid connection handle (location: "mysql_query")
97
+ * - SQL syntax errors (location: "mysql_query")
98
+ * - Connection timeout (location: "mysql_query")
99
+ * - Parameter type mismatch (location: "mysql_query")
100
+ * - Constraint violations (location: "mysql_query")
101
+ *
102
+ * @example
103
+ * ```ts
104
+ * import { East, IntegerType, NullType, variant } from "@elaraai/east";
105
+ * import { SQL } from "@elaraai/east-node-io";
106
+ *
107
+ * const insertUser = East.function([IntegerType], NullType, ($, userId) => {
108
+ * const config = $.let({
109
+ * host: "localhost",
110
+ * port: 3306n,
111
+ * database: "myapp",
112
+ * user: "root",
113
+ * password: "secret",
114
+ * ssl: variant('none', null),
115
+ * maxConnections: variant('none', null),
116
+ * });
117
+ * const conn = $.let(SQL.MySQL.connect(config));
118
+ * const result = $.let(SQL.MySQL.query(
119
+ * conn,
120
+ * "INSERT INTO users (name, email) VALUES (?, ?)",
121
+ * [variant('String', "Alice"), variant('String', "alice@example.com")]
122
+ * ));
123
+ * $(SQL.MySQL.close(conn));
124
+ * return $.return(null);
125
+ * });
126
+ *
127
+ * const compiled = East.compileAsync(insertUser.toIR(), SQL.MySQL.Implementation);
128
+ * await compiled(42n);
129
+ * ```
130
+ *
131
+ * @remarks
132
+ * - Uses ? for parameter placeholders (not $1, $2 like PostgreSQL)
133
+ * - NULL values map to {tag: "null", value: {}}
134
+ * - All queries are asynchronous
135
+ * - Parameters prevent SQL injection attacks
136
+ * - Returns lastInsertId for INSERT operations
137
+ */
138
+ export declare const mysql_query: import("@elaraai/east").AsyncPlatformDefinition<[EastStringType, EastStringType, import("@elaraai/east").ArrayType<import("@elaraai/east").VariantType<{
139
+ Null: NullType;
140
+ Boolean: BooleanType;
141
+ Integer: IntegerType;
142
+ Float: FloatType;
143
+ String: StringType;
144
+ DateTime: DateTimeType;
145
+ Blob: BlobType;
146
+ }>>], import("@elaraai/east").VariantType<{
147
+ select: import("@elaraai/east").StructType<{
148
+ rows: import("@elaraai/east").ArrayType<import("@elaraai/east").DictType<EastStringType, import("@elaraai/east").VariantType<{
149
+ Null: NullType;
150
+ Boolean: BooleanType;
151
+ Integer: IntegerType;
152
+ Float: FloatType;
153
+ String: StringType;
154
+ DateTime: DateTimeType;
155
+ Blob: BlobType;
156
+ }>>>;
157
+ }>;
158
+ insert: import("@elaraai/east").StructType<{
159
+ rowsAffected: IntegerType;
160
+ lastInsertId: import("@elaraai/east").OptionType<IntegerType>;
161
+ }>;
162
+ update: import("@elaraai/east").StructType<{
163
+ rowsAffected: IntegerType;
164
+ }>;
165
+ delete: import("@elaraai/east").StructType<{
166
+ rowsAffected: IntegerType;
167
+ }>;
168
+ }>>;
169
+ /**
170
+ * Closes a MySQL connection pool.
171
+ *
172
+ * Closes the connection pool and releases all resources.
173
+ * All active connections are terminated gracefully.
174
+ *
175
+ * @param handle - Connection handle from mysql_connect()
176
+ *
177
+ * @throws {EastError} When handle is invalid (location: "mysql_close")
178
+ *
179
+ * @example
180
+ * ```ts
181
+ * import { East, NullType, variant } from "@elaraai/east";
182
+ * import { SQL } from "@elaraai/east-node-io";
183
+ *
184
+ * const cleanup = East.function([], NullType, $ => {
185
+ * const config = $.let({
186
+ * host: "localhost",
187
+ * port: 3306n,
188
+ * database: "myapp",
189
+ * user: "root",
190
+ * password: "secret",
191
+ * ssl: variant('none', null),
192
+ * maxConnections: variant('none', null),
193
+ * });
194
+ * const conn = $.let(SQL.MySQL.connect(config));
195
+ * // ... do work ...
196
+ * $(SQL.MySQL.close(conn));
197
+ * return $.return(null);
198
+ * });
199
+ *
200
+ * const compiled = East.compileAsync(cleanup.toIR(), SQL.MySQL.Implementation);
201
+ * await compiled();
202
+ * ```
203
+ */
204
+ export declare const mysql_close: import("@elaraai/east").AsyncPlatformDefinition<[EastStringType], NullType>;
205
+ /**
206
+ * Closes all MySQL connections.
207
+ *
208
+ * Closes all active MySQL connection pools and releases all resources.
209
+ * Useful for test cleanup to ensure all connections are closed.
210
+ *
211
+ * @returns Null on success
212
+ *
213
+ * @example
214
+ * ```ts
215
+ * import { East, NullType } from "@elaraai/east";
216
+ * import { SQL } from "@elaraai/east-node-io";
217
+ *
218
+ * const cleanupAll = East.function([], NullType, $ => {
219
+ * // ... test code that may have left connections open ...
220
+ * $(SQL.MySQL.closeAll());
221
+ * return $.return(null);
222
+ * });
223
+ *
224
+ * const compiled = East.compileAsync(cleanupAll.toIR(), SQL.MySQL.Implementation);
225
+ * await compiled();
226
+ * ```
227
+ *
228
+ * @internal
229
+ */
230
+ export declare const mysql_close_all: import("@elaraai/east").AsyncPlatformDefinition<[], NullType>;
231
+ /**
232
+ * Node.js implementation of MySQL platform functions.
233
+ *
234
+ * Provides the runtime implementations for MySQL operations.
235
+ * Pass this to East.compileAsync() to enable MySQL functionality.
236
+ */
237
+ export declare const MySqlImpl: PlatformFunction[];
238
+ //# sourceMappingURL=mysql.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mysql.d.ts","sourceRoot":"","sources":["../../src/sql/mysql.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;GAOG;AAEH,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAQ,SAAS,EAAE,WAAW,EAAoB,QAAQ,EAAa,UAAU,IAAI,cAAc,EAAW,MAAM,eAAe,CAAC;AAEhL,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAI/D,OAAO,EAKH,UAAU,EAEb,MAAM,YAAY,CAAC;AA+BpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AACH,eAAO,MAAM,aAAa;;;;;;;;oBAA+E,CAAC;AAE1G;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA0G,CAAC;AAEnI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,eAAO,MAAM,WAAW,6EAAsE,CAAC;AAE/F;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,eAAe,+DAAsD,CAAC;AAuFnF;;;;;GAKG;AACH,eAAO,MAAM,SAAS,EAAE,gBAAgB,EA4IvC,CAAC"}
@@ -0,0 +1,396 @@
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
+ * MySQL platform functions for East Node IO.
7
+ *
8
+ * Provides MySQL database operations for East programs, including
9
+ * connection pooling and parameterized query execution.
10
+ *
11
+ * @packageDocumentation
12
+ */
13
+ import { BlobType, BooleanType, DateTimeType, East, FloatType, IntegerType, isValueOf, match, NullType, SortedMap, StringType as EastStringType, variant } from "@elaraai/east";
14
+ import { EastError } from "@elaraai/east/internal";
15
+ import mysql from 'mysql2/promise';
16
+ import { createHandle, getConnection, closeHandle, closeAllHandles } from '../connection/index.js';
17
+ import { MySqlConfigType, ConnectionHandleType, SqlParametersType, SqlResultType, StringType, SqlParameterType } from './types.js';
18
+ /**
19
+ * Connects to a MySQL database.
20
+ *
21
+ * Creates a connection pool to a MySQL database and returns an
22
+ * opaque handle for use in queries. The connection pool is managed
23
+ * automatically and supports concurrent queries.
24
+ *
25
+ * This is a platform function for the East language, enabling MySQL database
26
+ * operations in East programs running on Node.js.
27
+ *
28
+ * @param config - MySQL connection configuration
29
+ * @returns Connection handle (opaque string)
30
+ *
31
+ * @throws {EastError} When connection fails due to:
32
+ * - Network errors (location: "mysql_connect")
33
+ * - Authentication failures (location: "mysql_connect")
34
+ * - Invalid configuration (location: "mysql_connect")
35
+ * - Database does not exist (location: "mysql_connect")
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * import { East, StringType, IntegerType } from "@elaraai/east";
40
+ * import { SQL } from "@elaraai/east-node-io";
41
+ *
42
+ * const getUserById = East.function([IntegerType], NullType, ($, userId) => {
43
+ * const config = $.let({
44
+ * host: "localhost",
45
+ * port: 3306n,
46
+ * database: "myapp",
47
+ * user: "root",
48
+ * password: "secret",
49
+ * ssl: variant('none', null),
50
+ * maxConnections: variant('none', null),
51
+ * });
52
+ *
53
+ * const conn = $.let(SQL.MySQL.connect(config));
54
+ * $(SQL.MySQL.query(
55
+ * conn,
56
+ * "SELECT name FROM users WHERE id = ?",
57
+ * [variant('Integer', userId)]
58
+ * ));
59
+ * $(SQL.MySQL.close(conn));
60
+ * $.return(null);
61
+ * });
62
+ *
63
+ * const compiled = East.compileAsync(getUserById.toIR(), SQL.MySQL.Implementation);
64
+ * await compiled(42n);
65
+ * ```
66
+ *
67
+ * @remarks
68
+ * - Uses connection pooling for better performance
69
+ * - Default pool size is 10 connections
70
+ * - All queries are asynchronous
71
+ * - Connections are automatically returned to the pool after queries
72
+ */
73
+ export const mysql_connect = East.asyncPlatform("mysql_connect", [MySqlConfigType], ConnectionHandleType);
74
+ /**
75
+ * Executes a SQL query with parameterized values.
76
+ *
77
+ * Runs a SQL query against a MySQL database with parameter binding for
78
+ * safe, injection-free queries. Returns rows as dictionaries mapping column
79
+ * names to typed values, along with metadata about affected rows.
80
+ *
81
+ * This is a platform function for the East language, enabling SQL database
82
+ * operations in East programs running on Node.js.
83
+ *
84
+ * @param handle - Connection handle from mysql_connect()
85
+ * @param sql - SQL query string with ? placeholders
86
+ * @param params - Query parameters as SqlParameterType array
87
+ * @returns Query results with rows and metadata
88
+ *
89
+ * @throws {EastError} When query fails due to:
90
+ * - Invalid connection handle (location: "mysql_query")
91
+ * - SQL syntax errors (location: "mysql_query")
92
+ * - Connection timeout (location: "mysql_query")
93
+ * - Parameter type mismatch (location: "mysql_query")
94
+ * - Constraint violations (location: "mysql_query")
95
+ *
96
+ * @example
97
+ * ```ts
98
+ * import { East, IntegerType, NullType, variant } from "@elaraai/east";
99
+ * import { SQL } from "@elaraai/east-node-io";
100
+ *
101
+ * const insertUser = East.function([IntegerType], NullType, ($, userId) => {
102
+ * const config = $.let({
103
+ * host: "localhost",
104
+ * port: 3306n,
105
+ * database: "myapp",
106
+ * user: "root",
107
+ * password: "secret",
108
+ * ssl: variant('none', null),
109
+ * maxConnections: variant('none', null),
110
+ * });
111
+ * const conn = $.let(SQL.MySQL.connect(config));
112
+ * const result = $.let(SQL.MySQL.query(
113
+ * conn,
114
+ * "INSERT INTO users (name, email) VALUES (?, ?)",
115
+ * [variant('String', "Alice"), variant('String', "alice@example.com")]
116
+ * ));
117
+ * $(SQL.MySQL.close(conn));
118
+ * return $.return(null);
119
+ * });
120
+ *
121
+ * const compiled = East.compileAsync(insertUser.toIR(), SQL.MySQL.Implementation);
122
+ * await compiled(42n);
123
+ * ```
124
+ *
125
+ * @remarks
126
+ * - Uses ? for parameter placeholders (not $1, $2 like PostgreSQL)
127
+ * - NULL values map to {tag: "null", value: {}}
128
+ * - All queries are asynchronous
129
+ * - Parameters prevent SQL injection attacks
130
+ * - Returns lastInsertId for INSERT operations
131
+ */
132
+ export const mysql_query = East.asyncPlatform("mysql_query", [ConnectionHandleType, StringType, SqlParametersType], SqlResultType);
133
+ /**
134
+ * Closes a MySQL connection pool.
135
+ *
136
+ * Closes the connection pool and releases all resources.
137
+ * All active connections are terminated gracefully.
138
+ *
139
+ * @param handle - Connection handle from mysql_connect()
140
+ *
141
+ * @throws {EastError} When handle is invalid (location: "mysql_close")
142
+ *
143
+ * @example
144
+ * ```ts
145
+ * import { East, NullType, variant } from "@elaraai/east";
146
+ * import { SQL } from "@elaraai/east-node-io";
147
+ *
148
+ * const cleanup = East.function([], NullType, $ => {
149
+ * const config = $.let({
150
+ * host: "localhost",
151
+ * port: 3306n,
152
+ * database: "myapp",
153
+ * user: "root",
154
+ * password: "secret",
155
+ * ssl: variant('none', null),
156
+ * maxConnections: variant('none', null),
157
+ * });
158
+ * const conn = $.let(SQL.MySQL.connect(config));
159
+ * // ... do work ...
160
+ * $(SQL.MySQL.close(conn));
161
+ * return $.return(null);
162
+ * });
163
+ *
164
+ * const compiled = East.compileAsync(cleanup.toIR(), SQL.MySQL.Implementation);
165
+ * await compiled();
166
+ * ```
167
+ */
168
+ export const mysql_close = East.asyncPlatform("mysql_close", [ConnectionHandleType], NullType);
169
+ /**
170
+ * Closes all MySQL connections.
171
+ *
172
+ * Closes all active MySQL connection pools and releases all resources.
173
+ * Useful for test cleanup to ensure all connections are closed.
174
+ *
175
+ * @returns Null on success
176
+ *
177
+ * @example
178
+ * ```ts
179
+ * import { East, NullType } from "@elaraai/east";
180
+ * import { SQL } from "@elaraai/east-node-io";
181
+ *
182
+ * const cleanupAll = East.function([], NullType, $ => {
183
+ * // ... test code that may have left connections open ...
184
+ * $(SQL.MySQL.closeAll());
185
+ * return $.return(null);
186
+ * });
187
+ *
188
+ * const compiled = East.compileAsync(cleanupAll.toIR(), SQL.MySQL.Implementation);
189
+ * await compiled();
190
+ * ```
191
+ *
192
+ * @internal
193
+ */
194
+ export const mysql_close_all = East.asyncPlatform("mysql_close_all", [], NullType);
195
+ /**
196
+ * Converts East SQL parameter to native JavaScript value.
197
+ *
198
+ * @param param - East SQL parameter variant
199
+ * @returns JavaScript value for MySQL binding
200
+ * @internal
201
+ */
202
+ function convertParamToNative(param) {
203
+ return match(param, {
204
+ String: (value) => value,
205
+ Integer: (value) => Number(value), // MySQL client handles numbers
206
+ Float: (value) => value,
207
+ Boolean: (value) => value,
208
+ Null: (value) => value,
209
+ Blob: (value) => Buffer.from(value), // Convert Uint8Array to Buffer
210
+ DateTime: (value) => value, // Pass Date object directly to MySQL
211
+ });
212
+ }
213
+ /**
214
+ * Converts native JavaScript value to East SQL parameter variant.
215
+ *
216
+ * @param value - Native JavaScript value from MySQL
217
+ * @param fieldType - MySQL field type code from field metadata
218
+ * @returns East SQL parameter variant
219
+ * @internal
220
+ */
221
+ function convertNativeToParam(value, fieldType) {
222
+ if (isValueOf(value, NullType)) {
223
+ return variant('Null', null);
224
+ }
225
+ else if (((fieldType === null) &&
226
+ isValueOf(value, BooleanType)) || ((fieldType === 1 || fieldType === 16) && // TINY (as boolean), BIT
227
+ (isValueOf(value, BooleanType) || isValueOf(value, FloatType)))) {
228
+ return variant('Boolean', value ? true : false);
229
+ }
230
+ else if (((fieldType === null) &&
231
+ isValueOf(value, IntegerType)) || ((fieldType === 2 || fieldType === 3 || fieldType === 8 || fieldType === 9 || fieldType === 13) && // SHORT, LONG, LONGLONG, INT24, YEAR (not TINY=1)
232
+ (isValueOf(value, IntegerType) || isValueOf(value, FloatType)))) {
233
+ return variant('Integer', BigInt(value));
234
+ }
235
+ else if ((fieldType === 0 || fieldType === 4 || fieldType === 5 || fieldType === 246 || fieldType === null) && // DECIMAL, FLOAT, DOUBLE, NEWDECIMAL
236
+ isValueOf(value, FloatType)) {
237
+ return variant('Float', value);
238
+ }
239
+ else if ((fieldType === 253 || fieldType === 254 || fieldType === null) && // VARCHAR, STRING (CHAR)
240
+ isValueOf(value, EastStringType)) {
241
+ return variant('String', value);
242
+ }
243
+ else if ((fieldType === 252 || fieldType === null) && // BLOB or TEXT (252 is used for both!)
244
+ isValueOf(value, EastStringType) // Check string first for TEXT columns
245
+ ) {
246
+ return variant('String', value);
247
+ }
248
+ else if (((fieldType === null) &&
249
+ isValueOf(value, DateTimeType)) || ((fieldType === 7 || fieldType === 10 || fieldType === 11 || fieldType === 12) && // TIMESTAMP, DATE, TIME, DATETIME
250
+ isValueOf(value, DateTimeType))) {
251
+ return variant('DateTime', value);
252
+ }
253
+ else if ((fieldType === 252 || fieldType === null) && // BLOB or TEXT (check Blob after String)
254
+ isValueOf(value, BlobType)) {
255
+ return variant('Blob', value);
256
+ }
257
+ else {
258
+ return variant('Null', null);
259
+ }
260
+ }
261
+ /**
262
+ * Node.js implementation of MySQL platform functions.
263
+ *
264
+ * Provides the runtime implementations for MySQL operations.
265
+ * Pass this to East.compileAsync() to enable MySQL functionality.
266
+ */
267
+ export const MySqlImpl = [
268
+ mysql_connect.implement(async (config) => {
269
+ try {
270
+ const poolConfig = {
271
+ host: config.host,
272
+ port: Number(config.port),
273
+ database: config.database,
274
+ user: config.user,
275
+ password: config.password,
276
+ };
277
+ // Handle optional SSL
278
+ if (config.ssl?.type === 'some' && config.ssl.value) {
279
+ poolConfig.ssl = {};
280
+ }
281
+ // Handle optional max connections
282
+ if (config.maxConnections?.type === 'some') {
283
+ poolConfig.connectionLimit = Number(config.maxConnections.value);
284
+ }
285
+ const pool = mysql.createPool(poolConfig);
286
+ // Test the connection
287
+ const connection = await pool.getConnection();
288
+ connection.release();
289
+ return createHandle(pool, async () => {
290
+ await pool.end();
291
+ });
292
+ }
293
+ catch (err) {
294
+ throw new EastError(`MySQL connection failed: ${err.message}`, {
295
+ location: { filename: "mysql_connect", line: 0n, column: 0n },
296
+ cause: err
297
+ });
298
+ }
299
+ }),
300
+ mysql_query.implement(async (handle, sql, params) => {
301
+ try {
302
+ const pool = getConnection(handle);
303
+ // Convert East parameters to native values
304
+ const nativeParams = params.map(convertParamToNative);
305
+ // Execute the query
306
+ const [rows, fields] = await pool.query(sql, nativeParams);
307
+ // For SELECT queries, fields will contain column metadata and rows will be an array
308
+ // For DML queries (INSERT/UPDATE/DELETE), result will be ResultSetHeader
309
+ // Check using the fields array: SELECT has fields, DML doesn't
310
+ if (Array.isArray(rows) && fields.length > 0) {
311
+ // Get column metadata for type information
312
+ const fieldTypeMap = new SortedMap();
313
+ for (const field of fields) {
314
+ fieldTypeMap.set(field.name, field.type);
315
+ }
316
+ // SELECT query - rows is array of RowDataPacket
317
+ const eastRows = rows.map((row) => {
318
+ const eastRow = new SortedMap();
319
+ for (const [key, value] of Object.entries(row)) {
320
+ const fieldType = fieldTypeMap.get(key) || null;
321
+ eastRow.set(key, convertNativeToParam(value, fieldType));
322
+ }
323
+ return eastRow;
324
+ });
325
+ return variant('select', { rows: eastRows });
326
+ }
327
+ else if (!Array.isArray(rows) && typeof rows === 'object' && rows !== null) {
328
+ // DML query - ResultSetHeader
329
+ const result = rows;
330
+ // Validate ResultSetHeader structure
331
+ if (typeof result.affectedRows !== 'number') {
332
+ throw new EastError('MySQL ResultSetHeader missing affectedRows', {
333
+ location: { filename: "mysql_query", line: 0n, column: 0n }
334
+ });
335
+ }
336
+ // Determine query type from SQL
337
+ const trimmedSql = sql.trim().toUpperCase();
338
+ if (trimmedSql.startsWith('INSERT')) {
339
+ return variant('insert', {
340
+ rowsAffected: BigInt(result.affectedRows),
341
+ lastInsertId: result.insertId && result.insertId > 0
342
+ ? variant('some', BigInt(result.insertId))
343
+ : variant('none', null)
344
+ });
345
+ }
346
+ else if (trimmedSql.startsWith('UPDATE')) {
347
+ return variant('update', {
348
+ rowsAffected: BigInt(result.affectedRows)
349
+ });
350
+ }
351
+ else if (trimmedSql.startsWith('DELETE')) {
352
+ return variant('delete', {
353
+ rowsAffected: BigInt(result.affectedRows)
354
+ });
355
+ }
356
+ else {
357
+ // Other mutating queries (CREATE, DROP, ALTER, etc.) - treat as update
358
+ return variant('update', {
359
+ rowsAffected: BigInt(result.affectedRows)
360
+ });
361
+ }
362
+ }
363
+ else {
364
+ // Unexpected result type
365
+ throw new EastError(`Unexpected result type from MySQL query: ${typeof rows}`, {
366
+ location: { filename: "mysql_query", line: 0n, column: 0n }
367
+ });
368
+ }
369
+ }
370
+ catch (err) {
371
+ throw new EastError(`MySQL query failed: ${err.message}`, {
372
+ location: { filename: "mysql_query", line: 0n, column: 0n },
373
+ cause: err
374
+ });
375
+ }
376
+ }),
377
+ mysql_close.implement(async (handle) => {
378
+ try {
379
+ const pool = getConnection(handle);
380
+ await pool.end();
381
+ closeHandle(handle);
382
+ return null;
383
+ }
384
+ catch (err) {
385
+ throw new EastError(`MySQL close failed: ${err.message}`, {
386
+ location: { filename: "mysql_close", line: 0n, column: 0n },
387
+ cause: err
388
+ });
389
+ }
390
+ }),
391
+ mysql_close_all.implement(async () => {
392
+ await closeAllHandles();
393
+ return null;
394
+ }),
395
+ ];
396
+ //# sourceMappingURL=mysql.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mysql.js","sourceRoot":"","sources":["../../src/sql/mysql.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;GAOG;AAEH,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,IAAI,cAAc,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAGhL,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,KAAK,MAAM,gBAAgB,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACnG,OAAO,EACH,eAAe,EACf,oBAAoB,EACpB,iBAAiB,EACjB,aAAa,EACb,UAAU,EACV,gBAAgB,EACnB,MAAM,YAAY,CAAC;AA+BpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC,eAAe,EAAE,CAAC,eAAe,CAAC,EAAE,oBAAoB,CAAC,CAAC;AAE1G;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyD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