consistent context overrides (redirect)
ssube opened this issue · 0 comments
ssube commented
Multiple services need to override parts of an outgoing command or message's context:
- the completion controller has a
defaultTarget
- the echo controller has a
defaultTarget
andforceChannel
- the base generator has a
defaultContext
anddefaultTarget
- the express listener has a
defaultTarget
- the loopback listener has a
defaultTarget
and needs aforceChannel
Many of these implement the same new Context({...defaults, ...options, ...force})
structure.
Extract that into a helper that will provide defaults and overrides to a Context
. It needs to set the:
channel: ChannelData
(id and thread)name: string
(user display name)source: source: boolean | service: ServiceMetadata
(default:source: true
)target: source: boolean | service: ServiceMetadata
(default:source: true
)user: User
(which setsname
anduid
)
Scope
- add
ContextRedirect
interface - add
redirectContext(...): Context
helper-
Context, ContextRedirect
args: from incoming entity and config -
services: ServiceModule, source: Listener = undefined
args: service module for source/target metadata lookups, source forsource = true
redirects
-
- ensure name/uid is set
look upwould be asyncUser
from uid?- refactor existing services
- update example config
- fix tests
- update docs
- add new interfaces to schema