@feathersjs/feathers 5.0.0-pre.22 → 5.0.0-pre.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/hooks.ts ADDED
@@ -0,0 +1,230 @@
1
+ import {
2
+ getManager,
3
+ HookContextData,
4
+ HookManager,
5
+ HookMap as BaseHookMap,
6
+ hooks,
7
+ Middleware,
8
+ collect
9
+ } from '@feathersjs/hooks'
10
+ import {
11
+ Service,
12
+ ServiceOptions,
13
+ HookContext,
14
+ FeathersService,
15
+ HookMap,
16
+ AroundHookFunction,
17
+ HookFunction
18
+ } from './declarations'
19
+ import { defaultServiceArguments, defaultServiceMethods, getHookMethods } from './service'
20
+
21
+ export function collectHooks(target: any, method: string) {
22
+ return target.__hooks.hooks[method] || []
23
+ }
24
+
25
+ // Converts different hook registration formats into the
26
+ // same internal format
27
+ export function convertHookData(input: any) {
28
+ const result: { [method: string]: HookFunction[] | AroundHookFunction[] } = {}
29
+
30
+ if (Array.isArray(input)) {
31
+ result.all = input
32
+ } else if (typeof input !== 'object') {
33
+ result.all = [input]
34
+ } else {
35
+ for (const key of Object.keys(input)) {
36
+ const value = input[key]
37
+ result[key] = Array.isArray(value) ? value : [value]
38
+ }
39
+ }
40
+
41
+ return result
42
+ }
43
+
44
+ type HookTypes = 'before' | 'after' | 'error' | 'around'
45
+
46
+ type ConvertedMap = { [type in HookTypes]: ReturnType<typeof convertHookData> }
47
+
48
+ type HookStore = {
49
+ around: { [method: string]: AroundHookFunction[] }
50
+ before: { [method: string]: HookFunction[] }
51
+ after: { [method: string]: HookFunction[] }
52
+ error: { [method: string]: HookFunction[] }
53
+ hooks: { [method: string]: AroundHookFunction[] }
54
+ }
55
+
56
+ const types: HookTypes[] = ['before', 'after', 'error', 'around']
57
+
58
+ const isType = (value: any): value is HookTypes => types.includes(value)
59
+
60
+ const createMap = (input: HookMap<any, any>, methods: string[]) => {
61
+ const map = {} as ConvertedMap
62
+
63
+ Object.keys(input).forEach((type) => {
64
+ if (!isType(type)) {
65
+ throw new Error(`'${type}' is not a valid hook type`)
66
+ }
67
+
68
+ const data = convertHookData(input[type])
69
+
70
+ Object.keys(data).forEach((method) => {
71
+ if (method !== 'all' && !methods.includes(method) && !defaultServiceMethods.includes(method)) {
72
+ throw new Error(`'${method}' is not a valid hook method`)
73
+ }
74
+ })
75
+
76
+ map[type] = data
77
+ })
78
+
79
+ return map
80
+ }
81
+
82
+ const updateStore = (store: HookStore, map: ConvertedMap) =>
83
+ Object.keys(store.hooks).forEach((method) => {
84
+ Object.keys(map).forEach((key) => {
85
+ const type = key as HookTypes
86
+ const allHooks = map[type].all || []
87
+ const methodHooks = map[type][method] || []
88
+
89
+ if (allHooks.length || methodHooks.length) {
90
+ const list = [...allHooks, ...methodHooks] as any
91
+ const hooks = (store[type][method] ||= [])
92
+
93
+ hooks.push(...list)
94
+ }
95
+ })
96
+
97
+ const collected = collect({
98
+ before: store.before[method] || [],
99
+ after: store.after[method] || [],
100
+ error: store.error[method] || []
101
+ })
102
+
103
+ store.hooks[method] = [...(store.around[method] || []), collected]
104
+ })
105
+
106
+ // Add `.hooks` functionality to an object
107
+ export function enableHooks(object: any, methods: string[] = defaultServiceMethods) {
108
+ const store: HookStore = {
109
+ around: {},
110
+ before: {},
111
+ after: {},
112
+ error: {},
113
+ hooks: {}
114
+ }
115
+
116
+ for (const method of methods) {
117
+ store.hooks[method] = []
118
+ }
119
+
120
+ Object.defineProperty(object, '__hooks', {
121
+ configurable: true,
122
+ value: store,
123
+ writable: true
124
+ })
125
+
126
+ return function registerHooks(this: any, input: HookMap<any, any>) {
127
+ const store = this.__hooks
128
+ const map = createMap(input, methods)
129
+
130
+ updateStore(store, map)
131
+
132
+ return this
133
+ }
134
+ }
135
+
136
+ export function createContext(service: Service, method: string, data: HookContextData = {}) {
137
+ const createContext = (service as any)[method].createContext
138
+
139
+ if (typeof createContext !== 'function') {
140
+ throw new Error(`Can not create context for method ${method}`)
141
+ }
142
+
143
+ return createContext(data) as HookContext
144
+ }
145
+
146
+ export class FeathersHookManager<A> extends HookManager {
147
+ constructor(public app: A, public method: string) {
148
+ super()
149
+ this._middleware = []
150
+ }
151
+
152
+ collectMiddleware(self: any, args: any[]): Middleware[] {
153
+ const appHooks = collectHooks(this.app, this.method)
154
+ const middleware = super.collectMiddleware(self, args)
155
+ const methodHooks = collectHooks(self, this.method)
156
+
157
+ return [...appHooks, ...middleware, ...methodHooks]
158
+ }
159
+
160
+ initializeContext(self: any, args: any[], context: HookContext) {
161
+ const ctx = super.initializeContext(self, args, context)
162
+
163
+ ctx.params = ctx.params || {}
164
+
165
+ return ctx
166
+ }
167
+
168
+ middleware(mw: Middleware[]) {
169
+ this._middleware.push(...mw)
170
+ return this
171
+ }
172
+ }
173
+
174
+ export function hookMixin<A>(this: A, service: FeathersService<A>, path: string, options: ServiceOptions) {
175
+ if (typeof service.hooks === 'function') {
176
+ return service
177
+ }
178
+
179
+ const hookMethods = getHookMethods(service, options)
180
+
181
+ const serviceMethodHooks = hookMethods.reduce((res, method) => {
182
+ const params = (defaultServiceArguments as any)[method] || ['data', 'params']
183
+
184
+ res[method] = new FeathersHookManager<A>(this, method).params(...params).props({
185
+ app: this,
186
+ path,
187
+ method,
188
+ service,
189
+ event: null,
190
+ type: null,
191
+ get statusCode() {
192
+ return this.http?.status
193
+ },
194
+ set statusCode(value: number) {
195
+ this.http = this.http || {}
196
+ this.http.status = value
197
+ }
198
+ })
199
+
200
+ return res
201
+ }, {} as BaseHookMap)
202
+
203
+ const registerHooks = enableHooks(service, hookMethods)
204
+
205
+ hooks(service, serviceMethodHooks)
206
+
207
+ service.hooks = function (this: any, hookOptions: any) {
208
+ if (hookOptions.before || hookOptions.after || hookOptions.error || hookOptions.around) {
209
+ return registerHooks.call(this, hookOptions)
210
+ }
211
+
212
+ if (Array.isArray(hookOptions)) {
213
+ return hooks(this, hookOptions)
214
+ }
215
+
216
+ Object.keys(hookOptions).forEach((method) => {
217
+ const manager = getManager(this[method])
218
+
219
+ if (!(manager instanceof FeathersHookManager)) {
220
+ throw new Error(`Method ${method} is not a Feathers hooks enabled service method`)
221
+ }
222
+
223
+ manager.middleware(hookOptions[method])
224
+ })
225
+
226
+ return this
227
+ }
228
+
229
+ return service
230
+ }
package/src/index.ts CHANGED
@@ -1,19 +1,20 @@
1
- import { setDebug } from './dependencies';
2
- import version from './version';
3
- import { Feathers } from './application';
4
- import { Application } from './declarations';
1
+ import { setDebug } from '@feathersjs/commons'
5
2
 
