@hile/typeorm 1.0.13 → 1.1.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/README.md +2 -0
- package/SKILL.md +1 -1
- package/dist/index.js +2 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -20,6 +20,8 @@ const ds = await loadService(typeormService)
|
|
|
20
20
|
// 使用 ds.getRepository(Entity)、ds.manager 等
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
+
默认导出使用稳定的服务 key(实现中为 `Symbol.for` + 包名),与 `@hile/core` 的「按 key 单例」语义一致;需要多个 DataSource 时请自行 `defineService(不同 key, ...)` 再包装。
|
|
24
|
+
|
|
23
25
|
## 环境变量
|
|
24
26
|
|
|
25
27
|
默认 DataSource 从以下环境变量读取配置:
|
package/SKILL.md
CHANGED
|
@@ -11,7 +11,7 @@ description: "@hile/typeorm 的代码生成与使用规范。适用于 DataSourc
|
|
|
11
11
|
|
|
12
12
|
`@hile/typeorm` 提供:
|
|
13
13
|
|
|
14
|
-
- 默认导出:Hile 服务化的 TypeORM `DataSource
|
|
14
|
+
- 默认导出:Hile 服务化的 TypeORM `DataSource`(服务 key 为稳定 symbol,见包内实现)
|
|
15
15
|
- `transaction`:事务封装,支持失败时 LIFO 执行补偿回调
|
|
16
16
|
|
|
17
17
|
依赖:`@hile/core`、`typeorm`。
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import pkg from '../package.json' with { type: 'json' };
|
|
1
2
|
import { defineService } from '@hile/core';
|
|
2
3
|
import { DataSource } from 'typeorm';
|
|
3
4
|
/**
|
|
@@ -14,7 +15,7 @@ import { DataSource } from 'typeorm';
|
|
|
14
15
|
* - TYPEORM_ENTITY_PREFIX: 实体前缀
|
|
15
16
|
* - TYPEORM_ENTITIES: 实体目录
|
|
16
17
|
*/
|
|
17
|
-
export default defineService(async (shutdown) => {
|
|
18
|
+
export default defineService(Symbol.for(pkg.name), async (shutdown) => {
|
|
18
19
|
const configs = {
|
|
19
20
|
// @ts-ignore
|
|
20
21
|
type: process.env.TYPEORM_TYPE,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hile/typeorm",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "TypeORM DataSource as Hile service with transaction helper",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"vitest": "^4.0.18"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@hile/core": "^1.0
|
|
26
|
+
"@hile/core": "^1.1.0",
|
|
27
27
|
"typeorm": "^0.3.28"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "ec49eb8979b6c9c3ce99cb5311f1684bcde1bf2a"
|
|
30
30
|
}
|