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

Native provider state handlers and request filters #702

Merged
merged 1 commit into from
Jun 26, 2021

Conversation

mefellows
Copy link
Member

@mefellows mefellows commented Jun 24, 2021

The main changes:

  • Replaces the rust callback which doesn't support promises for state handlers whilst preserving the function parameters setup and params. The response type now expects a Promise.
  • Replaces the rust callback which doesn't support promises for request filters
  • Updates to logging as I was debugging things
  • Updates to types based on current best knowledge (I didn't feel like some of these types belonged in the proxy package, but also, they kind of needed to be there because of import cycles. Feedback welcome here).

Notably, the states (consumer) and state handlers (provider) now use the JsonMap type is outgoing/incoming. I think this is correct.

Opening as WIP for feedback, I'll squash it all before merging.

EDIT: check is failing due to code coverage. I can improve testing of some of the v3 interfaces, but let's get ✅ on the general approach first.

@mefellows mefellows changed the title Native provider state handlers Native provider state handlers and request filters Jun 24, 2021
@mefellows mefellows requested a review from TimothyJones June 24, 2021 03:54
@mefellows
Copy link
Member Author

cc: @lviana-menlosecurity - FYI.

src/dsl/verifier/proxy/types.ts Outdated Show resolved Hide resolved
src/dsl/verifier/proxy/types.ts Show resolved Hide resolved
src/dsl/verifier/proxy/stateHandler/setupStates.ts Outdated Show resolved Hide resolved
examples/v3/e2e/test/provider.spec.js Show resolved Hide resolved
src/dsl/verifier/proxy/stateHandler/setupStates.ts Outdated Show resolved Hide resolved
src/dsl/verifier/proxy/stateHandler/setupStates.ts Outdated Show resolved Hide resolved
src/dsl/verifier/proxy/tracer.ts Outdated Show resolved Hide resolved
src/v3/verifier.ts Outdated Show resolved Hide resolved
src/v3/verifier.ts Outdated Show resolved Hide resolved
@mefellows
Copy link
Member Author

OK I think I've resolved most items @TimothyJones. Feedback on the StateFunc is the only remaining thing I think.

I'll then tidy up commits, sync up with feat/v3.0.0 and merge after that.

@mefellows mefellows force-pushed the fix/provider-state-handlers branch from 665a3ff to b5e8638 Compare June 26, 2021 12:24
Adds back the proxy infrastructure to allow native promises
in the request filters and provider state handlers.

BREAKING CHANGE: the signature of state handlers has been updated to
accept either a single function with parameters, or an object that
can specify optional teardown and setup functions that run on the
different state phases.

BREAKING CHANGE: callbackTimeout is now timeout
@mefellows mefellows force-pushed the fix/provider-state-handlers branch from 691cdf2 to 456567c Compare June 26, 2021 12:51
@mefellows
Copy link
Member Author

Going to merge this in. Now that it's here, adding support for messages is actually not a huge amount of work either.

@mefellows mefellows marked this pull request as ready for review June 26, 2021 13:07
@mefellows mefellows merged commit 2cae51e into feat/v3.0.0 Jun 26, 2021
@mefellows mefellows deleted the fix/provider-state-handlers branch June 26, 2021 13:08
@TimothyJones
Copy link
Contributor

Awesome! Excited about this

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.

2 participants