orange-orm 4.7.0-beta.1 → 4.7.0-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/README.md +11 -0
- package/dist/index.browser.mjs +896 -170
- package/dist/index.mjs +41 -63
- 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/index.d.ts +1 -1
- package/src/indexBrowser.js +9 -0
- 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/sqlite3/newDatabase.js +2 -5
- package/src/sqlite3/pool/newGenericPool.js +1 -0
- package/src/tedious/newDatabase.js +2 -5
- package/src/tedious/pool/newGenericPool.js +1 -0
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);
|
|
@@ -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
|
|
|
@@ -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/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/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/indexBrowser.js
CHANGED
|
@@ -3,6 +3,7 @@ const hostLocal = require('./hostLocal');
|
|
|
3
3
|
const client = require('./client/index.js');
|
|
4
4
|
const map = require('./client/map');
|
|
5
5
|
let _d1;
|
|
6
|
+
let _pglite;
|
|
6
7
|
|
|
7
8
|
var connectViaPool = function() {
|
|
8
9
|
return client.apply(null, arguments);
|
|
@@ -34,6 +35,14 @@ Object.defineProperty(connectViaPool, 'd1', {
|
|
|
34
35
|
}
|
|
35
36
|
});
|
|
36
37
|
|
|
38
|
+
Object.defineProperty(connectViaPool, 'pglite', {
|
|
39
|
+
get: function() {
|
|
40
|
+
if (!_pglite)
|
|
41
|
+
_pglite = require('./pglite/newDatabase');
|
|
42
|
+
return _pglite;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
37
46
|
connectViaPool.express = hostExpress.bind(null, hostLocal);
|
|
38
47
|
|
|
39
48
|
module.exports = connectViaPool;
|
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,
|
|
@@ -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,
|