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