Comparing version 1.0.13 to 1.0.14
@@ -350,5 +350,26 @@ type RecursivePartial<T> = { | ||
type BeforeHook = (query: RecursivePartial<QueryInstructions>, multipleRecords: boolean) => Promise<RecursivePartial<QueryInstructions>>; | ||
type DuringHook<T = unknown> = (query: RecursivePartial<QueryInstructions>, multipleRecords: boolean) => Promise<T>; | ||
type AfterHook<T = unknown> = (query: RecursivePartial<QueryInstructions>, multipleRecords: boolean, result: QueryResult<T>) => Promise<void>; | ||
type FilteredHookQuery<TQuery extends QueryInstructions, TType extends QueryType> = RecursivePartial<TQuery> & Pick<TQuery, TType extends 'count' ? never : TType extends 'create' ? 'with' : TType extends 'get' ? never : TType extends 'set' ? 'to' : TType extends 'drop' ? never : never>; | ||
type BeforeHookHandler<TType extends QueryType, TQuery extends FilteredHookQuery<QueryInstructions, TType> = FilteredHookQuery<QueryInstructions, TType>> = (query: TQuery, multipleRecords: boolean) => TQuery | Promise<TQuery>; | ||
type DuringHookHandler<TType extends QueryType, TSchema = unknown> = (query: FilteredHookQuery<QueryInstructions, TType>, multipleRecords: boolean) => TSchema | Promise<TSchema>; | ||
type AfterHookHandler<TType extends QueryType, TSchema = unknown> = (query: FilteredHookQuery<QueryInstructions, TType>, multipleRecords: boolean, result: TSchema) => void | Promise<void>; | ||
type HookType = 'before' | 'during' | 'after'; | ||
type Hook<TStage extends HookType, TType extends QueryType, TSchema extends TStage extends 'before' ? never : unknown = never> = TStage extends 'before' ? BeforeHookHandler<TType> : TStage extends 'during' ? DuringHookHandler<TType, TSchema> : TStage extends 'after' ? AfterHookHandler<TType, TSchema> : never; | ||
type BeforeHook<TType extends QueryType> = Hook<'before', TType>; | ||
type DuringHook<TType extends QueryType, TSchema = unknown> = Hook<'during', TType, TSchema>; | ||
type AfterHook<TType extends QueryType, TSchema = unknown> = Hook<'after', TType, TSchema>; | ||
type BeforeCountHook = BeforeHook<'count'>; | ||
type BeforeCreateHook = BeforeHook<'create'>; | ||
type BeforeDropHook = BeforeHook<'drop'>; | ||
type BeforeGetHook = BeforeHook<'get'>; | ||
type BeforeSetHook = BeforeHook<'set'>; | ||
type CountHook<TSchema = unknown> = DuringHook<'count', TSchema>; | ||
type CreateHook<TSchema = unknown> = DuringHook<'create', TSchema>; | ||
type DropHook<TSchema = unknown> = DuringHook<'drop', TSchema>; | ||
type GetHook<TSchema = unknown> = DuringHook<'get', TSchema>; | ||
type SetHook<TSchema = unknown> = DuringHook<'set', TSchema>; | ||
type AfterCountHook<TSchema = unknown> = AfterHook<'count', TSchema>; | ||
type AfterCreateHook<TSchema = unknown> = AfterHook<'create', TSchema>; | ||
type AfterDropHook<TSchema = unknown> = AfterHook<'drop', TSchema>; | ||
type AfterGetHook<TSchema = unknown> = AfterHook<'get', TSchema>; | ||
type AfterSetHook<TSchema = unknown> = AfterHook<'set', TSchema>; | ||
@@ -367,2 +388,2 @@ /** | ||
export { AfterHook, BeforeHook, DuringHook, Query, QueryResult, RONIN, Readable, ReadableValue, RunScratchpadOptions, ScratchPad, ScratchPadActions, StoredReadable, handleScratchPadOrConfig as default, getQueriesFromScratchPad, processReadables, runQueries }; | ||
export { AfterCountHook, AfterCreateHook, AfterDropHook, AfterGetHook, AfterHookHandler, AfterSetHook, BeforeCountHook, BeforeCreateHook, BeforeDropHook, BeforeGetHook, BeforeHookHandler, BeforeSetHook, CountHook, CreateHook, DropHook, DuringHookHandler, GetHook, Query, QueryInstructions, QueryResult, QueryType, RONIN, Readable, ReadableValue, RunScratchpadOptions, ScratchPad, ScratchPadActions, SetHook, StoredReadable, handleScratchPadOrConfig as default, getQueriesFromScratchPad, processReadables, runQueries }; |
{ | ||
"version": "1.0.13", | ||
"version": "1.0.14", | ||
"name": "ronin", | ||
@@ -4,0 +4,0 @@ "scripts": { |
30699
781