@h3ravel/arquebus 0.3.6 → 0.4.0
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/bin/index.cjs +4269 -2733
- package/bin/index.js +4364 -2828
- package/dist/browser/index.cjs +2 -0
- package/dist/browser/index.d.cts +94 -7
- package/dist/browser/index.d.ts +94 -7
- package/dist/browser/index.js +2 -1
- package/dist/index.cjs +1501 -15
- package/dist/index.d.cts +130 -10
- package/dist/index.d.ts +130 -10
- package/dist/index.js +1501 -16
- package/dist/inspector/index.cjs +4885 -0
- package/dist/inspector/index.d.cts +83 -0
- package/dist/inspector/index.d.ts +83 -0
- package/dist/inspector/index.js +4859 -0
- package/dist/migrations/index.cjs +4389 -2904
- package/dist/migrations/index.d.cts +128 -9
- package/dist/migrations/index.d.ts +129 -10
- package/dist/migrations/index.js +4275 -2790
- package/package.json +12 -3
- package/types/query-builder.ts +37 -1
- package/src/migrations/stubs/migration-js.stub +0 -21
- package/src/migrations/stubs/migration-ts.stub +0 -18
- package/src/migrations/stubs/migration.create-js.stub +0 -24
- package/src/migrations/stubs/migration.create-ts.stub +0 -21
- package/src/migrations/stubs/migration.update-js.stub +0 -25
- package/src/migrations/stubs/migration.update-ts.stub +0 -22
- package/src/stubs/arquebus.config-js.stub +0 -25
- package/src/stubs/arquebus.config-ts.stub +0 -24
- package/src/stubs/model-js.stub +0 -5
- package/src/stubs/model-ts.stub +0 -5
package/dist/index.d.cts
CHANGED
|
@@ -251,9 +251,92 @@ declare class Builder<M extends Model$1 = Model$1, R = IModel | ICollection<M>>
|
|
|
251
251
|
hydrate(items: any[]): Collection<any>;
|
|
252
252
|
}
|
|
253
253
|
//#endregion
|
|
254
|
+
//#region src/inspector/types/column.d.ts
|
|
255
|
+
interface Column {
|
|
256
|
+
name: string;
|
|
257
|
+
table: string;
|
|
258
|
+
data_type: string;
|
|
259
|
+
default_value: string | null;
|
|
260
|
+
max_length: number | null;
|
|
261
|
+
numeric_precision: number | null;
|
|
262
|
+
numeric_scale: number | null;
|
|
263
|
+
is_nullable: boolean;
|
|
264
|
+
is_unique: boolean;
|
|
265
|
+
is_primary_key: boolean;
|
|
266
|
+
is_generated: boolean;
|
|
267
|
+
generation_expression?: string | null;
|
|
268
|
+
has_auto_increment: boolean;
|
|
269
|
+
foreign_key_table: string | null;
|
|
270
|
+
foreign_key_column: string | null;
|
|
271
|
+
comment?: string | null;
|
|
272
|
+
schema?: string;
|
|
273
|
+
foreign_key_schema?: string | null;
|
|
274
|
+
collation?: string | null;
|
|
275
|
+
}
|
|
276
|
+
//#endregion
|
|
277
|
+
//#region src/inspector/types/foreign-key.d.ts
|
|
278
|
+
type ForeignKey = {
|
|
279
|
+
table: string;
|
|
280
|
+
column: string;
|
|
281
|
+
foreign_key_table: string;
|
|
282
|
+
foreign_key_column: string;
|
|
283
|
+
foreign_key_schema?: string;
|
|
284
|
+
constraint_name: null | string;
|
|
285
|
+
on_update: null | 'NO ACTION' | 'RESTRICT' | 'CASCADE' | 'SET NULL' | 'SET DEFAULT';
|
|
286
|
+
on_delete: null | 'NO ACTION' | 'RESTRICT' | 'CASCADE' | 'SET NULL' | 'SET DEFAULT';
|
|
287
|
+
};
|
|
288
|
+
//#endregion
|
|
289
|
+
//#region src/inspector/types/table.d.ts
|
|
290
|
+
interface Table {
|
|
291
|
+
name: string;
|
|
292
|
+
comment?: string | null;
|
|
293
|
+
schema?: string;
|
|
294
|
+
collation?: string;
|
|
295
|
+
engine?: string;
|
|
296
|
+
owner?: string;
|
|
297
|
+
sql?: string;
|
|
298
|
+
catalog?: string;
|
|
299
|
+
}
|
|
300
|
+
//#endregion
|
|
254
301
|
//#region types/query-builder.d.ts
|
|
255
302
|
interface SchemaBuilder extends Knex.SchemaBuilder {
|
|
256
303
|
[k: string]: any;
|
|
304
|
+
/**
|
|
305
|
+
* Retrieve all tables in the current database.
|
|
306
|
+
*/
|
|
307
|
+
tables(): Promise<string[]>;
|
|
308
|
+
/**
|
|
309
|
+
* Retrieve the table info for the given table, or all tables if no table is specified.
|
|
310
|
+
*
|
|
311
|
+
* @param table
|
|
312
|
+
*/
|
|
313
|
+
tableInfo(table?: string): Promise<Table | Table[]>;
|
|
314
|
+
/**
|
|
315
|
+
* Retrieve all columns in a given table, or all columns if no table is specified.
|
|
316
|
+
*
|
|
317
|
+
* @param table
|
|
318
|
+
*/
|
|
319
|
+
columns(table?: string): Promise<{
|
|
320
|
+
table: string;
|
|
321
|
+
column: string;
|
|
322
|
+
}[]>;
|
|
323
|
+
/**
|
|
324
|
+
* Retrieve all columns from a given table. Returns all columns if table parameter is undefined.
|
|
325
|
+
*
|
|
326
|
+
* @param table
|
|
327
|
+
* @param column
|
|
328
|
+
*/
|
|
329
|
+
columnInfo(table?: string, column?: string): Promise<Column[] | Column>;
|
|
330
|
+
/**
|
|
331
|
+
* Retrieve the primary key column for a given table.
|
|
332
|
+
*
|
|
333
|
+
* @param table
|
|
334
|
+
*/
|
|
335
|
+
primary(table: string): Promise<string>;
|
|
336
|
+
/**
|
|
337
|
+
* Retrieve all configured foreign key constraints
|
|
338
|
+
*/
|
|
339
|
+
foreignKeys(): Promise<ForeignKey>;
|
|
257
340
|
}
|
|
258
341
|
interface AsMethod<QB extends AnyQueryBuilder> {
|
|
259
342
|
(alias: string): QB;
|
|
@@ -384,7 +467,7 @@ interface IQueryBuilder<M extends Model$1 | Model$2 = Model$1, R = M[] | M> {
|
|
|
384
467
|
take(count: number): this;
|
|
385
468
|
limit(count: number): this;
|
|
386
469
|
offset(count: number): this;
|
|
387
|
-
pluck<X extends Model$1 = any>(column: string): Promise<
|
|
470
|
+
pluck<X extends Model$1 = any>(column: string): Promise<Array<X>>;
|
|
388
471
|
chunk(count: number, callback: (rows: M[]) => any): Promise<boolean>;
|
|
389
472
|
forPage(page: number, perPage?: number): this;
|
|
390
473
|
paginate<F extends IPaginatorParams>(page?: number, perPage?: number): Promise<IPaginator<M, F>>;
|
|
@@ -577,10 +660,13 @@ declare const Inference$1: {
|
|
|
577
660
|
declare class QueryBuilder<M extends Model$1 = Model$1, R = M[] | M> extends Inference$1<M, R> {
|
|
578
661
|
model: M;
|
|
579
662
|
schema: SchemaBuilder;
|
|
580
|
-
|
|
663
|
+
connector: IQueryBuilder<M, R> & Knex.QueryBuilder & {
|
|
664
|
+
_statements: any[];
|
|
665
|
+
_single: any;
|
|
666
|
+
} & Knex;
|
|
581
667
|
constructor(config: TConfig | null, connector: TFunction);
|
|
582
668
|
asProxy(): any;
|
|
583
|
-
beginTransaction(): Promise<Knex.Transaction<any, any[]
|
|
669
|
+
beginTransaction(): Promise<Knex.Transaction<any, any[]>>;
|
|
584
670
|
table<X extends M>(table: string): IQueryBuilder<X, R>;
|
|
585
671
|
transaction(callback?: TFunction): Promise<Knex.Transaction> | undefined;
|
|
586
672
|
find(id: string | number, columns?: string[]): Promise<any>;
|
|
@@ -604,7 +690,7 @@ declare class QueryBuilder<M extends Model$1 = Model$1, R = M[] | M> extends Inf
|
|
|
604
690
|
destroy(...args: Parameters<typeof (void 0).connector.destroy>): Promise<number>;
|
|
605
691
|
get _statements(): IStatement[] & any[];
|
|
606
692
|
get _single(): any;
|
|
607
|
-
get from(): Knex.Table<any, any>;
|
|
693
|
+
get from(): Knex.Table<any, any> & Knex.Table<any, any[]>;
|
|
608
694
|
}
|
|
609
695
|
//#endregion
|
|
610
696
|
//#region src/relations/relation.d.ts
|
|
@@ -913,7 +999,7 @@ declare class arquebus<M extends Model$1 = Model$1> {
|
|
|
913
999
|
static setConnectorFactory(connectorFactory: typeof Knex$1): void;
|
|
914
1000
|
static getConnectorFactory(): typeof Knex$1;
|
|
915
1001
|
static addConnection(config: TConfig | TBaseConfig, name?: string): void;
|
|
916
|
-
static beginTransaction(connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]
|
|
1002
|
+
static beginTransaction(connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]>>;
|
|
917
1003
|
static transaction(callback: TFunction, connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]>> | undefined;
|
|
918
1004
|
static table(name: string, connection?: null): IQueryBuilder<Model$1, Model$1 | Model$1[]>;
|
|
919
1005
|
static schema(connection?: null): SchemaBuilder;
|
|
@@ -933,7 +1019,7 @@ declare class arquebus<M extends Model$1 = Model$1> {
|
|
|
933
1019
|
* @returns
|
|
934
1020
|
*/
|
|
935
1021
|
static autoLoad(addConnection?: boolean): Promise<TBaseConfig>;
|
|
936
|
-
beginTransaction(connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]
|
|
1022
|
+
beginTransaction(connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]>>;
|
|
937
1023
|
transaction(callback: TFunction, connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]>> | undefined;
|
|
938
1024
|
table(name: string, connection?: null): IQueryBuilder<M, M | M[]>;
|
|
939
1025
|
schema(connection?: null): SchemaBuilder;
|
|
@@ -1234,7 +1320,7 @@ declare class MigrationRepository {
|
|
|
1234
1320
|
table: string;
|
|
1235
1321
|
connection: TBaseConfig['client'] | null;
|
|
1236
1322
|
constructor(resolver: typeof arquebus, table: string);
|
|
1237
|
-
getRan(): Promise<
|
|
1323
|
+
getRan(): Promise<any[]>;
|
|
1238
1324
|
getMigrations(steps: number): Promise<any>;
|
|
1239
1325
|
getMigrationsByBatch(batch: number): Promise<any>;
|
|
1240
1326
|
getLast(): Promise<any>;
|
|
@@ -1256,6 +1342,7 @@ interface MigrationOptions {
|
|
|
1256
1342
|
pretend?: boolean;
|
|
1257
1343
|
step?: number;
|
|
1258
1344
|
batch?: number;
|
|
1345
|
+
quiet?: boolean;
|
|
1259
1346
|
}
|
|
1260
1347
|
declare class Migrator {
|
|
1261
1348
|
events: any;
|
|
@@ -1280,7 +1367,14 @@ declare class Migrator {
|
|
|
1280
1367
|
rollbackMigrations(migrations: {
|
|
1281
1368
|
migration: string;
|
|
1282
1369
|
}[], paths: string[], options: MigrationOptions): Promise<string[]>;
|
|
1283
|
-
reset(
|
|
1370
|
+
reset(paths: string[] | undefined, options: MigrationOptions, pretend?: boolean): Promise<string[]>;
|
|
1371
|
+
/**
|
|
1372
|
+
* Drop all tables and re-run all migrations
|
|
1373
|
+
*
|
|
1374
|
+
* @param paths
|
|
1375
|
+
* @param options
|
|
1376
|
+
*/
|
|
1377
|
+
fresh(paths: string[], options: MigrationOptions): Promise<void>;
|
|
1284
1378
|
resetMigrations(migrations: {
|
|
1285
1379
|
migration: string;
|
|
1286
1380
|
}[], paths: string[], pretend?: boolean): Promise<string[]>;
|
|
@@ -1300,7 +1394,7 @@ declare class Migrator {
|
|
|
1300
1394
|
deleteRepository(): void;
|
|
1301
1395
|
setOutput(output: boolean): this;
|
|
1302
1396
|
write(...args: any[]): void;
|
|
1303
|
-
|
|
1397
|
+
taskRunner(description: string, task: (() => Promise<any>) | (() => any)): Promise<void>;
|
|
1304
1398
|
}
|
|
1305
1399
|
//#endregion
|
|
1306
1400
|
//#region src/migrate.d.ts
|
|
@@ -1314,6 +1408,7 @@ interface MigrateOptions {
|
|
|
1314
1408
|
step?: number;
|
|
1315
1409
|
pretend?: boolean;
|
|
1316
1410
|
batch?: number;
|
|
1411
|
+
quiet?: boolean;
|
|
1317
1412
|
}
|
|
1318
1413
|
type TXBaseConfig<S = boolean> = (S extends true ? Partial<TBaseConfig> : TBaseConfig) & {
|
|
1319
1414
|
/**
|
|
@@ -1345,6 +1440,30 @@ declare class Migrate {
|
|
|
1345
1440
|
* @param destroyAll
|
|
1346
1441
|
*/
|
|
1347
1442
|
rollback(config: TXBaseConfig, options?: MigrateOptions, destroyAll?: boolean): Promise<void>;
|
|
1443
|
+
/**
|
|
1444
|
+
* Rollback all database migrations
|
|
1445
|
+
*
|
|
1446
|
+
* @param config
|
|
1447
|
+
* @param options
|
|
1448
|
+
* @param destroyAll
|
|
1449
|
+
*/
|
|
1450
|
+
reset(config: TXBaseConfig, options?: MigrateOptions, destroyAll?: boolean): Promise<void>;
|
|
1451
|
+
/**
|
|
1452
|
+
* Reset and re-run all migrations
|
|
1453
|
+
*
|
|
1454
|
+
* @param config
|
|
1455
|
+
* @param options
|
|
1456
|
+
* @param destroyAll
|
|
1457
|
+
*/
|
|
1458
|
+
refresh(config: TXBaseConfig, options?: MigrateOptions, destroyAll?: boolean): Promise<void>;
|
|
1459
|
+
/**
|
|
1460
|
+
* Drop all tables and re-run all migrations
|
|
1461
|
+
*
|
|
1462
|
+
* @param config
|
|
1463
|
+
* @param options
|
|
1464
|
+
* @param destroyAll
|
|
1465
|
+
*/
|
|
1466
|
+
fresh(config: TXBaseConfig, options?: MigrateOptions, destroyAll?: boolean): Promise<void>;
|
|
1348
1467
|
/**
|
|
1349
1468
|
* Prepares the database for migration
|
|
1350
1469
|
*
|
|
@@ -1492,6 +1611,7 @@ declare const getAttrName: (attrMethod: string) => string;
|
|
|
1492
1611
|
*/
|
|
1493
1612
|
declare const tap: <I>(instance: I, callback: (ins: I) => Promise<I> | I) => Promise<I> | I;
|
|
1494
1613
|
declare const compose: typeof compose$1;
|
|
1614
|
+
declare const flatten: <A = any>(arr: A[]) => (A extends readonly (infer InnerArr)[] ? InnerArr : A)[];
|
|
1495
1615
|
declare const flattenDeep: (arr: any) => any;
|
|
1496
1616
|
declare const kebabCase: (str: string) => string;
|
|
1497
1617
|
declare const snakeCase: (str: string) => string;
|
|
@@ -1504,4 +1624,4 @@ declare const make: (model: Model$1, data: TGeneric, options?: {
|
|
|
1504
1624
|
declare const makeCollection: (model: Model$1, data: TGeneric) => Collection<Model$1 | Model$2>;
|
|
1505
1625
|
declare const makePaginator: (model: Model$1, data: TGeneric) => Paginator<Model$1, IPaginatorParams>;
|
|
1506
1626
|
//#endregion
|
|
1507
|
-
export { Attribute, Builder, CastsAttributes, Collection, HasUniqueIds, InvalidArgumentError, Migrate, Migration, Model$1 as Model, ModelNotFoundError, Paginator, Pivot, QueryBuilder, RelationNotFoundError, Scope, softDeletes as SoftDeletes, arquebus, compose, defineConfig, flattenDeep, getAttrMethod, getAttrName, getGetterMethod, getRelationMethod, getRelationName, getScopeMethod, getScopeName, getSetterMethod, kebabCase, make, makeCollection, makePaginator, now, snakeCase, tap };
|
|
1627
|
+
export { Attribute, Builder, CastsAttributes, Collection, HasUniqueIds, InvalidArgumentError, Migrate, Migration, Model$1 as Model, ModelNotFoundError, Paginator, Pivot, QueryBuilder, RelationNotFoundError, Scope, softDeletes as SoftDeletes, arquebus, compose, defineConfig, flatten, flattenDeep, getAttrMethod, getAttrName, getGetterMethod, getRelationMethod, getRelationName, getScopeMethod, getScopeName, getSetterMethod, kebabCase, make, makeCollection, makePaginator, now, snakeCase, tap };
|
package/dist/index.d.ts
CHANGED
|
@@ -251,9 +251,92 @@ declare class Builder<M extends Model$1 = Model$1, R = IModel | ICollection<M>>
|
|
|
251
251
|
hydrate(items: any[]): Collection<any>;
|
|
252
252
|
}
|
|
253
253
|
//#endregion
|
|
254
|
+
//#region src/inspector/types/column.d.ts
|
|
255
|
+
interface Column {
|
|
256
|
+
name: string;
|
|
257
|
+
table: string;
|
|
258
|
+
data_type: string;
|
|
259
|
+
default_value: string | null;
|
|
260
|
+
max_length: number | null;
|
|
261
|
+
numeric_precision: number | null;
|
|
262
|
+
numeric_scale: number | null;
|
|
263
|
+
is_nullable: boolean;
|
|
264
|
+
is_unique: boolean;
|
|
265
|
+
is_primary_key: boolean;
|
|
266
|
+
is_generated: boolean;
|
|
267
|
+
generation_expression?: string | null;
|
|
268
|
+
has_auto_increment: boolean;
|
|
269
|
+
foreign_key_table: string | null;
|
|
270
|
+
foreign_key_column: string | null;
|
|
271
|
+
comment?: string | null;
|
|
272
|
+
schema?: string;
|
|
273
|
+
foreign_key_schema?: string | null;
|
|
274
|
+
collation?: string | null;
|
|
275
|
+
}
|
|
276
|
+
//#endregion
|
|
277
|
+
//#region src/inspector/types/foreign-key.d.ts
|
|
278
|
+
type ForeignKey = {
|
|
279
|
+
table: string;
|
|
280
|
+
column: string;
|
|
281
|
+
foreign_key_table: string;
|
|
282
|
+
foreign_key_column: string;
|
|
283
|
+
foreign_key_schema?: string;
|
|
284
|
+
constraint_name: null | string;
|
|
285
|
+
on_update: null | 'NO ACTION' | 'RESTRICT' | 'CASCADE' | 'SET NULL' | 'SET DEFAULT';
|
|
286
|
+
on_delete: null | 'NO ACTION' | 'RESTRICT' | 'CASCADE' | 'SET NULL' | 'SET DEFAULT';
|
|
287
|
+
};
|
|
288
|
+
//#endregion
|
|
289
|
+
//#region src/inspector/types/table.d.ts
|
|
290
|
+
interface Table {
|
|
291
|
+
name: string;
|
|
292
|
+
comment?: string | null;
|
|
293
|
+
schema?: string;
|
|
294
|
+
collation?: string;
|
|
295
|
+
engine?: string;
|
|
296
|
+
owner?: string;
|
|
297
|
+
sql?: string;
|
|
298
|
+
catalog?: string;
|
|
299
|
+
}
|
|
300
|
+
//#endregion
|
|
254
301
|
//#region types/query-builder.d.ts
|
|
255
302
|
interface SchemaBuilder extends Knex.SchemaBuilder {
|
|
256
303
|
[k: string]: any;
|
|
304
|
+
/**
|
|
305
|
+
* Retrieve all tables in the current database.
|
|
306
|
+
*/
|
|
307
|
+
tables(): Promise<string[]>;
|
|
308
|
+
/**
|
|
309
|
+
* Retrieve the table info for the given table, or all tables if no table is specified.
|
|
310
|
+
*
|
|
311
|
+
* @param table
|
|
312
|
+
*/
|
|
313
|
+
tableInfo(table?: string): Promise<Table | Table[]>;
|
|
314
|
+
/**
|
|
315
|
+
* Retrieve all columns in a given table, or all columns if no table is specified.
|
|
316
|
+
*
|
|
317
|
+
* @param table
|
|
318
|
+
*/
|
|
319
|
+
columns(table?: string): Promise<{
|
|
320
|
+
table: string;
|
|
321
|
+
column: string;
|
|
322
|
+
}[]>;
|
|
323
|
+
/**
|
|
324
|
+
* Retrieve all columns from a given table. Returns all columns if table parameter is undefined.
|
|
325
|
+
*
|
|
326
|
+
* @param table
|
|
327
|
+
* @param column
|
|
328
|
+
*/
|
|
329
|
+
columnInfo(table?: string, column?: string): Promise<Column[] | Column>;
|
|
330
|
+
/**
|
|
331
|
+
* Retrieve the primary key column for a given table.
|
|
332
|
+
*
|
|
333
|
+
* @param table
|
|
334
|
+
*/
|
|
335
|
+
primary(table: string): Promise<string>;
|
|
336
|
+
/**
|
|
337
|
+
* Retrieve all configured foreign key constraints
|
|
338
|
+
*/
|
|
339
|
+
foreignKeys(): Promise<ForeignKey>;
|
|
257
340
|
}
|
|
258
341
|
interface AsMethod<QB extends AnyQueryBuilder> {
|
|
259
342
|
(alias: string): QB;
|
|
@@ -384,7 +467,7 @@ interface IQueryBuilder<M extends Model$1 | Model$2 = Model$1, R = M[] | M> {
|
|
|
384
467
|
take(count: number): this;
|
|
385
468
|
limit(count: number): this;
|
|
386
469
|
offset(count: number): this;
|
|
387
|
-
pluck<X extends Model$1 = any>(column: string): Promise<
|
|
470
|
+
pluck<X extends Model$1 = any>(column: string): Promise<Array<X>>;
|
|
388
471
|
chunk(count: number, callback: (rows: M[]) => any): Promise<boolean>;
|
|
389
472
|
forPage(page: number, perPage?: number): this;
|
|
390
473
|
paginate<F extends IPaginatorParams>(page?: number, perPage?: number): Promise<IPaginator<M, F>>;
|
|
@@ -577,10 +660,13 @@ declare const Inference$1: {
|
|
|
577
660
|
declare class QueryBuilder<M extends Model$1 = Model$1, R = M[] | M> extends Inference$1<M, R> {
|
|
578
661
|
model: M;
|
|
579
662
|
schema: SchemaBuilder;
|
|
580
|
-
|
|
663
|
+
connector: IQueryBuilder<M, R> & Knex.QueryBuilder & {
|
|
664
|
+
_statements: any[];
|
|
665
|
+
_single: any;
|
|
666
|
+
} & Knex;
|
|
581
667
|
constructor(config: TConfig | null, connector: TFunction);
|
|
582
668
|
asProxy(): any;
|
|
583
|
-
beginTransaction(): Promise<Knex.Transaction<any, any[]
|
|
669
|
+
beginTransaction(): Promise<Knex.Transaction<any, any[]>>;
|
|
584
670
|
table<X extends M>(table: string): IQueryBuilder<X, R>;
|
|
585
671
|
transaction(callback?: TFunction): Promise<Knex.Transaction> | undefined;
|
|
586
672
|
find(id: string | number, columns?: string[]): Promise<any>;
|
|
@@ -604,7 +690,7 @@ declare class QueryBuilder<M extends Model$1 = Model$1, R = M[] | M> extends Inf
|
|
|
604
690
|
destroy(...args: Parameters<typeof (void 0).connector.destroy>): Promise<number>;
|
|
605
691
|
get _statements(): IStatement[] & any[];
|
|
606
692
|
get _single(): any;
|
|
607
|
-
get from(): Knex.Table<any, any>;
|
|
693
|
+
get from(): Knex.Table<any, any> & Knex.Table<any, any[]>;
|
|
608
694
|
}
|
|
609
695
|
//#endregion
|
|
610
696
|
//#region src/relations/relation.d.ts
|
|
@@ -913,7 +999,7 @@ declare class arquebus<M extends Model$1 = Model$1> {
|
|
|
913
999
|
static setConnectorFactory(connectorFactory: typeof Knex$1): void;
|
|
914
1000
|
static getConnectorFactory(): typeof Knex$1;
|
|
915
1001
|
static addConnection(config: TConfig | TBaseConfig, name?: string): void;
|
|
916
|
-
static beginTransaction(connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]
|
|
1002
|
+
static beginTransaction(connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]>>;
|
|
917
1003
|
static transaction(callback: TFunction, connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]>> | undefined;
|
|
918
1004
|
static table(name: string, connection?: null): IQueryBuilder<Model$1, Model$1 | Model$1[]>;
|
|
919
1005
|
static schema(connection?: null): SchemaBuilder;
|
|
@@ -933,7 +1019,7 @@ declare class arquebus<M extends Model$1 = Model$1> {
|
|
|
933
1019
|
* @returns
|
|
934
1020
|
*/
|
|
935
1021
|
static autoLoad(addConnection?: boolean): Promise<TBaseConfig>;
|
|
936
|
-
beginTransaction(connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]
|
|
1022
|
+
beginTransaction(connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]>>;
|
|
937
1023
|
transaction(callback: TFunction, connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]>> | undefined;
|
|
938
1024
|
table(name: string, connection?: null): IQueryBuilder<M, M | M[]>;
|
|
939
1025
|
schema(connection?: null): SchemaBuilder;
|
|
@@ -1234,7 +1320,7 @@ declare class MigrationRepository {
|
|
|
1234
1320
|
table: string;
|
|
1235
1321
|
connection: TBaseConfig['client'] | null;
|
|
1236
1322
|
constructor(resolver: typeof arquebus, table: string);
|
|
1237
|
-
getRan(): Promise<
|
|
1323
|
+
getRan(): Promise<any[]>;
|
|
1238
1324
|
getMigrations(steps: number): Promise<any>;
|
|
1239
1325
|
getMigrationsByBatch(batch: number): Promise<any>;
|
|
1240
1326
|
getLast(): Promise<any>;
|
|
@@ -1256,6 +1342,7 @@ interface MigrationOptions {
|
|
|
1256
1342
|
pretend?: boolean;
|
|
1257
1343
|
step?: number;
|
|
1258
1344
|
batch?: number;
|
|
1345
|
+
quiet?: boolean;
|
|
1259
1346
|
}
|
|
1260
1347
|
declare class Migrator {
|
|
1261
1348
|
events: any;
|
|
@@ -1280,7 +1367,14 @@ declare class Migrator {
|
|
|
1280
1367
|
rollbackMigrations(migrations: {
|
|
1281
1368
|
migration: string;
|
|
1282
1369
|
}[], paths: string[], options: MigrationOptions): Promise<string[]>;
|
|
1283
|
-
reset(
|
|
1370
|
+
reset(paths: string[] | undefined, options: MigrationOptions, pretend?: boolean): Promise<string[]>;
|
|
1371
|
+
/**
|
|
1372
|
+
* Drop all tables and re-run all migrations
|
|
1373
|
+
*
|
|
1374
|
+
* @param paths
|
|
1375
|
+
* @param options
|
|
1376
|
+
*/
|
|
1377
|
+
fresh(paths: string[], options: MigrationOptions): Promise<void>;
|
|
1284
1378
|
resetMigrations(migrations: {
|
|
1285
1379
|
migration: string;
|
|
1286
1380
|
}[], paths: string[], pretend?: boolean): Promise<string[]>;
|
|
@@ -1300,7 +1394,7 @@ declare class Migrator {
|
|
|
1300
1394
|
deleteRepository(): void;
|
|
1301
1395
|
setOutput(output: boolean): this;
|
|
1302
1396
|
write(...args: any[]): void;
|
|
1303
|
-
|
|
1397
|
+
taskRunner(description: string, task: (() => Promise<any>) | (() => any)): Promise<void>;
|
|
1304
1398
|
}
|
|
1305
1399
|
//#endregion
|
|
1306
1400
|
//#region src/migrate.d.ts
|
|
@@ -1314,6 +1408,7 @@ interface MigrateOptions {
|
|
|
1314
1408
|
step?: number;
|
|
1315
1409
|
pretend?: boolean;
|
|
1316
1410
|
batch?: number;
|
|
1411
|
+
quiet?: boolean;
|
|
1317
1412
|
}
|
|
1318
1413
|
type TXBaseConfig<S = boolean> = (S extends true ? Partial<TBaseConfig> : TBaseConfig) & {
|
|
1319
1414
|
/**
|
|
@@ -1345,6 +1440,30 @@ declare class Migrate {
|
|
|
1345
1440
|
* @param destroyAll
|
|
1346
1441
|
*/
|
|
1347
1442
|
rollback(config: TXBaseConfig, options?: MigrateOptions, destroyAll?: boolean): Promise<void>;
|
|
1443
|
+
/**
|
|
1444
|
+
* Rollback all database migrations
|
|
1445
|
+
*
|
|
1446
|
+
* @param config
|
|
1447
|
+
* @param options
|
|
1448
|
+
* @param destroyAll
|
|
1449
|
+
*/
|
|
1450
|
+
reset(config: TXBaseConfig, options?: MigrateOptions, destroyAll?: boolean): Promise<void>;
|
|
1451
|
+
/**
|
|
1452
|
+
* Reset and re-run all migrations
|
|
1453
|
+
*
|
|
1454
|
+
* @param config
|
|
1455
|
+
* @param options
|
|
1456
|
+
* @param destroyAll
|
|
1457
|
+
*/
|
|
1458
|
+
refresh(config: TXBaseConfig, options?: MigrateOptions, destroyAll?: boolean): Promise<void>;
|
|
1459
|
+
/**
|
|
1460
|
+
* Drop all tables and re-run all migrations
|
|
1461
|
+
*
|
|
1462
|
+
* @param config
|
|
1463
|
+
* @param options
|
|
1464
|
+
* @param destroyAll
|
|
1465
|
+
*/
|
|
1466
|
+
fresh(config: TXBaseConfig, options?: MigrateOptions, destroyAll?: boolean): Promise<void>;
|
|
1348
1467
|
/**
|
|
1349
1468
|
* Prepares the database for migration
|
|
1350
1469
|
*
|
|
@@ -1492,6 +1611,7 @@ declare const getAttrName: (attrMethod: string) => string;
|
|
|
1492
1611
|
*/
|
|
1493
1612
|
declare const tap: <I>(instance: I, callback: (ins: I) => Promise<I> | I) => Promise<I> | I;
|
|
1494
1613
|
declare const compose: typeof compose$1;
|
|
1614
|
+
declare const flatten: <A = any>(arr: A[]) => (A extends readonly (infer InnerArr)[] ? InnerArr : A)[];
|
|
1495
1615
|
declare const flattenDeep: (arr: any) => any;
|
|
1496
1616
|
declare const kebabCase: (str: string) => string;
|
|
1497
1617
|
declare const snakeCase: (str: string) => string;
|
|
@@ -1504,4 +1624,4 @@ declare const make: (model: Model$1, data: TGeneric, options?: {
|
|
|
1504
1624
|
declare const makeCollection: (model: Model$1, data: TGeneric) => Collection<Model$1 | Model$2>;
|
|
1505
1625
|
declare const makePaginator: (model: Model$1, data: TGeneric) => Paginator<Model$1, IPaginatorParams>;
|
|
1506
1626
|
//#endregion
|
|
1507
|
-
export { Attribute, Builder, CastsAttributes, Collection, HasUniqueIds, InvalidArgumentError, Migrate, Migration, Model$1 as Model, ModelNotFoundError, Paginator, Pivot, QueryBuilder, RelationNotFoundError, Scope, softDeletes as SoftDeletes, arquebus, compose, defineConfig, flattenDeep, getAttrMethod, getAttrName, getGetterMethod, getRelationMethod, getRelationName, getScopeMethod, getScopeName, getSetterMethod, kebabCase, make, makeCollection, makePaginator, now, snakeCase, tap };
|
|
1627
|
+
export { Attribute, Builder, CastsAttributes, Collection, HasUniqueIds, InvalidArgumentError, Migrate, Migration, Model$1 as Model, ModelNotFoundError, Paginator, Pivot, QueryBuilder, RelationNotFoundError, Scope, softDeletes as SoftDeletes, arquebus, compose, defineConfig, flatten, flattenDeep, getAttrMethod, getAttrName, getGetterMethod, getRelationMethod, getRelationName, getScopeMethod, getScopeName, getSetterMethod, kebabCase, make, makeCollection, makePaginator, now, snakeCase, tap };
|