feathers icon indicating copy to clipboard operation
feathers copied to clipboard

Service Method list not correct on client side

Open elvince opened this issue 1 year ago • 3 comments

Steps to reproduce

Hi,

Create a service (with knex postgre on my side). Most on my CRUDS methods should not be accessible from external (for this I set the appropriate hooks).

Next I register the methods I want to be available on client side.

// Register a socket client service with all methods listed
client.use('myservice', socketClient.service('myservice'), {
  methods: ['find', 'get',  'update', 'patch',  'myCustomMethod']
})

For example, Create/Remove are not listed

Expected behavior

The methods shoulds not be available on client side

Actual behavior

The methods are available on client side

Module versions (especially the part that's not working): Feathers, knex, 5.0.3 Feathers cli: 5.0.9

NodeJS version: v20.9.0

Operating System: w10 64bits

Thanks,

elvince avatar Nov 08 '23 13:11 elvince

Can someone confirm if it's a bug, if something is wrong on my code or a "won't fix it's by design" ? Thanks

elvince avatar Nov 28 '23 09:11 elvince

Unfortunately the default method list is currently not being inferred. They will throw a NotImplemented error if you try to call them though.

Ideally the client inference needs to be reworked to use service and custom methods but only use the data and return types (instead of just taking the entire method signature).

daffl avatar Nov 28 '23 17:11 daffl

Thanks for the clarification. In the mean time, could you update the docs so this behavior is explained and expected.

elvince avatar Nov 29 '23 11:11 elvince