orange-orm 4.7.17-beta.0 → 4.8.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/dist/index.browser.mjs +5 -2
- package/dist/index.mjs +5 -2
- package/docs/changelog.md +2 -0
- package/package.json +2 -2
- package/src/client/index.js +3 -2
- package/src/client/netAdapter.js +2 -0
- package/src/map2.d.ts +3 -3
package/dist/index.browser.mjs
CHANGED
|
@@ -2395,6 +2395,8 @@ function requireNetAdapter () {
|
|
|
2395
2395
|
}
|
|
2396
2396
|
|
|
2397
2397
|
function netAdapter(url, tableName, { axios, tableOptions }) {
|
|
2398
|
+
if (tableOptions.transaction?.done)
|
|
2399
|
+
delete tableOptions.transaction;
|
|
2398
2400
|
|
|
2399
2401
|
let c = {
|
|
2400
2402
|
get,
|
|
@@ -2841,8 +2843,10 @@ function requireClient () {
|
|
|
2841
2843
|
|
|
2842
2844
|
try {
|
|
2843
2845
|
const nextClient = client({ transaction });
|
|
2844
|
-
await fn(nextClient);
|
|
2846
|
+
const result = await fn(nextClient);
|
|
2847
|
+
transaction.done = true;
|
|
2845
2848
|
await transaction(transaction.commit);
|
|
2849
|
+
return result;
|
|
2846
2850
|
}
|
|
2847
2851
|
catch (e) {
|
|
2848
2852
|
await transaction(transaction.rollback.bind(null, e));
|
|
@@ -3482,7 +3486,6 @@ function requireClient () {
|
|
|
3482
3486
|
return;
|
|
3483
3487
|
|
|
3484
3488
|
let body = stringify({ patch, options: { ...tableOptions, ...concurrencyOptions, strategy, deduceStrategy } });
|
|
3485
|
-
|
|
3486
3489
|
let adapter = netAdapter(url, tableName, { axios: axiosInterceptor, tableOptions });
|
|
3487
3490
|
let { changed, strategy: newStrategy } = await adapter.patch(body);
|
|
3488
3491
|
copyInto(changed, [row]);
|
package/dist/index.mjs
CHANGED
|
@@ -2396,6 +2396,8 @@ function requireNetAdapter () {
|
|
|
2396
2396
|
}
|
|
2397
2397
|
|
|
2398
2398
|
function netAdapter(url, tableName, { axios, tableOptions }) {
|
|
2399
|
+
if (tableOptions.transaction?.done)
|
|
2400
|
+
delete tableOptions.transaction;
|
|
2399
2401
|
|
|
2400
2402
|
let c = {
|
|
2401
2403
|
get,
|
|
@@ -2842,8 +2844,10 @@ function requireClient () {
|
|
|
2842
2844
|
|
|
2843
2845
|
try {
|
|
2844
2846
|
const nextClient = client({ transaction });
|
|
2845
|
-
await fn(nextClient);
|
|
2847
|
+
const result = await fn(nextClient);
|
|
2848
|
+
transaction.done = true;
|
|
2846
2849
|
await transaction(transaction.commit);
|
|
2850
|
+
return result;
|
|
2847
2851
|
}
|
|
2848
2852
|
catch (e) {
|
|
2849
2853
|
await transaction(transaction.rollback.bind(null, e));
|
|
@@ -3483,7 +3487,6 @@ function requireClient () {
|
|
|
3483
3487
|
return;
|
|
3484
3488
|
|
|
3485
3489
|
let body = stringify({ patch, options: { ...tableOptions, ...concurrencyOptions, strategy, deduceStrategy } });
|
|
3486
|
-
|
|
3487
3490
|
let adapter = netAdapter(url, tableName, { axios: axiosInterceptor, tableOptions });
|
|
3488
3491
|
let { changed, strategy: newStrategy } = await adapter.patch(body);
|
|
3489
3492
|
copyInto(changed, [row]);
|
package/docs/changelog.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "orange-orm",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.8.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"scripts": {
|
|
55
55
|
"test": "vitest run --pool=forks --poolOptions.forks.singleFork",
|
|
56
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",
|
|
57
|
+
"test:deno": "deno test --allow-all --no-check --unstable-detect-cjs ./tests/*.deno.test.js",
|
|
58
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
59
|
"test:all:parallel": "concurrently \"npm:test:node\" \"npm:test:bun\" \"npm:test:deno\"",
|
|
60
60
|
"coverage": "vitest run --coverage.enabled --coverage.reporter='text-summary' --pool=forks --poolOptions.forks.singleFork",
|
package/src/client/index.js
CHANGED
|
@@ -179,8 +179,10 @@ function rdbClient(options = {}) {
|
|
|
179
179
|
|
|
180
180
|
try {
|
|
181
181
|
const nextClient = client({ transaction });
|
|
182
|
-
await fn(nextClient);
|
|
182
|
+
const result = await fn(nextClient);
|
|
183
|
+
transaction.done = true;
|
|
183
184
|
await transaction(transaction.commit);
|
|
185
|
+
return result;
|
|
184
186
|
}
|
|
185
187
|
catch (e) {
|
|
186
188
|
await transaction(transaction.rollback.bind(null, e));
|
|
@@ -820,7 +822,6 @@ function rdbClient(options = {}) {
|
|
|
820
822
|
return;
|
|
821
823
|
|
|
822
824
|
let body = stringify({ patch, options: { ...tableOptions, ...concurrencyOptions, strategy, deduceStrategy } });
|
|
823
|
-
|
|
824
825
|
let adapter = netAdapter(url, tableName, { axios: axiosInterceptor, tableOptions });
|
|
825
826
|
let { changed, strategy: newStrategy } = await adapter.patch(body);
|
|
826
827
|
copyInto(changed, [row]);
|
package/src/client/netAdapter.js
CHANGED
package/src/map2.d.ts
CHANGED
|
@@ -910,9 +910,9 @@ export type DBClient<M extends Record<string, TableDefinition<M>>> = {
|
|
|
910
910
|
(
|
|
911
911
|
config?: DbOptions<M>
|
|
912
912
|
): DBClient<M>;
|
|
913
|
-
transaction(
|
|
914
|
-
|
|
915
|
-
|
|
913
|
+
transaction<TR = unknown>(
|
|
914
|
+
fn: (db: DBClient<M>) => Promise<TR> | TR
|
|
915
|
+
): Promise<TR>;
|
|
916
916
|
express(): import('express').RequestHandler;
|
|
917
917
|
express(config: ExpressConfig<M>): import('express').RequestHandler;
|
|
918
918
|
readonly metaData: DbConcurrency<M>;
|