@h3ravel/arquebus 0.3.0 → 0.3.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 +1 -1
- package/bin/index.cjs +4419 -1
- package/bin/index.d.cts +1 -1
- package/bin/index.d.ts +1 -1
- package/bin/index.js +4384 -1
- package/dist/browser/index.cjs +1269 -1
- package/dist/browser/index.d.cts +1222 -1202
- package/dist/browser/index.d.ts +1222 -1202
- package/dist/browser/index.js +1217 -1
- package/dist/index.cjs +4181 -1
- package/dist/index.d.cts +1306 -1280
- package/dist/index.d.ts +1306 -1280
- package/dist/index.js +4116 -1
- package/dist/migrations/chunk-PECeCxCb.js +15 -0
- package/dist/migrations/index.cjs +4064 -1
- package/dist/migrations/index.d.cts +1250 -1243
- package/dist/migrations/index.d.ts +1247 -1243
- package/dist/migrations/index.js +3994 -1
- package/package.json +3 -3
- package/bin/cli.cjs +0 -4942
- package/bin/cli.d.cts +0 -18
- package/bin/cli.d.ts +0 -18
- package/bin/cli.js +0 -4907
- package/bin/utils.js +0 -141
- /package/{bin → dist}/migrations/stubs/migration-js.stub +0 -0
- /package/{bin → dist}/migrations/stubs/migration-ts.stub +0 -0
- /package/{bin → dist}/migrations/stubs/migration.create-js.stub +0 -0
- /package/{bin → dist}/migrations/stubs/migration.create-ts.stub +0 -0
- /package/{bin → dist}/migrations/stubs/migration.update-js.stub +0 -0
- /package/{bin → dist}/migrations/stubs/migration.update-ts.stub +0 -0
- /package/{bin → dist}/stubs/arquebus.config-js.stub +0 -0
- /package/{bin → dist}/stubs/arquebus.config-ts.stub +0 -0
- /package/{bin → dist}/stubs/model-js.stub +0 -0
- /package/{bin → dist}/stubs/model-ts.stub +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -1,183 +1,467 @@
|
|
|
1
|
-
import { Collection as Collection$
|
|
2
|
-
import Knex$1, { Knex } from
|
|
1
|
+
import { Collection as Collection$1 } from "collect.js";
|
|
2
|
+
import Knex$1, { Knex } from "knex";
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
private newConstructor;
|
|
6
|
-
getConstructor<T extends typeof Collection$1<I>>(this: InstanceType<T>): T;
|
|
7
|
-
load(...relations: I[]): Promise<Collection$1<I>>;
|
|
8
|
-
loadAggregate<I>(relations: I, column: string, action?: string | null | TFunction): Promise<this>;
|
|
9
|
-
loadCount(relations: I): Promise<this>;
|
|
10
|
-
loadMax(relation: I, column: string): Promise<this>;
|
|
11
|
-
loadMin(relation: I, column: string): Promise<this>;
|
|
12
|
-
loadSum(relation: I, column: string): Promise<this>;
|
|
13
|
-
loadAvg(relation: I, column: string): Promise<this>;
|
|
14
|
-
mapThen(callback: () => void): Promise<void[]>;
|
|
15
|
-
modelKeys(): any[];
|
|
16
|
-
contains<K, V>(key: keyof I | K | TFunction, value?: V): boolean;
|
|
17
|
-
diff(items: ICollection<any> | any[]): any;
|
|
18
|
-
except(keys: any[]): any;
|
|
19
|
-
intersect(items: I[]): any;
|
|
20
|
-
unique(key?: TFunction | keyof I, _strict?: boolean): any;
|
|
21
|
-
find(key: any, defaultValue?: null): any;
|
|
22
|
-
fresh(...args: any[]): Promise<any>;
|
|
23
|
-
makeVisible(attributes: any): this;
|
|
24
|
-
makeHidden(attributes: any): this;
|
|
25
|
-
append(attributes: any): this;
|
|
26
|
-
only(keys: any[]): any;
|
|
27
|
-
getDictionary(items?: ICollection<any> | any[]): TGeneric;
|
|
28
|
-
toQuery(): any;
|
|
29
|
-
toData(): (I | {
|
|
30
|
-
[x: string]: any;
|
|
31
|
-
[x: number]: any;
|
|
32
|
-
[x: symbol]: any;
|
|
33
|
-
})[];
|
|
34
|
-
toJSON(): (I | {
|
|
35
|
-
[x: string]: any;
|
|
36
|
-
[x: number]: any;
|
|
37
|
-
[x: symbol]: any;
|
|
38
|
-
})[];
|
|
39
|
-
toJson(...args: any[]): string;
|
|
40
|
-
[Symbol.iterator]: () => Iterator<I>;
|
|
41
|
-
}
|
|
4
|
+
//#region src/collection.d.ts
|
|
42
5
|
|
|
6
|
+
declare class Collection<I extends Model$1 | Model$2> extends Collection$1<I> implements ICollection<I> {
|
|
7
|
+
private newConstructor;
|
|
8
|
+
getConstructor<T extends typeof Collection<I>>(this: InstanceType<T>): T;
|
|
9
|
+
load(...relations: I[]): Promise<Collection<I>>;
|
|
10
|
+
loadAggregate<I>(relations: I, column: string, action?: string | null | TFunction): Promise<this>;
|
|
11
|
+
loadCount(relations: I): Promise<this>;
|
|
12
|
+
loadMax(relation: I, column: string): Promise<this>;
|
|
13
|
+
loadMin(relation: I, column: string): Promise<this>;
|
|
14
|
+
loadSum(relation: I, column: string): Promise<this>;
|
|
15
|
+
loadAvg(relation: I, column: string): Promise<this>;
|
|
16
|
+
mapThen(callback: () => void): Promise<void[]>;
|
|
17
|
+
modelKeys(): any[];
|
|
18
|
+
contains<K, V>(key: keyof I | K | TFunction, value?: V): boolean;
|
|
19
|
+
diff(items: ICollection<any> | any[]): any;
|
|
20
|
+
except(keys: any[]): any;
|
|
21
|
+
intersect(items: I[]): any;
|
|
22
|
+
unique(key?: TFunction | keyof I, _strict?: boolean): any;
|
|
23
|
+
find(key: any, defaultValue?: null): any;
|
|
24
|
+
fresh(...args: any[]): Promise<any>;
|
|
25
|
+
makeVisible(attributes: any): this;
|
|
26
|
+
makeHidden(attributes: any): this;
|
|
27
|
+
append(attributes: any): this;
|
|
28
|
+
only(keys: any[]): any;
|
|
29
|
+
getDictionary(items?: ICollection<any> | any[]): TGeneric;
|
|
30
|
+
toQuery(): any;
|
|
31
|
+
toData(): (I | {
|
|
32
|
+
[x: string]: any;
|
|
33
|
+
[x: number]: any;
|
|
34
|
+
[x: symbol]: any;
|
|
35
|
+
})[];
|
|
36
|
+
toJSON(): (I | {
|
|
37
|
+
[x: string]: any;
|
|
38
|
+
[x: number]: any;
|
|
39
|
+
[x: symbol]: any;
|
|
40
|
+
})[];
|
|
41
|
+
toJson(...args: any[]): string;
|
|
42
|
+
[Symbol.iterator]: () => Iterator<I>;
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region types/utils.d.ts
|
|
46
|
+
interface ICollection<T extends Model$1 | Model$2> extends Collection$1<T> {
|
|
47
|
+
items?: T[];
|
|
48
|
+
load(...relations: T[]): Promise<ICollection<T>>;
|
|
49
|
+
loadAggregate(relations: T | T[], column: string, action?: string | null): Promise<this>;
|
|
50
|
+
loadCount(relation: T, column: string): Promise<this>;
|
|
51
|
+
loadMax(relation: T, column: string): Promise<this>;
|
|
52
|
+
loadMin(relation: T, column: string): Promise<this>;
|
|
53
|
+
loadSum(relation: T, column: string): Promise<this>;
|
|
54
|
+
loadAvg(relation: T, column: string): Promise<this>;
|
|
55
|
+
mapThen(callback: () => void): Promise<any>;
|
|
56
|
+
modelKeys(): string[] | number[];
|
|
57
|
+
contains(key: IModel | any, operator?: any, value?: any): boolean;
|
|
58
|
+
diff(items: ICollection<T> | any[]): ICollection<T>;
|
|
59
|
+
except(keys: any[]): ICollection<T>;
|
|
60
|
+
intersect(items: T[]): ICollection<T>;
|
|
61
|
+
unique(key?: any, strict?: boolean): ICollection<T>;
|
|
62
|
+
find(key: any, defaultValue?: any): any;
|
|
63
|
+
fresh(withs?: any[]): Promise<ICollection<T>>;
|
|
64
|
+
makeVisible(attributes: string | string[]): this;
|
|
65
|
+
makeHidden(attributes: string | string[]): this;
|
|
66
|
+
append(attributes: string[]): this;
|
|
67
|
+
only(keys: null | any[]): this;
|
|
68
|
+
getDictionary(items?: any[]): TGeneric;
|
|
69
|
+
toQuery(): IBuilder<T, any>;
|
|
70
|
+
toData(): any;
|
|
71
|
+
toJSON(): any;
|
|
72
|
+
toJson(): string;
|
|
73
|
+
toString(): string;
|
|
74
|
+
[key: string]: any;
|
|
75
|
+
[Symbol.iterator]: () => Iterator<T>;
|
|
76
|
+
}
|
|
77
|
+
interface IPaginatorParams {
|
|
78
|
+
current_page: number;
|
|
79
|
+
data: any[];
|
|
80
|
+
per_page: number;
|
|
81
|
+
total: number;
|
|
82
|
+
last_page: number;
|
|
83
|
+
count: number;
|
|
84
|
+
}
|
|
85
|
+
interface IPaginator<T extends Model$1 | Model$2, K extends IPaginatorParams = IPaginatorParams> {
|
|
86
|
+
formatter?(paginator: IPaginator<any>): any | null;
|
|
87
|
+
setFormatter?(formatter: (paginator: IPaginator<any>) => any | null): void;
|
|
88
|
+
setItems(items: T[] | Collection<T>): void;
|
|
89
|
+
hasMorePages(): boolean;
|
|
90
|
+
get(index: number): T | null;
|
|
91
|
+
count(): number;
|
|
92
|
+
items(): Collection<T>;
|
|
93
|
+
map(callback: (value: T, index: number) => T): Collection<T>;
|
|
94
|
+
currentPage(): number;
|
|
95
|
+
perPage(): number;
|
|
96
|
+
lastPage(): number;
|
|
97
|
+
firstItem(): number | null;
|
|
98
|
+
lastItem(): number | null;
|
|
99
|
+
total(): number;
|
|
100
|
+
toData<U = K>(): U;
|
|
101
|
+
toJSON<U = K>(): U;
|
|
102
|
+
toJson(): string;
|
|
103
|
+
[Symbol.iterator]?(): {
|
|
104
|
+
next: () => {
|
|
105
|
+
value: T;
|
|
106
|
+
done: boolean;
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
//#endregion
|
|
111
|
+
//#region src/paginator.d.ts
|
|
112
|
+
declare class Paginator<T extends Model$1, K extends IPaginatorParams = IPaginatorParams> implements IPaginator<T, K> {
|
|
113
|
+
static formatter: (paginator: IPaginator<any>) => any | null;
|
|
114
|
+
_items: Collection<T>;
|
|
115
|
+
_total: number;
|
|
116
|
+
_perPage: number;
|
|
117
|
+
_lastPage: number;
|
|
118
|
+
_currentPage: number;
|
|
119
|
+
hasMore: boolean;
|
|
120
|
+
options: TGeneric;
|
|
121
|
+
static setFormatter(formatter: (paginator: IPaginator<any>) => any | null): void;
|
|
122
|
+
constructor(items: T[], total: number, perPage: number, currentPage?: number, options?: TGeneric);
|
|
123
|
+
setItems(items: T[]): void;
|
|
124
|
+
firstItem(): number | null;
|
|
125
|
+
lastItem(): number | null;
|
|
126
|
+
hasMorePages(): boolean;
|
|
127
|
+
get(index: number): T | null;
|
|
128
|
+
count(): number;
|
|
129
|
+
items(): Collection<T>;
|
|
130
|
+
map(callback: (value: T, index: number) => T): Collection<T>;
|
|
131
|
+
currentPage(): number;
|
|
132
|
+
onFirstPage(): boolean;
|
|
133
|
+
perPage(): number;
|
|
134
|
+
lastPage(): number;
|
|
135
|
+
total(): number;
|
|
136
|
+
toData(): any;
|
|
137
|
+
toJSON(): any;
|
|
138
|
+
toJson(...args: any[]): string;
|
|
139
|
+
}
|
|
140
|
+
//#endregion
|
|
141
|
+
//#region src/scope.d.ts
|
|
142
|
+
declare class Scope<M extends Model$1 = Model$1> implements IScope {
|
|
143
|
+
constructor();
|
|
144
|
+
apply(_builder: Builder<M>, _model: M): void;
|
|
145
|
+
}
|
|
146
|
+
//#endregion
|
|
147
|
+
//#region src/builder.d.ts
|
|
148
|
+
declare const Inference$2: {
|
|
149
|
+
new <M extends Model$1 = Model$1, R = IModel | ICollection<M>>(): IBuilder<M, R>;
|
|
150
|
+
};
|
|
151
|
+
declare class Builder<M extends Model$1 = Model$1, R = IModel | ICollection<M>> extends Inference$2 {
|
|
152
|
+
query: IBuilder<M, R>;
|
|
153
|
+
connection: any;
|
|
154
|
+
model: M;
|
|
155
|
+
actions: any[];
|
|
156
|
+
localMacros: TGeneric<(...args: any[]) => any, keyof Omit<IBuilder<M, R>, number>>;
|
|
157
|
+
eagerLoad: TGeneric<(...args: any[]) => any>;
|
|
158
|
+
globalScopes: TGeneric<Scope<M> | ((arg: Builder<M, R>) => Builder<M, R>)>;
|
|
159
|
+
onDeleteCallback?: (builder: Builder<M, R>) => Promise<boolean | number>;
|
|
160
|
+
constructor(query: IBuilder<M, R>);
|
|
161
|
+
asProxy(): Builder<M, R>;
|
|
162
|
+
orWhere(...args: any[]): this;
|
|
163
|
+
chunk<C extends TFunction>(count: number, callback: C): Promise<boolean>;
|
|
164
|
+
enforceOrderBy(this: any): void;
|
|
165
|
+
clone(this: any): any;
|
|
166
|
+
forPage(this: any, page: number, perPage?: number): any;
|
|
167
|
+
insert(...args: Parameters<typeof (void 0).query.insert>): Promise<any>;
|
|
168
|
+
update<T extends TGeneric>(values: T): Promise<any>;
|
|
169
|
+
increment(column: string, amount?: number, extra?: {}): Promise<any>;
|
|
170
|
+
decrement(column: string, amount?: number, extra?: {}): Promise<any>;
|
|
171
|
+
addUpdatedAtColumn(values: TGeneric<string>): TGeneric<string>;
|
|
172
|
+
delete(): Promise<number | boolean>;
|
|
173
|
+
onDelete<C extends TFunction<any, Promise<number | boolean>>>(callback: C): void;
|
|
174
|
+
forceDelete(): Promise<number | boolean>;
|
|
175
|
+
create(attributes?: {}): Promise<any>;
|
|
176
|
+
newModelInstance(attributes?: {}): any;
|
|
177
|
+
getQuery(): IBuilder<M, R>;
|
|
178
|
+
getModel(): M;
|
|
179
|
+
setModel<MO extends Model$1>(model: MO): this;
|
|
180
|
+
qualifyColumn(column: string): string;
|
|
181
|
+
setTable(table: string): this;
|
|
182
|
+
applyScopes(): this;
|
|
183
|
+
hasNamedScope(name: string): boolean;
|
|
184
|
+
callNamedScope(scope: string, parameters: any[]): any;
|
|
185
|
+
callScope(scope: (builder: this, ...args: any[]) => this, parameters?: never[]): this;
|
|
186
|
+
scopes(scopes: string[]): this;
|
|
187
|
+
withGlobalScope(identifier: string, scope: any): this;
|
|
188
|
+
withoutGlobalScope(scope: Scope | string): this;
|
|
189
|
+
macro<N extends string>(name: N, callback: (builder: TGeneric & IBuilder<M>, attrs: any, vals: any) => any): this;
|
|
190
|
+
hasMacro(name: string): boolean;
|
|
191
|
+
getMacro(name: string): (...args: any[]) => any;
|
|
192
|
+
with(...args: any[]): this;
|
|
193
|
+
has(relation: any, operator?: string, count?: number, boolean?: string, callback?: TFunction | null): any;
|
|
194
|
+
orHas(relation: any, operator?: string, count?: number): any;
|
|
195
|
+
doesntHave(relation: any, boolean?: string, callback?: TFunction | null): any;
|
|
196
|
+
orDoesntHave(relation: any): any;
|
|
197
|
+
whereHas(relation: any, callback?: TFunction | null, operator?: string, count?: number): any;
|
|
198
|
+
orWhereHas(relation: any, callback?: TFunction | null, operator?: string, count?: number): any;
|
|
199
|
+
whereRelation(relation: any, ...args: any[]): any;
|
|
200
|
+
orWhereRelation(relation: any, ...args: any[]): any;
|
|
201
|
+
hasNested(relations: any, operator?: string, count?: number, boolean?: string, callback?: TFunction | null): any;
|
|
202
|
+
canUseExistsForExistenceCheck(operator: string, count: number): boolean;
|
|
203
|
+
addHasWhere(hasQuery: any, relation: any, operator: string, count: number, boolean: string): any;
|
|
204
|
+
addWhereExistsQuery(this: any, query: any, boolean?: string, not?: boolean): any;
|
|
205
|
+
addWhereCountQuery(this: any, query: any, operator?: string, count?: number, boolean?: string): any;
|
|
206
|
+
withAggregate(relations: any, column: string, action?: string | null): this;
|
|
207
|
+
toSql(): any;
|
|
208
|
+
mergeConstraintsFrom(_from: any): this;
|
|
209
|
+
selectSub(query: Builder<M>, as: string): any;
|
|
210
|
+
createSub(query: any): any[];
|
|
211
|
+
parseSub(query: any): any[];
|
|
212
|
+
prependDatabaseNameIfCrossDatabaseQuery(query: any): any;
|
|
213
|
+
getRelationWithoutConstraints(relation: string): any;
|
|
214
|
+
withCount(...args: any[]): this;
|
|
215
|
+
withMax(relation: any, column: string): this;
|
|
216
|
+
withMin(relation: any, column: string): this;
|
|
217
|
+
withAvg(relation: any, column: string): this;
|
|
218
|
+
withSum(relation: any, column: string): this;
|
|
219
|
+
withExists(relation: any): this;
|
|
220
|
+
parseWithRelations(relations: TGeneric): TGeneric | never[];
|
|
221
|
+
addNestedWiths(name: string, results: TGeneric): TGeneric;
|
|
222
|
+
prepareNestedWithRelationships(relations: TGeneric, prefix?: string): TGeneric;
|
|
223
|
+
combineConstraints(constraints: TFunction[]): (builder: Builder<M>) => Builder<M, IModel | ICollection<M>>;
|
|
224
|
+
parseNameAndAttributeSelectionConstraint(name: string, value: string): (string | ((query: any) => void))[];
|
|
225
|
+
createSelectWithConstraint(name: string): (string | ((query: any) => void))[];
|
|
226
|
+
related(relation: string): any;
|
|
227
|
+
take(this: any, ...args: any[]): any;
|
|
228
|
+
skip(this: any, ...args: any[]): any;
|
|
229
|
+
first(this: any, ...columns: any[]): Promise<M | null>;
|
|
230
|
+
firstOrFail(...columns: any[]): Promise<M>;
|
|
231
|
+
findOrFail(this: any, ...args: any[]): Promise<M>;
|
|
232
|
+
findOrNew(id: string, columns?: string[]): Promise<any>;
|
|
233
|
+
firstOrNew(this: any, attributes?: {}, values?: {}): Promise<any>;
|
|
234
|
+
firstOrCreate(this: any, attributes?: TGeneric, values?: {}): Promise<any>;
|
|
235
|
+
updateOrCreate(attributes: TGeneric, values?: {}): Promise<any>;
|
|
236
|
+
latest(column?: string): this;
|
|
237
|
+
oldest(column?: string): this;
|
|
238
|
+
find(this: any, id: string | number | Collection<M>, columns?: string[]): Promise<any>;
|
|
239
|
+
findMany(this: any, ids: string[] | number[] | ICollection<any>, columns?: string[]): Promise<any>;
|
|
240
|
+
pluck(column: string): Promise<any>;
|
|
241
|
+
destroy(this: any, ids?: (string | number)[] | TFunction | Collection<M>): Promise<number>;
|
|
242
|
+
get<M extends Model$1>(columns?: string | string[]): Promise<Collection<M>>;
|
|
243
|
+
all(columns?: string[]): Promise<any>;
|
|
244
|
+
paginate(this: any, page?: number, perPage?: number): Promise<Paginator<any, IPaginatorParams>>;
|
|
245
|
+
getModels(...columns: any[]): Promise<any[]>;
|
|
246
|
+
getRelation(name: string): any;
|
|
247
|
+
relationsNestedUnder(relation: string): TGeneric;
|
|
248
|
+
isNestedUnder(relation: string, name: string): boolean;
|
|
249
|
+
eagerLoadRelation<M extends Model$1>(models: M[], name: string, constraints: any): Promise<any>;
|
|
250
|
+
eagerLoadRelations<M extends Model$1>(models: M[]): Promise<M[]>;
|
|
251
|
+
hydrate(items: any[]): Collection<any>;
|
|
252
|
+
}
|
|
253
|
+
//#endregion
|
|
254
|
+
//#region types/query-builder.d.ts
|
|
43
255
|
interface SchemaBuilder extends Knex.SchemaBuilder {
|
|
44
|
-
|
|
256
|
+
[k: string]: any;
|
|
45
257
|
}
|
|
46
258
|
interface AsMethod<QB extends AnyQueryBuilder> {
|
|
47
|
-
|
|
259
|
+
(alias: string): QB;
|
|
48
260
|
}
|
|
49
261
|
interface IStatement {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
interface IQueryBuilder<M extends Model$
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
}
|
|
180
|
-
|
|
262
|
+
grouping: string;
|
|
263
|
+
direction: string;
|
|
264
|
+
type: string;
|
|
265
|
+
value: () => any;
|
|
266
|
+
not: boolean;
|
|
267
|
+
nulls: boolean;
|
|
268
|
+
bool: 'and' | 'or' | 'not';
|
|
269
|
+
}
|
|
270
|
+
interface IQueryBuilder<M extends Model$1 | Model$2 = Model$1, R = M[] | M> {
|
|
271
|
+
schema: SchemaBuilder;
|
|
272
|
+
_statements: IStatement[];
|
|
273
|
+
table(name: string): IQueryBuilder<M, R>;
|
|
274
|
+
select: SelectMethod<this>;
|
|
275
|
+
columns: SelectMethod<this>;
|
|
276
|
+
column: SelectMethod<this>;
|
|
277
|
+
distinct: SelectMethod<this>;
|
|
278
|
+
distinctOn: SelectMethod<this>;
|
|
279
|
+
as: AsMethod<this>;
|
|
280
|
+
asProxy(): IQueryBuilder<M, R>;
|
|
281
|
+
where: WhereMethod<this>;
|
|
282
|
+
andWhere: WhereMethod<this>;
|
|
283
|
+
orWhere(...args: any[]): this;
|
|
284
|
+
whereNot: WhereMethod<this>;
|
|
285
|
+
andWhereNot: WhereMethod<this>;
|
|
286
|
+
orWhereNot: WhereMethod<this>;
|
|
287
|
+
whereRaw: WhereRawMethod<this>;
|
|
288
|
+
orWhereRaw: WhereRawMethod<this>;
|
|
289
|
+
andWhereRaw: WhereRawMethod<this>;
|
|
290
|
+
whereWrapped: WhereWrappedMethod<this>;
|
|
291
|
+
havingWrapped: WhereWrappedMethod<this>;
|
|
292
|
+
whereExists: WhereExistsMethod<this>;
|
|
293
|
+
orWhereExists: WhereExistsMethod<this>;
|
|
294
|
+
whereNotExists: WhereExistsMethod<this>;
|
|
295
|
+
orWhereNotExists: WhereExistsMethod<this>;
|
|
296
|
+
whereIn: WhereInMethod<this>;
|
|
297
|
+
orWhereIn: WhereInMethod<this>;
|
|
298
|
+
whereNotIn: WhereInMethod<this>;
|
|
299
|
+
orWhereNotIn: WhereInMethod<this>;
|
|
300
|
+
whereBetween: WhereBetweenMethod<this>;
|
|
301
|
+
orWhereBetween: WhereBetweenMethod<this>;
|
|
302
|
+
andWhereBetween: WhereBetweenMethod<this>;
|
|
303
|
+
whereNotBetween: WhereBetweenMethod<this>;
|
|
304
|
+
orWhereNotBetween: WhereBetweenMethod<this>;
|
|
305
|
+
andWhereNotBetween: WhereBetweenMethod<this>;
|
|
306
|
+
whereNull: WhereNullMethod<this>;
|
|
307
|
+
orWhereNull: WhereNullMethod<this>;
|
|
308
|
+
whereNotNull: WhereNullMethod<this>;
|
|
309
|
+
orWhereNotNull: WhereNullMethod<this>;
|
|
310
|
+
whereColumn: WhereColumnMethod<this>;
|
|
311
|
+
orWhereColumn: WhereColumnMethod<this>;
|
|
312
|
+
andWhereColumn: WhereColumnMethod<this>;
|
|
313
|
+
whereNotColumn: WhereColumnMethod<this>;
|
|
314
|
+
orWhereNotColumn: WhereColumnMethod<this>;
|
|
315
|
+
andWhereNotColumn: WhereColumnMethod<this>;
|
|
316
|
+
whereJsonIsArray: WhereFieldExpressionMethod<this>;
|
|
317
|
+
orWhereJsonIsArray: WhereFieldExpressionMethod<this>;
|
|
318
|
+
whereJsonNotArray: WhereFieldExpressionMethod<this>;
|
|
319
|
+
orWhereJsonNotArray: WhereFieldExpressionMethod<this>;
|
|
320
|
+
whereJsonIsObject: WhereFieldExpressionMethod<this>;
|
|
321
|
+
orWhereJsonIsObject: WhereFieldExpressionMethod<this>;
|
|
322
|
+
whereJsonNotObject: WhereFieldExpressionMethod<this>;
|
|
323
|
+
orWhereJsonNotObject: WhereFieldExpressionMethod<this>;
|
|
324
|
+
whereJsonHasAny: WhereJsonExpressionMethod<this>;
|
|
325
|
+
orWhereJsonHasAny: WhereJsonExpressionMethod<this>;
|
|
326
|
+
whereJsonHasAll: WhereJsonExpressionMethod<this>;
|
|
327
|
+
orWhereJsonHasAll: WhereJsonExpressionMethod<this>;
|
|
328
|
+
having: WhereMethod<this>;
|
|
329
|
+
andHaving: WhereMethod<this>;
|
|
330
|
+
orHaving: WhereMethod<this>;
|
|
331
|
+
havingRaw: WhereRawMethod<this>;
|
|
332
|
+
orHavingRaw: WhereRawMethod<this>;
|
|
333
|
+
havingIn: WhereInMethod<this>;
|
|
334
|
+
orHavingIn: WhereInMethod<this>;
|
|
335
|
+
havingNotIn: WhereInMethod<this>;
|
|
336
|
+
orHavingNotIn: WhereInMethod<this>;
|
|
337
|
+
havingNull: WhereNullMethod<this>;
|
|
338
|
+
orHavingNull: WhereNullMethod<this>;
|
|
339
|
+
havingNotNull: WhereNullMethod<this>;
|
|
340
|
+
orHavingNotNull: WhereNullMethod<this>;
|
|
341
|
+
havingExists: WhereExistsMethod<this>;
|
|
342
|
+
orHavingExists: WhereExistsMethod<this>;
|
|
343
|
+
havingNotExists: WhereExistsMethod<this>;
|
|
344
|
+
orHavingNotExists: WhereExistsMethod<this>;
|
|
345
|
+
havingBetween: WhereBetweenMethod<this>;
|
|
346
|
+
orHavingBetween: WhereBetweenMethod<this>;
|
|
347
|
+
havingNotBetween: WhereBetweenMethod<this>;
|
|
348
|
+
orHavingNotBetween: WhereBetweenMethod<this>;
|
|
349
|
+
union: UnionMethod<this>;
|
|
350
|
+
unionAll: UnionMethod<this>;
|
|
351
|
+
intersect: SetOperationsMethod<this>;
|
|
352
|
+
join: JoinMethod<this>;
|
|
353
|
+
joinRaw: JoinRawMethod<this>;
|
|
354
|
+
innerJoin: JoinMethod<this>;
|
|
355
|
+
leftJoin: JoinMethod<this>;
|
|
356
|
+
leftOuterJoin: JoinMethod<this>;
|
|
357
|
+
rightJoin: JoinMethod<this>;
|
|
358
|
+
rightOuterJoin: JoinMethod<this>;
|
|
359
|
+
outerJoin: JoinMethod<this>;
|
|
360
|
+
fullOuterJoin: JoinMethod<this>;
|
|
361
|
+
crossJoin: JoinMethod<this>;
|
|
362
|
+
orderBy: OrderByMethod<this>;
|
|
363
|
+
orderByRaw: OrderByRawMethod<this>;
|
|
364
|
+
groupBy: GroupByMethod<this>;
|
|
365
|
+
groupByRaw: RawInterface<this>;
|
|
366
|
+
transaction(callback?: TFunction): Promise<Knex.Transaction> | undefined;
|
|
367
|
+
destroy(callback: TFunction): Promise<number>;
|
|
368
|
+
destroy(): Promise<number>;
|
|
369
|
+
clone(): IQueryBuilder<M, R>;
|
|
370
|
+
raw: Knex.RawQueryBuilder<TGeneric, M>;
|
|
371
|
+
get(columns?: string[]): Promise<any>;
|
|
372
|
+
first(columns?: string[]): Promise<M | null | undefined>;
|
|
373
|
+
find(key: string | number, columns?: string[]): Promise<M | null | undefined>;
|
|
374
|
+
insert(attributes: any): Promise<unknown>;
|
|
375
|
+
update(...attributes: any[]): Promise<number>;
|
|
376
|
+
delete(): Promise<boolean | number>;
|
|
377
|
+
exists(): Promise<boolean>;
|
|
378
|
+
count(column?: string): Promise<number>;
|
|
379
|
+
min(column: string): Promise<number>;
|
|
380
|
+
max(column: string): Promise<number>;
|
|
381
|
+
sum(column: string): Promise<number>;
|
|
382
|
+
avg(column: string): Promise<number>;
|
|
383
|
+
skip(count: number): this;
|
|
384
|
+
take(count: number): this;
|
|
385
|
+
limit(count: number): this;
|
|
386
|
+
offset(count: number): this;
|
|
387
|
+
pluck<X extends Model$1 = any>(column: string): Promise<ICollection<X>>;
|
|
388
|
+
chunk(count: number, callback: (rows: M[]) => any): Promise<boolean>;
|
|
389
|
+
forPage(page: number, perPage?: number): this;
|
|
390
|
+
paginate<F extends IPaginatorParams>(page?: number, perPage?: number): Promise<IPaginator<M, F>>;
|
|
391
|
+
}
|
|
392
|
+
//#endregion
|
|
393
|
+
//#region types/builder.d.ts
|
|
394
|
+
interface IScope {
|
|
395
|
+
apply(builder: Builder<any>, model: Model$1): void;
|
|
396
|
+
}
|
|
397
|
+
interface IBuilder<M extends Model$1 | Model$2, R = ICollection<M> | IModel> extends IQueryBuilder<M, R> {
|
|
398
|
+
asProxy(): IQueryBuilder<M, R>;
|
|
399
|
+
enforceOrderBy(): void;
|
|
400
|
+
insert(attributes: any): Promise<any>;
|
|
401
|
+
update(attributes: any): Promise<any>;
|
|
402
|
+
increment(column: string, amount?: number, extra?: any): Promise<any>;
|
|
403
|
+
decrement(column: string, amount?: number, extra?: any): Promise<any>;
|
|
404
|
+
addUpdatedAtColumn(values: any): any;
|
|
405
|
+
delete(): Promise<boolean | number>;
|
|
406
|
+
softDelete(): boolean | Promise<any>;
|
|
407
|
+
forceDelete(): boolean | Promise<any>;
|
|
408
|
+
restore(): boolean | Promise<any>;
|
|
409
|
+
withTrashed(): this;
|
|
410
|
+
withoutTrashed(): this;
|
|
411
|
+
onlyTrashed(): this;
|
|
412
|
+
getDeletedAtColumn(): string;
|
|
413
|
+
create(attributes?: any): Promise<M>;
|
|
414
|
+
newModelInstance(attributes?: any): M;
|
|
415
|
+
count(columns?: string): Promise<number>;
|
|
416
|
+
getQuery(): AnyQueryBuilder;
|
|
417
|
+
getModel(): M;
|
|
418
|
+
setModel(model: M): this;
|
|
419
|
+
setTable(table: string): this;
|
|
420
|
+
applyScopes(): this;
|
|
421
|
+
scopes(scopes: string[]): this;
|
|
422
|
+
withGlobalScope(identifier: string | number, scope: string | (() => void)): this;
|
|
423
|
+
withoutGlobalScope(scope: IScope | string): this;
|
|
424
|
+
with(relation: WithRelationType): this;
|
|
425
|
+
with(...relations: WithRelationType[]): this;
|
|
426
|
+
has(relation: string, operator?: any, count?: number, boolean?: any, callback?: (builder: IBuilder<any>) => void | null): this;
|
|
427
|
+
orHas(relation: string, operator?: any, count?: number): this;
|
|
428
|
+
doesntHave(relation: string, boolean?: any, callback?: (builder: IBuilder<any>) => void | null): this;
|
|
429
|
+
orDoesntHave(relation: string): this;
|
|
430
|
+
whereHas(relation: string, callback?: (builder: IBuilder<any>) => void | IBuilder<any> | null, operator?: any, count?: number): this;
|
|
431
|
+
orWhereHas(relation: string, callback?: (builder: IBuilder<any>) => void | IBuilder<any> | null, operator?: any, count?: number): this;
|
|
432
|
+
whereRelation(relation: string, column: string, operator?: any, value?: any): this;
|
|
433
|
+
hasNested(relation: string, operator?: any, count?: number, boolean?: any, callback?: (builder: IBuilder<any>) => void | null): this;
|
|
434
|
+
canUseExistsForExistenceCheck(operator: string, count: number): boolean;
|
|
435
|
+
addHasWhere(hasQuery: IBuilder<any>, relation: string, operator?: string, count?: number, boolean?: string): this;
|
|
436
|
+
withAggregate(relations: string | string[] | object, column: string, action?: string | null): this;
|
|
437
|
+
toSql(): object;
|
|
438
|
+
withCount(...relations: WithRelationType[]): this;
|
|
439
|
+
withMax(relation: WithRelationType, column: string): this;
|
|
440
|
+
withMin(relation: WithRelationType, column: string): this;
|
|
441
|
+
withAvg(relation: WithRelationType, column: string): this;
|
|
442
|
+
withSum(relation: WithRelationType, column: string): this;
|
|
443
|
+
withExists(relation: WithRelationType): this;
|
|
444
|
+
related(relation: string): this;
|
|
445
|
+
first(column?: string | string[]): Promise<M | null | undefined>;
|
|
446
|
+
firstOrFail(column?: string | string[]): Promise<M>;
|
|
447
|
+
findOrFail(key: string | number, columns?: string[]): Promise<M>;
|
|
448
|
+
findOrFail(key: string[] | number[] | ICollection<any>, columns?: string[]): Promise<M>;
|
|
449
|
+
findOrFail(key: string | number | string[] | number[] | ICollection<any>, columns?: string[]): Promise<M>;
|
|
450
|
+
findOrNew(id: string | number, columns?: string[]): Promise<M>;
|
|
451
|
+
firstOrNew(attributes?: object, values?: object): Promise<M>;
|
|
452
|
+
firstOrCreate(attributes?: object, values?: object): Promise<M>;
|
|
453
|
+
updateOrCreate(attributes: object, values?: object): Promise<M>;
|
|
454
|
+
latest(column?: string): this;
|
|
455
|
+
oldest(column?: string): this;
|
|
456
|
+
find(key: string | number, columns?: string[]): Promise<M | null | undefined>;
|
|
457
|
+
findMany(keys: string[] | number[] | ICollection<any>, columns?: string[]): Promise<ICollection<M>>;
|
|
458
|
+
pluck<X extends Model$1 = any | M>(column: string): Promise<ICollection<X>>;
|
|
459
|
+
all(columns?: string[]): Promise<ICollection<M>>;
|
|
460
|
+
paginate<F extends IPaginatorParams>(page?: number, perPage?: number): Promise<IPaginator<M, F>>;
|
|
461
|
+
[value: string]: any;
|
|
462
|
+
}
|
|
463
|
+
//#endregion
|
|
464
|
+
//#region types/query-methods.d.ts
|
|
181
465
|
type Operator = string;
|
|
182
466
|
type ColumnRef = string | Raw;
|
|
183
467
|
type FieldExpression = string;
|
|
@@ -185,1206 +469,952 @@ type TableRef<QB extends AnyQueryBuilder> = ColumnRef | AnyQueryBuilder | Callba
|
|
|
185
469
|
type Selection<QB extends AnyQueryBuilder> = ColumnRef | AnyQueryBuilder | CallbackVoid<QB>;
|
|
186
470
|
type QBOrCallback<QB extends AnyQueryBuilder> = AnyQueryBuilder | CallbackVoid<QB>;
|
|
187
471
|
interface CallbackVoid<T> {
|
|
188
|
-
|
|
472
|
+
(this: T, arg: T): void;
|
|
189
473
|
}
|
|
190
474
|
type Raw = Knex.Raw;
|
|
191
475
|
type OrderByDirection = 'asc' | 'desc' | 'ASC' | 'DESC';
|
|
192
476
|
interface OrderByDescriptor {
|
|
193
|
-
|
|
194
|
-
|
|
477
|
+
column: ColumnRef;
|
|
478
|
+
order?: OrderByDirection;
|
|
195
479
|
}
|
|
196
|
-
type AnyQueryBuilder<M extends Model$
|
|
480
|
+
type AnyQueryBuilder<M extends Model$1 = any, R = any> = IQueryBuilder<M, R> | IBuilder<M, R>;
|
|
197
481
|
type Expression<T> = T | Raw | AnyQueryBuilder;
|
|
198
482
|
type ColumnRefOrOrderByDescriptor = ColumnRef | OrderByDescriptor;
|
|
199
483
|
interface RawInterface<R> {
|
|
200
|
-
|
|
484
|
+
(sql: string, ...bindings: any[]): R;
|
|
201
485
|
}
|
|
202
486
|
interface BaseSetOperations<QB extends AnyQueryBuilder> {
|
|
203
|
-
|
|
204
|
-
|
|
487
|
+
(callbackOrBuilder: QBOrCallback<QB>, wrap?: boolean): QB;
|
|
488
|
+
(callbacksOrBuilders: QBOrCallback<QB>[], wrap?: boolean): QB;
|
|
205
489
|
}
|
|
206
490
|
type JoinRawMethod<QB extends AnyQueryBuilder> = RawInterface<QB> & {};
|
|
207
491
|
type OrderByRawMethod<QB extends AnyQueryBuilder> = RawInterface<QB> & {};
|
|
208
492
|
type WhereRawMethod<QB extends AnyQueryBuilder> = RawInterface<QB> & {};
|
|
209
493
|
interface GroupByMethod<QB extends AnyQueryBuilder> {
|
|
210
|
-
|
|
211
|
-
|
|
494
|
+
(...columns: ColumnRef[]): QB;
|
|
495
|
+
(columns: ColumnRef[]): QB;
|
|
212
496
|
}
|
|
213
497
|
type WithRelationType = {
|
|
214
|
-
|
|
498
|
+
[key: string]: <T extends IBuilder<any>>(builder: T) => T | void;
|
|
215
499
|
} | string | string[];
|
|
216
500
|
interface SetOperationsMethod<QB extends AnyQueryBuilder> extends BaseSetOperations<QB> {
|
|
217
|
-
|
|
501
|
+
(...callbacksOrBuilders: QBOrCallback<QB>[]): QB;
|
|
218
502
|
}
|
|
219
503
|
interface SelectMethod<QB extends AnyQueryBuilder> {
|
|
220
|
-
|
|
221
|
-
|
|
504
|
+
<QBP extends QB>(...columns: Selection<QBP>[]): QB;
|
|
505
|
+
<QBP extends QB>(columns: Selection<QBP>[]): QB;
|
|
222
506
|
}
|
|
223
507
|
interface WhereMethod<QB extends AnyQueryBuilder> {
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
508
|
+
(col: ColumnRef, op: Operator, expr: Expression<PrimitiveValue>): QB;
|
|
509
|
+
(col: ColumnRef, expr: Expression<PrimitiveValue>): QB;
|
|
510
|
+
(condition: boolean): QB;
|
|
511
|
+
(cb: CallbackVoid<QB>): QB;
|
|
512
|
+
(raw: Raw): QB;
|
|
513
|
+
<QBA extends AnyQueryBuilder>(qb: QBA): QB;
|
|
514
|
+
(obj: object): QB;
|
|
231
515
|
}
|
|
232
516
|
interface WhereWrappedMethod<QB extends AnyQueryBuilder> {
|
|
233
|
-
|
|
517
|
+
(cb: CallbackVoid<QB>): QB;
|
|
234
518
|
}
|
|
235
519
|
interface WhereFieldExpressionMethod<QB extends AnyQueryBuilder> {
|
|
236
|
-
|
|
520
|
+
(fieldExpression: FieldExpression): QB;
|
|
237
521
|
}
|
|
238
522
|
interface WhereExistsMethod<QB extends AnyQueryBuilder> {
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
523
|
+
(cb: CallbackVoid<QB>): QB;
|
|
524
|
+
(raw: Raw): QB;
|
|
525
|
+
<QBA extends AnyQueryBuilder>(qb: QBA): QB;
|
|
242
526
|
}
|
|
243
527
|
interface WhereInMethod<QB extends AnyQueryBuilder> {
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
528
|
+
(col: ColumnRef | ColumnRef[], expr: Expression<PrimitiveValue>[]): QB;
|
|
529
|
+
(col: ColumnRef | ColumnRef[], cb: CallbackVoid<QB>): QB;
|
|
530
|
+
(col: ColumnRef | ColumnRef[], qb: AnyQueryBuilder): QB;
|
|
247
531
|
}
|
|
248
532
|
interface WhereBetweenMethod<QB extends AnyQueryBuilder> {
|
|
249
|
-
|
|
533
|
+
(column: ColumnRef, range: [Expression<PrimitiveValue>, Expression<PrimitiveValue>]): QB;
|
|
250
534
|
}
|
|
251
535
|
interface WhereNullMethod<QB extends AnyQueryBuilder> {
|
|
252
|
-
|
|
536
|
+
(column: ColumnRef): QB;
|
|
253
537
|
}
|
|
254
538
|
interface OrderByMethod<QB extends AnyQueryBuilder> {
|
|
255
|
-
|
|
256
|
-
|
|
539
|
+
(column: ColumnRef, order?: OrderByDirection): QB;
|
|
540
|
+
(columns: ColumnRefOrOrderByDescriptor[]): QB;
|
|
257
541
|
}
|
|
258
542
|
interface WhereJsonExpressionMethod<QB extends AnyQueryBuilder> {
|
|
259
|
-
|
|
543
|
+
(fieldExpression: FieldExpression, keys: string | string[]): QB;
|
|
260
544
|
}
|
|
261
545
|
interface WhereColumnMethod<QB extends AnyQueryBuilder> {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
}
|
|
265
|
-
interface UnionMethod<QB extends AnyQueryBuilder> extends BaseSetOperations<QB> {
|
|
266
|
-
(arg1: QBOrCallback<QB>, wrap?: boolean): QB;
|
|
267
|
-
(arg1: QBOrCallback<QB>, arg2: QBOrCallback<QB>, wrap?: boolean): QB;
|
|
268
|
-
(arg1: QBOrCallback<QB>, arg2: QBOrCallback<QB>, arg3: QBOrCallback<QB>, wrap?: boolean): QB;
|
|
269
|
-
(arg1: QBOrCallback<QB>, arg2: QBOrCallback<QB>, arg3: QBOrCallback<QB>, arg4: QBOrCallback<QB>, wrap?: boolean): QB;
|
|
270
|
-
(arg1: QBOrCallback<QB>, arg2: QBOrCallback<QB>, arg3: QBOrCallback<QB>, arg4: QBOrCallback<QB>, arg5: QBOrCallback<QB>, wrap?: boolean): QB;
|
|
271
|
-
(arg1: QBOrCallback<QB>, arg2: QBOrCallback<QB>, arg3: QBOrCallback<QB>, arg4: QBOrCallback<QB>, arg5: QBOrCallback<QB>, arg6: QBOrCallback<QB>, wrap?: boolean): QB;
|
|
272
|
-
(arg1: QBOrCallback<QB>, arg2: QBOrCallback<QB>, arg3: QBOrCallback<QB>, arg4: QBOrCallback<QB>, arg5: QBOrCallback<QB>, arg6: QBOrCallback<QB>, arg7: QBOrCallback<QB>, wrap?: boolean): QB;
|
|
546
|
+
(col1: ColumnRef, op: Operator, col2: ColumnRef): QB;
|
|
547
|
+
(col1: ColumnRef, col2: ColumnRef): QB;
|
|
273
548
|
}
|
|
274
549
|
interface JoinMethod<QB extends AnyQueryBuilder> {
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
550
|
+
(table: TableRef<QB>, leftCol: ColumnRef, op: Operator, rightCol: ColumnRef): QB;
|
|
551
|
+
(table: TableRef<QB>, leftCol: ColumnRef, rightCol: ColumnRef): QB;
|
|
552
|
+
(table: TableRef<QB>, cb: CallbackVoid<Knex.JoinClause>): QB;
|
|
553
|
+
(table: TableRef<QB>, raw: Raw): QB;
|
|
554
|
+
(raw: Raw): QB;
|
|
280
555
|
}
|
|
281
|
-
interface
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
556
|
+
interface UnionMethod<QB extends AnyQueryBuilder> extends BaseSetOperations<QB> {
|
|
557
|
+
(arg1: QBOrCallback<QB>, wrap?: boolean): QB;
|
|
558
|
+
(arg1: QBOrCallback<QB>, arg2: QBOrCallback<QB>, wrap?: boolean): QB;
|
|
559
|
+
(arg1: QBOrCallback<QB>, arg2: QBOrCallback<QB>, arg3: QBOrCallback<QB>, wrap?: boolean): QB;
|
|
560
|
+
(arg1: QBOrCallback<QB>, arg2: QBOrCallback<QB>, arg3: QBOrCallback<QB>, arg4: QBOrCallback<QB>, wrap?: boolean): QB;
|
|
561
|
+
(arg1: QBOrCallback<QB>, arg2: QBOrCallback<QB>, arg3: QBOrCallback<QB>, arg4: QBOrCallback<QB>, arg5: QBOrCallback<QB>, wrap?: boolean): QB;
|
|
562
|
+
(arg1: QBOrCallback<QB>, arg2: QBOrCallback<QB>, arg3: QBOrCallback<QB>, arg4: QBOrCallback<QB>, arg5: QBOrCallback<QB>, arg6: QBOrCallback<QB>, wrap?: boolean): QB;
|
|
563
|
+
(arg1: QBOrCallback<QB>, arg2: QBOrCallback<QB>, arg3: QBOrCallback<QB>, arg4: QBOrCallback<QB>, arg5: QBOrCallback<QB>, arg6: QBOrCallback<QB>, arg7: QBOrCallback<QB>, wrap?: boolean): QB;
|
|
287
564
|
}
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
565
|
+
interface JoinMethod<QB extends AnyQueryBuilder> {
|
|
566
|
+
(table: TableRef<QB>, leftCol: ColumnRef, op: Operator, rightCol: ColumnRef): QB;
|
|
567
|
+
(table: TableRef<QB>, leftCol: ColumnRef, rightCol: ColumnRef): QB;
|
|
568
|
+
(table: TableRef<QB>, cb: CallbackVoid<Knex.JoinClause>): QB;
|
|
569
|
+
(table: TableRef<QB>, raw: Raw): QB;
|
|
570
|
+
(raw: Raw): QB;
|
|
571
|
+
}
|
|
572
|
+
//#endregion
|
|
573
|
+
//#region src/query-builder.d.ts
|
|
574
|
+
declare const Inference$1: {
|
|
575
|
+
new <M extends Model$1 = Model$1, R = M[] | M>(): IQueryBuilder<M, R>;
|
|
291
576
|
};
|
|
292
|
-
declare class QueryBuilder<M extends Model$
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
}
|
|
324
|
-
|
|
577
|
+
declare class QueryBuilder<M extends Model$1 = Model$1, R = M[] | M> extends Inference$1<M, R> {
|
|
578
|
+
model: M;
|
|
579
|
+
schema: SchemaBuilder;
|
|
580
|
+
private connector;
|
|
581
|
+
constructor(config: TConfig | null, connector: TFunction);
|
|
582
|
+
asProxy(): any;
|
|
583
|
+
beginTransaction(): Promise<Knex.Transaction<any, any[]> | undefined>;
|
|
584
|
+
table<X extends M>(table: string): IQueryBuilder<X, R>;
|
|
585
|
+
transaction(callback?: TFunction): Promise<Knex.Transaction> | undefined;
|
|
586
|
+
find(id: string | number, columns?: string[]): Promise<any>;
|
|
587
|
+
get(_columns?: string[]): Promise<any>;
|
|
588
|
+
exists(): Promise<boolean>;
|
|
589
|
+
skip(this: any, ...args: any[]): any;
|
|
590
|
+
take(this: any, ...args: any[]): any;
|
|
591
|
+
chunk(count: number, callback: TFunction): Promise<boolean>;
|
|
592
|
+
paginate<F extends IPaginatorParams>(this: any, page?: number, perPage?: number): Promise<IPaginator<M, F>>;
|
|
593
|
+
forPage(this: any, page?: number, perPage?: number): any;
|
|
594
|
+
toSQL(...args: Parameters<typeof (void 0).connector.toSQL>): Knex.Sql;
|
|
595
|
+
count(column: string): Promise<number>;
|
|
596
|
+
min(column: string): Promise<number>;
|
|
597
|
+
max(column: string): Promise<number>;
|
|
598
|
+
sum(column: string): Promise<number>;
|
|
599
|
+
avg(column: string): Promise<number>;
|
|
600
|
+
clone(): IQueryBuilder<M, R>;
|
|
601
|
+
delete(): Promise<number | boolean>;
|
|
602
|
+
insert(...args: Parameters<typeof (void 0).connector.insert>): Promise<unknown>;
|
|
603
|
+
update(...args: Parameters<typeof (void 0).connector.update>): Promise<number>;
|
|
604
|
+
destroy(...args: Parameters<typeof (void 0).connector.destroy>): Promise<number>;
|
|
605
|
+
get _statements(): IStatement[] & any[];
|
|
606
|
+
get _single(): any;
|
|
607
|
+
get from(): Knex.Table<any, any>;
|
|
608
|
+
}
|
|
609
|
+
//#endregion
|
|
610
|
+
//#region src/relations/relation.d.ts
|
|
325
611
|
declare class Relation$1 {
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
}
|
|
354
|
-
|
|
612
|
+
query: QueryBuilder;
|
|
613
|
+
parent: any;
|
|
614
|
+
related: any;
|
|
615
|
+
eagerKeysWereEmpty: boolean;
|
|
616
|
+
static constraints: boolean;
|
|
617
|
+
static selfJoinCount: number;
|
|
618
|
+
constructor(query: any, parent: any);
|
|
619
|
+
static extend(trait: Record<string, any>): void;
|
|
620
|
+
static noConstraints(callback: () => any): any;
|
|
621
|
+
asProxy(): any;
|
|
622
|
+
getRelated(): any;
|
|
623
|
+
getKeys(models: any[], key?: string | null): any[];
|
|
624
|
+
getRelationQuery(): any;
|
|
625
|
+
whereInEager(whereIn: string, key: string, modelKeys: any[], query?: any): void;
|
|
626
|
+
whereInMethod(model: any, key: string): string;
|
|
627
|
+
getEager(): any;
|
|
628
|
+
get(columns?: string | string[]): Promise<any>;
|
|
629
|
+
first(columns?: string[]): Promise<any>;
|
|
630
|
+
paginate(...args: any[]): Promise<any>;
|
|
631
|
+
count(...args: any[]): Promise<any>;
|
|
632
|
+
toSql(): string;
|
|
633
|
+
addConstraints(): void;
|
|
634
|
+
getRelationCountHash(incrementJoinCount?: boolean): string;
|
|
635
|
+
getRelationExistenceQuery(query: any, parentQuery: any, columns?: string[]): any;
|
|
636
|
+
getRelationExistenceCountQuery(query: any, parentQuery: any): any;
|
|
637
|
+
getQualifiedParentKeyName(): string;
|
|
638
|
+
getExistenceCompareKey(this: any): string;
|
|
639
|
+
}
|
|
640
|
+
//#endregion
|
|
641
|
+
//#region types/container.d.ts
|
|
355
642
|
interface TBaseConfig {
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
643
|
+
client: 'mysql' | 'mysql2' | 'sqlite3' | 'oracle' | 'mariadb' | 'pg';
|
|
644
|
+
connection: {
|
|
645
|
+
typeCast?(field: TField, next: TFunction): any;
|
|
646
|
+
dateStrings?: boolean;
|
|
647
|
+
};
|
|
648
|
+
pool?: {
|
|
649
|
+
afterCreate: (connection: TConfig, callback: (val: any, con: any) => void) => Promise<any>;
|
|
650
|
+
} | undefined;
|
|
651
|
+
connections?: arquebus['connections'];
|
|
652
|
+
migrations?: {
|
|
653
|
+
table: string;
|
|
654
|
+
path: string;
|
|
655
|
+
};
|
|
656
|
+
factories?: {
|
|
657
|
+
path: string;
|
|
658
|
+
};
|
|
659
|
+
seeders?: {
|
|
660
|
+
path: string;
|
|
661
|
+
};
|
|
662
|
+
models?: {
|
|
663
|
+
path: string;
|
|
664
|
+
};
|
|
378
665
|
}
|
|
379
666
|
type TConfig = TBaseConfig & ({
|
|
380
|
-
|
|
381
|
-
|
|
667
|
+
client: 'pg';
|
|
668
|
+
connection: Knex.PgConnectionConfig;
|
|
382
669
|
} | {
|
|
383
|
-
|
|
384
|
-
|
|
670
|
+
client: 'oracle';
|
|
671
|
+
connection: Knex.OracleDbConnectionConfig;
|
|
385
672
|
} | {
|
|
386
|
-
|
|
387
|
-
|
|
673
|
+
client: 'mysql2';
|
|
674
|
+
connection: Knex.MySql2ConnectionConfig;
|
|
388
675
|
} | {
|
|
389
|
-
|
|
390
|
-
|
|
676
|
+
client: 'mysql';
|
|
677
|
+
connection: Knex.MySqlConnectionConfig;
|
|
391
678
|
} | {
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
679
|
+
client: 'sqlite3';
|
|
680
|
+
connection: Knex.Sqlite3ConnectionConfig;
|
|
681
|
+
useNullAsDefault?: boolean;
|
|
395
682
|
} | {
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
683
|
+
client: 'mariadb';
|
|
684
|
+
connection: Knex.MariaSqlConnectionConfig;
|
|
685
|
+
useNullAsDefault?: boolean;
|
|
399
686
|
});
|
|
400
|
-
interface ModelOptions<M extends Model$
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
687
|
+
interface ModelOptions<M extends Model$1 = Model$1> {
|
|
688
|
+
table?: string;
|
|
689
|
+
scopes?: TGeneric<(...args: any[]) => Builder<M>>;
|
|
690
|
+
plugins?: (<X extends MixinConstructor<M>>(Model: X) => MixinConstructor<M>)[];
|
|
691
|
+
relations?: TGeneric<(...args: any[]) => Relation$1>;
|
|
692
|
+
attributes?: TGeneric<Attribute$1>;
|
|
693
|
+
CREATED_AT?: string;
|
|
694
|
+
UPDATED_AT?: string;
|
|
695
|
+
DELETED_AT?: string;
|
|
696
|
+
connection?: TBaseConfig['client'];
|
|
697
|
+
timestamps?: boolean;
|
|
698
|
+
primaryKey?: string;
|
|
699
|
+
incrementing?: boolean;
|
|
700
|
+
keyType?: 'int' | 'string';
|
|
701
|
+
with?: Model$1['with'];
|
|
702
|
+
casts?: Model$1['casts'];
|
|
416
703
|
}
|
|
417
704
|
interface TField {
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
}
|
|
427
|
-
|
|
705
|
+
type: 'VAR_STRING' | 'BLOB' | 'DATETIME' | 'TIMESTAMP' | 'LONG' | 'JSON';
|
|
706
|
+
length: number;
|
|
707
|
+
db: string;
|
|
708
|
+
table: string;
|
|
709
|
+
name: string;
|
|
710
|
+
string: TFunction;
|
|
711
|
+
buffer: TFunction;
|
|
712
|
+
geometry: TFunction;
|
|
713
|
+
}
|
|
714
|
+
//#endregion
|
|
715
|
+
//#region types/modeling.d.ts
|
|
428
716
|
interface Attribute$1 {
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
}
|
|
438
|
-
type Relation<M extends Model$
|
|
439
|
-
interface HasOneOrMany<M extends Model$
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
}
|
|
445
|
-
interface HasOne<M extends Model$
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
}
|
|
449
|
-
interface HasMany<M extends Model$
|
|
450
|
-
|
|
451
|
-
}
|
|
452
|
-
interface BelongsTo<M extends Model$
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
}
|
|
456
|
-
interface BelongsToMany<M extends Model$
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
717
|
+
make(config: {
|
|
718
|
+
get?: TFunction | null;
|
|
719
|
+
set?: TFunction | null;
|
|
720
|
+
}): Attribute$1;
|
|
721
|
+
get: TFunction | null;
|
|
722
|
+
set: TFunction | null;
|
|
723
|
+
withCaching?: boolean;
|
|
724
|
+
withObjectCaching?: boolean;
|
|
725
|
+
}
|
|
726
|
+
type Relation<M extends Model$1> = IBuilder<M, any> & {};
|
|
727
|
+
interface HasOneOrMany<M extends Model$1> extends Relation<M> {
|
|
728
|
+
save(model: M): Promise<M>;
|
|
729
|
+
saveMany(models: M[] | ICollection<M>): Promise<ICollection<M>>;
|
|
730
|
+
create(attributes?: any): Promise<M>;
|
|
731
|
+
createMany(records: any[]): Promise<ICollection<M>>;
|
|
732
|
+
}
|
|
733
|
+
interface HasOne<M extends Model$1> extends HasOneOrMany<M> {
|
|
734
|
+
getResults(): Promise<M | null>;
|
|
735
|
+
withDefault(callback?: TFunction | object): this;
|
|
736
|
+
}
|
|
737
|
+
interface HasMany<M extends Model$1> extends HasOneOrMany<M> {
|
|
738
|
+
getResults(): Promise<ICollection<M>>;
|
|
739
|
+
}
|
|
740
|
+
interface BelongsTo<M extends Model$1> extends Relation<M> {
|
|
741
|
+
getResults(): Promise<M | null>;
|
|
742
|
+
withDefault(callback?: TFunction | object): this;
|
|
743
|
+
}
|
|
744
|
+
interface BelongsToMany<M extends Model$1> extends Relation<M> {
|
|
745
|
+
getResults(): Promise<ICollection<M>>;
|
|
746
|
+
withTimestamps(): this;
|
|
747
|
+
wherePivot(column: any, operator?: any, value?: any, boolean?: string, ...args: any[]): this;
|
|
748
|
+
wherePivotBetween(column: any, values: any, boolean?: string, not?: boolean): this;
|
|
749
|
+
orWherePivotBetween(column: any, values: any): this;
|
|
750
|
+
wherePivotNotBetween(column: any, values: any, boolean?: string): this;
|
|
751
|
+
orWherePivotNotBetween(column: any, values: any): this;
|
|
752
|
+
wherePivotIn(column: any, values: any, boolean?: string, not?: boolean): this;
|
|
753
|
+
orWherePivot(column: any, operator?: any, value?: any): this;
|
|
754
|
+
orWherePivotIn(column: any, values: any): this;
|
|
755
|
+
wherePivotNotIn(column: any, values: any, boolean?: string): this;
|
|
756
|
+
orWherePivotNotIn(column: any, values: any): this;
|
|
757
|
+
wherePivotNull(column: any, boolean?: string, not?: boolean): this;
|
|
758
|
+
wherePivotNotNull(column: any, boolean?: string): this;
|
|
759
|
+
orWherePivotNull(column: any, not?: boolean): this;
|
|
760
|
+
orWherePivotNotNull(column: any): this;
|
|
761
|
+
orderByPivot(column: any, direction?: string): this;
|
|
474
762
|
}
|
|
475
763
|
interface IModel {
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
onDelete<C extends TFunction<any, Promise<number | boolean>>>(callback: C): void;
|
|
658
|
-
forceDelete(): Promise<number | boolean>;
|
|
659
|
-
create(attributes?: {}): Promise<any>;
|
|
660
|
-
newModelInstance(attributes?: {}): any;
|
|
661
|
-
getQuery(): IBuilder<M, R>;
|
|
662
|
-
getModel(): M;
|
|
663
|
-
setModel<MO extends Model$2>(model: MO): this;
|
|
664
|
-
qualifyColumn(column: string): string;
|
|
665
|
-
setTable(table: string): this;
|
|
666
|
-
applyScopes(): this;
|
|
667
|
-
hasNamedScope(name: string): boolean;
|
|
668
|
-
callNamedScope(scope: string, parameters: any[]): any;
|
|
669
|
-
callScope(scope: (builder: this, ...args: any[]) => this, parameters?: never[]): this;
|
|
670
|
-
scopes(scopes: string[]): this;
|
|
671
|
-
withGlobalScope(identifier: string, scope: any): this;
|
|
672
|
-
withoutGlobalScope(scope: Scope | string): this;
|
|
673
|
-
macro<N extends string>(name: N, callback: (builder: TGeneric & IBuilder<M>, attrs: any, vals: any) => any): this;
|
|
674
|
-
hasMacro(name: string): boolean;
|
|
675
|
-
getMacro(name: string): (...args: any[]) => any;
|
|
676
|
-
with(...args: any[]): this;
|
|
677
|
-
has(relation: any, operator?: string, count?: number, boolean?: string, callback?: TFunction | null): any;
|
|
678
|
-
orHas(relation: any, operator?: string, count?: number): any;
|
|
679
|
-
doesntHave(relation: any, boolean?: string, callback?: TFunction | null): any;
|
|
680
|
-
orDoesntHave(relation: any): any;
|
|
681
|
-
whereHas(relation: any, callback?: TFunction | null, operator?: string, count?: number): any;
|
|
682
|
-
orWhereHas(relation: any, callback?: TFunction | null, operator?: string, count?: number): any;
|
|
683
|
-
whereRelation(relation: any, ...args: any[]): any;
|
|
684
|
-
orWhereRelation(relation: any, ...args: any[]): any;
|
|
685
|
-
hasNested(relations: any, operator?: string, count?: number, boolean?: string, callback?: TFunction | null): any;
|
|
686
|
-
canUseExistsForExistenceCheck(operator: string, count: number): boolean;
|
|
687
|
-
addHasWhere(hasQuery: any, relation: any, operator: string, count: number, boolean: string): any;
|
|
688
|
-
addWhereExistsQuery(this: any, query: any, boolean?: string, not?: boolean): any;
|
|
689
|
-
addWhereCountQuery(this: any, query: any, operator?: string, count?: number, boolean?: string): any;
|
|
690
|
-
withAggregate(relations: any, column: string, action?: string | null): this;
|
|
691
|
-
toSql(): any;
|
|
692
|
-
mergeConstraintsFrom(_from: any): this;
|
|
693
|
-
selectSub(query: Builder<M>, as: string): any;
|
|
694
|
-
createSub(query: any): any[];
|
|
695
|
-
parseSub(query: any): any[];
|
|
696
|
-
prependDatabaseNameIfCrossDatabaseQuery(query: any): any;
|
|
697
|
-
getRelationWithoutConstraints(relation: string): any;
|
|
698
|
-
withCount(...args: any[]): this;
|
|
699
|
-
withMax(relation: any, column: string): this;
|
|
700
|
-
withMin(relation: any, column: string): this;
|
|
701
|
-
withAvg(relation: any, column: string): this;
|
|
702
|
-
withSum(relation: any, column: string): this;
|
|
703
|
-
withExists(relation: any): this;
|
|
704
|
-
parseWithRelations(relations: TGeneric): TGeneric | never[];
|
|
705
|
-
addNestedWiths(name: string, results: TGeneric): TGeneric;
|
|
706
|
-
prepareNestedWithRelationships(relations: TGeneric, prefix?: string): TGeneric;
|
|
707
|
-
combineConstraints(constraints: TFunction[]): (builder: Builder<M>) => Builder<M, IModel | ICollection<M>>;
|
|
708
|
-
parseNameAndAttributeSelectionConstraint(name: string, value: string): (string | ((query: any) => void))[];
|
|
709
|
-
createSelectWithConstraint(name: string): (string | ((query: any) => void))[];
|
|
710
|
-
related(relation: string): any;
|
|
711
|
-
take(this: any, ...args: any[]): any;
|
|
712
|
-
skip(this: any, ...args: any[]): any;
|
|
713
|
-
first(this: any, ...columns: any[]): Promise<M | null>;
|
|
714
|
-
firstOrFail(...columns: any[]): Promise<M>;
|
|
715
|
-
findOrFail(this: any, ...args: any[]): Promise<M>;
|
|
716
|
-
findOrNew(id: string, columns?: string[]): Promise<any>;
|
|
717
|
-
firstOrNew(this: any, attributes?: {}, values?: {}): Promise<any>;
|
|
718
|
-
firstOrCreate(this: any, attributes?: TGeneric, values?: {}): Promise<any>;
|
|
719
|
-
updateOrCreate(attributes: TGeneric, values?: {}): Promise<any>;
|
|
720
|
-
latest(column?: string): this;
|
|
721
|
-
oldest(column?: string): this;
|
|
722
|
-
find(this: any, id: string | number | Collection$1<M>, columns?: string[]): Promise<any>;
|
|
723
|
-
findMany(this: any, ids: string[] | number[] | ICollection<any>, columns?: string[]): Promise<any>;
|
|
724
|
-
pluck(column: string): Promise<any>;
|
|
725
|
-
destroy(this: any, ids?: (string | number)[] | TFunction | Collection$1<M>): Promise<number>;
|
|
726
|
-
get<M extends Model$2>(columns?: string | string[]): Promise<Collection$1<M>>;
|
|
727
|
-
all(columns?: string[]): Promise<any>;
|
|
728
|
-
paginate(this: any, page?: number, perPage?: number): Promise<Paginator<any, IPaginatorParams>>;
|
|
729
|
-
getModels(...columns: any[]): Promise<any[]>;
|
|
730
|
-
getRelation(name: string): any;
|
|
731
|
-
relationsNestedUnder(relation: string): TGeneric;
|
|
732
|
-
isNestedUnder(relation: string, name: string): boolean;
|
|
733
|
-
eagerLoadRelation<M extends Model$2>(models: M[], name: string, constraints: any): Promise<any>;
|
|
734
|
-
eagerLoadRelations<M extends Model$2>(models: M[]): Promise<M[]>;
|
|
735
|
-
hydrate(items: any[]): Collection$1<any>;
|
|
736
|
-
}
|
|
737
|
-
|
|
738
|
-
interface IScope {
|
|
739
|
-
apply(builder: Builder<any>, model: Model$2): void;
|
|
740
|
-
}
|
|
741
|
-
interface IBuilder<M extends Model$2 | Model$1, R = ICollection<M> | IModel> extends IQueryBuilder<M, R> {
|
|
742
|
-
asProxy(): IQueryBuilder<M, R>;
|
|
743
|
-
enforceOrderBy(): void;
|
|
744
|
-
insert(attributes: any): Promise<any>;
|
|
745
|
-
update(attributes: any): Promise<any>;
|
|
746
|
-
increment(column: string, amount?: number, extra?: any): Promise<any>;
|
|
747
|
-
decrement(column: string, amount?: number, extra?: any): Promise<any>;
|
|
748
|
-
addUpdatedAtColumn(values: any): any;
|
|
749
|
-
delete(): Promise<boolean | number>;
|
|
750
|
-
softDelete(): boolean | Promise<any>;
|
|
751
|
-
forceDelete(): boolean | Promise<any>;
|
|
752
|
-
restore(): boolean | Promise<any>;
|
|
753
|
-
withTrashed(): this;
|
|
754
|
-
withoutTrashed(): this;
|
|
755
|
-
onlyTrashed(): this;
|
|
756
|
-
getDeletedAtColumn(): string;
|
|
757
|
-
create(attributes?: any): Promise<M>;
|
|
758
|
-
newModelInstance(attributes?: any): M;
|
|
759
|
-
count(columns?: string): Promise<number>;
|
|
760
|
-
getQuery(): AnyQueryBuilder;
|
|
761
|
-
getModel(): M;
|
|
762
|
-
setModel(model: M): this;
|
|
763
|
-
setTable(table: string): this;
|
|
764
|
-
applyScopes(): this;
|
|
765
|
-
scopes(scopes: string[]): this;
|
|
766
|
-
withGlobalScope(identifier: string | number, scope: string | (() => void)): this;
|
|
767
|
-
withoutGlobalScope(scope: IScope | string): this;
|
|
768
|
-
with(relation: WithRelationType): this;
|
|
769
|
-
with(...relations: WithRelationType[]): this;
|
|
770
|
-
has(relation: string, operator?: any, count?: number, boolean?: any, callback?: (builder: IBuilder<any>) => void | null): this;
|
|
771
|
-
orHas(relation: string, operator?: any, count?: number): this;
|
|
772
|
-
doesntHave(relation: string, boolean?: any, callback?: (builder: IBuilder<any>) => void | null): this;
|
|
773
|
-
orDoesntHave(relation: string): this;
|
|
774
|
-
whereHas(relation: string, callback?: (builder: IBuilder<any>) => void | IBuilder<any> | null, operator?: any, count?: number): this;
|
|
775
|
-
orWhereHas(relation: string, callback?: (builder: IBuilder<any>) => void | IBuilder<any> | null, operator?: any, count?: number): this;
|
|
776
|
-
whereRelation(relation: string, column: string, operator?: any, value?: any): this;
|
|
777
|
-
hasNested(relation: string, operator?: any, count?: number, boolean?: any, callback?: (builder: IBuilder<any>) => void | null): this;
|
|
778
|
-
canUseExistsForExistenceCheck(operator: string, count: number): boolean;
|
|
779
|
-
addHasWhere(hasQuery: IBuilder<any>, relation: string, operator?: string, count?: number, boolean?: string): this;
|
|
780
|
-
withAggregate(relations: string | string[] | object, column: string, action?: string | null): this;
|
|
781
|
-
toSql(): object;
|
|
782
|
-
withCount(...relations: WithRelationType[]): this;
|
|
783
|
-
withMax(relation: WithRelationType, column: string): this;
|
|
784
|
-
withMin(relation: WithRelationType, column: string): this;
|
|
785
|
-
withAvg(relation: WithRelationType, column: string): this;
|
|
786
|
-
withSum(relation: WithRelationType, column: string): this;
|
|
787
|
-
withExists(relation: WithRelationType): this;
|
|
788
|
-
related(relation: string): this;
|
|
789
|
-
first(column?: string | string[]): Promise<M | null | undefined>;
|
|
790
|
-
firstOrFail(column?: string | string[]): Promise<M>;
|
|
791
|
-
findOrFail(key: string | number, columns?: string[]): Promise<M>;
|
|
792
|
-
findOrFail(key: string[] | number[] | ICollection<any>, columns?: string[]): Promise<M>;
|
|
793
|
-
findOrFail(key: string | number | string[] | number[] | ICollection<any>, columns?: string[]): Promise<M>;
|
|
794
|
-
findOrNew(id: string | number, columns?: string[]): Promise<M>;
|
|
795
|
-
firstOrNew(attributes?: object, values?: object): Promise<M>;
|
|
796
|
-
firstOrCreate(attributes?: object, values?: object): Promise<M>;
|
|
797
|
-
updateOrCreate(attributes: object, values?: object): Promise<M>;
|
|
798
|
-
latest(column?: string): this;
|
|
799
|
-
oldest(column?: string): this;
|
|
800
|
-
find(key: string | number, columns?: string[]): Promise<M | null | undefined>;
|
|
801
|
-
findMany(keys: string[] | number[] | ICollection<any>, columns?: string[]): Promise<ICollection<M>>;
|
|
802
|
-
pluck<X extends Model$2 = any | M>(column: string): Promise<ICollection<X>>;
|
|
803
|
-
all(columns?: string[]): Promise<ICollection<M>>;
|
|
804
|
-
paginate<F extends IPaginatorParams>(page?: number, perPage?: number): Promise<IPaginator<M, F>>;
|
|
805
|
-
[value: string]: any;
|
|
806
|
-
}
|
|
807
|
-
|
|
808
|
-
interface ICollection<T extends Model$2 | Model$1> extends Collection$2<T> {
|
|
809
|
-
items?: T[];
|
|
810
|
-
load(...relations: T[]): Promise<ICollection<T>>;
|
|
811
|
-
loadAggregate(relations: T | T[], column: string, action?: string | null): Promise<this>;
|
|
812
|
-
loadCount(relation: T, column: string): Promise<this>;
|
|
813
|
-
loadMax(relation: T, column: string): Promise<this>;
|
|
814
|
-
loadMin(relation: T, column: string): Promise<this>;
|
|
815
|
-
loadSum(relation: T, column: string): Promise<this>;
|
|
816
|
-
loadAvg(relation: T, column: string): Promise<this>;
|
|
817
|
-
mapThen(callback: () => void): Promise<any>;
|
|
818
|
-
modelKeys(): string[] | number[];
|
|
819
|
-
contains(key: IModel | any, operator?: any, value?: any): boolean;
|
|
820
|
-
diff(items: ICollection<T> | any[]): ICollection<T>;
|
|
821
|
-
except(keys: any[]): ICollection<T>;
|
|
822
|
-
intersect(items: T[]): ICollection<T>;
|
|
823
|
-
unique(key?: any, strict?: boolean): ICollection<T>;
|
|
824
|
-
find(key: any, defaultValue?: any): any;
|
|
825
|
-
fresh(withs?: any[]): Promise<ICollection<T>>;
|
|
826
|
-
makeVisible(attributes: string | string[]): this;
|
|
827
|
-
makeHidden(attributes: string | string[]): this;
|
|
828
|
-
append(attributes: string[]): this;
|
|
829
|
-
only(keys: null | any[]): this;
|
|
830
|
-
getDictionary(items?: any[]): TGeneric;
|
|
831
|
-
toQuery(): IBuilder<T, any>;
|
|
832
|
-
toData(): any;
|
|
833
|
-
toJSON(): any;
|
|
834
|
-
toJson(): string;
|
|
835
|
-
toString(): string;
|
|
836
|
-
[key: string]: any;
|
|
837
|
-
[Symbol.iterator]: () => Iterator<T>;
|
|
838
|
-
}
|
|
839
|
-
interface IPaginatorParams {
|
|
840
|
-
current_page: number;
|
|
841
|
-
data: any[];
|
|
842
|
-
per_page: number;
|
|
843
|
-
total: number;
|
|
844
|
-
last_page: number;
|
|
845
|
-
count: number;
|
|
846
|
-
}
|
|
847
|
-
interface IPaginator<T extends Model$2 | Model$1, K extends IPaginatorParams = IPaginatorParams> {
|
|
848
|
-
formatter?(paginator: IPaginator<any>): any | null;
|
|
849
|
-
setFormatter?(formatter: (paginator: IPaginator<any>) => any | null): void;
|
|
850
|
-
setItems(items: T[] | Collection$1<T>): void;
|
|
851
|
-
hasMorePages(): boolean;
|
|
852
|
-
get(index: number): T | null;
|
|
853
|
-
count(): number;
|
|
854
|
-
items(): Collection$1<T>;
|
|
855
|
-
map(callback: (value: T, index: number) => T): Collection$1<T>;
|
|
856
|
-
currentPage(): number;
|
|
857
|
-
perPage(): number;
|
|
858
|
-
lastPage(): number;
|
|
859
|
-
firstItem(): number | null;
|
|
860
|
-
lastItem(): number | null;
|
|
861
|
-
total(): number;
|
|
862
|
-
toData<U = K>(): U;
|
|
863
|
-
toJSON<U = K>(): U;
|
|
864
|
-
toJson(): string;
|
|
865
|
-
[Symbol.iterator]?(): {
|
|
866
|
-
next: () => {
|
|
867
|
-
value: T;
|
|
868
|
-
done: boolean;
|
|
869
|
-
};
|
|
870
|
-
};
|
|
871
|
-
}
|
|
872
|
-
|
|
873
|
-
declare class arquebus<M extends Model$2 = Model$2> {
|
|
874
|
-
static connectorFactory: typeof Knex$1 | null;
|
|
875
|
-
static instance: arquebus | null;
|
|
876
|
-
manager: Record<string, QueryBuilder<M>>;
|
|
877
|
-
connections: Record<string, TConfig>;
|
|
878
|
-
models: Record<string, typeof Model$2>;
|
|
879
|
-
constructor();
|
|
880
|
-
getConstructor<T extends typeof arquebus>(this: InstanceType<T>): T;
|
|
881
|
-
static getInstance(): arquebus<Model$2>;
|
|
882
|
-
/**
|
|
883
|
-
* Initialize a new database connection
|
|
884
|
-
*
|
|
885
|
-
* @returns
|
|
886
|
-
*/
|
|
887
|
-
static fire<C extends TBaseConfig['client']>(connection?: C | null): QueryBuilder<Model$2>;
|
|
888
|
-
/**
|
|
889
|
-
* Initialize a new database connection
|
|
890
|
-
*
|
|
891
|
-
* This is an alias of `arquebus.fire()` and will be removed in the future
|
|
892
|
-
*
|
|
893
|
-
* @deprecated since version 0.3.0
|
|
894
|
-
* @alias fire
|
|
895
|
-
*
|
|
896
|
-
* @returns
|
|
897
|
-
*/
|
|
898
|
-
static connection<C extends TBaseConfig['client']>(connection?: C | null): QueryBuilder<Model$2, Model$2 | Model$2[]>;
|
|
899
|
-
static setConnectorFactory(connectorFactory: typeof Knex$1): void;
|
|
900
|
-
static getConnectorFactory(): typeof Knex$1;
|
|
901
|
-
static addConnection(config: TConfig | TBaseConfig, name?: string): void;
|
|
902
|
-
static beginTransaction(connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]> | undefined>;
|
|
903
|
-
static transaction(callback: TFunction, connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]>> | undefined;
|
|
904
|
-
static table(name: string, connection?: null): IQueryBuilder<Model$2, Model$2 | Model$2[]>;
|
|
905
|
-
static schema(connection?: null): SchemaBuilder;
|
|
906
|
-
static destroyAll(): Promise<void>;
|
|
907
|
-
static createModel<X extends TGeneric>(name: string, options: X): typeof Model$2;
|
|
908
|
-
connection(connection?: string | null): QueryBuilder<M, M | M[]>;
|
|
909
|
-
getConnection(name?: string | null): QueryBuilder<M, M | M[]>;
|
|
910
|
-
addConnection(config: TConfig | TBaseConfig, name?: string): void;
|
|
911
|
-
/**
|
|
912
|
-
* Autoload the config file
|
|
913
|
-
*
|
|
914
|
-
* @param addConnection
|
|
915
|
-
* @default true
|
|
916
|
-
* If set to `false` we will no attempt add the connection, we
|
|
917
|
-
* will just go ahead and return the config
|
|
918
|
-
*
|
|
919
|
-
* @returns
|
|
920
|
-
*/
|
|
921
|
-
static autoLoad(addConnection?: boolean): Promise<TBaseConfig>;
|
|
922
|
-
beginTransaction(connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]> | undefined>;
|
|
923
|
-
transaction(callback: TFunction, connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]>> | undefined;
|
|
924
|
-
table(name: string, connection?: null): IQueryBuilder<M, M | M[]>;
|
|
925
|
-
schema(connection?: null): SchemaBuilder;
|
|
926
|
-
destroyAll(): Promise<void>;
|
|
927
|
-
createModel(name: string, options?: ModelOptions): typeof Model$2;
|
|
928
|
-
}
|
|
929
|
-
|
|
764
|
+
[value: string]: any;
|
|
765
|
+
attributes: any;
|
|
766
|
+
relations: any;
|
|
767
|
+
exists: boolean;
|
|
768
|
+
primaryKey: string;
|
|
769
|
+
builder?: IBuilder<any, any> | null;
|
|
770
|
+
table: string | null;
|
|
771
|
+
connection?: TBaseConfig['client'] | null;
|
|
772
|
+
keyType: string;
|
|
773
|
+
incrementing: boolean;
|
|
774
|
+
perPage: number;
|
|
775
|
+
with: string | string[] | TGeneric<(...args: any[]) => IBuilder<Model$1>>;
|
|
776
|
+
withCount: string[];
|
|
777
|
+
trx: AnyQueryBuilder | null;
|
|
778
|
+
timestamps: boolean;
|
|
779
|
+
dateFormat: string;
|
|
780
|
+
visible: string[];
|
|
781
|
+
hidden: string[];
|
|
782
|
+
query<T extends {
|
|
783
|
+
prototype: unknown;
|
|
784
|
+
}>(this: T, client?: AnyQueryBuilder | null): IBuilder<Model$1>;
|
|
785
|
+
on<T extends {
|
|
786
|
+
prototype: unknown;
|
|
787
|
+
}>(this: T, connection: string | null): IBuilder<Model$1>;
|
|
788
|
+
boot(): void;
|
|
789
|
+
make<T extends IModel>(this: new () => T, attributes?: TGeneric): T;
|
|
790
|
+
addHook(hook: Hook, callback: TFunction): void;
|
|
791
|
+
creating(callback: TFunction): void;
|
|
792
|
+
created(callback: TFunction): void;
|
|
793
|
+
updating(callback: TFunction): void;
|
|
794
|
+
updated(callback: TFunction): void;
|
|
795
|
+
deleting(callback: TFunction): void;
|
|
796
|
+
deleted(callback: TFunction): void;
|
|
797
|
+
saving(callback: TFunction): void;
|
|
798
|
+
saved(callback: TFunction): void;
|
|
799
|
+
restoring(callback: TFunction): void;
|
|
800
|
+
restored(callback: TFunction): void;
|
|
801
|
+
trashed(callback: TFunction): void;
|
|
802
|
+
forceDeleted(callback: TFunction): void;
|
|
803
|
+
bootIfNotBooted(): void;
|
|
804
|
+
initialize(): void;
|
|
805
|
+
initializePlugins(): void;
|
|
806
|
+
addPluginInitializer(method: any): void;
|
|
807
|
+
newInstance(attributes?: TGeneric, exists?: boolean): any;
|
|
808
|
+
getKey(): string | number | null | undefined;
|
|
809
|
+
getKeyName(): string;
|
|
810
|
+
getConnectionName(): string;
|
|
811
|
+
getConnection(): any;
|
|
812
|
+
setConnection(connection: TBaseConfig['client'] | null): this;
|
|
813
|
+
usesUniqueIds(): boolean;
|
|
814
|
+
uniqueIds(): string[];
|
|
815
|
+
newUniqueId(): string;
|
|
816
|
+
setUniqueIds(): void;
|
|
817
|
+
getKeyType(): string;
|
|
818
|
+
getIncrementing(): boolean;
|
|
819
|
+
setIncrementing(value: boolean): this;
|
|
820
|
+
getTable(): string;
|
|
821
|
+
setTable(table: string): this;
|
|
822
|
+
getDates(): string[];
|
|
823
|
+
getDateFormat(): string;
|
|
824
|
+
getAttributes(): object;
|
|
825
|
+
getAttribute(key: string): any;
|
|
826
|
+
setAttribute(key: string, value: any): this;
|
|
827
|
+
fill(attributes: any): this;
|
|
828
|
+
setAppends(appends: string[]): this;
|
|
829
|
+
append(key: string | string[]): this;
|
|
830
|
+
getRelation<T extends Model$1>(relation: string): T | ICollection<T> | null | undefined;
|
|
831
|
+
setRelation<T extends Model$1>(relation: string, value: T | ICollection<T> | null): this;
|
|
832
|
+
unsetRelation(relation: string): this;
|
|
833
|
+
relationLoaded(relation: string): boolean;
|
|
834
|
+
makeVisible(attributes: string | string[]): this;
|
|
835
|
+
makeHidden(attributes: string | string[]): this;
|
|
836
|
+
newCollection(models?: any[]): ICollection<Model$1>;
|
|
837
|
+
load(relations: WithRelationType): Promise<this>;
|
|
838
|
+
load(...relations: WithRelationType[]): Promise<this>;
|
|
839
|
+
loadAggregate(relations: WithRelationType, column: any, callback?: any): Promise<this>;
|
|
840
|
+
loadCount(...relations: WithRelationType[]): Promise<this>;
|
|
841
|
+
loadMax(relations: WithRelationType, column: string): Promise<this>;
|
|
842
|
+
loadMin(relations: WithRelationType, column: string): Promise<this>;
|
|
843
|
+
loadSum(relations: WithRelationType, column: string): Promise<this>;
|
|
844
|
+
usesTimestamps(): boolean;
|
|
845
|
+
updateTimestamps(): this;
|
|
846
|
+
getCreatedAtColumn(): string;
|
|
847
|
+
getUpdatedAtColumn(): string;
|
|
848
|
+
getDeletedAtColumn(): string;
|
|
849
|
+
setCreatedAt(value: string): this;
|
|
850
|
+
setUpdatedAt(value: string): this;
|
|
851
|
+
freshTimestamp(): Date;
|
|
852
|
+
freshTimestampString(): string;
|
|
853
|
+
fromDateTime(value: Date | number | null): string;
|
|
854
|
+
useSoftDeletes(): boolean;
|
|
855
|
+
toData(): any;
|
|
856
|
+
attributesToData(): any;
|
|
857
|
+
relationsToData(): any;
|
|
858
|
+
toJSON(): any;
|
|
859
|
+
toJson(): string;
|
|
860
|
+
toString(): string;
|
|
861
|
+
isDirty(attributes?: string | string[]): boolean;
|
|
862
|
+
getDirty(): string[];
|
|
863
|
+
save(options?: any): Promise<boolean>;
|
|
864
|
+
update(attributes?: any, options?: any): Promise<boolean>;
|
|
865
|
+
increment(column: string, amount?: number, extra?: any): Promise<boolean>;
|
|
866
|
+
decrement(column: string, amount?: number, extra?: any): Promise<boolean>;
|
|
867
|
+
serializeDate(date: any): string;
|
|
868
|
+
delete(options?: any): Promise<boolean>;
|
|
869
|
+
softDelete(options?: any): Promise<boolean>;
|
|
870
|
+
forceDelete(options?: any): Promise<boolean>;
|
|
871
|
+
restore(options?: any): Promise<boolean>;
|
|
872
|
+
trashed(): boolean;
|
|
873
|
+
fresh(): Promise<this>;
|
|
874
|
+
refresh(): Promise<this | undefined>;
|
|
875
|
+
push(): Promise<boolean>;
|
|
876
|
+
is(model: this): boolean;
|
|
877
|
+
isNot(model: this): boolean;
|
|
878
|
+
related<T extends RelationNames<this>>(relation: T): ReturnTypeOfMethod<this, `relation${Capitalize<SnakeToCamelCase<T>>}`>;
|
|
879
|
+
getRelated<T extends RelationNames<this>>(relation: T): ReturnTypeOfMethod<ReturnTypeOfMethod<this, `relation${Capitalize<SnakeToCamelCase<T>>}`>, any>;
|
|
880
|
+
hasOne<T extends Model$1>(model: new () => T, foreignKey?: string, localKey?: string): HasOne<T>;
|
|
881
|
+
hasMany<T extends Model$1>(model: new () => T, foreignKey?: string, localKey?: string): HasMany<T>;
|
|
882
|
+
belongsTo<T extends Model$1>(model: new () => T, foreignKey?: string, ownerKey?: string, relation?: string): BelongsTo<T>;
|
|
883
|
+
belongsToMany<T extends Model$1>(model: new () => T, table?: string, foreignPivotKey?: string, relatedPivotKey?: string, parentKey?: string, relatedKey?: string): BelongsToMany<T>;
|
|
884
|
+
}
|
|
885
|
+
//#endregion
|
|
886
|
+
//#region src/arquebus.d.ts
|
|
887
|
+
declare class arquebus<M extends Model$1 = Model$1> {
|
|
888
|
+
static connectorFactory: typeof Knex$1 | null;
|
|
889
|
+
static instance: arquebus | null;
|
|
890
|
+
manager: Record<string, QueryBuilder<M>>;
|
|
891
|
+
connections: Record<string, TConfig>;
|
|
892
|
+
models: Record<string, typeof Model$1>;
|
|
893
|
+
constructor();
|
|
894
|
+
getConstructor<T extends typeof arquebus>(this: InstanceType<T>): T;
|
|
895
|
+
static getInstance(): arquebus<Model$1>;
|
|
896
|
+
/**
|
|
897
|
+
* Initialize a new database connection
|
|
898
|
+
*
|
|
899
|
+
* @returns
|
|
900
|
+
*/
|
|
901
|
+
static fire<C extends TBaseConfig['client']>(connection?: C | null): QueryBuilder<Model$1>;
|
|
902
|
+
/**
|
|
903
|
+
* Initialize a new database connection
|
|
904
|
+
*
|
|
905
|
+
* This is an alias of `arquebus.fire()` and will be removed in the future
|
|
906
|
+
*
|
|
907
|
+
* @deprecated since version 0.3.0
|
|
908
|
+
* @alias fire
|
|
909
|
+
*
|
|
910
|
+
* @returns
|
|
911
|
+
*/
|
|
912
|
+
static connection<C extends TBaseConfig['client']>(connection?: C | null): QueryBuilder<Model$1, Model$1 | Model$1[]>;
|
|
913
|
+
static setConnectorFactory(connectorFactory: typeof Knex$1): void;
|
|
914
|
+
static getConnectorFactory(): typeof Knex$1;
|
|
915
|
+
static addConnection(config: TConfig | TBaseConfig, name?: string): void;
|
|
916
|
+
static beginTransaction(connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]> | undefined>;
|
|
917
|
+
static transaction(callback: TFunction, connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]>> | undefined;
|
|
918
|
+
static table(name: string, connection?: null): IQueryBuilder<Model$1, Model$1 | Model$1[]>;
|
|
919
|
+
static schema(connection?: null): SchemaBuilder;
|
|
920
|
+
static destroyAll(): Promise<void>;
|
|
921
|
+
static createModel<X extends TGeneric>(name: string, options: X): typeof Model$1;
|
|
922
|
+
connection(connection?: string | null): QueryBuilder<M, M | M[]>;
|
|
923
|
+
getConnection(name?: string | null): QueryBuilder<M, M | M[]>;
|
|
924
|
+
addConnection(config: TConfig | TBaseConfig, name?: string): void;
|
|
925
|
+
/**
|
|
926
|
+
* Autoload the config file
|
|
927
|
+
*
|
|
928
|
+
* @param addConnection
|
|
929
|
+
* @default true
|
|
930
|
+
* If set to `false` we will no attempt add the connection, we
|
|
931
|
+
* will just go ahead and return the config
|
|
932
|
+
*
|
|
933
|
+
* @returns
|
|
934
|
+
*/
|
|
935
|
+
static autoLoad(addConnection?: boolean): Promise<TBaseConfig>;
|
|
936
|
+
beginTransaction(connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]> | undefined>;
|
|
937
|
+
transaction(callback: TFunction, connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]>> | undefined;
|
|
938
|
+
table(name: string, connection?: null): IQueryBuilder<M, M | M[]>;
|
|
939
|
+
schema(connection?: null): SchemaBuilder;
|
|
940
|
+
destroyAll(): Promise<void>;
|
|
941
|
+
createModel(name: string, options?: ModelOptions): typeof Model$1;
|
|
942
|
+
}
|
|
943
|
+
//#endregion
|
|
944
|
+
//#region src/model.d.ts
|
|
930
945
|
declare const BaseModel$1: (new (...args: any[]) => any) & {
|
|
931
|
-
|
|
946
|
+
[x: string]: any;
|
|
932
947
|
};
|
|
933
|
-
declare class Model$
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
}
|
|
1025
|
-
declare class Pivot$1 extends Model$2 {
|
|
1026
|
-
incrementing: boolean;
|
|
1027
|
-
guarded: never[];
|
|
1028
|
-
pivotParent: Model$2 | null;
|
|
1029
|
-
foreignKey: string | null;
|
|
1030
|
-
relatedKey: string | null;
|
|
1031
|
-
setPivotKeys(foreignKey: string, relatedKey: string): this;
|
|
1032
|
-
static fromRawAttributes<E extends Model$2>(parent: E, attributes: TGeneric, table: string, exists?: boolean): Pivot$1;
|
|
1033
|
-
static fromAttributes<E extends Model$2>(parent: E, attributes: TGeneric, table: string, exists?: boolean): Pivot$1;
|
|
1034
|
-
hasTimestampAttributes(this: any, attributes?: TGeneric | null): boolean;
|
|
948
|
+
declare class Model$1 extends BaseModel$1 {
|
|
949
|
+
protected primaryKey: string;
|
|
950
|
+
protected builder: IBuilder<any, any> | null;
|
|
951
|
+
protected table: string | null;
|
|
952
|
+
protected keyType: string;
|
|
953
|
+
protected incrementing: boolean;
|
|
954
|
+
protected withCount: never[];
|
|
955
|
+
perPage: number;
|
|
956
|
+
static globalScopes: {};
|
|
957
|
+
static pluginInitializers: {};
|
|
958
|
+
static _booted: {};
|
|
959
|
+
static resolver: arquebus;
|
|
960
|
+
connection: TBaseConfig['client'] | null;
|
|
961
|
+
eagerLoad: {};
|
|
962
|
+
exists: boolean;
|
|
963
|
+
with: string | string[] | TGeneric<(...args: any[]) => IBuilder<Model$1>>;
|
|
964
|
+
trx: null;
|
|
965
|
+
constructor(attributes?: {});
|
|
966
|
+
static query(trx?: null): Builder<Model$1, IModel | ICollection<Model$1>>;
|
|
967
|
+
static on(connection?: TBaseConfig['client'] | null): Builder<Model$1, IModel | ICollection<Model$1>>;
|
|
968
|
+
static init(attributes?: {}): Model$1;
|
|
969
|
+
static extend(plugin: TFunction, options: TGeneric): void;
|
|
970
|
+
static make(attributes?: TGeneric): Model$1;
|
|
971
|
+
getConstructor<T extends typeof Model$1>(this: InstanceType<T>): T;
|
|
972
|
+
bootIfNotBooted(this: any): void;
|
|
973
|
+
static booting(): void;
|
|
974
|
+
static boot(): void;
|
|
975
|
+
static booted(): void;
|
|
976
|
+
static setConnectionResolver(resolver: arquebus): void;
|
|
977
|
+
initialize(): void;
|
|
978
|
+
initializePlugins(this: any): void;
|
|
979
|
+
addPluginInitializer(this: any, method: any): void;
|
|
980
|
+
newInstance(this: any, attributes?: TGeneric, exists?: boolean): any;
|
|
981
|
+
newFromBuilder(attributes?: TGeneric, connection?: null): any;
|
|
982
|
+
asProxy(): this;
|
|
983
|
+
getKey(): any;
|
|
984
|
+
getKeyName(): string;
|
|
985
|
+
getForeignKey(): string;
|
|
986
|
+
getConnectionName(): "mysql" | "mysql2" | "sqlite3" | "oracle" | "mariadb" | "pg";
|
|
987
|
+
getTable(): string;
|
|
988
|
+
getConnection(this: any): any;
|
|
989
|
+
setConnection(connection: TBaseConfig['client'] | null): this;
|
|
990
|
+
getKeyType(): string;
|
|
991
|
+
newQuery(trx?: null): Builder<Model$1, IModel | ICollection<Model$1>>;
|
|
992
|
+
newQueryWithoutScopes(trx?: null): Builder<Model$1, IModel | ICollection<Model$1>>;
|
|
993
|
+
newModelQuery(trx?: null): Builder<Model$1, IModel | ICollection<Model$1>>;
|
|
994
|
+
addGlobalScopes(this: any, builder: Builder<Model$1>): Builder<Model$1, IModel | ICollection<Model$1>>;
|
|
995
|
+
hasNamedScope(name: string): boolean;
|
|
996
|
+
callNamedScope(scope: string, parameters: any[]): any;
|
|
997
|
+
setTable(table: string): this;
|
|
998
|
+
newCollection(this: any, models?: never[]): Collection<Model$1>;
|
|
999
|
+
load<R extends WithRelationType>(this: any, ...relations: R[]): Promise<any>;
|
|
1000
|
+
loadAggregate<R extends WithRelationType>(relations: R[], column: string, callback?: TFunction | string | null): Promise<this>;
|
|
1001
|
+
loadCount<R extends WithRelationType>(...relations: R[]): Promise<this>;
|
|
1002
|
+
loadMax<R extends WithRelationType>(relations: R[], column: string): Promise<this>;
|
|
1003
|
+
loadMin<R extends WithRelationType>(relations: R[], column: string): Promise<this>;
|
|
1004
|
+
loadSum<R extends WithRelationType>(relations: R[], column: string): Promise<this>;
|
|
1005
|
+
increment(column: string, amount?: number, extra?: TGeneric, options?: TGeneric): Promise<any>;
|
|
1006
|
+
decrement(column: string, amount?: number, extra?: TGeneric, options?: TGeneric): Promise<any>;
|
|
1007
|
+
incrementOrDecrement(column: string, amount: number, extra: TGeneric, method: string, options: TGeneric): Promise<any>;
|
|
1008
|
+
toData(): {
|
|
1009
|
+
[x: string]: any;
|
|
1010
|
+
[x: number]: any;
|
|
1011
|
+
[x: symbol]: any;
|
|
1012
|
+
};
|
|
1013
|
+
toJSON(): {
|
|
1014
|
+
[x: string]: any;
|
|
1015
|
+
[x: number]: any;
|
|
1016
|
+
[x: symbol]: any;
|
|
1017
|
+
};
|
|
1018
|
+
toJson(...args: any[]): string;
|
|
1019
|
+
toString(): string;
|
|
1020
|
+
fill(attributes: TGeneric): this;
|
|
1021
|
+
transacting(trx: any): this;
|
|
1022
|
+
trashed(): boolean;
|
|
1023
|
+
getIncrementing(): boolean;
|
|
1024
|
+
setIncrementing(value: boolean): this;
|
|
1025
|
+
save(options?: TGeneric): Promise<boolean>;
|
|
1026
|
+
update(attributes?: TGeneric, options?: TGeneric): Promise<boolean>;
|
|
1027
|
+
delete(options?: {}): Promise<boolean>;
|
|
1028
|
+
performDeleteOnModel(options?: TGeneric): Promise<void>;
|
|
1029
|
+
setKeysForSaveQuery(query: any): any;
|
|
1030
|
+
forceDelete(options?: {}): Promise<boolean>;
|
|
1031
|
+
fresh(this: any): any;
|
|
1032
|
+
refresh(this: any): Promise<any>;
|
|
1033
|
+
newPivot<E extends Model$1>(parent: E, attributes: TGeneric, table: string, exists: boolean, using?: typeof Pivot | null): Pivot;
|
|
1034
|
+
qualifyColumn(column: string): string;
|
|
1035
|
+
getQualifiedKeyName(): string;
|
|
1036
|
+
push(options?: {}): Promise<boolean>;
|
|
1037
|
+
is(model: any): any;
|
|
1038
|
+
isNot(model: any): boolean;
|
|
1035
1039
|
}
|
|
1036
|
-
|
|
1040
|
+
declare class Pivot extends Model$1 {
|
|
1041
|
+
incrementing: boolean;
|
|
1042
|
+
guarded: never[];
|
|
1043
|
+
pivotParent: Model$1 | null;
|
|
1044
|
+
foreignKey: string | null;
|
|
1045
|
+
relatedKey: string | null;
|
|
1046
|
+
setPivotKeys(foreignKey: string, relatedKey: string): this;
|
|
1047
|
+
static fromRawAttributes<E extends Model$1>(parent: E, attributes: TGeneric, table: string, exists?: boolean): Pivot;
|
|
1048
|
+
static fromAttributes<E extends Model$1>(parent: E, attributes: TGeneric, table: string, exists?: boolean): Pivot;
|
|
1049
|
+
hasTimestampAttributes(this: any, attributes?: TGeneric | null): boolean;
|
|
1050
|
+
}
|
|
1051
|
+
//#endregion
|
|
1052
|
+
//#region types/generics.d.ts
|
|
1037
1053
|
type TGeneric<V = any, K extends string = string> = Record<K, V>;
|
|
1038
1054
|
type XGeneric<V = TGeneric, T = any> = {
|
|
1039
|
-
|
|
1055
|
+
[key: string]: T;
|
|
1040
1056
|
} & V;
|
|
1041
1057
|
type Hook = 'creating' | 'created' | 'updating' | 'updated' | 'saving' | 'saved' | 'deleting' | 'deleted' | 'restoring' | 'restored' | 'trashed' | 'forceDeleted';
|
|
1042
1058
|
type TFunction<TArgs extends any[] = any[], TReturn = any> = (...args: TArgs) => TReturn;
|
|
1043
1059
|
type PrimitiveValue = string | number | boolean | Date | string[] | number[] | boolean[] | Date[] | null | Buffer;
|
|
1044
|
-
type ReturnTypeOfMethod<T, K extends keyof T> = T[K] extends (...args: any[]) => infer R ? R : never;
|
|
1060
|
+
type ReturnTypeOfMethod<T, K extends keyof T> = T[K] extends ((...args: any[]) => infer R) ? R : never;
|
|
1045
1061
|
type SnakeToCamelCase<S extends string> = S extends `${infer T}_${infer U}` ? `${T}${Capitalize<SnakeToCamelCase<U>>}` : S;
|
|
1046
1062
|
type CamelToSnakeCase<S extends string> = S extends `${infer T}${infer U}` ? U extends Uncapitalize<U> ? `${Uncapitalize<T>}${CamelToSnakeCase<U>}` : `${Uncapitalize<T>}_${CamelToSnakeCase<U>}` : S;
|
|
1047
|
-
type FunctionPropertyNames<T> = {
|
|
1048
|
-
[K in keyof T]: T[K] extends (...args: any[]) => any ? K : never;
|
|
1049
|
-
}[keyof T];
|
|
1063
|
+
type FunctionPropertyNames<T> = { [K in keyof T]: T[K] extends ((...args: any[]) => any) ? K : never }[keyof T];
|
|
1050
1064
|
type RelationNames<T> = FunctionPropertyNames<T> extends infer R ? R extends `relation${infer P}` ? P extends ('sToData' | 'loaded') ? never : CamelToSnakeCase<P> : never : never;
|
|
1051
1065
|
type MixinConstructor<T = TGeneric> = new (...args: any[]) => T;
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
[x: number]: any;
|
|
1075
|
-
[x: symbol]: any;
|
|
1076
|
-
})[];
|
|
1077
|
-
toJson(...args: any[]): string;
|
|
1078
|
-
[Symbol.iterator]: () => Iterator<I>;
|
|
1079
|
-
}
|
|
1080
|
-
|
|
1081
|
-
declare const BaseModel: (new (...args: any[]) => any) & {
|
|
1066
|
+
//#endregion
|
|
1067
|
+
//#region src/browser/collection.d.ts
|
|
1068
|
+
declare class Collection$2<I extends Model$2> extends Collection$1<I> {
|
|
1069
|
+
mapThen(callback: TFunction): Promise<any[]>;
|
|
1070
|
+
modelKeys(): any[];
|
|
1071
|
+
contains<K, V>(key: keyof I | K | TFunction, value?: V): boolean;
|
|
1072
|
+
diff(items: ICollection<any> | any[]): any;
|
|
1073
|
+
except(keys: any[]): any;
|
|
1074
|
+
intersect(items: I[]): any;
|
|
1075
|
+
unique(key?: TFunction | keyof I, _strict?: boolean): any;
|
|
1076
|
+
find(key: any, defaultValue?: null): any;
|
|
1077
|
+
makeVisible(attributes: any): this;
|
|
1078
|
+
makeHidden(attributes: any): this;
|
|
1079
|
+
append(attributes: any): this;
|
|
1080
|
+
only(keys: any[]): any;
|
|
1081
|
+
getDictionary(items?: ICollection<any> | any[]): TGeneric;
|
|
1082
|
+
toData(): (I | {
|
|
1083
|
+
[x: string]: any;
|
|
1084
|
+
[x: number]: any;
|
|
1085
|
+
[x: symbol]: any;
|
|
1086
|
+
})[];
|
|
1087
|
+
toJSON(): (I | {
|
|
1082
1088
|
[x: string]: any;
|
|
1089
|
+
[x: number]: any;
|
|
1090
|
+
[x: symbol]: any;
|
|
1091
|
+
})[];
|
|
1092
|
+
toJson(...args: any[]): string;
|
|
1093
|
+
[Symbol.iterator]: () => Iterator<I>;
|
|
1094
|
+
}
|
|
1095
|
+
//#endregion
|
|
1096
|
+
//#region src/browser/model.d.ts
|
|
1097
|
+
declare const BaseModel: (new (...args: any[]) => any) & {
|
|
1098
|
+
[x: string]: any;
|
|
1083
1099
|
};
|
|
1084
|
-
declare class Model$
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
}
|
|
1141
|
-
declare class Pivot extends Model$1 {
|
|
1142
|
-
incrementing: boolean;
|
|
1143
|
-
guarded: never[];
|
|
1144
|
-
pivotParent: Model$1 | null;
|
|
1145
|
-
foreignKey: string | null;
|
|
1146
|
-
relatedKey: string | null;
|
|
1147
|
-
setPivotKeys(foreignKey: string, relatedKey: string): this;
|
|
1148
|
-
static fromRawAttributes<E extends Model$1>(parent: E, attributes: TGeneric, table: string, exists?: boolean): Pivot;
|
|
1149
|
-
static fromAttributes<E extends Model$1>(parent: E, attributes: TGeneric, table: string, exists?: boolean): Pivot;
|
|
1150
|
-
hasTimestampAttributes(this: any, attributes?: TGeneric | null): boolean;
|
|
1100
|
+
declare class Model$2 extends BaseModel {
|
|
1101
|
+
protected primaryKey: string;
|
|
1102
|
+
protected perPage: number;
|
|
1103
|
+
static globalScopes: {};
|
|
1104
|
+
static pluginInitializers: {};
|
|
1105
|
+
static _booted: {};
|
|
1106
|
+
static resolver: arquebus;
|
|
1107
|
+
static browser: boolean;
|
|
1108
|
+
connection: TBaseConfig['client'] | null;
|
|
1109
|
+
constructor(attributes?: {});
|
|
1110
|
+
static init(attributes?: {}): Model$2;
|
|
1111
|
+
static extend(plugin: TFunction, options: TGeneric): void;
|
|
1112
|
+
static make(attributes?: TGeneric): Model$2;
|
|
1113
|
+
bootIfNotBooted(this: any): void;
|
|
1114
|
+
static booting(): void;
|
|
1115
|
+
static boot(): void;
|
|
1116
|
+
static booted(): void;
|
|
1117
|
+
static setConnectionResolver(resolver: arquebus): void;
|
|
1118
|
+
initialize(): void;
|
|
1119
|
+
initializePlugins(this: any): void;
|
|
1120
|
+
addPluginInitializer(this: any, method: any): void;
|
|
1121
|
+
newInstance(this: any, attributes?: TGeneric, exists?: boolean): any;
|
|
1122
|
+
asProxy(): this;
|
|
1123
|
+
getKey(): any;
|
|
1124
|
+
getKeyName(): string;
|
|
1125
|
+
getForeignKey(): string;
|
|
1126
|
+
getConnectionName(): "mysql" | "mysql2" | "sqlite3" | "oracle" | "mariadb" | "pg" | null;
|
|
1127
|
+
getTable(): any;
|
|
1128
|
+
setConnection(connection: TBaseConfig['client']): this;
|
|
1129
|
+
getKeyType(): any;
|
|
1130
|
+
hasNamedScope(name: string): boolean;
|
|
1131
|
+
callNamedScope(scope: string, parameters: any): any;
|
|
1132
|
+
setTable(table: string): this;
|
|
1133
|
+
newCollection(models?: never[]): Collection$2<never>;
|
|
1134
|
+
getIncrementing(): any;
|
|
1135
|
+
setIncrementing(value: boolean): this;
|
|
1136
|
+
toData(): {
|
|
1137
|
+
[x: string]: any;
|
|
1138
|
+
[x: number]: any;
|
|
1139
|
+
[x: symbol]: any;
|
|
1140
|
+
};
|
|
1141
|
+
toJSON(): {
|
|
1142
|
+
[x: string]: any;
|
|
1143
|
+
[x: number]: any;
|
|
1144
|
+
[x: symbol]: any;
|
|
1145
|
+
};
|
|
1146
|
+
toJson(...args: any[]): string;
|
|
1147
|
+
toString(): string;
|
|
1148
|
+
fill(attributes: TGeneric): this;
|
|
1149
|
+
transacting(trx: any): this;
|
|
1150
|
+
trashed(): boolean;
|
|
1151
|
+
newPivot<E extends Model$2>(parent: E, attributes: TGeneric, table: string, exists: boolean, using?: typeof Pivot$1 | null): Pivot$1;
|
|
1152
|
+
qualifyColumn(column: string): string;
|
|
1153
|
+
getQualifiedKeyName(): string;
|
|
1154
|
+
is(model: any): any;
|
|
1155
|
+
isNot(model: any): boolean;
|
|
1151
1156
|
}
|
|
1152
|
-
|
|
1157
|
+
declare class Pivot$1 extends Model$2 {
|
|
1158
|
+
incrementing: boolean;
|
|
1159
|
+
guarded: never[];
|
|
1160
|
+
pivotParent: Model$2 | null;
|
|
1161
|
+
foreignKey: string | null;
|
|
1162
|
+
relatedKey: string | null;
|
|
1163
|
+
setPivotKeys(foreignKey: string, relatedKey: string): this;
|
|
1164
|
+
static fromRawAttributes<E extends Model$2>(parent: E, attributes: TGeneric, table: string, exists?: boolean): Pivot$1;
|
|
1165
|
+
static fromAttributes<E extends Model$2>(parent: E, attributes: TGeneric, table: string, exists?: boolean): Pivot$1;
|
|
1166
|
+
hasTimestampAttributes(this: any, attributes?: TGeneric | null): boolean;
|
|
1167
|
+
}
|
|
1168
|
+
//#endregion
|
|
1169
|
+
//#region src/casts/attribute.d.ts
|
|
1153
1170
|
interface IAttribute {
|
|
1154
|
-
|
|
1155
|
-
|
|
1171
|
+
get?: null | (<A extends TGeneric>(value: string, attr: A) => string);
|
|
1172
|
+
set?: null | (<A extends TGeneric>(value: string, attr: A) => string | TGeneric);
|
|
1156
1173
|
}
|
|
1157
1174
|
declare class Attribute {
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1175
|
+
get: IAttribute['get'];
|
|
1176
|
+
set: IAttribute['set'];
|
|
1177
|
+
withCaching: boolean;
|
|
1178
|
+
withObjectCaching: boolean;
|
|
1179
|
+
constructor({
|
|
1180
|
+
get,
|
|
1181
|
+
set
|
|
1182
|
+
}: IAttribute);
|
|
1183
|
+
static make({
|
|
1184
|
+
get,
|
|
1185
|
+
set
|
|
1186
|
+
}: IAttribute): Attribute;
|
|
1187
|
+
static get(get: IAttribute['get']): Attribute;
|
|
1188
|
+
static set(set: IAttribute['set']): Attribute;
|
|
1189
|
+
withoutObjectCaching(): this;
|
|
1190
|
+
shouldCache(): this;
|
|
1191
|
+
}
|
|
1192
|
+
//#endregion
|
|
1193
|
+
//#region src/casts-attributes.d.ts
|
|
1170
1194
|
interface ICastsAttributes {
|
|
1171
|
-
|
|
1172
|
-
|
|
1195
|
+
get?(model: Model$1, key: string, value: string, attributes: TGeneric): string | null | undefined;
|
|
1196
|
+
set?(model: Model$1, key: string, value: string, attributes: TGeneric): string | null | undefined;
|
|
1173
1197
|
}
|
|
1174
1198
|
declare class CastsAttributes implements ICastsAttributes {
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1199
|
+
constructor();
|
|
1200
|
+
static get(_model: Model$1, _key: string, _value: string, _attributes: TGeneric): string | null | undefined;
|
|
1201
|
+
static set(_model: Model$1, _key: string, _value: string, _attributes: TGeneric): string | null | undefined;
|
|
1178
1202
|
}
|
|
1179
|
-
|
|
1203
|
+
//#endregion
|
|
1204
|
+
//#region src/concerns/has-unique-ids.d.ts
|
|
1180
1205
|
declare const HasUniqueIds: <TBase extends MixinConstructor>(Model: TBase) => {
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1206
|
+
new (...args: any[]): {
|
|
1207
|
+
[x: string]: any;
|
|
1208
|
+
useUniqueIds: boolean;
|
|
1209
|
+
uniqueIds(): any[];
|
|
1210
|
+
getKeyType(): any;
|
|
1211
|
+
getIncrementing(): any;
|
|
1212
|
+
};
|
|
1188
1213
|
} & TBase;
|
|
1189
|
-
|
|
1214
|
+
//#endregion
|
|
1215
|
+
//#region src/migrations/migration.d.ts
|
|
1190
1216
|
interface IMigration {
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1217
|
+
withinTransaction?: boolean;
|
|
1218
|
+
up(schema: SchemaBuilder, connection?: QueryBuilder): Promise<any>;
|
|
1219
|
+
down(schema: SchemaBuilder, connection?: QueryBuilder): Promise<any>;
|
|
1220
|
+
getConnection(): TBaseConfig['client'];
|
|
1195
1221
|
}
|
|
1196
1222
|
declare const Inference: {
|
|
1197
|
-
|
|
1223
|
+
new (): IMigration;
|
|
1198
1224
|
};
|
|
1199
1225
|
declare class Migration extends Inference {
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1226
|
+
protected connection: TBaseConfig['client'];
|
|
1227
|
+
withinTransaction: boolean;
|
|
1228
|
+
getConnection(): TBaseConfig['client'];
|
|
1203
1229
|
}
|
|
1204
|
-
|
|
1230
|
+
//#endregion
|
|
1231
|
+
//#region src/migrations/migration-repository.d.ts
|
|
1205
1232
|
declare class MigrationRepository {
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
}
|
|
1226
|
-
|
|
1233
|
+
resolver: typeof arquebus;
|
|
1234
|
+
table: string;
|
|
1235
|
+
connection: TBaseConfig['client'] | null;
|
|
1236
|
+
constructor(resolver: typeof arquebus, table: string);
|
|
1237
|
+
getRan(): Promise<ICollection<any>>;
|
|
1238
|
+
getMigrations(steps: number): Promise<any>;
|
|
1239
|
+
getMigrationsByBatch(batch: number): Promise<any>;
|
|
1240
|
+
getLast(): Promise<any>;
|
|
1241
|
+
getMigrationBatches(): Promise<TGeneric>;
|
|
1242
|
+
log(file: string, batch: number): Promise<void>;
|
|
1243
|
+
delete(migration: TGeneric): Promise<void>;
|
|
1244
|
+
getNextBatchNumber(): Promise<number>;
|
|
1245
|
+
getLastBatchNumber(): Promise<number>;
|
|
1246
|
+
createRepository(): Promise<void>;
|
|
1247
|
+
repositoryExists(): Promise<boolean>;
|
|
1248
|
+
deleteRepository(): Promise<void>;
|
|
1249
|
+
getTable(): IQueryBuilder<Model$1, Model$1 | Model$1[]>;
|
|
1250
|
+
getConnection(): QueryBuilder<Model$1, Model$1 | Model$1[]>;
|
|
1251
|
+
setSource(name: TBaseConfig['client']): void;
|
|
1252
|
+
}
|
|
1253
|
+
//#endregion
|
|
1254
|
+
//#region src/migrations/migrator.d.ts
|
|
1227
1255
|
interface MigrationOptions {
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1256
|
+
pretend?: boolean;
|
|
1257
|
+
step?: number;
|
|
1258
|
+
batch?: number;
|
|
1231
1259
|
}
|
|
1232
1260
|
declare class Migrator {
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
}
|
|
1278
|
-
|
|
1261
|
+
events: any;
|
|
1262
|
+
repository: MigrationRepository;
|
|
1263
|
+
files: any;
|
|
1264
|
+
resolver: typeof arquebus;
|
|
1265
|
+
connection: TBaseConfig['client'];
|
|
1266
|
+
paths: string[];
|
|
1267
|
+
output: boolean | null;
|
|
1268
|
+
constructor(repository: MigrationRepository, resolver?: typeof arquebus | null, files?: any, dispatcher?: any);
|
|
1269
|
+
run(paths?: string[], options?: MigrationOptions): Promise<string[]>;
|
|
1270
|
+
pendingMigrations(files: Record<string, string>, ran: string[]): string[];
|
|
1271
|
+
runPending(migrations: string[], options?: MigrationOptions): Promise<void>;
|
|
1272
|
+
runUp(file: string, batch: number, _pretend: boolean): Promise<void>;
|
|
1273
|
+
runDown(file: string, migration: {
|
|
1274
|
+
migration: string;
|
|
1275
|
+
}, _pretend: boolean): Promise<void>;
|
|
1276
|
+
rollback(paths?: string[], options?: MigrationOptions): Promise<string[]>;
|
|
1277
|
+
getMigrationsForRollback(options: MigrationOptions): Promise<{
|
|
1278
|
+
migration: string;
|
|
1279
|
+
}[]>;
|
|
1280
|
+
rollbackMigrations(migrations: {
|
|
1281
|
+
migration: string;
|
|
1282
|
+
}[], paths: string[], options: MigrationOptions): Promise<string[]>;
|
|
1283
|
+
reset(_paths?: string[], _pretend?: boolean): Promise<string[]> | string[];
|
|
1284
|
+
resetMigrations(migrations: {
|
|
1285
|
+
migration: string;
|
|
1286
|
+
}[], paths: string[], pretend?: boolean): Promise<string[]>;
|
|
1287
|
+
runMigration(migration: IMigration, method: 'up' | 'down'): Promise<void>;
|
|
1288
|
+
runMethod(connection: QueryBuilder, migration: IMigration, method: 'up' | 'down'): Promise<void>;
|
|
1289
|
+
resolvePath(filePath: string): Promise<IMigration>;
|
|
1290
|
+
getMigrationClass(migrationName: string): string;
|
|
1291
|
+
getMigrationFiles(paths: string[]): Promise<Record<string, string>>;
|
|
1292
|
+
getMigrationName(filePath: string): string;
|
|
1293
|
+
path(p: string): void;
|
|
1294
|
+
getPaths(): string[];
|
|
1295
|
+
getConnection(): TBaseConfig['client'];
|
|
1296
|
+
resolveConnection(connection?: TBaseConfig['client']): any;
|
|
1297
|
+
getRepository(): MigrationRepository;
|
|
1298
|
+
repositoryExists(): Promise<boolean>;
|
|
1299
|
+
hasRunAnyMigrations(): Promise<boolean>;
|
|
1300
|
+
deleteRepository(): void;
|
|
1301
|
+
setOutput(output: boolean): this;
|
|
1302
|
+
write(...args: any[]): void;
|
|
1303
|
+
writeTwoColumns(name: string, ...args: string[]): void;
|
|
1304
|
+
writeTask(description: string, task: () => Promise<any> | any): Promise<void>;
|
|
1305
|
+
}
|
|
1306
|
+
//#endregion
|
|
1307
|
+
//#region src/migrate.d.ts
|
|
1279
1308
|
interface MigrationStatus {
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1309
|
+
name: string;
|
|
1310
|
+
ran: boolean;
|
|
1311
|
+
batch: number | null;
|
|
1283
1312
|
}
|
|
1284
1313
|
interface MigrateOptions {
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1314
|
+
path?: string;
|
|
1315
|
+
step?: number;
|
|
1316
|
+
pretend?: boolean;
|
|
1317
|
+
batch?: number;
|
|
1289
1318
|
}
|
|
1290
1319
|
type TXBaseConfig<S = boolean> = (S extends true ? Partial<TBaseConfig> : TBaseConfig) & {
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1320
|
+
/**
|
|
1321
|
+
* Set this to true if you already have an active connection and dont want to create a new one
|
|
1322
|
+
*/
|
|
1323
|
+
skipConnection?: S;
|
|
1295
1324
|
};
|
|
1296
1325
|
interface TCallback {
|
|
1297
|
-
|
|
1326
|
+
(message: string, status?: 'success' | 'error' | 'info' | 'quiet'): void;
|
|
1298
1327
|
}
|
|
1299
1328
|
declare class Migrate {
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
}
|
|
1346
|
-
|
|
1329
|
+
private basePath?;
|
|
1330
|
+
private customStubPath?;
|
|
1331
|
+
private callback;
|
|
1332
|
+
constructor(basePath?: string | undefined, customStubPath?: string | undefined, callback?: TCallback);
|
|
1333
|
+
/**
|
|
1334
|
+
* Runs all pending migrations
|
|
1335
|
+
*
|
|
1336
|
+
* @param config
|
|
1337
|
+
* @param options
|
|
1338
|
+
* @param destroyAll
|
|
1339
|
+
*/
|
|
1340
|
+
run(config: TXBaseConfig, options?: MigrateOptions, destroyAll?: boolean): Promise<void>;
|
|
1341
|
+
/**
|
|
1342
|
+
* Rollback the last migration
|
|
1343
|
+
*
|
|
1344
|
+
* @param config
|
|
1345
|
+
* @param options
|
|
1346
|
+
* @param destroyAll
|
|
1347
|
+
*/
|
|
1348
|
+
rollback(config: TXBaseConfig, options?: MigrateOptions, destroyAll?: boolean): Promise<void>;
|
|
1349
|
+
/**
|
|
1350
|
+
* Prepares the database for migration
|
|
1351
|
+
*
|
|
1352
|
+
* @param migrator
|
|
1353
|
+
*/
|
|
1354
|
+
prepareDatabase(migrator: Migrator): Promise<void>;
|
|
1355
|
+
/**
|
|
1356
|
+
* Check the status of available migrations
|
|
1357
|
+
*
|
|
1358
|
+
* @param config
|
|
1359
|
+
* @param options
|
|
1360
|
+
* @param destroyAll
|
|
1361
|
+
* @returns
|
|
1362
|
+
*/
|
|
1363
|
+
status(config: TXBaseConfig, options?: MigrateOptions, destroyAll?: boolean): Promise<MigrationStatus[]>;
|
|
1364
|
+
/**
|
|
1365
|
+
* Setup the database connection
|
|
1366
|
+
*
|
|
1367
|
+
* @param config
|
|
1368
|
+
* @returns
|
|
1369
|
+
*/
|
|
1370
|
+
setupConnection(config: TXBaseConfig): Promise<{
|
|
1371
|
+
arquebus: typeof arquebus;
|
|
1372
|
+
migrator: Migrator;
|
|
1373
|
+
}>;
|
|
1374
|
+
}
|
|
1375
|
+
//#endregion
|
|
1376
|
+
//#region src/soft-deletes.d.ts
|
|
1347
1377
|
declare const softDeletes: <TBase extends MixinConstructor>(Model: TBase) => {
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1378
|
+
new (...args: any[]): {
|
|
1379
|
+
[x: string]: any;
|
|
1380
|
+
forceDeleting: boolean;
|
|
1381
|
+
initialize(this: typeof Model.prototype): void;
|
|
1382
|
+
initializeSoftDeletes(): void;
|
|
1383
|
+
forceDelete(): Promise<any>;
|
|
1384
|
+
forceDeleteQuietly(): any;
|
|
1385
|
+
performDeleteOnModel(options?: {}): Promise<any>;
|
|
1386
|
+
runSoftDelete(options?: {}): Promise<void>;
|
|
1387
|
+
restore(options?: {}): Promise<any>;
|
|
1388
|
+
restoreQuietly(): any;
|
|
1389
|
+
trashed(): boolean;
|
|
1390
|
+
isForceDeleting(): boolean;
|
|
1391
|
+
getDeletedAtColumn(this: typeof Model.prototype): any;
|
|
1392
|
+
getQualifiedDeletedAtColumn(): any;
|
|
1393
|
+
};
|
|
1394
|
+
bootSoftDeletes(this: typeof Model.prototype): void;
|
|
1395
|
+
softDeleted(this: typeof Model.prototype, callback: TFunction): void;
|
|
1396
|
+
restoring(this: typeof Model.prototype, callback: TFunction): void;
|
|
1397
|
+
restored(this: typeof Model.prototype, callback: TFunction): void;
|
|
1398
|
+
forceDeleting(this: typeof Model.prototype, callback: TFunction): void;
|
|
1399
|
+
forceDeleted(this: typeof Model.prototype, callback: TFunction): void;
|
|
1370
1400
|
} & TBase;
|
|
1371
|
-
|
|
1401
|
+
//#endregion
|
|
1402
|
+
//#region src/errors.d.ts
|
|
1372
1403
|
declare class BaseError extends Error {
|
|
1373
|
-
|
|
1404
|
+
constructor(message: string, _entity?: any);
|
|
1374
1405
|
}
|
|
1375
1406
|
declare class ModelNotFoundError extends BaseError {
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
}
|
|
1383
|
-
declare class RelationNotFoundError extends BaseError {
|
|
1384
|
-
}
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1407
|
+
model?: IModel;
|
|
1408
|
+
ids: (string | number)[] | string | number;
|
|
1409
|
+
constructor();
|
|
1410
|
+
setModel(model: IModel, ids?: never[]): this;
|
|
1411
|
+
getModel(): IModel | undefined;
|
|
1412
|
+
getIds(): string | number | (string | number)[];
|
|
1413
|
+
}
|
|
1414
|
+
declare class RelationNotFoundError extends BaseError {}
|
|
1415
|
+
declare class InvalidArgumentError extends BaseError {}
|
|
1416
|
+
//#endregion
|
|
1417
|
+
//#region src/mixin.d.ts
|
|
1388
1418
|
/**
|
|
1389
1419
|
* Helper type to extract instance type from constructor or mixin function
|
|
1390
1420
|
*/
|
|
@@ -1393,13 +1423,11 @@ type Mixin<TBase extends Constructor> = (Base: TBase) => Constructor;
|
|
|
1393
1423
|
/**
|
|
1394
1424
|
* Helper type to convert union to intersection
|
|
1395
1425
|
*/
|
|
1396
|
-
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
|
1426
|
+
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
|
|
1397
1427
|
/**
|
|
1398
1428
|
* Helper type to get static side of a constructor
|
|
1399
1429
|
*/
|
|
1400
|
-
type Static<T> = {
|
|
1401
|
-
[K in keyof T]: T[K];
|
|
1402
|
-
};
|
|
1430
|
+
type Static<T> = { [K in keyof T]: T[K] };
|
|
1403
1431
|
/**
|
|
1404
1432
|
* Compose function that merges multiple classes and mixins
|
|
1405
1433
|
*
|
|
@@ -1444,12 +1472,9 @@ type Static<T> = {
|
|
|
1444
1472
|
* @param mixins
|
|
1445
1473
|
* @returns
|
|
1446
1474
|
*/
|
|
1447
|
-
declare function compose$1<TBase extends Constructor, TMixins extends Array<Mixin<any> | Constructor>>(Base: TBase, ...mixins: TMixins): Constructor<InstanceType<TBase> & UnionToIntersection<{
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
[K in keyof TMixins]: TMixins[K] extends Mixin<any> ? Static<ReturnType<TMixins[K]>> : TMixins[K] extends Constructor ? Static<TMixins[K]> : never;
|
|
1451
|
-
}[number]> & Static<TBase>;
|
|
1452
|
-
|
|
1475
|
+
declare function compose$1<TBase extends Constructor, TMixins extends Array<Mixin<any> | Constructor>>(Base: TBase, ...mixins: TMixins): Constructor<InstanceType<TBase> & UnionToIntersection<{ [K in keyof TMixins]: TMixins[K] extends Mixin<any> ? InstanceType<ReturnType<TMixins[K]>> : TMixins[K] extends Constructor ? InstanceType<TMixins[K]> : never }[number]>> & UnionToIntersection<{ [K in keyof TMixins]: TMixins[K] extends Mixin<any> ? Static<ReturnType<TMixins[K]>> : TMixins[K] extends Constructor ? Static<TMixins[K]> : never }[number]> & Static<TBase>;
|
|
1476
|
+
//#endregion
|
|
1477
|
+
//#region src/utils.d.ts
|
|
1453
1478
|
declare const now: (format?: string) => string;
|
|
1454
1479
|
declare const getRelationName: (relationMethod: string) => string;
|
|
1455
1480
|
declare const getScopeName: (scopeMethod: string) => string;
|
|
@@ -1472,11 +1497,12 @@ declare const flattenDeep: (arr: any) => any;
|
|
|
1472
1497
|
declare const kebabCase: (str: string) => string;
|
|
1473
1498
|
declare const snakeCase: (str: string) => string;
|
|
1474
1499
|
declare const defineConfig: (config: TConfig) => XGeneric<TConfig>;
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1500
|
+
//#endregion
|
|
1501
|
+
//#region src/index.d.ts
|
|
1502
|
+
declare const make: (model: Model$1, data: TGeneric, options?: {
|
|
1503
|
+
paginated: IPaginatorParams;
|
|
1478
1504
|
}) => any;
|
|
1479
|
-
declare const makeCollection: (model: Model$
|
|
1480
|
-
declare const makePaginator: (model: Model$
|
|
1481
|
-
|
|
1482
|
-
export { Attribute, Builder, CastsAttributes, Collection
|
|
1505
|
+
declare const makeCollection: (model: Model$1, data: TGeneric) => Collection<Model$1 | Model$2>;
|
|
1506
|
+
declare const makePaginator: (model: Model$1, data: TGeneric) => Paginator<Model$1, IPaginatorParams>;
|
|
1507
|
+
//#endregion
|
|
1508
|
+
export { Attribute, Builder, CastsAttributes, Collection, HasUniqueIds, InvalidArgumentError, Migrate, Migration, Model$1 as Model, ModelNotFoundError, Paginator, Pivot, QueryBuilder, RelationNotFoundError, Scope, softDeletes as SoftDeletes, arquebus, compose, defineConfig, flattenDeep, getAttrMethod, getAttrName, getGetterMethod, getRelationMethod, getRelationName, getScopeMethod, getScopeName, getSetterMethod, kebabCase, make, makeCollection, makePaginator, now, snakeCase, tap };
|