{"version":3,"file":"index.mjs","names":[],"sources":["../src/types.ts"],"sourcesContent":["import type { HookContext, NextFunction, Params } from '@feathersjs/feathers'\nimport type { Promisable } from './internal.utils.js'\n\nexport const hookTypes = ['around', 'before', 'after', 'error'] as const\nexport type HookType = (typeof hookTypes)[number]\n\nexport const methodNames = [\n  'find',\n  'get',\n  'create',\n  'update',\n  'patch',\n  'remove',\n] as const\nexport type MethodName = (typeof methodNames)[number] | ({} & string) // allow custom methods\n\nexport type TransportName = 'socketio' | 'rest' | 'external' | 'server'\n\nexport type ContextFunctionSync<T, H extends HookContext = HookContext> = (\n  context: H,\n) => T\nexport type ContextFunctionAsync<T, H extends HookContext = HookContext> = (\n  context: H,\n) => Promise<T>\nexport type ContextFunction<T, H extends HookContext = HookContext> = (\n  context: H,\n) => T | Promise<T>\n\nexport type PredicateContextSync<H extends HookContext = HookContext> = (\n  context: H,\n) => boolean\nexport type PredicateContextAsync<H extends HookContext = HookContext> = (\n  context: H,\n) => Promise<boolean>\n\nexport type PredicateFn<H extends HookContext = HookContext> = (\n  context: H,\n) => boolean | Promise<boolean>\n\nexport type PredicateItemWithContext<T = any> = (\n  item: T,\n  context: HookContext,\n) => boolean\n\nexport type TransformerFn<\n  T = Record<string, any>,\n  H extends HookContext = HookContext,\n> = (\n  item: T,\n  options: { context: H; i: number },\n) => Promisable<T | undefined | void>\n\nexport type TransformerInputFn<\n  T = Record<string, any>,\n  H extends HookContext = HookContext,\n> = (item: T, options: { context: H; i: number }) => Promisable<any>\n\nexport type FieldKey<T> =\n  | (keyof T & string)\n  | `${Extract<keyof T, string>}.${string}`\n\nexport type StringFieldKey<T> =\n  | {\n      [K in keyof T & string]: T[K] extends string | null | undefined\n        ? K\n        : never\n    }[keyof T & string]\n  | `${Extract<keyof T, string>}.${string}`\n\nexport type DefaultsInput<T extends Record<string, any>> = {\n  [K in keyof T & string]?: T[K] | (() => T[K])\n} & {\n  [K in `${Extract<keyof T, string>}.${string}`]?: unknown\n}\n\nexport declare type HookFunction<H extends HookContext = HookContext> = (\n  context: H,\n  next?: NextFunction,\n) => Promise<H | void> | H | void\n\nexport type TransformParamsFn<P extends Params = Params> = (\n  params: P,\n) => P | void\n\nexport type DispatchOption = boolean | 'both'\n"],"mappings":";;;;;;;AAGA,MAAa,YAAY;CAAC;CAAU;CAAU;CAAS;AAAO;AAG9D,MAAa,cAAc;CACzB;CACA;CACA;CACA;CACA;CACA;AACF"}