orange-orm 5.3.2 → 5.3.4

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/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
+ }
@@ -7288,6 +7288,14 @@ function requireNewUpdateCommandCore () {
7288
7288
  else if (engine === 'sqlite') {
7289
7289
  command = command.append(separator + columnSql + ' IS ').append(encoded);
7290
7290
  }
7291
+ else if (engine === 'sap' && column.tsType === 'DateColumn') {
7292
+ if (encoded.sql() === 'null') {
7293
+ command = command.append(separator + columnSql + ' IS NULL');
7294
+ }
7295
+ else {
7296
+ command = command.append(separator + column.formatOut(context) + '=').append(encoded);
7297
+ }
7298
+ }
7291
7299
  else if (engine === 'sap' && column.tsType === 'JSONColumn') {
7292
7300
  if (encoded.sql() === 'null') {
7293
7301
  command = command.append(separator + columnSql + ' IS NULL');
@@ -8234,6 +8242,11 @@ function requireNewSingleCommandCore () {
8234
8242
  if (engine === 'sqlite') {
8235
8243
  return newParameterized(columnSql + ' IS ' + encoded.sql(), encoded.parameters);
8236
8244
  }
8245
+ if (engine === 'sap' && column.tsType === 'DateColumn') {
8246
+ if (encoded.sql() === 'null')
8247
+ return newParameterized(columnSql + ' IS NULL');
8248
+ return newParameterized(column.formatOut(context) + '=' + encoded.sql(), encoded.parameters);
8249
+ }
8237
8250
  if (engine === 'sap' && column.tsType === 'JSONColumn') {
8238
8251
  if (encoded.sql() === 'null')
8239
8252
  return newParameterized(columnSql + ' IS NULL');
@@ -11830,9 +11843,6 @@ function requireGetManyDto$1 () {
11830
11843
 
11831
11844
  async function decodeManyRelations(context, strategy, span) {
11832
11845
  const maxParameters = getSessionSingleton(context, 'maxParameters');
11833
- const maxRows = maxParameters
11834
- ? maxParameters * span.table._primaryColumns.length
11835
- : undefined;
11836
11846
 
11837
11847
  const promises = [];
11838
11848
  const c = {};
@@ -11852,6 +11862,10 @@ function requireGetManyDto$1 () {
11852
11862
  const name = leg.name;
11853
11863
  const table = span.table;
11854
11864
  const relation = table._relations[name];
11865
+ const parametersPerRow = relation.joinRelation.columns.length;
11866
+ const maxRows = maxParameters
11867
+ ? Math.max(1, Math.floor((maxParameters - 1) / parametersPerRow))
11868
+ : undefined;
11855
11869
  const rowsMap = span._rowsMap;
11856
11870
 
11857
11871
  const extractKey = createExtractKey(leg);
package/dist/index.mjs CHANGED
@@ -7289,6 +7289,14 @@ function requireNewUpdateCommandCore () {
7289
7289
  else if (engine === 'sqlite') {
7290
7290
  command = command.append(separator + columnSql + ' IS ').append(encoded);
7291
7291
  }
7292
+ else if (engine === 'sap' && column.tsType === 'DateColumn') {
7293
+ if (encoded.sql() === 'null') {
7294
+ command = command.append(separator + columnSql + ' IS NULL');
7295
+ }
7296
+ else {
7297
+ command = command.append(separator + column.formatOut(context) + '=').append(encoded);
7298
+ }
7299
+ }
7292
7300
  else if (engine === 'sap' && column.tsType === 'JSONColumn') {
7293
7301
  if (encoded.sql() === 'null') {
7294
7302
  command = command.append(separator + columnSql + ' IS NULL');
@@ -8235,6 +8243,11 @@ function requireNewSingleCommandCore () {
8235
8243
  if (engine === 'sqlite') {
8236
8244
  return newParameterized(columnSql + ' IS ' + encoded.sql(), encoded.parameters);
8237
8245
  }
8246
+ if (engine === 'sap' && column.tsType === 'DateColumn') {
8247
+ if (encoded.sql() === 'null')
8248
+ return newParameterized(columnSql + ' IS NULL');
8249
+ return newParameterized(column.formatOut(context) + '=' + encoded.sql(), encoded.parameters);
8250
+ }
8238
8251
  if (engine === 'sap' && column.tsType === 'JSONColumn') {
8239
8252
  if (encoded.sql() === 'null')
8240
8253
  return newParameterized(columnSql + ' IS NULL');
@@ -11831,9 +11844,6 @@ function requireGetManyDto$1 () {
11831
11844
 
11832
11845
  async function decodeManyRelations(context, strategy, span) {
11833
11846
  const maxParameters = getSessionSingleton(context, 'maxParameters');
11834
- const maxRows = maxParameters
11835
- ? maxParameters * span.table._primaryColumns.length
11836
- : undefined;
11837
11847
 
11838
11848
  const promises = [];
11839
11849
  const c = {};
@@ -11853,6 +11863,10 @@ function requireGetManyDto$1 () {
11853
11863
  const name = leg.name;
11854
11864
  const table = span.table;
11855
11865
  const relation = table._relations[name];
11866
+ const parametersPerRow = relation.joinRelation.columns.length;
11867
+ const maxRows = maxParameters
11868
+ ? Math.max(1, Math.floor((maxParameters - 1) / parametersPerRow))
11869
+ : undefined;
11856
11870
  const rowsMap = span._rowsMap;
11857
11871
 
11858
11872
  const extractKey = createExtractKey(leg);
@@ -20915,7 +20929,7 @@ function requireNewTransaction$3 () {
20915
20929
  rdb.pool = pool;
20916
20930
  }
20917
20931
  rdb.engine = 'mssqlNative';
20918
- rdb.maxParameters = 2100;
20932
+ rdb.maxParameters = 2098;
20919
20933
  rdb.encodeBoolean = encodeBoolean;
20920
20934
  rdb.decodeJSON = decodeJSON;
20921
20935
  rdb.encodeJSON = JSON.stringify;
@@ -21678,7 +21692,7 @@ function requireNewTransaction$2 () {
21678
21692
  rdb.pool = pool;
21679
21693
  }
21680
21694
  rdb.engine = 'mssql';
21681
- rdb.maxParameters = 2100;
21695
+ rdb.maxParameters = 2098;
21682
21696
  rdb.encodeBoolean = encodeBoolean;
21683
21697
  rdb.decodeJSON = decodeJSON;
21684
21698
  rdb.encodeJSON = JSON.stringify;
package/docs/changelog.md CHANGED
@@ -1,4 +1,8 @@
1
1
  ## Changelog
2
+ __5.3.4__
3
+ SAP ASE: Fix optimistic concurrency for `date()` columns when datetime values are read back without millisecond precision.
4
+ __5.3.3__
5
+ MSSQL: Set `maxParameters` to `2098` because `tedious` adds extra parameters, so using `2100` can still exceed SQL Server's limit during `getMany`/`hasMany` loading.
2
6
  __5.3.2__
3
7
  Removed uuid dependency.
4
8
  Upgraded to tedious@19.2.1 to reduce transitive audit vulnerabilities in the MSSQL driver chain.
package/other.db ADDED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orange-orm",
3
- "version": "5.3.2",
3
+ "version": "5.3.4",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/getManyDto.js CHANGED
@@ -184,9 +184,6 @@ async function decode(context, strategy, span, rows, keys = rows.length > 0 ? Ob
184
184
 
185
185
  async function decodeManyRelations(context, strategy, span) {
186
186
  const maxParameters = getSessionSingleton(context, 'maxParameters');
187
- const maxRows = maxParameters
188
- ? maxParameters * span.table._primaryColumns.length
189
- : undefined;
190
187
 
191
188
  const promises = [];
192
189
  const c = {};
@@ -206,6 +203,10 @@ async function decodeManyRelations(context, strategy, span) {
206
203
  const name = leg.name;
207
204
  const table = span.table;
208
205
  const relation = table._relations[name];
206
+ const parametersPerRow = relation.joinRelation.columns.length;
207
+ const maxRows = maxParameters
208
+ ? Math.max(1, Math.floor((maxParameters - 1) / parametersPerRow))
209
+ : undefined;
209
210
  const rowsMap = span._rowsMap;
210
211
 
211
212
  const extractKey = createExtractKey(leg);
@@ -19,7 +19,7 @@ function newResolveTransaction(domain, pool, { readonly = false } = {}) {
19
19
  rdb.pool = pool;
20
20
  }
21
21
  rdb.engine = 'mssqlNative';
22
- rdb.maxParameters = 2100;
22
+ rdb.maxParameters = 2098;
23
23
  rdb.encodeBoolean = encodeBoolean;
24
24
  rdb.decodeJSON = decodeJSON;
25
25
  rdb.encodeJSON = JSON.stringify;
@@ -66,6 +66,11 @@ function newSingleCommandCore(context, table, filter, alias, concurrencyState) {
66
66
  if (engine === 'sqlite') {
67
67
  return newParameterized(columnSql + ' IS ' + encoded.sql(), encoded.parameters);
68
68
  }
69
+ if (engine === 'sap' && column.tsType === 'DateColumn') {
70
+ if (encoded.sql() === 'null')
71
+ return newParameterized(columnSql + ' IS NULL');
72
+ return newParameterized(column.formatOut(context) + '=' + encoded.sql(), encoded.parameters);
73
+ }
69
74
  if (engine === 'sap' && column.tsType === 'JSONColumn') {
70
75
  if (encoded.sql() === 'null')
71
76
  return newParameterized(columnSql + ' IS NULL');
@@ -90,6 +90,14 @@ function newUpdateCommandCore(context, table, columns, row, concurrencyState) {
90
90
  else if (engine === 'sqlite') {
91
91
  command = command.append(separator + columnSql + ' IS ').append(encoded);
92
92
  }
93
+ else if (engine === 'sap' && column.tsType === 'DateColumn') {
94
+ if (encoded.sql() === 'null') {
95
+ command = command.append(separator + columnSql + ' IS NULL');
96
+ }
97
+ else {
98
+ command = command.append(separator + column.formatOut(context) + '=').append(encoded);
99
+ }
100
+ }
93
101
  else if (engine === 'sap' && column.tsType === 'JSONColumn') {
94
102
  if (encoded.sql() === 'null') {
95
103
  command = command.append(separator + columnSql + ' IS NULL');
@@ -19,7 +19,7 @@ function newResolveTransaction(domain, pool, { readonly = false } = {}) {
19
19
  rdb.pool = pool;
20
20
  }
21
21
  rdb.engine = 'mssql';
22
- rdb.maxParameters = 2100;
22
+ rdb.maxParameters = 2098;
23
23
  rdb.encodeBoolean = encodeBoolean;
24
24
  rdb.decodeJSON = decodeJSON;
25
25
  rdb.encodeJSON = JSON.stringify;