orange-orm 5.2.4 → 5.3.1

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 (42) hide show
  1. package/README.md +10 -0
  2. package/deno.lock +75 -0
  3. package/dist/index.browser.mjs +116 -50
  4. package/dist/index.mjs +444 -69
  5. package/docs/changelog.md +5 -0
  6. package/other.db +0 -0
  7. package/package.json +2 -1
  8. package/src/bunSqlite/newTransaction.js +2 -1
  9. package/src/client/clientMap.js +2 -0
  10. package/src/client/createProviders.js +8 -0
  11. package/src/client/index.js +2 -1
  12. package/src/client/map.js +1 -0
  13. package/src/getManyDto.js +7 -5
  14. package/src/index.d.ts +1 -0
  15. package/src/index.js +11 -1
  16. package/src/map.d.ts +3 -0
  17. package/src/map2.d.ts +3 -0
  18. package/src/mariaDb/newDatabase.js +101 -0
  19. package/src/mariaDb/newPool.js +13 -0
  20. package/src/mariaDb/newTransaction.js +126 -0
  21. package/src/mssql/newTransaction.js +2 -1
  22. package/src/mySql/newTransaction.js +27 -1
  23. package/src/nodeSqlite/newTransaction.js +2 -1
  24. package/src/oracle/newTransaction.js +2 -1
  25. package/src/patchTable.js +1 -5
  26. package/src/pg/pool/newPgPool.js +1 -1
  27. package/src/sqlite3/newTransaction.js +2 -1
  28. package/src/table/column/bigint/newEncode.js +1 -1
  29. package/src/table/column/date/newEncode.js +1 -1
  30. package/src/table/column/dateWithTimeZone/newEncode.js +14 -10
  31. package/src/table/column/string/newLikeColumnArg.js +1 -1
  32. package/src/table/column.js +2 -7
  33. package/src/table/commands/delete/singleCommand/newSingleCommandCore.js +5 -1
  34. package/src/table/commands/newInsertAndForgetCommand.js +2 -2
  35. package/src/table/commands/newUpdateCommandCore.js +23 -3
  36. package/src/table/isJsonUpdateSupported.js +1 -1
  37. package/src/table/relatedTable/aggregate.js +4 -5
  38. package/src/table/relatedTable/where.js +4 -5
  39. package/src/table/relation/newManyCacheCore.js +1 -1
  40. package/src/table/resultToRows/dbRowToRow.js +38 -5
  41. package/src/tedious/newTransaction.js +2 -1
  42. package/src/table/query/extractLimitQuery.js +0 -23
package/README.md CHANGED
@@ -27,6 +27,7 @@ The ultimate Object Relational Mapper for Node.js, Bun and Deno, offering seamle
27
27
  | PGlite | ✅ | ✅ | ✅ | ✅ | ✅
28
28
  | MS SQL | ✅ | | ✅ | |
29
29
  | MySQL | ✅ | ✅ | ✅ ||
30
+ | MariaDB | ✅ | ✅ | ✅ ||
30
31
  | Oracle | ✅ | ✅ | ✅ | |
31
32
  | SAP ASE | ✅ | | | |
32
33
  | SQLite | ✅ | ✅ | ✅ | |
@@ -350,6 +351,15 @@ import map from './map';
350
351
  const db = map.mysql('mysql://test:test@mysql/test');
351
352
  ```
352
353
 
354
+ __MariaDB__
355
+ ```bash
356
+ $ npm install mysql2
357
+ ```
358
+ ```javascript
359
+ import map from './map';
360
+ const db = map.mariadb('mariadb://test:test@mariadb/test');
361
+ ```
362
+
353
363
 
354
364
  __MS SQL__
355
365
  ```bash
