orange-orm 4.5.0-beta.4 → 4.5.1-beta.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 +12 -12
- package/{src/client/index.mjs → dist/index.browser.mjs} +30 -9
- package/dist/index.mjs +20001 -0
- package/docs/docs.md +1 -0
- package/package.json +14 -4
- package/src/bunPg/newDatabase.js +137 -0
- package/src/bunPg/newPool.js +19 -0
- package/src/bunPg/pool/end.js +13 -0
- package/src/bunPg/pool/newPgPool.js +98 -0
- package/src/bunPg/wrapQuery.js +33 -0
- package/src/bunSqlite/newPool.js +19 -0
- package/src/bunSqlite/newTransaction.js +83 -0
- package/src/bunSqlite/pool/newGenericPool.js +55 -0
- package/src/bunSqlite/wrapQuery.js +23 -0
- package/src/index.js +16 -3
- package/src/merge-browser.js +9 -0
- package/src/merge-server.js +9 -0
- package/src/mssql/pool/newGenericPool.js +9 -2
- package/src/mySql/pool/newGenericPool.js +11 -2
- package/src/nodeSqlite/decodeBinary.js +9 -0
- package/src/nodeSqlite/encodeBinary.js +20 -0
- package/src/nodeSqlite/newDatabase.js +116 -0
- package/src/nodeSqlite/newPool.js +19 -0
- package/src/nodeSqlite/newTransaction.js +87 -0
- package/src/nodeSqlite/pool/newGenericPool.js +50 -0
- package/src/nodeSqlite/wrapQuery.js +23 -0
- package/src/oracle/pool/newGenericPool.js +13 -5
- package/src/pg/newDatabase.js +0 -5
- package/src/pg/pool/newPgPool.js +15 -3
- package/src/{client/rollup.config.js → rollup.config.browser.js} +1 -1
- package/src/rollup.config.server.js +32 -0
- package/src/runtimes.js +24 -0
- package/src/sqlite3/deleteFromSql.js +10 -0
- package/src/sqlite3/encodeBoolean.js +7 -0
- package/src/sqlite3/encodeBuffer.js +7 -0
- package/src/sqlite3/insert.js +21 -0
- package/src/sqlite3/insertSql.js +67 -0
- package/src/sqlite3/lastInsertedSql.js +12 -0
- package/src/sqlite3/limitAndOffset.js +18 -0
- package/src/sqlite3/newDatabase.js +116 -0
- package/src/sqlite3/newTransaction.js +83 -0
- package/src/sqlite3/pool/end.js +13 -0
- package/src/{sqlite → sqlite3}/pool/newGenericPool.js +10 -2
- package/src/sqlite3/quote.js +1 -0
- package/src/sqlite3/selectForUpdateSql.js +5 -0
- package/src/table/column/binary/newDecode.js +13 -2
- package/src/table/column/binary/newEncode.js +16 -6
- package/src/table/resultToRows/newDecodeDbRow.js +1 -1
- package/src/tedious/pool/newGenericPool.js +8 -2
- package/src/tedious/wrapQuery.js +40 -17
- package/src/client/merge.js +0 -9
- /package/src/{sqlite → bunSqlite}/newDatabase.js +0 -0
- /package/src/{sqlite → sqlite3}/newPool.js +0 -0
- /package/src/{sqlite → sqlite3}/wrapQuery.js +0 -0
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
The ultimate Object Relational Mapper for Node.js and Typescript, offering seamless integration with a variety of popular databases. Whether you're building applications in TypeScript or JavaScript, including both CommonJS and ECMAScript, Orange ORM has got you covered.
|
|
6
6
|
|
|
7
7
|
[](https://www.npmjs.org/package/orange-orm)
|
|
8
|
-
[](https://github.com/alfateam/orange-orm/actions)
|
|
9
9
|
[](https://github.com/alfateam/orange-orm/actions)
|
|
10
10
|
[](https://github.com/alfateam/orange-orm)
|
|
11
11
|
[](https://github.com/alfateam/orange-orm/discussions)
|
|
@@ -22,16 +22,16 @@ The ultimate Object Relational Mapper for Node.js and Typescript, offering seaml
|
|
|
22
22
|
- **TypeScript and JavaScript Support**: Orange fully supports both TypeScript and JavaScript, allowing you to leverage the benefits of static typing and modern ECMAScript features.
|
|
23
23
|
- **Works in the Browser**: You can securely use Orange in the browser by utilizing the Express.js plugin, which serves to safeguard sensitive database credentials from exposure at the client level and protect against SQL injection. This method mirrors a traditional REST API, augmented with advanced TypeScript tooling for enhanced functionality.
|
|
24
24
|
|
|
25
|
-
## Supported Databases
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
✅
|
|
29
|
-
✅
|
|
30
|
-
✅
|
|
31
|
-
✅
|
|
32
|
-
✅
|
|
33
|
-
✅
|
|
34
|
-
|
|
25
|
+
## Supported Databases and Runtimes
|
|
26
|
+
| | Node | Deno | Bun |Cloudflare |
|
|
27
|
+
| ------------- | :-----: | :-----: | :-----: | :-----: |
|
|
28
|
+
| Postgres | ✅ | ✅ | ✅ | ✅
|
|
29
|
+
| MS SQL | ✅ | | ✅ |
|
|
30
|
+
| MySQL | ✅ | ✅ | ✅ |
|
|
31
|
+
| Oracle | ✅ | ✅ | ✅ |
|
|
32
|
+
| SAP ASE | ✅ | | |
|
|
33
|
+
| SQLite | ✅ | ✅ | ✅ |
|
|
34
|
+
| Cloudflare D1 | | | | ✅
|
|
35
35
|
|
|
36
36
|
This is the _Modern Typescript Documentation_. Are you looking for the [_Classic Documentation_](https://github.com/alfateam/orange-orm/blob/master/docs/docs.md) ?
|
|
37
37
|
|
|
@@ -381,7 +381,7 @@ database_name = "<your-name-for-the-database>"
|
|
|
381
381
|
database_id = "<your-guid-for-the-database>"
|
|
382
382
|
```
|
|
383
383
|
|
|
384
|
-
<sub>📄
|
|
384
|
+
<sub>📄 src/index.ts</sub>
|
|
385
385
|
```javascript
|
|
386
386
|
import map from './map';
|
|
387
387
|
|
|
@@ -5137,29 +5137,39 @@ function requireNewEncode () {
|
|
|
5137
5137
|
hasRequiredNewEncode = 1;
|
|
5138
5138
|
var purify = requirePurify();
|
|
5139
5139
|
var newParam = requireNewParameterized();
|
|
5140
|
+
var getSessionSingleton = requireGetSessionSingleton();
|
|
5140
5141
|
|
|
5141
5142
|
function _new(_column) {
|
|
5142
5143
|
|
|
5143
|
-
function encode(
|
|
5144
|
+
function encode(context, value) {
|
|
5144
5145
|
value = purify(value);
|
|
5145
5146
|
if (value === null)
|
|
5146
5147
|
return newParam('null');
|
|
5147
|
-
|
|
5148
|
+
|
|
5149
|
+
var encodeCore = getSessionSingleton(context, 'encodeBinary') || encodeDefault;
|
|
5150
|
+
const enc = encodeCore(value);
|
|
5151
|
+
return newParam('?', [enc]);
|
|
5148
5152
|
}
|
|
5149
|
-
encode.unsafe = function(
|
|
5153
|
+
encode.unsafe = function(context, value) {
|
|
5150
5154
|
value = purify(value);
|
|
5151
5155
|
if (value === null)
|
|
5152
5156
|
return 'null';
|
|
5153
|
-
|
|
5157
|
+
var encodeCore = getSessionSingleton(context, 'encodeBinary') || encodeDefault;
|
|
5158
|
+
return encodeCore(value);
|
|
5154
5159
|
};
|
|
5155
5160
|
|
|
5156
|
-
encode.direct = function(
|
|
5157
|
-
|
|
5161
|
+
encode.direct = function(context, value) {
|
|
5162
|
+
var encodeCore = getSessionSingleton(context, 'encodeBinary') || encodeDefault;
|
|
5163
|
+
return encodeCore(value);
|
|
5158
5164
|
};
|
|
5159
5165
|
|
|
5160
5166
|
return encode;
|
|
5161
5167
|
}
|
|
5162
5168
|
|
|
5169
|
+
function encodeDefault(base64) {
|
|
5170
|
+
return Buffer.from(base64, 'base64');
|
|
5171
|
+
}
|
|
5172
|
+
|
|
5163
5173
|
newEncode = _new;
|
|
5164
5174
|
return newEncode;
|
|
5165
5175
|
}
|
|
@@ -5171,19 +5181,30 @@ function requireNewDecode () {
|
|
|
5171
5181
|
if (hasRequiredNewDecode) return newDecode;
|
|
5172
5182
|
hasRequiredNewDecode = 1;
|
|
5173
5183
|
var newDecodeCore = requireNewDecodeCore();
|
|
5184
|
+
var getSessionSingleton = requireGetSessionSingleton();
|
|
5174
5185
|
|
|
5175
5186
|
function _new(column) {
|
|
5176
5187
|
var decodeCore = newDecodeCore(column);
|
|
5177
5188
|
|
|
5178
5189
|
return function(context, value) {
|
|
5190
|
+
|
|
5191
|
+
var toBase64 = getSessionSingleton(context, 'decodeBinary') || toBase64Default;
|
|
5192
|
+
|
|
5179
5193
|
value = decodeCore(context, value);
|
|
5180
5194
|
if (value === null)
|
|
5181
5195
|
return value;
|
|
5182
|
-
else
|
|
5183
|
-
|
|
5196
|
+
else {
|
|
5197
|
+
const ret = toBase64(value);
|
|
5198
|
+
return ret;
|
|
5199
|
+
}
|
|
5184
5200
|
};
|
|
5185
5201
|
}
|
|
5186
5202
|
|
|
5203
|
+
function toBase64Default(buffer) {
|
|
5204
|
+
return buffer.toString('base64');
|
|
5205
|
+
|
|
5206
|
+
}
|
|
5207
|
+
|
|
5187
5208
|
newDecode = _new;
|
|
5188
5209
|
return newDecode;
|
|
5189
5210
|
}
|
|
@@ -7993,7 +8014,7 @@ function requireNewDecodeDbRow () {
|
|
|
7993
8014
|
for (let i = 0; i < numberOfColumns; i++) {
|
|
7994
8015
|
let index = offset + i;
|
|
7995
8016
|
let key = keys[index];
|
|
7996
|
-
if (row[key] !== undefined)
|
|
8017
|
+
if (row[key] !== undefined && !isInsert)
|
|
7997
8018
|
row[key] = columns[i].decode(context, row[key]);
|
|
7998
8019
|
if (shouldValidate && columns[i].validate)
|
|
7999
8020
|
columns[i].validate(row[key], row, isInsert);
|