@h3ravel/arquebus 0.6.6 → 0.6.8
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 +5 -4
- package/bin/index.cjs +270 -425
- package/bin/{index.js → index.mjs} +230 -409
- package/bin/seeders-C0schOjT.mjs +3 -0
- package/bin/seeders-D-v59HCz.cjs +3 -0
- package/dist/browser/index.cjs +4 -12
- package/dist/browser/index.d.cts +203 -203
- package/dist/browser/{index.d.ts → index.d.mts} +203 -203
- package/dist/browser/{index.js → index.mjs} +4 -11
- package/dist/index.cjs +21 -59
- package/dist/index.d.cts +133 -133
- package/dist/{index.d.ts → index.d.mts} +133 -133
- package/dist/{index.js → index.mjs} +21 -54
- package/dist/inspector/index.cjs +15 -46
- package/dist/inspector/{index.js → index.mjs} +15 -43
- package/dist/migrations/{chunk-PECeCxCb.js → chunk-BD38OWEx.mjs} +1 -1
- package/dist/migrations/index.cjs +20 -57
- package/dist/migrations/index.d.cts +186 -186
- package/dist/migrations/{index.d.ts → index.d.mts} +186 -186
- package/dist/migrations/{index.js → index.mjs} +22 -54
- package/dist/seeders/index.cjs +1 -5
- package/dist/seeders/index.d.cts +184 -184
- package/dist/seeders/{index.d.ts → index.d.mts} +184 -184
- package/dist/seeders/{index.js → index.mjs} +2 -3
- package/dist/stubs/seeder-js.stub +4 -4
- package/dist/stubs/seeder-ts.stub +5 -0
- package/package.json +5 -4
- package/bin/seeders-8GJzfIIN.js +0 -3
- package/bin/seeders-ByeSoCAQ.cjs +0 -131
- package/bin/seeders-CltigymO.js +0 -79
- package/bin/seeders-_xJ6VGVS.cjs +0 -3
- /package/bin/{index.d.ts → index.d.mts} +0 -0
- /package/dist/inspector/{index.d.ts → index.d.mts} +0 -0
package/dist/seeders/index.d.cts
CHANGED
|
@@ -4,33 +4,33 @@ import Knex$1, { Knex } from "knex";
|
|
|
4
4
|
|
|
5
5
|
//#region src/casts-attributes.d.ts
|
|
6
6
|
interface ICastsAttributes {
|
|
7
|
-
get?(model: Model, key: string, value: string, attributes: TGeneric): string | null | undefined;
|
|
8
|
-
set?(model: Model, key: string, value: string, attributes: TGeneric): string | null | undefined;
|
|
7
|
+
get?(model: Model$1, key: string, value: string, attributes: TGeneric): string | null | undefined;
|
|
8
|
+
set?(model: Model$1, key: string, value: string, attributes: TGeneric): string | null | undefined;
|
|
9
9
|
}
|
|
10
10
|
declare class CastsAttributes implements ICastsAttributes {
|
|
11
11
|
constructor();
|
|
12
|
-
static get(_model: Model, _key: string, _value: string, _attributes: TGeneric): string | null | undefined;
|
|
13
|
-
static set(_model: Model, _key: string, _value: string, _attributes: TGeneric): string | null | undefined;
|
|
12
|
+
static get(_model: Model$1, _key: string, _value: string, _attributes: TGeneric): string | null | undefined;
|
|
13
|
+
static set(_model: Model$1, _key: string, _value: string, _attributes: TGeneric): string | null | undefined;
|
|
14
14
|
}
|
|
15
15
|
//#endregion
|
|
16
16
|
//#region src/collection.d.ts
|
|
17
|
-
declare class Collection$1<I extends Model | Model$
|
|
17
|
+
declare class Collection$1<I$1 extends Model$1 | Model$2> extends Collection<I$1> implements ICollection<I$1> {
|
|
18
18
|
private newConstructor;
|
|
19
|
-
getConstructor<T extends typeof Collection$1<I>>(this: InstanceType<T>): T;
|
|
20
|
-
load(...relations: (string[] | I[] | string | I)[]): Promise<Collection$1<I>>;
|
|
21
|
-
loadAggregate<I>(relations: I, column: string, action?: string | null | TFunction): Promise<this>;
|
|
22
|
-
loadCount(relations: I): Promise<this>;
|
|
23
|
-
loadMax(relation: I, column: string): Promise<this>;
|
|
24
|
-
loadMin(relation: I, column: string): Promise<this>;
|
|
25
|
-
loadSum(relation: I, column: string): Promise<this>;
|
|
26
|
-
loadAvg(relation: I, column: string): Promise<this>;
|
|
19
|
+
getConstructor<T$1 extends typeof Collection$1<I$1>>(this: InstanceType<T$1>): T$1;
|
|
20
|
+
load(...relations: (string[] | I$1[] | string | I$1)[]): Promise<Collection$1<I$1>>;
|
|
21
|
+
loadAggregate<I$1>(relations: I$1, column: string, action?: string | null | TFunction): Promise<this>;
|
|
22
|
+
loadCount(relations: I$1): Promise<this>;
|
|
23
|
+
loadMax(relation: I$1, column: string): Promise<this>;
|
|
24
|
+
loadMin(relation: I$1, column: string): Promise<this>;
|
|
25
|
+
loadSum(relation: I$1, column: string): Promise<this>;
|
|
26
|
+
loadAvg(relation: I$1, column: string): Promise<this>;
|
|
27
27
|
mapThen(callback: () => void): Promise<void[]>;
|
|
28
28
|
modelKeys(): any[];
|
|
29
|
-
contains<K, V>(key: keyof I | K | TFunction, value?: V): boolean;
|
|
29
|
+
contains<K$1, V>(key: keyof I$1 | K$1 | TFunction, value?: V): boolean;
|
|
30
30
|
diff(items: ICollection<any> | any[]): any;
|
|
31
31
|
except(keys: any[]): any;
|
|
32
|
-
intersect(items: I[]): any;
|
|
33
|
-
unique(key?: TFunction | keyof I, _strict?: boolean): any;
|
|
32
|
+
intersect(items: I$1[]): any;
|
|
33
|
+
unique(key?: TFunction | keyof I$1, _strict?: boolean): any;
|
|
34
34
|
find(key: any, defaultValue?: null): any;
|
|
35
35
|
fresh(...args: any[]): Promise<any>;
|
|
36
36
|
makeVisible(attributes: any): this;
|
|
@@ -39,24 +39,24 @@ declare class Collection$1<I extends Model | Model$1> extends Collection<I> impl
|
|
|
39
39
|
only(keys: any[]): any;
|
|
40
40
|
getDictionary(items?: ICollection<any> | any[]): TGeneric;
|
|
41
41
|
toQuery(): any;
|
|
42
|
-
toData(): (I | {
|
|
42
|
+
toData(): (I$1 | {
|
|
43
43
|
[x: string]: any;
|
|
44
44
|
[x: number]: any;
|
|
45
45
|
[x: symbol]: any;
|
|
46
46
|
})[];
|
|
47
|
-
toJSON(): (I | {
|
|
47
|
+
toJSON(): (I$1 | {
|
|
48
48
|
[x: string]: any;
|
|
49
49
|
[x: number]: any;
|
|
50
50
|
[x: symbol]: any;
|
|
51
51
|
})[];
|
|
52
52
|
toJson(...args: any[]): string;
|
|
53
|
-
[Symbol.iterator]: () => Iterator<I>;
|
|
53
|
+
[Symbol.iterator]: () => Iterator<I$1>;
|
|
54
54
|
}
|
|
55
55
|
//#endregion
|
|
56
56
|
//#region src/paginator.d.ts
|
|
57
|
-
declare class Paginator<T extends Model, K extends IPaginatorParams = IPaginatorParams> implements IPaginator<T, K> {
|
|
57
|
+
declare class Paginator<T$1 extends Model$1, K$1 extends IPaginatorParams = IPaginatorParams> implements IPaginator<T$1, K$1> {
|
|
58
58
|
static formatter: (paginator: IPaginator<any>) => any | null;
|
|
59
|
-
_items: Collection$1<T>;
|
|
59
|
+
_items: Collection$1<T$1>;
|
|
60
60
|
_total: number;
|
|
61
61
|
_perPage: number;
|
|
62
62
|
_lastPage: number;
|
|
@@ -64,15 +64,15 @@ declare class Paginator<T extends Model, K extends IPaginatorParams = IPaginator
|
|
|
64
64
|
hasMore: boolean;
|
|
65
65
|
options: TGeneric;
|
|
66
66
|
static setFormatter(formatter?: ((paginator: IPaginator<any> | null) => any) | null): void;
|
|
67
|
-
constructor(items: T[], total: number, perPage: number, currentPage?: number, options?: TGeneric);
|
|
68
|
-
setItems(items: T[]): void;
|
|
67
|
+
constructor(items: T$1[], total: number, perPage: number, currentPage?: number, options?: TGeneric);
|
|
68
|
+
setItems(items: T$1[]): void;
|
|
69
69
|
firstItem(): number | null;
|
|
70
70
|
lastItem(): number | null;
|
|
71
71
|
hasMorePages(): boolean;
|
|
72
|
-
get(index: number): T | null;
|
|
72
|
+
get(index: number): T$1 | null;
|
|
73
73
|
count(): number;
|
|
74
|
-
items(): Collection$1<T>;
|
|
75
|
-
map(callback: (value: T, index: number) => T): Collection$1<T>;
|
|
74
|
+
items(): Collection$1<T$1>;
|
|
75
|
+
map(callback: (value: T$1, index: number) => T$1): Collection$1<T$1>;
|
|
76
76
|
currentPage(): number;
|
|
77
77
|
onFirstPage(): boolean;
|
|
78
78
|
perPage(): number;
|
|
@@ -84,33 +84,33 @@ declare class Paginator<T extends Model, K extends IPaginatorParams = IPaginator
|
|
|
84
84
|
}
|
|
85
85
|
//#endregion
|
|
86
86
|
//#region src/scope.d.ts
|
|
87
|
-
declare class Scope<M extends Model = Model> implements IScope {
|
|
87
|
+
declare class Scope<M extends Model$1 = Model$1> implements IScope {
|
|
88
88
|
constructor();
|
|
89
89
|
apply(_builder: Builder<M>, _model: M): void;
|
|
90
90
|
}
|
|
91
91
|
//#endregion
|
|
92
92
|
//#region src/builder.d.ts
|
|
93
93
|
declare const Inference$1: {
|
|
94
|
-
new <M extends Model | Model$
|
|
94
|
+
new <M extends Model$1 | Model$2 = Model$1, R$1 = IModel | ICollection<M>>(): IBuilder<M, R$1>;
|
|
95
95
|
};
|
|
96
|
-
declare class Builder<M extends Model = Model, R = IModel | ICollection<M>> extends Inference$1 {
|
|
97
|
-
query: IBuilder<M, R>;
|
|
96
|
+
declare class Builder<M extends Model$1 = Model$1, R$1 = IModel | ICollection<M>> extends Inference$1 {
|
|
97
|
+
query: IBuilder<M, R$1>;
|
|
98
98
|
connection: any;
|
|
99
99
|
model: M;
|
|
100
100
|
actions: any[];
|
|
101
|
-
localMacros: TGeneric<(...args: any[]) => any, keyof Omit<IBuilder<M, R>, number>>;
|
|
101
|
+
localMacros: TGeneric<(...args: any[]) => any, keyof Omit<IBuilder<M, R$1>, number>>;
|
|
102
102
|
eagerLoad: TGeneric<(...args: any[]) => any>;
|
|
103
|
-
globalScopes: TGeneric<Scope<M> | ((arg: Builder<M, R>) => Builder<M, R>)>;
|
|
104
|
-
onDeleteCallback?: (builder: Builder<M, R>) => Promise<boolean | number>;
|
|
105
|
-
constructor(query: IBuilder<M, R>);
|
|
106
|
-
asProxy(): Builder<M, R>;
|
|
103
|
+
globalScopes: TGeneric<Scope<M> | ((arg: Builder<M, R$1>) => Builder<M, R$1>)>;
|
|
104
|
+
onDeleteCallback?: (builder: Builder<M, R$1>) => Promise<boolean | number>;
|
|
105
|
+
constructor(query: IBuilder<M, R$1>);
|
|
106
|
+
asProxy(): Builder<M, R$1>;
|
|
107
107
|
orWhere(...args: any[]): this;
|
|
108
108
|
chunk<C extends TFunction>(count: number, callback: C): Promise<boolean>;
|
|
109
109
|
enforceOrderBy(this: any): void;
|
|
110
110
|
clone(this: any): any;
|
|
111
111
|
forPage(this: any, page: number, perPage?: number): any;
|
|
112
112
|
insert(...args: Parameters<typeof this.query.insert>): Promise<any>;
|
|
113
|
-
update<T extends TGeneric>(values: T): Promise<any>;
|
|
113
|
+
update<T$1 extends TGeneric>(values: T$1): Promise<any>;
|
|
114
114
|
increment(column: string, amount?: number, extra?: {}): Promise<any>;
|
|
115
115
|
decrement(column: string, amount?: number, extra?: {}): Promise<any>;
|
|
116
116
|
addUpdatedAtColumn(values: TGeneric<string>): TGeneric<string>;
|
|
@@ -119,9 +119,9 @@ declare class Builder<M extends Model = Model, R = IModel | ICollection<M>> exte
|
|
|
119
119
|
forceDelete(): Promise<number | boolean>;
|
|
120
120
|
create(attributes?: {}): Promise<any>;
|
|
121
121
|
newModelInstance(attributes?: {}): any;
|
|
122
|
-
getQuery(): IBuilder<M, R>;
|
|
122
|
+
getQuery(): IBuilder<M, R$1>;
|
|
123
123
|
getModel(): M;
|
|
124
|
-
setModel<MO extends Model>(model: MO): this;
|
|
124
|
+
setModel<MO extends Model$1>(model: MO): this;
|
|
125
125
|
qualifyColumn(column: string): string;
|
|
126
126
|
setTable(table: string): this;
|
|
127
127
|
applyScopes(): this;
|
|
@@ -184,15 +184,15 @@ declare class Builder<M extends Model = Model, R = IModel | ICollection<M>> exte
|
|
|
184
184
|
findMany(this: any, ids: string[] | number[] | ICollection<any>, columns?: string[]): Promise<any>;
|
|
185
185
|
pluck(column: string): Promise<any>;
|
|
186
186
|
destroy(this: any, ids?: string | number | string[] | number[] | TFunction | Collection$1<M>): Promise<number>;
|
|
187
|
-
get<M extends Model>(columns?: string | string[]): Promise<Collection$1<M>>;
|
|
187
|
+
get<M extends Model$1>(columns?: string | string[]): Promise<Collection$1<M>>;
|
|
188
188
|
all(columns?: string[]): Promise<any>;
|
|
189
189
|
paginate(this: any, page?: number, perPage?: number): Promise<Paginator<any, IPaginatorParams>>;
|
|
190
190
|
getModels(...columns: any[]): Promise<any[]>;
|
|
191
191
|
getRelation(name: string): any;
|
|
192
192
|
relationsNestedUnder(relation: string): TGeneric;
|
|
193
193
|
isNestedUnder(relation: string, name: string): boolean;
|
|
194
|
-
eagerLoadRelation<M extends Model>(models: M[], name: string, constraints: any): Promise<any>;
|
|
195
|
-
eagerLoadRelations<M extends Model>(models: M[]): Promise<M[]>;
|
|
194
|
+
eagerLoadRelation<M extends Model$1>(models: M[], name: string, constraints: any): Promise<any>;
|
|
195
|
+
eagerLoadRelations<M extends Model$1>(models: M[]): Promise<M[]>;
|
|
196
196
|
hydrate(items: any[] | ICollection<any>): Collection$1<any>;
|
|
197
197
|
}
|
|
198
198
|
//#endregion
|
|
@@ -228,21 +228,21 @@ declare class Relation$1 {
|
|
|
228
228
|
}
|
|
229
229
|
//#endregion
|
|
230
230
|
//#region src/arquebus.d.ts
|
|
231
|
-
declare class arquebus<M extends Model = Model> {
|
|
231
|
+
declare class arquebus<M extends Model$1 = Model$1> {
|
|
232
232
|
static connectorFactory: typeof Knex$1 | null;
|
|
233
233
|
static instance: arquebus | null;
|
|
234
234
|
manager: Record<string, QueryBuilder<M>>;
|
|
235
235
|
connections: Record<string, TConfig>;
|
|
236
|
-
models: Record<string, typeof Model>;
|
|
236
|
+
models: Record<string, typeof Model$1>;
|
|
237
237
|
constructor();
|
|
238
|
-
getConstructor<T extends typeof arquebus>(this: InstanceType<T>): T;
|
|
239
|
-
static getInstance(): arquebus<Model>;
|
|
238
|
+
getConstructor<T$1 extends typeof arquebus>(this: InstanceType<T$1>): T$1;
|
|
239
|
+
static getInstance(): arquebus<Model$1>;
|
|
240
240
|
/**
|
|
241
241
|
* Initialize a new database connection
|
|
242
242
|
*
|
|
243
243
|
* @returns
|
|
244
244
|
*/
|
|
245
|
-
static fire<C extends TBaseConfig['client']>(connection?: C | null): QueryBuilder<Model>;
|
|
245
|
+
static fire<C extends TBaseConfig['client']>(connection?: C | null): QueryBuilder<Model$1>;
|
|
246
246
|
/**
|
|
247
247
|
* Initialize a new database connection
|
|
248
248
|
*
|
|
@@ -253,16 +253,16 @@ declare class arquebus<M extends Model = Model> {
|
|
|
253
253
|
*
|
|
254
254
|
* @returns
|
|
255
255
|
*/
|
|
256
|
-
static connection<C extends TBaseConfig['client']>(connection?: C | null): QueryBuilder<Model, Model | Model[]>;
|
|
256
|
+
static connection<C extends TBaseConfig['client']>(connection?: C | null): QueryBuilder<Model$1, Model$1 | Model$1[]>;
|
|
257
257
|
static setConnectorFactory(connectorFactory: typeof Knex$1): void;
|
|
258
258
|
static getConnectorFactory(): typeof Knex$1;
|
|
259
259
|
static addConnection(config: TConfig | TBaseConfig, name?: string): void;
|
|
260
260
|
static beginTransaction(connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]>>;
|
|
261
|
-
static transaction<A, R>(callback: TFunction<A[], R>, connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]>> | undefined;
|
|
262
|
-
static table(name: string, connection?: null): IQueryBuilder<Model, Model | Model[]>;
|
|
261
|
+
static transaction<A, R$1>(callback: TFunction<A[], R$1>, connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]>> | undefined;
|
|
262
|
+
static table(name: string, connection?: null): IQueryBuilder<Model$1, Model$1 | Model$1[]>;
|
|
263
263
|
static schema(connection?: null): SchemaBuilder;
|
|
264
264
|
static destroyAll(): Promise<void>;
|
|
265
|
-
static createModel<X extends TGeneric>(name: string, options: X): typeof Model;
|
|
265
|
+
static createModel<X extends TGeneric>(name: string, options: X): typeof Model$1;
|
|
266
266
|
connection(connection?: string | null): QueryBuilder<M, M | M[]>;
|
|
267
267
|
getConnection(name?: string | null): QueryBuilder<M, M | M[]>;
|
|
268
268
|
addConnection(config: TConfig | TBaseConfig, name?: string): void;
|
|
@@ -282,7 +282,7 @@ declare class arquebus<M extends Model = Model> {
|
|
|
282
282
|
table(name: string, connection?: null): IQueryBuilder<M, M | M[]>;
|
|
283
283
|
schema(connection?: null): SchemaBuilder;
|
|
284
284
|
destroyAll(): Promise<void>;
|
|
285
|
-
createModel(name: string, options?: ModelOptions): typeof Model;
|
|
285
|
+
createModel(name: string, options?: ModelOptions): typeof Model$1;
|
|
286
286
|
}
|
|
287
287
|
//#endregion
|
|
288
288
|
//#region types/container.d.ts
|
|
@@ -331,7 +331,7 @@ type TConfig = TBaseConfig & ({
|
|
|
331
331
|
connection: Knex.MariaSqlConnectionConfig;
|
|
332
332
|
useNullAsDefault?: boolean;
|
|
333
333
|
});
|
|
334
|
-
interface ModelOptions<M extends Model = Model> {
|
|
334
|
+
interface ModelOptions<M extends Model$1 = Model$1> {
|
|
335
335
|
table?: string;
|
|
336
336
|
scopes?: TGeneric<(...args: any[]) => Builder<M>>;
|
|
337
337
|
plugins?: (<X extends MixinConstructor<M>>(Model: X) => MixinConstructor<M>)[];
|
|
@@ -345,8 +345,8 @@ interface ModelOptions<M extends Model = Model> {
|
|
|
345
345
|
primaryKey?: string;
|
|
346
346
|
incrementing?: boolean;
|
|
347
347
|
keyType?: 'int' | 'string';
|
|
348
|
-
with?: Model['with'];
|
|
349
|
-
casts?: Model['casts'];
|
|
348
|
+
with?: Model$1['with'];
|
|
349
|
+
casts?: Model$1['casts'];
|
|
350
350
|
}
|
|
351
351
|
interface TField {
|
|
352
352
|
type: 'VAR_STRING' | 'BLOB' | 'DATETIME' | 'TIMESTAMP' | 'LONG' | 'JSON';
|
|
@@ -370,25 +370,25 @@ interface Attribute {
|
|
|
370
370
|
withCaching?: boolean;
|
|
371
371
|
withObjectCaching?: boolean;
|
|
372
372
|
}
|
|
373
|
-
type Relation<M extends Model> = IBuilder<M, any> & {};
|
|
374
|
-
interface HasOneOrMany<M extends Model> extends Relation<M> {
|
|
373
|
+
type Relation<M extends Model$1> = IBuilder<M, any> & {};
|
|
374
|
+
interface HasOneOrMany<M extends Model$1> extends Relation<M> {
|
|
375
375
|
save(model: M): Promise<M>;
|
|
376
376
|
saveMany(models: M[] | ICollection<M>): Promise<ICollection<M>>;
|
|
377
377
|
create(attributes?: any): Promise<M>;
|
|
378
378
|
createMany(records: any[]): Promise<ICollection<M>>;
|
|
379
379
|
}
|
|
380
|
-
interface HasOne<M extends Model> extends HasOneOrMany<M> {
|
|
380
|
+
interface HasOne<M extends Model$1> extends HasOneOrMany<M> {
|
|
381
381
|
getResults(): Promise<M | null>;
|
|
382
382
|
withDefault(callback?: TFunction | object): this;
|
|
383
383
|
}
|
|
384
|
-
interface HasMany<M extends Model> extends HasOneOrMany<M> {
|
|
384
|
+
interface HasMany<M extends Model$1> extends HasOneOrMany<M> {
|
|
385
385
|
getResults(): Promise<ICollection<M>>;
|
|
386
386
|
}
|
|
387
|
-
interface BelongsTo<M extends Model> extends Relation<M> {
|
|
387
|
+
interface BelongsTo<M extends Model$1> extends Relation<M> {
|
|
388
388
|
getResults(): Promise<M | null>;
|
|
389
389
|
withDefault(callback?: TFunction | object): this;
|
|
390
390
|
}
|
|
391
|
-
interface BelongsToMany<M extends Model> extends Relation<M> {
|
|
391
|
+
interface BelongsToMany<M extends Model$1> extends Relation<M> {
|
|
392
392
|
getResults(): Promise<ICollection<M>>;
|
|
393
393
|
withTimestamps(): this;
|
|
394
394
|
wherePivot(column: any, operator?: any, value?: any, boolean?: string, ...args: any[]): this;
|
|
@@ -414,20 +414,20 @@ interface IModel {
|
|
|
414
414
|
exists: boolean;
|
|
415
415
|
connection?: TBaseConfig['client'] | null;
|
|
416
416
|
perPage: number;
|
|
417
|
-
with: string | string[] | TGeneric<(...args: any[]) => IBuilder<Model>>;
|
|
417
|
+
with: string | string[] | TGeneric<(...args: any[]) => IBuilder<Model$1>>;
|
|
418
418
|
trx: AnyQueryBuilder | null;
|
|
419
419
|
timestamps: boolean;
|
|
420
420
|
dateFormat: string;
|
|
421
421
|
visible: string[];
|
|
422
422
|
hidden: string[];
|
|
423
|
-
query<T extends {
|
|
423
|
+
query<T$1 extends {
|
|
424
424
|
prototype: unknown;
|
|
425
|
-
}>(this: T, client?: AnyQueryBuilder | null): IBuilder<Model>;
|
|
426
|
-
on<T extends {
|
|
425
|
+
}>(this: T$1, client?: AnyQueryBuilder | null): IBuilder<Model$1>;
|
|
426
|
+
on<T$1 extends {
|
|
427
427
|
prototype: unknown;
|
|
428
|
-
}>(this: T, connection: string | null): IBuilder<Model>;
|
|
428
|
+
}>(this: T$1, connection: string | null): IBuilder<Model$1>;
|
|
429
429
|
boot(): void;
|
|
430
|
-
make<T extends IModel>(this: new () => T, attributes?: TGeneric): T;
|
|
430
|
+
make<T$1 extends IModel>(this: new () => T$1, attributes?: TGeneric): T$1;
|
|
431
431
|
addHook(hook: Hook, callback: TFunction): void;
|
|
432
432
|
creating(callback: TFunction): void;
|
|
433
433
|
created(callback: TFunction): void;
|
|
@@ -467,13 +467,13 @@ interface IModel {
|
|
|
467
467
|
fill(attributes: any): this;
|
|
468
468
|
setAppends(appends: string[]): this;
|
|
469
469
|
append(key: string | string[]): this;
|
|
470
|
-
getRelation<T extends Model>(relation: string): T | ICollection<T> | null | undefined;
|
|
471
|
-
setRelation<T extends Model>(relation: string, value: T | ICollection<T> | null): this;
|
|
470
|
+
getRelation<T$1 extends Model$1>(relation: string): T$1 | ICollection<T$1> | null | undefined;
|
|
471
|
+
setRelation<T$1 extends Model$1>(relation: string, value: T$1 | ICollection<T$1> | null): this;
|
|
472
472
|
unsetRelation(relation: string): this;
|
|
473
473
|
relationLoaded(relation: string): boolean;
|
|
474
474
|
makeVisible(attributes: string | string[]): this;
|
|
475
475
|
makeHidden(attributes: string | string[]): this;
|
|
476
|
-
newCollection(models?: any[]): ICollection<Model>;
|
|
476
|
+
newCollection(models?: any[]): ICollection<Model$1>;
|
|
477
477
|
load(relations: WithRelationType): Promise<this>;
|
|
478
478
|
load(...relations: WithRelationType[]): Promise<this>;
|
|
479
479
|
loadAggregate(relations: WithRelationType, column: any, callback?: any): Promise<this>;
|
|
@@ -515,12 +515,12 @@ interface IModel {
|
|
|
515
515
|
push(): Promise<boolean>;
|
|
516
516
|
is(model: this): boolean;
|
|
517
517
|
isNot(model: this): boolean;
|
|
518
|
-
related<T extends RelationNames<this>>(relation: T): ReturnTypeOfMethod<this, `relation${Capitalize<SnakeToCamelCase<T>>}`>;
|
|
519
|
-
getRelated<T extends RelationNames<this>>(relation: T): ReturnTypeOfMethod<ReturnTypeOfMethod<this, `relation${Capitalize<SnakeToCamelCase<T>>}`>, any>;
|
|
520
|
-
hasOne<T extends Model>(model: new () => T, foreignKey?: string, localKey?: string): HasOne<T>;
|
|
521
|
-
hasMany<T extends Model>(model: new () => T, foreignKey?: string, localKey?: string): HasMany<T>;
|
|
522
|
-
belongsTo<T extends Model>(model: new () => T, foreignKey?: string, ownerKey?: string, relation?: string): BelongsTo<T>;
|
|
523
|
-
belongsToMany<T extends Model>(model: new () => T, table?: string, foreignPivotKey?: string, relatedPivotKey?: string, parentKey?: string, relatedKey?: string): BelongsToMany<T>;
|
|
518
|
+
related<T$1 extends RelationNames<this>>(relation: T$1): ReturnTypeOfMethod<this, `relation${Capitalize<SnakeToCamelCase<T$1>>}`>;
|
|
519
|
+
getRelated<T$1 extends RelationNames<this>>(relation: T$1): ReturnTypeOfMethod<ReturnTypeOfMethod<this, `relation${Capitalize<SnakeToCamelCase<T$1>>}`>, any>;
|
|
520
|
+
hasOne<T$1 extends Model$1>(model: new () => T$1, foreignKey?: string, localKey?: string): HasOne<T$1>;
|
|
521
|
+
hasMany<T$1 extends Model$1>(model: new () => T$1, foreignKey?: string, localKey?: string): HasMany<T$1>;
|
|
522
|
+
belongsTo<T$1 extends Model$1>(model: new () => T$1, foreignKey?: string, ownerKey?: string, relation?: string): BelongsTo<T$1>;
|
|
523
|
+
belongsToMany<T$1 extends Model$1>(model: new () => T$1, table?: string, foreignPivotKey?: string, relatedPivotKey?: string, parentKey?: string, relatedKey?: string): BelongsToMany<T$1>;
|
|
524
524
|
}
|
|
525
525
|
//#endregion
|
|
526
526
|
//#region src/model.d.ts
|
|
@@ -533,20 +533,20 @@ declare const BaseModel$1: (new (...args: any[]) => any) & {
|
|
|
533
533
|
exists: boolean;
|
|
534
534
|
connection?: (TBaseConfig["client"] | null) | undefined;
|
|
535
535
|
perPage: number;
|
|
536
|
-
with: string | string[] | TGeneric<(...args: any[]) => IBuilder<Model>>;
|
|
536
|
+
with: string | string[] | TGeneric<(...args: any[]) => IBuilder<Model$1>>;
|
|
537
537
|
trx: AnyQueryBuilder | null;
|
|
538
538
|
timestamps: boolean;
|
|
539
539
|
dateFormat: string;
|
|
540
540
|
visible: string[] & any[];
|
|
541
541
|
hidden: string[] & any[];
|
|
542
|
-
query: <T extends {
|
|
542
|
+
query: <T$1 extends {
|
|
543
543
|
prototype: unknown;
|
|
544
|
-
}>(this: T, client?: AnyQueryBuilder | null) => IBuilder<Model>;
|
|
545
|
-
on: <T extends {
|
|
544
|
+
}>(this: T$1, client?: AnyQueryBuilder | null) => IBuilder<Model$1>;
|
|
545
|
+
on: <T$1 extends {
|
|
546
546
|
prototype: unknown;
|
|
547
|
-
}>(this: T, connection: string | null) => IBuilder<Model>;
|
|
547
|
+
}>(this: T$1, connection: string | null) => IBuilder<Model$1>;
|
|
548
548
|
boot: () => void;
|
|
549
|
-
make: <T extends IModel>(this: new () => T, attributes?: TGeneric) => T;
|
|
549
|
+
make: <T$1 extends IModel>(this: new () => T$1, attributes?: TGeneric) => T$1;
|
|
550
550
|
addHook: (hook: Hook, callback: TFunction) => void;
|
|
551
551
|
creating: (callback: TFunction) => void;
|
|
552
552
|
created: (callback: TFunction) => void;
|
|
@@ -1391,8 +1391,8 @@ declare const BaseModel$1: (new (...args: any[]) => any) & {
|
|
|
1391
1391
|
uniqueIds(): never[];
|
|
1392
1392
|
setUniqueIds(): void;
|
|
1393
1393
|
});
|
|
1394
|
-
getRelation: <T extends Model>(relation: string) => T | ICollection<T> | null | undefined;
|
|
1395
|
-
setRelation: <T extends Model>(relation: string, value: T | ICollection<T> | null) => (new () => IModel) & IModel & {
|
|
1394
|
+
getRelation: <T$1 extends Model$1>(relation: string) => T$1 | ICollection<T$1> | null | undefined;
|
|
1395
|
+
setRelation: <T$1 extends Model$1>(relation: string, value: T$1 | ICollection<T$1> | null) => (new () => IModel) & IModel & {
|
|
1396
1396
|
[x: string]: any;
|
|
1397
1397
|
timestamps: boolean;
|
|
1398
1398
|
dateFormat: string;
|
|
@@ -1877,7 +1877,7 @@ declare const BaseModel$1: (new (...args: any[]) => any) & {
|
|
|
1877
1877
|
uniqueIds(): never[];
|
|
1878
1878
|
setUniqueIds(): void;
|
|
1879
1879
|
});
|
|
1880
|
-
newCollection: (models?: any[]) => ICollection<Model>;
|
|
1880
|
+
newCollection: (models?: any[]) => ICollection<Model$1>;
|
|
1881
1881
|
load: {
|
|
1882
1882
|
(relations: WithRelationType): Promise<(new () => IModel) & IModel & {
|
|
1883
1883
|
[x: string]: any;
|
|
@@ -3282,7 +3282,7 @@ declare const BaseModel$1: (new (...args: any[]) => any) & {
|
|
|
3282
3282
|
uniqueIds(): never[];
|
|
3283
3283
|
setUniqueIds(): void;
|
|
3284
3284
|
}) => boolean;
|
|
3285
|
-
related: <T extends never>(relation: T) => ReturnTypeOfMethod<(new () => IModel) & IModel & {
|
|
3285
|
+
related: <T$1 extends never>(relation: T$1) => ReturnTypeOfMethod<(new () => IModel) & IModel & {
|
|
3286
3286
|
[x: string]: any;
|
|
3287
3287
|
timestamps: boolean;
|
|
3288
3288
|
dateFormat: string;
|
|
@@ -3362,8 +3362,8 @@ declare const BaseModel$1: (new (...args: any[]) => any) & {
|
|
|
3362
3362
|
usesUniqueIds(): boolean;
|
|
3363
3363
|
uniqueIds(): never[];
|
|
3364
3364
|
setUniqueIds(): void;
|
|
3365
|
-
}, `relation${Capitalize<SnakeToCamelCase<T>>}`>;
|
|
3366
|
-
getRelated: <T extends never>(relation: T) => ReturnTypeOfMethod<ReturnTypeOfMethod<(new () => IModel) & IModel & {
|
|
3365
|
+
}, `relation${Capitalize<SnakeToCamelCase<T$1>>}`>;
|
|
3366
|
+
getRelated: <T$1 extends never>(relation: T$1) => ReturnTypeOfMethod<ReturnTypeOfMethod<(new () => IModel) & IModel & {
|
|
3367
3367
|
[x: string]: any;
|
|
3368
3368
|
timestamps: boolean;
|
|
3369
3369
|
dateFormat: string;
|
|
@@ -3443,11 +3443,11 @@ declare const BaseModel$1: (new (...args: any[]) => any) & {
|
|
|
3443
3443
|
usesUniqueIds(): boolean;
|
|
3444
3444
|
uniqueIds(): never[];
|
|
3445
3445
|
setUniqueIds(): void;
|
|
3446
|
-
}, `relation${Capitalize<SnakeToCamelCase<T>>}`>, any>;
|
|
3447
|
-
hasOne: <T extends Model>(model: new () => T, foreignKey?: string, localKey?: string) => HasOne<T>;
|
|
3448
|
-
hasMany: <T extends Model>(model: new () => T, foreignKey?: string, localKey?: string) => HasMany<T>;
|
|
3449
|
-
belongsTo: <T extends Model>(model: new () => T, foreignKey?: string, ownerKey?: string, relation?: string) => BelongsTo<T>;
|
|
3450
|
-
belongsToMany: <T extends Model>(model: new () => T, table?: string, foreignPivotKey?: string, relatedPivotKey?: string, parentKey?: string, relatedKey?: string) => BelongsToMany<T>;
|
|
3446
|
+
}, `relation${Capitalize<SnakeToCamelCase<T$1>>}`>, any>;
|
|
3447
|
+
hasOne: <T$1 extends Model$1>(model: new () => T$1, foreignKey?: string, localKey?: string) => HasOne<T$1>;
|
|
3448
|
+
hasMany: <T$1 extends Model$1>(model: new () => T$1, foreignKey?: string, localKey?: string) => HasMany<T$1>;
|
|
3449
|
+
belongsTo: <T$1 extends Model$1>(model: new () => T$1, foreignKey?: string, ownerKey?: string, relation?: string) => BelongsTo<T$1>;
|
|
3450
|
+
belongsToMany: <T$1 extends Model$1>(model: new () => T$1, table?: string, foreignPivotKey?: string, relatedPivotKey?: string, parentKey?: string, relatedKey?: string) => BelongsToMany<T$1>;
|
|
3451
3451
|
original: TGeneric;
|
|
3452
3452
|
casts: TGeneric<typeof CastsAttributes | "int" | "json" | "string" | "date" | "boolean" | "datetime" | "collection">;
|
|
3453
3453
|
changes: TGeneric;
|
|
@@ -3963,7 +3963,7 @@ declare const BaseModel$1: (new (...args: any[]) => any) & {
|
|
|
3963
3963
|
getGlobalScopes: () => {};
|
|
3964
3964
|
useUniqueIds: boolean;
|
|
3965
3965
|
};
|
|
3966
|
-
declare class Model extends BaseModel$1 {
|
|
3966
|
+
declare class Model$1 extends BaseModel$1 {
|
|
3967
3967
|
[key: string]: any;
|
|
3968
3968
|
protected builder: IBuilder<any, any> | null;
|
|
3969
3969
|
protected table: string | null;
|
|
@@ -3979,16 +3979,16 @@ declare class Model extends BaseModel$1 {
|
|
|
3979
3979
|
connection: TBaseConfig['client'] | null;
|
|
3980
3980
|
eagerLoad: {};
|
|
3981
3981
|
exists: boolean;
|
|
3982
|
-
with: string | string[] | TGeneric<(...args: any[]) => IBuilder<Model>>;
|
|
3982
|
+
with: string | string[] | TGeneric<(...args: any[]) => IBuilder<Model$1>>;
|
|
3983
3983
|
name: any;
|
|
3984
3984
|
trx: null;
|
|
3985
3985
|
constructor(attributes?: {});
|
|
3986
|
-
static query(trx?: null): Builder<Model, IModel | ICollection<Model>>;
|
|
3987
|
-
static on(connection?: TBaseConfig['client'] | null): Builder<Model, IModel | ICollection<Model>>;
|
|
3988
|
-
static init(attributes?: {}): Model;
|
|
3986
|
+
static query(trx?: null): Builder<Model$1, IModel | ICollection<Model$1>>;
|
|
3987
|
+
static on(connection?: TBaseConfig['client'] | null): Builder<Model$1, IModel | ICollection<Model$1>>;
|
|
3988
|
+
static init(attributes?: {}): Model$1;
|
|
3989
3989
|
static extend(plugin: TFunction, options: TGeneric): void;
|
|
3990
|
-
static make(attributes?: TGeneric): Model;
|
|
3991
|
-
getConstructor<T extends typeof Model>(this: InstanceType<T>): T;
|
|
3990
|
+
static make(attributes?: TGeneric): Model$1;
|
|
3991
|
+
getConstructor<T$1 extends typeof Model$1>(this: InstanceType<T$1>): T$1;
|
|
3992
3992
|
bootIfNotBooted(this: any): void;
|
|
3993
3993
|
static booting(): void;
|
|
3994
3994
|
static boot(): void;
|
|
@@ -4008,20 +4008,20 @@ declare class Model extends BaseModel$1 {
|
|
|
4008
4008
|
getConnection(this: any): any;
|
|
4009
4009
|
setConnection(connection: TBaseConfig['client'] | null): this;
|
|
4010
4010
|
getKeyType(): string;
|
|
4011
|
-
newQuery(trx?: null): Builder<Model, IModel | ICollection<Model>>;
|
|
4012
|
-
newQueryWithoutScopes(trx?: null): Builder<Model, IModel | ICollection<Model>>;
|
|
4013
|
-
newModelQuery(trx?: null): Builder<Model, IModel | ICollection<Model>>;
|
|
4014
|
-
addGlobalScopes(this: any, builder: Builder<Model>): Builder<Model, IModel | ICollection<Model>>;
|
|
4011
|
+
newQuery(trx?: null): Builder<Model$1, IModel | ICollection<Model$1>>;
|
|
4012
|
+
newQueryWithoutScopes(trx?: null): Builder<Model$1, IModel | ICollection<Model$1>>;
|
|
4013
|
+
newModelQuery(trx?: null): Builder<Model$1, IModel | ICollection<Model$1>>;
|
|
4014
|
+
addGlobalScopes(this: any, builder: Builder<Model$1>): Builder<Model$1, IModel | ICollection<Model$1>>;
|
|
4015
4015
|
hasNamedScope(name: string): boolean;
|
|
4016
4016
|
callNamedScope(scope: string, parameters: any[]): any;
|
|
4017
4017
|
setTable(table: string): this;
|
|
4018
|
-
newCollection(this: any, models?: never[]): Collection$1<Model>;
|
|
4019
|
-
load<R extends WithRelationType>(this: any, ...relations: R[]): Promise<any>;
|
|
4020
|
-
loadAggregate<R extends WithRelationType>(relations: R[], column: string, callback?: TFunction | string | null): Promise<this>;
|
|
4021
|
-
loadCount<R extends WithRelationType>(...relations: R[]): Promise<this>;
|
|
4022
|
-
loadMax<R extends WithRelationType>(relations: R[], column: string): Promise<this>;
|
|
4023
|
-
loadMin<R extends WithRelationType>(relations: R[], column: string): Promise<this>;
|
|
4024
|
-
loadSum<R extends WithRelationType>(relations: R[], column: string): Promise<this>;
|
|
4018
|
+
newCollection(this: any, models?: never[]): Collection$1<Model$1>;
|
|
4019
|
+
load<R$1 extends WithRelationType>(this: any, ...relations: R$1[]): Promise<any>;
|
|
4020
|
+
loadAggregate<R$1 extends WithRelationType>(relations: R$1[], column: string, callback?: TFunction | string | null): Promise<this>;
|
|
4021
|
+
loadCount<R$1 extends WithRelationType>(...relations: R$1[]): Promise<this>;
|
|
4022
|
+
loadMax<R$1 extends WithRelationType>(relations: R$1[], column: string): Promise<this>;
|
|
4023
|
+
loadMin<R$1 extends WithRelationType>(relations: R$1[], column: string): Promise<this>;
|
|
4024
|
+
loadSum<R$1 extends WithRelationType>(relations: R$1[], column: string): Promise<this>;
|
|
4025
4025
|
increment(column: string, amount?: number, extra?: TGeneric, options?: TGeneric): Promise<any>;
|
|
4026
4026
|
decrement(column: string, amount?: number, extra?: TGeneric, options?: TGeneric): Promise<any>;
|
|
4027
4027
|
incrementOrDecrement(column: string, amount: number, extra: TGeneric, method: string, options: TGeneric): Promise<any>;
|
|
@@ -4050,46 +4050,46 @@ declare class Model extends BaseModel$1 {
|
|
|
4050
4050
|
forceDelete(options?: {}): Promise<boolean>;
|
|
4051
4051
|
fresh(this: any): any;
|
|
4052
4052
|
refresh(this: any): Promise<any>;
|
|
4053
|
-
newPivot<E extends Model>(parent: E, attributes: TGeneric, table: string, exists: boolean, using?: typeof Pivot$1 | null): Pivot$1;
|
|
4053
|
+
newPivot<E extends Model$1>(parent: E, attributes: TGeneric, table: string, exists: boolean, using?: typeof Pivot$1 | null): Pivot$1;
|
|
4054
4054
|
qualifyColumn(column: string): string;
|
|
4055
4055
|
getQualifiedKeyName(): string;
|
|
4056
4056
|
push(options?: {}): Promise<boolean>;
|
|
4057
4057
|
is(model: any): any;
|
|
4058
4058
|
isNot(model: any): boolean;
|
|
4059
4059
|
}
|
|
4060
|
-
declare class Pivot$1 extends Model {
|
|
4060
|
+
declare class Pivot$1 extends Model$1 {
|
|
4061
4061
|
incrementing: boolean;
|
|
4062
4062
|
guarded: never[];
|
|
4063
|
-
pivotParent: Model | null;
|
|
4063
|
+
pivotParent: Model$1 | null;
|
|
4064
4064
|
foreignKey: string | null;
|
|
4065
4065
|
relatedKey: string | null;
|
|
4066
4066
|
setPivotKeys(foreignKey: string, relatedKey: string): this;
|
|
4067
|
-
static fromRawAttributes<E extends Model>(parent: E, attributes: TGeneric, table: string, exists?: boolean): Pivot$1;
|
|
4068
|
-
static fromAttributes<E extends Model>(parent: E, attributes: TGeneric, table: string, exists?: boolean): Pivot$1;
|
|
4067
|
+
static fromRawAttributes<E extends Model$1>(parent: E, attributes: TGeneric, table: string, exists?: boolean): Pivot$1;
|
|
4068
|
+
static fromAttributes<E extends Model$1>(parent: E, attributes: TGeneric, table: string, exists?: boolean): Pivot$1;
|
|
4069
4069
|
hasTimestampAttributes(this: any, attributes?: TGeneric | null): boolean;
|
|
4070
4070
|
}
|
|
4071
4071
|
//#endregion
|
|
4072
4072
|
//#region types/generics.d.ts
|
|
4073
|
-
type TGeneric<V = any, K extends string = string> = Record<K, V>;
|
|
4073
|
+
type TGeneric<V = any, K$1 extends string = string> = Record<K$1, V>;
|
|
4074
4074
|
type Hook = 'creating' | 'created' | 'updating' | 'updated' | 'saving' | 'saved' | 'deleting' | 'deleted' | 'restoring' | 'restored' | 'trashed' | 'forceDeleted';
|
|
4075
4075
|
type TFunction<TArgs extends any[] = any[], TReturn = any> = (...args: TArgs) => TReturn;
|
|
4076
4076
|
type PrimitiveValue = string | number | boolean | Date | string[] | number[] | boolean[] | Date[] | null | Buffer;
|
|
4077
|
-
type ReturnTypeOfMethod<T, K extends keyof T> = T[K] extends ((...args: any[]) => infer R) ? R : never;
|
|
4077
|
+
type ReturnTypeOfMethod<T$1, K$1 extends keyof T$1> = T$1[K$1] extends ((...args: any[]) => infer R) ? R : never;
|
|
4078
4078
|
type SnakeToCamelCase<S extends string> = S extends `${infer T}_${infer U}` ? `${T}${Capitalize<SnakeToCamelCase<U>>}` : S;
|
|
4079
4079
|
type CamelToSnakeCase<S extends string> = S extends `${infer T}${infer U}` ? U extends Uncapitalize<U> ? `${Uncapitalize<T>}${CamelToSnakeCase<U>}` : `${Uncapitalize<T>}_${CamelToSnakeCase<U>}` : S;
|
|
4080
|
-
type FunctionPropertyNames<T> = { [K in keyof T]: T[K] extends ((...args: any[]) => any) ? K : never }[keyof T];
|
|
4081
|
-
type RelationNames<T> = FunctionPropertyNames<T> extends infer R ? R extends `relation${infer P}` ? P extends 'sToData' | 'loaded' ? never : CamelToSnakeCase<P> : never : never;
|
|
4082
|
-
type MixinConstructor<T = TGeneric> = new (...args: any[]) => T;
|
|
4080
|
+
type FunctionPropertyNames<T$1> = { [K in keyof T$1]: T$1[K] extends ((...args: any[]) => any) ? K : never }[keyof T$1];
|
|
4081
|
+
type RelationNames<T$1> = FunctionPropertyNames<T$1> extends infer R ? R extends `relation${infer P}` ? P extends 'sToData' | 'loaded' ? never : CamelToSnakeCase<P> : never : never;
|
|
4082
|
+
type MixinConstructor<T$1 = TGeneric> = new (...args: any[]) => T$1;
|
|
4083
4083
|
//#endregion
|
|
4084
4084
|
//#region src/browser/collection.d.ts
|
|
4085
|
-
declare class Collection$2<I extends Model$
|
|
4085
|
+
declare class Collection$2<I$1 extends Model$2> extends Collection<I$1> {
|
|
4086
4086
|
mapThen(callback: TFunction): Promise<any[]>;
|
|
4087
4087
|
modelKeys(): any[];
|
|
4088
|
-
contains<K, V>(key: keyof I | K | TFunction, value?: V): boolean;
|
|
4088
|
+
contains<K$1, V>(key: keyof I$1 | K$1 | TFunction, value?: V): boolean;
|
|
4089
4089
|
diff(items: ICollection<any> | any[]): any;
|
|
4090
4090
|
except(keys: any[]): any;
|
|
4091
|
-
intersect(items: I[]): any;
|
|
4092
|
-
unique(key?: TFunction | keyof I, _strict?: boolean): any;
|
|
4091
|
+
intersect(items: I$1[]): any;
|
|
4092
|
+
unique(key?: TFunction | keyof I$1, _strict?: boolean): any;
|
|
4093
4093
|
find(key: any, defaultValue?: null): any;
|
|
4094
4094
|
makeVisible(attributes: any): this;
|
|
4095
4095
|
makeHidden(attributes: any): this;
|
|
@@ -4100,21 +4100,21 @@ declare class Collection$2<I extends Model$1> extends Collection<I> {
|
|
|
4100
4100
|
[x: string]: any;
|
|
4101
4101
|
[x: number]: any;
|
|
4102
4102
|
[x: symbol]: any;
|
|
4103
|
-
} | I)[];
|
|
4103
|
+
} | I$1)[];
|
|
4104
4104
|
toJSON(): ({
|
|
4105
4105
|
[x: string]: any;
|
|
4106
4106
|
[x: number]: any;
|
|
4107
4107
|
[x: symbol]: any;
|
|
4108
|
-
} | I)[];
|
|
4108
|
+
} | I$1)[];
|
|
4109
4109
|
toJson(...args: any[]): string;
|
|
4110
|
-
[Symbol.iterator]: () => Iterator<I>;
|
|
4110
|
+
[Symbol.iterator]: () => Iterator<I$1>;
|
|
4111
4111
|
}
|
|
4112
4112
|
//#endregion
|
|
4113
4113
|
//#region src/browser/model.d.ts
|
|
4114
4114
|
declare const BaseModel: (new (...args: any[]) => any) & {
|
|
4115
4115
|
[x: string]: any;
|
|
4116
4116
|
};
|
|
4117
|
-
declare class Model$
|
|
4117
|
+
declare class Model$2 extends BaseModel {
|
|
4118
4118
|
protected primaryKey: string;
|
|
4119
4119
|
protected perPage: number;
|
|
4120
4120
|
static globalScopes: {};
|
|
@@ -4124,9 +4124,9 @@ declare class Model$1 extends BaseModel {
|
|
|
4124
4124
|
static browser: boolean;
|
|
4125
4125
|
connection: TBaseConfig['client'] | null;
|
|
4126
4126
|
constructor(attributes?: {});
|
|
4127
|
-
static init(attributes?: {}): Model$
|
|
4127
|
+
static init(attributes?: {}): Model$2;
|
|
4128
4128
|
static extend(plugin: TFunction, options: TGeneric): void;
|
|
4129
|
-
static make(attributes?: TGeneric): Model$
|
|
4129
|
+
static make(attributes?: TGeneric): Model$2;
|
|
4130
4130
|
bootIfNotBooted(this: any): void;
|
|
4131
4131
|
static booting(): void;
|
|
4132
4132
|
static boot(): void;
|
|
@@ -4165,55 +4165,55 @@ declare class Model$1 extends BaseModel {
|
|
|
4165
4165
|
fill(attributes: TGeneric): this;
|
|
4166
4166
|
transacting(trx: any): this;
|
|
4167
4167
|
trashed(): boolean;
|
|
4168
|
-
newPivot<E extends Model$
|
|
4168
|
+
newPivot<E extends Model$2>(parent: E, attributes: TGeneric, table: string, exists: boolean, using?: typeof Pivot | null): Pivot;
|
|
4169
4169
|
qualifyColumn(column: string): string;
|
|
4170
4170
|
getQualifiedKeyName(): string;
|
|
4171
4171
|
is(model: any): any;
|
|
4172
4172
|
isNot(model: any): boolean;
|
|
4173
4173
|
}
|
|
4174
|
-
declare class Pivot extends Model$
|
|
4174
|
+
declare class Pivot extends Model$2 {
|
|
4175
4175
|
incrementing: boolean;
|
|
4176
4176
|
guarded: never[];
|
|
4177
|
-
pivotParent: Model$
|
|
4177
|
+
pivotParent: Model$2 | null;
|
|
4178
4178
|
foreignKey: string | null;
|
|
4179
4179
|
relatedKey: string | null;
|
|
4180
4180
|
setPivotKeys(foreignKey: string, relatedKey: string): this;
|
|
4181
|
-
static fromRawAttributes<E extends Model$
|
|
4182
|
-
static fromAttributes<E extends Model$
|
|
4181
|
+
static fromRawAttributes<E extends Model$2>(parent: E, attributes: TGeneric, table: string, exists?: boolean): Pivot;
|
|
4182
|
+
static fromAttributes<E extends Model$2>(parent: E, attributes: TGeneric, table: string, exists?: boolean): Pivot;
|
|
4183
4183
|
hasTimestampAttributes(this: any, attributes?: TGeneric | null): boolean;
|
|
4184
4184
|
}
|
|
4185
4185
|
//#endregion
|
|
4186
4186
|
//#region types/utils.d.ts
|
|
4187
|
-
interface ICollection<T extends Model | Model$
|
|
4188
|
-
items?: T[];
|
|
4189
|
-
load(...relations: T[]): Promise<ICollection<T>>;
|
|
4190
|
-
loadAggregate(relations: T | T[], column: string, action?: string | null): Promise<this>;
|
|
4191
|
-
loadCount(relation: T, column: string): Promise<this>;
|
|
4192
|
-
loadMax(relation: T, column: string): Promise<this>;
|
|
4193
|
-
loadMin(relation: T, column: string): Promise<this>;
|
|
4194
|
-
loadSum(relation: T, column: string): Promise<this>;
|
|
4195
|
-
loadAvg(relation: T, column: string): Promise<this>;
|
|
4187
|
+
interface ICollection<T$1 extends Model$1 | Model$2> extends Collection<T$1> {
|
|
4188
|
+
items?: T$1[];
|
|
4189
|
+
load(...relations: T$1[]): Promise<ICollection<T$1>>;
|
|
4190
|
+
loadAggregate(relations: T$1 | T$1[], column: string, action?: string | null): Promise<this>;
|
|
4191
|
+
loadCount(relation: T$1, column: string): Promise<this>;
|
|
4192
|
+
loadMax(relation: T$1, column: string): Promise<this>;
|
|
4193
|
+
loadMin(relation: T$1, column: string): Promise<this>;
|
|
4194
|
+
loadSum(relation: T$1, column: string): Promise<this>;
|
|
4195
|
+
loadAvg(relation: T$1, column: string): Promise<this>;
|
|
4196
4196
|
mapThen(callback: () => void): Promise<any>;
|
|
4197
4197
|
modelKeys(): string[] | number[];
|
|
4198
4198
|
contains(key: IModel | any, operator?: any, value?: any): boolean;
|
|
4199
|
-
diff(items: ICollection<T> | any[]): ICollection<T>;
|
|
4200
|
-
except(keys: any[]): ICollection<T>;
|
|
4201
|
-
intersect(items: T[]): ICollection<T>;
|
|
4202
|
-
unique(key?: any, strict?: boolean): ICollection<T>;
|
|
4199
|
+
diff(items: ICollection<T$1> | any[]): ICollection<T$1>;
|
|
4200
|
+
except(keys: any[]): ICollection<T$1>;
|
|
4201
|
+
intersect(items: T$1[]): ICollection<T$1>;
|
|
4202
|
+
unique(key?: any, strict?: boolean): ICollection<T$1>;
|
|
4203
4203
|
find(key: any, defaultValue?: any): any;
|
|
4204
|
-
fresh(withs?: any[]): Promise<ICollection<T>>;
|
|
4204
|
+
fresh(withs?: any[]): Promise<ICollection<T$1>>;
|
|
4205
4205
|
makeVisible(attributes: string | string[]): this;
|
|
4206
4206
|
makeHidden(attributes: string | string[]): this;
|
|
4207
4207
|
append(attributes: string[]): this;
|
|
4208
4208
|
only(keys: null | any[]): this;
|
|
4209
4209
|
getDictionary(items?: any[]): TGeneric;
|
|
4210
|
-
toQuery(): IBuilder<T, any>;
|
|
4210
|
+
toQuery(): IBuilder<T$1, any>;
|
|
4211
4211
|
toData(): any;
|
|
4212
4212
|
toJSON(): any;
|
|
4213
4213
|
toJson(): string;
|
|
4214
4214
|
toString(): string;
|
|
4215
4215
|
[key: string]: any;
|
|
4216
|
-
[Symbol.iterator]: () => Iterator<T>;
|
|
4216
|
+
[Symbol.iterator]: () => Iterator<T$1>;
|
|
4217
4217
|
}
|
|
4218
4218
|
interface IPaginatorParams {
|
|
4219
4219
|
current_page: number;
|
|
@@ -4224,47 +4224,47 @@ interface IPaginatorParams {
|
|
|
4224
4224
|
count: number;
|
|
4225
4225
|
paginated?: boolean;
|
|
4226
4226
|
}
|
|
4227
|
-
interface IPaginator<T extends Model | Model$
|
|
4227
|
+
interface IPaginator<T$1 extends Model$1 | Model$2, K$1 extends IPaginatorParams = IPaginatorParams> {
|
|
4228
4228
|
formatter?(paginator: IPaginator<any>): any | null;
|
|
4229
4229
|
setFormatter?(formatter: (paginator: IPaginator<any>) => any | null): void;
|
|
4230
|
-
setItems(items: T[] | Collection$1<T>): void;
|
|
4230
|
+
setItems(items: T$1[] | Collection$1<T$1>): void;
|
|
4231
4231
|
hasMorePages(): boolean;
|
|
4232
|
-
get(index: number): T | null;
|
|
4232
|
+
get(index: number): T$1 | null;
|
|
4233
4233
|
count(): number;
|
|
4234
|
-
items(): Collection$1<T>;
|
|
4235
|
-
map(callback: (value: T, index: number) => T): Collection$1<T>;
|
|
4234
|
+
items(): Collection$1<T$1>;
|
|
4235
|
+
map(callback: (value: T$1, index: number) => T$1): Collection$1<T$1>;
|
|
4236
4236
|
currentPage(): number;
|
|
4237
4237
|
perPage(): number;
|
|
4238
4238
|
lastPage(): number;
|
|
4239
4239
|
firstItem(): number | null;
|
|
4240
4240
|
lastItem(): number | null;
|
|
4241
4241
|
total(): number;
|
|
4242
|
-
toData<U = K>(): U;
|
|
4243
|
-
toJSON<U = K>(): U;
|
|
4242
|
+
toData<U$1 = K$1>(): U$1;
|
|
4243
|
+
toJSON<U$1 = K$1>(): U$1;
|
|
4244
4244
|
toJson(): string;
|
|
4245
4245
|
[Symbol.iterator]?(): {
|
|
4246
4246
|
next: () => {
|
|
4247
|
-
value: T;
|
|
4247
|
+
value: T$1;
|
|
4248
4248
|
done: boolean;
|
|
4249
4249
|
};
|
|
4250
4250
|
};
|
|
4251
4251
|
}
|
|
4252
4252
|
//#endregion
|
|
4253
4253
|
//#region types/builder.d.ts
|
|
4254
|
-
type BaseBuilder<M extends Model | Model$
|
|
4254
|
+
type BaseBuilder<M extends Model$1 | Model$2, R$1 = ICollection<M> | IModel> = Omit<IQueryBuilder<M, R$1>, 'destroy' | 'clone' | 'get' | 'skip' | 'limit' | 'take' | 'offset' | 'chunk' | 'forPage' | 'orWhere' | 'pluck'>;
|
|
4255
4255
|
interface IScope {
|
|
4256
|
-
apply(builder: Builder<any>, model: Model): void;
|
|
4256
|
+
apply(builder: Builder<any>, model: Model$1): void;
|
|
4257
4257
|
}
|
|
4258
|
-
interface IBuilder<M extends Model | Model$
|
|
4259
|
-
connector: IQueryBuilder<M, R> & Knex.QueryBuilder & {
|
|
4258
|
+
interface IBuilder<M extends Model$1 | Model$2, R$1 = ICollection<M> | IModel> extends BaseBuilder<M, R$1> {
|
|
4259
|
+
connector: IQueryBuilder<M, R$1> & Knex.QueryBuilder & {
|
|
4260
4260
|
_statements: any[];
|
|
4261
4261
|
_single: any;
|
|
4262
4262
|
} & Knex;
|
|
4263
|
-
asProxy(): IQueryBuilder<M, R>;
|
|
4263
|
+
asProxy(): IQueryBuilder<M, R$1>;
|
|
4264
4264
|
chunk(count: number, callback: (rows: ICollection<M>) => any): Promise<boolean>;
|
|
4265
4265
|
enforceOrderBy(): void;
|
|
4266
4266
|
idOf(id: string | number): this;
|
|
4267
|
-
clone(): IBuilder<M, R>;
|
|
4267
|
+
clone(): IBuilder<M, R$1>;
|
|
4268
4268
|
forPage(page: number, perPage?: number): this;
|
|
4269
4269
|
insert(...attributes: any[]): Promise<any>;
|
|
4270
4270
|
update(attributes: any): Promise<any>;
|
|
@@ -4329,7 +4329,7 @@ interface IBuilder<M extends Model | Model$1, R = ICollection<M> | IModel> exten
|
|
|
4329
4329
|
oldest(column?: string): this;
|
|
4330
4330
|
find(key: string | number, columns?: string[]): Promise<M | null | undefined>;
|
|
4331
4331
|
findMany(keys: string[] | number[] | ICollection<any>, columns?: string[]): Promise<ICollection<M>>;
|
|
4332
|
-
pluck<X extends Model = any | M>(column: string): Promise<ICollection<X>>;
|
|
4332
|
+
pluck<X extends Model$1 = any | M>(column: string): Promise<ICollection<X>>;
|
|
4333
4333
|
destroy(ids?: string | number | string[] | number[] | TFunction | ICollection<any>): Promise<number>;
|
|
4334
4334
|
get(columns?: string[]): Promise<ICollection<M>>;
|
|
4335
4335
|
all(columns?: string[]): Promise<ICollection<M>>;
|
|
@@ -4344,8 +4344,8 @@ type FieldExpression = string;
|
|
|
4344
4344
|
type TableRef<QB extends AnyQueryBuilder> = ColumnRef | AnyQueryBuilder | CallbackVoid<QB>;
|
|
4345
4345
|
type Selection<QB extends AnyQueryBuilder> = ColumnRef | AnyQueryBuilder | CallbackVoid<QB>;
|
|
4346
4346
|
type QBOrCallback<QB extends AnyQueryBuilder> = AnyQueryBuilder | CallbackVoid<QB>;
|
|
4347
|
-
interface CallbackVoid<T> {
|
|
4348
|
-
(this: T, arg: T): void;
|
|
4347
|
+
interface CallbackVoid<T$1> {
|
|
4348
|
+
(this: T$1, arg: T$1): void;
|
|
4349
4349
|
}
|
|
4350
4350
|
type Raw = Knex.Raw;
|
|
4351
4351
|
type OrderByDirection = 'asc' | 'desc' | 'ASC' | 'DESC';
|
|
@@ -4353,11 +4353,11 @@ interface OrderByDescriptor {
|
|
|
4353
4353
|
column: ColumnRef;
|
|
4354
4354
|
order?: OrderByDirection;
|
|
4355
4355
|
}
|
|
4356
|
-
type AnyQueryBuilder<M extends Model = any, R = any> = IQueryBuilder<M, R> | IBuilder<M, R>;
|
|
4357
|
-
type Expression<T> = T | Raw | AnyQueryBuilder;
|
|
4356
|
+
type AnyQueryBuilder<M extends Model$1 = any, R$1 = any> = IQueryBuilder<M, R$1> | IBuilder<M, R$1>;
|
|
4357
|
+
type Expression<T$1> = T$1 | Raw | AnyQueryBuilder;
|
|
4358
4358
|
type ColumnRefOrOrderByDescriptor = ColumnRef | OrderByDescriptor;
|
|
4359
|
-
interface RawInterface<R> {
|
|
4360
|
-
(sql: string, ...bindings: any[]): R;
|
|
4359
|
+
interface RawInterface<R$1> {
|
|
4360
|
+
(sql: string, ...bindings: any[]): R$1;
|
|
4361
4361
|
}
|
|
4362
4362
|
interface BaseSetOperations<QB extends AnyQueryBuilder> {
|
|
4363
4363
|
(callbackOrBuilder: QBOrCallback<QB>, wrap?: boolean): QB;
|
|
@@ -4371,7 +4371,7 @@ interface GroupByMethod<QB extends AnyQueryBuilder> {
|
|
|
4371
4371
|
(columns: ColumnRef[]): QB;
|
|
4372
4372
|
}
|
|
4373
4373
|
type WithRelationType = {
|
|
4374
|
-
[key: string]: <T extends IBuilder<any>>(builder: T) => T | void;
|
|
4374
|
+
[key: string]: <T$1 extends IBuilder<any>>(builder: T$1) => T$1 | void;
|
|
4375
4375
|
} | string | string[];
|
|
4376
4376
|
interface SetOperationsMethod<QB extends AnyQueryBuilder> extends BaseSetOperations<QB> {
|
|
4377
4377
|
(...callbacksOrBuilders: QBOrCallback<QB>[]): QB;
|
|
@@ -4562,11 +4562,11 @@ interface IStatement {
|
|
|
4562
4562
|
nulls: boolean;
|
|
4563
4563
|
bool: 'and' | 'or' | 'not';
|
|
4564
4564
|
}
|
|
4565
|
-
interface IQueryBuilder<M extends Model | Model$
|
|
4566
|
-
query: IBuilder<M, R>;
|
|
4565
|
+
interface IQueryBuilder<M extends Model$1 | Model$2 = Model$1, R$1 = M[] | M> {
|
|
4566
|
+
query: IBuilder<M, R$1>;
|
|
4567
4567
|
schema: SchemaBuilder;
|
|
4568
4568
|
_statements: IStatement[];
|
|
4569
|
-
table(name: string): IQueryBuilder<M, R>;
|
|
4569
|
+
table(name: string): IQueryBuilder<M, R$1>;
|
|
4570
4570
|
select: SelectMethod<this>;
|
|
4571
4571
|
addSelect: AddSelectMethod<this>;
|
|
4572
4572
|
columns: SelectMethod<this>;
|
|
@@ -4575,7 +4575,7 @@ interface IQueryBuilder<M extends Model | Model$1 = Model, R = M[] | M> {
|
|
|
4575
4575
|
returning: ReturningMethod<this>;
|
|
4576
4576
|
distinctOn: SelectMethod<this>;
|
|
4577
4577
|
as: AsMethod<this>;
|
|
4578
|
-
asProxy(): IQueryBuilder<M, R>;
|
|
4578
|
+
asProxy(): IQueryBuilder<M, R$1>;
|
|
4579
4579
|
where: WhereMethod<this>;
|
|
4580
4580
|
firstOrFail: FirstOrFailMethod<this>;
|
|
4581
4581
|
forceDelete: ForceDeleteMethod;
|
|
@@ -4667,7 +4667,7 @@ interface IQueryBuilder<M extends Model | Model$1 = Model, R = M[] | M> {
|
|
|
4667
4667
|
transaction(callback?: TFunction): Promise<Knex.Transaction> | undefined;
|
|
4668
4668
|
destroy(callback: TFunction): Promise<number>;
|
|
4669
4669
|
destroy(): Promise<number>;
|
|
4670
|
-
clone(): IQueryBuilder<M, R>;
|
|
4670
|
+
clone(): IQueryBuilder<M, R$1>;
|
|
4671
4671
|
raw: Knex.RawQueryBuilder<TGeneric, M>;
|
|
4672
4672
|
get(columns?: string[]): Promise<any>;
|
|
4673
4673
|
first(columns?: string[]): Promise<M | null | undefined>;
|
|
@@ -4685,7 +4685,7 @@ interface IQueryBuilder<M extends Model | Model$1 = Model, R = M[] | M> {
|
|
|
4685
4685
|
take(count: number): this;
|
|
4686
4686
|
limit(count: number): this;
|
|
4687
4687
|
offset(count: number): this;
|
|
4688
|
-
pluck<X extends Model = any>(column: string): Promise<Array<X>>;
|
|
4688
|
+
pluck<X extends Model$1 = any>(column: string): Promise<Array<X>>;
|
|
4689
4689
|
chunk(count: number, callback: (rows: M[]) => any): Promise<boolean>;
|
|
4690
4690
|
forPage(page: number, perPage?: number): this;
|
|
4691
4691
|
paginate<F extends IPaginatorParams>(page?: number, perPage?: number): Promise<IPaginator<M, F>>;
|
|
@@ -4693,19 +4693,19 @@ interface IQueryBuilder<M extends Model | Model$1 = Model, R = M[] | M> {
|
|
|
4693
4693
|
//#endregion
|
|
4694
4694
|
//#region src/query-builder.d.ts
|
|
4695
4695
|
declare const Inference: {
|
|
4696
|
-
new <M extends Model = Model, R = M[] | M>(): IQueryBuilder<M, R>;
|
|
4696
|
+
new <M extends Model$1 = Model$1, R$1 = M[] | M>(): IQueryBuilder<M, R$1>;
|
|
4697
4697
|
};
|
|
4698
|
-
declare class QueryBuilder<M extends Model = Model, R = M[] | M> extends Inference<M, R> {
|
|
4698
|
+
declare class QueryBuilder<M extends Model$1 = Model$1, R$1 = M[] | M> extends Inference<M, R$1> {
|
|
4699
4699
|
model: M;
|
|
4700
4700
|
schema: SchemaBuilder;
|
|
4701
|
-
connector: IQueryBuilder<M, R> & Knex.QueryBuilder & {
|
|
4701
|
+
connector: IQueryBuilder<M, R$1> & Knex.QueryBuilder & {
|
|
4702
4702
|
_statements: any[];
|
|
4703
4703
|
_single: any;
|
|
4704
4704
|
} & Knex;
|
|
4705
4705
|
constructor(config: TConfig | null, connector: TFunction);
|
|
4706
4706
|
asProxy(): any;
|
|
4707
4707
|
beginTransaction(): Promise<Knex.Transaction<any, any[]>>;
|
|
4708
|
-
table<X extends M>(table: string): IQueryBuilder<X, R>;
|
|
4708
|
+
table<X extends M>(table: string): IQueryBuilder<X, R$1>;
|
|
4709
4709
|
transaction(callback?: TFunction): Promise<Knex.Transaction> | undefined;
|
|
4710
4710
|
find(id: string | number, columns?: string[]): Promise<any>;
|
|
4711
4711
|
get(_columns?: string[]): Promise<any>;
|
|
@@ -4721,7 +4721,7 @@ declare class QueryBuilder<M extends Model = Model, R = M[] | M> extends Inferen
|
|
|
4721
4721
|
max(column: string): Promise<number>;
|
|
4722
4722
|
sum(column: string): Promise<number>;
|
|
4723
4723
|
avg(column: string): Promise<number>;
|
|
4724
|
-
clone(): IQueryBuilder<M, R>;
|
|
4724
|
+
clone(): IQueryBuilder<M, R$1>;
|
|
4725
4725
|
delete(): Promise<number | boolean>;
|
|
4726
4726
|
insert(...args: Parameters<typeof this.connector.insert>): Promise<unknown>;
|
|
4727
4727
|
update(...args: Parameters<typeof this.connector.update>): Promise<number>;
|