package/deno.lock ADDED
@@ -0,0 +1,75 @@
1
+ {
2
+ "version": "5",
3
+ "specifiers": {
4
+ "jsr:@std/assert@*": "1.0.19",
5
+ "jsr:@std/assert@^1.0.17": "1.0.19",
6
+ "jsr:@std/internal@^1.0.12": "1.0.12",
7
+ "jsr:@std/path@*": "1.1.4",
8
+ "jsr:@std/testing@*": "1.0.17"
9
+ },
10
+ "jsr": {
11
+ "@std/assert@1.0.19": {
12
+ "integrity": "eaada96ee120cb980bc47e040f82814d786fe8162ecc53c91d8df60b8755991e",
13
+ "dependencies": [
14
+ "jsr:@std/internal"
15
+ ]
16
+ },
17
+ "@std/internal@1.0.12": {
18
+ "integrity": "972a634fd5bc34b242024402972cd5143eac68d8dffaca5eaa4dba30ce17b027"
19
+ },
20
+ "@std/path@1.1.4": {
21
+ "integrity": "1d2d43f39efb1b42f0b1882a25486647cb851481862dc7313390b2bb044314b5",
22
+ "dependencies": [
23
+ "jsr:@std/internal"
24
+ ]
25
+ },
26
+ "@std/testing@1.0.17": {
27
+ "integrity": "87bdc2700fa98249d48a17cd72413352d3d3680dcfbdb64947fd0982d6bbf681",
28
+ "dependencies": [
29
+ "jsr:@std/assert@^1.0.17",
30
+ "jsr:@std/internal"
31
+ ]
32
+ }
33
+ },
34
+ "workspace": {
35
+ "packageJson": {
36
+ "dependencies": [
37
+ "npm:@cloudflare/workers-types@^4.20241106.0",
38
+ "npm:@electric-sql/pglite@0.3",
39
+ "npm:@hono/node-server@^1.14.4",
40
+ "npm:@lroal/on-change@^4.0.2",
41
+ "npm:@rollup/plugin-commonjs@^28.0.2",
42
+ "npm:@rollup/plugin-json@^6.1.0",
43
+ "npm:@rollup/plugin-node-resolve@13",
44
+ "npm:@tediousjs/connection-string@~0.4.1",
45
+ "npm:@types/express@^4.17.13",
46
+ "npm:@types/oracledb@^6.0.4",
47
+ "npm:@types/tedious@^4.0.14",
48
+ "npm:@typescript-eslint/eslint-plugin@^8.56.1",
49
+ "npm:@typescript-eslint/parser@^8.56.1",
50
+ "npm:@vitest/coverage-v8@^3.2.4",
51
+ "npm:ajv@^8.17.1",
52
+ "npm:axios@^1.6.2",
53
+ "npm:better-sqlite3@^12.6.2",
54
+ "npm:cors@^2.8.5",
55
+ "npm:eslint-plugin-jest@^29.15.0",
56
+ "npm:eslint@^8.57.0",
57
+ "npm:express@^4.18.2",
58
+ "npm:fast-json-patch@^3.1.1",
59
+ "npm:hono@^4.8.2",
60
+ "npm:msnodesqlv8@^4.1.0",
61
+ "npm:mysql2@^3.9.4",
62
+ "npm:oracledb@^6.3.0",
63
+ "npm:owasp-dependency-check@^0.0.21",
64
+ "npm:pg-query-stream@^3.3.2",
65
+ "npm:pg@^8.5.1",
66
+ "npm:rfdc@^1.2.0",
67
+ "npm:rollup@^2.52.7",
68
+ "npm:tedious@19",
69
+ "npm:typescript@^5.4.5",
70
+ "npm:uuid@^8.3.2 || 9 || 10 || ^11.1.0",
71
+ "npm:vitest@^3.2.4"
72
+ ]
73
+ }
74
+ }
75
+ }
@@ -3049,6 +3049,7 @@ function requireClientMap () {
3049
3049
  dbMap.mssql = throwDb;
3050
3050
  dbMap.mssqlNative = throwDb;
3051
3051
  dbMap.mysql = throwDb;
3052
+ dbMap.mariadb = throwDb;
3052
3053
  dbMap.sap = throwDb;
3053
3054
  dbMap.oracle = throwDb;
3054
3055
  dbMap.sqlite = throwDb;
@@ -3077,6 +3078,7 @@ function requireClientMap () {
3077
3078
  onFinal.mssql = () => index({ db: throwDb, providers: dbMap });
3078
3079
  onFinal.mssqlNative = () => index({ db: throwDb, providers: dbMap });
3079
3080
  onFinal.mysql = () => index({ db: throwDb, providers: dbMap });
3081
+ onFinal.mariadb = () => index({ db: throwDb, providers: dbMap });
3080
3082
  onFinal.sap = () => index({ db: throwDb, providers: dbMap });
3081
3083
  onFinal.oracle = () => index({ db: throwDb, providers: dbMap });
3082
3084
  onFinal.sqlite = () => index({ db: throwDb, providers: dbMap });
@@ -3234,6 +3236,7 @@ function requireClient () {
3234
3236
  client.oracle = onProvider.bind(null, 'oracle');
3235
3237
  client.http = onProvider.bind(null, 'http');//todo
3236
3238
  client.mysql = onProvider.bind(null, 'mysql');
3239
+ client.mariadb = onProvider.bind(null, 'mariadb');
3237
3240
  client.express = express;
3238
3241
  client.hono = hono;
3239
3242
  client.close = close;
@@ -4254,7 +4257,7 @@ function requireClient () {
4254
4257
  if (arguments[i][isColumnProxyKey])
4255
4258
  args[i] = { [columnRefKey]: arguments[i][columnPathKey] };
4256
4259
  else
4257
- args[i] = arguments[i](tableProxy(path.split('.').slice(0, -1).join('.')));
4260
+ args[i] = arguments[i](tableProxy());
4258
4261
  }
4259
4262
  else
4260
4263
  args[i] = arguments[i];
@@ -4972,7 +4975,7 @@ function requireNewLikeColumnArg () {
4972
4975
  var encodedSuffix = suffix ? column.encode(context, suffix) : null;
4973
4976
  var engine = getSessionSingleton(context, 'engine');
4974
4977
 
4975
- if (engine === 'mysql')
4978
+ if (engine === 'mysql' || engine === 'mariadb')
4976
4979
  return concatWithFunction(encodedPrefix, encodedArg, encodedSuffix);
4977
4980
  if (engine === 'mssql' || engine === 'mssqlNative')
4978
4981
  return concatWithOperator('+', encodedPrefix, encodedArg, encodedSuffix);
@@ -5596,7 +5599,7 @@ function requireNewEncode$5 () {
5596
5599
  value = purify(value);
5597
5600
  if (value == null) {
5598
5601
  if (column.dbNull === null)
5599
- ;
5602
+ return 'null';
5600
5603
  return '\'' + column.dbNull + '\'';
5601
5604
  }
5602
5605
  var encodeCore = getSessionSingleton(context, 'encodeDate') || encodeDate;
@@ -5708,39 +5711,44 @@ function requireNewEncode$4 () {
5708
5711
  hasRequiredNewEncode$4 = 1;
5709
5712
  var newPara = requireNewParameterized();
5710
5713
  var purify = requirePurify$3();
5714
+ var getSessionContext = requireGetSessionContext();
5715
+ var getSessionSingleton = requireGetSessionSingleton();
5711
5716
 
5712
5717
  function _new(column) {
5713
- var encode = function(_context, value) {
5718
+ var encode = function(context, value) {
5714
5719
  value = purify(value);
5715
5720
  if (value == null) {
5716
5721
  if (column.dbNull === null)
5717
5722
  return newPara('null');
5718
5723
  return newPara('\'' + column.dbNull + '\'');
5719
5724
  }
5720
- return newPara('?', [encodeDate(value)]);
5725
+ var ctx = getSessionContext(context);
5726
+ var encodeCore = ctx.encodeDateTz || ctx.encodeDate || encodeDate;
5727
+ return newPara('?', [encodeCore(value)]);
5721
5728
  };
5722
5729
 
5723
- encode.unsafe = function(_context, value) {
5730
+ encode.unsafe = function(context, value) {
5724
5731
  value = purify(value);
5725
5732
  if (value == null) {
5726
5733
  if (column.dbNull === null)
5727
5734
  return 'null';
5728
5735
  return '\'' + column.dbNull + '\'';
5729
5736
  }
5730
- return encodeDate(value);
5737
+ var encodeCore = getSessionSingleton(context, 'encodeDateTz') || getSessionSingleton(context, 'encodeDate') || encodeDate;
5738
+ return encodeCore(value);
5731
5739
  };
5732
5740
 
5733
- encode.direct = function(_context, value) {
5734
- return encodeDate(value);
5741
+ encode.direct = function(context, value) {
5742
+ var encodeCore = getSessionSingleton(context, 'encodeDateTz') || getSessionSingleton(context, 'encodeDate') || encodeDate;
5743
+ return encodeCore(value);
5735
5744
  };
5736
5745
 
5737
5746
  return encode;
5738
-
5739
-
5740
5747
  }
5748
+
5741
5749
  function encodeDate(date) {
5742
5750
  if (date.toISOString)
5743
- return truncate(date.toISOString(date));
5751
+ return truncate(date.toISOString());
5744
5752
  return truncate(date);
5745
5753
  }
5746
5754
 
@@ -5748,7 +5756,6 @@ function requireNewEncode$4 () {
5748
5756
  return date;
5749
5757
  }
5750
5758
 
5751
-
5752
5759
  newEncode$4 = _new;
5753
5760
  return newEncode$4;
5754
5761
  }
@@ -5936,7 +5943,7 @@ function requireNewEncode$2 () {
5936
5943
  value = purify(value);
5937
5944
  if (value == null) {
5938
5945
  if (column.dbNull === null)
5939
- ;
5946
+ return 'null';
5940
5947
  return '\'' + column.dbNull + '\'';
5941
5948
  }
5942
5949
  var encodeCore = getSessionSingleton(context, 'encodeBigint') || encodeBigint;
@@ -6285,18 +6292,13 @@ function requireColumn () {
6285
6292
  return c;
6286
6293
  };
6287
6294
 
6288
- c.date = function() {
6289
- requireDate()(column);
6290
- return c;
6291
- };
6292
-
6293
6295
  c.dateWithTimeZone = function() {
6294
6296
  requireDateWithTimeZone()(column);
6295
6297
  return c;
6296
6298
  };
6297
6299
 
6298
- c.numeric = function(optionalPrecision,optionalScale) {
6299
- requireNumeric()(column,optionalPrecision,optionalScale);
6300
+ c.numeric = function() {
6301
+ requireNumeric()(column);
6300
6302
  return c;
6301
6303
  };
6302
6304
 
@@ -7170,7 +7172,7 @@ function requireIsJsonUpdateSupported () {
7170
7172
  if (hasRequiredIsJsonUpdateSupported) return isJsonUpdateSupported_1;
7171
7173
  hasRequiredIsJsonUpdateSupported = 1;
7172
7174
  function isJsonUpdateSupported(engine) {
7173
- return engine === 'pg' || engine === 'mysql' || engine === 'sqlite' || engine === 'mssql' || engine === 'mssqlNative' || engine === 'oracle';
7175
+ return engine === 'pg' || engine === 'mysql' || engine === 'mariadb' || engine === 'sqlite' || engine === 'mssql' || engine === 'mssqlNative' || engine === 'oracle';
7174
7176
  }
7175
7177
 
7176
7178
  isJsonUpdateSupported_1 = isJsonUpdateSupported;
@@ -7269,7 +7271,7 @@ function requireNewUpdateCommandCore () {
7269
7271
  if (engine === 'pg') {
7270
7272
  command = command.append(separator + columnSql + ' IS NOT DISTINCT FROM ').append(encoded);
7271
7273
  }
7272
- else if (engine === 'mysql') {
7274
+ else if (engine === 'mysql' || engine === 'mariadb') {
7273
7275
  command = command.append(separator + columnSql + ' <=> ').append(encoded);
7274
7276
  }
7275
7277
  else if (engine === 'sqlite') {
@@ -7308,7 +7310,7 @@ function requireNewUpdateCommandCore () {
7308
7310
  if (engine === 'pg') {
7309
7311
  command = command.append(separator).append(columnExpr).append(' IS NOT DISTINCT FROM ').append(encoded);
7310
7312
  }
7311
- else if (engine === 'mysql') {
7313
+ else if (engine === 'mysql' || engine === 'mariadb') {
7312
7314
  command = command.append(separator).append(columnExpr).append(' <=> ').append(encoded);
7313
7315
  }
7314
7316
  else if (engine === 'sqlite') {
@@ -7369,6 +7371,11 @@ function requireNewUpdateCommandCore () {
7369
7371
  const sql = 'JSON_SET(' + expr.sql() + ', ' + jsonPath.sql + ', CAST(? AS JSON))';
7370
7372
  return newParameterized(sql, expr.parameters.concat(jsonPath.parameters, [jsonValue]));
7371
7373
  }
7374
+ if (engine === 'mariadb') {
7375
+ const jsonValue = JSON.stringify(value === undefined ? null : value);
7376
+ const sql = 'JSON_SET(' + expr.sql() + ', ' + jsonPath.sql + ', JSON_EXTRACT(?, \'$\'))';
7377
+ return newParameterized(sql, expr.parameters.concat(jsonPath.parameters, [jsonValue]));
7378
+ }
7372
7379
  if (engine === 'sqlite') {
7373
7380
  const jsonValue = JSON.stringify(value === undefined ? null : value);
7374
7381
  const sql = 'json_set(' + expr.sql() + ', ' + jsonPath.sql + ', json(?))';
@@ -7393,7 +7400,7 @@ function requireNewUpdateCommandCore () {
7393
7400
  const sql = expr.sql() + ' #- ' + pathLiteral;
7394
7401
  return newParameterized(sql, expr.parameters);
7395
7402
  }
7396
- if (engine === 'mysql') {
7403
+ if (engine === 'mysql' || engine === 'mariadb') {
7397
7404
  const sql = 'JSON_REMOVE(' + expr.sql() + ', ' + jsonPath.sql + ')';
7398
7405
  return newParameterized(sql, expr.parameters.concat(jsonPath.parameters));
7399
7406
  }
@@ -7421,6 +7428,12 @@ function requireNewUpdateCommandCore () {
7421
7428
  const sql = 'JSON_EXTRACT(' + columnSql + ', ' + jsonPath.sql + ')';
7422
7429
  return newParameterized(sql, jsonPath.parameters);
7423
7430
  }
7431
+ if (engine === 'mariadb') {
7432
+ const sql = isJsonObject(oldValue)
7433
+ ? 'JSON_EXTRACT(' + columnSql + ', ' + jsonPath.sql + ')'
7434
+ : 'JSON_UNQUOTE(JSON_EXTRACT(' + columnSql + ', ' + jsonPath.sql + '))';
7435
+ return newParameterized(sql, jsonPath.parameters);
7436
+ }
7424
7437
  if (engine === 'sqlite') {
7425
7438
  const sql = 'json_extract(' + columnSql + ', ' + jsonPath.sql + ')';
7426
7439
  return newParameterized(sql, jsonPath.parameters);
@@ -7496,6 +7509,15 @@ function requireNewUpdateCommandCore () {
7496
7509
  const jsonValue = JSON.stringify(value === undefined ? null : value);
7497
7510
  return newParameterized('CAST(? AS JSON)', [jsonValue]);
7498
7511
  }
7512
+ if (engine === 'mariadb') {
7513
+ if (isJsonObject(value)) {
7514
+ const jsonValue = JSON.stringify(value);
7515
+ return newParameterized('JSON_EXTRACT(?, \'$\')', [jsonValue]);
7516
+ }
7517
+ if (value === null || value === undefined)
7518
+ return newParameterized('null');
7519
+ return newParameterized('?', [String(value)]);
7520
+ }
7499
7521
  if (engine === 'sqlite') {
7500
7522
  if (isJsonObject(value)) {
7501
7523
  const jsonValue = JSON.stringify(value);
@@ -8195,7 +8217,7 @@ function requireNewSingleCommandCore () {
8195
8217
  if (engine === 'pg') {
8196
8218
  return newParameterized(columnSql + ' IS NOT DISTINCT FROM ' + encoded.sql(), encoded.parameters);
8197
8219
  }
8198
- if (engine === 'mysql') {
8220
+ if (engine === 'mysql' || engine === 'mariadb') {
8199
8221
  return newParameterized(columnSql + ' <=> ' + encoded.sql(), encoded.parameters);
8200
8222
  }
8201
8223
  if (engine === 'sqlite') {
@@ -8236,6 +8258,10 @@ function requireNewSingleCommandCore () {
8236
8258
  const jsonValue = JSON.stringify(value === undefined ? null : value);
8237
8259
  return newParameterized('CAST(? AS JSON)', [jsonValue]);
8238
8260
  }
8261
+ if (engine === 'mariadb') {
8262
+ const jsonValue = JSON.stringify(value === undefined ? null : value);
8263
+ return newParameterized('JSON_EXTRACT(?, \'$\')', [jsonValue]);
8264
+ }
8239
8265
  if (engine === 'sqlite') {
8240
8266
  if (isJsonObject(value)) {
8241
8267
  const jsonValue = JSON.stringify(value);
@@ -8868,6 +8894,10 @@ function requireDbRowToRow () {
8868
8894
  function dbRowToRow(context, span, dbRow) {
8869
8895
  var table = span.table;
8870
8896
  var row = decodeDbRow(context, span, table, dbRow);
8897
+ if (!hasPrimaryKey(row, table)) {
8898
+ skipNestedLegs(span, dbRow);
8899
+ return null;
8900
+ }
8871
8901
  var cache = table._cache;
8872
8902
  if (!cache.tryGet(context, row)) {
8873
8903
  var queryContext = span.queryContext;
@@ -8884,13 +8914,15 @@ function requireDbRowToRow () {
8884
8914
  var c = {};
8885
8915
 
8886
8916
  c.visitOne = function(leg) {
8887
- dbRowToRow(context, leg.span, dbRow);
8888
- leg.expand(row);
8917
+ let child = dbRowToRow(context, leg.span, dbRow);
8918
+ if (child)
8919
+ leg.expand(row);
8889
8920
  };
8890
8921
 
8891
8922
  c.visitJoin = function(leg) {
8892
- dbRowToRow(context, leg.span, dbRow);
8893
- leg.expand(row);
8923
+ let child = dbRowToRow(context, leg.span, dbRow);
8924
+ if (child)
8925
+ leg.expand(row);
8894
8926
  };
8895
8927
 
8896
8928
  c.visitMany = function() {
@@ -8905,6 +8937,33 @@ function requireDbRowToRow () {
8905
8937
  return row;
8906
8938
  }
8907
8939
 
8940
+ function hasPrimaryKey(row, table) {
8941
+ return table._primaryColumns.every((column) => {
8942
+ let value = row[column.alias];
8943
+ return value !== null && value !== undefined;
8944
+ });
8945
+ }
8946
+
8947
+ function skipNestedLegs(span, dbRow) {
8948
+ span.legs.forEach((leg) => {
8949
+ leg.accept({
8950
+ visitOne() {
8951
+ skipSpan(leg.span, dbRow);
8952
+ },
8953
+ visitJoin() {
8954
+ skipSpan(leg.span, dbRow);
8955
+ },
8956
+ visitMany() {
8957
+ }
8958
+ });
8959
+ });
8960
+ }
8961
+
8962
+ function skipSpan(span, dbRow) {
8963
+ decodeDbRow(undefined, span, span.table, dbRow);
8964
+ skipNestedLegs(span, dbRow);
8965
+ }
8966
+
8908
8967
  dbRowToRow_1 = dbRowToRow;
8909
8968
  return dbRowToRow_1;
8910
8969
  }
@@ -10246,10 +10305,9 @@ function requireWhere$1 () {
10246
10305
  function newWhere(_relations, _depth) {
10247
10306
 
10248
10307
  function where(context, fn) {
10249
- const includeMany = false;
10250
- let { relations, alias } = extract(includeMany, _relations);
10308
+ let { relations, alias } = extract(_relations);
10251
10309
  const table = relations[relations.length - 1].childTable;
10252
- if (!relations[0].isMany || includeMany)
10310
+ if (!relations[0].isMany)
10253
10311
  table._rootAlias = alias;
10254
10312
 
10255
10313
  try {
@@ -10265,11 +10323,11 @@ function requireWhere$1 () {
10265
10323
  }
10266
10324
  return where;
10267
10325
 
10268
- function extract(includeMany, relations) {
10326
+ function extract(relations) {
10269
10327
  let alias = relations[0].toLeg().table._dbName;
10270
10328
  let result = [];
10271
10329
  for (let i = 0; i < relations.length; i++) {
10272
- if (relations[i].isMany && !includeMany) {
10330
+ if (relations[i].isMany) {
10273
10331
  result = [relations[i]];
10274
10332
  alias = relations[i].toLeg().table._dbName;
10275
10333
  }
@@ -10296,10 +10354,9 @@ function requireAggregate$1 () {
10296
10354
  function newAggregate(_relations) {
10297
10355
 
10298
10356
  function aggregate(context, fn) {
10299
- const includeMany = false;
10300
- let { relations, alias } = extract(includeMany, _relations);
10357
+ let { relations, alias } = extract(_relations);
10301
10358
  const table = relations[relations.length - 1].childTable;
10302
- if (!relations[0].isMany || includeMany)
10359
+ if (!relations[0].isMany)
10303
10360
  table._rootAlias = alias;
10304
10361
 
10305
10362
  try {
@@ -10314,11 +10371,11 @@ function requireAggregate$1 () {
10314
10371
  }
10315
10372
  return aggregate;
10316
10373
 
10317
- function extract(includeMany, relations) {
10374
+ function extract(relations) {
10318
10375
  let alias = relations[0].toLeg().table._dbName;
10319
10376
  let result = [];
10320
10377
  for (let i = 0; i < relations.length; i++) {
10321
- if (relations[i].isMany && !includeMany) {
10378
+ if (relations[i].isMany) {
10322
10379
  result = [relations[i]];
10323
10380
  alias = relations[i].toLeg().table._dbName;
10324
10381
  }
@@ -10979,7 +11036,7 @@ function requireNewManyCacheCore () {
10979
11036
  }
10980
11037
  var rows = newArray();
10981
11038
  rows.push(childRow);
10982
- existing = cache.tryAdd(key, rows);
11039
+ cache.tryAdd(key, rows);
10983
11040
  }
10984
11041
 
10985
11042
  function newArray() {
@@ -11705,16 +11762,18 @@ function requireGetManyDto$1 () {
11705
11762
  outRow[column.alias] = column.decode(context, row[keys[j]]);
11706
11763
  }
11707
11764
 
11708
- for (let j = 0; j < aggregateKeys.length; j++) {
11709
- const key = aggregateKeys[j];
11710
- const parse = span.aggregates[key].column?.decode || ((context, arg) => Number.parseFloat(arg));
11711
- outRow[key] = parse(context, row[keys[j + columnsLength]]);
11765
+ if (outRow) {
11766
+ for (let j = 0; j < aggregateKeys.length; j++) {
11767
+ const key = aggregateKeys[j];
11768
+ const parse = span.aggregates[key].column?.decode || ((context, arg) => Number.parseFloat(arg));
11769
+ outRow[key] = parse(context, row[keys[j + columnsLength]]);
11770
+ }
11712
11771
  }
11713
11772
 
11714
11773
  outRows[i] = outRow;
11715
11774
  if (updateParent)
11716
11775
  updateParent(outRow, i);
11717
- if (shouldCreateMap) {
11776
+ if (shouldCreateMap && outRow) {
11718
11777
  fkIds[i] = getIds(outRow);
11719
11778
  addToMap(rowsMap, fkIds[i], outRow);
11720
11779
  }
@@ -12905,7 +12964,6 @@ function requirePatchTable () {
12905
12964
  let result;
12906
12965
  for (let i = 0; i < relation.columns.length; i++) {
12907
12966
  let p = relation.columns[i].alias;
12908
- row[p];
12909
12967
  result = await remove({ path: ['dummy', p], oldValue: (oldValue || {})[p], op, options: options }, table, row) || result;
12910
12968
  }
12911
12969
  return result || {};
@@ -12918,8 +12976,7 @@ function requirePatchTable () {
12918
12976
  let p = relation.columns[i].alias;
12919
12977
  let childKey = relation.childTable._primaryColumns[i].alias;
12920
12978
  if (path[1] === childKey) {
12921
- row[p];
12922
- result = await remove({ path: ['dummy', p], oldValue: (oldValue || {})[p], op, options: options }, table, row) || result;
12979
+ result = await remove({ path: ['dummy', p], oldValue: oldValue[p], op, options: options }, table, row) || result;
12923
12980
  break;
12924
12981
  }
12925
12982
  }
@@ -13509,6 +13566,11 @@ function requireCreateProviders () {
13509
13566
  return createPool.bind(null, 'mysql');
13510
13567
  }
13511
13568
  });
13569
+ Object.defineProperty(dbMap, 'mariadb', {
13570
+ get: function() {
13571
+ return createPool.bind(null, 'mariadb');
13572
+ }
13573
+ });
13512
13574
  Object.defineProperty(dbMap, 'sap', {
13513
13575
  get: function() {
13514
13576
  return createPool.bind(null, 'sap');
@@ -13573,6 +13635,9 @@ function requireCreateProviders () {
13573
13635
  get mysql() {
13574
13636
  return createPool.bind(null, 'mysql');
13575
13637
  },
13638
+ get mariadb() {
13639
+ return createPool.bind(null, 'mariadb');
13640
+ },
13576
13641
  get sap() {
13577
13642
  return createPool.bind(null, 'sap');
13578
13643
  },
@@ -13668,6 +13733,7 @@ function requireMap () {
13668
13733
  context.mssql = connect.bind(null, 'mssql');
13669
13734
  context.mssqlNative = connect.bind(null, 'mssqlNative');
13670
13735
  context.mysql = connect.bind(null, 'mysql');
13736
+ context.mariadb = connect.bind(null, 'mariadb');
13671
13737
  context.sap = connect.bind(null, 'sap');
13672
13738
  context.oracle = connect.bind(null, 'oracle');
13673
13739
  context.sqlite = connect.bind(null, 'sqlite');
@@ -16915,7 +16981,7 @@ function requireNewPgPool () {
16915
16981
  if (!pg) {
16916
16982
  pg = await import('pg');
16917
16983
  pg = pg.default || pg;
16918
- let types = pg.types || pg.types;
16984
+ let types = pg.types;
16919
16985
  types.setTypeParser(1700, function(val) {
16920
16986
  return parseFloat(val);
16921
16987
  });