-
Notifications
You must be signed in to change notification settings - Fork 375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
composition? #642
Comments
Requiring generators in an API feels premature - support for them may not be perfect, and they certainly make debugging transpiled code very painful.
This suggests that a call should always return a wrapper / proxy with an RSM-capable interface. Something like: interface RSMParameters {
max?: number
before?: string
after?: string
index?: number
}
interface RSMResult<T> {
supportsRsm: true
data: T
count: number,
first: string,
last: string
previous: () => Promise<RSMResult)
next: () => Promise<RSMResult>
get: (q: RSMParameters) => Promise<RSMResult>
}
interface NonRSMResult<T> {
supportsRsm: false
data: T
}
type PubSubResult = XML // I don't know from memory what this exactly looks like
interface PubSubPlugin<T> {
get: (query, rsm: boolean | RSMParameters=false) =>
Promise<RSMResult<PubSubResult>|NonRSMResult<PubSubResult>>
} As an alternative we could return the data directly if interface PubSubPlugin<T> {
get: (query, rsm: boolean | RSMParameters=false) =>
Promise<RSMResult<PubSubResult>|PubSubResult>
} |
Hey, |
While working on several "high level" packages for xmpp.js (pubsub, chat, ...) I realized there was one use case the current architecture does not help with.
Let's take PubSub and RSM
RSM is not limited to PubSub and PubSub does not need RSM, as such I do not want to implement RSM directly in the pubsub package. So I'm not sure how to offer RSM features to users.
I think composition would be great for this use case but I'm not sure how we should implement this
example:
However it does not provide enough flexibility, wouldn't be able to return the rsm info or iterate over them.
Maybe we could make plugin expose their internal functions to create stanzas and do
Thoughts? Comments?
cc @ggozad
cc @wichert
The text was updated successfully, but these errors were encountered: