Skip to content

Conversation

@marshallswain
Copy link
Member

@marshallswain marshallswain commented Jan 10, 2026

Summary

This PR adds support for the externalMethods option to control which service methods are exposed via transports (HTTP/WebSockets), addressing #3457.

Changes

@feathersjs/feathers

  • Added externalMethods to ServiceOptions interface
  • Added getExternalMethods() helper function
  • Updated normalizeServiceOptions() to include externalMethods (defaults to methods for backwards compatibility)

@feathersjs/transport-commons

  • Updated socket/utils.ts to use externalMethods for method validation
  • Updated socket/index.ts to use externalMethods for handler registration

Usage

app.use('myService', new MyService(), {
  // Methods that receive 'all' hooks
  methods: ['find', 'get', 'create', 'internalAction'],
  // Methods exposed via transports (defaults to methods if not specified)
  externalMethods: ['find', 'get', 'create']
})

Backwards Compatibility

  • If externalMethods is not specified, it defaults to methods
  • Existing code works without modification

Related

- Add externalMethods to ServiceOptions to control transport exposure
- Add getExternalMethods() helper function
- Update transport-commons socket transport to use externalMethods
- Backwards compatible: externalMethods defaults to methods
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hooks should run on non-enabled methods

2 participants