feathersjs / feathers

The API and real-time application framework
https://feathersjs.com
MIT License
15.08k stars 750 forks source link

Service Method list not correct on client side #3329

Open elvince opened 1 year ago

elvince commented 1 year ago

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 commented 1 year ago

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

daffl commented 12 months ago

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).

elvince commented 12 months ago

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