orange-orm 4.7.0-beta.3 → 4.7.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.
package/README.md CHANGED
@@ -1591,12 +1591,10 @@ const db = map.sqlite('demo.db');
1591
1591
  getRows();
1592
1592
 
1593
1593
  async function getRows() {
1594
- const filter = db.order.lines.any(x => x.product.contains('guitar'));
1595
- //equivalent syntax:
1596
- // const filter = db.order.lines.product.contains('guitar');
1597
-
1598
1594
  const rows = await db.order.getAll({
1599
1595
  where: y => y.lines.any(x => x.product.contains('guitar'))
1596
+ //equivalent syntax:
1597
+ //where: x => x.lines.product.contains('guitar')
1600
1598
  });
1601
1599
  }
1602
1600
  ```
@@ -4374,7 +4374,7 @@ function requireEndsWithCore () {
4374
4374
  var nullOperator = ' is ';
4375
4375
 
4376
4376
  function endsWithCore(context, operator, column,arg,alias) {
4377
- alias = quote(alias);
4377
+ alias = quote(context, alias);
4378
4378
  operator = ' ' + operator + ' ';
4379
4379
  var encoded = column.encode(context, arg);
4380
4380
  if (encoded.sql() == 'null')
@@ -6086,7 +6086,7 @@ function requireNegotiateExclusive () {
6086
6086
  function negotiateExclusive(context, table, alias, _exclusive) {
6087
6087
  if (table._exclusive || _exclusive) {
6088
6088
  var encode = getSessionSingleton(context, 'selectForUpdateSql');
6089
- return encode(alias);
6089
+ return encode(context, alias);
6090
6090
  }
6091
6091
  return '';
6092
6092
  }
@@ -11081,8 +11081,8 @@ function requireGetManyDto$1 () {
11081
11081
  return decode(context, strategy[name], leg.span, rawRows, keys, updateParent);
11082
11082
 
11083
11083
  function updateParent(subRow, i) {
11084
- resultRows[i][name] = subRow;
11085
-
11084
+ if (resultRows[i])
11085
+ resultRows[i][name] = subRow;
11086
11086
  }
11087
11087
  };
11088
11088
 
@@ -12631,8 +12631,8 @@ function requireSelectForUpdateSql$1 () {
12631
12631
  hasRequiredSelectForUpdateSql$1 = 1;
12632
12632
  const quote = requireQuote$2();
12633
12633
 
12634
- selectForUpdateSql$1 = function(alias) {
12635
- return ' FOR UPDATE OF ' + quote(alias);
12634
+ selectForUpdateSql$1 = function(context, alias) {
12635
+ return ' FOR UPDATE OF ' + quote(context, alias);
12636
12636
  };
12637
12637
  return selectForUpdateSql$1;
12638
12638
  }
package/dist/index.mjs CHANGED
@@ -4376,7 +4376,7 @@ function requireEndsWithCore () {
4376
4376
  var nullOperator = ' is ';
4377
4377
 
4378
4378
  function endsWithCore(context, operator, column,arg,alias) {
4379
- alias = quote(alias);
4379
+ alias = quote(context, alias);
4380
4380
  operator = ' ' + operator + ' ';
4381
4381
  var encoded = column.encode(context, arg);
4382
4382
  if (encoded.sql() == 'null')
@@ -6088,7 +6088,7 @@ function requireNegotiateExclusive () {
6088
6088
  function negotiateExclusive(context, table, alias, _exclusive) {
6089
6089
  if (table._exclusive || _exclusive) {
6090
6090
  var encode = getSessionSingleton(context, 'selectForUpdateSql');
6091
- return encode(alias);
6091
+ return encode(context, alias);
6092
6092
  }
6093
6093
  return '';
6094
6094
  }
@@ -11083,8 +11083,8 @@ function requireGetManyDto$2 () {
11083
11083
  return decode(context, strategy[name], leg.span, rawRows, keys, updateParent);
11084
11084
 
11085
11085
  function updateParent(subRow, i) {
11086
- resultRows[i][name] = subRow;
11087
-
11086
+ if (resultRows[i])
11087
+ resultRows[i][name] = subRow;
11088
11088
  }
11089
11089
  };
11090
11090
 
@@ -15933,8 +15933,8 @@ function requireSelectForUpdateSql$3 () {
15933
15933
  hasRequiredSelectForUpdateSql$3 = 1;
15934
15934
  const quote = requireQuote$6();
15935
15935
 
15936
- selectForUpdateSql$3 = function(alias) {
15937
- return ' FOR UPDATE OF ' + quote(alias);
15936
+ selectForUpdateSql$3 = function(context, alias) {
15937
+ return ' FOR UPDATE OF ' + quote(context, alias);
15938
15938
  };
15939
15939
  return selectForUpdateSql$3;
15940
15940
  }
@@ -16564,7 +16564,6 @@ function requireNewGenericPool$5 () {
16564
16564
 
16565
16565
  var genericPool = requireGenericPool();
16566
16566
  var Database;
16567
-
16568
16567
  function newGenericPool(connectionString, poolOptions) {
16569
16568
  poolOptions = poolOptions || {};
16570
16569
  var pool = genericPool.Pool({
@@ -16577,7 +16576,8 @@ function requireNewGenericPool$5 () {
16577
16576
  try {
16578
16577
  try {
16579
16578
  if (!Database)
16580
- ({ Database } = await import('bun:Database'));
16579
+ ({ Database } = await import('bun:sqlite'));
16580
+
16581
16581
  }
16582
16582
  catch (err) {
16583
16583
  return cb(err, null);
package/docs/changelog.md CHANGED
@@ -1,4 +1,14 @@
1
1
  ## Changelog
2
+ __4.7.1__
3
+ Bugfix: Error when using bun and sqlite: Cannot find package 'Database'. See [#127](https://github.com/alfateam/issues/127)
4
+ __4.7.0__
5
+ Support for [PGLite](https://pglite.dev/). See [#124](https://github.com/alfateam/orange-orm/issues/124)
6
+ __4.6.3__
7
+ Bugfix: Chained Reference relation throws if first one is null. See [#126](https://github.com/alfateam/orange-orm/issues/126)
8
+ __4.6.2__
9
+ Bugfix: crashed when combining endsWith filter with other filter: e.g. `endsWith('foo').or(...)`
10
+ __4.6.1__
11
+ Bugfix: No intellisense when running in browser mode . See [#125](https://github.com/alfateam/orange-orm/issues/125)
2
12
  __4.6.0__
3
13
  Support for Deno and Bun.
4
14
  Using builtin sqlite for Node22++.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orange-orm",
3
- "version": "4.7.0-beta.3",
3
+ "version": "4.7.1",
4
4
  "main": "./src/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "browser": "./dist/index.browser.mjs",
@@ -3,7 +3,6 @@ var defaults = require('../../poolDefaults');
3
3
 
4
4
  var genericPool = require('../../generic-pool');
5
5
  var Database;
6
-
7
6
  function newGenericPool(connectionString, poolOptions) {
8
7
  poolOptions = poolOptions || {};
9
8
  var pool = genericPool.Pool({
@@ -16,7 +15,8 @@ function newGenericPool(connectionString, poolOptions) {
16
15
  try {
17
16
  try {
18
17
  if (!Database)
19
- ({ Database } = await import('bun:Database'));
18
+ ({ Database } = await import('bun:sqlite'));
19
+
20
20
  }
21
21
  catch (err) {
22
22
  return cb(err, null);
package/src/getManyDto.js CHANGED
@@ -338,8 +338,8 @@ async function decodeRelations2(context, strategy, span, rawRows, resultRows, ke
338
338
  return decode(context, strategy[name], leg.span, rawRows, keys, updateParent);
339
339
 
340
340
  function updateParent(subRow, i) {
341
- resultRows[i][name] = subRow;
342
-
341
+ if (resultRows[i])
342
+ resultRows[i][name] = subRow;
343
343
  }
344
344
  };
345
345
 
@@ -1,5 +1,5 @@
1
1
  const quote = require('../table/quote');
2
2
 
3
- module.exports = function(alias) {
4
- return ' FOR UPDATE OF ' + quote(alias);
3
+ module.exports = function(context, alias) {
4
+ return ' FOR UPDATE OF ' + quote(context, alias);
5
5
  };
@@ -3,7 +3,7 @@ var newBoolean = require('../newBoolean');
3
3
  var nullOperator = ' is ';
4
4
 
5
5
  function endsWithCore(context, operator, column,arg,alias) {
6
- alias = quote(alias);
6
+ alias = quote(context, alias);
7
7
  operator = ' ' + operator + ' ';
8
8
  var encoded = column.encode(context, arg);
9
9
  if (encoded.sql() == 'null')
@@ -3,7 +3,7 @@ var getSessionSingleton = require('../../getSessionSingleton');
3
3
  function negotiateExclusive(context, table, alias, _exclusive) {
4
4
  if (table._exclusive || _exclusive) {
5
5
  var encode = getSessionSingleton(context, 'selectForUpdateSql');
6
- return encode(alias);
6
+ return encode(context, alias);
7
7
  }
8
8
  return '';
9
9
  }