@mikro-orm/decorators 7.1.6-dev.8 → 7.1.6
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/es/Check.d.ts +3 -3
- package/es/Check.js +4 -2
- package/package.json +3 -3
package/es/Check.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { type CheckConstraint } from '@mikro-orm/core';
|
|
2
|
-
/** Defines a database check constraint on a property (TC39 decorator). */
|
|
3
|
-
export declare function Check<T>(options: CheckConstraint<T>): (value: unknown, context: ClassFieldDecoratorContext<T>) => void;
|
|
1
|
+
import { type CheckConstraint, type EntityCtor } from '@mikro-orm/core';
|
|
2
|
+
/** Defines a database check constraint on a property or entity class (TC39 decorator). */
|
|
3
|
+
export declare function Check<T>(options: CheckConstraint<T>): (value: unknown, context: ClassDecoratorContext<T & EntityCtor> | ClassFieldDecoratorContext<T>) => void;
|
package/es/Check.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
/** Defines a database check constraint on a property (TC39 decorator). */
|
|
1
|
+
/** Defines a database check constraint on a property or entity class (TC39 decorator). */
|
|
2
2
|
export function Check(options) {
|
|
3
3
|
return function (value, context) {
|
|
4
4
|
const meta = context.metadata;
|
|
5
5
|
meta.checks ??= [];
|
|
6
|
-
|
|
6
|
+
if (context.kind === 'field') {
|
|
7
|
+
options.property ??= context.name;
|
|
8
|
+
}
|
|
7
9
|
meta.checks.push(options);
|
|
8
10
|
};
|
|
9
11
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/decorators",
|
|
3
|
-
"version": "7.1.6
|
|
3
|
+
"version": "7.1.6",
|
|
4
4
|
"description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"data-mapper",
|
|
@@ -49,10 +49,10 @@
|
|
|
49
49
|
"copy": "node ../../scripts/copy.mjs"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@mikro-orm/core": "^7.1.
|
|
52
|
+
"@mikro-orm/core": "^7.1.6"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
|
-
"@mikro-orm/core": "7.1.6
|
|
55
|
+
"@mikro-orm/core": "7.1.6",
|
|
56
56
|
"reflect-metadata": "^0.1.0 || ^0.2.0"
|
|
57
57
|
},
|
|
58
58
|
"peerDependenciesMeta": {
|