fix: Add registerPublisher method to protected method list

This commit is contained in:
daffl 2025-09-02 12:55:50 -07:00
parent 9a11776aa2
commit 2c0664acf9
2 changed files with 21 additions and 1 deletions

View File

@ -170,6 +170,15 @@ describe('Feathers application', () => {
message: "'teardown' on service 'dummy' is not allowed as a custom method name"
}
)
assert.throws(
() =>
feathers().use('/dummy', dummyService, {
methods: ['create', 'registerPublisher']
}),
{
message: "'registerPublisher' on service 'dummy' is not allowed as a custom method name"
}
)
})
it('can register service with no external methods', async () => {

View File

@ -25,7 +25,18 @@ export const defaultServiceEvents = Object.values(defaultEventMap)
export const protectedMethods = Object.keys(Object.prototype)
.concat(Object.keys(EventEmitter.prototype))
.concat(['all', 'around', 'before', 'after', 'error', 'hooks', 'setup', 'teardown', 'publish'])
.concat([
'all',
'around',
'before',
'after',
'error',
'hooks',
'setup',
'teardown',
'publish',
'registerPublisher'
])
export const protectedProperties = protectedMethods.concat(['service', 'events', 'id'])