import type { HookContext, NextFunction, Params } from '@feathersjs/feathers' import type { Promisable } from './internal.utils.js' export const hookTypes = ['around', 'before', 'after', 'error'] as const export type HookType = (typeof hookTypes)[number] export const methodNames = [ 'find', 'get', 'create', 'update', 'patch', 'remove', ] as const export type MethodName = (typeof methodNames)[number] | ({} & string) // allow custom methods export type TransportName = 'socketio' | 'rest' | 'external' | 'server' export type ContextFunctionSync = ( context: H, ) => T export type ContextFunctionAsync = ( context: H, ) => Promise export type ContextFunction = ( context: H, ) => T | Promise export type PredicateContextSync = ( context: H, ) => boolean export type PredicateContextAsync = ( context: H, ) => Promise export type PredicateFn = ( context: H, ) => boolean | Promise export type PredicateItemWithContext = ( item: T, context: HookContext, ) => boolean export type TransformerFn< T = Record, H extends HookContext = HookContext, > = ( item: T, options: { context: H; i: number }, ) => Promisable export type TransformerInputFn< T = Record, H extends HookContext = HookContext, > = (item: T, options: { context: H; i: number }) => Promisable export type FieldKey = | (keyof T & string) | `${Extract}.${string}` export type StringFieldKey = | { [K in keyof T & string]: T[K] extends string | null | undefined ? K : never }[keyof T & string] | `${Extract}.${string}` export type DefaultsInput> = { [K in keyof T & string]?: T[K] | (() => T[K]) } & { [K in `${Extract}.${string}`]?: unknown } export declare type HookFunction = ( context: H, next?: NextFunction, ) => Promise | H | void export type TransformParamsFn

= ( params: P, ) => P | void export type DispatchOption = boolean | 'both'