mythix-orm 1.6.2 → 1.6.3
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/lib/model.d.ts
CHANGED
|
@@ -146,16 +146,18 @@ export declare class Model {
|
|
|
146
146
|
public static getWhereWithConnection(options?: { connection: ConnectionBase }): QueryEngine;
|
|
147
147
|
public getWhereWithConnection(options?: { connection: ConnectionBase }): QueryEngine;
|
|
148
148
|
|
|
149
|
-
public static create(models: Array<
|
|
150
|
-
public static create(models:
|
|
149
|
+
public static create<T extends Model = Model>(models: Array<T>, options?: GenericObject): Promise<Array<T>>;
|
|
150
|
+
public static create<T extends Model = Model>(models: T, options?: GenericObject): Promise<T>;
|
|
151
|
+
public static create<T extends Model = Model>(models: Array<GenericObject>, options?: GenericObject): Promise<Array<T>>;
|
|
152
|
+
public static create<T extends Model = Model>(models: GenericObject, options?: GenericObject): Promise<T>;
|
|
151
153
|
public static count(options?: GenericObject): Promise<number>;
|
|
152
|
-
public static all(options?: GenericObject): Promise<Array<
|
|
153
|
-
public static fetchAll(options?: GenericObject): AsyncGenerator<
|
|
154
|
-
public static first(limit?: number, options?: GenericObject): Promise<
|
|
155
|
-
public static last(limit?: number, options?: GenericObject): Promise<
|
|
154
|
+
public static all<T extends Model = Model>(options?: GenericObject): Promise<Array<T>>;
|
|
155
|
+
public static fetchAll<T extends Model = Model>(options?: GenericObject): AsyncGenerator<T>;
|
|
156
|
+
public static first<T extends Model = Model>(limit?: number, options?: GenericObject): Promise<T | undefined>;
|
|
157
|
+
public static last<T extends Model = Model>(limit?: number, options?: GenericObject): Promise<T | undefined>;
|
|
156
158
|
public static pluck(fields: string | Array<string>, options?: GenericObject): Promise<Array<any>>;
|
|
157
159
|
|
|
158
|
-
public constructor(data
|
|
160
|
+
public constructor(data?: GenericObject, _options?: ModelOptions);
|
|
159
161
|
public getOptions(): ModelOptions;
|
|
160
162
|
public _constructor(data?: GenericObject): void;
|
|
161
163
|
public _constructFields(): void;
|
|
@@ -183,7 +185,7 @@ export declare class Model {
|
|
|
183
185
|
public onAfterCreate(context: HookContext): Promise<any>;
|
|
184
186
|
public onAfterUpdate(context: HookContext): Promise<any>;
|
|
185
187
|
public onAfterSave(context: HookContext): Promise<any>;
|
|
186
|
-
public save(options?: GenericObject): Promise<
|
|
188
|
+
public save(options?: GenericObject): Promise<this | boolean>;
|
|
187
189
|
public reload(options?: GenericObject): Promise<void>;
|
|
188
190
|
public destroy(options?: GenericObject): Promise<number>;
|
|
189
191
|
public toString(): string;
|
|
@@ -53,11 +53,11 @@ export declare class QueryEngine<T = ConnectionBase> {
|
|
|
53
53
|
public unscoped(context?: GenericObject): QueryEngine;
|
|
54
54
|
public toString(options?: GenericObject): string;
|
|
55
55
|
public MERGE(queryEngine: QueryEngine): QueryEngine;
|
|
56
|
-
public all(options?: GenericObject): Promise<Array<
|
|
57
|
-
public fetchAll(options?: GenericObject): AsyncGenerator<
|
|
58
|
-
public first(limit?: number | null | undefined, options?: GenericObject): Promise<
|
|
59
|
-
public last(limit?: number | null | undefined, options?: GenericObject): Promise<
|
|
60
|
-
public update(attributes:
|
|
56
|
+
public all<T extends Model = Model>(options?: GenericObject): Promise<Array<T>>;
|
|
57
|
+
public fetchAll<T extends Model = Model>(options?: GenericObject): AsyncGenerator<T>;
|
|
58
|
+
public first<T extends Model = Model>(limit?: number | null | undefined, options?: GenericObject): Promise<T | undefined>;
|
|
59
|
+
public last<T extends Model = Model>(limit?: number | null | undefined, options?: GenericObject): Promise<T | undefined>;
|
|
60
|
+
public update<T extends Model = Model>(attributes: T | GenericObject, options?: GenericObject): Promise<number>;
|
|
61
61
|
public destroy(options?: GenericObject): Promise<number>;
|
|
62
62
|
public average(field: Field | string, options?: GenericObject): Promise<number>;
|
|
63
63
|
public count(field: Field | string, options?: GenericObject): Promise<number>;
|
|
@@ -78,51 +78,71 @@ export declare class QueryEngine<T = ConnectionBase> {
|
|
|
78
78
|
|
|
79
79
|
declare public NOT: {
|
|
80
80
|
(): QueryEngine;
|
|
81
|
+
|
|
82
|
+
name: QueryEngine;
|
|
81
83
|
[ key: string ]: QueryEngine;
|
|
82
84
|
};
|
|
83
85
|
|
|
84
86
|
declare public AND: {
|
|
85
87
|
(query: QueryEngine): QueryEngine;
|
|
88
|
+
|
|
89
|
+
name: QueryEngine;
|
|
86
90
|
[ key: string ]: QueryEngine;
|
|
87
91
|
};
|
|
88
92
|
|
|
89
93
|
declare public OR: {
|
|
90
94
|
(query: QueryEngine): QueryEngine;
|
|
95
|
+
|
|
96
|
+
name: QueryEngine;
|
|
91
97
|
[ key: string ]: QueryEngine;
|
|
92
98
|
};
|
|
93
99
|
|
|
94
100
|
declare public DISTINCT: {
|
|
95
101
|
(fullyQualifiedName: string | Field): QueryEngine;
|
|
102
|
+
|
|
103
|
+
name: QueryEngine;
|
|
96
104
|
[ key: string ]: QueryEngine;
|
|
97
105
|
};
|
|
98
106
|
|
|
99
107
|
declare public INNER_JOIN: {
|
|
100
108
|
(): QueryEngine;
|
|
109
|
+
|
|
110
|
+
name: QueryEngine;
|
|
101
111
|
[ key: string ]: QueryEngine;
|
|
102
112
|
};
|
|
103
113
|
|
|
104
114
|
declare public LEFT_JOIN: {
|
|
105
115
|
(): QueryEngine;
|
|
116
|
+
|
|
117
|
+
name: QueryEngine;
|
|
106
118
|
[ key: string ]: QueryEngine;
|
|
107
119
|
};
|
|
108
120
|
|
|
109
121
|
declare public RIGHT_JOIN: {
|
|
110
122
|
(): QueryEngine;
|
|
123
|
+
|
|
124
|
+
name: QueryEngine;
|
|
111
125
|
[ key: string ]: QueryEngine;
|
|
112
126
|
};
|
|
113
127
|
|
|
114
128
|
declare public FULL_JOIN: {
|
|
115
129
|
(): QueryEngine;
|
|
130
|
+
|
|
131
|
+
name: QueryEngine;
|
|
116
132
|
[ key: string ]: QueryEngine;
|
|
117
133
|
};
|
|
118
134
|
|
|
119
135
|
declare public CROSS_JOIN: {
|
|
120
136
|
(): QueryEngine;
|
|
137
|
+
|
|
138
|
+
name: QueryEngine;
|
|
121
139
|
[ key: string ]: QueryEngine;
|
|
122
140
|
};
|
|
123
141
|
|
|
124
142
|
declare public JOIN: {
|
|
125
143
|
(type: string | LiteralBase): QueryEngine;
|
|
144
|
+
|
|
145
|
+
name: QueryEngine;
|
|
126
146
|
[ key: string ]: QueryEngine;
|
|
127
147
|
};
|
|
128
148
|
|
|
@@ -137,6 +157,7 @@ export declare class QueryEngine<T = ConnectionBase> {
|
|
|
137
157
|
public LIKE(value: string, options?: { caseSensitive: boolean }): QueryEngine;
|
|
138
158
|
public NOT_LIKE(value: string, options?: { caseSensitive: boolean }): QueryEngine;
|
|
139
159
|
|
|
160
|
+
name: QueryEngine;
|
|
140
161
|
[ key: string ]: any;
|
|
141
162
|
}
|
|
142
163
|
|
|
@@ -64,7 +64,7 @@ export declare function createAndSaveAllRelatedModels(
|
|
|
64
64
|
options?: GenericObject,
|
|
65
65
|
): Promise<Array<Model> | undefined>;
|
|
66
66
|
|
|
67
|
-
export declare function setRelationalValues<T = Model>(
|
|
67
|
+
export declare function setRelationalValues<T extends Model = Model>(
|
|
68
68
|
connection: ConnectionBase,
|
|
69
69
|
TargetModel: ModelClass,
|
|
70
70
|
targetModelInstance: T,
|