tspace-mysql 1.9.0 → 1.9.1-beta.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/README.md +4580 -133
- package/dist/lib/config/index.d.ts +2 -2
- package/dist/lib/config/index.js +24 -16
- package/dist/lib/config/index.js.map +1 -1
- package/dist/lib/constants/index.d.ts +10 -1
- package/dist/lib/constants/index.js +11 -2
- package/dist/lib/constants/index.js.map +1 -1
- package/dist/lib/core/Abstracts/AbstractBuilder.d.ts +27 -23
- package/dist/lib/core/Abstracts/AbstractBuilder.js +11 -13
- package/dist/lib/core/Abstracts/AbstractBuilder.js.map +1 -1
- package/dist/lib/core/Abstracts/AbstractDB.d.ts +5 -2
- package/dist/lib/core/Abstracts/AbstractDB.js.map +1 -1
- package/dist/lib/core/Abstracts/AbstractModel.d.ts +7 -2
- package/dist/lib/core/Abstracts/AbstractModel.js.map +1 -1
- package/dist/lib/core/Abstracts/AbstractView.js.map +1 -1
- package/dist/lib/core/Blueprint.d.ts +37 -17
- package/dist/lib/core/Blueprint.js +38 -14
- package/dist/lib/core/Blueprint.js.map +1 -1
- package/dist/lib/core/Builder.d.ts +314 -42
- package/dist/lib/core/Builder.js +686 -391
- package/dist/lib/core/Builder.js.map +1 -1
- package/dist/lib/core/Cache/DBCache.js +19 -20
- package/dist/lib/core/Cache/DBCache.js.map +1 -1
- package/dist/lib/core/Cache/MemoryCache.js +3 -3
- package/dist/lib/core/Cache/MemoryCache.js.map +1 -1
- package/dist/lib/core/Cache/RedisCache.js +27 -17
- package/dist/lib/core/Cache/RedisCache.js.map +1 -1
- package/dist/lib/core/Cache/index.js +37 -17
- package/dist/lib/core/Cache/index.js.map +1 -1
- package/dist/lib/core/Contracts/AlterTable.d.ts +152 -0
- package/dist/lib/core/Contracts/AlterTable.js +243 -0
- package/dist/lib/core/Contracts/AlterTable.js.map +1 -0
- package/dist/lib/core/Contracts/Audit.d.ts +1 -1
- package/dist/lib/core/Contracts/Audit.js +2 -5
- package/dist/lib/core/Contracts/Audit.js.map +1 -1
- package/dist/lib/core/Contracts/Logger.d.ts +1 -1
- package/dist/lib/core/Contracts/Logger.js.map +1 -1
- package/dist/lib/core/DB.d.ts +103 -11
- package/dist/lib/core/DB.js +158 -32
- package/dist/lib/core/DB.js.map +1 -1
- package/dist/lib/core/Decorator.d.ts +144 -16
- package/dist/lib/core/Decorator.js +156 -14
- package/dist/lib/core/Decorator.js.map +1 -1
- package/dist/lib/core/Driver/index.d.ts +50 -14
- package/dist/lib/core/Driver/index.js +13 -9
- package/dist/lib/core/Driver/index.js.map +1 -1
- package/dist/lib/core/Driver/mariadb/MariadbDriver.js +84 -29
- package/dist/lib/core/Driver/mariadb/MariadbDriver.js.map +1 -1
- package/dist/lib/core/Driver/mariadb/MariadbQueryBuilder.d.ts +48 -12
- package/dist/lib/core/Driver/mariadb/MariadbQueryBuilder.js +189 -28
- package/dist/lib/core/Driver/mariadb/MariadbQueryBuilder.js.map +1 -1
- package/dist/lib/core/Driver/mongodb/MongodbDriver.d.ts +24 -0
- package/dist/lib/core/Driver/mongodb/MongodbDriver.js +261 -0
- package/dist/lib/core/Driver/mongodb/MongodbDriver.js.map +1 -0
- package/dist/lib/core/Driver/mongodb/MongodbQueryBuilder.d.ts +141 -0
- package/dist/lib/core/Driver/mongodb/MongodbQueryBuilder.js +571 -0
- package/dist/lib/core/Driver/mongodb/MongodbQueryBuilder.js.map +1 -0
- package/dist/lib/core/Driver/mysql/MysqlDriver.js +115 -97
- package/dist/lib/core/Driver/mysql/MysqlDriver.js.map +1 -1
- package/dist/lib/core/Driver/mysql/MysqlQueryBuilder.d.ts +48 -12
- package/dist/lib/core/Driver/mysql/MysqlQueryBuilder.js +189 -28
- package/dist/lib/core/Driver/mysql/MysqlQueryBuilder.js.map +1 -1
- package/dist/lib/core/Driver/postgres/PostgresDriver.js +106 -73
- package/dist/lib/core/Driver/postgres/PostgresDriver.js.map +1 -1
- package/dist/lib/core/Driver/postgres/PostgresQueryBuilder.d.ts +53 -12
- package/dist/lib/core/Driver/postgres/PostgresQueryBuilder.js +318 -48
- package/dist/lib/core/Driver/postgres/PostgresQueryBuilder.js.map +1 -1
- package/dist/lib/core/Driver/sqlite/SqliteDriver.d.ts +21 -0
- package/dist/lib/core/Driver/sqlite/SqliteDriver.js +213 -0
- package/dist/lib/core/Driver/sqlite/SqliteDriver.js.map +1 -0
- package/dist/lib/core/Driver/sqlite/SqliteQueryBuilder.d.ts +146 -0
- package/dist/lib/core/Driver/sqlite/SqliteQueryBuilder.js +705 -0
- package/dist/lib/core/Driver/sqlite/SqliteQueryBuilder.js.map +1 -0
- package/dist/lib/core/Join.d.ts +63 -5
- package/dist/lib/core/Join.js +92 -15
- package/dist/lib/core/Join.js.map +1 -1
- package/dist/lib/core/JoinModel.d.ts +65 -9
- package/dist/lib/core/JoinModel.js +81 -52
- package/dist/lib/core/JoinModel.js.map +1 -1
- package/dist/lib/core/Meta.d.ts +22 -16
- package/dist/lib/core/Meta.js +28 -21
- package/dist/lib/core/Meta.js.map +1 -1
- package/dist/lib/core/Model.d.ts +644 -134
- package/dist/lib/core/Model.js +1361 -631
- package/dist/lib/core/Model.js.map +1 -1
- package/dist/lib/{tools/index.d.ts → core/Package.d.ts} +11 -3
- package/dist/lib/{tools/index.js → core/Package.js} +20 -7
- package/dist/lib/core/Package.js.map +1 -0
- package/dist/lib/core/Pool.js +42 -30
- package/dist/lib/core/Pool.js.map +1 -1
- package/dist/lib/core/Queue.d.ts +249 -0
- package/dist/lib/core/Queue.js +726 -0
- package/dist/lib/core/Queue.js.map +1 -0
- package/dist/lib/core/RelationManager.d.ts +4 -4
- package/dist/lib/core/RelationManager.js +168 -41
- package/dist/lib/core/RelationManager.js.map +1 -1
- package/dist/lib/core/Repository.d.ts +73 -207
- package/dist/lib/core/Repository.js +122 -234
- package/dist/lib/core/Repository.js.map +1 -1
- package/dist/lib/core/Schema.d.ts +211 -1
- package/dist/lib/core/Schema.js +370 -65
- package/dist/lib/core/Schema.js.map +1 -1
- package/dist/lib/core/StateManager.d.ts +31 -12
- package/dist/lib/core/StateManager.js +11 -5
- package/dist/lib/core/StateManager.js.map +1 -1
- package/dist/lib/core/UtilityTypes.d.ts +103 -81
- package/dist/lib/core/UtilityTypes.js.map +1 -1
- package/dist/lib/core/index.d.ts +4 -0
- package/dist/lib/core/index.js +6 -2
- package/dist/lib/core/index.js.map +1 -1
- package/dist/lib/types/decorator/index.d.ts +1 -1
- package/dist/lib/types/index.d.ts +120 -30
- package/dist/lib/types/repository/index.d.ts +68 -37
- package/dist/lib/utils/index.d.ts +13 -2
- package/dist/lib/utils/index.js +81 -2
- package/dist/lib/utils/index.js.map +1 -1
- package/package.json +14 -6
- package/dist/lib/tools/index.js.map +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Blueprint } from "./Blueprint";
|
|
2
|
-
import
|
|
2
|
+
import { Model } from "./Model";
|
|
3
|
+
import type { TPattern, TRelationOptions, TSave, TStateWhereCondition, TValidateSchema } from "../types";
|
|
3
4
|
declare const STATE_DEFAULT: {
|
|
4
5
|
readonly PRIMARY_KEY: string;
|
|
5
6
|
readonly VOID: boolean;
|
|
@@ -17,7 +18,7 @@ declare const STATE_DEFAULT: {
|
|
|
17
18
|
readonly EXCEPTS: string[];
|
|
18
19
|
readonly FROM: string[];
|
|
19
20
|
readonly JOIN: string[];
|
|
20
|
-
readonly WHERE:
|
|
21
|
+
readonly WHERE: TStateWhereCondition[];
|
|
21
22
|
readonly GROUP_BY: string[];
|
|
22
23
|
readonly ORDER_BY: string[];
|
|
23
24
|
readonly LIMIT: number | null;
|
|
@@ -27,14 +28,18 @@ declare const STATE_DEFAULT: {
|
|
|
27
28
|
readonly HIDDEN: string[];
|
|
28
29
|
readonly DEBUG: boolean;
|
|
29
30
|
readonly CTE: string[];
|
|
30
|
-
readonly PAGE: number;
|
|
31
|
+
readonly PAGE: number | null;
|
|
31
32
|
readonly AFTER_SAVE: number;
|
|
32
33
|
readonly HOOKS: Function[];
|
|
33
34
|
readonly ALIAS: string | null;
|
|
34
35
|
readonly RAW_ALIAS: string | null;
|
|
35
36
|
readonly UNION: string[];
|
|
36
37
|
readonly UNION_ALL: string[];
|
|
37
|
-
readonly ROW_LEVEL_LOCK:
|
|
38
|
+
readonly ROW_LEVEL_LOCK: {
|
|
39
|
+
readonly mode: "FOR_UPDATE" | "FOR_SHARE" | null;
|
|
40
|
+
readonly skipLocked: boolean | null;
|
|
41
|
+
readonly nowait: boolean | null;
|
|
42
|
+
};
|
|
38
43
|
};
|
|
39
44
|
declare const STATE_DB: {
|
|
40
45
|
readonly PRIMARY_KEY: string;
|
|
@@ -53,7 +58,7 @@ declare const STATE_DB: {
|
|
|
53
58
|
readonly EXCEPTS: string[];
|
|
54
59
|
readonly FROM: string[];
|
|
55
60
|
readonly JOIN: string[];
|
|
56
|
-
readonly WHERE:
|
|
61
|
+
readonly WHERE: TStateWhereCondition[];
|
|
57
62
|
readonly GROUP_BY: string[];
|
|
58
63
|
readonly ORDER_BY: string[];
|
|
59
64
|
readonly LIMIT: number | null;
|
|
@@ -63,14 +68,18 @@ declare const STATE_DB: {
|
|
|
63
68
|
readonly HIDDEN: string[];
|
|
64
69
|
readonly DEBUG: boolean;
|
|
65
70
|
readonly CTE: string[];
|
|
66
|
-
readonly PAGE: number;
|
|
71
|
+
readonly PAGE: number | null;
|
|
67
72
|
readonly AFTER_SAVE: number;
|
|
68
73
|
readonly HOOKS: Function[];
|
|
69
74
|
readonly ALIAS: string | null;
|
|
70
75
|
readonly RAW_ALIAS: string | null;
|
|
71
76
|
readonly UNION: string[];
|
|
72
77
|
readonly UNION_ALL: string[];
|
|
73
|
-
readonly ROW_LEVEL_LOCK:
|
|
78
|
+
readonly ROW_LEVEL_LOCK: {
|
|
79
|
+
readonly mode: "FOR_UPDATE" | "FOR_SHARE" | null;
|
|
80
|
+
readonly skipLocked: boolean | null;
|
|
81
|
+
readonly nowait: boolean | null;
|
|
82
|
+
};
|
|
74
83
|
};
|
|
75
84
|
declare const STATE_MODEL: {
|
|
76
85
|
readonly AUDIT: number | null;
|
|
@@ -83,8 +92,8 @@ declare const STATE_MODEL: {
|
|
|
83
92
|
readonly SOFT_DELETE_RELATIONS: boolean;
|
|
84
93
|
readonly REGISTRY: Record<string, string>;
|
|
85
94
|
readonly PATTERN: TPattern;
|
|
86
|
-
readonly
|
|
87
|
-
readonly RELATIONS:
|
|
95
|
+
readonly APPLY_RELATIONS: TRelationOptions[];
|
|
96
|
+
readonly RELATIONS: TRelationOptions[];
|
|
88
97
|
readonly RELATIONS_TRASHED: boolean;
|
|
89
98
|
readonly RELATIONS_EXISTS: boolean;
|
|
90
99
|
readonly TIMESTAMP: boolean;
|
|
@@ -101,6 +110,7 @@ declare const STATE_MODEL: {
|
|
|
101
110
|
} | null;
|
|
102
111
|
readonly TABLE_LOGGER: string;
|
|
103
112
|
readonly TABLE_AUDIT: string;
|
|
113
|
+
readonly TABLE_JOB: string;
|
|
104
114
|
readonly VALIDATE_SCHEMA: boolean;
|
|
105
115
|
readonly VALIDATE_SCHEMA_DEFINED: TValidateSchema | null;
|
|
106
116
|
readonly FUNCTION_RELATION: boolean;
|
|
@@ -129,6 +139,11 @@ declare const STATE_MODEL: {
|
|
|
129
139
|
readonly LIFECYCLE_AFTER_REMOVES: Function[];
|
|
130
140
|
readonly ON_CREATED_TABLE: Function | null;
|
|
131
141
|
readonly ON_SYNC_TABLE: Function | null;
|
|
142
|
+
readonly OF_MANY: {
|
|
143
|
+
column: string;
|
|
144
|
+
aggregate: "MAX" | "MIN";
|
|
145
|
+
query: Model | null;
|
|
146
|
+
} | null;
|
|
132
147
|
readonly PRIMARY_KEY: string;
|
|
133
148
|
readonly VOID: boolean;
|
|
134
149
|
readonly DISTINCT: boolean;
|
|
@@ -145,7 +160,7 @@ declare const STATE_MODEL: {
|
|
|
145
160
|
readonly EXCEPTS: string[];
|
|
146
161
|
readonly FROM: string[];
|
|
147
162
|
readonly JOIN: string[];
|
|
148
|
-
readonly WHERE:
|
|
163
|
+
readonly WHERE: TStateWhereCondition[];
|
|
149
164
|
readonly GROUP_BY: string[];
|
|
150
165
|
readonly ORDER_BY: string[];
|
|
151
166
|
readonly LIMIT: number | null;
|
|
@@ -155,14 +170,18 @@ declare const STATE_MODEL: {
|
|
|
155
170
|
readonly HIDDEN: string[];
|
|
156
171
|
readonly DEBUG: boolean;
|
|
157
172
|
readonly CTE: string[];
|
|
158
|
-
readonly PAGE: number;
|
|
173
|
+
readonly PAGE: number | null;
|
|
159
174
|
readonly AFTER_SAVE: number;
|
|
160
175
|
readonly HOOKS: Function[];
|
|
161
176
|
readonly ALIAS: string | null;
|
|
162
177
|
readonly RAW_ALIAS: string | null;
|
|
163
178
|
readonly UNION: string[];
|
|
164
179
|
readonly UNION_ALL: string[];
|
|
165
|
-
readonly ROW_LEVEL_LOCK:
|
|
180
|
+
readonly ROW_LEVEL_LOCK: {
|
|
181
|
+
readonly mode: "FOR_UPDATE" | "FOR_SHARE" | null;
|
|
182
|
+
readonly skipLocked: boolean | null;
|
|
183
|
+
readonly nowait: boolean | null;
|
|
184
|
+
};
|
|
166
185
|
};
|
|
167
186
|
type State = typeof STATE_MODEL & typeof STATE_DB & typeof STATE_DEFAULT;
|
|
168
187
|
declare class StateManager {
|
|
@@ -25,14 +25,18 @@ const STATE_DEFAULT = {
|
|
|
25
25
|
HIDDEN: [],
|
|
26
26
|
DEBUG: false,
|
|
27
27
|
CTE: [],
|
|
28
|
-
PAGE:
|
|
28
|
+
PAGE: null,
|
|
29
29
|
AFTER_SAVE: 100,
|
|
30
30
|
HOOKS: [],
|
|
31
31
|
ALIAS: null,
|
|
32
32
|
RAW_ALIAS: null,
|
|
33
33
|
UNION: [],
|
|
34
34
|
UNION_ALL: [],
|
|
35
|
-
ROW_LEVEL_LOCK:
|
|
35
|
+
ROW_LEVEL_LOCK: {
|
|
36
|
+
mode: null,
|
|
37
|
+
skipLocked: false,
|
|
38
|
+
nowait: false
|
|
39
|
+
}
|
|
36
40
|
};
|
|
37
41
|
const STATE_DB = {
|
|
38
42
|
...STATE_DEFAULT,
|
|
@@ -49,7 +53,7 @@ const STATE_MODEL = {
|
|
|
49
53
|
SOFT_DELETE_RELATIONS: false,
|
|
50
54
|
REGISTRY: {},
|
|
51
55
|
PATTERN: 'default',
|
|
52
|
-
|
|
56
|
+
APPLY_RELATIONS: [],
|
|
53
57
|
RELATIONS: [],
|
|
54
58
|
RELATIONS_TRASHED: false,
|
|
55
59
|
RELATIONS_EXISTS: false,
|
|
@@ -60,8 +64,9 @@ const STATE_MODEL = {
|
|
|
60
64
|
},
|
|
61
65
|
LOGGER: false,
|
|
62
66
|
LOGGER_OPTIONS: null,
|
|
63
|
-
TABLE_LOGGER: '
|
|
64
|
-
TABLE_AUDIT: '
|
|
67
|
+
TABLE_LOGGER: 'tspace_loggers',
|
|
68
|
+
TABLE_AUDIT: 'tspace_audits',
|
|
69
|
+
TABLE_JOB: 'tspace_jobs',
|
|
65
70
|
VALIDATE_SCHEMA: false,
|
|
66
71
|
VALIDATE_SCHEMA_DEFINED: null,
|
|
67
72
|
FUNCTION_RELATION: false,
|
|
@@ -84,6 +89,7 @@ const STATE_MODEL = {
|
|
|
84
89
|
LIFECYCLE_AFTER_REMOVES: [],
|
|
85
90
|
ON_CREATED_TABLE: null,
|
|
86
91
|
ON_SYNC_TABLE: null,
|
|
92
|
+
OF_MANY: null
|
|
87
93
|
};
|
|
88
94
|
class StateManager {
|
|
89
95
|
STATE = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StateManager.js","sourceRoot":"","sources":["../../../src/lib/core/StateManager.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"StateManager.js","sourceRoot":"","sources":["../../../src/lib/core/StateManager.ts"],"names":[],"mappings":";;;AAYA,MAAM,aAAa,GAAG;IACpB,WAAW,EAAE,IAAc;IAC3B,IAAI,EAAE,KAAgB;IACtB,QAAQ,EAAE,KAAgB;IAC1B,IAAI,EAAE,IAAoB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AK,QAAQ,EAAE,CAAC;YAC/B,MAAM,IAAI,KAAK,CAAC,SAAS,CAAC,CAAA;QAC9B,CAAC;QAED,IAAG,SAAS;YAAE,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAA;QAEtC,OAAM;IACV,CAAC;CACJ;AAEQ,oCAAY;AACrB,kBAAe,YAAY,CAAA"}
|
|
@@ -1,38 +1,10 @@
|
|
|
1
1
|
import { Blueprint } from "./Blueprint";
|
|
2
2
|
import { Model } from "./Model";
|
|
3
3
|
import { Repository } from "./Repository";
|
|
4
|
-
import type { TDeepExpand,
|
|
4
|
+
import type { TDeepExpand, TResultResolved, TFreezeStringQuery, TIsEnum, TOperatorQuery, TPagination, TRawStringQuery, TRelationKeys, TRelationResults, TSelectionMerger, TDeepOmit, TConflictKeys, TInsertInput, TUpdateInput, TInsertOrUpdateInput, TDefault, TRemoveDefault } from "../types";
|
|
5
5
|
import type { TColumnsDecorator, TRelationsDecorator } from "../types/decorator";
|
|
6
|
-
import type { TRepositoryCreate, TRepositoryCreateMultiple, TRepositoryCreateOrThings, TRepositoryDelete, TRepositoryExcept, TRepositoryGroupBy, TRepositoryOrderBy, TRepositoryRelation, TRepositoryRequest, TRepositorySelect, TRepositoryUpdate, TRepositoryUpdateMultiple, TRepositoryWhere } from "../types/repository";
|
|
7
|
-
|
|
8
|
-
* The 'TSchemaStrict' type is used to specify the type of the schema.
|
|
9
|
-
*
|
|
10
|
-
* @param {type} T typeof the schema
|
|
11
|
-
* @param {type} S override type in the schema
|
|
12
|
-
* @example
|
|
13
|
-
* import { Blueprint, TSchema, Model, Schema } from 'tspace-mysql';
|
|
14
|
-
* const schemaUser = {
|
|
15
|
-
* id :new Blueprint().int().notNull().primary().autoIncrement(),
|
|
16
|
-
* uuid :new Blueprint().varchar(50).null(),
|
|
17
|
-
* email :new Blueprint().varchar(50).null(),
|
|
18
|
-
* name :new Blueprint().varchar(255).null(),
|
|
19
|
-
* username : new Blueprint().varchar(255).null(),
|
|
20
|
-
* password : new Blueprint().varchar(255).null(),
|
|
21
|
-
* createdAt :new Blueprint().timestamp().null(),
|
|
22
|
-
* updatedAt :new Blueprint().timestamp().null()
|
|
23
|
-
* }
|
|
24
|
-
*
|
|
25
|
-
* type TSchemaUser = TSchemaStrict<typeof schemaUser , {
|
|
26
|
-
* id : number,
|
|
27
|
-
* uuid : string,
|
|
28
|
-
* ........
|
|
29
|
-
* }>
|
|
30
|
-
*
|
|
31
|
-
* class User<TSchemaUser> {}
|
|
32
|
-
*/
|
|
33
|
-
export type TSchemaStrict<T, S = {}> = {
|
|
34
|
-
[K in keyof T]: K extends keyof S ? S[K] : T[K] extends Blueprint<infer U> ? U : any;
|
|
35
|
-
};
|
|
6
|
+
import type { TRepositoryCreate, TRepositoryCreateMultiple, TRepositoryCreateOrThings, TRepositoryDelete, TRepositoryExcept, TRepositoryExtendType, TRepositoryGroupBy, TRepositoryOrderBy, TRepositoryPrimitiveExtendType, TRepositoryRelation, TRepositoryRequest, TRepositorySelect, TRepositoryUpdate, TRepositoryUpdateMultiple, TRepositoryWhere } from "../types/repository";
|
|
7
|
+
import { z } from "zod";
|
|
36
8
|
/**
|
|
37
9
|
* The 'TSchema' type is used to specify the type of the schema.
|
|
38
10
|
*
|
|
@@ -63,8 +35,6 @@ export type TSchemaStrict<T, S = {}> = {
|
|
|
63
35
|
*/
|
|
64
36
|
export type TSchema<T, S = {}> = {
|
|
65
37
|
[K in keyof T]: K extends keyof S ? S[K] : T[K] extends Blueprint<infer U> ? U : any;
|
|
66
|
-
} & {
|
|
67
|
-
[key: string]: any;
|
|
68
38
|
};
|
|
69
39
|
/**
|
|
70
40
|
* The 'TRelation' type is used to specify the type of the relation.
|
|
@@ -121,7 +91,7 @@ export type TRelation<R> = {
|
|
|
121
91
|
* }
|
|
122
92
|
*
|
|
123
93
|
*/
|
|
124
|
-
export type TSchemaModel<M extends Model
|
|
94
|
+
export type TSchemaModel<M extends Model<any, any, any>> = ReturnType<M['typeOfSchema']>;
|
|
125
95
|
/**
|
|
126
96
|
* The 'TRelationModel' type is used to get type of schema in the model
|
|
127
97
|
* @generic {Model} M Model
|
|
@@ -139,80 +109,132 @@ export type TSchemaModel<M extends Model> = ReturnType<M['typeOfSchema']>;
|
|
|
139
109
|
* }
|
|
140
110
|
*
|
|
141
111
|
*/
|
|
142
|
-
export type TRelationModel<M extends Model
|
|
112
|
+
export type TRelationModel<M extends Model<any, any, any>> = ReturnType<M['typeOfRelation']>;
|
|
143
113
|
/**
|
|
144
114
|
* The 'TResult' type is used to get type of result from model
|
|
145
115
|
* @generic {Model} M Model
|
|
146
116
|
*/
|
|
147
|
-
export type TResult<M extends Model
|
|
117
|
+
export type TResult<M extends Model<any, any, any>> = TRelationResults<TRelationModel<M>> & TSchemaModel<M>;
|
|
148
118
|
/**
|
|
149
119
|
* The 'TPaginateResult' type is used to get type of result from model using paginate , pagination
|
|
150
120
|
* @generic {Model} M Model
|
|
151
121
|
*/
|
|
152
|
-
export type TPaginateResult<M extends Model
|
|
153
|
-
export type TSchemaKeyOf<M extends Model, T = TSchemaModel<M>> = keyof {
|
|
122
|
+
export type TPaginateResult<M extends Model<any, any, any>> = TPagination<TRelationResults<TRelationModel<M>> & TSchemaModel<M>>;
|
|
123
|
+
export type TSchemaKeyOf<M extends Model<any, any, any>, T = TSchemaModel<M>> = keyof {
|
|
154
124
|
[K in keyof T as string extends K ? never : K]: T[K];
|
|
155
125
|
} extends never ? string : keyof {
|
|
156
126
|
[K in keyof T as string extends K ? never : K]: T[K];
|
|
157
127
|
};
|
|
158
128
|
export declare namespace T {
|
|
159
|
-
type Schema<T, S = {}> = TSchema<T, S>;
|
|
160
|
-
type SchemaStrict<T, S = {}> = TSchemaStrict<T, S>;
|
|
129
|
+
type Schema<T, S = {}> = T extends Model ? TSchemaModel<T> : TSchema<T, S>;
|
|
161
130
|
type Relation<R> = TRelation<R>;
|
|
162
|
-
type SchemaModel<M extends Model
|
|
163
|
-
type RelationModel<M extends Model
|
|
164
|
-
type Repository<M extends Model
|
|
165
|
-
type
|
|
166
|
-
type ResultFiltered<M extends Model, K = {}, S = undefined, // selected by columns
|
|
131
|
+
type SchemaModel<M extends Model<any, any, any>> = keyof TColumnsDecorator<M> extends never ? TDeepExpand<TSchemaModel<M>> : TDeepExpand<TColumnsDecorator<M>>;
|
|
132
|
+
type RelationModel<M extends Model<any, any, any>> = keyof TColumnsDecorator<M> extends never ? TDeepExpand<TRelationModel<M>> : TDeepExpand<TRelationsDecorator<M>>;
|
|
133
|
+
type Repository<M extends Model<any, any, any>> = ReturnType<typeof Repository<M>>;
|
|
134
|
+
type ResultFiltered<M extends Model, S = undefined, // selected by columns
|
|
167
135
|
SR = undefined, // selected by relations
|
|
168
|
-
E = undefined
|
|
136
|
+
E = undefined, // excepted by omit columns
|
|
137
|
+
SRS = undefined, // selected by raw select
|
|
138
|
+
G = {}> = ([
|
|
169
139
|
S,
|
|
170
140
|
SR
|
|
171
|
-
] extends [undefined, undefined] ? T.Columns<M> :
|
|
141
|
+
] extends [undefined, undefined] ? SRS extends undefined ? E extends undefined ? T.Columns<M> & TRepositoryPrimitiveExtendType<G> : T.Result<M> & TRepositoryPrimitiveExtendType<G> : E extends undefined ? T.Columns<M> & {
|
|
142
|
+
[K in keyof SRS]: any;
|
|
143
|
+
} & TRepositoryPrimitiveExtendType<G> : T.Result<M> & {
|
|
144
|
+
[K in keyof SRS]: any;
|
|
145
|
+
} & TRepositoryPrimitiveExtendType<G> : TDeepExpand<TSelectionMerger<SRS extends undefined ? T.Result<M> : T.Result<M> & {
|
|
146
|
+
[K in keyof SRS]: any;
|
|
147
|
+
}, S extends undefined ? SRS extends undefined ? {
|
|
172
148
|
[K in keyof T.Columns<M>]: true;
|
|
173
|
-
} :
|
|
174
|
-
[K in keyof
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
type
|
|
181
|
-
type
|
|
182
|
-
|
|
149
|
+
} : {
|
|
150
|
+
[K in keyof T.Columns<M>]: true;
|
|
151
|
+
} & {
|
|
152
|
+
[K in keyof SRS]: true;
|
|
153
|
+
} : SRS extends undefined ? S : S & {
|
|
154
|
+
[K in keyof SRS]: true;
|
|
155
|
+
}, SR>> & TRepositoryPrimitiveExtendType<G>) extends infer $Resolved ? S extends undefined ? E extends undefined ? TDeepExpand<$Resolved> : TDeepExpand<TDeepOmit<$Resolved, E>> : TDeepExpand<$Resolved> : never;
|
|
156
|
+
type PaginateResultFiltered<M extends Model<any, any, any>, K = {}, S = undefined, SR = undefined, E = undefined, SRS = undefined> = TDeepExpand<TPagination<ResultFiltered<M, K, S, SR, E, SRS>>>;
|
|
157
|
+
type Result<M extends Model<any, any, any>, K = {}> = TDeepExpand<TResultResolved<M> & K> & {
|
|
158
|
+
[customKey: string]: unknown;
|
|
159
|
+
};
|
|
160
|
+
type PaginateResult<M extends Model<any, any, any>, K = {}> = TDeepExpand<TPagination<Result<M, K>>>;
|
|
161
|
+
type InsertResult<M extends Model<any, any, any>> = TDeepExpand<TResultResolved<M>>;
|
|
162
|
+
type InsertManyResult<M extends Model<any, any, any>> = TDeepExpand<TResultResolved<M>>[];
|
|
163
|
+
type InsertNotExistsResult<M extends Model<any, any, any>> = TDeepExpand<TResultResolved<M>> | null;
|
|
164
|
+
type UpdateResult<M extends Model<any, any, any>> = TDeepExpand<TResultResolved<M>> | null;
|
|
165
|
+
type UpdateManyResult<M extends Model<any, any, any>> = TDeepExpand<TResultResolved<M>>[];
|
|
183
166
|
type DeleteResult = boolean;
|
|
184
|
-
type
|
|
167
|
+
type InsertInput<K, C> = TInsertInput<K, C>;
|
|
168
|
+
type UpdateInput<K, C> = TUpdateInput<K, C>;
|
|
169
|
+
type InsertOrUpdateInput<K, C> = TInsertOrUpdateInput<K, C>;
|
|
170
|
+
type NoConflict<R extends readonly PropertyKey[], O extends readonly PropertyKey[]> = TConflictKeys<R, O> extends never ? {} : {
|
|
171
|
+
ERROR_DUPLICATE_KEYS: TConflictKeys<R, O>;
|
|
172
|
+
};
|
|
173
|
+
type ZodShapeCreate<M extends Model<any, any, any>, O extends T.ColumnKeys<M>[] = [], Opt extends T.ColumnKeys<M>[] = []> = {
|
|
174
|
+
[K in Extract<T.ColumnKeys<M>, keyof Columns<M>> as K extends O[number] ? K extends Opt[number] ? K : never : K]: K extends Opt[number] ? z.ZodOptional<BlueprintToZod<Columns<M>[K]>> : BlueprintToZod<Columns<M>[K]>;
|
|
175
|
+
};
|
|
176
|
+
type ZodShapeUpdate<M extends Model<any, any, any>, R extends T.ColumnKeys<M>[] = [], O extends T.ColumnKeys<M>[] = []> = {
|
|
177
|
+
[K in Extract<T.ColumnKeys<M>, keyof Columns<M>> as K extends O[number] ? never : K]: K extends R[number] ? BlueprintToZod<Columns<M>[K]> : z.ZodOptional<BlueprintToZod<Columns<M>[K]>>;
|
|
178
|
+
};
|
|
179
|
+
type BlueprintToZod<T> = T extends number ? z.ZodNumber : T extends string ? z.ZodString : T extends Date ? z.ZodDate : T extends null ? z.ZodNull : z.ZodTypeAny;
|
|
180
|
+
type Raw<M extends Model<any, any, any>> = {
|
|
181
|
+
[K in keyof TSchemaModel<M>]: TSchemaModel<M>[K] | TOperatorQuery | TRawStringQuery | TFreezeStringQuery;
|
|
182
|
+
};
|
|
183
|
+
type ColumnBlueprints<M extends Model<any, any, any>> = {
|
|
184
|
+
[K in keyof Columns<M, {
|
|
185
|
+
InputQuery: true;
|
|
186
|
+
}>]: Blueprint<Columns<M, {
|
|
187
|
+
InputQuery: true;
|
|
188
|
+
}>[K]>;
|
|
189
|
+
};
|
|
190
|
+
type Columns<M extends Model<any, any, any>, Options extends {
|
|
185
191
|
InputQuery?: boolean;
|
|
186
|
-
|
|
187
|
-
|
|
192
|
+
Default?: boolean;
|
|
193
|
+
} = {
|
|
194
|
+
InputQuery: false;
|
|
195
|
+
Default: false;
|
|
196
|
+
}> = TDeepExpand<keyof TColumnsDecorator<M> extends never ? {
|
|
197
|
+
[K in keyof TSchemaModel<M>]: Options["InputQuery"] extends true ? (Options["Default"] extends false ? TRemoveDefault<TSchemaModel<M>[K]> : TSchemaModel<M>[K]) | TOperatorQuery | TRawStringQuery | TFreezeStringQuery : (Options["Default"] extends false ? TRemoveDefault<TSchemaModel<M>[K]> : TSchemaModel<M>[K]);
|
|
188
198
|
} : TColumnsDecorator<M, Options>>;
|
|
189
|
-
type
|
|
190
|
-
|
|
199
|
+
type ColumnOptions<M extends Model<any, any, any>, Options extends {
|
|
200
|
+
InputQuery?: boolean;
|
|
201
|
+
Default?: boolean;
|
|
202
|
+
} = {
|
|
203
|
+
InputQuery: true;
|
|
204
|
+
}> = Columns<M, Options>;
|
|
205
|
+
type ColumnValue<M extends Model<any, any, any>, K extends T.ColumnKeys<M>, C extends T.ColumnOptions<M> = T.ColumnOptions<M, {
|
|
206
|
+
Default: false;
|
|
207
|
+
}>> = K extends keyof C ? C[K] : any;
|
|
208
|
+
type ColumnKeys<M extends Model<any, any, any>, Options extends {
|
|
209
|
+
InputQuery?: boolean;
|
|
210
|
+
Default?: boolean;
|
|
211
|
+
} = {}> = (keyof TColumnsDecorator<M> extends never ? TSchemaKeyOf<M> : keyof TColumnsDecorator<M>) | (Options["InputQuery"] extends true ? `${string}.${string}` | TRawStringQuery | TFreezeStringQuery : `${string}.${string}`);
|
|
212
|
+
type ColumnEnumMap<M extends Model<any, any, any>> = keyof TColumnsDecorator<M> extends never ? {
|
|
191
213
|
[K in keyof TSchemaModel<M> as TIsEnum<NonNullable<TSchemaModel<M>[K]>> extends true ? K : never]: TSchemaModel<M>[K];
|
|
192
214
|
} : {
|
|
193
215
|
[K in keyof TColumnsDecorator<M> as TIsEnum<NonNullable<TColumnsDecorator<M>[K]>> extends true ? K : never]: TColumnsDecorator<M>[K];
|
|
194
216
|
};
|
|
195
|
-
type ColumnEnumKeys<M extends Model
|
|
217
|
+
type ColumnEnumKeys<M extends Model<any, any, any>> = keyof TColumnsDecorator<M> extends never ? {
|
|
196
218
|
[K in keyof TSchemaModel<M>]: TIsEnum<NonNullable<TSchemaModel<M>[K]>> extends true ? K : never;
|
|
197
219
|
}[keyof TSchemaModel<M>] : {
|
|
198
220
|
[K in keyof TColumnsDecorator<M>]: TIsEnum<NonNullable<TColumnsDecorator<M>[K]>> extends true ? K : never;
|
|
199
221
|
}[keyof TColumnsDecorator<M>];
|
|
200
|
-
type Relations<M extends Model
|
|
201
|
-
type RelationKeys<M extends Model
|
|
202
|
-
type
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
type
|
|
206
|
-
type
|
|
207
|
-
type
|
|
208
|
-
type
|
|
209
|
-
type
|
|
210
|
-
type
|
|
211
|
-
type
|
|
212
|
-
type
|
|
213
|
-
type
|
|
214
|
-
type
|
|
215
|
-
type
|
|
216
|
-
type
|
|
217
|
-
type
|
|
222
|
+
type Relations<M extends Model<any, any, any>> = keyof TColumnsDecorator<M> extends never ? TRelationModel<M> : TRelationsDecorator<M>;
|
|
223
|
+
type RelationKeys<M extends Model<any, any, any>> = (keyof TColumnsDecorator<M> extends never ? TRelationKeys<TRelationModel<M>> : keyof TRelationsDecorator<M>);
|
|
224
|
+
type WhereOptions<M extends Model<any, any, any>> = TRepositoryWhere<TSchemaModel<M>, TRelationModel<M>, M>;
|
|
225
|
+
type SelectOptions<M extends Model<any, any, any>> = TRepositorySelect<TSchemaModel<M>, TRelationModel<M>, M>;
|
|
226
|
+
type ExceptOptions<M extends Model<any, any, any>> = TRepositoryExcept<TSchemaModel<M>, TRelationModel<M>, M>;
|
|
227
|
+
type OrderByOptions<M extends Model<any, any, any>> = TRepositoryOrderBy<TSchemaModel<M>, TRelationModel<M>, M>;
|
|
228
|
+
type GroupByOptions<M extends Model<any, any, any>> = TRepositoryGroupBy<TSchemaModel<M>, TRelationModel<M>, M>;
|
|
229
|
+
type RelationOptions<M extends Model<any, any, any>> = TRepositoryRelation<TRelationModel<M>, M>;
|
|
230
|
+
type RepositoryOptions<M extends Model<any, any, any>, S = undefined, SR = undefined, E = undefined, SRS = undefined, G = undefined> = TRepositoryRequest<TSchemaModel<M>, TRelationModel<M>, M, S, SR, E, SRS, G>;
|
|
231
|
+
type RepositoryCreate<M extends Model<any, any, any>, NR extends boolean | undefined = false> = TRepositoryCreate<M, NR>;
|
|
232
|
+
type RepositoryCreateMultiple<M extends Model<any, any, any>, NR extends boolean | undefined = false> = TRepositoryCreateMultiple<M, NR>;
|
|
233
|
+
type RepositoryUpdate<M extends Model<any, any, any>, NR extends boolean | undefined = false> = TRepositoryUpdate<M, NR>;
|
|
234
|
+
type RepositoryUpdateMultiple<M extends Model<any, any, any>, NR extends boolean | undefined = false> = TRepositoryUpdateMultiple<M, NR>;
|
|
235
|
+
type RepositoryCreateOrThings<M extends Model<any, any, any>, NR extends boolean | undefined = false> = TRepositoryCreateOrThings<M, NR>;
|
|
236
|
+
type RepositoryDelete<M extends Model<any, any, any>> = TRepositoryDelete<M>;
|
|
237
|
+
type RepositoryGenericTypeOptions = TRepositoryExtendType;
|
|
238
|
+
type Default<T = any> = TDefault<T>;
|
|
239
|
+
type QueryModifier<M extends Model<any, any, any>> = (query: M) => M;
|
|
218
240
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UtilityTypes.js","sourceRoot":"","sources":["../../../src/lib/core/UtilityTypes.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"UtilityTypes.js","sourceRoot":"","sources":["../../../src/lib/core/UtilityTypes.ts"],"names":[],"mappings":";;AAwfC,CAAC"}
|
package/dist/lib/core/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import Pool from "./Pool";
|
|
|
6
6
|
import sql from "./SqlLike";
|
|
7
7
|
import Meta from "./Meta";
|
|
8
8
|
import View from './View';
|
|
9
|
+
import Queue from "./Queue";
|
|
9
10
|
export { View };
|
|
10
11
|
export { Meta };
|
|
11
12
|
export { sql };
|
|
@@ -13,6 +14,7 @@ export { DB };
|
|
|
13
14
|
export { Model };
|
|
14
15
|
export { Blueprint };
|
|
15
16
|
export { Pool };
|
|
17
|
+
export { Queue };
|
|
16
18
|
export * from "./Decorator";
|
|
17
19
|
export * from "./Schema";
|
|
18
20
|
export * from "./UtilityTypes";
|
|
@@ -20,11 +22,13 @@ export * from "./Repository";
|
|
|
20
22
|
export * from "./Operator";
|
|
21
23
|
export * from "./Nest";
|
|
22
24
|
export * from './StoredProcedure';
|
|
25
|
+
export * from "./Queue";
|
|
23
26
|
declare const _default: {
|
|
24
27
|
DB: typeof DB;
|
|
25
28
|
Model: typeof Model;
|
|
26
29
|
Schema: typeof Schema;
|
|
27
30
|
Blueprint: typeof Blueprint;
|
|
28
31
|
Pool: import("./Pool").PoolConnection;
|
|
32
|
+
Queue: typeof Queue;
|
|
29
33
|
};
|
|
30
34
|
export default _default;
|
package/dist/lib/core/index.js
CHANGED
|
@@ -17,7 +17,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
17
17
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
18
|
};
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.Pool = exports.Blueprint = exports.Model = exports.DB = exports.sql = exports.Meta = exports.View = void 0;
|
|
20
|
+
exports.Queue = exports.Pool = exports.Blueprint = exports.Model = exports.DB = exports.sql = exports.Meta = exports.View = void 0;
|
|
21
21
|
const DB_1 = __importDefault(require("./DB"));
|
|
22
22
|
exports.DB = DB_1.default;
|
|
23
23
|
const Model_1 = __importDefault(require("./Model"));
|
|
@@ -33,6 +33,8 @@ const Meta_1 = __importDefault(require("./Meta"));
|
|
|
33
33
|
exports.Meta = Meta_1.default;
|
|
34
34
|
const View_1 = __importDefault(require("./View"));
|
|
35
35
|
exports.View = View_1.default;
|
|
36
|
+
const Queue_1 = __importDefault(require("./Queue"));
|
|
37
|
+
exports.Queue = Queue_1.default;
|
|
36
38
|
__exportStar(require("./Decorator"), exports);
|
|
37
39
|
__exportStar(require("./Schema"), exports);
|
|
38
40
|
__exportStar(require("./UtilityTypes"), exports);
|
|
@@ -40,11 +42,13 @@ __exportStar(require("./Repository"), exports);
|
|
|
40
42
|
__exportStar(require("./Operator"), exports);
|
|
41
43
|
__exportStar(require("./Nest"), exports);
|
|
42
44
|
__exportStar(require("./StoredProcedure"), exports);
|
|
45
|
+
__exportStar(require("./Queue"), exports);
|
|
43
46
|
exports.default = {
|
|
44
47
|
DB: DB_1.default,
|
|
45
48
|
Model: Model_1.default,
|
|
46
49
|
Schema: Schema_1.default,
|
|
47
50
|
Blueprint: Blueprint_1.default,
|
|
48
|
-
Pool: Pool_1.default
|
|
51
|
+
Pool: Pool_1.default,
|
|
52
|
+
Queue: Queue_1.default
|
|
49
53
|
};
|
|
50
54
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/core/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,8CAA8B;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/core/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,8CAA8B;AAarB,aAbF,YAAE,CAaE;AAZX,oDAAiC;AAaxB,gBAbF,eAAK,CAaE;AAZd,sDAAkC;AAClC,4DAAqC;AAY5B,oBAZF,mBAAS,CAYE;AAXlB,kDAAgC;AAYvB,eAZF,cAAI,CAYE;AAXb,wDAAmC;AAO1B,cAPF,iBAAG,CAOE;AANZ,kDAAgC;AAKvB,eALF,cAAI,CAKE;AAJb,kDAAgC;AAGvB,eAHF,cAAI,CAGE;AAFb,oDAAiC;AASxB,gBATF,eAAK,CASE;AACd,8CAA4B;AAC5B,2CAAyB;AACzB,iDAA+B;AAC/B,+CAA6B;AAC7B,6CAA2B;AAC3B,yCAAuB;AACvB,oDAAiC;AACjC,0CAAuB;AAEvB,kBAAe;IACb,EAAE,EAAF,YAAE;IACF,KAAK,EAAL,eAAK;IACL,MAAM,EAAN,gBAAM;IACN,SAAS,EAAT,mBAAS;IACT,IAAI,EAAJ,cAAI;IACJ,KAAK,EAAL,eAAK;CACN,CAAC"}
|
|
@@ -20,7 +20,7 @@ export type TRelationOptionsDecorator<K = any> = {
|
|
|
20
20
|
export type TColumnsDecorator<T, Options extends {
|
|
21
21
|
InputQuery?: boolean;
|
|
22
22
|
} = {}> = {
|
|
23
|
-
[K in keyof T as T[K] extends string | number | null | boolean | Date ? K : never]: Options['InputQuery'] extends true ? T[K] | TOperatorQuery | TRawStringQuery | TFreezeStringQuery : T[K];
|
|
23
|
+
[K in keyof T as T[K] extends string | number | null | boolean | Date | Record<string, unknown> ? K : never]: Options['InputQuery'] extends true ? T[K] | TOperatorQuery | TRawStringQuery | TFreezeStringQuery : T[K];
|
|
24
24
|
};
|
|
25
25
|
export type TRelationsDecorator<T> = Pick<T, {
|
|
26
26
|
[K in keyof T]: T[K] extends Model | Model[] ? K : never;
|