@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
|
@@ -7,33 +7,33 @@ import Knex$1, { Knex } from "knex";
|
|
|
7
7
|
//#endregion
|
|
8
8
|
//#region src/casts-attributes.d.ts
|
|
9
9
|
interface ICastsAttributes {
|
|
10
|
-
get?(model: Model, key: string, value: string, attributes: TGeneric): string | null | undefined;
|
|
11
|
-
set?(model: Model, key: string, value: string, attributes: TGeneric): string | null | undefined;
|
|
10
|
+
get?(model: Model$1, key: string, value: string, attributes: TGeneric): string | null | undefined;
|
|
11
|
+
set?(model: Model$1, key: string, value: string, attributes: TGeneric): string | null | undefined;
|
|
12
12
|
}
|
|
13
13
|
declare class CastsAttributes implements ICastsAttributes {
|
|
14
14
|
constructor();
|
|
15
|
-
static get(_model: Model, _key: string, _value: string, _attributes: TGeneric): string | null | undefined;
|
|
16
|
-
static set(_model: Model, _key: string, _value: string, _attributes: TGeneric): string | null | undefined;
|
|
15
|
+
static get(_model: Model$1, _key: string, _value: string, _attributes: TGeneric): string | null | undefined;
|
|
16
|
+
static set(_model: Model$1, _key: string, _value: string, _attributes: TGeneric): string | null | undefined;
|
|
17
17
|
}
|
|
18
18
|
//#endregion
|
|
19
19
|
//#region src/collection.d.ts
|
|
20
|
-
declare class Collection$1<I extends Model | Model$
|
|
20
|
+
declare class Collection$1<I$1 extends Model$1 | Model$2> extends Collection<I$1> implements ICollection<I$1> {
|
|
21
21
|
private newConstructor;
|
|
22
|
-
getConstructor<T extends typeof Collection$1<I>>(this: InstanceType<T>): T;
|
|
23
|
-
load(...relations: (string[] | I[] | string | I)[]): Promise<Collection$1<I>>;
|
|
24
|
-
loadAggregate<I>(relations: I, column: string, action?: string | null | TFunction): Promise<this>;
|
|
25
|
-
loadCount(relations: I): Promise<this>;
|
|
26
|
-
loadMax(relation: I, column: string): Promise<this>;
|
|
27
|
-
loadMin(relation: I, column: string): Promise<this>;
|
|
28
|
-
loadSum(relation: I, column: string): Promise<this>;
|
|
29
|
-
loadAvg(relation: I, column: string): Promise<this>;
|
|
22
|
+
getConstructor<T$1 extends typeof Collection$1<I$1>>(this: InstanceType<T$1>): T$1;
|
|
23
|
+
load(...relations: (string[] | I$1[] | string | I$1)[]): Promise<Collection$1<I$1>>;
|
|
24
|
+
loadAggregate<I$1>(relations: I$1, column: string, action?: string | null | TFunction): Promise<this>;
|
|
25
|
+
loadCount(relations: I$1): Promise<this>;
|
|
26
|
+
loadMax(relation: I$1, column: string): Promise<this>;
|
|
27
|
+
loadMin(relation: I$1, column: string): Promise<this>;
|
|
28
|
+
loadSum(relation: I$1, column: string): Promise<this>;
|
|
29
|
+
loadAvg(relation: I$1, column: string): Promise<this>;
|
|
30
30
|
mapThen(callback: () => void): Promise<void[]>;
|
|
31
31
|
modelKeys(): any[];
|
|
32
|
-
contains<K, V>(key: keyof I | K | TFunction, value?: V): boolean;
|
|
32
|
+
contains<K$1, V>(key: keyof I$1 | K$1 | TFunction, value?: V): boolean;
|
|
33
33
|
diff(items: ICollection<any> | any[]): any;
|
|
34
34
|
except(keys: any[]): any;
|
|
35
|
-
intersect(items: I[]): any;
|
|
36
|
-
unique(key?: TFunction | keyof I, _strict?: boolean): any;
|
|
35
|
+
intersect(items: I$1[]): any;
|
|
36
|
+
unique(key?: TFunction | keyof I$1, _strict?: boolean): any;
|
|
37
37
|
find(key: any, defaultValue?: null): any;
|
|
38
38
|
fresh(...args: any[]): Promise<any>;
|
|
39
39
|
makeVisible(attributes: any): this;
|
|
@@ -42,24 +42,24 @@ declare class Collection$1<I extends Model | Model$1> extends Collection<I> impl
|
|
|
42
42
|
only(keys: any[]): any;
|
|
43
43
|
getDictionary(items?: ICollection<any> | any[]): TGeneric;
|
|
44
44
|
toQuery(): any;
|
|
45
|
-
toData(): (I | {
|
|
45
|
+
toData(): (I$1 | {
|
|
46
46
|
[x: string]: any;
|
|
47
47
|
[x: number]: any;
|
|
48
48
|
[x: symbol]: any;
|
|
49
49
|
})[];
|
|
50
|
-
toJSON(): (I | {
|
|
50
|
+
toJSON(): (I$1 | {
|
|
51
51
|
[x: string]: any;
|
|
52
52
|
[x: number]: any;
|
|
53
53
|
[x: symbol]: any;
|
|
54
54
|
})[];
|
|
55
55
|
toJson(...args: any[]): string;
|
|
56
|
-
[Symbol.iterator]: () => Iterator<I>;
|
|
56
|
+
[Symbol.iterator]: () => Iterator<I$1>;
|
|
57
57
|
}
|
|
58
58
|
//#endregion
|
|
59
59
|
//#region src/paginator.d.ts
|
|
60
|
-
declare class Paginator<T extends Model, K extends IPaginatorParams = IPaginatorParams> implements IPaginator<T, K> {
|
|
60
|
+
declare class Paginator<T$1 extends Model$1, K$1 extends IPaginatorParams = IPaginatorParams> implements IPaginator<T$1, K$1> {
|
|
61
61
|
static formatter: (paginator: IPaginator<any>) => any | null;
|
|
62
|
-
_items: Collection$1<T>;
|
|
62
|
+
_items: Collection$1<T$1>;
|
|
63
63
|
_total: number;
|
|
64
64
|
_perPage: number;
|
|
65
65
|
_lastPage: number;
|
|
@@ -67,15 +67,15 @@ declare class Paginator<T extends Model, K extends IPaginatorParams = IPaginator
|
|
|
67
67
|
hasMore: boolean;
|
|
68
68
|
options: TGeneric;
|
|
69
69
|
static setFormatter(formatter?: ((paginator: IPaginator<any> | null) => any) | null): void;
|
|
70
|
-
constructor(items: T[], total: number, perPage: number, currentPage?: number, options?: TGeneric);
|
|
71
|
-
setItems(items: T[]): void;
|
|
70
|
+
constructor(items: T$1[], total: number, perPage: number, currentPage?: number, options?: TGeneric);
|
|
71
|
+
setItems(items: T$1[]): void;
|
|
72
72
|
firstItem(): number | null;
|
|
73
73
|
lastItem(): number | null;
|
|
74
74
|
hasMorePages(): boolean;
|
|
75
|
-
get(index: number): T | null;
|
|
75
|
+
get(index: number): T$1 | null;
|
|
76
76
|
count(): number;
|
|
77
|
-
items(): Collection$1<T>;
|
|
78
|
-
map(callback: (value: T, index: number) => T): Collection$1<T>;
|
|
77
|
+
items(): Collection$1<T$1>;
|
|
78
|
+
map(callback: (value: T$1, index: number) => T$1): Collection$1<T$1>;
|
|
79
79
|
currentPage(): number;
|
|
80
80
|
onFirstPage(): boolean;
|
|
81
81
|
perPage(): number;
|
|
@@ -87,33 +87,33 @@ declare class Paginator<T extends Model, K extends IPaginatorParams = IPaginator
|
|
|
87
87
|
}
|
|
88
88
|
//#endregion
|
|
89
89
|
//#region src/scope.d.ts
|
|
90
|
-
declare class Scope<M extends Model = Model> implements IScope {
|
|
90
|
+
declare class Scope<M extends Model$1 = Model$1> implements IScope {
|
|
91
91
|
constructor();
|
|
92
92
|
apply(_builder: Builder<M>, _model: M): void;
|
|
93
93
|
}
|
|
94
94
|
//#endregion
|
|
95
95
|
//#region src/builder.d.ts
|
|
96
96
|
declare const Inference$2: {
|
|
97
|
-
new <M extends Model | Model$
|
|
97
|
+
new <M extends Model$1 | Model$2 = Model$1, R$1 = IModel | ICollection<M>>(): IBuilder<M, R$1>;
|
|
98
98
|
};
|
|
99
|
-
declare class Builder<M extends Model = Model, R = IModel | ICollection<M>> extends Inference$2 {
|
|
100
|
-
query: IBuilder<M, R>;
|
|
99
|
+
declare class Builder<M extends Model$1 = Model$1, R$1 = IModel | ICollection<M>> extends Inference$2 {
|
|
100
|
+
query: IBuilder<M, R$1>;
|
|
101
101
|
connection: any;
|
|
102
102
|
model: M;
|
|
103
103
|
actions: any[];
|
|
104
|
-
localMacros: TGeneric<(...args: any[]) => any, keyof Omit<IBuilder<M, R>, number>>;
|
|
104
|
+
localMacros: TGeneric<(...args: any[]) => any, keyof Omit<IBuilder<M, R$1>, number>>;
|
|
105
105
|
eagerLoad: TGeneric<(...args: any[]) => any>;
|
|
106
|
-
globalScopes: TGeneric<Scope<M> | ((arg: Builder<M, R>) => Builder<M, R>)>;
|
|
107
|
-
onDeleteCallback?: (builder: Builder<M, R>) => Promise<boolean | number>;
|
|
108
|
-
constructor(query: IBuilder<M, R>);
|
|
109
|
-
asProxy(): Builder<M, R>;
|
|
106
|
+
globalScopes: TGeneric<Scope<M> | ((arg: Builder<M, R$1>) => Builder<M, R$1>)>;
|
|
107
|
+
onDeleteCallback?: (builder: Builder<M, R$1>) => Promise<boolean | number>;
|
|
108
|
+
constructor(query: IBuilder<M, R$1>);
|
|
109
|
+
asProxy(): Builder<M, R$1>;
|
|
110
110
|
orWhere(...args: any[]): this;
|
|
111
111
|
chunk<C extends TFunction>(count: number, callback: C): Promise<boolean>;
|
|
112
112
|
enforceOrderBy(this: any): void;
|
|
113
113
|
clone(this: any): any;
|
|
114
114
|
forPage(this: any, page: number, perPage?: number): any;
|
|
115
115
|
insert(...args: Parameters<typeof this.query.insert>): Promise<any>;
|
|
116
|
-
update<T extends TGeneric>(values: T): Promise<any>;
|
|
116
|
+
update<T$1 extends TGeneric>(values: T$1): Promise<any>;
|
|
117
117
|
increment(column: string, amount?: number, extra?: {}): Promise<any>;
|
|
118
118
|
decrement(column: string, amount?: number, extra?: {}): Promise<any>;
|
|
119
119
|
addUpdatedAtColumn(values: TGeneric<string>): TGeneric<string>;
|
|
@@ -122,9 +122,9 @@ declare class Builder<M extends Model = Model, R = IModel | ICollection<M>> exte
|
|
|
122
122
|
forceDelete(): Promise<number | boolean>;
|
|
123
123
|
create(attributes?: {}): Promise<any>;
|
|
124
124
|
newModelInstance(attributes?: {}): any;
|
|
125
|
-
getQuery(): IBuilder<M, R>;
|
|
125
|
+
getQuery(): IBuilder<M, R$1>;
|
|
126
126
|
getModel(): M;
|
|
127
|
-
setModel<MO extends Model>(model: MO): this;
|
|
127
|
+
setModel<MO extends Model$1>(model: MO): this;
|
|
128
128
|
qualifyColumn(column: string): string;
|
|
129
129
|
setTable(table: string): this;
|
|
130
130
|
applyScopes(): this;
|
|
@@ -187,15 +187,15 @@ declare class Builder<M extends Model = Model, R = IModel | ICollection<M>> exte
|
|
|
187
187
|
findMany(this: any, ids: string[] | number[] | ICollection<any>, columns?: string[]): Promise<any>;
|
|
188
188
|
pluck(column: string): Promise<any>;
|
|
189
189
|
destroy(this: any, ids?: string | number | string[] | number[] | TFunction | Collection$1<M>): Promise<number>;
|
|
190
|
-
get<M extends Model>(columns?: string | string[]): Promise<Collection$1<M>>;
|
|
190
|
+
get<M extends Model$1>(columns?: string | string[]): Promise<Collection$1<M>>;
|
|
191
191
|
all(columns?: string[]): Promise<any>;
|
|
192
192
|
paginate(this: any, page?: number, perPage?: number): Promise<Paginator<any, IPaginatorParams>>;
|
|
193
193
|
getModels(...columns: any[]): Promise<any[]>;
|
|
194
194
|
getRelation(name: string): any;
|
|
195
195
|
relationsNestedUnder(relation: string): TGeneric;
|
|
196
196
|
isNestedUnder(relation: string, name: string): boolean;
|
|
197
|
-
eagerLoadRelation<M extends Model>(models: M[], name: string, constraints: any): Promise<any>;
|
|
198
|
-
eagerLoadRelations<M extends Model>(models: M[]): Promise<M[]>;
|
|
197
|
+
eagerLoadRelation<M extends Model$1>(models: M[], name: string, constraints: any): Promise<any>;
|
|
198
|
+
eagerLoadRelations<M extends Model$1>(models: M[]): Promise<M[]>;
|
|
199
199
|
hydrate(items: any[] | ICollection<any>): Collection$1<any>;
|
|
200
200
|
}
|
|
201
201
|
//#endregion
|
|
@@ -231,21 +231,21 @@ declare class Relation$1 {
|
|
|
231
231
|
}
|
|
232
232
|
//#endregion
|
|
233
233
|
//#region src/arquebus.d.ts
|
|
234
|
-
declare class arquebus<M extends Model = Model> {
|
|
234
|
+
declare class arquebus<M extends Model$1 = Model$1> {
|
|
235
235
|
static connectorFactory: typeof Knex$1 | null;
|
|
236
236
|
static instance: arquebus | null;
|
|
237
237
|
manager: Record<string, QueryBuilder<M>>;
|
|
238
238
|
connections: Record<string, TConfig>;
|
|
239
|
-
models: Record<string, typeof Model>;
|
|
239
|
+
models: Record<string, typeof Model$1>;
|
|
240
240
|
constructor();
|
|
241
|
-
getConstructor<T extends typeof arquebus>(this: InstanceType<T>): T;
|
|
242
|
-
static getInstance(): arquebus<Model>;
|
|
241
|
+
getConstructor<T$1 extends typeof arquebus>(this: InstanceType<T$1>): T$1;
|
|
242
|
+
static getInstance(): arquebus<Model$1>;
|
|
243
243
|
/**
|
|
244
244
|
* Initialize a new database connection
|
|
245
245
|
*
|
|
246
246
|
* @returns
|
|
247
247
|
*/
|
|
248
|
-
static fire<C extends TBaseConfig['client']>(connection?: C | null): QueryBuilder<Model>;
|
|
248
|
+
static fire<C extends TBaseConfig['client']>(connection?: C | null): QueryBuilder<Model$1>;
|
|
249
249
|
/**
|
|
250
250
|
* Initialize a new database connection
|
|
251
251
|
*
|
|
@@ -256,16 +256,16 @@ declare class arquebus<M extends Model = Model> {
|
|
|
256
256
|
*
|
|
257
257
|
* @returns
|
|
258
258
|
*/
|
|
259
|
-
static connection<C extends TBaseConfig['client']>(connection?: C | null): QueryBuilder<Model, Model | Model[]>;
|
|
259
|
+
static connection<C extends TBaseConfig['client']>(connection?: C | null): QueryBuilder<Model$1, Model$1 | Model$1[]>;
|
|
260
260
|
static setConnectorFactory(connectorFactory: typeof Knex$1): void;
|
|
261
261
|
static getConnectorFactory(): typeof Knex$1;
|
|
262
262
|
static addConnection(config: TConfig | TBaseConfig, name?: string): void;
|
|
263
263
|
static beginTransaction(connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]>>;
|
|
264
|
-
static transaction<A, R>(callback: TFunction<A[], R>, connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]>> | undefined;
|
|
265
|
-
static table(name: string, connection?: null): IQueryBuilder<Model, Model | Model[]>;
|
|
264
|
+
static transaction<A, R$1>(callback: TFunction<A[], R$1>, connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]>> | undefined;
|
|
265
|
+
static table(name: string, connection?: null): IQueryBuilder<Model$1, Model$1 | Model$1[]>;
|
|
266
266
|
static schema(connection?: null): SchemaBuilder;
|
|
267
267
|
static destroyAll(): Promise<void>;
|
|
268
|
-
static createModel<X extends TGeneric>(name: string, options: X): typeof Model;
|
|
268
|
+
static createModel<X extends TGeneric>(name: string, options: X): typeof Model$1;
|
|
269
269
|
connection(connection?: string | null): QueryBuilder<M, M | M[]>;
|
|
270
270
|
getConnection(name?: string | null): QueryBuilder<M, M | M[]>;
|
|
271
271
|
addConnection(config: TConfig | TBaseConfig, name?: string): void;
|
|
@@ -285,7 +285,7 @@ declare class arquebus<M extends Model = Model> {
|
|
|
285
285
|
table(name: string, connection?: null): IQueryBuilder<M, M | M[]>;
|
|
286
286
|
schema(connection?: null): SchemaBuilder;
|
|
287
287
|
destroyAll(): Promise<void>;
|
|
288
|
-
createModel(name: string, options?: ModelOptions): typeof Model;
|
|
288
|
+
createModel(name: string, options?: ModelOptions): typeof Model$1;
|
|
289
289
|
}
|
|
290
290
|
//#endregion
|
|
291
291
|
//#region types/container.d.ts
|
|
@@ -334,7 +334,7 @@ type TConfig = TBaseConfig & ({
|
|
|
334
334
|
connection: Knex.MariaSqlConnectionConfig;
|
|
335
335
|
useNullAsDefault?: boolean;
|
|
336
336
|
});
|
|
337
|
-
interface ModelOptions<M extends Model = Model> {
|
|
337
|
+
interface ModelOptions<M extends Model$1 = Model$1> {
|
|
338
338
|
table?: string;
|
|
339
339
|
scopes?: TGeneric<(...args: any[]) => Builder<M>>;
|
|
340
340
|
plugins?: (<X extends MixinConstructor<M>>(Model: X) => MixinConstructor<M>)[];
|
|
@@ -348,8 +348,8 @@ interface ModelOptions<M extends Model = Model> {
|
|
|
348
348
|
primaryKey?: string;
|
|
349
349
|
incrementing?: boolean;
|
|
350
350
|
keyType?: 'int' | 'string';
|
|
351
|
-
with?: Model['with'];
|
|
352
|
-
casts?: Model['casts'];
|
|
351
|
+
with?: Model$1['with'];
|
|
352
|
+
casts?: Model$1['casts'];
|
|
353
353
|
}
|
|
354
354
|
interface TField {
|
|
355
355
|
type: 'VAR_STRING' | 'BLOB' | 'DATETIME' | 'TIMESTAMP' | 'LONG' | 'JSON';
|
|
@@ -373,25 +373,25 @@ interface Attribute {
|
|
|
373
373
|
withCaching?: boolean;
|
|
374
374
|
withObjectCaching?: boolean;
|
|
375
375
|
}
|
|
376
|
-
type Relation<M extends Model> = IBuilder<M, any> & {};
|
|
377
|
-
interface HasOneOrMany<M extends Model> extends Relation<M> {
|
|
376
|
+
type Relation<M extends Model$1> = IBuilder<M, any> & {};
|
|
377
|
+
interface HasOneOrMany<M extends Model$1> extends Relation<M> {
|
|
378
378
|
save(model: M): Promise<M>;
|
|
379
379
|
saveMany(models: M[] | ICollection<M>): Promise<ICollection<M>>;
|
|
380
380
|
create(attributes?: any): Promise<M>;
|
|
381
381
|
createMany(records: any[]): Promise<ICollection<M>>;
|
|
382
382
|
}
|
|
383
|
-
interface HasOne<M extends Model> extends HasOneOrMany<M> {
|
|
383
|
+
interface HasOne<M extends Model$1> extends HasOneOrMany<M> {
|
|
384
384
|
getResults(): Promise<M | null>;
|
|
385
385
|
withDefault(callback?: TFunction | object): this;
|
|
386
386
|
}
|
|
387
|
-
interface HasMany<M extends Model> extends HasOneOrMany<M> {
|
|
387
|
+
interface HasMany<M extends Model$1> extends HasOneOrMany<M> {
|
|
388
388
|
getResults(): Promise<ICollection<M>>;
|
|
389
389
|
}
|
|
390
|
-
interface BelongsTo<M extends Model> extends Relation<M> {
|
|
390
|
+
interface BelongsTo<M extends Model$1> extends Relation<M> {
|
|
391
391
|
getResults(): Promise<M | null>;
|
|
392
392
|
withDefault(callback?: TFunction | object): this;
|
|
393
393
|
}
|
|
394
|
-
interface BelongsToMany<M extends Model> extends Relation<M> {
|
|
394
|
+
interface BelongsToMany<M extends Model$1> extends Relation<M> {
|
|
395
395
|
getResults(): Promise<ICollection<M>>;
|
|
396
396
|
withTimestamps(): this;
|
|
397
397
|
wherePivot(column: any, operator?: any, value?: any, boolean?: string, ...args: any[]): this;
|
|
@@ -417,20 +417,20 @@ interface IModel {
|
|
|
417
417
|
exists: boolean;
|
|
418
418
|
connection?: TBaseConfig['client'] | null;
|
|
419
419
|
perPage: number;
|
|
420
|
-
with: string | string[] | TGeneric<(...args: any[]) => IBuilder<Model>>;
|
|
420
|
+
with: string | string[] | TGeneric<(...args: any[]) => IBuilder<Model$1>>;
|
|
421
421
|
trx: AnyQueryBuilder | null;
|
|
422
422
|
timestamps: boolean;
|
|
423
423
|
dateFormat: string;
|
|
424
424
|
visible: string[];
|
|
425
425
|
hidden: string[];
|
|
426
|
-
query<T extends {
|
|
426
|
+
query<T$1 extends {
|
|
427
427
|
prototype: unknown;
|
|
428
|
-
}>(this: T, client?: AnyQueryBuilder | null): IBuilder<Model>;
|
|
429
|
-
on<T extends {
|
|
428
|
+
}>(this: T$1, client?: AnyQueryBuilder | null): IBuilder<Model$1>;
|
|
429
|
+
on<T$1 extends {
|
|
430
430
|
prototype: unknown;
|
|
431
|
-
}>(this: T, connection: string | null): IBuilder<Model>;
|
|
431
|
+
}>(this: T$1, connection: string | null): IBuilder<Model$1>;
|
|
432
432
|
boot(): void;
|
|
433
|
-
make<T extends IModel>(this: new () => T, attributes?: TGeneric): T;
|
|
433
|
+
make<T$1 extends IModel>(this: new () => T$1, attributes?: TGeneric): T$1;
|
|
434
434
|
addHook(hook: Hook, callback: TFunction): void;
|
|
435
435
|
creating(callback: TFunction): void;
|
|
436
436
|
created(callback: TFunction): void;
|
|
@@ -470,13 +470,13 @@ interface IModel {
|
|
|
470
470
|
fill(attributes: any): this;
|
|
471
471
|
setAppends(appends: string[]): this;
|
|
472
472
|
append(key: string | string[]): this;
|
|
473
|
-
getRelation<T extends Model>(relation: string): T | ICollection<T> | null | undefined;
|
|
474
|
-
setRelation<T extends Model>(relation: string, value: T | ICollection<T> | null): this;
|
|
473
|
+
getRelation<T$1 extends Model$1>(relation: string): T$1 | ICollection<T$1> | null | undefined;
|
|
474
|
+
setRelation<T$1 extends Model$1>(relation: string, value: T$1 | ICollection<T$1> | null): this;
|
|
475
475
|
unsetRelation(relation: string): this;
|
|
476
476
|
relationLoaded(relation: string): boolean;
|
|
477
477
|
makeVisible(attributes: string | string[]): this;
|
|
478
478
|
makeHidden(attributes: string | string[]): this;
|
|
479
|
-
newCollection(models?: any[]): ICollection<Model>;
|
|
479
|
+
newCollection(models?: any[]): ICollection<Model$1>;
|
|
480
480
|
load(relations: WithRelationType): Promise<this>;
|
|
481
481
|
load(...relations: WithRelationType[]): Promise<this>;
|
|
482
482
|
loadAggregate(relations: WithRelationType, column: any, callback?: any): Promise<this>;
|
|
@@ -518,12 +518,12 @@ interface IModel {
|
|
|
518
518
|
push(): Promise<boolean>;
|
|
519
519
|
is(model: this): boolean;
|
|
520
520
|
isNot(model: this): boolean;
|
|
521
|
-
related<T extends RelationNames<this>>(relation: T): ReturnTypeOfMethod<this, `relation${Capitalize<SnakeToCamelCase<T>>}`>;
|
|
522
|
-
getRelated<T extends RelationNames<this>>(relation: T): ReturnTypeOfMethod<ReturnTypeOfMethod<this, `relation${Capitalize<SnakeToCamelCase<T>>}`>, any>;
|
|
523
|
-
hasOne<T extends Model>(model: new () => T, foreignKey?: string, localKey?: string): HasOne<T>;
|
|
524
|
-
hasMany<T extends Model>(model: new () => T, foreignKey?: string, localKey?: string): HasMany<T>;
|
|
525
|
-
belongsTo<T extends Model>(model: new () => T, foreignKey?: string, ownerKey?: string, relation?: string): BelongsTo<T>;
|
|
526
|
-
belongsToMany<T extends Model>(model: new () => T, table?: string, foreignPivotKey?: string, relatedPivotKey?: string, parentKey?: string, relatedKey?: string): BelongsToMany<T>;
|
|
521
|
+
related<T$1 extends RelationNames<this>>(relation: T$1): ReturnTypeOfMethod<this, `relation${Capitalize<SnakeToCamelCase<T$1>>}`>;
|
|
522
|
+
getRelated<T$1 extends RelationNames<this>>(relation: T$1): ReturnTypeOfMethod<ReturnTypeOfMethod<this, `relation${Capitalize<SnakeToCamelCase<T$1>>}`>, any>;
|
|
523
|
+
hasOne<T$1 extends Model$1>(model: new () => T$1, foreignKey?: string, localKey?: string): HasOne<T$1>;
|
|
524
|
+
hasMany<T$1 extends Model$1>(model: new () => T$1, foreignKey?: string, localKey?: string): HasMany<T$1>;
|
|
525
|
+
belongsTo<T$1 extends Model$1>(model: new () => T$1, foreignKey?: string, ownerKey?: string, relation?: string): BelongsTo<T$1>;
|
|
526
|
+
belongsToMany<T$1 extends Model$1>(model: new () => T$1, table?: string, foreignPivotKey?: string, relatedPivotKey?: string, parentKey?: string, relatedKey?: string): BelongsToMany<T$1>;
|
|
527
527
|
}
|
|
528
528
|
//#endregion
|
|
529
529
|
//#region src/model.d.ts
|
|
@@ -536,20 +536,20 @@ declare const BaseModel$1: (new (...args: any[]) => any) & {
|
|
|
536
536
|
exists: boolean;
|
|
537
537
|
connection?: (TBaseConfig["client"] | null) | undefined;
|
|
538
538
|
perPage: number;
|
|
539
|
-
with: string | string[] | TGeneric<(...args: any[]) => IBuilder<Model>>;
|
|
539
|
+
with: string | string[] | TGeneric<(...args: any[]) => IBuilder<Model$1>>;
|
|
540
540
|
trx: AnyQueryBuilder | null;
|
|
541
541
|
timestamps: boolean;
|
|
542
542
|
dateFormat: string;
|
|
543
543
|
visible: string[] & any[];
|
|
544
544
|
hidden: string[] & any[];
|
|
545
|
-
query: <T extends {
|
|
545
|
+
query: <T$1 extends {
|
|
546
546
|
prototype: unknown;
|
|
547
|
-
}>(this: T, client?: AnyQueryBuilder | null) => IBuilder<Model>;
|
|
548
|
-
on: <T extends {
|
|
547
|
+
}>(this: T$1, client?: AnyQueryBuilder | null) => IBuilder<Model$1>;
|
|
548
|
+
on: <T$1 extends {
|
|
549
549
|
prototype: unknown;
|
|
550
|
-
}>(this: T, connection: string | null) => IBuilder<Model>;
|
|
550
|
+
}>(this: T$1, connection: string | null) => IBuilder<Model$1>;
|
|
551
551
|
boot: () => void;
|
|
552
|
-
make: <T extends IModel>(this: new () => T, attributes?: TGeneric) => T;
|
|
552
|
+
make: <T$1 extends IModel>(this: new () => T$1, attributes?: TGeneric) => T$1;
|
|
553
553
|
addHook: (hook: Hook, callback: TFunction) => void;
|
|
554
554
|
creating: (callback: TFunction) => void;
|
|
555
555
|
created: (callback: TFunction) => void;
|
|
@@ -1394,8 +1394,8 @@ declare const BaseModel$1: (new (...args: any[]) => any) & {
|
|
|
1394
1394
|
uniqueIds(): never[];
|
|
1395
1395
|
setUniqueIds(): void;
|
|
1396
1396
|
});
|
|
1397
|
-
getRelation: <T extends Model>(relation: string) => T | ICollection<T> | null | undefined;
|
|
1398
|
-
setRelation: <T extends Model>(relation: string, value: T | ICollection<T> | null) => (new () => IModel) & IModel & {
|
|
1397
|
+
getRelation: <T$1 extends Model$1>(relation: string) => T$1 | ICollection<T$1> | null | undefined;
|
|
1398
|
+
setRelation: <T$1 extends Model$1>(relation: string, value: T$1 | ICollection<T$1> | null) => (new () => IModel) & IModel & {
|
|
1399
1399
|
[x: string]: any;
|
|
1400
1400
|
timestamps: boolean;
|
|
1401
1401
|
dateFormat: string;
|
|
@@ -1880,7 +1880,7 @@ declare const BaseModel$1: (new (...args: any[]) => any) & {
|
|
|
1880
1880
|
uniqueIds(): never[];
|
|
1881
1881
|
setUniqueIds(): void;
|
|
1882
1882
|
});
|
|
1883
|
-
newCollection: (models?: any[]) => ICollection<Model>;
|
|
1883
|
+
newCollection: (models?: any[]) => ICollection<Model$1>;
|
|
1884
1884
|
load: {
|
|
1885
1885
|
(relations: WithRelationType): Promise<(new () => IModel) & IModel & {
|
|
1886
1886
|
[x: string]: any;
|
|
@@ -3285,7 +3285,7 @@ declare const BaseModel$1: (new (...args: any[]) => any) & {
|
|
|
3285
3285
|
uniqueIds(): never[];
|
|
3286
3286
|
setUniqueIds(): void;
|
|
3287
3287
|
}) => boolean;
|
|
3288
|
-
related: <T extends never>(relation: T) => ReturnTypeOfMethod<(new () => IModel) & IModel & {
|
|
3288
|
+
related: <T$1 extends never>(relation: T$1) => ReturnTypeOfMethod<(new () => IModel) & IModel & {
|
|
3289
3289
|
[x: string]: any;
|
|
3290
3290
|
timestamps: boolean;
|
|
3291
3291
|
dateFormat: string;
|
|
@@ -3365,8 +3365,8 @@ declare const BaseModel$1: (new (...args: any[]) => any) & {
|
|
|
3365
3365
|
usesUniqueIds(): boolean;
|
|
3366
3366
|
uniqueIds(): never[];
|
|
3367
3367
|
setUniqueIds(): void;
|
|
3368
|
-
}, `relation${Capitalize<SnakeToCamelCase<T>>}`>;
|
|
3369
|
-
getRelated: <T extends never>(relation: T) => ReturnTypeOfMethod<ReturnTypeOfMethod<(new () => IModel) & IModel & {
|
|
3368
|
+
}, `relation${Capitalize<SnakeToCamelCase<T$1>>}`>;
|
|
3369
|
+
getRelated: <T$1 extends never>(relation: T$1) => ReturnTypeOfMethod<ReturnTypeOfMethod<(new () => IModel) & IModel & {
|
|
3370
3370
|
[x: string]: any;
|
|
3371
3371
|
timestamps: boolean;
|
|
3372
3372
|
dateFormat: string;
|
|
@@ -3446,11 +3446,11 @@ declare const BaseModel$1: (new (...args: any[]) => any) & {
|
|
|
3446
3446
|
usesUniqueIds(): boolean;
|
|
3447
3447
|
uniqueIds(): never[];
|
|
3448
3448
|
setUniqueIds(): void;
|
|
3449
|
-
}, `relation${Capitalize<SnakeToCamelCase<T>>}`>, any>;
|
|
3450
|
-
hasOne: <T extends Model>(model: new () => T, foreignKey?: string, localKey?: string) => HasOne<T>;
|
|
3451
|
-
hasMany: <T extends Model>(model: new () => T, foreignKey?: string, localKey?: string) => HasMany<T>;
|
|
3452
|
-
belongsTo: <T extends Model>(model: new () => T, foreignKey?: string, ownerKey?: string, relation?: string) => BelongsTo<T>;
|
|
3453
|
-
belongsToMany: <T extends Model>(model: new () => T, table?: string, foreignPivotKey?: string, relatedPivotKey?: string, parentKey?: string, relatedKey?: string) => BelongsToMany<T>;
|
|
3449
|
+
}, `relation${Capitalize<SnakeToCamelCase<T$1>>}`>, any>;
|
|
3450
|
+
hasOne: <T$1 extends Model$1>(model: new () => T$1, foreignKey?: string, localKey?: string) => HasOne<T$1>;
|
|
3451
|
+
hasMany: <T$1 extends Model$1>(model: new () => T$1, foreignKey?: string, localKey?: string) => HasMany<T$1>;
|
|
3452
|
+
belongsTo: <T$1 extends Model$1>(model: new () => T$1, foreignKey?: string, ownerKey?: string, relation?: string) => BelongsTo<T$1>;
|
|
3453
|
+
belongsToMany: <T$1 extends Model$1>(model: new () => T$1, table?: string, foreignPivotKey?: string, relatedPivotKey?: string, parentKey?: string, relatedKey?: string) => BelongsToMany<T$1>;
|
|
3454
3454
|
original: TGeneric;
|
|
3455
3455
|
casts: TGeneric<typeof CastsAttributes | "int" | "json" | "string" | "date" | "boolean" | "datetime" | "collection">;
|
|
3456
3456
|
changes: TGeneric;
|
|
@@ -3966,7 +3966,7 @@ declare const BaseModel$1: (new (...args: any[]) => any) & {
|
|
|
3966
3966
|
getGlobalScopes: () => {};
|
|
3967
3967
|
useUniqueIds: boolean;
|
|
3968
3968
|
};
|
|
3969
|
-
declare class Model extends BaseModel$1 {
|
|
3969
|
+
declare class Model$1 extends BaseModel$1 {
|
|
3970
3970
|
[key: string]: any;
|
|
3971
3971
|
protected builder: IBuilder<any, any> | null;
|
|
3972
3972
|
protected table: string | null;
|
|
@@ -3982,16 +3982,16 @@ declare class Model extends BaseModel$1 {
|
|
|
3982
3982
|
connection: TBaseConfig['client'] | null;
|
|
3983
3983
|
eagerLoad: {};
|
|
3984
3984
|
exists: boolean;
|
|
3985
|
-
with: string | string[] | TGeneric<(...args: any[]) => IBuilder<Model>>;
|
|
3985
|
+
with: string | string[] | TGeneric<(...args: any[]) => IBuilder<Model$1>>;
|
|
3986
3986
|
name: any;
|
|
3987
3987
|
trx: null;
|
|
3988
3988
|
constructor(attributes?: {});
|
|
3989
|
-
static query(trx?: null): Builder<Model, IModel | ICollection<Model>>;
|
|
3990
|
-
static on(connection?: TBaseConfig['client'] | null): Builder<Model, IModel | ICollection<Model>>;
|
|
3991
|
-
static init(attributes?: {}): Model;
|
|
3989
|
+
static query(trx?: null): Builder<Model$1, IModel | ICollection<Model$1>>;
|
|
3990
|
+
static on(connection?: TBaseConfig['client'] | null): Builder<Model$1, IModel | ICollection<Model$1>>;
|
|
3991
|
+
static init(attributes?: {}): Model$1;
|
|
3992
3992
|
static extend(plugin: TFunction, options: TGeneric): void;
|
|
3993
|
-
static make(attributes?: TGeneric): Model;
|
|
3994
|
-
getConstructor<T extends typeof Model>(this: InstanceType<T>): T;
|
|
3993
|
+
static make(attributes?: TGeneric): Model$1;
|
|
3994
|
+
getConstructor<T$1 extends typeof Model$1>(this: InstanceType<T$1>): T$1;
|
|
3995
3995
|
bootIfNotBooted(this: any): void;
|
|
3996
3996
|
static booting(): void;
|
|
3997
3997
|
static boot(): void;
|
|
@@ -4011,20 +4011,20 @@ declare class Model extends BaseModel$1 {
|
|
|
4011
4011
|
getConnection(this: any): any;
|
|
4012
4012
|
setConnection(connection: TBaseConfig['client'] | null): this;
|
|
4013
4013
|
getKeyType(): string;
|
|
4014
|
-
newQuery(trx?: null): Builder<Model, IModel | ICollection<Model>>;
|
|
4015
|
-
newQueryWithoutScopes(trx?: null): Builder<Model, IModel | ICollection<Model>>;
|
|
4016
|
-
newModelQuery(trx?: null): Builder<Model, IModel | ICollection<Model>>;
|
|
4017
|
-
addGlobalScopes(this: any, builder: Builder<Model>): Builder<Model, IModel | ICollection<Model>>;
|
|
4014
|
+
newQuery(trx?: null): Builder<Model$1, IModel | ICollection<Model$1>>;
|
|
4015
|
+
newQueryWithoutScopes(trx?: null): Builder<Model$1, IModel | ICollection<Model$1>>;
|
|
4016
|
+
newModelQuery(trx?: null): Builder<Model$1, IModel | ICollection<Model$1>>;
|
|
4017
|
+
addGlobalScopes(this: any, builder: Builder<Model$1>): Builder<Model$1, IModel | ICollection<Model$1>>;
|
|
4018
4018
|
hasNamedScope(name: string): boolean;
|
|
4019
4019
|
callNamedScope(scope: string, parameters: any[]): any;
|
|
4020
4020
|
setTable(table: string): this;
|
|
4021
|
-
newCollection(this: any, models?: never[]): Collection$1<Model>;
|
|
4022
|
-
load<R extends WithRelationType>(this: any, ...relations: R[]): Promise<any>;
|
|
4023
|
-
loadAggregate<R extends WithRelationType>(relations: R[], column: string, callback?: TFunction | string | null): Promise<this>;
|
|
4024
|
-
loadCount<R extends WithRelationType>(...relations: R[]): Promise<this>;
|
|
4025
|
-
loadMax<R extends WithRelationType>(relations: R[], column: string): Promise<this>;
|
|
4026
|
-
loadMin<R extends WithRelationType>(relations: R[], column: string): Promise<this>;
|
|
4027
|
-
loadSum<R extends WithRelationType>(relations: R[], column: string): Promise<this>;
|
|
4021
|
+
newCollection(this: any, models?: never[]): Collection$1<Model$1>;
|
|
4022
|
+
load<R$1 extends WithRelationType>(this: any, ...relations: R$1[]): Promise<any>;
|
|
4023
|
+
loadAggregate<R$1 extends WithRelationType>(relations: R$1[], column: string, callback?: TFunction | string | null): Promise<this>;
|
|
4024
|
+
loadCount<R$1 extends WithRelationType>(...relations: R$1[]): Promise<this>;
|
|
4025
|
+
loadMax<R$1 extends WithRelationType>(relations: R$1[], column: string): Promise<this>;
|
|
4026
|
+
loadMin<R$1 extends WithRelationType>(relations: R$1[], column: string): Promise<this>;
|
|
4027
|
+
loadSum<R$1 extends WithRelationType>(relations: R$1[], column: string): Promise<this>;
|
|
4028
4028
|
increment(column: string, amount?: number, extra?: TGeneric, options?: TGeneric): Promise<any>;
|
|
4029
4029
|
decrement(column: string, amount?: number, extra?: TGeneric, options?: TGeneric): Promise<any>;
|
|
4030
4030
|
incrementOrDecrement(column: string, amount: number, extra: TGeneric, method: string, options: TGeneric): Promise<any>;
|
|
@@ -4053,46 +4053,46 @@ declare class Model extends BaseModel$1 {
|
|
|
4053
4053
|
forceDelete(options?: {}): Promise<boolean>;
|
|
4054
4054
|
fresh(this: any): any;
|
|
4055
4055
|
refresh(this: any): Promise<any>;
|
|
4056
|
-
newPivot<E extends Model>(parent: E, attributes: TGeneric, table: string, exists: boolean, using?: typeof Pivot$1 | null): Pivot$1;
|
|
4056
|
+
newPivot<E extends Model$1>(parent: E, attributes: TGeneric, table: string, exists: boolean, using?: typeof Pivot$1 | null): Pivot$1;
|
|
4057
4057
|
qualifyColumn(column: string): string;
|
|
4058
4058
|
getQualifiedKeyName(): string;
|
|
4059
4059
|
push(options?: {}): Promise<boolean>;
|
|
4060
4060
|
is(model: any): any;
|
|
4061
4061
|
isNot(model: any): boolean;
|
|
4062
4062
|
}
|
|
4063
|
-
declare class Pivot$1 extends Model {
|
|
4063
|
+
declare class Pivot$1 extends Model$1 {
|
|
4064
4064
|
incrementing: boolean;
|
|
4065
4065
|
guarded: never[];
|
|
4066
|
-
pivotParent: Model | null;
|
|
4066
|
+
pivotParent: Model$1 | null;
|
|
4067
4067
|
foreignKey: string | null;
|
|
4068
4068
|
relatedKey: string | null;
|
|
4069
4069
|
setPivotKeys(foreignKey: string, relatedKey: string): this;
|
|
4070
|
-
static fromRawAttributes<E extends Model>(parent: E, attributes: TGeneric, table: string, exists?: boolean): Pivot$1;
|
|
4071
|
-
static fromAttributes<E extends Model>(parent: E, attributes: TGeneric, table: string, exists?: boolean): Pivot$1;
|
|
4070
|
+
static fromRawAttributes<E extends Model$1>(parent: E, attributes: TGeneric, table: string, exists?: boolean): Pivot$1;
|
|
4071
|
+
static fromAttributes<E extends Model$1>(parent: E, attributes: TGeneric, table: string, exists?: boolean): Pivot$1;
|
|
4072
4072
|
hasTimestampAttributes(this: any, attributes?: TGeneric | null): boolean;
|
|
4073
4073
|
}
|
|
4074
4074
|
//#endregion
|
|
4075
4075
|
//#region types/generics.d.ts
|
|
4076
|
-
type TGeneric<V = any, K extends string = string> = Record<K, V>;
|
|
4076
|
+
type TGeneric<V = any, K$1 extends string = string> = Record<K$1, V>;
|
|
4077
4077
|
type Hook = 'creating' | 'created' | 'updating' | 'updated' | 'saving' | 'saved' | 'deleting' | 'deleted' | 'restoring' | 'restored' | 'trashed' | 'forceDeleted';
|
|
4078
4078
|
type TFunction<TArgs extends any[] = any[], TReturn = any> = (...args: TArgs) => TReturn;
|
|
4079
4079
|
type PrimitiveValue = string | number | boolean | Date | string[] | number[] | boolean[] | Date[] | null | Buffer;
|
|
4080
|
-
type ReturnTypeOfMethod<T, K extends keyof T> = T[K] extends ((...args: any[]) => infer R) ? R : never;
|
|
4080
|
+
type ReturnTypeOfMethod<T$1, K$1 extends keyof T$1> = T$1[K$1] extends ((...args: any[]) => infer R) ? R : never;
|
|
4081
4081
|
type SnakeToCamelCase<S extends string> = S extends `${infer T}_${infer U}` ? `${T}${Capitalize<SnakeToCamelCase<U>>}` : S;
|
|
4082
4082
|
type CamelToSnakeCase<S extends string> = S extends `${infer T}${infer U}` ? U extends Uncapitalize<U> ? `${Uncapitalize<T>}${CamelToSnakeCase<U>}` : `${Uncapitalize<T>}_${CamelToSnakeCase<U>}` : S;
|
|
4083
|
-
type FunctionPropertyNames<T> = { [K in keyof T]: T[K] extends ((...args: any[]) => any) ? K : never }[keyof T];
|
|
4084
|
-
type RelationNames<T> = FunctionPropertyNames<T> extends infer R ? R extends `relation${infer P}` ? P extends 'sToData' | 'loaded' ? never : CamelToSnakeCase<P> : never : never;
|
|
4085
|
-
type MixinConstructor<T = TGeneric> = new (...args: any[]) => T;
|
|
4083
|
+
type FunctionPropertyNames<T$1> = { [K in keyof T$1]: T$1[K] extends ((...args: any[]) => any) ? K : never }[keyof T$1];
|
|
4084
|
+
type RelationNames<T$1> = FunctionPropertyNames<T$1> extends infer R ? R extends `relation${infer P}` ? P extends 'sToData' | 'loaded' ? never : CamelToSnakeCase<P> : never : never;
|
|
4085
|
+
type MixinConstructor<T$1 = TGeneric> = new (...args: any[]) => T$1;
|
|
4086
4086
|
//#endregion
|
|
4087
4087
|
//#region src/browser/collection.d.ts
|
|
4088
|
-
declare class Collection$2<I extends Model$
|
|
4088
|
+
declare class Collection$2<I$1 extends Model$2> extends Collection<I$1> {
|
|
4089
4089
|
mapThen(callback: TFunction): Promise<any[]>;
|
|
4090
4090
|
modelKeys(): any[];
|
|
4091
|
-
contains<K, V>(key: keyof I | K | TFunction, value?: V): boolean;
|
|
4091
|
+
contains<K$1, V>(key: keyof I$1 | K$1 | TFunction, value?: V): boolean;
|
|
4092
4092
|
diff(items: ICollection<any> | any[]): any;
|
|
4093
4093
|
except(keys: any[]): any;
|
|
4094
|
-
intersect(items: I[]): any;
|
|
4095
|
-
unique(key?: TFunction | keyof I, _strict?: boolean): any;
|
|
4094
|
+
intersect(items: I$1[]): any;
|
|
4095
|
+
unique(key?: TFunction | keyof I$1, _strict?: boolean): any;
|
|
4096
4096
|
find(key: any, defaultValue?: null): any;
|
|
4097
4097
|
makeVisible(attributes: any): this;
|
|
4098
4098
|
makeHidden(attributes: any): this;
|
|
@@ -4103,21 +4103,21 @@ declare class Collection$2<I extends Model$1> extends Collection<I> {
|
|
|
4103
4103
|
[x: string]: any;
|
|
4104
4104
|
[x: number]: any;
|
|
4105
4105
|
[x: symbol]: any;
|
|
4106
|
-
} | I)[];
|
|
4106
|
+
} | I$1)[];
|
|
4107
4107
|
toJSON(): ({
|
|
4108
4108
|
[x: string]: any;
|
|
4109
4109
|
[x: number]: any;
|
|
4110
4110
|
[x: symbol]: any;
|
|
4111
|
-
} | I)[];
|
|
4111
|
+
} | I$1)[];
|
|
4112
4112
|
toJson(...args: any[]): string;
|
|
4113
|
-
[Symbol.iterator]: () => Iterator<I>;
|
|
4113
|
+
[Symbol.iterator]: () => Iterator<I$1>;
|
|
4114
4114
|
}
|
|
4115
4115
|
//#endregion
|
|
4116
4116
|
//#region src/browser/model.d.ts
|
|
4117
4117
|
declare const BaseModel: (new (...args: any[]) => any) & {
|
|
4118
4118
|
[x: string]: any;
|
|
4119
4119
|
};
|
|
4120
|
-
declare class Model$
|
|
4120
|
+
declare class Model$2 extends BaseModel {
|
|
4121
4121
|
protected primaryKey: string;
|
|
4122
4122
|
protected perPage: number;
|
|
4123
4123
|
static globalScopes: {};
|
|
@@ -4127,9 +4127,9 @@ declare class Model$1 extends BaseModel {
|
|
|
4127
4127
|
static browser: boolean;
|
|
4128
4128
|
connection: TBaseConfig['client'] | null;
|
|
4129
4129
|
constructor(attributes?: {});
|
|
4130
|
-
static init(attributes?: {}): Model$
|
|
4130
|
+
static init(attributes?: {}): Model$2;
|
|
4131
4131
|
static extend(plugin: TFunction, options: TGeneric): void;
|
|
4132
|
-
static make(attributes?: TGeneric): Model$
|
|
4132
|
+
static make(attributes?: TGeneric): Model$2;
|
|
4133
4133
|
bootIfNotBooted(this: any): void;
|
|
4134
4134
|
static booting(): void;
|
|
4135
4135
|
static boot(): void;
|
|
@@ -4168,55 +4168,55 @@ declare class Model$1 extends BaseModel {
|
|
|
4168
4168
|
fill(attributes: TGeneric): this;
|
|
4169
4169
|
transacting(trx: any): this;
|
|
4170
4170
|
trashed(): boolean;
|
|
4171
|
-
newPivot<E extends Model$
|
|
4171
|
+
newPivot<E extends Model$2>(parent: E, attributes: TGeneric, table: string, exists: boolean, using?: typeof Pivot | null): Pivot;
|
|
4172
4172
|
qualifyColumn(column: string): string;
|
|
4173
4173
|
getQualifiedKeyName(): string;
|
|
4174
4174
|
is(model: any): any;
|
|
4175
4175
|
isNot(model: any): boolean;
|
|
4176
4176
|
}
|
|
4177
|
-
declare class Pivot extends Model$
|
|
4177
|
+
declare class Pivot extends Model$2 {
|
|
4178
4178
|
incrementing: boolean;
|
|
4179
4179
|
guarded: never[];
|
|
4180
|
-
pivotParent: Model$
|
|
4180
|
+
pivotParent: Model$2 | null;
|
|
4181
4181
|
foreignKey: string | null;
|
|
4182
4182
|
relatedKey: string | null;
|
|
4183
4183
|
setPivotKeys(foreignKey: string, relatedKey: string): this;
|
|
4184
|
-
static fromRawAttributes<E extends Model$
|
|
4185
|
-
static fromAttributes<E extends Model$
|
|
4184
|
+
static fromRawAttributes<E extends Model$2>(parent: E, attributes: TGeneric, table: string, exists?: boolean): Pivot;
|
|
4185
|
+
static fromAttributes<E extends Model$2>(parent: E, attributes: TGeneric, table: string, exists?: boolean): Pivot;
|
|
4186
4186
|
hasTimestampAttributes(this: any, attributes?: TGeneric | null): boolean;
|
|
4187
4187
|
}
|
|
4188
4188
|
//#endregion
|
|
4189
4189
|
//#region types/utils.d.ts
|
|
4190
|
-
interface ICollection<T extends Model | Model$
|
|
4191
|
-
items?: T[];
|
|
4192
|
-
load(...relations: T[]): Promise<ICollection<T>>;
|
|
4193
|
-
loadAggregate(relations: T | T[], column: string, action?: string | null): Promise<this>;
|
|
4194
|
-
loadCount(relation: T, column: string): Promise<this>;
|
|
4195
|
-
loadMax(relation: T, column: string): Promise<this>;
|
|
4196
|
-
loadMin(relation: T, column: string): Promise<this>;
|
|
4197
|
-
loadSum(relation: T, column: string): Promise<this>;
|
|
4198
|
-
loadAvg(relation: T, column: string): Promise<this>;
|
|
4190
|
+
interface ICollection<T$1 extends Model$1 | Model$2> extends Collection<T$1> {
|
|
4191
|
+
items?: T$1[];
|
|
4192
|
+
load(...relations: T$1[]): Promise<ICollection<T$1>>;
|
|
4193
|
+
loadAggregate(relations: T$1 | T$1[], column: string, action?: string | null): Promise<this>;
|
|
4194
|
+
loadCount(relation: T$1, column: string): Promise<this>;
|
|
4195
|
+
loadMax(relation: T$1, column: string): Promise<this>;
|
|
4196
|
+
loadMin(relation: T$1, column: string): Promise<this>;
|
|
4197
|
+
loadSum(relation: T$1, column: string): Promise<this>;
|
|
4198
|
+
loadAvg(relation: T$1, column: string): Promise<this>;
|
|
4199
4199
|
mapThen(callback: () => void): Promise<any>;
|
|
4200
4200
|
modelKeys(): string[] | number[];
|
|
4201
4201
|
contains(key: IModel | any, operator?: any, value?: any): boolean;
|
|
4202
|
-
diff(items: ICollection<T> | any[]): ICollection<T>;
|
|
4203
|
-
except(keys: any[]): ICollection<T>;
|
|
4204
|
-
intersect(items: T[]): ICollection<T>;
|
|
4205
|
-
unique(key?: any, strict?: boolean): ICollection<T>;
|
|
4202
|
+
diff(items: ICollection<T$1> | any[]): ICollection<T$1>;
|
|
4203
|
+
except(keys: any[]): ICollection<T$1>;
|
|
4204
|
+
intersect(items: T$1[]): ICollection<T$1>;
|
|
4205
|
+
unique(key?: any, strict?: boolean): ICollection<T$1>;
|
|
4206
4206
|
find(key: any, defaultValue?: any): any;
|
|
4207
|
-
fresh(withs?: any[]): Promise<ICollection<T>>;
|
|
4207
|
+
fresh(withs?: any[]): Promise<ICollection<T$1>>;
|
|
4208
4208
|
makeVisible(attributes: string | string[]): this;
|
|
4209
4209
|
makeHidden(attributes: string | string[]): this;
|
|
4210
4210
|
append(attributes: string[]): this;
|
|
4211
4211
|
only(keys: null | any[]): this;
|
|
4212
4212
|
getDictionary(items?: any[]): TGeneric;
|
|
4213
|
-
toQuery(): IBuilder<T, any>;
|
|
4213
|
+
toQuery(): IBuilder<T$1, any>;
|
|
4214
4214
|
toData(): any;
|
|
4215
4215
|
toJSON(): any;
|
|
4216
4216
|
toJson(): string;
|
|
4217
4217
|
toString(): string;
|
|
4218
4218
|
[key: string]: any;
|
|
4219
|
-
[Symbol.iterator]: () => Iterator<T>;
|
|
4219
|
+
[Symbol.iterator]: () => Iterator<T$1>;
|
|
4220
4220
|
}
|
|
4221
4221
|
interface IPaginatorParams {
|
|
4222
4222
|
current_page: number;
|
|
@@ -4227,47 +4227,47 @@ interface IPaginatorParams {
|
|
|
4227
4227
|
count: number;
|
|
4228
4228
|
paginated?: boolean;
|
|
4229
4229
|
}
|
|
4230
|
-
interface IPaginator<T extends Model | Model$
|
|
4230
|
+
interface IPaginator<T$1 extends Model$1 | Model$2, K$1 extends IPaginatorParams = IPaginatorParams> {
|
|
4231
4231
|
formatter?(paginator: IPaginator<any>): any | null;
|
|
4232
4232
|
setFormatter?(formatter: (paginator: IPaginator<any>) => any | null): void;
|
|
4233
|
-
setItems(items: T[] | Collection$1<T>): void;
|
|
4233
|
+
setItems(items: T$1[] | Collection$1<T$1>): void;
|
|
4234
4234
|
hasMorePages(): boolean;
|
|
4235
|
-
get(index: number): T | null;
|
|
4235
|
+
get(index: number): T$1 | null;
|
|
4236
4236
|
count(): number;
|
|
4237
|
-
items(): Collection$1<T>;
|
|
4238
|
-
map(callback: (value: T, index: number) => T): Collection$1<T>;
|
|
4237
|
+
items(): Collection$1<T$1>;
|
|
4238
|
+
map(callback: (value: T$1, index: number) => T$1): Collection$1<T$1>;
|
|
4239
4239
|
currentPage(): number;
|
|
4240
4240
|
perPage(): number;
|
|
4241
4241
|
lastPage(): number;
|
|
4242
4242
|
firstItem(): number | null;
|
|
4243
4243
|
lastItem(): number | null;
|
|
4244
4244
|
total(): number;
|
|
4245
|
-
toData<U = K>(): U;
|
|
4246
|
-
toJSON<U = K>(): U;
|
|
4245
|
+
toData<U$1 = K$1>(): U$1;
|
|
4246
|
+
toJSON<U$1 = K$1>(): U$1;
|
|
4247
4247
|
toJson(): string;
|
|
4248
4248
|
[Symbol.iterator]?(): {
|
|
4249
4249
|
next: () => {
|
|
4250
|
-
value: T;
|
|
4250
|
+
value: T$1;
|
|
4251
4251
|
done: boolean;
|
|
4252
4252
|
};
|
|
4253
4253
|
};
|
|
4254
4254
|
}
|
|
4255
4255
|
//#endregion
|
|
4256
4256
|
//#region types/builder.d.ts
|
|
4257
|
-
type BaseBuilder<M extends Model | Model$
|
|
4257
|
+
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'>;
|
|
4258
4258
|
interface IScope {
|
|
4259
|
-
apply(builder: Builder<any>, model: Model): void;
|
|
4259
|
+
apply(builder: Builder<any>, model: Model$1): void;
|
|
4260
4260
|
}
|
|
4261
|
-
interface IBuilder<M extends Model | Model$
|
|
4262
|
-
connector: IQueryBuilder<M, R> & Knex.QueryBuilder & {
|
|
4261
|
+
interface IBuilder<M extends Model$1 | Model$2, R$1 = ICollection<M> | IModel> extends BaseBuilder<M, R$1> {
|
|
4262
|
+
connector: IQueryBuilder<M, R$1> & Knex.QueryBuilder & {
|
|
4263
4263
|
_statements: any[];
|
|
4264
4264
|
_single: any;
|
|
4265
4265
|
} & Knex;
|
|
4266
|
-
asProxy(): IQueryBuilder<M, R>;
|
|
4266
|
+
asProxy(): IQueryBuilder<M, R$1>;
|
|
4267
4267
|
chunk(count: number, callback: (rows: ICollection<M>) => any): Promise<boolean>;
|
|
4268
4268
|
enforceOrderBy(): void;
|
|
4269
4269
|
idOf(id: string | number): this;
|
|
4270
|
-
clone(): IBuilder<M, R>;
|
|
4270
|
+
clone(): IBuilder<M, R$1>;
|
|
4271
4271
|
forPage(page: number, perPage?: number): this;
|
|
4272
4272
|
insert(...attributes: any[]): Promise<any>;
|
|
4273
4273
|
update(attributes: any): Promise<any>;
|
|
@@ -4332,7 +4332,7 @@ interface IBuilder<M extends Model | Model$1, R = ICollection<M> | IModel> exten
|
|
|
4332
4332
|
oldest(column?: string): this;
|
|
4333
4333
|
find(key: string | number, columns?: string[]): Promise<M | null | undefined>;
|
|
4334
4334
|
findMany(keys: string[] | number[] | ICollection<any>, columns?: string[]): Promise<ICollection<M>>;
|
|
4335
|
-
pluck<X extends Model = any | M>(column: string): Promise<ICollection<X>>;
|
|
4335
|
+
pluck<X extends Model$1 = any | M>(column: string): Promise<ICollection<X>>;
|
|
4336
4336
|
destroy(ids?: string | number | string[] | number[] | TFunction | ICollection<any>): Promise<number>;
|
|
4337
4337
|
get(columns?: string[]): Promise<ICollection<M>>;
|
|
4338
4338
|
all(columns?: string[]): Promise<ICollection<M>>;
|
|
@@ -4347,8 +4347,8 @@ type FieldExpression = string;
|
|
|
4347
4347
|
type TableRef<QB extends AnyQueryBuilder> = ColumnRef | AnyQueryBuilder | CallbackVoid<QB>;
|
|
4348
4348
|
type Selection<QB extends AnyQueryBuilder> = ColumnRef | AnyQueryBuilder | CallbackVoid<QB>;
|
|
4349
4349
|
type QBOrCallback<QB extends AnyQueryBuilder> = AnyQueryBuilder | CallbackVoid<QB>;
|
|
4350
|
-
interface CallbackVoid<T> {
|
|
4351
|
-
(this: T, arg: T): void;
|
|
4350
|
+
interface CallbackVoid<T$1> {
|
|
4351
|
+
(this: T$1, arg: T$1): void;
|
|
4352
4352
|
}
|
|
4353
4353
|
type Raw = Knex.Raw;
|
|
4354
4354
|
type OrderByDirection = 'asc' | 'desc' | 'ASC' | 'DESC';
|
|
@@ -4356,11 +4356,11 @@ interface OrderByDescriptor {
|
|
|
4356
4356
|
column: ColumnRef;
|
|
4357
4357
|
order?: OrderByDirection;
|
|
4358
4358
|
}
|
|
4359
|
-
type AnyQueryBuilder<M extends Model = any, R = any> = IQueryBuilder<M, R> | IBuilder<M, R>;
|
|
4360
|
-
type Expression<T> = T | Raw | AnyQueryBuilder;
|
|
4359
|
+
type AnyQueryBuilder<M extends Model$1 = any, R$1 = any> = IQueryBuilder<M, R$1> | IBuilder<M, R$1>;
|
|
4360
|
+
type Expression<T$1> = T$1 | Raw | AnyQueryBuilder;
|
|
4361
4361
|
type ColumnRefOrOrderByDescriptor = ColumnRef | OrderByDescriptor;
|
|
4362
|
-
interface RawInterface<R> {
|
|
4363
|
-
(sql: string, ...bindings: any[]): R;
|
|
4362
|
+
interface RawInterface<R$1> {
|
|
4363
|
+
(sql: string, ...bindings: any[]): R$1;
|
|
4364
4364
|
}
|
|
4365
4365
|
interface BaseSetOperations<QB extends AnyQueryBuilder> {
|
|
4366
4366
|
(callbackOrBuilder: QBOrCallback<QB>, wrap?: boolean): QB;
|
|
@@ -4374,7 +4374,7 @@ interface GroupByMethod<QB extends AnyQueryBuilder> {
|
|
|
4374
4374
|
(columns: ColumnRef[]): QB;
|
|
4375
4375
|
}
|
|
4376
4376
|
type WithRelationType = {
|
|
4377
|
-
[key: string]: <T extends IBuilder<any>>(builder: T) => T | void;
|
|
4377
|
+
[key: string]: <T$1 extends IBuilder<any>>(builder: T$1) => T$1 | void;
|
|
4378
4378
|
} | string | string[];
|
|
4379
4379
|
interface SetOperationsMethod<QB extends AnyQueryBuilder> extends BaseSetOperations<QB> {
|
|
4380
4380
|
(...callbacksOrBuilders: QBOrCallback<QB>[]): QB;
|
|
@@ -4565,11 +4565,11 @@ interface IStatement {
|
|
|
4565
4565
|
nulls: boolean;
|
|
4566
4566
|
bool: 'and' | 'or' | 'not';
|
|
4567
4567
|
}
|
|
4568
|
-
interface IQueryBuilder<M extends Model | Model$
|
|
4569
|
-
query: IBuilder<M, R>;
|
|
4568
|
+
interface IQueryBuilder<M extends Model$1 | Model$2 = Model$1, R$1 = M[] | M> {
|
|
4569
|
+
query: IBuilder<M, R$1>;
|
|
4570
4570
|
schema: SchemaBuilder;
|
|
4571
4571
|
_statements: IStatement[];
|
|
4572
|
-
table(name: string): IQueryBuilder<M, R>;
|
|
4572
|
+
table(name: string): IQueryBuilder<M, R$1>;
|
|
4573
4573
|
select: SelectMethod<this>;
|
|
4574
4574
|
addSelect: AddSelectMethod<this>;
|
|
4575
4575
|
columns: SelectMethod<this>;
|
|
@@ -4578,7 +4578,7 @@ interface IQueryBuilder<M extends Model | Model$1 = Model, R = M[] | M> {
|
|
|
4578
4578
|
returning: ReturningMethod<this>;
|
|
4579
4579
|
distinctOn: SelectMethod<this>;
|
|
4580
4580
|
as: AsMethod<this>;
|
|
4581
|
-
asProxy(): IQueryBuilder<M, R>;
|
|
4581
|
+
asProxy(): IQueryBuilder<M, R$1>;
|
|
4582
4582
|
where: WhereMethod<this>;
|
|
4583
4583
|
firstOrFail: FirstOrFailMethod<this>;
|
|
4584
4584
|
forceDelete: ForceDeleteMethod;
|
|
@@ -4670,7 +4670,7 @@ interface IQueryBuilder<M extends Model | Model$1 = Model, R = M[] | M> {
|
|
|
4670
4670
|
transaction(callback?: TFunction): Promise<Knex.Transaction> | undefined;
|
|
4671
4671
|
destroy(callback: TFunction): Promise<number>;
|
|
4672
4672
|
destroy(): Promise<number>;
|
|
4673
|
-
clone(): IQueryBuilder<M, R>;
|
|
4673
|
+
clone(): IQueryBuilder<M, R$1>;
|
|
4674
4674
|
raw: Knex.RawQueryBuilder<TGeneric, M>;
|
|
4675
4675
|
get(columns?: string[]): Promise<any>;
|
|
4676
4676
|
first(columns?: string[]): Promise<M | null | undefined>;
|
|
@@ -4688,7 +4688,7 @@ interface IQueryBuilder<M extends Model | Model$1 = Model, R = M[] | M> {
|
|
|
4688
4688
|
take(count: number): this;
|
|
4689
4689
|
limit(count: number): this;
|
|
4690
4690
|
offset(count: number): this;
|
|
4691
|
-
pluck<X extends Model = any>(column: string): Promise<Array<X>>;
|
|
4691
|
+
pluck<X extends Model$1 = any>(column: string): Promise<Array<X>>;
|
|
4692
4692
|
chunk(count: number, callback: (rows: M[]) => any): Promise<boolean>;
|
|
4693
4693
|
forPage(page: number, perPage?: number): this;
|
|
4694
4694
|
paginate<F extends IPaginatorParams>(page?: number, perPage?: number): Promise<IPaginator<M, F>>;
|
|
@@ -4696,19 +4696,19 @@ interface IQueryBuilder<M extends Model | Model$1 = Model, R = M[] | M> {
|
|
|
4696
4696
|
//#endregion
|
|
4697
4697
|
//#region src/query-builder.d.ts
|
|
4698
4698
|
declare const Inference$1: {
|
|
4699
|
-
new <M extends Model = Model, R = M[] | M>(): IQueryBuilder<M, R>;
|
|
4699
|
+
new <M extends Model$1 = Model$1, R$1 = M[] | M>(): IQueryBuilder<M, R$1>;
|
|
4700
4700
|
};
|
|
4701
|
-
declare class QueryBuilder<M extends Model = Model, R = M[] | M> extends Inference$1<M, R> {
|
|
4701
|
+
declare class QueryBuilder<M extends Model$1 = Model$1, R$1 = M[] | M> extends Inference$1<M, R$1> {
|
|
4702
4702
|
model: M;
|
|
4703
4703
|
schema: SchemaBuilder;
|
|
4704
|
-
connector: IQueryBuilder<M, R> & Knex.QueryBuilder & {
|
|
4704
|
+
connector: IQueryBuilder<M, R$1> & Knex.QueryBuilder & {
|
|
4705
4705
|
_statements: any[];
|
|
4706
4706
|
_single: any;
|
|
4707
4707
|
} & Knex;
|
|
4708
4708
|
constructor(config: TConfig | null, connector: TFunction);
|
|
4709
4709
|
asProxy(): any;
|
|
4710
4710
|
beginTransaction(): Promise<Knex.Transaction<any, any[]>>;
|
|
4711
|
-
table<X extends M>(table: string): IQueryBuilder<X, R>;
|
|
4711
|
+
table<X extends M>(table: string): IQueryBuilder<X, R$1>;
|
|
4712
4712
|
transaction(callback?: TFunction): Promise<Knex.Transaction> | undefined;
|
|
4713
4713
|
find(id: string | number, columns?: string[]): Promise<any>;
|
|
4714
4714
|
get(_columns?: string[]): Promise<any>;
|
|
@@ -4724,7 +4724,7 @@ declare class QueryBuilder<M extends Model = Model, R = M[] | M> extends Inferen
|
|
|
4724
4724
|
max(column: string): Promise<number>;
|
|
4725
4725
|
sum(column: string): Promise<number>;
|
|
4726
4726
|
avg(column: string): Promise<number>;
|
|
4727
|
-
clone(): IQueryBuilder<M, R>;
|
|
4727
|
+
clone(): IQueryBuilder<M, R$1>;
|
|
4728
4728
|
delete(): Promise<number | boolean>;
|
|
4729
4729
|
insert(...args: Parameters<typeof this.connector.insert>): Promise<unknown>;
|
|
4730
4730
|
update(...args: Parameters<typeof this.connector.update>): Promise<number>;
|
|
@@ -4769,8 +4769,8 @@ declare class MigrationRepository {
|
|
|
4769
4769
|
createRepository(): Promise<void>;
|
|
4770
4770
|
repositoryExists(): Promise<boolean>;
|
|
4771
4771
|
deleteRepository(): Promise<void>;
|
|
4772
|
-
getTable(): IQueryBuilder<Model, Model | Model[]>;
|
|
4773
|
-
getConnection(): QueryBuilder<Model, Model | Model[]>;
|
|
4772
|
+
getTable(): IQueryBuilder<Model$1, Model$1 | Model$1[]>;
|
|
4773
|
+
getConnection(): QueryBuilder<Model$1, Model$1 | Model$1[]>;
|
|
4774
4774
|
setSource(name: TBaseConfig['client']): void;
|
|
4775
4775
|
}
|
|
4776
4776
|
declare namespace migrator_d_exports {
|