orange-orm 5.3.1 → 5.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,6 @@ void !function() {
2
2
  typeof self === 'undefined' && typeof global === 'object'
3
3
  ? global.self = global : null;
4
4
  }();import * as fastJsonPatch from 'fast-json-patch';
5
- import * as uuid from 'uuid';
6
5
  import * as axios from 'axios';
7
6
  import * as _default from 'rfdc/default';
8
7
  import * as ajv from 'ajv';
@@ -973,7 +972,7 @@ function requireHostHono () {
973
972
  return hostHono_1;
974
973
  }
975
974
 
976
- var require$$0$3 = /*@__PURE__*/getDefaultExportFromNamespaceIfPresent(fastJsonPatch);
975
+ var require$$0$2 = /*@__PURE__*/getDefaultExportFromNamespaceIfPresent(fastJsonPatch);
977
976
 
978
977
  var dateToISOString_1;
979
978
  var hasRequiredDateToISOString;
@@ -1035,7 +1034,19 @@ function requireStringify () {
1035
1034
  return stringify_1;
1036
1035
  }
1037
1036
 
1038
- var require$$0$2 = /*@__PURE__*/getDefaultExportFromNamespaceIfPresent(uuid);
1037
+ var newMemoryId;
1038
+ var hasRequiredNewMemoryId;
1039
+
1040
+ function requireNewMemoryId () {
1041
+ if (hasRequiredNewMemoryId) return newMemoryId;
1042
+ hasRequiredNewMemoryId = 1;
1043
+ let nextId = 1;
1044
+
1045
+ newMemoryId = function newMemoryId() {
1046
+ return `tmp${nextId++}`;
1047
+ };
1048
+ return newMemoryId;
1049
+ }
1039
1050
 
1040
1051
  var createPatch;
1041
1052
  var hasRequiredCreatePatch;
@@ -1043,10 +1054,10 @@ var hasRequiredCreatePatch;
1043
1054
  function requireCreatePatch () {
1044
1055
  if (hasRequiredCreatePatch) return createPatch;
1045
1056
  hasRequiredCreatePatch = 1;
1046
- const jsonpatch = require$$0$3;
1057
+ const jsonpatch = require$$0$2;
1047
1058
  let dateToIsoString = requireDateToISOString();
1048
1059
  let stringify = requireStringify();
1049
- let { v4: uuid } = require$$0$2;
1060
+ let newMemoryId = requireNewMemoryId();
1050
1061
 
1051
1062
  createPatch = function createPatch(original, dto, options) {
1052
1063
  let subject = toCompareObject({ d: original }, options, true);
@@ -1155,7 +1166,7 @@ function requireCreatePatch () {
1155
1166
 
1156
1167
  function negotiateTempKey(value) {
1157
1168
  if (value === undefined)
1158
- return `~${uuid()}`;
1169
+ return `~${newMemoryId()}`;
1159
1170
  else
1160
1171
  return value;
1161
1172
  }
@@ -2972,7 +2983,7 @@ function requireToKeyPositionMap () {
2972
2983
  if (hasRequiredToKeyPositionMap) return toKeyPositionMap_1;
2973
2984
  hasRequiredToKeyPositionMap = 1;
2974
2985
  const stringify = requireStringify();
2975
- const { v4: uuid } = require$$0$2;
2986
+ const newMemoryId = requireNewMemoryId();
2976
2987
 
2977
2988
  function toKeyPositionMap(rows, options) {
2978
2989
  return rows.reduce((map, element, i) => {
@@ -2995,7 +3006,7 @@ function requireToKeyPositionMap () {
2995
3006
 
2996
3007
  function negotiateTempKey(value) {
2997
3008
  if (value === undefined)
2998
- return `~${uuid()}`;
3009
+ return `~${newMemoryId()}`;
2999
3010
  else
3000
3011
  return value;
3001
3012
  }
@@ -11073,8 +11084,7 @@ var hasRequiredNewId;
11073
11084
  function requireNewId () {
11074
11085
  if (hasRequiredNewId) return newId;
11075
11086
  hasRequiredNewId = 1;
11076
- const { v4 : uuid} = require$$0$2;
11077
- newId = uuid;
11087
+ newId = requireNewMemoryId();
11078
11088
  return newId;
11079
11089
  }
11080
11090
 
@@ -11820,9 +11830,6 @@ function requireGetManyDto$1 () {
11820
11830
 
11821
11831
  async function decodeManyRelations(context, strategy, span) {
11822
11832
  const maxParameters = getSessionSingleton(context, 'maxParameters');
11823
- const maxRows = maxParameters
11824
- ? maxParameters * span.table._primaryColumns.length
11825
- : undefined;
11826
11833
 
11827
11834
  const promises = [];
11828
11835
  const c = {};
@@ -11842,6 +11849,10 @@ function requireGetManyDto$1 () {
11842
11849
  const name = leg.name;
11843
11850
  const table = span.table;
11844
11851
  const relation = table._relations[name];
11852
+ const parametersPerRow = relation.joinRelation.columns.length;
11853
+ const maxRows = maxParameters
11854
+ ? Math.max(1, Math.floor((maxParameters - 1) / parametersPerRow))
11855
+ : undefined;
11845
11856
  const rowsMap = span._rowsMap;
11846
11857
 
11847
11858
  const extractKey = createExtractKey(leg);
@@ -12460,7 +12471,7 @@ var hasRequiredApplyPatch;
12460
12471
  function requireApplyPatch () {
12461
12472
  if (hasRequiredApplyPatch) return applyPatch_1;
12462
12473
  hasRequiredApplyPatch = 1;
12463
- const fastjson = require$$0$3;
12474
+ const fastjson = require$$0$2;
12464
12475
  let fromCompareObject = requireFromCompareObject();
12465
12476
  let toCompareObject = requireToCompareObject();
12466
12477
  let getSessionSingleton = requireGetSessionSingleton();
package/dist/index.mjs CHANGED
@@ -2,7 +2,6 @@ void !function() {
2
2
  typeof self === 'undefined' && typeof global === 'object'
3
3
  ? global.self = global : null;
4
4
  }();import * as fastJsonPatch from 'fast-json-patch';
5
- import * as uuid from 'uuid';
6
5
  import * as axios from 'axios';
7
6
  import * as _default from 'rfdc/default';
8
7
  import * as ajv from 'ajv';
@@ -974,7 +973,7 @@ function requireHostHono () {
974
973
  return hostHono_1;
975
974
  }
976
975
 
977
- var require$$0$4 = /*@__PURE__*/getDefaultExportFromNamespaceIfPresent(fastJsonPatch);
976
+ var require$$0$3 = /*@__PURE__*/getDefaultExportFromNamespaceIfPresent(fastJsonPatch);
978
977
 
979
978
  var dateToISOString_1;
980
979
  var hasRequiredDateToISOString;
@@ -1036,7 +1035,19 @@ function requireStringify () {
1036
1035
  return stringify_1;
1037
1036
  }
1038
1037
 
1039
- var require$$0$3 = /*@__PURE__*/getDefaultExportFromNamespaceIfPresent(uuid);
1038
+ var newMemoryId;
1039
+ var hasRequiredNewMemoryId;
1040
+
1041
+ function requireNewMemoryId () {
1042
+ if (hasRequiredNewMemoryId) return newMemoryId;
1043
+ hasRequiredNewMemoryId = 1;
1044
+ let nextId = 1;
1045
+
1046
+ newMemoryId = function newMemoryId() {
1047
+ return `tmp${nextId++}`;
1048
+ };
1049
+ return newMemoryId;
1050
+ }
1040
1051
 
1041
1052
  var createPatch;
1042
1053
  var hasRequiredCreatePatch;
@@ -1044,10 +1055,10 @@ var hasRequiredCreatePatch;
1044
1055
  function requireCreatePatch () {
1045
1056
  if (hasRequiredCreatePatch) return createPatch;
1046
1057
  hasRequiredCreatePatch = 1;
1047
- const jsonpatch = require$$0$4;
1058
+ const jsonpatch = require$$0$3;
1048
1059
  let dateToIsoString = requireDateToISOString();
1049
1060
  let stringify = requireStringify();
1050
- let { v4: uuid } = require$$0$3;
1061
+ let newMemoryId = requireNewMemoryId();
1051
1062
 
1052
1063
  createPatch = function createPatch(original, dto, options) {
1053
1064
  let subject = toCompareObject({ d: original }, options, true);
@@ -1156,7 +1167,7 @@ function requireCreatePatch () {
1156
1167
 
1157
1168
  function negotiateTempKey(value) {
1158
1169
  if (value === undefined)
1159
- return `~${uuid()}`;
1170
+ return `~${newMemoryId()}`;
1160
1171
  else
1161
1172
  return value;
1162
1173
  }
@@ -2973,7 +2984,7 @@ function requireToKeyPositionMap () {
2973
2984
  if (hasRequiredToKeyPositionMap) return toKeyPositionMap_1;
2974
2985
  hasRequiredToKeyPositionMap = 1;
2975
2986
  const stringify = requireStringify();
2976
- const { v4: uuid } = require$$0$3;
2987
+ const newMemoryId = requireNewMemoryId();
2977
2988
 
2978
2989
  function toKeyPositionMap(rows, options) {
2979
2990
  return rows.reduce((map, element, i) => {
@@ -2996,7 +3007,7 @@ function requireToKeyPositionMap () {
2996
3007
 
2997
3008
  function negotiateTempKey(value) {
2998
3009
  if (value === undefined)
2999
- return `~${uuid()}`;
3010
+ return `~${newMemoryId()}`;
3000
3011
  else
3001
3012
  return value;
3002
3013
  }
@@ -11074,8 +11085,7 @@ var hasRequiredNewId;
11074
11085
  function requireNewId () {
11075
11086
  if (hasRequiredNewId) return newId;
11076
11087
  hasRequiredNewId = 1;
11077
- const { v4 : uuid} = require$$0$3;
11078
- newId = uuid;
11088
+ newId = requireNewMemoryId();
11079
11089
  return newId;
11080
11090
  }
11081
11091
 
@@ -11821,9 +11831,6 @@ function requireGetManyDto$1 () {
11821
11831
 
11822
11832
  async function decodeManyRelations(context, strategy, span) {
11823
11833
  const maxParameters = getSessionSingleton(context, 'maxParameters');
11824
- const maxRows = maxParameters
11825
- ? maxParameters * span.table._primaryColumns.length
11826
- : undefined;
11827
11834
 
11828
11835
  const promises = [];
11829
11836
  const c = {};
@@ -11843,6 +11850,10 @@ function requireGetManyDto$1 () {
11843
11850
  const name = leg.name;
11844
11851
  const table = span.table;
11845
11852
  const relation = table._relations[name];
11853
+ const parametersPerRow = relation.joinRelation.columns.length;
11854
+ const maxRows = maxParameters
11855
+ ? Math.max(1, Math.floor((maxParameters - 1) / parametersPerRow))
11856
+ : undefined;
11846
11857
  const rowsMap = span._rowsMap;
11847
11858
 
11848
11859
  const extractKey = createExtractKey(leg);
@@ -12461,7 +12472,7 @@ var hasRequiredApplyPatch;
12461
12472
  function requireApplyPatch () {
12462
12473
  if (hasRequiredApplyPatch) return applyPatch_1;
12463
12474
  hasRequiredApplyPatch = 1;
12464
- const fastjson = require$$0$4;
12475
+ const fastjson = require$$0$3;
12465
12476
  let fromCompareObject = requireFromCompareObject();
12466
12477
  let toCompareObject = requireToCompareObject();
12467
12478
  let getSessionSingleton = requireGetSessionSingleton();
@@ -20905,7 +20916,7 @@ function requireNewTransaction$3 () {
20905
20916
  rdb.pool = pool;
20906
20917
  }
20907
20918
  rdb.engine = 'mssqlNative';
20908
- rdb.maxParameters = 2100;
20919
+ rdb.maxParameters = 2098;
20909
20920
  rdb.encodeBoolean = encodeBoolean;
20910
20921
  rdb.decodeJSON = decodeJSON;
20911
20922
  rdb.encodeJSON = JSON.stringify;
@@ -21668,7 +21679,7 @@ function requireNewTransaction$2 () {
21668
21679
  rdb.pool = pool;
21669
21680
  }
21670
21681
  rdb.engine = 'mssql';
21671
- rdb.maxParameters = 2100;
21682
+ rdb.maxParameters = 2098;
21672
21683
  rdb.encodeBoolean = encodeBoolean;
21673
21684
  rdb.decodeJSON = decodeJSON;
21674
21685
  rdb.encodeJSON = JSON.stringify;
package/docs/changelog.md CHANGED
@@ -1,4 +1,9 @@
1
1
  ## Changelog
2
+ __5.3.3__
3
+ MSSQL: Set `maxParameters` to `2098` because `tedious` adds extra parameters, so using `2100` can still exceed SQL Server's limit during `getMany`/`hasMany` loading.
4
+ __5.3.2__
5
+ Removed uuid dependency.
6
+ Upgraded to tedious@19.2.1 to reduce transitive audit vulnerabilities in the MSSQL driver chain.
2
7
  __5.3.1__
3
8
  Fixes crashes in getById/getMany when a missing relation has nested hasMany/hasOne/references in the strategy. [#177](https://github.com/alfateam/orange-orm/issues/177)
4
9
  Added max parameter chunking for getManyDto hasMany subqueries on MSSQL, SQLite and Oracle.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orange-orm",
3
- "version": "5.3.1",
3
+ "version": "5.3.3",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -81,8 +81,7 @@
81
81
  "ajv": "^8.17.1",
82
82
  "axios": "^1.6.2",
83
83
  "fast-json-patch": "^3.1.1",
84
- "rfdc": "^1.2.0",
85
- "uuid": "^8.3.2 || ^9.0.0 || ^10.0.0 || ^11.1.0"
84
+ "rfdc": "^1.2.0"
86
85
  },
87
86
  "peerDependencies": {
88
87
  "@electric-sql/pglite": "^0.3.0",
@@ -92,7 +91,7 @@
92
91
  "oracledb": "^6.3.0",
93
92
  "pg": "^8.5.1",
94
93
  "pg-query-stream": "^3.3.2",
95
- "tedious": "^15.1.2 || ^16.0.0 || ^18.1.0 || || ^19.0.0"
94
+ "tedious": "^15.1.2 || ^16.0.0 || ^18.1.0 || ^19.0.0"
96
95
  },
97
96
  "peerDependenciesMeta": {
98
97
  "pg": {
@@ -145,7 +144,7 @@
145
144
  "pg": "^8.5.1",
146
145
  "pg-query-stream": "^3.3.2",
147
146
  "rollup": "^2.52.7",
148
- "tedious": "^19.0.0",
147
+ "tedious": "^19.2.1",
149
148
  "typescript": "^5.4.5",
150
149
  "vitest": "^3.2.4"
151
150
  },
@@ -1,7 +1,7 @@
1
1
  const jsonpatch = require('fast-json-patch');
2
2
  let dateToIsoString = require('../dateToISOString');
3
3
  let stringify = require('./stringify');
4
- let { v4: uuid } = require('uuid');
4
+ let newMemoryId = require('../newMemoryId');
5
5
 
6
6
  module.exports = function createPatch(original, dto, options) {
7
7
  let subject = toCompareObject({ d: original }, options, true);
@@ -110,7 +110,7 @@ module.exports = function createPatch(original, dto, options) {
110
110
 
111
111
  function negotiateTempKey(value) {
112
112
  if (value === undefined)
113
- return `~${uuid()}`;
113
+ return `~${newMemoryId()}`;
114
114
  else
115
115
  return value;
116
116
  }
@@ -1,5 +1,5 @@
1
1
  const stringify = require('./stringify');
2
- const { v4: uuid } = require('uuid');
2
+ const newMemoryId = require('../newMemoryId');
3
3
 
4
4
  function toKeyPositionMap(rows, options) {
5
5
  return rows.reduce((map, element, i) => {
@@ -22,9 +22,9 @@ function toKeyPositionMap(rows, options) {
22
22
 
23
23
  function negotiateTempKey(value) {
24
24
  if (value === undefined)
25
- return `~${uuid()}`;
25
+ return `~${newMemoryId()}`;
26
26
  else
27
27
  return value;
28
28
  }
29
29
 
30
- module.exports = toKeyPositionMap;
30
+ module.exports = toKeyPositionMap;
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;
package/src/newId.js CHANGED
@@ -1,2 +1 @@
1
- const { v4 : uuid} = require('uuid');
2
- module.exports = uuid;
1
+ module.exports = require('./newMemoryId');
@@ -0,0 +1,5 @@
1
+ let nextId = 1;
2
+
3
+ module.exports = function newMemoryId() {
4
+ return `tmp${nextId++}`;
5
+ };
@@ -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;