@eggjs/transaction-decorator 4.0.0-beta.35 → 4.0.0-beta.36
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/builder/TransactionMetaBuilder.d.ts +9 -5
- package/dist/builder/TransactionMetaBuilder.js +17 -14
- package/dist/builder/index.d.ts +1 -1
- package/dist/builder/index.js +3 -2
- package/dist/decorator/Transactional.d.ts +6 -2
- package/dist/decorator/Transactional.js +21 -18
- package/dist/decorator/index.d.ts +1 -1
- package/dist/decorator/index.js +3 -2
- package/dist/index.d.ts +8 -4
- package/dist/index.js +10 -5
- package/dist/util/TransactionMetadataUtil.d.ts +10 -6
- package/dist/util/TransactionMetadataUtil.js +21 -18
- package/dist/util/index.d.ts +1 -1
- package/dist/util/index.js +3 -2
- package/package.json +28 -32
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { EggProtoImplClass, TransactionMetadata } from "@eggjs/tegg-types";
|
|
2
|
+
|
|
3
|
+
//#region src/builder/TransactionMetaBuilder.d.ts
|
|
4
|
+
declare class TransactionMetaBuilder {
|
|
5
|
+
private readonly clazz;
|
|
6
|
+
constructor(clazz: EggProtoImplClass);
|
|
7
|
+
build(): TransactionMetadata[];
|
|
6
8
|
}
|
|
9
|
+
//#endregion
|
|
10
|
+
export { TransactionMetaBuilder };
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import { TransactionMetadataUtil } from "../util/
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
1
|
+
import { TransactionMetadataUtil } from "../util/TransactionMetadataUtil.js";
|
|
2
|
+
import "../util/index.js";
|
|
3
|
+
|
|
4
|
+
//#region src/builder/TransactionMetaBuilder.ts
|
|
5
|
+
var TransactionMetaBuilder = class {
|
|
6
|
+
clazz;
|
|
7
|
+
constructor(clazz) {
|
|
8
|
+
this.clazz = clazz;
|
|
9
|
+
}
|
|
10
|
+
build() {
|
|
11
|
+
if (!TransactionMetadataUtil.isTransactionClazz(this.clazz)) return [];
|
|
12
|
+
return TransactionMetadataUtil.getTransactionMetadataList(this.clazz);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
export { TransactionMetaBuilder };
|
package/dist/builder/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import { TransactionMetaBuilder } from "./TransactionMetaBuilder.js";
|
package/dist/builder/index.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { TransactionMetaBuilder } from "./TransactionMetaBuilder.js";
|
|
2
|
+
|
|
3
|
+
export { };
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { TransactionalParams } from "@eggjs/tegg-types";
|
|
2
|
+
|
|
3
|
+
//#region src/decorator/Transactional.d.ts
|
|
4
|
+
declare function Transactional(params?: TransactionalParams): (target: any, propertyKey: PropertyKey) => void;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { Transactional };
|
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import { TransactionMetadataUtil } from "../util/TransactionMetadataUtil.js";
|
|
2
|
+
import "../util/index.js";
|
|
3
|
+
import { PropagationType } from "@eggjs/tegg-types";
|
|
4
|
+
|
|
5
|
+
//#region src/decorator/Transactional.ts
|
|
6
|
+
function Transactional(params) {
|
|
7
|
+
const propagation = params?.propagation || PropagationType.REQUIRED;
|
|
8
|
+
if (!Object.values(PropagationType).includes(propagation)) throw new Error(`unknown propagation type ${propagation}`);
|
|
9
|
+
const datasourceName = params?.datasourceName;
|
|
10
|
+
return function(target, propertyKey) {
|
|
11
|
+
const constructor = target.constructor;
|
|
12
|
+
TransactionMetadataUtil.setIsTransactionClazz(constructor);
|
|
13
|
+
TransactionMetadataUtil.addTransactionMetadata(constructor, {
|
|
14
|
+
propagation,
|
|
15
|
+
method: propertyKey,
|
|
16
|
+
datasourceName
|
|
17
|
+
});
|
|
18
|
+
};
|
|
18
19
|
}
|
|
19
|
-
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
export { Transactional };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import { Transactional } from "./Transactional.js";
|
package/dist/decorator/index.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { Transactional } from "./Transactional.js";
|
|
2
|
+
|
|
3
|
+
export { };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { TransactionMetaBuilder } from "./builder/TransactionMetaBuilder.js";
|
|
2
|
+
import "./builder/index.js";
|
|
3
|
+
import { Transactional } from "./decorator/Transactional.js";
|
|
4
|
+
import "./decorator/index.js";
|
|
5
|
+
import { TransactionMetadataUtil } from "./util/TransactionMetadataUtil.js";
|
|
6
|
+
import "./util/index.js";
|
|
7
|
+
export * from "@eggjs/tegg-types/transaction";
|
|
8
|
+
export { TransactionMetaBuilder, TransactionMetadataUtil, Transactional };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { TransactionMetadataUtil } from "./util/TransactionMetadataUtil.js";
|
|
2
|
+
import "./util/index.js";
|
|
3
|
+
import { TransactionMetaBuilder } from "./builder/TransactionMetaBuilder.js";
|
|
4
|
+
import "./builder/index.js";
|
|
5
|
+
import { Transactional } from "./decorator/Transactional.js";
|
|
6
|
+
import "./decorator/index.js";
|
|
7
|
+
|
|
8
|
+
export * from "@eggjs/tegg-types/transaction"
|
|
9
|
+
|
|
10
|
+
export { TransactionMetaBuilder, TransactionMetadataUtil, Transactional };
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { EggProtoImplClass, TransactionMetadata } from "@eggjs/tegg-types";
|
|
2
|
+
|
|
3
|
+
//#region src/util/TransactionMetadataUtil.d.ts
|
|
4
|
+
declare class TransactionMetadataUtil {
|
|
5
|
+
static setIsTransactionClazz(clazz: EggProtoImplClass): void;
|
|
6
|
+
static isTransactionClazz(clazz: EggProtoImplClass): boolean;
|
|
7
|
+
static addTransactionMetadata(clazz: EggProtoImplClass, data: TransactionMetadata): void;
|
|
8
|
+
static getTransactionMetadataList(clazz: EggProtoImplClass): TransactionMetadata[];
|
|
7
9
|
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { TransactionMetadataUtil };
|
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
import { MetadataUtil } from
|
|
2
|
-
import { IS_TRANSACTION_CLAZZ, TRANSACTION_META_DATA
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
1
|
+
import { MetadataUtil } from "@eggjs/core-decorator";
|
|
2
|
+
import { IS_TRANSACTION_CLAZZ, TRANSACTION_META_DATA } from "@eggjs/tegg-types";
|
|
3
|
+
|
|
4
|
+
//#region src/util/TransactionMetadataUtil.ts
|
|
5
|
+
var TransactionMetadataUtil = class {
|
|
6
|
+
static setIsTransactionClazz(clazz) {
|
|
7
|
+
MetadataUtil.defineMetaData(IS_TRANSACTION_CLAZZ, true, clazz);
|
|
8
|
+
}
|
|
9
|
+
static isTransactionClazz(clazz) {
|
|
10
|
+
return MetadataUtil.getBooleanMetaData(IS_TRANSACTION_CLAZZ, clazz);
|
|
11
|
+
}
|
|
12
|
+
static addTransactionMetadata(clazz, data) {
|
|
13
|
+
MetadataUtil.initOwnArrayMetaData(TRANSACTION_META_DATA, clazz, []).push(data);
|
|
14
|
+
}
|
|
15
|
+
static getTransactionMetadataList(clazz) {
|
|
16
|
+
return MetadataUtil.getArrayMetaData(TRANSACTION_META_DATA, clazz);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
export { TransactionMetadataUtil };
|
package/dist/util/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import { TransactionMetadataUtil } from "./TransactionMetadataUtil.js";
|
package/dist/util/index.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { TransactionMetadataUtil } from "./TransactionMetadataUtil.js";
|
|
2
|
+
|
|
3
|
+
export { };
|
package/package.json
CHANGED
|
@@ -1,55 +1,51 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eggjs/transaction-decorator",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.36",
|
|
4
4
|
"description": "tegg transaction decorator",
|
|
5
5
|
"keywords": [
|
|
6
|
-
"egg",
|
|
7
|
-
"typescript",
|
|
8
6
|
"decorator",
|
|
7
|
+
"egg",
|
|
8
|
+
"tegg",
|
|
9
9
|
"transaction",
|
|
10
|
-
"
|
|
10
|
+
"typescript"
|
|
11
11
|
],
|
|
12
|
-
"author": "qile222 <chhxxc@gmail.com>",
|
|
13
12
|
"homepage": "https://github.com/eggjs/egg/tree/next/tegg/core/transaction-decorator",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/eggjs/egg/issues"
|
|
15
|
+
},
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"author": "qile222 <chhxxc@gmail.com>",
|
|
14
18
|
"repository": {
|
|
15
19
|
"type": "git",
|
|
16
20
|
"url": "git+https://github.com/eggjs/egg.git",
|
|
17
21
|
"directory": "tegg/core/transaction-decorator"
|
|
18
22
|
},
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"
|
|
23
|
+
"files": [
|
|
24
|
+
"dist"
|
|
25
|
+
],
|
|
26
|
+
"type": "module",
|
|
27
|
+
"main": "./dist/index.js",
|
|
28
|
+
"module": "./dist/index.js",
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
30
|
+
"exports": {
|
|
31
|
+
".": "./dist/index.js",
|
|
32
|
+
"./package.json": "./package.json"
|
|
28
33
|
},
|
|
29
34
|
"publishConfig": {
|
|
30
35
|
"access": "public"
|
|
31
36
|
},
|
|
32
|
-
"
|
|
33
|
-
"
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@eggjs/core-decorator": "4.0.0-beta.36",
|
|
39
|
+
"@eggjs/tegg-types": "4.0.0-beta.36"
|
|
34
40
|
},
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
".": "./dist/index.js",
|
|
39
|
-
"./package.json": "./package.json"
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@types/node": "^24.10.2",
|
|
43
|
+
"typescript": "^5.9.3"
|
|
40
44
|
},
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
],
|
|
44
|
-
"bugs": {
|
|
45
|
-
"url": "https://github.com/eggjs/egg/issues"
|
|
45
|
+
"engines": {
|
|
46
|
+
"node": ">=22.18.0"
|
|
46
47
|
},
|
|
47
|
-
"main": "./dist/index.js",
|
|
48
|
-
"module": "./dist/index.js",
|
|
49
|
-
"types": "./dist/index.d.ts",
|
|
50
48
|
"scripts": {
|
|
51
|
-
"
|
|
52
|
-
"build": "tsdown && npm run clean && tsc -p tsconfig.build.json",
|
|
53
|
-
"typecheck": "tsc --noEmit"
|
|
49
|
+
"typecheck": "tsgo --noEmit"
|
|
54
50
|
}
|
|
55
51
|
}
|