@feathersjs/feathers 5.0.0-pre.6 → 5.0.0
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/CHANGELOG.md +265 -212
- package/LICENSE +1 -1
- package/{readme.md → README.md} +7 -12
- package/lib/application.d.ts +20 -15
- package/lib/application.js +83 -44
- package/lib/application.js.map +1 -1
- package/lib/declarations.d.ts +193 -78
- package/lib/events.d.ts +2 -2
- package/lib/events.js +5 -6
- package/lib/events.js.map +1 -1
- package/lib/hooks.d.ts +42 -0
- package/lib/hooks.js +176 -0
- package/lib/hooks.js.map +1 -0
- package/lib/index.d.ts +2 -2
- package/lib/index.js +8 -4
- package/lib/index.js.map +1 -1
- package/lib/service.d.ts +3 -1
- package/lib/service.js +27 -26
- package/lib/service.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/package.json +17 -16
- package/src/application.ts +162 -101
- package/src/declarations.ts +281 -147
- package/src/events.ts +15 -15
- package/src/hooks.ts +234 -0
- package/src/index.ts +13 -12
- package/src/service.ts +38 -50
- package/src/version.ts +1 -1
- package/lib/dependencies.d.ts +0 -4
- package/lib/dependencies.js +0 -18
- package/lib/dependencies.js.map +0 -1
- package/lib/hooks/index.d.ts +0 -14
- package/lib/hooks/index.js +0 -84
- package/lib/hooks/index.js.map +0 -1
- package/lib/hooks/legacy.d.ts +0 -7
- package/lib/hooks/legacy.js +0 -114
- package/lib/hooks/legacy.js.map +0 -1
- package/src/dependencies.ts +0 -5
- package/src/hooks/index.ts +0 -109
- package/src/hooks/legacy.ts +0 -138
package/src/hooks.ts
ADDED
|
@@ -0,0 +1,234 @@
|
|
|
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
|
+
HookType
|
|
19
|
+
} from './declarations'
|
|
20
|
+
import { defaultServiceArguments, getHookMethods } from './service'
|
|
21
|
+
|
|
22
|
+
type ConvertedMap = { [type in HookType]: ReturnType<typeof convertHookData> }
|
|
23
|
+
|
|
24
|
+
type HookStore = {
|
|
25
|
+
around: { [method: string]: AroundHookFunction[] }
|
|
26
|
+
before: { [method: string]: HookFunction[] }
|
|
27
|
+
after: { [method: string]: HookFunction[] }
|
|
28
|
+
error: { [method: string]: HookFunction[] }
|
|
29
|
+
collected: { [method: string]: AroundHookFunction[] }
|
|
30
|
+
collectedAll: { before?: AroundHookFunction[]; after?: AroundHookFunction[] }
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
type HookEnabled = { __hooks: HookStore }
|
|
34
|
+
|
|
35
|
+
const types: HookType[] = ['before', 'after', 'error', 'around']
|
|
36
|
+
|
|
37
|
+
const isType = (value: any): value is HookType => types.includes(value)
|
|
38
|
+
|
|
39
|
+
// Converts different hook registration formats into the
|
|
40
|
+
// same internal format
|
|
41
|
+
export function convertHookData(input: any) {
|
|
42
|
+
const result: { [method: string]: HookFunction[] | AroundHookFunction[] } = {}
|
|
43
|
+
|
|
44
|
+
if (Array.isArray(input)) {
|
|
45
|
+
result.all = input
|
|
46
|
+
} else if (typeof input !== 'object') {
|
|
47
|
+
result.all = [input]
|
|
48
|
+
} else {
|
|
49
|
+
for (const key of Object.keys(input)) {
|
|
50
|
+
const value = input[key]
|
|
51
|
+
result[key] = Array.isArray(value) ? value : [value]
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return result
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export function collectHooks(target: HookEnabled, method: string) {
|
|
59
|
+
const { collected, collectedAll, around } = target.__hooks
|
|
60
|
+
|
|
61
|
+
return [
|
|
62
|
+
...(around.all || []),
|
|
63
|
+
...(around[method] || []),
|
|
64
|
+
...(collectedAll.before || []),
|
|
65
|
+
...(collected[method] || []),
|
|
66
|
+
...(collectedAll.after || [])
|
|
67
|
+
] as AroundHookFunction[]
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Add `.hooks` functionality to an object
|
|
71
|
+
export function enableHooks(object: any) {
|
|
72
|
+
const store: HookStore = {
|
|
73
|
+
around: {},
|
|
74
|
+
before: {},
|
|
75
|
+
after: {},
|
|
76
|
+
error: {},
|
|
77
|
+
collected: {},
|
|
78
|
+
collectedAll: {}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
Object.defineProperty(object, '__hooks', {
|
|
82
|
+
configurable: true,
|
|
83
|
+
value: store,
|
|
84
|
+
writable: true
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
return function registerHooks(this: HookEnabled, input: HookMap<any, any>) {
|
|
88
|
+
const store = this.__hooks
|
|
89
|
+
const map = Object.keys(input).reduce((map, type) => {
|
|
90
|
+
if (!isType(type)) {
|
|
91
|
+
throw new Error(`'${type}' is not a valid hook type`)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
map[type] = convertHookData(input[type])
|
|
95
|
+
|
|
96
|
+
return map
|
|
97
|
+
}, {} as ConvertedMap)
|
|
98
|
+
const types = Object.keys(map) as HookType[]
|
|
99
|
+
|
|
100
|
+
types.forEach((type) =>
|
|
101
|
+
Object.keys(map[type]).forEach((method) => {
|
|
102
|
+
const mapHooks = map[type][method]
|
|
103
|
+
const storeHooks: any[] = (store[type][method] ||= [])
|
|
104
|
+
|
|
105
|
+
storeHooks.push(...mapHooks)
|
|
106
|
+
|
|
107
|
+
if (method === 'all') {
|
|
108
|
+
if (store.before[method] || store.error[method]) {
|
|
109
|
+
const beforeAll = collect({
|
|
110
|
+
before: store.before[method] || [],
|
|
111
|
+
error: store.error[method] || []
|
|
112
|
+
})
|
|
113
|
+
store.collectedAll.before = [beforeAll]
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (store.after[method]) {
|
|
117
|
+
const afterAll = collect({
|
|
118
|
+
after: store.after[method] || []
|
|
119
|
+
})
|
|
120
|
+
store.collectedAll.after = [afterAll]
|
|
121
|
+
}
|
|
122
|
+
} else {
|
|
123
|
+
if (store.before[method] || store.after[method] || store.error[method]) {
|
|
124
|
+
const collected = collect({
|
|
125
|
+
before: store.before[method] || [],
|
|
126
|
+
after: store.after[method] || [],
|
|
127
|
+
error: store.error[method] || []
|
|
128
|
+
})
|
|
129
|
+
|
|
130
|
+
store.collected[method] = [collected]
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
})
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
return this
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export function createContext(service: Service, method: string, data: HookContextData = {}) {
|
|
141
|
+
const createContext = (service as any)[method].createContext
|
|
142
|
+
|
|
143
|
+
if (typeof createContext !== 'function') {
|
|
144
|
+
throw new Error(`Can not create context for method ${method}`)
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
return createContext(data) as HookContext
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export class FeathersHookManager<A> extends HookManager {
|
|
151
|
+
constructor(public app: A, public method: string) {
|
|
152
|
+
super()
|
|
153
|
+
this._middleware = []
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
collectMiddleware(self: any, args: any[]): Middleware[] {
|
|
157
|
+
const appHooks = collectHooks(this.app as any as HookEnabled, this.method)
|
|
158
|
+
const middleware = super.collectMiddleware(self, args)
|
|
159
|
+
const methodHooks = collectHooks(self, this.method)
|
|
160
|
+
|
|
161
|
+
return [...appHooks, ...middleware, ...methodHooks]
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
initializeContext(self: any, args: any[], context: HookContext) {
|
|
165
|
+
const ctx = super.initializeContext(self, args, context)
|
|
166
|
+
|
|
167
|
+
ctx.params = ctx.params || {}
|
|
168
|
+
|
|
169
|
+
return ctx
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
middleware(mw: Middleware[]) {
|
|
173
|
+
this._middleware.push(...mw)
|
|
174
|
+
return this
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export function hookMixin<A>(this: A, service: FeathersService<A>, path: string, options: ServiceOptions) {
|
|
179
|
+
if (typeof service.hooks === 'function') {
|
|
180
|
+
return service
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
const hookMethods = getHookMethods(service, options)
|
|
184
|
+
|
|
185
|
+
const serviceMethodHooks = hookMethods.reduce((res, method) => {
|
|
186
|
+
const params = (defaultServiceArguments as any)[method] || ['data', 'params']
|
|
187
|
+
|
|
188
|
+
res[method] = new FeathersHookManager<A>(this, method).params(...params).props({
|
|
189
|
+
app: this,
|
|
190
|
+
path,
|
|
191
|
+
method,
|
|
192
|
+
service,
|
|
193
|
+
event: null,
|
|
194
|
+
type: 'around',
|
|
195
|
+
get statusCode() {
|
|
196
|
+
return this.http?.status
|
|
197
|
+
},
|
|
198
|
+
set statusCode(value: number) {
|
|
199
|
+
this.http = this.http || {}
|
|
200
|
+
this.http.status = value
|
|
201
|
+
}
|
|
202
|
+
})
|
|
203
|
+
|
|
204
|
+
return res
|
|
205
|
+
}, {} as BaseHookMap)
|
|
206
|
+
|
|
207
|
+
const registerHooks = enableHooks(service)
|
|
208
|
+
|
|
209
|
+
hooks(service, serviceMethodHooks)
|
|
210
|
+
|
|
211
|
+
service.hooks = function (this: any, hookOptions: any) {
|
|
212
|
+
if (hookOptions.before || hookOptions.after || hookOptions.error || hookOptions.around) {
|
|
213
|
+
return registerHooks.call(this, hookOptions)
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
if (Array.isArray(hookOptions)) {
|
|
217
|
+
return hooks(this, hookOptions)
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
Object.keys(hookOptions).forEach((method) => {
|
|
221
|
+
const manager = getManager(this[method])
|
|
222
|
+
|
|
223
|
+
if (!(manager instanceof FeathersHookManager)) {
|
|
224
|
+
throw new Error(`Method ${method} is not a Feathers hooks enabled service method`)
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
manager.middleware(hookOptions[method])
|
|
228
|
+
})
|
|
229
|
+
|
|
230
|
+
return this
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
return service
|
|
234
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import { setDebug } from '
|
|
2
|
-
import version from './version';
|
|
3
|
-
import { Feathers } from './application';
|
|
4
|
-
import { Application } from './declarations';
|
|
1
|
+
import { setDebug } from '@feathersjs/commons'
|
|
5
2
|
|
|
6
|
-
|
|
7
|
-
|
|
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
|
|
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,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
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: [
|
|
8
|
-
get: [
|
|
9
|
-
create: [
|
|
10
|
-
update: [
|
|
11
|
-
patch: [
|
|
12
|
-
remove: [
|
|
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
|
-
export const defaultServiceMethods = Object.keys(defaultServiceArguments);
|
|
15
|
+
export const defaultServiceMethods = ['find', 'get', 'create', 'update', 'patch', 'remove']
|
|
16
16
|
|
|
17
17
|
export const defaultEventMap = {
|
|
18
18
|
create: 'created',
|
|
@@ -21,70 +21,58 @@ export const defaultEventMap = {
|
|
|
21
21
|
remove: 'removed'
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
export const defaultServiceEvents = Object.values(defaultEventMap)
|
|
25
|
+
|
|
24
26
|
export const protectedMethods = Object.keys(Object.prototype)
|
|
25
27
|
.concat(Object.keys(EventEmitter.prototype))
|
|
26
|
-
.concat([
|
|
27
|
-
'before',
|
|
28
|
-
'after',
|
|
29
|
-
'error',
|
|
30
|
-
'hooks',
|
|
31
|
-
'setup',
|
|
32
|
-
'publish'
|
|
33
|
-
]);
|
|
28
|
+
.concat(['all', 'around', 'before', 'after', 'error', 'hooks', 'setup', 'teardown', 'publish'])
|
|
34
29
|
|
|
35
|
-
export function getHookMethods
|
|
36
|
-
const { methods } = options
|
|
30
|
+
export function getHookMethods(service: any, options: ServiceOptions) {
|
|
31
|
+
const { methods } = options
|
|
37
32
|
|
|
38
|
-
return defaultServiceMethods
|
|
39
|
-
typeof service[m] === 'function' && !methods.includes(m)
|
|
40
|
-
|
|
33
|
+
return (defaultServiceMethods as any as string[])
|
|
34
|
+
.filter((m) => typeof service[m] === 'function' && !methods.includes(m))
|
|
35
|
+
.concat(methods)
|
|
41
36
|
}
|
|
42
37
|
|
|
43
|
-
export function getServiceOptions
|
|
44
|
-
service
|
|
45
|
-
|
|
46
|
-
const existingOptions = service[SERVICE];
|
|
47
|
-
|
|
48
|
-
if (existingOptions) {
|
|
49
|
-
return existingOptions;
|
|
50
|
-
}
|
|
38
|
+
export function getServiceOptions(service: any): ServiceOptions {
|
|
39
|
+
return service[SERVICE]
|
|
40
|
+
}
|
|
51
41
|
|
|
42
|
+
export const normalizeServiceOptions = (service: any, options: ServiceOptions = {}): ServiceOptions => {
|
|
52
43
|
const {
|
|
53
|
-
methods = defaultServiceMethods.filter(method =>
|
|
54
|
-
typeof service[method] === 'function'
|
|
55
|
-
),
|
|
44
|
+
methods = defaultServiceMethods.filter((method) => typeof service[method] === 'function'),
|
|
56
45
|
events = service.events || []
|
|
57
|
-
} = options
|
|
58
|
-
const
|
|
59
|
-
serviceEvents = Object.values(defaultEventMap).concat(events)
|
|
60
|
-
} = options;
|
|
46
|
+
} = options
|
|
47
|
+
const serviceEvents = options.serviceEvents || defaultServiceEvents.concat(events)
|
|
61
48
|
|
|
62
49
|
return {
|
|
63
50
|
...options,
|
|
64
51
|
events,
|
|
65
52
|
methods,
|
|
66
53
|
serviceEvents
|
|
67
|
-
}
|
|
54
|
+
}
|
|
68
55
|
}
|
|
69
56
|
|
|
70
|
-
export function wrapService
|
|
71
|
-
location: string, service: any, options: ServiceOptions
|
|
72
|
-
) {
|
|
57
|
+
export function wrapService(location: string, service: any, options: ServiceOptions) {
|
|
73
58
|
// Do nothing if this is already an initialized
|
|
74
59
|
if (service[SERVICE]) {
|
|
75
|
-
return service
|
|
60
|
+
return service
|
|
76
61
|
}
|
|
77
62
|
|
|
78
|
-
const protoService = Object.create(service)
|
|
79
|
-
const serviceOptions =
|
|
63
|
+
const protoService = Object.create(service)
|
|
64
|
+
const serviceOptions = normalizeServiceOptions(service, options)
|
|
80
65
|
|
|
81
|
-
if (
|
|
82
|
-
|
|
66
|
+
if (
|
|
67
|
+
Object.keys(serviceOptions.methods).length === 0 &&
|
|
68
|
+
![...defaultServiceMethods, 'setup', 'teardown'].some((method) => typeof service[method] === 'function')
|
|
69
|
+
) {
|
|
70
|
+
throw new Error(`Invalid service object passed for path \`${location}\``)
|
|
83
71
|
}
|
|
84
72
|
|
|
85
73
|
Object.defineProperty(protoService, SERVICE, {
|
|
86
74
|
value: serviceOptions
|
|
87
|
-
})
|
|
75
|
+
})
|
|
88
76
|
|
|
89
|
-
return protoService
|
|
77
|
+
return protoService
|
|
90
78
|
}
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default '5.0.0
|
|
1
|
+
export default '5.0.0'
|
package/lib/dependencies.d.ts
DELETED
package/lib/dependencies.js
DELETED
|
@@ -1,18 +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
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
-
};
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.EventEmitter = void 0;
|
|
14
|
-
const events_1 = require("events");
|
|
15
|
-
Object.defineProperty(exports, "EventEmitter", { enumerable: true, get: function () { return events_1.EventEmitter; } });
|
|
16
|
-
__exportStar(require("@feathersjs/commons"), exports);
|
|
17
|
-
__exportStar(require("@feathersjs/hooks"), exports);
|
|
18
|
-
//# sourceMappingURL=dependencies.js.map
|
package/lib/dependencies.js.map
DELETED
|
@@ -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"}
|
package/lib/hooks/index.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { HookContextData, HookManager, Middleware } from '../dependencies';
|
|
2
|
-
import { Service, ServiceOptions, HookContext, FeathersService, Application } from '../declarations';
|
|
3
|
-
import { fromAfterHook, fromBeforeHook, fromErrorHooks } from './legacy';
|
|
4
|
-
export { fromAfterHook, fromBeforeHook, fromErrorHooks };
|
|
5
|
-
export declare function createContext(service: Service<any>, method: string, data?: HookContextData): HookContext<Application<any, any>, any>;
|
|
6
|
-
export declare class FeathersHookManager<A> extends HookManager {
|
|
7
|
-
app: A;
|
|
8
|
-
method: string;
|
|
9
|
-
constructor(app: A, method: string);
|
|
10
|
-
collectMiddleware(self: any, args: any[]): Middleware[];
|
|
11
|
-
initializeContext(self: any, args: any[], context: HookContext): import("@feathersjs/hooks/lib/base").HookContext<any, any>;
|
|
12
|
-
middleware(mw: Middleware[]): this;
|
|
13
|
-
}
|
|
14
|
-
export declare function hookMixin<A>(this: A, service: FeathersService<A>, path: string, options: ServiceOptions): FeathersService<A, Service<any, Partial<any>>>;
|
package/lib/hooks/index.js
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hookMixin = exports.FeathersHookManager = exports.createContext = exports.fromErrorHooks = exports.fromBeforeHook = exports.fromAfterHook = void 0;
|
|
4
|
-
const dependencies_1 = require("../dependencies");
|
|
5
|
-
const service_1 = require("../service");
|
|
6
|
-
const legacy_1 = require("./legacy");
|
|
7
|
-
Object.defineProperty(exports, "fromAfterHook", { enumerable: true, get: function () { return legacy_1.fromAfterHook; } });
|
|
8
|
-
Object.defineProperty(exports, "fromBeforeHook", { enumerable: true, get: function () { return legacy_1.fromBeforeHook; } });
|
|
9
|
-
Object.defineProperty(exports, "fromErrorHooks", { enumerable: true, get: function () { return legacy_1.fromErrorHooks; } });
|
|
10
|
-
function createContext(service, method, data = {}) {
|
|
11
|
-
const createContext = service[method].createContext;
|
|
12
|
-
if (typeof createContext !== 'function') {
|
|
13
|
-
throw new Error(`Can not create context for method ${method}`);
|
|
14
|
-
}
|
|
15
|
-
return createContext(data);
|
|
16
|
-
}
|
|
17
|
-
exports.createContext = createContext;
|
|
18
|
-
class FeathersHookManager extends dependencies_1.HookManager {
|
|
19
|
-
constructor(app, method) {
|
|
20
|
-
super();
|
|
21
|
-
this.app = app;
|
|
22
|
-
this.method = method;
|
|
23
|
-
this._middleware = [];
|
|
24
|
-
}
|
|
25
|
-
collectMiddleware(self, args) {
|
|
26
|
-
const app = this.app;
|
|
27
|
-
const appHooks = app.appHooks[dependencies_1.HOOKS].concat(app.appHooks[this.method] || []);
|
|
28
|
-
const legacyAppHooks = legacy_1.collectLegacyHooks(this.app, this.method);
|
|
29
|
-
const middleware = super.collectMiddleware(self, args);
|
|
30
|
-
const legacyHooks = legacy_1.collectLegacyHooks(self, this.method);
|
|
31
|
-
return [...appHooks, ...legacyAppHooks, ...middleware, ...legacyHooks];
|
|
32
|
-
}
|
|
33
|
-
initializeContext(self, args, context) {
|
|
34
|
-
const ctx = super.initializeContext(self, args, context);
|
|
35
|
-
ctx.params = ctx.params || {};
|
|
36
|
-
return ctx;
|
|
37
|
-
}
|
|
38
|
-
middleware(mw) {
|
|
39
|
-
this._middleware.push(...mw);
|
|
40
|
-
return this;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
exports.FeathersHookManager = FeathersHookManager;
|
|
44
|
-
function hookMixin(service, path, options) {
|
|
45
|
-
if (typeof service.hooks === 'function') {
|
|
46
|
-
return service;
|
|
47
|
-
}
|
|
48
|
-
const app = this;
|
|
49
|
-
const serviceMethodHooks = service_1.getHookMethods(service, options).reduce((res, method) => {
|
|
50
|
-
const params = service_1.defaultServiceArguments[method] || ['data', 'params'];
|
|
51
|
-
res[method] = new FeathersHookManager(app, method)
|
|
52
|
-
.params(...params)
|
|
53
|
-
.props({
|
|
54
|
-
app,
|
|
55
|
-
path,
|
|
56
|
-
method,
|
|
57
|
-
service,
|
|
58
|
-
event: null,
|
|
59
|
-
type: null
|
|
60
|
-
});
|
|
61
|
-
return res;
|
|
62
|
-
}, {});
|
|
63
|
-
const handleLegacyHooks = legacy_1.enableLegacyHooks(service);
|
|
64
|
-
dependencies_1.hooks(service, serviceMethodHooks);
|
|
65
|
-
service.hooks = function (hookOptions) {
|
|
66
|
-
if (hookOptions.before || hookOptions.after || hookOptions.error) {
|
|
67
|
-
return handleLegacyHooks.call(this, hookOptions);
|
|
68
|
-
}
|
|
69
|
-
if (Array.isArray(hookOptions)) {
|
|
70
|
-
return dependencies_1.hooks(this, hookOptions);
|
|
71
|
-
}
|
|
72
|
-
Object.keys(hookOptions).forEach(method => {
|
|
73
|
-
const manager = dependencies_1.getManager(this[method]);
|
|
74
|
-
if (!(manager instanceof FeathersHookManager)) {
|
|
75
|
-
throw new Error(`Method ${method} is not a Feathers hooks enabled service method`);
|
|
76
|
-
}
|
|
77
|
-
manager.middleware(hookOptions[method]);
|
|
78
|
-
});
|
|
79
|
-
return this;
|
|
80
|
-
};
|
|
81
|
-
return service;
|
|
82
|
-
}
|
|
83
|
-
exports.hookMixin = hookMixin;
|
|
84
|
-
//# sourceMappingURL=index.js.map
|
package/lib/hooks/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":";;;AAAA,kDAEyB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G,UAAqB,WAAgB;QACnD,IAAI,WAAW,CAAC,MAAM,IAAI,WAAW,CAAC,KAAK,IAAI,WAAW,CAAC,KAAK,EAAE;YAChE,OAAO,iBAAiB,CAAC,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;SAClD;QAED,IAAI,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;YAC9B,OAAO,oBAAK,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;SACjC;QAED,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;YACxC,MAAM,OAAO,GAAG,yBAAU,CAAC,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;AAnDD,8BAmDC"}
|
package/lib/hooks/legacy.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { LegacyHookFunction } from '../declarations';
|
|
2
|
-
export declare function fromBeforeHook(hook: LegacyHookFunction): (context: any, next: any) => Promise<any>;
|
|
3
|
-
export declare function fromAfterHook(hook: LegacyHookFunction): (context: any, next: any) => any;
|
|
4
|
-
export declare function fromErrorHooks(hooks: LegacyHookFunction[]): (context: any, next: any) => any;
|
|
5
|
-
export declare function collectLegacyHooks(target: any, method: string): any[];
|
|
6
|
-
export declare function convertHookData(obj: any): any;
|
|
7
|
-
export declare function enableLegacyHooks(obj: any, methods?: string[], types?: string[]): (this: any, allHooks: any) => any;
|
package/lib/hooks/legacy.js
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.enableLegacyHooks = exports.convertHookData = exports.collectLegacyHooks = exports.fromErrorHooks = exports.fromAfterHook = exports.fromBeforeHook = void 0;
|
|
4
|
-
const dependencies_1 = require("../dependencies");
|
|
5
|
-
const { each } = dependencies_1._;
|
|
6
|
-
function fromBeforeHook(hook) {
|
|
7
|
-
return (context, next) => {
|
|
8
|
-
context.type = 'before';
|
|
9
|
-
return Promise.resolve(hook.call(context.self, context)).then(() => {
|
|
10
|
-
context.type = null;
|
|
11
|
-
return next();
|
|
12
|
-
});
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
exports.fromBeforeHook = fromBeforeHook;
|
|
16
|
-
function fromAfterHook(hook) {
|
|
17
|
-
return (context, next) => {
|
|
18
|
-
return next().then(() => {
|
|
19
|
-
context.type = 'after';
|
|
20
|
-
return hook.call(context.self, context);
|
|
21
|
-
}).then(() => {
|
|
22
|
-
context.type = null;
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
exports.fromAfterHook = fromAfterHook;
|
|
27
|
-
function fromErrorHooks(hooks) {
|
|
28
|
-
return (context, next) => {
|
|
29
|
-
return next().catch((error) => {
|
|
30
|
-
let promise = Promise.resolve();
|
|
31
|
-
context.original = Object.assign({}, context);
|
|
32
|
-
context.error = error;
|
|
33
|
-
context.type = 'error';
|
|
34
|
-
delete context.result;
|
|
35
|
-
for (const hook of hooks) {
|
|
36
|
-
promise = promise.then(() => hook.call(context.self, context));
|
|
37
|
-
}
|
|
38
|
-
return promise.then(() => {
|
|
39
|
-
context.type = null;
|
|
40
|
-
if (context.result === undefined) {
|
|
41
|
-
throw context.error;
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
exports.fromErrorHooks = fromErrorHooks;
|
|
48
|
-
function collectLegacyHooks(target, method) {
|
|
49
|
-
const { before: { [method]: before = [] }, after: { [method]: after = [] }, error: { [method]: error = [] } } = target.__hooks;
|
|
50
|
-
const beforeHooks = before;
|
|
51
|
-
const afterHooks = [...after].reverse();
|
|
52
|
-
const errorHook = fromErrorHooks(error);
|
|
53
|
-
return [errorHook, ...beforeHooks, ...afterHooks];
|
|
54
|
-
}
|
|
55
|
-
exports.collectLegacyHooks = collectLegacyHooks;
|
|
56
|
-
// Converts different hook registration formats into the
|
|
57
|
-
// same internal format
|
|
58
|
-
function convertHookData(obj) {
|
|
59
|
-
let hook = {};
|
|
60
|
-
if (Array.isArray(obj)) {
|
|
61
|
-
hook = { all: obj };
|
|
62
|
-
}
|
|
63
|
-
else if (typeof obj !== 'object') {
|
|
64
|
-
hook = { all: [obj] };
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
each(obj, function (value, key) {
|
|
68
|
-
hook[key] = !Array.isArray(value) ? [value] : value;
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
return hook;
|
|
72
|
-
}
|
|
73
|
-
exports.convertHookData = convertHookData;
|
|
74
|
-
// Add `.hooks` functionality to an object
|
|
75
|
-
function enableLegacyHooks(obj, methods = ['find', 'get', 'create', 'update', 'patch', 'remove'], types = ['before', 'after', 'error']) {
|
|
76
|
-
const hookData = {};
|
|
77
|
-
types.forEach(type => {
|
|
78
|
-
// Initialize properties where hook functions are stored
|
|
79
|
-
hookData[type] = {};
|
|
80
|
-
});
|
|
81
|
-
// Add non-enumerable `__hooks` property to the object
|
|
82
|
-
Object.defineProperty(obj, '__hooks', {
|
|
83
|
-
configurable: true,
|
|
84
|
-
value: hookData,
|
|
85
|
-
writable: true
|
|
86
|
-
});
|
|
87
|
-
return function legacyHooks(allHooks) {
|
|
88
|
-
each(allHooks, (current, type) => {
|
|
89
|
-
if (!this.__hooks[type]) {
|
|
90
|
-
throw new Error(`'${type}' is not a valid hook type`);
|
|
91
|
-
}
|
|
92
|
-
const hooks = convertHookData(current);
|
|
93
|
-
each(hooks, (_value, method) => {
|
|
94
|
-
if (method !== 'all' && methods.indexOf(method) === -1) {
|
|
95
|
-
throw new Error(`'${method}' is not a valid hook method`);
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
methods.forEach(method => {
|
|
99
|
-
let currentHooks = [...(hooks.all || []), ...(hooks[method] || [])];
|
|
100
|
-
this.__hooks[type][method] = this.__hooks[type][method] || [];
|
|
101
|
-
if (type === 'before') {
|
|
102
|
-
currentHooks = currentHooks.map(fromBeforeHook);
|
|
103
|
-
}
|
|
104
|
-
if (type === 'after') {
|
|
105
|
-
currentHooks = currentHooks.map(fromAfterHook);
|
|
106
|
-
}
|
|
107
|
-
this.__hooks[type][method].push(...currentHooks);
|
|
108
|
-
});
|
|
109
|
-
});
|
|
110
|
-
return this;
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
exports.enableLegacyHooks = enableLegacyHooks;
|
|
114
|
-
//# sourceMappingURL=legacy.js.map
|
package/lib/hooks/legacy.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"legacy.js","sourceRoot":"","sources":["../../src/hooks/legacy.ts"],"names":[],"mappings":";;;AAAA,kDAAoC;AAGpC,MAAM,EAAE,IAAI,EAAE,GAAG,gBAAC,CAAC;AAEnB,SAAgB,cAAc,CAAE,IAAwB;IACtD,OAAO,CAAC,OAAY,EAAE,IAAS,EAAE,EAAE;QACjC,OAAO,CAAC,IAAI,GAAG,QAAQ,CAAC;QAExB,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;YACjE,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;YACpB,OAAO,IAAI,EAAE,CAAC;QAChB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AATD,wCASC;AAED,SAAgB,aAAa,CAAE,IAAwB;IACrD,OAAO,CAAC,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