tspace-mysql 1.5.2 → 1.5.4
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 +8 -8
- package/build/lib/Interface.d.ts +2 -2
- package/build/lib/connection/options.js +1 -1
- package/build/lib/constants/index.d.ts +1 -3
- package/build/lib/constants/index.js +0 -96
- package/build/lib/core/Abstracts/AbstractBuilder.d.ts +2 -2
- package/build/lib/core/Abstracts/AbstractBuilder.js +1 -4
- package/build/lib/core/Builder.d.ts +5 -3
- package/build/lib/core/Builder.js +91 -69
- package/build/lib/core/DB.js +1 -1
- package/build/lib/core/Handlers/State.d.ts +2 -2
- package/build/lib/core/Handlers/State.js +126 -12
- package/build/lib/core/Model.d.ts +97 -76
- package/build/lib/core/Model.js +208 -93
- package/build/lib/core/Type.d.ts +55 -1
- package/package.json +1 -1
package/build/lib/core/Type.d.ts
CHANGED
|
@@ -1,6 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {type} TSchema typeof the schema
|
|
4
|
+
* @param {type} TSpecific override of the schema
|
|
5
|
+
* @example
|
|
6
|
+
* import { Blueprint , SchemaType , Model } from 'tspace-mysql'
|
|
7
|
+
* const schemaUser = {
|
|
8
|
+
* id :new Blueprint().int().notNull().primary().autoIncrement(),
|
|
9
|
+
* uuid :new Blueprint().varchar(50).null(),
|
|
10
|
+
* email :new Blueprint().varchar(50).null(),
|
|
11
|
+
* name :new Blueprint().varchar(255).null(),
|
|
12
|
+
* username : new Blueprint().varchar(255).null(),
|
|
13
|
+
* password : new Blueprint().varchar(255).null(),
|
|
14
|
+
* createdAt :new Blueprint().timestamp().null(),
|
|
15
|
+
* updatedAt :new Blueprint().timestamp().null()
|
|
16
|
+
* }
|
|
17
|
+
*
|
|
18
|
+
* type SchemaUserType = SchemaType<typeof schemaUser , {
|
|
19
|
+
* id : number,
|
|
20
|
+
* uuid : string,
|
|
21
|
+
* ........
|
|
22
|
+
* }>
|
|
23
|
+
*
|
|
24
|
+
* class User<SchemaUserType> {}
|
|
25
|
+
*/
|
|
1
26
|
export type SchemaType<TSchema, TSpecific = any> = {
|
|
2
27
|
[K in keyof TSchema]: K extends keyof TSpecific ? TSpecific[K] : any;
|
|
3
28
|
};
|
|
29
|
+
/**
|
|
30
|
+
*
|
|
31
|
+
* @param {type} T relationships type
|
|
32
|
+
* @example
|
|
33
|
+
* import { Blueprint , RelationType , SchemaUserType , Model } from 'tspace-mysql'
|
|
34
|
+
* const schemaUser = {
|
|
35
|
+
* id :new Blueprint().int().notNull().primary().autoIncrement(),
|
|
36
|
+
* uuid :new Blueprint().varchar(50).null(),
|
|
37
|
+
* email :new Blueprint().varchar(50).null(),
|
|
38
|
+
* name :new Blueprint().varchar(255).null(),
|
|
39
|
+
* username : new Blueprint().varchar(255).null(),
|
|
40
|
+
* password : new Blueprint().varchar(255).null(),
|
|
41
|
+
* createdAt :new Blueprint().timestamp().null(),
|
|
42
|
+
* updatedAt :new Blueprint().timestamp().null()
|
|
43
|
+
* }
|
|
44
|
+
*
|
|
45
|
+
* type SchemaUserType = SchemaType<typeof schemaUser , {
|
|
46
|
+
* id : number,
|
|
47
|
+
* uuid : string,
|
|
48
|
+
* ........
|
|
49
|
+
* }>
|
|
50
|
+
*
|
|
51
|
+
* type RelationUserType = RelationType<{
|
|
52
|
+
* phones : SchemaPhoneType[]
|
|
53
|
+
* phone : SchemaPhoneType
|
|
54
|
+
* }>
|
|
55
|
+
*
|
|
56
|
+
* class User<SchemaUserType,RelationUserType> {}
|
|
57
|
+
*/
|
|
4
58
|
export type RelationType<T> = {
|
|
5
|
-
[K in keyof T]
|
|
59
|
+
[K in keyof T]+?: T[K];
|
|
6
60
|
};
|