6
- export function feathers<T = any, S = any> () {
7
- return new Feathers<T, S>() as Application<T, S>;
3
+ import version from './version'
4
+ import { Feathers } from './application'
5
+ import { Application } from './declarations'
6
+
7
+ export function feathers<T = any, S = any>() {
8
+ return new Feathers<T, S>() as Application<T, S>
8
9
  }
9
10
 
10
- feathers.setDebug = setDebug;
11
+ feathers.setDebug = setDebug
11
12
 
12
- export { version, Feathers };
13
- export * from './hooks/index';
14
- export * from './declarations';
15
- export * from './service';
13
+ export { version, Feathers }
14
+ export * from './hooks'
15
+ export * from './declarations'
16
+ export * from './service'
16
17
 
17
18
  if (typeof module !== 'undefined') {
18
- module.exports = Object.assign(feathers, module.exports);
19
+ module.exports = Object.assign(feathers, module.exports)
19
20
  }
package/src/service.ts CHANGED
@@ -1,18 +1,19 @@
1
- import { createSymbol, EventEmitter } from './dependencies';
2
- import { ServiceOptions } from './declarations';
1
+ import { EventEmitter } from 'events'
2
+ import { createSymbol } from '@feathersjs/commons'
3
+ import { ServiceOptions } from './declarations'
3
4
 
4
- export const SERVICE = createSymbol('@feathersjs/service');
5
+ export const SERVICE = createSymbol('@feathersjs/service')
5
6
 
6
7
  export const defaultServiceArguments = {
7
- find: [ 'params' ],
8
- get: [ 'id', 'params' ],
9
- create: [ 'data', 'params' ],
10
- update: [ 'id', 'data', 'params' ],
11
- patch: [ 'id', 'data', 'params' ],
12
- remove: [ 'id', 'params' ]
8
+ find: ['params'],
9
+ get: ['id', 'params'],
10
+ create: ['data', 'params'],
11
+ update: ['id', 'data', 'params'],
12
+ patch: ['id', 'data', 'params'],
13
+ remove: ['id', 'params']
13
14
  }
14
15
 
15
- export const defaultServiceMethods = Object.keys(defaultServiceArguments);
16
+ export const defaultServiceMethods = Object.keys(defaultServiceArguments)
16
17
 
17
18
  export const defaultEventMap = {
18
19
  create: 'created',
@@ -23,70 +24,53 @@ export const defaultEventMap = {
23
24
 
24
25
  export const protectedMethods = Object.keys(Object.prototype)
25
26
  .concat(Object.keys(EventEmitter.prototype))
26
- .concat([
27
- 'all',
28
- 'before',
29
- 'after',
30
- 'error',
31
- 'hooks',
32
- 'setup',
33
- 'teardown',
34
- 'publish'
35
- ]);
36
-
37
- export function getHookMethods (service: any, options: ServiceOptions) {
38
- const { methods } = options;
39
-
40
- return defaultServiceMethods.filter(m =>
41
- typeof service[m] === 'function' && !methods.includes(m)
42
- ).concat(methods);
27
+ .concat(['all', 'around', 'before', 'after', 'error', 'hooks', 'setup', 'teardown', 'publish'])
28
+
29
+ export function getHookMethods(service: any, options: ServiceOptions) {
30
+ const { methods } = options
31
+
32
+ return defaultServiceMethods
33
+ .filter((m) => typeof service[m] === 'function' && !methods.includes(m))
34
+ .concat(methods)
43
35
  }
44
36
 
45
- export function getServiceOptions (
46
- service: any, options: ServiceOptions = {}
47
- ): ServiceOptions {
48
- const existingOptions = service[SERVICE];
37
+ export function getServiceOptions(service: any, options: ServiceOptions = {}): ServiceOptions {
38
+ const existingOptions = service[SERVICE]
49
39
 
50
40
  if (existingOptions) {
51
- return existingOptions;
41
+ return existingOptions
52
42
  }
53
43
 
54
44
  const {
55
- methods = defaultServiceMethods.filter(method =>
56
- typeof service[method] === 'function'
57
- ),
45
+ methods = defaultServiceMethods.filter((method) => typeof service[method] === 'function'),
58
46
  events = service.events || []
59
- } = options;
60
- const {
61
- serviceEvents = Object.values(defaultEventMap).concat(events)
62
- } = options;
47
+ } = options
48
+ const { serviceEvents = Object.values(defaultEventMap).concat(events) } = options
63
49
 
64
50
  return {
65
51
  ...options,
66
52
  events,
67
53
  methods,
68
54
  serviceEvents
69
- };
55
+ }
70
56
  }
71
57
 
72
- export function wrapService (
73
- location: string, service: any, options: ServiceOptions
74
- ) {
58
+ export function wrapService(location: string, service: any, options: ServiceOptions) {
75
59
  // Do nothing if this is already an initialized
76
60
  if (service[SERVICE]) {
77
- return service;
61
+ return service
78
62
  }
79
63
 
80
- const protoService = Object.create(service);
81
- const serviceOptions = getServiceOptions(service, options);
64
+ const protoService = Object.create(service)
65
+ const serviceOptions = getServiceOptions(service, options)
82
66
 
83
67
  if (Object.keys(serviceOptions.methods).length === 0 && typeof service.setup !== 'function') {
84
- throw new Error(`Invalid service object passed for path \`${location}\``);
68
+ throw new Error(`Invalid service object passed for path \`${location}\``)
85
69
  }
86
70
 
87
71
  Object.defineProperty(protoService, SERVICE, {
88
72
  value: serviceOptions
89
- });
73
+ })
90
74
 
91
- return protoService;
75
+ return protoService
92
76
  }
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export default '5.0.0-pre.22';
1
+ export default '5.0.0-pre.25'
@@ -1,4 +0,0 @@
1
- import { EventEmitter } from 'events';
2
- export * from '@feathersjs/commons';
3
- export * from '@feathersjs/hooks';
4
- export { EventEmitter };
@@ -1,22 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.EventEmitter = void 0;
18
- const events_1 = require("events");
19
- Object.defineProperty(exports, "EventEmitter", { enumerable: true, get: function () { return events_1.EventEmitter; } });
20
- __exportStar(require("@feathersjs/commons"), exports);
21
- __exportStar(require("@feathersjs/hooks"), exports);
22
- //# sourceMappingURL=dependencies.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dependencies.js","sourceRoot":"","sources":["../src/dependencies.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,mCAAsC;AAI7B,6FAJA,qBAAY,OAIA;AAHrB,sDAAoC;AACpC,oDAAkC"}
@@ -1,13 +0,0 @@
1
- import { HookContextData, HookManager, Middleware } from '../dependencies';
2
- import { Service, ServiceOptions, HookContext, FeathersService, Application } from '../declarations';
3
- export { fromBeforeHook, fromBeforeHooks, fromAfterHook, fromAfterHooks, fromErrorHook, fromErrorHooks } from './regular';
4
- export declare function createContext(service: Service, method: string, data?: HookContextData): HookContext<Application<any, any>, any>;
5
- export declare class FeathersHookManager<A> extends HookManager {
6
- app: A;
7
- method: string;
8
- constructor(app: A, method: string);
9
- collectMiddleware(self: any, args: any[]): Middleware[];
10
- initializeContext(self: any, args: any[], context: HookContext): import("@feathersjs/hooks/types/base").HookContext<any, any>;
11
- middleware(mw: Middleware[]): this;
12
- }
13
- export declare function hookMixin<A>(this: A, service: FeathersService<A>, path: string, options: ServiceOptions): FeathersService<A, Service<any, Partial<any>, import("../declarations").Params<import("../declarations").Query>>>;
@@ -1,96 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.hookMixin = exports.FeathersHookManager = exports.createContext = exports.fromErrorHooks = exports.fromErrorHook = exports.fromAfterHooks = exports.fromAfterHook = exports.fromBeforeHooks = exports.fromBeforeHook = void 0;
4
- const dependencies_1 = require("../dependencies");
5
- const service_1 = require("../service");
6
- const regular_1 = require("./regular");
7
- var regular_2 = require("./regular");
8
- Object.defineProperty(exports, "fromBeforeHook", { enumerable: true, get: function () { return regular_2.fromBeforeHook; } });
9
- Object.defineProperty(exports, "fromBeforeHooks", { enumerable: true, get: function () { return regular_2.fromBeforeHooks; } });
10
- Object.defineProperty(exports, "fromAfterHook", { enumerable: true, get: function () { return regular_2.fromAfterHook; } });
11
- Object.defineProperty(exports, "fromAfterHooks", { enumerable: true, get: function () { return regular_2.fromAfterHooks; } });
12
- Object.defineProperty(exports, "fromErrorHook", { enumerable: true, get: function () { return regular_2.fromErrorHook; } });
13
- Object.defineProperty(exports, "fromErrorHooks", { enumerable: true, get: function () { return regular_2.fromErrorHooks; } });
14
- function createContext(service, method, data = {}) {
15
- const createContext = service[method].createContext;
16
- if (typeof createContext !== 'function') {
17
- throw new Error(`Can not create context for method ${method}`);
18
- }
19
- return createContext(data);
20
- }
21
- exports.createContext = createContext;
22
- class FeathersHookManager extends dependencies_1.HookManager {
23
- constructor(app, method) {
24
- super();
25
- this.app = app;
26
- this.method = method;
27
- this._middleware = [];
28
- }
29
- collectMiddleware(self, args) {
30
- const app = this.app;
31
- const appHooks = app.appHooks[dependencies_1.HOOKS].concat(app.appHooks[this.method] || []);
32
- const regularAppHooks = (0, regular_1.collectRegularHooks)(this.app, this.method);
33
- const middleware = super.collectMiddleware(self, args);
34
- const regularHooks = (0, regular_1.collectRegularHooks)(self, this.method);
35
- return [...appHooks, ...regularAppHooks, ...middleware, ...regularHooks];
36
- }
37
- initializeContext(self, args, context) {
38
- const ctx = super.initializeContext(self, args, context);
39
- ctx.params = ctx.params || {};
40
- return ctx;
41
- }
42
- middleware(mw) {
43
- this._middleware.push(...mw);
44
- return this;
45
- }
46
- }
47
- exports.FeathersHookManager = FeathersHookManager;
48
- function hookMixin(service, path, options) {
49
- if (typeof service.hooks === 'function') {
50
- return service;
51
- }
52
- const app = this;
53
- const hookMethods = (0, service_1.getHookMethods)(service, options);
54
- const serviceMethodHooks = hookMethods.reduce((res, method) => {
55
- const params = service_1.defaultServiceArguments[method] || ['data', 'params'];
56
- res[method] = new FeathersHookManager(app, method)
57
- .params(...params)
58
- .props({
59
- app,
60
- path,
61
- method,
62
- service,
63
- event: null,
64
- type: null,
65
- get statusCode() {
66
- var _a;
67
- return (_a = this.http) === null || _a === void 0 ? void 0 : _a.status;
68
- },
69
- set statusCode(value) {
70
- (this.http || (this.http = {})).status = value;
71
- }
72
- });
73
- return res;
74
- }, {});
75
- const handleRegularHooks = (0, regular_1.enableRegularHooks)(service, hookMethods);
76
- (0, dependencies_1.hooks)(service, serviceMethodHooks);
77
- service.hooks = function (hookOptions) {
78
- if (hookOptions.before || hookOptions.after || hookOptions.error) {
79
- return handleRegularHooks.call(this, hookOptions);
80
- }
81
- if (Array.isArray(hookOptions)) {
82
- return (0, dependencies_1.hooks)(this, hookOptions);
83
- }
84
- Object.keys(hookOptions).forEach(method => {
85
- const manager = (0, dependencies_1.getManager)(this[method]);
86
- if (!(manager instanceof FeathersHookManager)) {
87
- throw new Error(`Method ${method} is not a Feathers hooks enabled service method`);
88
- }
89
- manager.middleware(hookOptions[method]);
90
- });
91
- return this;
92
- };
93
- return service;
94
- }
95
- exports.hookMixin = hookMixin;
96
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":";;;AAAA,kDAEyB;AAIzB,wCAAqE;AACrE,uCAGmB;AAEnB,qCAOmB;AANjB,yGAAA,cAAc,OAAA;AACd,0GAAA,eAAe,OAAA;AACf,wGAAA,aAAa,OAAA;AACb,yGAAA,cAAc,OAAA;AACd,wGAAA,aAAa,OAAA;AACb,yGAAA,cAAc,OAAA;AAGhB,SAAgB,aAAa,CAAE,OAAgB,EAAE,MAAc,EAAE,OAAwB,EAAE;IACzF,MAAM,aAAa,GAAI,OAAe,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC;IAE7D,IAAI,OAAO,aAAa,KAAK,UAAU,EAAE;QACvC,MAAM,IAAI,KAAK,CAAC,qCAAqC,MAAM,EAAE,CAAC,CAAC;KAChE;IAED,OAAO,aAAa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,CAAC,KAAK,IAAI,WAAW,CAAC,KAAK,EAAE;YAChE,OAAO,kBAAkB,CAAC,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;SACnD;QAED,IAAI,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;YAC9B,OAAO,IAAA,oBAAK,EAAC,IAAI,EAAE,WAAW,CAAC,CAAC;SACjC;QAED,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;YACxC,MAAM,OAAO,GAAG,IAAA,yBAAU,EAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;YAEzC,IAAI,CAAC,CAAC,OAAO,YAAY,mBAAmB,CAAC,EAAE;gBAC7C,MAAM,IAAI,KAAK,CAAC,UAAU,MAAM,iDAAiD,CAAC,CAAC;aACpF;YAED,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;QAC1C,CAAC,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;IACd,CAAC,CAAA;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AA5DD,8BA4DC"}
@@ -1,12 +0,0 @@
1
- import { HookFunction, RegularHookFunction, RegularHookMap } from '../declarations';
2
- export declare function fromBeforeHook<A, S>(hook: RegularHookFunction<A, S>): HookFunction<A, S>;
3
- export declare function fromAfterHook<A, S>(hook: RegularHookFunction<A, S>): HookFunction<A, S>;
4
- export declare function fromErrorHook<A, S>(hook: RegularHookFunction<A, S>): HookFunction<A, S>;
5
- export declare function fromBeforeHooks<A, S>(hooks: RegularHookFunction<A, S>[]): HookFunction<unknown, unknown>;
6
- export declare function fromAfterHooks<A, S>(hooks: RegularHookFunction<A, S>[]): HookFunction<unknown, unknown>;
7
- export declare function fromErrorHooks<A, S>(hooks: RegularHookFunction<A, S>[]): HookFunction<unknown, unknown>;
8
- export declare function collectRegularHooks(target: any, method: string): any;
9
- export declare function convertHookData(input: any): {
10
- [method: string]: RegularHookFunction<import("../declarations").Application<any, any>, import("../declarations").Service<any, Partial<any>, import("../declarations").Params<import("../declarations").Query>>>[];
11
- };
12
- export declare function enableRegularHooks(object: any, methods?: string[]): (this: any, input: RegularHookMap<any, any>) => any;