@e22m4u/js-repository 0.5.1 → 0.5.2
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/package.json +1 -1
- package/src/definition/model/properties/data-type.d.ts +13 -8
- package/src/definition/model/properties/property-definition.d.ts +3 -3
- package/src/definition/model/properties/property-uniqueness.d.ts +11 -5
- package/src/definition/model/relations/relation-definition.d.ts +9 -9
- package/src/definition/model/relations/relation-type.d.ts +11 -6
package/package.json
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Data type.
|
|
3
3
|
*/
|
|
4
|
-
export declare
|
|
5
|
-
ANY
|
|
6
|
-
STRING
|
|
7
|
-
NUMBER
|
|
8
|
-
BOOLEAN
|
|
9
|
-
ARRAY
|
|
10
|
-
OBJECT
|
|
11
|
-
}
|
|
4
|
+
export declare const DataType: {
|
|
5
|
+
ANY: 'any';
|
|
6
|
+
STRING: 'string';
|
|
7
|
+
NUMBER: 'number';
|
|
8
|
+
BOOLEAN: 'boolean';
|
|
9
|
+
ARRAY: 'array';
|
|
10
|
+
OBJECT: 'object';
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Type of DataType.
|
|
15
|
+
*/
|
|
16
|
+
export type DataType = (typeof DataType)[keyof typeof DataType];
|
|
@@ -7,8 +7,8 @@ import {PropertyTransformOptions} from './property-transformer/index.js';
|
|
|
7
7
|
* Full property definition.
|
|
8
8
|
*/
|
|
9
9
|
export declare type FullPropertyDefinition = {
|
|
10
|
-
type:
|
|
11
|
-
itemType?:
|
|
10
|
+
type: DataType;
|
|
11
|
+
itemType?: DataType;
|
|
12
12
|
itemModel?: string;
|
|
13
13
|
model?: string;
|
|
14
14
|
primaryKey?: boolean;
|
|
@@ -18,7 +18,7 @@ export declare type FullPropertyDefinition = {
|
|
|
18
18
|
default?: unknown;
|
|
19
19
|
validate?: PropertyValidateOptions;
|
|
20
20
|
transform?: PropertyTransformOptions;
|
|
21
|
-
unique?: boolean |
|
|
21
|
+
unique?: boolean | PropertyUniqueness;
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
/**
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Property uniqueness.
|
|
3
3
|
*/
|
|
4
|
-
export declare
|
|
5
|
-
STRICT
|
|
6
|
-
SPARSE
|
|
7
|
-
NON_UNIQUE
|
|
8
|
-
}
|
|
4
|
+
export declare const PropertyUniqueness: {
|
|
5
|
+
STRICT: 'strict';
|
|
6
|
+
SPARSE: 'sparse';
|
|
7
|
+
NON_UNIQUE: 'nonUnique';
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Type of PropertyUniqueness.
|
|
12
|
+
*/
|
|
13
|
+
export type PropertyUniqueness =
|
|
14
|
+
(typeof PropertyUniqueness)[keyof typeof PropertyUniqueness];
|
|
@@ -50,7 +50,7 @@ export declare type RelationDefinition =
|
|
|
50
50
|
* ```
|
|
51
51
|
*/
|
|
52
52
|
export declare type BelongsToDefinition = {
|
|
53
|
-
type:
|
|
53
|
+
type: typeof RelationType.BELONGS_TO;
|
|
54
54
|
polymorphic?: false;
|
|
55
55
|
model: string;
|
|
56
56
|
foreignKey?: string;
|
|
@@ -78,7 +78,7 @@ export declare type BelongsToDefinition = {
|
|
|
78
78
|
* ```
|
|
79
79
|
*/
|
|
80
80
|
export declare type PolyBelongsToDefinition = {
|
|
81
|
-
type:
|
|
81
|
+
type: typeof RelationType.BELONGS_TO;
|
|
82
82
|
polymorphic: true;
|
|
83
83
|
foreignKey?: string;
|
|
84
84
|
discriminator?: string;
|
|
@@ -97,7 +97,7 @@ export declare type PolyBelongsToDefinition = {
|
|
|
97
97
|
* ```
|
|
98
98
|
*/
|
|
99
99
|
export declare type HasOneDefinition = {
|
|
100
|
-
type:
|
|
100
|
+
type: typeof RelationType.HAS_ONE;
|
|
101
101
|
model: string;
|
|
102
102
|
foreignKey: string;
|
|
103
103
|
polymorphic?: false;
|
|
@@ -117,7 +117,7 @@ export declare type HasOneDefinition = {
|
|
|
117
117
|
* ```
|
|
118
118
|
*/
|
|
119
119
|
export declare type PolyHasOneDefinitionWithTargetRelationName = {
|
|
120
|
-
type:
|
|
120
|
+
type: typeof RelationType.HAS_ONE;
|
|
121
121
|
model: string;
|
|
122
122
|
polymorphic: string;
|
|
123
123
|
foreignKey?: undefined;
|
|
@@ -139,7 +139,7 @@ export declare type PolyHasOneDefinitionWithTargetRelationName = {
|
|
|
139
139
|
* ```
|
|
140
140
|
*/
|
|
141
141
|
export declare type PolyHasOneDefinitionWithTargetKeys = {
|
|
142
|
-
type:
|
|
142
|
+
type: typeof RelationType.HAS_ONE;
|
|
143
143
|
model: string;
|
|
144
144
|
polymorphic: true;
|
|
145
145
|
foreignKey: string;
|
|
@@ -159,7 +159,7 @@ export declare type PolyHasOneDefinitionWithTargetKeys = {
|
|
|
159
159
|
* ```
|
|
160
160
|
*/
|
|
161
161
|
export declare type HasManyDefinition = {
|
|
162
|
-
type:
|
|
162
|
+
type: typeof RelationType.HAS_MANY;
|
|
163
163
|
model: string;
|
|
164
164
|
foreignKey: string;
|
|
165
165
|
polymorphic?: false;
|
|
@@ -179,7 +179,7 @@ export declare type HasManyDefinition = {
|
|
|
179
179
|
* ```
|
|
180
180
|
*/
|
|
181
181
|
export declare type PolyHasManyDefinitionWithTargetRelationName = {
|
|
182
|
-
type:
|
|
182
|
+
type: typeof RelationType.HAS_MANY;
|
|
183
183
|
model: string;
|
|
184
184
|
polymorphic: string;
|
|
185
185
|
foreignKey?: undefined;
|
|
@@ -201,7 +201,7 @@ export declare type PolyHasManyDefinitionWithTargetRelationName = {
|
|
|
201
201
|
* ```
|
|
202
202
|
*/
|
|
203
203
|
export declare type PolyHasManyDefinitionWithTargetKeys = {
|
|
204
|
-
type:
|
|
204
|
+
type: typeof RelationType.HAS_MANY;
|
|
205
205
|
model: string;
|
|
206
206
|
polymorphic: true;
|
|
207
207
|
foreignKey: string;
|
|
@@ -229,7 +229,7 @@ export declare type PolyHasManyDefinitionWithTargetKeys = {
|
|
|
229
229
|
* ```
|
|
230
230
|
*/
|
|
231
231
|
export declare type ReferencesManyDefinition = {
|
|
232
|
-
type:
|
|
232
|
+
type: typeof RelationType.REFERENCES_MANY;
|
|
233
233
|
model: string;
|
|
234
234
|
foreignKey?: string;
|
|
235
235
|
discriminator?: undefined;
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Relation type.
|
|
3
3
|
*/
|
|
4
|
-
export declare
|
|
5
|
-
BELONGS_TO
|
|
6
|
-
HAS_ONE
|
|
7
|
-
HAS_MANY
|
|
8
|
-
REFERENCES_MANY
|
|
9
|
-
}
|
|
4
|
+
export declare const RelationType: {
|
|
5
|
+
BELONGS_TO: 'belongsTo';
|
|
6
|
+
HAS_ONE: 'hasOne';
|
|
7
|
+
HAS_MANY: 'hasMany';
|
|
8
|
+
REFERENCES_MANY: 'referencesMany';
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Type of RelationType.
|
|
13
|
+
*/
|
|
14
|
+
export type RelationType = (typeof RelationType)[keyof typeof RelationType];
|