-
-
Notifications
You must be signed in to change notification settings - Fork 761
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
feat(core): Improve legacy hooks integration #2483
Conversation
39e4de2
to
6f5b9da
Compare
45a8a98
to
408aff4
Compare
Had to break down Real problem here though is that the passing level is set too low (maybe because of replacements for |
This looks great, thank you! I've been looking with @marshallswain into a way to make the transition less scary (early adopters with larger codebases had concerns about the old hooks becoming "legacy") and we were thinking of using a naming of "Regular" ( import { hooks } from '@feathersjs/hooks';
class DummyClass {
async create(data: any) {
return data;
}
}
hooks(DummyClass, {
create: middleware([
collect({
before: [],
after: [],
error: []
})
])
}) So I'm thinking of getting your PR in, porting it into the |
Sounds good. Small note - it might make sense to add |
This pulls over the code for Regular hooks from this PR: feathersjs/feathers#2483
I've copied the utility functions into the https://github.com/feathersjs/hooks/blob/deno-port/packages/hooks/src/regular.ts |
This pulls over the code for Regular hooks from this PR: feathersjs/feathers#2483
This pulls over the code for Regular hooks from this PR: feathersjs/feathers#2483
* `collect` hooks util. Not hitting error hooks * Fix error hook handling and update tests * docs: complete refactor * fix: cleaner utilities for regular hooks & collect This pulls over the code for Regular hooks from this PR: feathersjs/feathers#2483 Co-authored-by: marshall_thompson2 <[email protected]> Co-authored-by: daffl <[email protected]>
* `collect` hooks util. Not hitting error hooks * Fix error hook handling and update tests * docs: complete refactor * feat: Port package and tests to Deno first * feat: cleaner regular hooks This pulls over the code for Regular hooks from this PR: feathersjs/feathers#2483 * Add makefile and build infrastructure * Update build file and dependencies * Remove NodeJS workflow * test: collect hooks * fix: imports * feat: run coverage reports in CI This also adds the `cov_profile` folder to the .gitignore. Not sure if we need it checked in. * chore: setup deno lint * chore: configure deno lint and deno fmt in makefile * chore: format and lint as part of test script * chore: simplify test script * Some additional tweaks Co-authored-by: marshall_thompson2 <[email protected]> Co-authored-by: daffl <[email protected]>
This pulls over the code for Regular hooks from this PR: feathersjs/feathers#2483 Co-authored-by: marshall_thompson2 <[email protected]> Co-authored-by: daffl <[email protected]>
Main thing is that now legacy hooks wrappers are cached much more. Currently
collectLegacyHooks
creates new array every time it is called withafterHooks
being spread/reversed,errorHook
being produced again and then all legacy combined into one array. Those things can be done during.hooks
setup call.Also:
fromBeforeHooks
,fromAfterHooks
andfromErrorHook
to complete the set.types
argument fromenableLegacyHooks
, it lacked a meaning.all
to list ofprotectedMethods
for services.