orange-orm 4.7.14 → 4.7.15-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 +7 -2
- package/SECURITY.md +2 -1
- package/dist/index.browser.mjs +4 -0
- package/dist/index.mjs +21 -7
- package/docs/changelog.md +2 -0
- package/package.json +156 -155
- package/src/getManyDto.js +4 -0
- package/src/index.js +1 -1
- package/src/mssql/wrapQuery.js +3 -4
- package/src/nodeSqlite/wrapQuery.js +13 -2
- package/.dockerignore +0 -1
- package/.eslintignore +0 -2
- package/.eslintrc.js +0 -45
- package/.gitattributes +0 -3
- package/CNAME +0 -1
- package/src/package.json +0 -5
- package/vitest.config.js +0 -17
package/README.md
CHANGED
|
@@ -222,7 +222,12 @@ Because of a peculiarity in SQLite, which only allows one statement execution at
|
|
|
222
222
|
import map from './map';
|
|
223
223
|
const db = map.sqlite('demo.db');
|
|
224
224
|
|
|
225
|
-
const sql = `DROP TABLE IF EXISTS deliveryAddress;
|
|
225
|
+
const sql = `DROP TABLE IF EXISTS deliveryAddress;
|
|
226
|
+
DROP TABLE IF EXISTS package;
|
|
227
|
+
DROP TABLE IF EXISTS orderLine;
|
|
228
|
+
DROP TABLE IF EXISTS _order;
|
|
229
|
+
DROP TABLE IF EXISTS customer;
|
|
230
|
+
|
|
226
231
|
CREATE TABLE customer (
|
|
227
232
|
id INTEGER PRIMARY KEY,
|
|
228
233
|
name TEXT,
|
|
@@ -931,7 +936,7 @@ async function update() {
|
|
|
931
936
|
```
|
|
932
937
|
</details>
|
|
933
938
|
|
|
934
|
-
<details><summary><strong>Upserting rows</strong></summary>
|
|
939
|
+
<details id="upserting-rows"><summary><strong>Upserting rows</strong></summary>
|
|
935
940
|
It is possible to perform 'upserts' by taking advantage of the 'overwrite' strategy.
|
|
936
941
|
|
|
937
942
|
Currently, there are three concurrency strategies:
|
package/SECURITY.md
CHANGED
package/dist/index.browser.mjs
CHANGED
|
@@ -11085,6 +11085,10 @@ function requireGetManyDto$1 () {
|
|
|
11085
11085
|
const extractKey = createExtractKey(leg);
|
|
11086
11086
|
const extractFromMap = createExtractFromMap(rowsMap, table._primaryColumns);
|
|
11087
11087
|
|
|
11088
|
+
if (span._ids.length === 0) {
|
|
11089
|
+
return;
|
|
11090
|
+
}
|
|
11091
|
+
|
|
11088
11092
|
// If maxRows is defined, chunk the IDs before calling getManyDto
|
|
11089
11093
|
if (maxRows) {
|
|
11090
11094
|
const chunkedIds = chunk(span._ids, maxRows);
|
package/dist/index.mjs
CHANGED
|
@@ -11086,6 +11086,10 @@ function requireGetManyDto$1 () {
|
|
|
11086
11086
|
const extractKey = createExtractKey(leg);
|
|
11087
11087
|
const extractFromMap = createExtractFromMap(rowsMap, table._primaryColumns);
|
|
11088
11088
|
|
|
11089
|
+
if (span._ids.length === 0) {
|
|
11090
|
+
return;
|
|
11091
|
+
}
|
|
11092
|
+
|
|
11089
11093
|
// If maxRows is defined, chunk the IDs before calling getManyDto
|
|
11090
11094
|
if (maxRows) {
|
|
11091
11095
|
const chunkedIds = chunk(span._ids, maxRows);
|
|
@@ -16034,9 +16038,16 @@ var hasRequiredWrapQuery$6;
|
|
|
16034
16038
|
function requireWrapQuery$6 () {
|
|
16035
16039
|
if (hasRequiredWrapQuery$6) return wrapQuery_1$6;
|
|
16036
16040
|
hasRequiredWrapQuery$6 = 1;
|
|
16037
|
-
|
|
16041
|
+
const log = requireLog();
|
|
16042
|
+
const connectionCache = new WeakMap();
|
|
16038
16043
|
|
|
16039
16044
|
function wrapQuery(_context, connection) {
|
|
16045
|
+
let statementCache = connectionCache.get(connection);
|
|
16046
|
+
if (!statementCache) {
|
|
16047
|
+
statementCache = new Map();
|
|
16048
|
+
connectionCache.set(connection, statementCache);
|
|
16049
|
+
}
|
|
16050
|
+
|
|
16040
16051
|
return runQuery;
|
|
16041
16052
|
|
|
16042
16053
|
function runQuery(query, onCompleted) {
|
|
@@ -16045,7 +16056,11 @@ function requireWrapQuery$6 () {
|
|
|
16045
16056
|
var sql = query.sql();
|
|
16046
16057
|
log.emitQuery({ sql, parameters: params });
|
|
16047
16058
|
|
|
16048
|
-
|
|
16059
|
+
let statement = statementCache.get(sql);
|
|
16060
|
+
if (!statement) {
|
|
16061
|
+
statement = connection.prepare(sql);
|
|
16062
|
+
statementCache.set(sql, statement);
|
|
16063
|
+
}
|
|
16049
16064
|
const rows = statement.all.apply(statement, params);
|
|
16050
16065
|
onCompleted(null, rows);
|
|
16051
16066
|
}
|
|
@@ -17724,7 +17739,6 @@ function requireWrapQuery$2 () {
|
|
|
17724
17739
|
const parameter = params[i];
|
|
17725
17740
|
|
|
17726
17741
|
if (typeof parameter === 'string') {
|
|
17727
|
-
const paramLength = parameter.length;
|
|
17728
17742
|
const byteLength = Buffer.from(parameter, 'utf8').length;
|
|
17729
17743
|
|
|
17730
17744
|
if (hasNonAsciiCharacters(parameter)) {
|
|
@@ -17733,10 +17747,10 @@ function requireWrapQuery$2 () {
|
|
|
17733
17747
|
if (isStoredProcCall) {
|
|
17734
17748
|
// For stored procedures, create a variable with exact lengths
|
|
17735
17749
|
const varName = `@hex_param_${i}`;
|
|
17736
|
-
const convertClause = `CONVERT(VARCHAR(${
|
|
17750
|
+
const convertClause = `CONVERT(VARCHAR(${byteLength}), CONVERT(VARBINARY(${byteLength}), 0x${hexValue}))`;
|
|
17737
17751
|
|
|
17738
17752
|
hexVariables.push({
|
|
17739
|
-
declaration: `DECLARE ${varName} VARCHAR(${
|
|
17753
|
+
declaration: `DECLARE ${varName} VARCHAR(${byteLength})`,
|
|
17740
17754
|
assignment: `SET ${varName} = ${convertClause}`
|
|
17741
17755
|
});
|
|
17742
17756
|
|
|
@@ -17746,7 +17760,7 @@ function requireWrapQuery$2 () {
|
|
|
17746
17760
|
});
|
|
17747
17761
|
} else {
|
|
17748
17762
|
// For regular queries, use inline conversion with exact lengths
|
|
17749
|
-
const convertClause = `CONVERT(VARCHAR(${
|
|
17763
|
+
const convertClause = `CONVERT(VARCHAR(${byteLength}), CONVERT(VARBINARY(${byteLength}), 0x${hexValue}))`;
|
|
17750
17764
|
replacements.push({
|
|
17751
17765
|
index: i,
|
|
17752
17766
|
replacement: convertClause
|
|
@@ -20719,7 +20733,7 @@ function requireSrc () {
|
|
|
20719
20733
|
Object.defineProperty(connectViaPool, 'sqlite', {
|
|
20720
20734
|
get: function() {
|
|
20721
20735
|
if (!_sqlite) {
|
|
20722
|
-
if (runtimes.deno || (runtimes.node && runtimes.node.major >=
|
|
20736
|
+
if (runtimes.deno || (runtimes.node && (runtimes.node.major > 22 || (runtimes.node.major === 22 && runtimes.node.minor >= 5))))
|
|
20723
20737
|
_sqlite = requireNewDatabase$7();
|
|
20724
20738
|
else if (runtimes.bun)
|
|
20725
20739
|
_sqlite = requireNewDatabase$6();
|
package/docs/changelog.md
CHANGED
package/package.json
CHANGED
|
@@ -1,165 +1,166 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
"test:bun": "bun test --timeout=30000 ./tests/*.bun.test.js",
|
|
54
|
-
"test:deno": "deno test --allow-all --unstable-detect-cjs ./tests/*.deno.test.js",
|
|
55
|
-
"test:all": "echo 'Running Node.js tests...' && npm run test:node && echo 'Running Bun tests...' && npm run test:bun && echo 'Running Deno tests...' && npm run test:deno && echo 'All tests completed!'",
|
|
56
|
-
"test:all:parallel": "concurrently \"npm:test:node\" \"npm:test:bun\" \"npm:test:deno\"",
|
|
57
|
-
"coverage": "vitest run --coverage.enabled --coverage.reporter='text-summary' --threads=false",
|
|
58
|
-
"testw": "vitest --threads=false update",
|
|
59
|
-
"tscheck": "tsc ./src/index.d.ts --module commonjs --target es2022 --noEmit true --strict true --esModuleInterop true",
|
|
60
|
-
"concat-server": "node ./src/merge-server.js",
|
|
61
|
-
"concat-browser": "node ./src/merge-browser.js",
|
|
62
|
-
"build": "npm run build-server && npm run build-browser",
|
|
63
|
-
"build-server": "rollup -c ./src/rollup.config.server.js && npm run concat-server",
|
|
64
|
-
"build-browser": "rollup -c ./src/rollup.config.browser.js && npm run concat-browser",
|
|
65
|
-
"lint": "eslint ./",
|
|
66
|
-
"fix": "eslint ./ --fix",
|
|
67
|
-
"owasp": "owasp-dependency-check --project \"MY_PROJECT\" --scan \"package-lock.json\" --exclude \"dependency-check-bin\" --out \"owasp\" --format HTML",
|
|
68
|
-
"beta": "npm publish --tag beta"
|
|
69
|
-
},
|
|
70
|
-
"dependencies": {
|
|
71
|
-
"@cloudflare/workers-types": "^4.20241106.0",
|
|
72
|
-
"@lroal/on-change": "^4.0.2",
|
|
73
|
-
"@tediousjs/connection-string": "^0.4.1",
|
|
74
|
-
"@types/express": "^4.17.13",
|
|
75
|
-
"@types/oracledb": "^6.0.4",
|
|
76
|
-
"@types/tedious": "^4.0.14",
|
|
77
|
-
"ajv": "^8.17.1",
|
|
78
|
-
"axios": "^1.6.2",
|
|
79
|
-
"fast-json-patch": "^3.1.1",
|
|
80
|
-
"findup-sync": "^5.0.0",
|
|
81
|
-
"glob": "^10.3.4 || ^11.0.2",
|
|
82
|
-
"module-definition": "^4.0.0 || ^5.0.0 || || ^6.0.0",
|
|
83
|
-
"rfdc": "^1.2.0",
|
|
84
|
-
"uuid": "^8.3.2 || ^9.0.0 || ^10.0.0 || ^11.1.0"
|
|
85
|
-
},
|
|
86
|
-
"peerDependencies": {
|
|
87
|
-
"@electric-sql/pglite": "^0.3.0",
|
|
88
|
-
"msnodesqlv8": "^4.1.0",
|
|
89
|
-
"mysql2": "^2.2.5 || ^3.9.4",
|
|
90
|
-
"oracledb": "^6.3.0",
|
|
91
|
-
"pg": "^8.5.1",
|
|
92
|
-
"pg-query-stream": "^3.3.2",
|
|
93
|
-
"sqlite3": "^5.0.2",
|
|
94
|
-
"tedious": "^15.1.2 || ^16.0.0 || ^18.1.0 || || ^19.0.0"
|
|
95
|
-
},
|
|
96
|
-
"peerDependenciesMeta": {
|
|
97
|
-
"pg": {
|
|
98
|
-
"optional": true
|
|
2
|
+
"name": "orange-orm",
|
|
3
|
+
"version": "4.7.15-beta.1",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"access": "public"
|
|
6
|
+
},
|
|
7
|
+
"main": "./src/index.js",
|
|
8
|
+
"module": "./dist/index.mjs",
|
|
9
|
+
"browser": "./dist/index.browser.mjs",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./src/index.d.ts",
|
|
13
|
+
"browser": "./dist/index.browser.mjs",
|
|
14
|
+
"import": "./dist/index.mjs",
|
|
15
|
+
"require": "./src/index.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"bin": {
|
|
19
|
+
"orange-orm": "bin/rdb.js"
|
|
20
|
+
},
|
|
21
|
+
"title": "Orange ORM",
|
|
22
|
+
"description": "Object Relational Mapper",
|
|
23
|
+
"keywords": [
|
|
24
|
+
"typescript orm",
|
|
25
|
+
"orm",
|
|
26
|
+
"sql",
|
|
27
|
+
"mySql",
|
|
28
|
+
"SQLite",
|
|
29
|
+
"MySQL",
|
|
30
|
+
"mssql",
|
|
31
|
+
"Microsoft Sql Server",
|
|
32
|
+
"PGlite",
|
|
33
|
+
"Cloudflare D1",
|
|
34
|
+
"PostgreSql",
|
|
35
|
+
"Postgres",
|
|
36
|
+
"pg",
|
|
37
|
+
"sap",
|
|
38
|
+
"sapase",
|
|
39
|
+
"Oracle",
|
|
40
|
+
"rdb",
|
|
41
|
+
"Orange ORM",
|
|
42
|
+
"active record"
|
|
43
|
+
],
|
|
44
|
+
"authors": [
|
|
45
|
+
"Lars-Erik Roald <lars.roald@gmail.com>"
|
|
46
|
+
],
|
|
47
|
+
"license": "ISC",
|
|
48
|
+
"codeOfConduct": "https://github.com/alfateam/orange-orm/blob/master/docs/CODE_OF_CONDUCT.md",
|
|
49
|
+
"contributing": "https://github.com/alfateam/orange-orm/blob/master/CONTRIBUTING.md",
|
|
50
|
+
"funding": {
|
|
51
|
+
"type": "github",
|
|
52
|
+
"url": "https://github.com/sponsors/lroal"
|
|
99
53
|
},
|
|
100
|
-
"
|
|
101
|
-
|
|
54
|
+
"scripts": {
|
|
55
|
+
"test": "vitest run --pool=forks --poolOptions.forks.singleFork",
|
|
56
|
+
"test:bun": "bun test --timeout=30000 ./tests/*.bun.test.js",
|
|
57
|
+
"test:deno": "deno test --allow-all --unstable-detect-cjs ./tests/*.deno.test.js",
|
|
58
|
+
"test:all": "echo 'Running Node.js tests...' && npm run test:node && echo 'Running Bun tests...' && npm run test:bun && echo 'Running Deno tests...' && npm run test:deno && echo 'All tests completed!'",
|
|
59
|
+
"test:all:parallel": "concurrently \"npm:test:node\" \"npm:test:bun\" \"npm:test:deno\"",
|
|
60
|
+
"coverage": "vitest run --coverage.enabled --coverage.reporter='text-summary' --pool=forks --poolOptions.forks.singleFork",
|
|
61
|
+
"testw": "vitest --pool=forks --poolOptions.forks.singleFork update",
|
|
62
|
+
"tscheck": "tsc ./src/index.d.ts --module commonjs --target es2022 --noEmit true --strict true --esModuleInterop true",
|
|
63
|
+
"concat-server": "node ./src/merge-server.js",
|
|
64
|
+
"concat-browser": "node ./src/merge-browser.js",
|
|
65
|
+
"build": "npm run build-server && npm run build-browser",
|
|
66
|
+
"build-server": "rollup -c ./src/rollup.config.server.js && npm run concat-server",
|
|
67
|
+
"build-browser": "rollup -c ./src/rollup.config.browser.js && npm run concat-browser",
|
|
68
|
+
"lint": "eslint ./",
|
|
69
|
+
"fix": "eslint ./ --fix",
|
|
70
|
+
"owasp": "owasp-dependency-check --project \"MY_PROJECT\" --scan \"package-lock.json\" --exclude \"dependency-check-bin\" --out \"owasp\" --format HTML",
|
|
71
|
+
"beta": "npm publish --tag beta"
|
|
102
72
|
},
|
|
103
|
-
"
|
|
104
|
-
|
|
73
|
+
"dependencies": {
|
|
74
|
+
"@cloudflare/workers-types": "^4.20241106.0",
|
|
75
|
+
"@lroal/on-change": "^4.0.2",
|
|
76
|
+
"@tediousjs/connection-string": "^0.4.1",
|
|
77
|
+
"@types/express": "^4.17.13",
|
|
78
|
+
"@types/oracledb": "^6.0.4",
|
|
79
|
+
"@types/tedious": "^4.0.14",
|
|
80
|
+
"ajv": "^8.17.1",
|
|
81
|
+
"axios": "^1.6.2",
|
|
82
|
+
"fast-json-patch": "^3.1.1",
|
|
83
|
+
"findup-sync": "^5.0.0",
|
|
84
|
+
"glob": "^10.3.4 || ^11.0.2",
|
|
85
|
+
"module-definition": "^4.0.0 || ^5.0.0 || || ^6.0.0",
|
|
86
|
+
"rfdc": "^1.2.0",
|
|
87
|
+
"uuid": "^8.3.2 || ^9.0.0 || ^10.0.0 || ^11.1.0"
|
|
105
88
|
},
|
|
106
|
-
"
|
|
107
|
-
|
|
89
|
+
"peerDependencies": {
|
|
90
|
+
"@electric-sql/pglite": "^0.3.0",
|
|
91
|
+
"msnodesqlv8": "^4.1.0",
|
|
92
|
+
"mysql2": "^2.2.5 || ^3.9.4",
|
|
93
|
+
"oracledb": "^6.3.0",
|
|
94
|
+
"pg": "^8.5.1",
|
|
95
|
+
"pg-query-stream": "^3.3.2",
|
|
96
|
+
"sqlite3": "^5.0.2",
|
|
97
|
+
"tedious": "^15.1.2 || ^16.0.0 || ^18.1.0 || || ^19.0.0"
|
|
108
98
|
},
|
|
109
|
-
"
|
|
110
|
-
|
|
99
|
+
"peerDependenciesMeta": {
|
|
100
|
+
"pg": {
|
|
101
|
+
"optional": true
|
|
102
|
+
},
|
|
103
|
+
"pg-query-stream": {
|
|
104
|
+
"optional": true
|
|
105
|
+
},
|
|
106
|
+
"mysql2": {
|
|
107
|
+
"optional": true
|
|
108
|
+
},
|
|
109
|
+
"sqlite3": {
|
|
110
|
+
"optional": true
|
|
111
|
+
},
|
|
112
|
+
"pg-native": {
|
|
113
|
+
"optional": true
|
|
114
|
+
},
|
|
115
|
+
"msnodesqlv8": {
|
|
116
|
+
"optional": true
|
|
117
|
+
},
|
|
118
|
+
"tedious": {
|
|
119
|
+
"optional": true
|
|
120
|
+
},
|
|
121
|
+
"oracledb": {
|
|
122
|
+
"optional": true
|
|
123
|
+
},
|
|
124
|
+
"@electric-sql/pglite": {
|
|
125
|
+
"optional": true
|
|
126
|
+
}
|
|
111
127
|
},
|
|
112
|
-
"
|
|
113
|
-
|
|
128
|
+
"devDependencies": {
|
|
129
|
+
"@electric-sql/pglite": "^0.3.0",
|
|
130
|
+
"@rollup/plugin-commonjs": "^28.0.2",
|
|
131
|
+
"@rollup/plugin-json": "^6.1.0",
|
|
132
|
+
"@rollup/plugin-node-resolve": "^13.0.0",
|
|
133
|
+
"@typescript-eslint/eslint-plugin": "^6.x",
|
|
134
|
+
"@typescript-eslint/parser": "^6.x",
|
|
135
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
136
|
+
"cors": "^2.8.5",
|
|
137
|
+
"eslint": "^8.57.0",
|
|
138
|
+
"eslint-plugin-jest": "^27.1.7",
|
|
139
|
+
"express": "^4.18.2",
|
|
140
|
+
"msnodesqlv8": "^4.1.0",
|
|
141
|
+
"mysql2": "^3.9.4",
|
|
142
|
+
"oracledb": "^6.3.0",
|
|
143
|
+
"owasp-dependency-check": "^0.0.21",
|
|
144
|
+
"pg": "^8.5.1",
|
|
145
|
+
"pg-query-stream": "^3.3.2",
|
|
146
|
+
"rollup": "^2.52.7",
|
|
147
|
+
"sqlite3": "^5.0.2",
|
|
148
|
+
"tedious": "^19.0.0",
|
|
149
|
+
"typescript": "^5.4.5",
|
|
150
|
+
"vitest": "^3.2.4"
|
|
114
151
|
},
|
|
115
|
-
"
|
|
116
|
-
|
|
152
|
+
"engines": {
|
|
153
|
+
"node": ">= 8.0.0"
|
|
117
154
|
},
|
|
118
|
-
"
|
|
119
|
-
|
|
155
|
+
"repository": {
|
|
156
|
+
"type": "git",
|
|
157
|
+
"url": "git@github.com:alfateam/orange-orm.git"
|
|
120
158
|
},
|
|
121
|
-
"
|
|
122
|
-
|
|
159
|
+
"homepage": "https://orange-orm.io",
|
|
160
|
+
"jshintConfig": {
|
|
161
|
+
"asi": true,
|
|
162
|
+
"eqnull": true,
|
|
163
|
+
"undef": true,
|
|
164
|
+
"node": true
|
|
123
165
|
}
|
|
124
|
-
|
|
125
|
-
"devDependencies": {
|
|
126
|
-
"@electric-sql/pglite": "^0.3.0",
|
|
127
|
-
"@miniflare/d1": "^2.14.4",
|
|
128
|
-
"@rollup/plugin-commonjs": "^28.0.2",
|
|
129
|
-
"@rollup/plugin-json": "^6.1.0",
|
|
130
|
-
"@rollup/plugin-node-resolve": "^13.0.0",
|
|
131
|
-
"@typescript-eslint/eslint-plugin": "^6.x",
|
|
132
|
-
"@typescript-eslint/parser": "^6.x",
|
|
133
|
-
"@vitest/coverage-v8": "^0.34.1",
|
|
134
|
-
"cors": "^2.8.5",
|
|
135
|
-
"eslint": "^8.57.0",
|
|
136
|
-
"eslint-plugin-jest": "^27.1.7",
|
|
137
|
-
"express": "^4.18.2",
|
|
138
|
-
"miniflare": "^3.20250129.0",
|
|
139
|
-
"msnodesqlv8": "^4.1.0",
|
|
140
|
-
"mysql2": "^3.9.4",
|
|
141
|
-
"oracledb": "^6.3.0",
|
|
142
|
-
"owasp-dependency-check": "^0.0.21",
|
|
143
|
-
"pg": "^8.5.1",
|
|
144
|
-
"pg-query-stream": "^3.3.2",
|
|
145
|
-
"rollup": "^2.52.7",
|
|
146
|
-
"sqlite3": "^5.0.2",
|
|
147
|
-
"tedious": "^19.0.0",
|
|
148
|
-
"typescript": "^5.4.5",
|
|
149
|
-
"vitest": "^0.34.6"
|
|
150
|
-
},
|
|
151
|
-
"engines": {
|
|
152
|
-
"node": ">= 8.0.0"
|
|
153
|
-
},
|
|
154
|
-
"repository": {
|
|
155
|
-
"type": "git",
|
|
156
|
-
"url": "git@github.com:alfateam/orange-orm.git"
|
|
157
|
-
},
|
|
158
|
-
"homepage": "https://orange-orm.io",
|
|
159
|
-
"jshintConfig": {
|
|
160
|
-
"asi": true,
|
|
161
|
-
"eqnull": true,
|
|
162
|
-
"undef": true,
|
|
163
|
-
"node": true
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
+
}
|
package/src/getManyDto.js
CHANGED
|
@@ -209,6 +209,10 @@ async function decodeManyRelations(context, strategy, span) {
|
|
|
209
209
|
const extractKey = createExtractKey(leg);
|
|
210
210
|
const extractFromMap = createExtractFromMap(rowsMap, table._primaryColumns);
|
|
211
211
|
|
|
212
|
+
if (span._ids.length === 0) {
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
|
|
212
216
|
// If maxRows is defined, chunk the IDs before calling getManyDto
|
|
213
217
|
if (maxRows) {
|
|
214
218
|
const chunkedIds = chunk(span._ids, maxRows);
|
package/src/index.js
CHANGED
|
@@ -88,7 +88,7 @@ Object.defineProperty(connectViaPool, 'pg', {
|
|
|
88
88
|
Object.defineProperty(connectViaPool, 'sqlite', {
|
|
89
89
|
get: function() {
|
|
90
90
|
if (!_sqlite) {
|
|
91
|
-
if (runtimes.deno || (runtimes.node && runtimes.node.major >=
|
|
91
|
+
if (runtimes.deno || (runtimes.node && (runtimes.node.major > 22 || (runtimes.node.major === 22 && runtimes.node.minor >= 5))))
|
|
92
92
|
_sqlite = require('./nodeSqlite/newDatabase');
|
|
93
93
|
else if (runtimes.bun)
|
|
94
94
|
_sqlite = require('./bunSqlite/newDatabase');
|
package/src/mssql/wrapQuery.js
CHANGED
|
@@ -26,7 +26,6 @@ function wrapQuery(_context, connection) {
|
|
|
26
26
|
const parameter = params[i];
|
|
27
27
|
|
|
28
28
|
if (typeof parameter === 'string') {
|
|
29
|
-
const paramLength = parameter.length;
|
|
30
29
|
const byteLength = Buffer.from(parameter, 'utf8').length;
|
|
31
30
|
|
|
32
31
|
if (hasNonAsciiCharacters(parameter)) {
|
|
@@ -35,10 +34,10 @@ function wrapQuery(_context, connection) {
|
|
|
35
34
|
if (isStoredProcCall) {
|
|
36
35
|
// For stored procedures, create a variable with exact lengths
|
|
37
36
|
const varName = `@hex_param_${i}`;
|
|
38
|
-
const convertClause = `CONVERT(VARCHAR(${
|
|
37
|
+
const convertClause = `CONVERT(VARCHAR(${byteLength}), CONVERT(VARBINARY(${byteLength}), 0x${hexValue}))`;
|
|
39
38
|
|
|
40
39
|
hexVariables.push({
|
|
41
|
-
declaration: `DECLARE ${varName} VARCHAR(${
|
|
40
|
+
declaration: `DECLARE ${varName} VARCHAR(${byteLength})`,
|
|
42
41
|
assignment: `SET ${varName} = ${convertClause}`
|
|
43
42
|
});
|
|
44
43
|
|
|
@@ -48,7 +47,7 @@ function wrapQuery(_context, connection) {
|
|
|
48
47
|
});
|
|
49
48
|
} else {
|
|
50
49
|
// For regular queries, use inline conversion with exact lengths
|
|
51
|
-
const convertClause = `CONVERT(VARCHAR(${
|
|
50
|
+
const convertClause = `CONVERT(VARCHAR(${byteLength}), CONVERT(VARBINARY(${byteLength}), 0x${hexValue}))`;
|
|
52
51
|
replacements.push({
|
|
53
52
|
index: i,
|
|
54
53
|
replacement: convertClause
|
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
const log = require('../table/log');
|
|
2
|
+
const connectionCache = new WeakMap();
|
|
2
3
|
|
|
3
4
|
function wrapQuery(_context, connection) {
|
|
5
|
+
let statementCache = connectionCache.get(connection);
|
|
6
|
+
if (!statementCache) {
|
|
7
|
+
statementCache = new Map();
|
|
8
|
+
connectionCache.set(connection, statementCache);
|
|
9
|
+
}
|
|
10
|
+
|
|
4
11
|
return runQuery;
|
|
5
12
|
|
|
6
13
|
function runQuery(query, onCompleted) {
|
|
@@ -9,7 +16,11 @@ function wrapQuery(_context, connection) {
|
|
|
9
16
|
var sql = query.sql();
|
|
10
17
|
log.emitQuery({ sql, parameters: params });
|
|
11
18
|
|
|
12
|
-
|
|
19
|
+
let statement = statementCache.get(sql);
|
|
20
|
+
if (!statement) {
|
|
21
|
+
statement = connection.prepare(sql);
|
|
22
|
+
statementCache.set(sql, statement);
|
|
23
|
+
}
|
|
13
24
|
const rows = statement.all.apply(statement, params);
|
|
14
25
|
onCompleted(null, rows);
|
|
15
26
|
}
|
package/.dockerignore
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
node_modules
|
package/.eslintignore
DELETED
package/.eslintrc.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
'env': {
|
|
3
|
-
'node': true,
|
|
4
|
-
'es6': true
|
|
5
|
-
},
|
|
6
|
-
'extends': [
|
|
7
|
-
'eslint:recommended',
|
|
8
|
-
'plugin:@typescript-eslint/eslint-recommended',
|
|
9
|
-
'plugin:@typescript-eslint/recommended',
|
|
10
|
-
// 'plugin:jest/recommended'
|
|
11
|
-
],
|
|
12
|
-
'parserOptions': {
|
|
13
|
-
'sourceType': 'module',
|
|
14
|
-
'ecmaVersion': 2018
|
|
15
|
-
},
|
|
16
|
-
'ignorePatterns': ['*esm.js', '*.ts'],
|
|
17
|
-
'rules': {
|
|
18
|
-
'@typescript-eslint/no-empty-function': 0,
|
|
19
|
-
'@typescript-eslint/no-var-requires': 0,
|
|
20
|
-
'@typescript-eslint/ban-ts-comment': 0,
|
|
21
|
-
'no-unused-vars': 'off',
|
|
22
|
-
'@typescript-eslint/no-unused-vars': [2, { 'args': 'after-used', 'ignoreRestSiblings': true, 'argsIgnorePattern': '^_' }],
|
|
23
|
-
'indent': ['error', 'tab'],
|
|
24
|
-
// 'linebreak-style': ['error', 'unix'],
|
|
25
|
-
'quotes': ['error', 'single'],
|
|
26
|
-
'semi': ['error', 'always'],
|
|
27
|
-
'no-console': 'off',
|
|
28
|
-
'no-debugger': 'off',
|
|
29
|
-
'no-trailing-spaces': 'error',
|
|
30
|
-
'no-underscore-dangle': 0,
|
|
31
|
-
'space-before-function-paren': ['error', {
|
|
32
|
-
'anonymous': 'never',
|
|
33
|
-
'named': 'never',
|
|
34
|
-
'asyncArrow': 'always'
|
|
35
|
-
}],
|
|
36
|
-
// 'jest/no-disabled-tests': 'warn',
|
|
37
|
-
// 'jest/no-focused-tests': 'error',
|
|
38
|
-
// 'jest/no-identical-title': 'error',
|
|
39
|
-
// 'jest/prefer-to-have-length': 'warn',
|
|
40
|
-
// 'jest/valid-expect': 'error'
|
|
41
|
-
},
|
|
42
|
-
'plugins': [ '@typescript-eslint']
|
|
43
|
-
// 'plugins': ['jest', '@typescript-eslint']
|
|
44
|
-
};
|
|
45
|
-
|
package/.gitattributes
DELETED
package/CNAME
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
orange-orm.io
|
package/src/package.json
DELETED
package/vitest.config.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
// vitest.config.js
|
|
2
|
-
/** @type {import('vitest').UserConfig} */
|
|
3
|
-
module.exports = {
|
|
4
|
-
test: {
|
|
5
|
-
// Copied baseline excludes (since configDefaults is ESM-only)
|
|
6
|
-
exclude: [
|
|
7
|
-
'**/node_modules/**',
|
|
8
|
-
'**/dist/**',
|
|
9
|
-
'**/cypress/**',
|
|
10
|
-
'**/.{idea,git,cache}/**',
|
|
11
|
-
'**/coverage/**',
|
|
12
|
-
'**/*.deno.test.js',
|
|
13
|
-
'**/*.bun.test.js',
|
|
14
|
-
],
|
|
15
|
-
threads: false,
|
|
16
|
-
},
|
|
17
|
-
};
|