kasia icon indicating copy to clipboard operation
kasia copied to clipboard

kasia-plugin-wp-api-response-modify not published to npm

Open nickpalmer opened this issue 6 years ago • 7 comments

$ npm install --save kasia-plugin-wp-api-response-modify
npm ERR! code E404
npm ERR! 404 Not Found: kasia-plugin-wp-api-response-modify@latest

Is there a reason this plugin hasn't been pushed to npm?

nickpalmer avatar Aug 16 '17 19:08 nickpalmer

Ah, good spot. 👍 It hasn't been tested and to be honest I forgot about it after splitting it out into a separate module, probably because we haven't needed it since. I will try and get it tested and published asap.

sdgluck avatar Aug 17 '17 09:08 sdgluck

Not super urgent, I am just evaluating Kasia and wanted to see what that plugin does. Thanks for the work on this project. Looking good so far. Is very aligned with what I was thinking to build already.

nickpalmer avatar Aug 18 '17 06:08 nickpalmer

Thanks- I hope you find it useful!

sdgluck avatar Aug 18 '17 14:08 sdgluck

Tagging along with this issue–I don't believe the plugin works. I emulated it with a custom plugin with the same signature as the kasia-wp-modify one and quickly realized that the return value must have a sagas property, which the plugin does not.

joshlevinson avatar Sep 12 '17 07:09 joshlevinson

Another oddity: The api-modify effect clobbers the entire state and just returns action.data post-effects. Upstream code expects the state to be returned in the shape of completeReducer.

For lack of a better immediate solution, my effect looks like this:

// imports for ActionTypes, modify, completeReducer, and normalise
const sanifyWPKasia = (_, effects) => ({
  reducers: {
    [ActionTypes.RequestComplete]: (state, action) => {
      const data = modify(action.data, effects);
      return completeReducer(normalise)(state, merge({}, action, { data }));
    },
  },
  sagas: [],
});

Once the modify effects transform the action data, upstream expects to find the data in state.entities, so I passed it back through completeReducer.

joshlevinson avatar Sep 12 '17 07:09 joshlevinson

@sdgluck Any update here? Still seems to be failing.

MickeyKay avatar Jan 10 '18 20:01 MickeyKay

@MickeyKay Apologies, I've not found the time to fix this yet. Am working on the next version of Kasia atm (including your req/res feature request 😃). This is next on the list!

sdgluck avatar Jan 24 '18 17:01 sdgluck