1+ import { Query , Params , Paginated , Id , NullableId } from '@feathersjs/feathers' ;
2+
3+ export type FilterSettings = string [ ] | {
4+ [ key : string ] : ( value : any , options : any ) => any
5+ }
6+
7+ export interface PaginationOptions {
8+ default ?: number ;
9+ max ?: number ;
10+ }
11+
12+ export type PaginationParams = false | PaginationOptions ;
13+
14+ export type FilterQueryOptions = {
15+ filters ?: FilterSettings ;
16+ operators ?: string [ ] ;
17+ paginate ?: PaginationParams ;
18+ }
19+
20+ export interface AdapterServiceOptions {
21+ events ?: string [ ] ;
22+ multi ?: boolean | string [ ] ;
23+ id ?: string ;
24+ paginate ?: PaginationOptions
25+ /**
26+ * @deprecated renamed to `allow`.
27+ */
28+ whitelist ?: string [ ] ;
29+ allow ?: string [ ] ;
30+ filters ?: string [ ] ;
31+ }
32+
33+ export interface AdapterOptions < M = any > extends Pick < AdapterServiceOptions , 'multi' | 'allow' | 'paginate' > {
34+ Model ?: M ;
35+ }
36+
37+ export interface AdapterParams < Q = Query , M = any > extends Params < Q > {
38+ adapter ?: Partial < AdapterOptions < M > > ;
39+ paginate ?: PaginationParams ;
40+ }
41+
42+ /**
43+ * Hook-less (internal) service methods. Directly call database adapter service methods
44+ * without running any service-level hooks. This can be useful if you need the raw data
45+ * from the service and don't want to trigger any of its hooks.
46+ *
47+ * Important: These methods are only available internally on the server, not on the client
48+ * side and only for the Feathers database adapters.
49+ *
50+ * These methods do not trigger events.
51+ *
52+ * @see {@link https://docs.feathersjs.com/guides/migrating.html#hook-less-service-methods }
53+ */
54+ export interface InternalServiceMethods < T = any , D = Partial < T > , P extends AdapterParams = AdapterParams > {
55+ /**
56+ * Retrieve all resources from this service, skipping any service-level hooks.
57+ *
58+ * @param params - Service call parameters {@link Params}
59+ * @see {@link HookLessServiceMethods }
60+ * @see {@link https://docs.feathersjs.com/api/services.html#find-params|Feathers API Documentation: .find(params) }
61+ */
62+ _find ( _params ?: P & { paginate ?: PaginationOptions } ) : Promise < Paginated < T > > ;
63+ _find ( _params ?: P & { paginate : false } ) : Promise < T [ ] > ;
64+ _find ( params ?: P ) : Promise < T | T [ ] | Paginated < T > > ;
65+
66+ /**
67+ * Retrieve a single resource matching the given ID, skipping any service-level hooks.
68+ *
69+ * @param id - ID of the resource to locate
70+ * @param params - Service call parameters {@link Params}
71+ * @see {@link HookLessServiceMethods }
72+ * @see {@link https://docs.feathersjs.com/api/services.html#get-id-params|Feathers API Documentation: .get(id, params) }
73+ */
74+ _get ( id : Id , params ?: P ) : Promise < T > ;
75+
76+ /**
77+ * Create a new resource for this service, skipping any service-level hooks.
78+ *
79+ * @param data - Data to insert into this service.
80+ * @param params - Service call parameters {@link Params}
81+ * @see {@link HookLessServiceMethods }
82+ * @see {@link https://docs.feathersjs.com/api/services.html#create-data-params|Feathers API Documentation: .create(data, params) }
83+ */
84+ _create ( data : Partial < D > , params ?: P ) : Promise < T > ;
85+ _create ( data : Partial < D > [ ] , params ?: P ) : Promise < T [ ] > ;
86+ _create ( data : Partial < D > | Partial < D > [ ] , params ?: P ) : Promise < T | T [ ] > ;
87+
88+ /**
89+ * Replace any resources matching the given ID with the given data, skipping any service-level hooks.
90+ *
91+ * @param id - ID of the resource to be updated
92+ * @param data - Data to be put in place of the current resource.
93+ * @param params - Service call parameters {@link Params}
94+ * @see {@link HookLessServiceMethods }
95+ * @see {@link https://docs.feathersjs.com/api/services.html#update-id-data-params|Feathers API Documentation: .update(id, data, params) }
96+ */
97+ _update ( id : Id , data : D , params ?: P ) : Promise < T > ;
98+
99+ /**
100+ * Merge any resources matching the given ID with the given data, skipping any service-level hooks.
101+ *
102+ * @param id - ID of the resource to be patched
103+ * @param data - Data to merge with the current resource.
104+ * @param params - Service call parameters {@link Params}
105+ * @see {@link HookLessServiceMethods }
106+ * @see {@link https://docs.feathersjs.com/api/services.html#patch-id-data-params|Feathers API Documentation: .patch(id, data, params) }
107+ */
108+ _patch ( id : null , data : Partial < D > , params ?: P ) : Promise < T [ ] > ;
109+ _patch ( id : Id , data : Partial < D > , params ?: P ) : Promise < T > ;
110+ _patch ( id : NullableId , data : Partial < D > , params ?: P ) : Promise < T | T [ ] > ;
111+
112+ /**
113+ * Remove resources matching the given ID from the this service, skipping any service-level hooks.
114+ *
115+ * @param id - ID of the resource to be removed
116+ * @param params - Service call parameters {@link Params}
117+ * @see {@link HookLessServiceMethods }
118+ * @see {@link https://docs.feathersjs.com/api/services.html#remove-id-params|Feathers API Documentation: .remove(id, params) }
119+ */
120+ _remove ( id : null , params ?: P ) : Promise < T [ ] > ;
121+ _remove ( id : Id , params ?: P ) : Promise < T > ;
122+ _remove ( id : NullableId , params ?: P ) : Promise < T | T [ ] > ;
123+ }
0 commit comments