@buka/nestjs-kit 4.5.0 → 4.6.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/CHANGELOG.md +7 -0
- package/dist/index.d.mts +27 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +42 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +43 -1
- package/dist/index.mjs.map +1 -1
- package/docs/mikro-orm.md +17 -0
- package/package.json +1 -1
- package/skills/nestjs-kit-coding-standards/references/entity.md +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [4.6.0](https://github.com/buka-ltd/npm.nestjs-kit/compare/v4.5.0...v4.6.0) (2026-10-26)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* 添加 Columns.Date ([d116cf2](https://github.com/buka-ltd/npm.nestjs-kit/commit/d116cf20985e0ece543031d8dd2f9b1e8e0c2559))
|
|
9
|
+
|
|
3
10
|
## [4.5.0](https://github.com/buka-ltd/npm.nestjs-kit/compare/v4.4.13...v4.5.0) (2026-10-07)
|
|
4
11
|
|
|
5
12
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1734,6 +1734,32 @@ interface UuidOptions<T extends object> extends Omit<PropertyOptions<T>, 'type'
|
|
|
1734
1734
|
*/
|
|
1735
1735
|
declare function Uuid<T extends object>(options?: UuidOptions<T>): (target: T, propertyName: string) => void;
|
|
1736
1736
|
//#endregion
|
|
1737
|
+
//#region src/modules/mikro-orm/decorators/columns/date.column.d.ts
|
|
1738
|
+
interface DateOptions<T extends object> extends Omit<PropertyOptions<T>, 'type' | 'columnType'> {
|
|
1739
|
+
example?: SchemaObject['example'];
|
|
1740
|
+
examples?: SchemaObject['examples'];
|
|
1741
|
+
}
|
|
1742
|
+
/**
|
|
1743
|
+
* DATE 列装饰器,声明一个只含日期的列(无时间、无时区)。
|
|
1744
|
+
*
|
|
1745
|
+
* 自动应用 MikroORM `@Property({ type: 'date' })`、`@Matches()` + `@IsISO8601({ strict: true })`
|
|
1746
|
+
* 验证及 Swagger schema(format: date)。
|
|
1747
|
+
*
|
|
1748
|
+
* MikroORM `DateType` 在 JS 侧表示为 `YYYY-MM-DD` 字符串,不是 `Date` 对象,也不代表某个绝对时刻。
|
|
1749
|
+
*
|
|
1750
|
+
* @param options - 列配置
|
|
1751
|
+
*
|
|
1752
|
+
* @example
|
|
1753
|
+
* ```typescript
|
|
1754
|
+
* @Entity()
|
|
1755
|
+
* class CourseOccurrence {
|
|
1756
|
+
* @Date({ comment: '计划日期' })
|
|
1757
|
+
* date: string
|
|
1758
|
+
* }
|
|
1759
|
+
* ```
|
|
1760
|
+
*/
|
|
1761
|
+
declare function Date$1<T extends object>(options?: DateOptions<T>): (target: T, propertyName: string) => void;
|
|
1762
|
+
//#endregion
|
|
1737
1763
|
//#region src/modules/mikro-orm/decorators/columns/timestamptz.column.d.ts
|
|
1738
1764
|
interface TimestamptzOptions<T extends object> extends Omit<PropertyOptions<T>, 'type' | 'columnType'> {
|
|
1739
1765
|
example?: SchemaObject['example'];
|
|
@@ -1884,6 +1910,7 @@ declare const Column: {
|
|
|
1884
1910
|
readonly Numeric: typeof Numeric;
|
|
1885
1911
|
readonly Boolean: typeof Boolean$1;
|
|
1886
1912
|
readonly Uuid: typeof Uuid;
|
|
1913
|
+
readonly Date: typeof Date$1;
|
|
1887
1914
|
readonly Timestamptz: typeof Timestamptz;
|
|
1888
1915
|
readonly Enum: typeof Enum$1;
|
|
1889
1916
|
readonly Jsonb: typeof Jsonb;
|
package/dist/index.d.ts
CHANGED
|
@@ -1734,6 +1734,32 @@ interface UuidOptions<T extends object> extends Omit<PropertyOptions<T>, 'type'
|
|
|
1734
1734
|
*/
|
|
1735
1735
|
declare function Uuid<T extends object>(options?: UuidOptions<T>): (target: T, propertyName: string) => void;
|
|
1736
1736
|
//#endregion
|
|
1737
|
+
//#region src/modules/mikro-orm/decorators/columns/date.column.d.ts
|
|
1738
|
+
interface DateOptions<T extends object> extends Omit<PropertyOptions<T>, 'type' | 'columnType'> {
|
|
1739
|
+
example?: SchemaObject['example'];
|
|
1740
|
+
examples?: SchemaObject['examples'];
|
|
1741
|
+
}
|
|
1742
|
+
/**
|
|
1743
|
+
* DATE 列装饰器,声明一个只含日期的列(无时间、无时区)。
|
|
1744
|
+
*
|
|
1745
|
+
* 自动应用 MikroORM `@Property({ type: 'date' })`、`@Matches()` + `@IsISO8601({ strict: true })`
|
|
1746
|
+
* 验证及 Swagger schema(format: date)。
|
|
1747
|
+
*
|
|
1748
|
+
* MikroORM `DateType` 在 JS 侧表示为 `YYYY-MM-DD` 字符串,不是 `Date` 对象,也不代表某个绝对时刻。
|
|
1749
|
+
*
|
|
1750
|
+
* @param options - 列配置
|
|
1751
|
+
*
|
|
1752
|
+
* @example
|
|
1753
|
+
* ```typescript
|
|
1754
|
+
* @Entity()
|
|
1755
|
+
* class CourseOccurrence {
|
|
1756
|
+
* @Date({ comment: '计划日期' })
|
|
1757
|
+
* date: string
|
|
1758
|
+
* }
|
|
1759
|
+
* ```
|
|
1760
|
+
*/
|
|
1761
|
+
declare function Date$1<T extends object>(options?: DateOptions<T>): (target: T, propertyName: string) => void;
|
|
1762
|
+
//#endregion
|
|
1737
1763
|
//#region src/modules/mikro-orm/decorators/columns/timestamptz.column.d.ts
|
|
1738
1764
|
interface TimestamptzOptions<T extends object> extends Omit<PropertyOptions<T>, 'type' | 'columnType'> {
|
|
1739
1765
|
example?: SchemaObject['example'];
|
|
@@ -1884,6 +1910,7 @@ declare const Column: {
|
|
|
1884
1910
|
readonly Numeric: typeof Numeric;
|
|
1885
1911
|
readonly Boolean: typeof Boolean$1;
|
|
1886
1912
|
readonly Uuid: typeof Uuid;
|
|
1913
|
+
readonly Date: typeof Date$1;
|
|
1887
1914
|
readonly Timestamptz: typeof Timestamptz;
|
|
1888
1915
|
readonly Enum: typeof Enum$1;
|
|
1889
1916
|
readonly Jsonb: typeof Jsonb;
|
package/dist/index.js
CHANGED
|
@@ -2521,6 +2521,47 @@ function Uuid(options) {
|
|
|
2521
2521
|
};
|
|
2522
2522
|
}
|
|
2523
2523
|
//#endregion
|
|
2524
|
+
//#region src/modules/mikro-orm/decorators/columns/date.column.ts
|
|
2525
|
+
/**
|
|
2526
|
+
* DATE 列装饰器,声明一个只含日期的列(无时间、无时区)。
|
|
2527
|
+
*
|
|
2528
|
+
* 自动应用 MikroORM `@Property({ type: 'date' })`、`@Matches()` + `@IsISO8601({ strict: true })`
|
|
2529
|
+
* 验证及 Swagger schema(format: date)。
|
|
2530
|
+
*
|
|
2531
|
+
* MikroORM `DateType` 在 JS 侧表示为 `YYYY-MM-DD` 字符串,不是 `Date` 对象,也不代表某个绝对时刻。
|
|
2532
|
+
*
|
|
2533
|
+
* @param options - 列配置
|
|
2534
|
+
*
|
|
2535
|
+
* @example
|
|
2536
|
+
* ```typescript
|
|
2537
|
+
* @Entity()
|
|
2538
|
+
* class CourseOccurrence {
|
|
2539
|
+
* @Date({ comment: '计划日期' })
|
|
2540
|
+
* date: string
|
|
2541
|
+
* }
|
|
2542
|
+
* ```
|
|
2543
|
+
*/
|
|
2544
|
+
function Date$1(options) {
|
|
2545
|
+
return (target, propertyKey) => {
|
|
2546
|
+
(0, _mikro_orm_decorators_legacy.Property)({
|
|
2547
|
+
...options,
|
|
2548
|
+
type: "date"
|
|
2549
|
+
})(target, propertyKey);
|
|
2550
|
+
(0, _nestjs_common.applyDecorators)((0, class_validator.Matches)(/^\d{4}-\d{2}-\d{2}$/, { message: "$property must be a date in YYYY-MM-DD format" }), (0, class_validator.IsISO8601)({ strict: true }), Property({
|
|
2551
|
+
optional: options?.nullable,
|
|
2552
|
+
lazy: options?.lazy,
|
|
2553
|
+
schema: {
|
|
2554
|
+
type: "string",
|
|
2555
|
+
format: "date",
|
|
2556
|
+
description: options?.comment,
|
|
2557
|
+
example: options?.example,
|
|
2558
|
+
examples: options?.examples,
|
|
2559
|
+
required: !options?.nullable
|
|
2560
|
+
}
|
|
2561
|
+
}))(target, propertyKey);
|
|
2562
|
+
};
|
|
2563
|
+
}
|
|
2564
|
+
//#endregion
|
|
2524
2565
|
//#region src/modules/mikro-orm/decorators/columns/timestamptz.column.ts
|
|
2525
2566
|
/**
|
|
2526
2567
|
* TIMESTAMPTZ 列装饰器,声明一个带时区的时间戳列。
|
|
@@ -2769,6 +2810,7 @@ const Column = {
|
|
|
2769
2810
|
Numeric,
|
|
2770
2811
|
Boolean: Boolean$1,
|
|
2771
2812
|
Uuid,
|
|
2813
|
+
Date: Date$1,
|
|
2772
2814
|
Timestamptz,
|
|
2773
2815
|
Enum: Enum$1,
|
|
2774
2816
|
Jsonb,
|