@hile/typeorm 1.0.1 → 1.0.5
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 +4 -1
- package/SKILL.md +9 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +6 -0
- package/package.json +4 -5
- package/skill.json +0 -16
package/README.md
CHANGED
|
@@ -34,8 +34,11 @@ DataSource 从以下环境变量读取配置:
|
|
|
34
34
|
| `TYPEORM_PASSWORD` | 密码 |
|
|
35
35
|
| `TYPEORM_DATABASE` | 数据库名 |
|
|
36
36
|
| `TYPEORM_PORT` | 端口 |
|
|
37
|
+
| `TYPEORM_CHARSET` | 数据库字符集 |
|
|
38
|
+
| `TYPEORM_ENTITY_PREFIX` | 实体表名前缀 |
|
|
39
|
+
| `TYPEORM_ENTITIES` | 实体目录(单一路径) |
|
|
37
40
|
|
|
38
|
-
行为:`synchronize: true`;当 `NODE_ENV === 'development'` 时开启 `logging
|
|
41
|
+
行为:`synchronize: true`;当 `NODE_ENV === 'development'` 时开启 `logging`。未设置 `TYPEORM_ENTITIES` 时实体列表为空。连接在进程退出时通过 Hile 的 shutdown 自动销毁。
|
|
39
42
|
|
|
40
43
|
## 事务
|
|
41
44
|
|
package/SKILL.md
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: hile-typeorm
|
|
3
|
+
description: Code generation and usage rules for @hile/typeorm. Use when using TypeORM DataSource as Hile service, transaction helper, or when the user asks about @hile/typeorm or TypeORM service patterns.
|
|
4
|
+
---
|
|
5
|
+
|
|
1
6
|
# @hile/typeorm
|
|
2
7
|
|
|
3
8
|
本文档是面向 AI 编码模型和人类开发者的 **代码生成规范**,阅读后应能正确地使用本库编写符合架构规则的代码。
|
|
@@ -27,8 +32,11 @@
|
|
|
27
32
|
| `TYPEORM_PASSWORD` | 密码 |
|
|
28
33
|
| `TYPEORM_DATABASE` | 数据库名 |
|
|
29
34
|
| `TYPEORM_PORT` | 端口(字符串会被转为数字) |
|
|
35
|
+
| `TYPEORM_CHARSET` | 数据库字符集 |
|
|
36
|
+
| `TYPEORM_ENTITY_PREFIX` | 实体表名前缀 |
|
|
37
|
+
| `TYPEORM_ENTITIES` | 实体目录(单一路径,会以单元素数组传入 DataSource.entities) |
|
|
30
38
|
|
|
31
|
-
DataSource 行为:`synchronize: true`;`logging` 在 `NODE_ENV === 'development'` 时为 `true
|
|
39
|
+
DataSource 行为:`synchronize: true`;`logging` 在 `NODE_ENV === 'development'` 时为 `true`。未设置 `TYPEORM_ENTITIES` 时 `entities` 为空数组。
|
|
32
40
|
|
|
33
41
|
### 2.2 类型(生成代码时须遵循)
|
|
34
42
|
|
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,9 @@ import { DataSource, QueryRunner } from 'typeorm';
|
|
|
9
9
|
* - TYPEORM_PASSWORD: 数据库密码
|
|
10
10
|
* - TYPEORM_DATABASE: 数据库名称
|
|
11
11
|
* - TYPEORM_PORT: 数据库端口
|
|
12
|
+
* - TYPEORM_CHARSET: 数据库字符集
|
|
13
|
+
* - TYPEORM_ENTITY_PREFIX: 实体前缀
|
|
14
|
+
* - TYPEORM_ENTITIES: 实体目录
|
|
12
15
|
*/
|
|
13
16
|
declare const _default: import("@hile/core").ServiceRegisterProps<DataSource>;
|
|
14
17
|
export default _default;
|
package/dist/index.js
CHANGED
|
@@ -10,6 +10,9 @@ import { DataSource } from 'typeorm';
|
|
|
10
10
|
* - TYPEORM_PASSWORD: 数据库密码
|
|
11
11
|
* - TYPEORM_DATABASE: 数据库名称
|
|
12
12
|
* - TYPEORM_PORT: 数据库端口
|
|
13
|
+
* - TYPEORM_CHARSET: 数据库字符集
|
|
14
|
+
* - TYPEORM_ENTITY_PREFIX: 实体前缀
|
|
15
|
+
* - TYPEORM_ENTITIES: 实体目录
|
|
13
16
|
*/
|
|
14
17
|
export default defineService(async (shutdown) => {
|
|
15
18
|
const configs = {
|
|
@@ -19,6 +22,9 @@ export default defineService(async (shutdown) => {
|
|
|
19
22
|
username: process.env.TYPEORM_USERNAME,
|
|
20
23
|
password: process.env.TYPEORM_PASSWORD,
|
|
21
24
|
database: process.env.TYPEORM_DATABASE,
|
|
25
|
+
charset: process.env.TYPEORM_CHARSET,
|
|
26
|
+
entityPrefix: process.env.TYPEORM_ENTITY_PREFIX,
|
|
27
|
+
entities: process.env.TYPEORM_ENTITIES ? [process.env.TYPEORM_ENTITIES] : [],
|
|
22
28
|
port: typeof process.env.TYPEORM_PORT === 'string'
|
|
23
29
|
? Number(process.env.TYPEORM_PORT)
|
|
24
30
|
: process.env.TYPEORM_PORT,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hile/typeorm",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "TypeORM DataSource as Hile service with transaction helper",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -13,8 +13,7 @@
|
|
|
13
13
|
"files": [
|
|
14
14
|
"dist",
|
|
15
15
|
"README.md",
|
|
16
|
-
"SKILL.md"
|
|
17
|
-
"skill.json"
|
|
16
|
+
"SKILL.md"
|
|
18
17
|
],
|
|
19
18
|
"license": "MIT",
|
|
20
19
|
"publishConfig": {
|
|
@@ -25,8 +24,8 @@
|
|
|
25
24
|
"vitest": "^4.0.18"
|
|
26
25
|
},
|
|
27
26
|
"dependencies": {
|
|
28
|
-
"@hile/core": "1.0.
|
|
27
|
+
"@hile/core": "1.0.14",
|
|
29
28
|
"typeorm": "^0.3.28"
|
|
30
29
|
},
|
|
31
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "c71a9452cf379f28c6d02e6b3603b90bc4891680"
|
|
32
31
|
}
|
package/skill.json
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@hile/typeorm",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"description": "Code generation and contribution rules for @hile/typeorm (TypeORM DataSource as Hile service). Use when editing this package or when the user asks about @hile/typeorm, DataSource, or transaction patterns.",
|
|
5
|
-
"repository": "",
|
|
6
|
-
"skills": [
|
|
7
|
-
{
|
|
8
|
-
"id": "typeorm",
|
|
9
|
-
"name": "@hile/typeorm 开发指南",
|
|
10
|
-
"description": "提供 @hile/typeorm 模块的开发与代码生成规范:DataSource 服务、环境变量、事务封装",
|
|
11
|
-
"path": "SKILL.md"
|
|
12
|
-
}
|
|
13
|
-
],
|
|
14
|
-
"authors": [],
|
|
15
|
-
"license": "MIT"
|
|
16
|
-
}
|