orange-orm 4.7.3-beta.0 → 4.7.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.
@@ -3853,10 +3853,9 @@ function requireLessThanOrEqual () {
3853
3853
  hasRequiredLessThanOrEqual = 1;
3854
3854
  var newBoolean = requireNewBoolean();
3855
3855
  var encodeFilterArg = requireEncodeFilterArg();
3856
- const getSessionSingleton = requireGetSessionSingleton();
3856
+ var quote = requireQuote$2();
3857
3857
 
3858
3858
  function lessThanOrEqual(context, column,arg,alias) {
3859
- const quote = getSessionSingleton(context, 'quote');
3860
3859
  var operator = '<=';
3861
3860
  var encoded = encodeFilterArg(context, column, arg);
3862
3861
  var firstPart = quote(context, alias) + '.' + quote(context, column._dbName) + operator;
@@ -10819,63 +10818,6 @@ function requireGetManyDto$1 () {
10819
10818
  return obj;
10820
10819
  }
10821
10820
 
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
10821
  function hasManyRelations(span) {
10880
10822
  let result;
10881
10823
  const c = {};
@@ -11040,8 +10982,10 @@ function requireGetManyDto$1 () {
11040
10982
 
11041
10983
  function updateParent(subRow) {
11042
10984
  const key = extractKey(subRow);
11043
- const parentRow = extractFromMap(key);
11044
- parentRow[name].push(subRow);
10985
+ const parentRows = extractFromMap(key) || [];
10986
+ parentRows.forEach(parentRow => {
10987
+ parentRow[name].push(subRow);
10988
+ });
11045
10989
  }
11046
10990
  };
11047
10991
 
@@ -11125,22 +11069,29 @@ function requireGetManyDto$1 () {
11125
11069
 
11126
11070
  function addToMap(map, values, row) {
11127
11071
  if (Array.isArray(values)) {
11128
-
11072
+ let m = map;
11129
11073
  const lastIndex = values.length - 1;
11130
11074
  for (let i = 0; i < lastIndex; i++) {
11131
11075
  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;
11076
+ if (!m.has(id)) {
11077
+ m.set(id, new Map());
11138
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);
11139
11093
  }
11140
- map.set(values[lastIndex], row);
11141
11094
  }
11142
- else
11143
- map.set(values, row);
11144
11095
  }
11145
11096
 
11146
11097
  function getFromMap(map, primaryColumns, values) {
@@ -11155,7 +11106,6 @@ function requireGetManyDto$1 () {
11155
11106
  return map.get(values);
11156
11107
  }
11157
11108
 
11158
-
11159
11109
  getManyDto_1$1 = getManyDto;
11160
11110
  return getManyDto_1$1;
11161
11111
  }
package/dist/index.mjs CHANGED
@@ -3854,10 +3854,9 @@ function requireLessThanOrEqual () {
3854
3854
  hasRequiredLessThanOrEqual = 1;
3855
3855
  var newBoolean = requireNewBoolean();
3856
3856
  var encodeFilterArg = requireEncodeFilterArg();
3857
- const getSessionSingleton = requireGetSessionSingleton();
3857
+ var quote = requireQuote$6();
3858
3858
 
3859
3859
  function lessThanOrEqual(context, column,arg,alias) {
3860
- const quote = getSessionSingleton(context, 'quote');
3861
3860
  var operator = '<=';
3862
3861
  var encoded = encodeFilterArg(context, column, arg);
3863
3862
  var firstPart = quote(context, alias) + '.' + quote(context, column._dbName) + operator;
@@ -10820,63 +10819,6 @@ function requireGetManyDto$2 () {
10820
10819
  return obj;
10821
10820
  }
10822
10821
 
10823
-
10824
- // function newCreateRow(span) {
10825
- // const columnsMap = span.columns;
10826
- // const columns = span.table._columns.filter(column => !columnsMap || columnsMap.get(column));
10827
- // const ProtoRow = createProto(columns, span);
10828
- // const manyNames = [];
10829
-
10830
- // const c = {
10831
- // visitJoin: () => { },
10832
- // visitOne: () => { },
10833
- // visitMany: function(leg) {
10834
- // manyNames.push(leg.name);
10835
- // }
10836
- // };
10837
-
10838
- // span.legs.forEach(leg => leg.accept(c));
10839
-
10840
- // return createRow;
10841
-
10842
- // function createRow() {
10843
- // const obj = new ProtoRow();
10844
- // manyNames.forEach(name => {
10845
- // obj[name] = [];
10846
- // });
10847
- // return obj;
10848
- // }
10849
- // }
10850
-
10851
- // function createProto(columns, span) {
10852
- // function ProtoRow() {
10853
- // columns.forEach(column => {
10854
- // this[column.alias] = null;
10855
- // });
10856
-
10857
- // for (const key in span.aggregates) {
10858
- // this[key] = null;
10859
- // }
10860
-
10861
- // const c = {
10862
- // visitJoin: (leg) => {
10863
- // this[leg.name] = null;
10864
- // },
10865
- // visitOne: (leg) => {
10866
- // this[leg.name] = null;
10867
- // },
10868
- // visitMany: (leg) => {
10869
- // this[leg.name] = null;
10870
- // }
10871
- // };
10872
-
10873
- // span.legs.forEach(leg => leg.accept(c));
10874
- // }
10875
-
10876
- // return ProtoRow;
10877
- // }
10878
-
10879
-
10880
10822
  function hasManyRelations(span) {
10881
10823
  let result;
10882
10824
  const c = {};
@@ -11041,8 +10983,10 @@ function requireGetManyDto$2 () {
11041
10983
 
11042
10984
  function updateParent(subRow) {
11043
10985
  const key = extractKey(subRow);
11044
- const parentRow = extractFromMap(key);
11045
- parentRow[name].push(subRow);
10986
+ const parentRows = extractFromMap(key) || [];
10987
+ parentRows.forEach(parentRow => {
10988
+ parentRow[name].push(subRow);
10989
+ });
11046
10990
  }
11047
10991
  };
11048
10992
 
@@ -11126,22 +11070,29 @@ function requireGetManyDto$2 () {
11126
11070
 
11127
11071
  function addToMap(map, values, row) {
11128
11072
  if (Array.isArray(values)) {
11129
-
11073
+ let m = map;
11130
11074
  const lastIndex = values.length - 1;
11131
11075
  for (let i = 0; i < lastIndex; i++) {
11132
11076
  const id = values[i];
11133
- if (map.has(id))
11134
- map = map.get(id);
11135
- else {
11136
- const next = new Map();
11137
- map.set(id, next);
11138
- map = next;
11077
+ if (!m.has(id)) {
11078
+ m.set(id, new Map());
11139
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);
11140
11094
  }
11141
- map.set(values[lastIndex], row);
11142
11095
  }
11143
- else
11144
- map.set(values, row);
11145
11096
  }
11146
11097
 
11147
11098
  function getFromMap(map, primaryColumns, values) {
@@ -11156,7 +11107,6 @@ function requireGetManyDto$2 () {
11156
11107
  return map.get(values);
11157
11108
  }
11158
11109
 
11159
-
11160
11110
  getManyDto_1$2 = getManyDto;
11161
11111
  return getManyDto_1$2;
11162
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.0",
3
+ "version": "4.7.3",
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;
@@ -1,9 +1,8 @@
1
1
  var newBoolean = require('./newBoolean');
2
2
  var encodeFilterArg = require('./encodeFilterArg');
3
- const getSessionSingleton = require('../getSessionSingleton');
3
+ var quote = require('../quote');
4
4
 
5
5
  function lessThanOrEqual(context, column,arg,alias) {
6
- const quote = getSessionSingleton(context, 'quote');
7
6
  var operator = '<=';
8
7
  var encoded = encodeFilterArg(context, column, arg);
9
8
  var firstPart = quote(context, alias) + '.' + quote(context, column._dbName) + operator;