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.
@@ -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]: T[K];
59
+ [K in keyof T]+?: T[K];
6
60
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tspace-mysql",
3
- "version": "1.5.2",
3
+ "version": "1.5.4",
4
4
  "description": "mysql query builder object relational mapping (ORM)",
5
5
  "main": "build/lib/index.js",
6
6
  "types": "build/lib/index.d.ts",