orange-orm 4.5.1-beta.1 → 4.5.1-beta.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.
package/dist/index.mjs CHANGED
@@ -15101,9 +15101,6 @@ function requireEncodeBinary () {
15101
15101
  if (hasRequiredEncodeBinary) return encodeBinary_1;
15102
15102
  hasRequiredEncodeBinary = 1;
15103
15103
  function encodeBinary(base64) {
15104
- // return Buffer.from(base64, 'base64');
15105
-
15106
-
15107
15104
  // Decode base64 to a binary string
15108
15105
  const binaryString = atob(base64);
15109
15106
 
@@ -15686,7 +15683,7 @@ function requireWrapQuery$5 () {
15686
15683
  var sql = query.sql();
15687
15684
  log.emitQuery({ sql, parameters: params });
15688
15685
 
15689
- var statement = connection.prepare(sql);
15686
+ var statement = connection.query(sql);
15690
15687
  const rows = statement.all.apply(statement, params);
15691
15688
  onCompleted(null, rows);
15692
15689
  }
@@ -15709,6 +15706,8 @@ function requireNewTransaction$6 () {
15709
15706
  hasRequiredNewTransaction$6 = 1;
15710
15707
  const wrapQuery = requireWrapQuery$5();
15711
15708
  const encodeBoolean = requireEncodeBoolean$4();
15709
+ const encodeBinary = requireEncodeBinary();
15710
+ const decodeBinary = requireDecodeBinary();
15712
15711
  const deleteFromSql = requireDeleteFromSql$4();
15713
15712
  const selectForUpdateSql = requireSelectForUpdateSql$4();
15714
15713
  const lastInsertedSql = requireLastInsertedSql$3();
@@ -15725,6 +15724,8 @@ function requireNewTransaction$6 () {
15725
15724
  }
15726
15725
  rdb.engine = 'sqlite';
15727
15726
  rdb.encodeBoolean = encodeBoolean;
15727
+ rdb.encodeBinary = encodeBinary;
15728
+ rdb.decodeBinary = decodeBinary;
15728
15729
  rdb.decodeJSON = decodeJSON;
15729
15730
  rdb.encodeJSON = JSON.stringify;
15730
15731
  rdb.deleteFromSql = deleteFromSql;
@@ -15804,7 +15805,7 @@ function requireNewGenericPool$5 () {
15804
15805
  var defaults = requirePoolDefaults();
15805
15806
 
15806
15807
  var genericPool = requireGenericPool();
15807
- var sqlite;
15808
+ var Database;
15808
15809
 
15809
15810
  function newGenericPool(connectionString, poolOptions) {
15810
15811
  poolOptions = poolOptions || {};
@@ -15816,14 +15817,14 @@ function requireNewGenericPool$5 () {
15816
15817
  create: async function(cb) {
15817
15818
  try {
15818
15819
  try {
15819
- if (!sqlite)
15820
- sqlite = await import('bun:sqlite');
15820
+ if (!Database)
15821
+ ({ Database } = await import('bun:Database'));
15821
15822
  }
15822
15823
  catch (err) {
15823
15824
  return cb(err, null);
15824
15825
  }
15825
15826
 
15826
- var client = new sqlite.DatabaseSync(connectionString);
15827
+ var client = new Database(connectionString);
15827
15828
  client.poolCount = 0;
15828
15829
  cb(null, client);
15829
15830
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orange-orm",
3
- "version": "4.5.1-beta.1",
3
+ "version": "4.5.1-beta.3",
4
4
  "main": "./src/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "browser": "./dist/index.browser.mjs",
@@ -53,6 +53,7 @@
53
53
  "tscheck": "tsc ./src/index.d.ts --module commonjs --target es2022 --noEmit true --strict true --esModuleInterop true",
54
54
  "concat-server": "node ./src/merge-server.js",
55
55
  "concat-browser": "node ./src/merge-browser.js",
56
+ "build": "npm run build-server && npm run build-browser",
56
57
  "build-server": "rollup -c ./src/rollup.config.server.js && npm run concat-server",
57
58
  "build-browser": "rollup -c ./src/rollup.config.browser.js && npm run concat-browser",
58
59
  "lint": "eslint ./",
@@ -1,5 +1,7 @@
1
1
  const wrapQuery = require('./wrapQuery');
2
2
  const encodeBoolean = require('../sqlite/encodeBoolean');
3
+ const encodeBinary = require('../nodeSqlite/encodeBinary');
4
+ const decodeBinary = require('../nodeSqlite/decodeBinary');
3
5
  const deleteFromSql = require('../sqlite/deleteFromSql');
4
6
  const selectForUpdateSql = require('../sqlite/selectForUpdateSql');
5
7
  const lastInsertedSql = require('../sqlite/lastInsertedSql');
@@ -16,6 +18,8 @@ function newResolveTransaction(domain, pool, { readonly = false } = {}) {
16
18
  }
17
19
  rdb.engine = 'sqlite';
18
20
  rdb.encodeBoolean = encodeBoolean;
21
+ rdb.encodeBinary = encodeBinary;
22
+ rdb.decodeBinary = decodeBinary;
19
23
  rdb.decodeJSON = decodeJSON;
20
24
  rdb.encodeJSON = JSON.stringify;
21
25
  rdb.deleteFromSql = deleteFromSql;
@@ -2,7 +2,7 @@
2
2
  var defaults = require('../../poolDefaults');
3
3
 
4
4
  var genericPool = require('../../generic-pool');
5
- var sqlite;
5
+ var Database;
6
6
 
7
7
  function newGenericPool(connectionString, poolOptions) {
8
8
  poolOptions = poolOptions || {};
@@ -14,14 +14,14 @@ function newGenericPool(connectionString, poolOptions) {
14
14
  create: async function(cb) {
15
15
  try {
16
16
  try {
17
- if (!sqlite)
18
- sqlite = await import('bun:sqlite');
17
+ if (!Database)
18
+ ({ Database } = await import('bun:Database'));
19
19
  }
20
20
  catch (err) {
21
21
  return cb(err, null);
22
22
  }
23
23
 
24
- var client = new sqlite.DatabaseSync(connectionString);
24
+ var client = new Database(connectionString);
25
25
  client.poolCount = 0;
26
26
  cb(null, client);
27
27
  }
@@ -9,7 +9,7 @@ function wrapQuery(connection) {
9
9
  var sql = query.sql();
10
10
  log.emitQuery({ sql, parameters: params });
11
11
 
12
- var statement = connection.prepare(sql);
12
+ var statement = connection.query(sql);
13
13
  const rows = statement.all.apply(statement, params);
14
14
  onCompleted(null, rows);
15
15
  }
@@ -1,7 +1,4 @@
1
1
  function encodeBinary(base64) {
2
- // return Buffer.from(base64, 'base64');
3
-
4
-
5
2
  // Decode base64 to a binary string
6
3
  const binaryString = atob(base64);
7
4