Skip to content

Commit b44432a

Browse files
committedMar 22, 2025
chore: update types
1 parent 96a0736 commit b44432a

File tree

3 files changed

+75
-2
lines changed

3 files changed

+75
-2
lines changed
 

‎types/Database/Database.d.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
import "knex";
12
import type { Knex } from "knex";
23

3-
export default Database;
44
declare let Database: Knex;
5+
declare type Database = Knex;
56

6-
import "knex";
7+
export default Database;
78

89
type PaginationOptions = {
910
page?: number;

‎types/Database/Repository.d.ts

+70
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import { Knex } from 'knex'
22
import ResultTypes = require('./result')
33

4+
type AnyOrUnknownToOther<T1, T2> = unknown extends T1 ? T2 : T1;
5+
type SafePartial<T> = Partial<AnyOrUnknownToOther<T, {}>>;
6+
47
type PaginationOptions = {
58
page?: number;
69
pageSize?: number;
@@ -397,6 +400,73 @@ export default class Repository<TRecord extends {} = any, TResult = any> {
397400
: Knex.DbRecordArr<TRecord> | ReadonlyArray<Knex.DbRecordArr<TRecord>>
398401
): T;
399402

403+
static del(
404+
returning?: '*',
405+
options?: DMLOptions
406+
): Knex.QueryBuilder<TRecord, DeferredKeySelection<TRecord, never>[]>;
407+
del<
408+
TKey extends StrKey<TRecord>,
409+
TResult2 = DeferredKeySelection.Augment<
410+
UnwrapArrayMember<TResult>,
411+
TRecord,
412+
TKey
413+
>[]
414+
>(
415+
returning?: TKey,
416+
options?: DMLOptions
417+
): Knex.QueryBuilder<TRecord, TResult2>;
418+
419+
del<
420+
TKey extends StrKey<TRecord>,
421+
TResult2 = DeferredKeySelection.Augment<
422+
UnwrapArrayMember<TResult>,
423+
TRecord,
424+
TKey
425+
>[]
426+
>(
427+
returning?: readonly TKey[],
428+
options?: DMLOptions
429+
): Knex.QueryBuilder<TRecord, TResult2[]>;
430+
del<TResult2 = SafePartial<TRecord>[]>(
431+
returning?: string | readonly string[],
432+
options?: DMLOptions
433+
): Knex.QueryBuilder<TRecord, TResult2>;
434+
del<TResult2 = number>(): Knex.QueryBuilder<TRecord, TResult2>;
435+
436+
static delete(
437+
returning?: '*',
438+
options?: DMLOptions
439+
): Knex.QueryBuilder<TRecord, DeferredKeySelection<TRecord, never>[]>;
440+
delete<
441+
TKey extends StrKey<Knex.ResolveTableType<TRecord>>,
442+
TResult2 = DeferredKeySelection.Augment<
443+
UnwrapArrayMember<TResult>,
444+
Knex.ResolveTableType<TRecord>,
445+
TKey
446+
>[]
447+
>(
448+
returning?: TKey,
449+
options?: DMLOptions
450+
): Knex.QueryBuilder<TRecord, TResult2>;
451+
delete<
452+
TKey extends StrKey<TRecord>,
453+
TResult2 = DeferredKeySelection.Augment<
454+
UnwrapArrayMember<TResult>,
455+
TRecord,
456+
TKey
457+
>[]
458+
>(
459+
returning?: readonly TKey[],
460+
options?: DMLOptions
461+
): Knex.QueryBuilder<TRecord, TResult2>;
462+
463+
static delete<TResult2 = any>(
464+
returning?: string | readonly (string | Knex.Raw)[] | Knex.Raw,
465+
options?: DMLOptions
466+
): QueryBuilder<TRecord, TResult2>;
467+
468+
static delete<TResult2 = number>(): Knex.QueryBuilder<TRecord, TResult2>;
469+
static truncate(): Knex.QueryBuilder<TRecord, void>;
400470
static join: Knex.Join<TRecord, TResult>;
401471
static joinRaw: Knex.JoinRaw<TRecord, TResult>;
402472
static innerJoin: Knex.Join<TRecord, TResult>;

‎types/index.d.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Command } from "./Foundation/Console/Command";
22
import { Context } from "./Foundation/Context";
3+
import { Factory } from "./Database/Factory";
34
import { FastifyInstance } from "fastify/types/instance";
45
import { FastifyReply } from "fastify";
56
import { FastifyRequest } from "fastify/types/request";
@@ -201,6 +202,7 @@ export {
201202
ErrorIfAuthenticated,
202203
ExceptionHandler,
203204
expiresIn,
205+
Factory,
204206
FastifyInstance,
205207
FastifyReply,
206208
FastifyRequest,

0 commit comments

Comments
 (0)
Failed to load comments.