orange-orm 4.7.0-beta.2 → 4.7.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.
- package/README.md +13 -4
- package/dist/index.browser.mjs +18 -19
- package/dist/index.mjs +47 -69
- package/docs/changelog.md +8 -0
- package/package.json +1 -1
- package/src/bunPg/newDatabase.js +2 -5
- package/src/bunPg/pool/newPgPool.js +1 -0
- package/src/bunSqlite/newDatabase.js +2 -5
- package/src/bunSqlite/pool/newGenericPool.js +1 -0
- package/src/client/index.js +5 -0
- package/src/d1/newDatabase.js +2 -5
- package/src/d1/pool/newGenericPool.js +1 -0
- package/src/getManyDto.js +2 -2
- package/src/index.d.ts +1 -1
- package/src/map.d.ts +1 -0
- package/src/mssql/newDatabase.js +2 -5
- package/src/mssql/pool/newGenericPool.js +1 -0
- package/src/mySql/newDatabase.js +2 -5
- package/src/mySql/pool/newGenericPool.js +1 -0
- package/src/nodeSqlite/newDatabase.js +2 -5
- package/src/nodeSqlite/pool/newGenericPool.js +1 -0
- package/src/oracle/newDatabase.js +2 -5
- package/src/oracle/pool/newGenericPool.js +1 -0
- package/src/pg/newDatabase.js +2 -5
- package/src/pg/pool/newPgPool.js +1 -0
- package/src/pglite/newDatabase.js +2 -5
- package/src/pglite/newTransaction.js +1 -3
- package/src/pglite/pool/newPgPool.js +1 -0
- package/src/sap/newDatabase.js +2 -5
- package/src/sqlite/selectForUpdateSql.js +2 -2
- package/src/sqlite3/newDatabase.js +2 -5
- package/src/sqlite3/pool/newGenericPool.js +1 -0
- package/src/table/column/string/endsWithCore.js +1 -1
- package/src/table/query/singleQuery/negotiateExclusive.js +1 -1
- package/src/tedious/newDatabase.js +2 -5
- package/src/tedious/pool/newGenericPool.js +1 -0
package/README.md
CHANGED
|
@@ -286,6 +286,10 @@ npm install sqlite3
|
|
|
286
286
|
```javascript
|
|
287
287
|
import map from './map';
|
|
288
288
|
const db = map.sqlite('demo.db');
|
|
289
|
+
// … use the database …
|
|
290
|
+
|
|
291
|
+
// IMPORTANT for serverless functions:
|
|
292
|
+
await db.close(); // closes the client connection
|
|
289
293
|
```
|
|
290
294
|
__With connection pool__
|
|
291
295
|
```bash
|
|
@@ -294,7 +298,14 @@ npm install sqlite3
|
|
|
294
298
|
```javascript
|
|
295
299
|
import map from './map';
|
|
296
300
|
const db = map.sqlite('demo.db', { size: 10 });
|
|
301
|
+
// … use the pool …
|
|
302
|
+
|
|
303
|
+
// IMPORTANT for serverless functions:
|
|
304
|
+
await pool.close(); // closes all pooled connections
|
|
297
305
|
```
|
|
306
|
+
__Why close ?__
|
|
307
|
+
In serverless environments (e.g. AWS Lambda, Vercel, Cloudflare Workers) execution contexts are frequently frozen and resumed. Explicitly closing the client or pool ensures that file handles are released promptly and prevents “database locked” errors between invocations.
|
|
308
|
+
|
|
298
309
|
__From the browser__
|
|
299
310
|
You can securely use Orange from the browser by utilizing the Express plugin, which serves to safeguard sensitive database credentials from exposure at the client level. This technique bypasses the need to transmit raw SQL queries directly from the client to the server. Instead, it logs method calls initiated by the client, which are later replayed and authenticated on the server. This not only reinforces security by preventing the disclosure of raw SQL queries on the client side but also facilitates a smoother operation. Essentially, this method mirrors a traditional REST API, augmented with advanced TypeScript tooling for enhanced functionality. You can read more about it in the section called [In the browser](#user-content-in-the-browser)
|
|
300
311
|
<sub>📄 server.ts</sub>
|
|
@@ -1580,12 +1591,10 @@ const db = map.sqlite('demo.db');
|
|
|
1580
1591
|
getRows();
|
|
1581
1592
|
|
|
1582
1593
|
async function getRows() {
|
|
1583
|
-
const filter = db.order.lines.any(x => x.product.contains('guitar'));
|
|
1584
|
-
//equivalent syntax:
|
|
1585
|
-
// const filter = db.order.lines.product.contains('guitar');
|
|
1586
|
-
|
|
1587
1594
|
const rows = await db.order.getAll({
|
|
1588
1595
|
where: y => y.lines.any(x => x.product.contains('guitar'))
|
|
1596
|
+
//equivalent syntax:
|
|
1597
|
+
//where: x => x.lines.product.contains('guitar')
|
|
1589
1598
|
});
|
|
1590
1599
|
}
|
|
1591
1600
|
```
|
package/dist/index.browser.mjs
CHANGED
|
@@ -2727,6 +2727,11 @@ function requireClient () {
|
|
|
2727
2727
|
client.http = onProvider.bind(null, 'http');//todo
|
|
2728
2728
|
client.mysql = onProvider.bind(null, 'mysql');
|
|
2729
2729
|
client.express = express;
|
|
2730
|
+
client.close = close;
|
|
2731
|
+
|
|
2732
|
+
function close() {
|
|
2733
|
+
return client.db.end ? client.db.end() : Promise.resolve();
|
|
2734
|
+
}
|
|
2730
2735
|
|
|
2731
2736
|
function onProvider(name, ...args) {
|
|
2732
2737
|
let db = providers[name].apply(null, args);
|
|
@@ -4369,7 +4374,7 @@ function requireEndsWithCore () {
|
|
|
4369
4374
|
var nullOperator = ' is ';
|
|
4370
4375
|
|
|
4371
4376
|
function endsWithCore(context, operator, column,arg,alias) {
|
|
4372
|
-
alias = quote(alias);
|
|
4377
|
+
alias = quote(context, alias);
|
|
4373
4378
|
operator = ' ' + operator + ' ';
|
|
4374
4379
|
var encoded = column.encode(context, arg);
|
|
4375
4380
|
if (encoded.sql() == 'null')
|
|
@@ -6081,7 +6086,7 @@ function requireNegotiateExclusive () {
|
|
|
6081
6086
|
function negotiateExclusive(context, table, alias, _exclusive) {
|
|
6082
6087
|
if (table._exclusive || _exclusive) {
|
|
6083
6088
|
var encode = getSessionSingleton(context, 'selectForUpdateSql');
|
|
6084
|
-
return encode(alias);
|
|
6089
|
+
return encode(context, alias);
|
|
6085
6090
|
}
|
|
6086
6091
|
return '';
|
|
6087
6092
|
}
|
|
@@ -11076,8 +11081,8 @@ function requireGetManyDto$1 () {
|
|
|
11076
11081
|
return decode(context, strategy[name], leg.span, rawRows, keys, updateParent);
|
|
11077
11082
|
|
|
11078
11083
|
function updateParent(subRow, i) {
|
|
11079
|
-
resultRows[i]
|
|
11080
|
-
|
|
11084
|
+
if (resultRows[i])
|
|
11085
|
+
resultRows[i][name] = subRow;
|
|
11081
11086
|
}
|
|
11082
11087
|
};
|
|
11083
11088
|
|
|
@@ -12626,8 +12631,8 @@ function requireSelectForUpdateSql$1 () {
|
|
|
12626
12631
|
hasRequiredSelectForUpdateSql$1 = 1;
|
|
12627
12632
|
const quote = requireQuote$2();
|
|
12628
12633
|
|
|
12629
|
-
selectForUpdateSql$1 = function(alias) {
|
|
12630
|
-
return ' FOR UPDATE OF ' + quote(alias);
|
|
12634
|
+
selectForUpdateSql$1 = function(context, alias) {
|
|
12635
|
+
return ' FOR UPDATE OF ' + quote(context, alias);
|
|
12631
12636
|
};
|
|
12632
12637
|
return selectForUpdateSql$1;
|
|
12633
12638
|
}
|
|
@@ -13919,6 +13924,7 @@ function requireNewGenericPool () {
|
|
|
13919
13924
|
poolOptions = poolOptions || {};
|
|
13920
13925
|
// @ts-ignore
|
|
13921
13926
|
var pool = genericPool.Pool({
|
|
13927
|
+
min: poolOptions.min || 0,
|
|
13922
13928
|
max: 1,
|
|
13923
13929
|
idleTimeoutMillis: poolOptions.idleTimeout || defaults.poolIdleTimeout,
|
|
13924
13930
|
reapIntervalMillis: poolOptions.reapIntervalMillis || defaults.reapIntervalMillis,
|
|
@@ -14003,11 +14009,8 @@ function requireNewDatabase$1 () {
|
|
|
14003
14009
|
function newDatabase(d1Database, poolOptions) {
|
|
14004
14010
|
if (!d1Database)
|
|
14005
14011
|
throw new Error('Missing d1Database');
|
|
14006
|
-
|
|
14007
|
-
|
|
14008
|
-
pool = newPool.bind(null,d1Database, poolOptions);
|
|
14009
|
-
else
|
|
14010
|
-
pool = newPool(d1Database, poolOptions);
|
|
14012
|
+
poolOptions = poolOptions || { min: 1 };
|
|
14013
|
+
var pool = newPool(d1Database, poolOptions);
|
|
14011
14014
|
|
|
14012
14015
|
let c = {poolFactory: pool, hostLocal, express};
|
|
14013
14016
|
|
|
@@ -14455,10 +14458,8 @@ function requireNewTransaction () {
|
|
|
14455
14458
|
|
|
14456
14459
|
function newResolveTransaction(domain, pool, { readonly = false } = {}) {
|
|
14457
14460
|
var rdb = { poolFactory: pool };
|
|
14458
|
-
if (!pool.connect)
|
|
14461
|
+
if (!pool.connect)
|
|
14459
14462
|
pool = pool();
|
|
14460
|
-
rdb.pool = pool;
|
|
14461
|
-
}
|
|
14462
14463
|
|
|
14463
14464
|
rdb.engine = 'pg';
|
|
14464
14465
|
rdb.encodeDate = encodeDate;
|
|
@@ -14570,6 +14571,7 @@ function requireNewPgPool () {
|
|
|
14570
14571
|
|
|
14571
14572
|
//@ts-ignore
|
|
14572
14573
|
const pool = genericPool.Pool({
|
|
14574
|
+
min: poolOptions.min || 0,
|
|
14573
14575
|
max: poolOptions.size || poolOptions.poolSize || defaults.poolSize,
|
|
14574
14576
|
idleTimeoutMillis: poolOptions.idleTimeout || defaults.poolIdleTimeout,
|
|
14575
14577
|
reapIntervalMillis: poolOptions.reapIntervalMillis || defaults.reapIntervalMillis,
|
|
@@ -14705,11 +14707,8 @@ function requireNewDatabase () {
|
|
|
14705
14707
|
let setSessionSingleton = requireSetSessionSingleton();
|
|
14706
14708
|
|
|
14707
14709
|
function newDatabase(connectionString, poolOptions) {
|
|
14708
|
-
|
|
14709
|
-
|
|
14710
|
-
pool = newPool.bind(null, connectionString, poolOptions);
|
|
14711
|
-
else
|
|
14712
|
-
pool = newPool(connectionString, poolOptions);
|
|
14710
|
+
poolOptions = poolOptions || { min: 1 };
|
|
14711
|
+
var pool = newPool(connectionString, poolOptions);
|
|
14713
14712
|
|
|
14714
14713
|
let c = { poolFactory: pool, hostLocal, express };
|
|
14715
14714
|
|
package/dist/index.mjs
CHANGED
|
@@ -2729,6 +2729,11 @@ function requireClient () {
|
|
|
2729
2729
|
client.http = onProvider.bind(null, 'http');//todo
|
|
2730
2730
|
client.mysql = onProvider.bind(null, 'mysql');
|
|
2731
2731
|
client.express = express;
|
|
2732
|
+
client.close = close;
|
|
2733
|
+
|
|
2734
|
+
function close() {
|
|
2735
|
+
return client.db.end ? client.db.end() : Promise.resolve();
|
|
2736
|
+
}
|
|
2732
2737
|
|
|
2733
2738
|
function onProvider(name, ...args) {
|
|
2734
2739
|
let db = providers[name].apply(null, args);
|
|
@@ -4371,7 +4376,7 @@ function requireEndsWithCore () {
|
|
|
4371
4376
|
var nullOperator = ' is ';
|
|
4372
4377
|
|
|
4373
4378
|
function endsWithCore(context, operator, column,arg,alias) {
|
|
4374
|
-
alias = quote(alias);
|
|
4379
|
+
alias = quote(context, alias);
|
|
4375
4380
|
operator = ' ' + operator + ' ';
|
|
4376
4381
|
var encoded = column.encode(context, arg);
|
|
4377
4382
|
if (encoded.sql() == 'null')
|
|
@@ -6083,7 +6088,7 @@ function requireNegotiateExclusive () {
|
|
|
6083
6088
|
function negotiateExclusive(context, table, alias, _exclusive) {
|
|
6084
6089
|
if (table._exclusive || _exclusive) {
|
|
6085
6090
|
var encode = getSessionSingleton(context, 'selectForUpdateSql');
|
|
6086
|
-
return encode(alias);
|
|
6091
|
+
return encode(context, alias);
|
|
6087
6092
|
}
|
|
6088
6093
|
return '';
|
|
6089
6094
|
}
|
|
@@ -11078,8 +11083,8 @@ function requireGetManyDto$2 () {
|
|
|
11078
11083
|
return decode(context, strategy[name], leg.span, rawRows, keys, updateParent);
|
|
11079
11084
|
|
|
11080
11085
|
function updateParent(subRow, i) {
|
|
11081
|
-
resultRows[i]
|
|
11082
|
-
|
|
11086
|
+
if (resultRows[i])
|
|
11087
|
+
resultRows[i][name] = subRow;
|
|
11083
11088
|
}
|
|
11084
11089
|
};
|
|
11085
11090
|
|
|
@@ -13945,6 +13950,7 @@ function requireNewGenericPool$7 () {
|
|
|
13945
13950
|
connectionString.dateStrings = true;
|
|
13946
13951
|
poolOptions = poolOptions || {};
|
|
13947
13952
|
var pool = genericPool.Pool({
|
|
13953
|
+
min: poolOptions.min || 0,
|
|
13948
13954
|
max: poolOptions.size || poolOptions.poolSize || defaults.poolSize,
|
|
13949
13955
|
idleTimeoutMillis: poolOptions.idleTimeout || defaults.poolIdleTimeout,
|
|
13950
13956
|
reapIntervalMillis: poolOptions.reapIntervalMillis || defaults.reapIntervalMillis,
|
|
@@ -14047,11 +14053,8 @@ function requireNewDatabase$b () {
|
|
|
14047
14053
|
function newDatabase(connectionString, poolOptions) {
|
|
14048
14054
|
if (!connectionString)
|
|
14049
14055
|
throw new Error('Connection string cannot be empty');
|
|
14050
|
-
|
|
14051
|
-
|
|
14052
|
-
pool = newPool.bind(null, connectionString, poolOptions);
|
|
14053
|
-
else
|
|
14054
|
-
pool = newPool(connectionString, poolOptions);
|
|
14056
|
+
poolOptions = poolOptions || { min: 1 };
|
|
14057
|
+
var pool = newPool(connectionString, poolOptions);
|
|
14055
14058
|
|
|
14056
14059
|
let c = { poolFactory: pool, hostLocal, express };
|
|
14057
14060
|
|
|
@@ -14497,10 +14500,8 @@ function requireNewTransaction$a () {
|
|
|
14497
14500
|
|
|
14498
14501
|
function newResolveTransaction(domain, pool, { readonly = false } = {}) {
|
|
14499
14502
|
var rdb = { poolFactory: pool };
|
|
14500
|
-
if (!pool.connect)
|
|
14503
|
+
if (!pool.connect)
|
|
14501
14504
|
pool = pool();
|
|
14502
|
-
rdb.pool = pool;
|
|
14503
|
-
}
|
|
14504
14505
|
|
|
14505
14506
|
rdb.engine = 'pg';
|
|
14506
14507
|
rdb.encodeDate = encodeDate;
|
|
@@ -14612,6 +14613,7 @@ function requireNewPgPool$2 () {
|
|
|
14612
14613
|
|
|
14613
14614
|
//@ts-ignore
|
|
14614
14615
|
const pool = genericPool.Pool({
|
|
14616
|
+
min: poolOptions.min || 0,
|
|
14615
14617
|
max: poolOptions.size || poolOptions.poolSize || defaults.poolSize,
|
|
14616
14618
|
idleTimeoutMillis: poolOptions.idleTimeout || defaults.poolIdleTimeout,
|
|
14617
14619
|
reapIntervalMillis: poolOptions.reapIntervalMillis || defaults.reapIntervalMillis,
|
|
@@ -14747,11 +14749,8 @@ function requireNewDatabase$a () {
|
|
|
14747
14749
|
let setSessionSingleton = requireSetSessionSingleton();
|
|
14748
14750
|
|
|
14749
14751
|
function newDatabase(connectionString, poolOptions) {
|
|
14750
|
-
|
|
14751
|
-
|
|
14752
|
-
pool = newPool.bind(null, connectionString, poolOptions);
|
|
14753
|
-
else
|
|
14754
|
-
pool = newPool(connectionString, poolOptions);
|
|
14752
|
+
poolOptions = poolOptions || { min: 1 };
|
|
14753
|
+
var pool = newPool(connectionString, poolOptions);
|
|
14755
14754
|
|
|
14756
14755
|
let c = { poolFactory: pool, hostLocal, express };
|
|
14757
14756
|
|
|
@@ -15156,6 +15155,7 @@ function requireNewPgPool$1 () {
|
|
|
15156
15155
|
|
|
15157
15156
|
//@ts-ignore
|
|
15158
15157
|
const pool = genericPool.Pool({
|
|
15158
|
+
min: poolOptions.min || 0,
|
|
15159
15159
|
max: poolOptions.size || poolOptions.poolSize || defaults.poolSize,
|
|
15160
15160
|
idleTimeoutMillis: poolOptions.idleTimeout || defaults.poolIdleTimeout,
|
|
15161
15161
|
reapIntervalMillis: poolOptions.reapIntervalMillis || defaults.reapIntervalMillis,
|
|
@@ -15256,11 +15256,8 @@ function requireNewDatabase$9 () {
|
|
|
15256
15256
|
function newDatabase(connectionString, poolOptions) {
|
|
15257
15257
|
if (!connectionString)
|
|
15258
15258
|
throw new Error('Connection string cannot be empty');
|
|
15259
|
-
|
|
15260
|
-
|
|
15261
|
-
pool = newPool.bind(null, connectionString, poolOptions);
|
|
15262
|
-
else
|
|
15263
|
-
pool = newPool(connectionString, poolOptions);
|
|
15259
|
+
poolOptions = poolOptions || { min: 1 };
|
|
15260
|
+
var pool = newPool(connectionString, poolOptions);
|
|
15264
15261
|
|
|
15265
15262
|
let c = { poolFactory: pool, hostLocal, express };
|
|
15266
15263
|
|
|
@@ -15589,6 +15586,7 @@ function requireNewPgPool () {
|
|
|
15589
15586
|
|
|
15590
15587
|
// @ts-ignore
|
|
15591
15588
|
var pool = genericPool.Pool({
|
|
15589
|
+
min: poolOptions.min || 0,
|
|
15592
15590
|
max: poolOptions.size || poolOptions.poolSize || defaults.poolSize,
|
|
15593
15591
|
idleTimeoutMillis: poolOptions.idleTimeout || defaults.poolIdleTimeout,
|
|
15594
15592
|
reapIntervalMillis: poolOptions.reapIntervalMillis || defaults.reapIntervalMillis,
|
|
@@ -15730,11 +15728,8 @@ function requireNewDatabase$8 () {
|
|
|
15730
15728
|
function newDatabase(connectionString, poolOptions) {
|
|
15731
15729
|
if (!connectionString)
|
|
15732
15730
|
throw new Error('Connection string cannot be empty');
|
|
15733
|
-
|
|
15734
|
-
|
|
15735
|
-
pool = newPool.bind(null, connectionString, poolOptions);
|
|
15736
|
-
else
|
|
15737
|
-
pool = newPool(connectionString, poolOptions);
|
|
15731
|
+
poolOptions = poolOptions || { min: 1 };
|
|
15732
|
+
var pool = newPool(connectionString, poolOptions);
|
|
15738
15733
|
|
|
15739
15734
|
let c = { poolFactory: pool, hostLocal, express };
|
|
15740
15735
|
|
|
@@ -15938,8 +15933,8 @@ function requireSelectForUpdateSql$3 () {
|
|
|
15938
15933
|
hasRequiredSelectForUpdateSql$3 = 1;
|
|
15939
15934
|
const quote = requireQuote$6();
|
|
15940
15935
|
|
|
15941
|
-
selectForUpdateSql$3 = function(alias) {
|
|
15942
|
-
return ' FOR UPDATE OF ' + quote(alias);
|
|
15936
|
+
selectForUpdateSql$3 = function(context, alias) {
|
|
15937
|
+
return ' FOR UPDATE OF ' + quote(context, alias);
|
|
15943
15938
|
};
|
|
15944
15939
|
return selectForUpdateSql$3;
|
|
15945
15940
|
}
|
|
@@ -16234,6 +16229,7 @@ function requireNewGenericPool$6 () {
|
|
|
16234
16229
|
|
|
16235
16230
|
poolOptions = poolOptions || {};
|
|
16236
16231
|
var pool = genericPool.Pool({
|
|
16232
|
+
min: poolOptions.min || 0,
|
|
16237
16233
|
max: poolOptions.size || poolOptions.poolSize || defaults.poolSize,
|
|
16238
16234
|
idleTimeoutMillis: poolOptions.idleTimeout || defaults.poolIdleTimeout,
|
|
16239
16235
|
reapIntervalMillis: poolOptions.reapIntervalMillis || defaults.reapIntervalMillis,
|
|
@@ -16326,11 +16322,8 @@ function requireNewDatabase$7 () {
|
|
|
16326
16322
|
function newDatabase(connectionString, poolOptions) {
|
|
16327
16323
|
if (!connectionString)
|
|
16328
16324
|
throw new Error('Connection string cannot be empty');
|
|
16329
|
-
|
|
16330
|
-
|
|
16331
|
-
pool = newPool.bind(null,connectionString, poolOptions);
|
|
16332
|
-
else
|
|
16333
|
-
pool = newPool(connectionString, poolOptions);
|
|
16325
|
+
poolOptions = poolOptions || { min: 1 };
|
|
16326
|
+
var pool = newPool(connectionString, poolOptions);
|
|
16334
16327
|
|
|
16335
16328
|
let c = {poolFactory: pool, hostLocal, express};
|
|
16336
16329
|
|
|
@@ -16575,6 +16568,7 @@ function requireNewGenericPool$5 () {
|
|
|
16575
16568
|
function newGenericPool(connectionString, poolOptions) {
|
|
16576
16569
|
poolOptions = poolOptions || {};
|
|
16577
16570
|
var pool = genericPool.Pool({
|
|
16571
|
+
min: poolOptions.min || 0,
|
|
16578
16572
|
max: poolOptions.size || poolOptions.poolSize || defaults.poolSize,
|
|
16579
16573
|
idleTimeoutMillis: poolOptions.idleTimeout || defaults.poolIdleTimeout,
|
|
16580
16574
|
reapIntervalMillis: poolOptions.reapIntervalMillis || defaults.reapIntervalMillis,
|
|
@@ -16673,11 +16667,8 @@ function requireNewDatabase$6 () {
|
|
|
16673
16667
|
function newDatabase(connectionString, poolOptions) {
|
|
16674
16668
|
if (!connectionString)
|
|
16675
16669
|
throw new Error('Connection string cannot be empty');
|
|
16676
|
-
|
|
16677
|
-
|
|
16678
|
-
pool = newPool.bind(null,connectionString, poolOptions);
|
|
16679
|
-
else
|
|
16680
|
-
pool = newPool(connectionString, poolOptions);
|
|
16670
|
+
poolOptions = poolOptions || { min: 1 };
|
|
16671
|
+
var pool = newPool(connectionString, poolOptions);
|
|
16681
16672
|
|
|
16682
16673
|
let c = {poolFactory: pool, hostLocal, express};
|
|
16683
16674
|
|
|
@@ -16941,6 +16932,7 @@ function requireNewGenericPool$4 () {
|
|
|
16941
16932
|
function newGenericPool(connectionString, poolOptions) {
|
|
16942
16933
|
poolOptions = poolOptions || {};
|
|
16943
16934
|
var pool = genericPool.Pool({
|
|
16935
|
+
min: poolOptions.min || 0,
|
|
16944
16936
|
max: poolOptions.size || poolOptions.poolSize || defaults.poolSize,
|
|
16945
16937
|
idleTimeoutMillis: poolOptions.idleTimeout || defaults.poolIdleTimeout,
|
|
16946
16938
|
reapIntervalMillis: poolOptions.reapIntervalMillis || defaults.reapIntervalMillis,
|
|
@@ -17039,11 +17031,8 @@ function requireNewDatabase$5 () {
|
|
|
17039
17031
|
function newDatabase(connectionString, poolOptions) {
|
|
17040
17032
|
if (!connectionString)
|
|
17041
17033
|
throw new Error('Connection string cannot be empty');
|
|
17042
|
-
|
|
17043
|
-
|
|
17044
|
-
pool = newPool.bind(null,connectionString, poolOptions);
|
|
17045
|
-
else
|
|
17046
|
-
pool = newPool(connectionString, poolOptions);
|
|
17034
|
+
poolOptions = poolOptions || { min: 1 };
|
|
17035
|
+
var pool = newPool(connectionString, poolOptions);
|
|
17047
17036
|
|
|
17048
17037
|
let c = {poolFactory: pool, hostLocal, express};
|
|
17049
17038
|
|
|
@@ -17304,6 +17293,7 @@ function requireNewGenericPool$3 () {
|
|
|
17304
17293
|
poolOptions = poolOptions || {};
|
|
17305
17294
|
// @ts-ignore
|
|
17306
17295
|
var pool = genericPool.Pool({
|
|
17296
|
+
min: poolOptions.min || 0,
|
|
17307
17297
|
max: 1,
|
|
17308
17298
|
idleTimeoutMillis: poolOptions.idleTimeout || defaults.poolIdleTimeout,
|
|
17309
17299
|
reapIntervalMillis: poolOptions.reapIntervalMillis || defaults.reapIntervalMillis,
|
|
@@ -17388,11 +17378,8 @@ function requireNewDatabase$4 () {
|
|
|
17388
17378
|
function newDatabase(d1Database, poolOptions) {
|
|
17389
17379
|
if (!d1Database)
|
|
17390
17380
|
throw new Error('Missing d1Database');
|
|
17391
|
-
|
|
17392
|
-
|
|
17393
|
-
pool = newPool.bind(null,d1Database, poolOptions);
|
|
17394
|
-
else
|
|
17395
|
-
pool = newPool(d1Database, poolOptions);
|
|
17381
|
+
poolOptions = poolOptions || { min: 1 };
|
|
17382
|
+
var pool = newPool(d1Database, poolOptions);
|
|
17396
17383
|
|
|
17397
17384
|
let c = {poolFactory: pool, hostLocal, express};
|
|
17398
17385
|
|
|
@@ -18004,6 +17991,7 @@ function requireNewGenericPool$2 () {
|
|
|
18004
17991
|
function newGenericPool(connectionString, poolOptions) {
|
|
18005
17992
|
poolOptions = poolOptions || {};
|
|
18006
17993
|
var pool = genericPool.Pool({
|
|
17994
|
+
min: poolOptions.min || 0,
|
|
18007
17995
|
max: poolOptions.size || poolOptions.poolSize || defaults.poolSize,
|
|
18008
17996
|
idleTimeoutMillis: poolOptions.idleTimeout || defaults.poolIdleTimeout,
|
|
18009
17997
|
reapIntervalMillis: poolOptions.reapIntervalMillis || defaults.reapIntervalMillis,
|
|
@@ -18104,11 +18092,8 @@ function requireNewDatabase$3 () {
|
|
|
18104
18092
|
function newDatabase(connectionString, poolOptions) {
|
|
18105
18093
|
if (!connectionString)
|
|
18106
18094
|
throw new Error('Connection string cannot be empty');
|
|
18107
|
-
|
|
18108
|
-
|
|
18109
|
-
pool = newPool.bind(null, connectionString, poolOptions);
|
|
18110
|
-
else
|
|
18111
|
-
pool = newPool(connectionString, poolOptions);
|
|
18095
|
+
poolOptions = poolOptions || { min: 1 };
|
|
18096
|
+
var pool = newPool(connectionString, poolOptions);
|
|
18112
18097
|
|
|
18113
18098
|
let c = { poolFactory: pool, hostLocal, express };
|
|
18114
18099
|
|
|
@@ -18830,6 +18815,7 @@ function requireNewGenericPool$1 () {
|
|
|
18830
18815
|
connectionString.options = { ...connectionString.options, ...{ useColumnNames: true } };
|
|
18831
18816
|
poolOptions = poolOptions || {};
|
|
18832
18817
|
var pool = genericPool.Pool({
|
|
18818
|
+
min: poolOptions.min || 0,
|
|
18833
18819
|
max: poolOptions.size || poolOptions.poolSize || defaults.poolSize,
|
|
18834
18820
|
idleTimeoutMillis: poolOptions.idleTimeout || defaults.poolIdleTimeout,
|
|
18835
18821
|
reapIntervalMillis: poolOptions.reapIntervalMillis || defaults.reapIntervalMillis,
|
|
@@ -18932,11 +18918,8 @@ function requireNewDatabase$2 () {
|
|
|
18932
18918
|
function newDatabase(connectionString, poolOptions) {
|
|
18933
18919
|
if (!connectionString)
|
|
18934
18920
|
throw new Error('Connection string cannot be empty');
|
|
18935
|
-
|
|
18936
|
-
|
|
18937
|
-
pool = newPool.bind(null, connectionString, poolOptions);
|
|
18938
|
-
else
|
|
18939
|
-
pool = newPool(connectionString, poolOptions);
|
|
18921
|
+
poolOptions = poolOptions || { min: 1 };
|
|
18922
|
+
var pool = newPool(connectionString, poolOptions);
|
|
18940
18923
|
|
|
18941
18924
|
let c = { poolFactory: pool, hostLocal, express };
|
|
18942
18925
|
|
|
@@ -19527,11 +19510,8 @@ function requireNewDatabase$1 () {
|
|
|
19527
19510
|
function newDatabase(connectionString, poolOptions) {
|
|
19528
19511
|
if (!connectionString)
|
|
19529
19512
|
throw new Error('Connection string cannot be empty');
|
|
19530
|
-
|
|
19531
|
-
|
|
19532
|
-
pool = newPool.bind(null,connectionString, poolOptions);
|
|
19533
|
-
else
|
|
19534
|
-
pool = newPool(connectionString, poolOptions);
|
|
19513
|
+
poolOptions = poolOptions || { min: 1 };
|
|
19514
|
+
var pool = newPool(connectionString, poolOptions);
|
|
19535
19515
|
|
|
19536
19516
|
let c = {poolFactory: pool, hostLocal, express};
|
|
19537
19517
|
|
|
@@ -20211,6 +20191,7 @@ function requireNewGenericPool () {
|
|
|
20211
20191
|
function newGenericPool(connectionString, poolOptions) {
|
|
20212
20192
|
poolOptions = poolOptions || {};
|
|
20213
20193
|
var pool = genericPool.Pool({
|
|
20194
|
+
min: poolOptions.min || 0,
|
|
20214
20195
|
max: poolOptions.size || poolOptions.poolSize || defaults.poolSize,
|
|
20215
20196
|
idleTimeoutMillis: poolOptions.idleTimeout || defaults.poolIdleTimeout,
|
|
20216
20197
|
reapIntervalMillis: poolOptions.reapIntervalMillis || defaults.reapIntervalMillis,
|
|
@@ -20313,11 +20294,8 @@ function requireNewDatabase () {
|
|
|
20313
20294
|
function newDatabase(connectionString, poolOptions) {
|
|
20314
20295
|
if (!connectionString)
|
|
20315
20296
|
throw new Error('Connection string cannot be empty');
|
|
20316
|
-
|
|
20317
|
-
|
|
20318
|
-
pool = newPool.bind(null, connectionString, poolOptions);
|
|
20319
|
-
else
|
|
20320
|
-
pool = newPool(connectionString, poolOptions);
|
|
20297
|
+
poolOptions = poolOptions || { min: 1 };
|
|
20298
|
+
var pool = newPool(connectionString, poolOptions);
|
|
20321
20299
|
|
|
20322
20300
|
let c = { poolFactory: pool, hostLocal, express };
|
|
20323
20301
|
|
package/docs/changelog.md
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
## Changelog
|
|
2
|
+
__4.7.0__
|
|
3
|
+
Support for [PGLite](https://pglite.dev/). See [#124](https://github.com/alfateam/issues/124)
|
|
4
|
+
__4.6.3__
|
|
5
|
+
Bugfix: Chained Reference relation throws if first one is null. See [#126](https://github.com/alfateam/issues/126)
|
|
6
|
+
__4.6.2__
|
|
7
|
+
Bugfix: crashed when combining endsWith filter with other filter: e.g. `endsWith('foo').or(...)`
|
|
8
|
+
__4.6.1__
|
|
9
|
+
Bugfix: No intellisense when running in browser mode . See [#125](https://github.com/alfateam/issues/125)
|
|
2
10
|
__4.6.0__
|
|
3
11
|
Support for Deno and Bun.
|
|
4
12
|
Using builtin sqlite for Node22++.
|
package/package.json
CHANGED
package/src/bunPg/newDatabase.js
CHANGED
|
@@ -15,11 +15,8 @@ let setSessionSingleton = require('../table/setSessionSingleton');
|
|
|
15
15
|
function newDatabase(connectionString, poolOptions) {
|
|
16
16
|
if (!connectionString)
|
|
17
17
|
throw new Error('Connection string cannot be empty');
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
pool = newPool.bind(null, connectionString, poolOptions);
|
|
21
|
-
else
|
|
22
|
-
pool = newPool(connectionString, poolOptions);
|
|
18
|
+
poolOptions = poolOptions || { min: 1 };
|
|
19
|
+
var pool = newPool(connectionString, poolOptions);
|
|
23
20
|
|
|
24
21
|
let c = { poolFactory: pool, hostLocal, express };
|
|
25
22
|
|
|
@@ -29,6 +29,7 @@ function newPgPool(connectionString, poolOptions = {}) {
|
|
|
29
29
|
|
|
30
30
|
//@ts-ignore
|
|
31
31
|
const pool = genericPool.Pool({
|
|
32
|
+
min: poolOptions.min || 0,
|
|
32
33
|
max: poolOptions.size || poolOptions.poolSize || defaults.poolSize,
|
|
33
34
|
idleTimeoutMillis: poolOptions.idleTimeout || defaults.poolIdleTimeout,
|
|
34
35
|
reapIntervalMillis: poolOptions.reapIntervalMillis || defaults.reapIntervalMillis,
|
|
@@ -13,11 +13,8 @@ let setSessionSingleton = require('../table/setSessionSingleton');
|
|
|
13
13
|
function newDatabase(connectionString, poolOptions) {
|
|
14
14
|
if (!connectionString)
|
|
15
15
|
throw new Error('Connection string cannot be empty');
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
pool = newPool.bind(null,connectionString, poolOptions);
|
|
19
|
-
else
|
|
20
|
-
pool = newPool(connectionString, poolOptions);
|
|
16
|
+
poolOptions = poolOptions || { min: 1 };
|
|
17
|
+
var pool = newPool(connectionString, poolOptions);
|
|
21
18
|
|
|
22
19
|
let c = {poolFactory: pool, hostLocal, express};
|
|
23
20
|
|
|
@@ -7,6 +7,7 @@ var Database;
|
|
|
7
7
|
function newGenericPool(connectionString, poolOptions) {
|
|
8
8
|
poolOptions = poolOptions || {};
|
|
9
9
|
var pool = genericPool.Pool({
|
|
10
|
+
min: poolOptions.min || 0,
|
|
10
11
|
max: poolOptions.size || poolOptions.poolSize || defaults.poolSize,
|
|
11
12
|
idleTimeoutMillis: poolOptions.idleTimeout || defaults.poolIdleTimeout,
|
|
12
13
|
reapIntervalMillis: poolOptions.reapIntervalMillis || defaults.reapIntervalMillis,
|
package/src/client/index.js
CHANGED
|
@@ -65,6 +65,11 @@ function rdbClient(options = {}) {
|
|
|
65
65
|
client.http = onProvider.bind(null, 'http');//todo
|
|
66
66
|
client.mysql = onProvider.bind(null, 'mysql');
|
|
67
67
|
client.express = express;
|
|
68
|
+
client.close = close;
|
|
69
|
+
|
|
70
|
+
function close() {
|
|
71
|
+
return client.db.end ? client.db.end() : Promise.resolve();
|
|
72
|
+
}
|
|
68
73
|
|
|
69
74
|
function onProvider(name, ...args) {
|
|
70
75
|
let db = providers[name].apply(null, args);
|
package/src/d1/newDatabase.js
CHANGED
|
@@ -13,11 +13,8 @@ let setSessionSingleton = require('../table/setSessionSingleton');
|
|
|
13
13
|
function newDatabase(d1Database, poolOptions) {
|
|
14
14
|
if (!d1Database)
|
|
15
15
|
throw new Error('Missing d1Database');
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
pool = newPool.bind(null,d1Database, poolOptions);
|
|
19
|
-
else
|
|
20
|
-
pool = newPool(d1Database, poolOptions);
|
|
16
|
+
poolOptions = poolOptions || { min: 1 };
|
|
17
|
+
var pool = newPool(d1Database, poolOptions);
|
|
21
18
|
|
|
22
19
|
let c = {poolFactory: pool, hostLocal, express};
|
|
23
20
|
|
|
@@ -6,6 +6,7 @@ function newGenericPool(d1Database, poolOptions) {
|
|
|
6
6
|
poolOptions = poolOptions || {};
|
|
7
7
|
// @ts-ignore
|
|
8
8
|
var pool = genericPool.Pool({
|
|
9
|
+
min: poolOptions.min || 0,
|
|
9
10
|
max: 1,
|
|
10
11
|
idleTimeoutMillis: poolOptions.idleTimeout || defaults.poolIdleTimeout,
|
|
11
12
|
reapIntervalMillis: poolOptions.reapIntervalMillis || defaults.reapIntervalMillis,
|
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]
|
|
342
|
-
|
|
341
|
+
if (resultRows[i])
|
|
342
|
+
resultRows[i][name] = subRow;
|
|
343
343
|
}
|
|
344
344
|
};
|
|
345
345
|
|
package/src/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ declare function r(config: r.Config): unknown;
|
|
|
11
11
|
declare namespace r {
|
|
12
12
|
|
|
13
13
|
function table(name: string): Table;
|
|
14
|
-
function
|
|
14
|
+
function close(): Promise<void>;
|
|
15
15
|
function d1(database: D1Database, options?: PoolOptions): Pool;
|
|
16
16
|
function postgres(connectionString: string, options?: PoolOptions): Pool;
|
|
17
17
|
function pglite(config?: PGliteOptions | string | undefined, options?: PoolOptions): Pool;
|
package/src/map.d.ts
CHANGED
package/src/mssql/newDatabase.js
CHANGED
|
@@ -13,11 +13,8 @@ let setSessionSingleton = require('../table/setSessionSingleton');
|
|
|
13
13
|
function newDatabase(connectionString, poolOptions) {
|
|
14
14
|
if (!connectionString)
|
|
15
15
|
throw new Error('Connection string cannot be empty');
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
pool = newPool.bind(null, connectionString, poolOptions);
|
|
19
|
-
else
|
|
20
|
-
pool = newPool(connectionString, poolOptions);
|
|
16
|
+
poolOptions = poolOptions || { min: 1 };
|
|
17
|
+
var pool = newPool(connectionString, poolOptions);
|
|
21
18
|
|
|
22
19
|
let c = { poolFactory: pool, hostLocal, express };
|
|
23
20
|
|
|
@@ -8,6 +8,7 @@ var mssql;
|
|
|
8
8
|
function newGenericPool(connectionString, poolOptions) {
|
|
9
9
|
poolOptions = poolOptions || {};
|
|
10
10
|
var pool = genericPool.Pool({
|
|
11
|
+
min: poolOptions.min || 0,
|
|
11
12
|
max: poolOptions.size || poolOptions.poolSize || defaults.poolSize,
|
|
12
13
|
idleTimeoutMillis: poolOptions.idleTimeout || defaults.poolIdleTimeout,
|
|
13
14
|
reapIntervalMillis: poolOptions.reapIntervalMillis || defaults.reapIntervalMillis,
|
package/src/mySql/newDatabase.js
CHANGED
|
@@ -13,11 +13,8 @@ let setSessionSingleton = require('../table/setSessionSingleton');
|
|
|
13
13
|
function newDatabase(connectionString, poolOptions) {
|
|
14
14
|
if (!connectionString)
|
|
15
15
|
throw new Error('Connection string cannot be empty');
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
pool = newPool.bind(null, connectionString, poolOptions);
|
|
19
|
-
else
|
|
20
|
-
pool = newPool(connectionString, poolOptions);
|
|
16
|
+
poolOptions = poolOptions || { min: 1 };
|
|
17
|
+
var pool = newPool(connectionString, poolOptions);
|
|
21
18
|
|
|
22
19
|
let c = { poolFactory: pool, hostLocal, express };
|
|
23
20
|
|
|
@@ -11,6 +11,7 @@ function newGenericPool(connectionString, poolOptions) {
|
|
|
11
11
|
connectionString.dateStrings = true;
|
|
12
12
|
poolOptions = poolOptions || {};
|
|
13
13
|
var pool = genericPool.Pool({
|
|
14
|
+
min: poolOptions.min || 0,
|
|
14
15
|
max: poolOptions.size || poolOptions.poolSize || defaults.poolSize,
|
|
15
16
|
idleTimeoutMillis: poolOptions.idleTimeout || defaults.poolIdleTimeout,
|
|
16
17
|
reapIntervalMillis: poolOptions.reapIntervalMillis || defaults.reapIntervalMillis,
|
|
@@ -13,11 +13,8 @@ let setSessionSingleton = require('../table/setSessionSingleton');
|
|
|
13
13
|
function newDatabase(connectionString, poolOptions) {
|
|
14
14
|
if (!connectionString)
|
|
15
15
|
throw new Error('Connection string cannot be empty');
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
pool = newPool.bind(null,connectionString, poolOptions);
|
|
19
|
-
else
|
|
20
|
-
pool = newPool(connectionString, poolOptions);
|
|
16
|
+
poolOptions = poolOptions || { min: 1 };
|
|
17
|
+
var pool = newPool(connectionString, poolOptions);
|
|
21
18
|
|
|
22
19
|
let c = {poolFactory: pool, hostLocal, express};
|
|
23
20
|
|
|
@@ -8,6 +8,7 @@ function newGenericPool(connectionString, poolOptions) {
|
|
|
8
8
|
|
|
9
9
|
poolOptions = poolOptions || {};
|
|
10
10
|
var pool = genericPool.Pool({
|
|
11
|
+
min: poolOptions.min || 0,
|
|
11
12
|
max: poolOptions.size || poolOptions.poolSize || defaults.poolSize,
|
|
12
13
|
idleTimeoutMillis: poolOptions.idleTimeout || defaults.poolIdleTimeout,
|
|
13
14
|
reapIntervalMillis: poolOptions.reapIntervalMillis || defaults.reapIntervalMillis,
|
|
@@ -13,11 +13,8 @@ let setSessionSingleton = require('../table/setSessionSingleton');
|
|
|
13
13
|
function newDatabase(connectionString, poolOptions) {
|
|
14
14
|
if (!connectionString)
|
|
15
15
|
throw new Error('Connection string cannot be empty');
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
pool = newPool.bind(null, connectionString, poolOptions);
|
|
19
|
-
else
|
|
20
|
-
pool = newPool(connectionString, poolOptions);
|
|
16
|
+
poolOptions = poolOptions || { min: 1 };
|
|
17
|
+
var pool = newPool(connectionString, poolOptions);
|
|
21
18
|
|
|
22
19
|
let c = { poolFactory: pool, hostLocal, express };
|
|
23
20
|
|
|
@@ -8,6 +8,7 @@ var oracle;
|
|
|
8
8
|
function newGenericPool(connectionString, poolOptions) {
|
|
9
9
|
poolOptions = poolOptions || {};
|
|
10
10
|
var pool = genericPool.Pool({
|
|
11
|
+
min: poolOptions.min || 0,
|
|
11
12
|
max: poolOptions.size || poolOptions.poolSize || defaults.poolSize,
|
|
12
13
|
idleTimeoutMillis: poolOptions.idleTimeout || defaults.poolIdleTimeout,
|
|
13
14
|
reapIntervalMillis: poolOptions.reapIntervalMillis || defaults.reapIntervalMillis,
|
package/src/pg/newDatabase.js
CHANGED
|
@@ -15,11 +15,8 @@ let setSessionSingleton = require('../table/setSessionSingleton');
|
|
|
15
15
|
function newDatabase(connectionString, poolOptions) {
|
|
16
16
|
if (!connectionString)
|
|
17
17
|
throw new Error('Connection string cannot be empty');
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
pool = newPool.bind(null, connectionString, poolOptions);
|
|
21
|
-
else
|
|
22
|
-
pool = newPool(connectionString, poolOptions);
|
|
18
|
+
poolOptions = poolOptions || { min: 1 };
|
|
19
|
+
var pool = newPool(connectionString, poolOptions);
|
|
23
20
|
|
|
24
21
|
let c = { poolFactory: pool, hostLocal, express };
|
|
25
22
|
|
package/src/pg/pool/newPgPool.js
CHANGED
|
@@ -12,6 +12,7 @@ function newPgPool(connectionString, poolOptions) {
|
|
|
12
12
|
|
|
13
13
|
// @ts-ignore
|
|
14
14
|
var pool = genericPool.Pool({
|
|
15
|
+
min: poolOptions.min || 0,
|
|
15
16
|
max: poolOptions.size || poolOptions.poolSize || defaults.poolSize,
|
|
16
17
|
idleTimeoutMillis: poolOptions.idleTimeout || defaults.poolIdleTimeout,
|
|
17
18
|
reapIntervalMillis: poolOptions.reapIntervalMillis || defaults.reapIntervalMillis,
|
|
@@ -13,11 +13,8 @@ let releaseDbClient = require('../table/releaseDbClient');
|
|
|
13
13
|
let setSessionSingleton = require('../table/setSessionSingleton');
|
|
14
14
|
|
|
15
15
|
function newDatabase(connectionString, poolOptions) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
pool = newPool.bind(null, connectionString, poolOptions);
|
|
19
|
-
else
|
|
20
|
-
pool = newPool(connectionString, poolOptions);
|
|
16
|
+
poolOptions = poolOptions || { min: 1 };
|
|
17
|
+
var pool = newPool(connectionString, poolOptions);
|
|
21
18
|
|
|
22
19
|
let c = { poolFactory: pool, hostLocal, express };
|
|
23
20
|
|
|
@@ -12,10 +12,8 @@ var quote = require('../pg/quote');
|
|
|
12
12
|
|
|
13
13
|
function newResolveTransaction(domain, pool, { readonly = false } = {}) {
|
|
14
14
|
var rdb = { poolFactory: pool };
|
|
15
|
-
if (!pool.connect)
|
|
15
|
+
if (!pool.connect)
|
|
16
16
|
pool = pool();
|
|
17
|
-
rdb.pool = pool;
|
|
18
|
-
}
|
|
19
17
|
|
|
20
18
|
rdb.engine = 'pg';
|
|
21
19
|
rdb.encodeDate = encodeDate;
|
|
@@ -11,6 +11,7 @@ function newPgPool(connectionString, poolOptions = {}) {
|
|
|
11
11
|
|
|
12
12
|
//@ts-ignore
|
|
13
13
|
const pool = genericPool.Pool({
|
|
14
|
+
min: poolOptions.min || 0,
|
|
14
15
|
max: poolOptions.size || poolOptions.poolSize || defaults.poolSize,
|
|
15
16
|
idleTimeoutMillis: poolOptions.idleTimeout || defaults.poolIdleTimeout,
|
|
16
17
|
reapIntervalMillis: poolOptions.reapIntervalMillis || defaults.reapIntervalMillis,
|
package/src/sap/newDatabase.js
CHANGED
|
@@ -13,11 +13,8 @@ let setSessionSingleton = require('../table/setSessionSingleton');
|
|
|
13
13
|
function newDatabase(connectionString, poolOptions) {
|
|
14
14
|
if (!connectionString)
|
|
15
15
|
throw new Error('Connection string cannot be empty');
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
pool = newPool.bind(null,connectionString, poolOptions);
|
|
19
|
-
else
|
|
20
|
-
pool = newPool(connectionString, poolOptions);
|
|
16
|
+
poolOptions = poolOptions || { min: 1 };
|
|
17
|
+
var pool = newPool(connectionString, poolOptions);
|
|
21
18
|
|
|
22
19
|
let c = {poolFactory: pool, hostLocal, express};
|
|
23
20
|
|
|
@@ -13,11 +13,8 @@ let setSessionSingleton = require('../table/setSessionSingleton');
|
|
|
13
13
|
function newDatabase(connectionString, poolOptions) {
|
|
14
14
|
if (!connectionString)
|
|
15
15
|
throw new Error('Connection string cannot be empty');
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
pool = newPool.bind(null,connectionString, poolOptions);
|
|
19
|
-
else
|
|
20
|
-
pool = newPool(connectionString, poolOptions);
|
|
16
|
+
poolOptions = poolOptions || { min: 1 };
|
|
17
|
+
var pool = newPool(connectionString, poolOptions);
|
|
21
18
|
|
|
22
19
|
let c = {poolFactory: pool, hostLocal, express};
|
|
23
20
|
|
|
@@ -7,6 +7,7 @@ var sqlite;
|
|
|
7
7
|
function newGenericPool(connectionString, poolOptions) {
|
|
8
8
|
poolOptions = poolOptions || {};
|
|
9
9
|
var pool = genericPool.Pool({
|
|
10
|
+
min: poolOptions.min || 0,
|
|
10
11
|
max: poolOptions.size || poolOptions.poolSize || defaults.poolSize,
|
|
11
12
|
idleTimeoutMillis: poolOptions.idleTimeout || defaults.poolIdleTimeout,
|
|
12
13
|
reapIntervalMillis: poolOptions.reapIntervalMillis || defaults.reapIntervalMillis,
|
|
@@ -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
|
}
|
|
@@ -13,11 +13,8 @@ let setSessionSingleton = require('../table/setSessionSingleton');
|
|
|
13
13
|
function newDatabase(connectionString, poolOptions) {
|
|
14
14
|
if (!connectionString)
|
|
15
15
|
throw new Error('Connection string cannot be empty');
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
pool = newPool.bind(null, connectionString, poolOptions);
|
|
19
|
-
else
|
|
20
|
-
pool = newPool(connectionString, poolOptions);
|
|
16
|
+
poolOptions = poolOptions || { min: 1 };
|
|
17
|
+
var pool = newPool(connectionString, poolOptions);
|
|
21
18
|
|
|
22
19
|
let c = { poolFactory: pool, hostLocal, express };
|
|
23
20
|
|
|
@@ -13,6 +13,7 @@ function newGenericPool(connectionString, poolOptions) {
|
|
|
13
13
|
connectionString.options = { ...connectionString.options, ...{ useColumnNames: true } };
|
|
14
14
|
poolOptions = poolOptions || {};
|
|
15
15
|
var pool = genericPool.Pool({
|
|
16
|
+
min: poolOptions.min || 0,
|
|
16
17
|
max: poolOptions.size || poolOptions.poolSize || defaults.poolSize,
|
|
17
18
|
idleTimeoutMillis: poolOptions.idleTimeout || defaults.poolIdleTimeout,
|
|
18
19
|
reapIntervalMillis: poolOptions.reapIntervalMillis || defaults.reapIntervalMillis,
|