Skip to content
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

Try to guess context data that's required down stream #199

Open
wants to merge 2 commits into
base: release
Choose a base branch
from

Conversation

mrfrase3
Copy link
Contributor

@mrfrase3 mrfrase3 commented Mar 8, 2024

Summary

Currently if you need to manually submit an event, like you want to push an update after calling _patch, this lib requires you to build a context object manually or else it wont work properly:

const newItem = await app.service(path)._patch(item._id, data);
app.service(path).emit('patched', newItem, { method: 'patch', id: item._id, result: newItem, path, params: {} });

most of the required info in context can already be gleaned from the execution context, so the code in this PR attempts a best guess context object. Whilst not perfect, it at least protects the developer from forgetting a fixed set of fields:

app.service(path).emit('patched', newItem);

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.

1 participant