orange-orm 4.7.3-beta.1 → 4.7.4-beta.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.
@@ -10818,63 +10818,6 @@ function requireGetManyDto$1 () {
10818
10818
  return obj;
10819
10819
  }
10820
10820
 
10821
-
10822
- // function newCreateRow(span) {
10823
- // const columnsMap = span.columns;
10824
- // const columns = span.table._columns.filter(column => !columnsMap || columnsMap.get(column));
10825
- // const ProtoRow = createProto(columns, span);
10826
- // const manyNames = [];
10827
-
10828
- // const c = {
10829
- // visitJoin: () => { },
10830
- // visitOne: () => { },
10831
- // visitMany: function(leg) {
10832
- // manyNames.push(leg.name);
10833
- // }
10834
- // };
10835
-
10836
- // span.legs.forEach(leg => leg.accept(c));
10837
-
10838
- // return createRow;
10839
-
10840
- // function createRow() {
10841
- // const obj = new ProtoRow();
10842
- // manyNames.forEach(name => {
10843
- // obj[name] = [];
10844
- // });
10845
- // return obj;
10846
- // }
10847
- // }
10848
-
10849
- // function createProto(columns, span) {
10850
- // function ProtoRow() {
10851
- // columns.forEach(column => {
10852
- // this[column.alias] = null;
10853
- // });
10854
-
10855
- // for (const key in span.aggregates) {
10856
- // this[key] = null;
10857
- // }
10858
-
10859
- // const c = {
10860
- // visitJoin: (leg) => {
10861
- // this[leg.name] = null;
10862
- // },
10863
- // visitOne: (leg) => {
10864
- // this[leg.name] = null;
10865
- // },
10866
- // visitMany: (leg) => {
10867
- // this[leg.name] = null;
10868
- // }
10869
- // };
10870
-
10871
- // span.legs.forEach(leg => leg.accept(c));
10872
- // }
10873
-
10874
- // return ProtoRow;
10875
- // }
10876
-
10877
-
10878
10821
  function hasManyRelations(span) {
10879
10822
  let result;
10880
10823
  const c = {};
@@ -11039,8 +10982,10 @@ function requireGetManyDto$1 () {
11039
10982
 
11040
10983
  function updateParent(subRow) {
11041
10984
  const key = extractKey(subRow);
11042
- const parentRow = extractFromMap(key);
11043
- parentRow[name].push(subRow);
10985
+ const parentRows = extractFromMap(key) || [];
10986
+ parentRows.forEach(parentRow => {
10987
+ parentRow[name].push(subRow);
10988
+ });
11044
10989
  }
11045
10990
  };
11046
10991
 
@@ -11124,22 +11069,29 @@ function requireGetManyDto$1 () {
11124
11069
 
11125
11070
  function addToMap(map, values, row) {
11126
11071
  if (Array.isArray(values)) {
11127
-
11072
+ let m = map;
11128
11073
  const lastIndex = values.length - 1;
11129
11074
  for (let i = 0; i < lastIndex; i++) {
11130
11075
  const id = values[i];
11131
- if (map.has(id))
11132
- map = map.get(id);
11133
- else {
11134
- const next = new Map();
11135
- map.set(id, next);
11136
- map = next;
11076
+ if (!m.has(id)) {
11077
+ m.set(id, new Map());
11137
11078
  }
11079
+ m = m.get(id);
11080
+ }
11081
+ const leafKey = values[lastIndex];
11082
+ if (!m.has(leafKey)) {
11083
+ m.set(leafKey, [row]);
11084
+ } else {
11085
+ m.get(leafKey).push(row);
11086
+ }
11087
+ }
11088
+ else {
11089
+ if (!map.has(values)) {
11090
+ map.set(values, [row]);
11091
+ } else {
11092
+ map.get(values).push(row);
11138
11093
  }
11139
- map.set(values[lastIndex], row);
11140
11094
  }
11141
- else
11142
- map.set(values, row);
11143
11095
  }
11144
11096
 
11145
11097
  function getFromMap(map, primaryColumns, values) {
@@ -11154,7 +11106,6 @@ function requireGetManyDto$1 () {
11154
11106
  return map.get(values);
11155
11107
  }
11156
11108
 
11157
-
11158
11109
  getManyDto_1$1 = getManyDto;
11159
11110
  return getManyDto_1$1;
11160
11111
  }
package/dist/index.mjs CHANGED
@@ -10819,63 +10819,6 @@ function requireGetManyDto$2 () {
10819
10819
  return obj;
10820
10820
  }
10821
10821
 
10822
-
10823
- // function newCreateRow(span) {
10824
- // const columnsMap = span.columns;
10825
- // const columns = span.table._columns.filter(column => !columnsMap || columnsMap.get(column));
10826
- // const ProtoRow = createProto(columns, span);
10827
- // const manyNames = [];
10828
-
10829
- // const c = {
10830
- // visitJoin: () => { },
10831
- // visitOne: () => { },
10832
- // visitMany: function(leg) {
10833
- // manyNames.push(leg.name);
10834
- // }
10835
- // };
10836
-
10837
- // span.legs.forEach(leg => leg.accept(c));
10838
-
10839
- // return createRow;
10840
-
10841
- // function createRow() {
10842
- // const obj = new ProtoRow();
10843
- // manyNames.forEach(name => {
10844
- // obj[name] = [];
10845
- // });
10846
- // return obj;
10847
- // }
10848
- // }
10849
-
10850
- // function createProto(columns, span) {
10851
- // function ProtoRow() {
10852
- // columns.forEach(column => {
10853
- // this[column.alias] = null;
10854
- // });
10855
-
10856
- // for (const key in span.aggregates) {
10857
- // this[key] = null;
10858
- // }
10859
-
10860
- // const c = {
10861
- // visitJoin: (leg) => {
10862
- // this[leg.name] = null;
10863
- // },
10864
- // visitOne: (leg) => {
10865
- // this[leg.name] = null;
10866
- // },
10867
- // visitMany: (leg) => {
10868
- // this[leg.name] = null;
10869
- // }
10870
- // };
10871
-
10872
- // span.legs.forEach(leg => leg.accept(c));
10873
- // }
10874
-
10875
- // return ProtoRow;
10876
- // }
10877
-
10878
-
10879
10822
  function hasManyRelations(span) {
10880
10823
  let result;
10881
10824
  const c = {};
@@ -11040,8 +10983,10 @@ function requireGetManyDto$2 () {
11040
10983
 
11041
10984
  function updateParent(subRow) {
11042
10985
  const key = extractKey(subRow);
11043
- const parentRow = extractFromMap(key);
11044
- parentRow[name].push(subRow);
10986
+ const parentRows = extractFromMap(key) || [];
10987
+ parentRows.forEach(parentRow => {
10988
+ parentRow[name].push(subRow);
10989
+ });
11045
10990
  }
11046
10991
  };
11047
10992
 
@@ -11125,22 +11070,29 @@ function requireGetManyDto$2 () {
11125
11070
 
11126
11071
  function addToMap(map, values, row) {
11127
11072
  if (Array.isArray(values)) {
11128
-
11073
+ let m = map;
11129
11074
  const lastIndex = values.length - 1;
11130
11075
  for (let i = 0; i < lastIndex; i++) {
11131
11076
  const id = values[i];
11132
- if (map.has(id))
11133
- map = map.get(id);
11134
- else {
11135
- const next = new Map();
11136
- map.set(id, next);
11137
- map = next;
11077
+ if (!m.has(id)) {
11078
+ m.set(id, new Map());
11138
11079
  }
11080
+ m = m.get(id);
11081
+ }
11082
+ const leafKey = values[lastIndex];
11083
+ if (!m.has(leafKey)) {
11084
+ m.set(leafKey, [row]);
11085
+ } else {
11086
+ m.get(leafKey).push(row);
11087
+ }
11088
+ }
11089
+ else {
11090
+ if (!map.has(values)) {
11091
+ map.set(values, [row]);
11092
+ } else {
11093
+ map.get(values).push(row);
11139
11094
  }
11140
- map.set(values[lastIndex], row);
11141
11095
  }
11142
- else
11143
- map.set(values, row);
11144
11096
  }
11145
11097
 
11146
11098
  function getFromMap(map, primaryColumns, values) {
@@ -11155,7 +11107,6 @@ function requireGetManyDto$2 () {
11155
11107
  return map.get(values);
11156
11108
  }
11157
11109
 
11158
-
11159
11110
  getManyDto_1$2 = getManyDto;
11160
11111
  return getManyDto_1$2;
11161
11112
  }
package/docs/changelog.md CHANGED
@@ -1,4 +1,6 @@
1
1
  ## Changelog
2
+ __4.7.3__
3
+ Bugfix: lessThanOrEqual throws incorrect syntax. See [#128](https://github.com/alfateam/issues/128)
2
4
  __4.7.2__
3
5
  Updated dependencies
4
6
  __4.7.1__
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orange-orm",
3
- "version": "4.7.3-beta.1",
3
+ "version": "4.7.4-beta.0",
4
4
  "main": "./src/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "browser": "./dist/index.browser.mjs",
package/src/getManyDto.js CHANGED
@@ -76,63 +76,6 @@ function createProto(columns, span) {
76
76
  return obj;
77
77
  }
78
78
 
79
-
80
- // function newCreateRow(span) {
81
- // const columnsMap = span.columns;
82
- // const columns = span.table._columns.filter(column => !columnsMap || columnsMap.get(column));
83
- // const ProtoRow = createProto(columns, span);
84
- // const manyNames = [];
85
-
86
- // const c = {
87
- // visitJoin: () => { },
88
- // visitOne: () => { },
89
- // visitMany: function(leg) {
90
- // manyNames.push(leg.name);
91
- // }
92
- // };
93
-
94
- // span.legs.forEach(leg => leg.accept(c));
95
-
96
- // return createRow;
97
-
98
- // function createRow() {
99
- // const obj = new ProtoRow();
100
- // manyNames.forEach(name => {
101
- // obj[name] = [];
102
- // });
103
- // return obj;
104
- // }
105
- // }
106
-
107
- // function createProto(columns, span) {
108
- // function ProtoRow() {
109
- // columns.forEach(column => {
110
- // this[column.alias] = null;
111
- // });
112
-
113
- // for (const key in span.aggregates) {
114
- // this[key] = null;
115
- // }
116
-
117
- // const c = {
118
- // visitJoin: (leg) => {
119
- // this[leg.name] = null;
120
- // },
121
- // visitOne: (leg) => {
122
- // this[leg.name] = null;
123
- // },
124
- // visitMany: (leg) => {
125
- // this[leg.name] = null;
126
- // }
127
- // };
128
-
129
- // span.legs.forEach(leg => leg.accept(c));
130
- // }
131
-
132
- // return ProtoRow;
133
- // }
134
-
135
-
136
79
  function hasManyRelations(span) {
137
80
  let result;
138
81
  const c = {};
@@ -297,8 +240,10 @@ async function decodeManyRelations(context, strategy, span) {
297
240
 
298
241
  function updateParent(subRow) {
299
242
  const key = extractKey(subRow);
300
- const parentRow = extractFromMap(key);
301
- parentRow[name].push(subRow);
243
+ const parentRows = extractFromMap(key) || [];
244
+ parentRows.forEach(parentRow => {
245
+ parentRow[name].push(subRow);
246
+ });
302
247
  }
303
248
  };
304
249
 
@@ -382,22 +327,29 @@ function createOneFilter(context, relation, ids) {
382
327
 
383
328
  function addToMap(map, values, row) {
384
329
  if (Array.isArray(values)) {
385
-
330
+ let m = map;
386
331
  const lastIndex = values.length - 1;
387
332
  for (let i = 0; i < lastIndex; i++) {
388
333
  const id = values[i];
389
- if (map.has(id))
390
- map = map.get(id);
391
- else {
392
- const next = new Map();
393
- map.set(id, next);
394
- map = next;
334
+ if (!m.has(id)) {
335
+ m.set(id, new Map());
395
336
  }
337
+ m = m.get(id);
338
+ }
339
+ const leafKey = values[lastIndex];
340
+ if (!m.has(leafKey)) {
341
+ m.set(leafKey, [row]);
342
+ } else {
343
+ m.get(leafKey).push(row);
344
+ }
345
+ }
346
+ else {
347
+ if (!map.has(values)) {
348
+ map.set(values, [row]);
349
+ } else {
350
+ map.get(values).push(row);
396
351
  }
397
- map.set(values[lastIndex], row);
398
352
  }
399
- else
400
- map.set(values, row);
401
353
  }
402
354
 
403
355
  function getFromMap(map, primaryColumns, values) {
@@ -412,5 +364,4 @@ function getFromMap(map, primaryColumns, values) {
412
364
  return map.get(values);
413
365
  }
414
366
 
415
-
416
- module.exports = getManyDto;
367
+ module.exports = getManyDto;
@@ -20,8 +20,10 @@ function wrapQuery(_context, connection) {
20
20
 
21
21
  function onInnerCompleted(err, rows, hasMore) {
22
22
  if (err) {
23
- if (err.code)
23
+ if (err.code && err.code !== 0)
24
24
  onCompleted(err);
25
+ if (rows)
26
+ result.push(rows);
25
27
  return;
26
28
  }
27
29
  result.push(rows);