New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@wordpress/data

Package Overview
Dependencies
Maintainers
14
Versions
224
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wordpress/data - npm Package Compare versions

Comparing version 4.15.0 to 4.16.0

8

build-module/namespace-store/index.js

@@ -262,5 +262,3 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";

function _fulfillSelector() {
_fulfillSelector = _asyncToGenerator(
/*#__PURE__*/
_regeneratorRuntime.mark(function _callee() {
_fulfillSelector = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
var state, _store$__unstableOrig, metadata;

@@ -337,5 +335,3 @@

function _fulfillResolver() {
_fulfillResolver = _asyncToGenerator(
/*#__PURE__*/
_regeneratorRuntime.mark(function _callee2(store, resolvers, selectorName) {
_fulfillResolver = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(store, resolvers, selectorName) {
var resolver,

@@ -342,0 +338,0 @@ _len4,

@@ -41,2 +41,4 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";

* @typedef {Object} WPDataPlugin An object of registry function overrides.
*
* @property {Function} registerStore registers store.
*/

@@ -43,0 +45,0 @@

@@ -273,5 +273,3 @@ "use strict";

function _fulfillSelector() {
_fulfillSelector = (0, _asyncToGenerator2.default)(
/*#__PURE__*/
_regenerator.default.mark(function _callee() {
_fulfillSelector = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
var state, _store$__unstableOrig, metadata;

@@ -348,5 +346,3 @@

function _fulfillResolver() {
_fulfillResolver = (0, _asyncToGenerator2.default)(
/*#__PURE__*/
_regenerator.default.mark(function _callee2(store, resolvers, selectorName) {
_fulfillResolver = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(store, resolvers, selectorName) {
var resolver,

@@ -353,0 +349,0 @@ _len4,

@@ -48,2 +48,4 @@ "use strict";

* @typedef {Object} WPDataPlugin An object of registry function overrides.
*
* @property {Function} registerStore registers store.
*/

@@ -50,0 +52,0 @@

{
"name": "@wordpress/data",
"version": "4.15.0",
"version": "4.16.0",
"description": "Data module for WordPress.",

@@ -25,13 +25,13 @@ "author": "The WordPress Contributors",

"dependencies": {
"@babel/runtime": "^7.8.3",
"@wordpress/compose": "^3.12.0",
"@wordpress/deprecated": "^2.7.0",
"@wordpress/element": "^2.12.0",
"@wordpress/is-shallow-equal": "^1.8.0",
"@wordpress/priority-queue": "^1.5.1",
"@wordpress/redux-routine": "^3.7.0",
"@babel/runtime": "^7.9.2",
"@wordpress/compose": "^3.13.0",
"@wordpress/deprecated": "^2.8.0",
"@wordpress/element": "^2.13.0",
"@wordpress/is-shallow-equal": "^2.0.0",
"@wordpress/priority-queue": "^1.6.0",
"@wordpress/redux-routine": "^3.8.0",
"equivalent-key-map": "^0.2.2",
"is-promise": "^2.1.0",
"lodash": "^4.17.15",
"memize": "^1.0.5",
"memize": "^1.1.0",
"redux": "^4.0.0",

@@ -44,3 +44,3 @@ "turbo-combine-reducers": "^1.0.2",

},
"gitHead": "6e2ca778fb69c67188479b491cf2e802011d72e2"
"gitHead": "65dbf3a9503402ca3837090dc89d0207f7d96352"
}

@@ -103,10 +103,10 @@ # Data

The return value of `registerStore` is a [Redux-like store object](https://redux.js.org/docs/basics/Store.html) with the following methods:
The return value of `registerStore` is a [Redux-like store object](https://redux.js.org/basics/store) with the following methods:
- `store.getState()`: Returns the state value of the registered reducer
- _Redux parallel:_ [`getState`](https://redux.js.org/api-reference/store#getState)
- _Redux parallel:_ [`getState`](https://redux.js.org/api/store#getstate)
- `store.subscribe( listener: Function )`: Registers a function called any time the value of state changes.
- _Redux parallel:_ [`subscribe`](https://redux.js.org/api-reference/store#subscribe(listener))
- _Redux parallel:_ [`subscribe`](https://redux.js.org/api/store#subscribelistener)
- `store.dispatch( action: Object )`: Given an action object, calls the registered reducer and updates the state value.
- _Redux parallel:_ [`dispatch`](https://redux.js.org/api-reference/store#dispatch(action))
- _Redux parallel:_ [`dispatch`](https://redux.js.org/api/store#dispatchaction)

@@ -117,3 +117,3 @@ ### Options

A [**reducer**](https://redux.js.org/docs/basics/Reducers.html) is a function accepting the previous `state` and `action` as arguments and returns an updated `state` value.
A [**reducer**](https://redux.js.org/basics/reducers) is a function accepting the previous `state` and `action` as arguments and returns an updated `state` value.

@@ -153,3 +153,3 @@ #### `actions`

- `subscribe( listener: Function )`: Registers a function called any time the value of state changes.
- Behaves as Redux [`subscribe`](https://redux.js.org/api-reference/store#subscribe(listener))
- Behaves as Redux [`subscribe`](https://redux.js.org/api/store#subscribelistener)
with the following differences:

@@ -156,0 +156,0 @@ - Doesn't have to implement an unsubscribe, since the registry never uses it.

@@ -45,3 +45,3 @@ /**

it( 'resolves in expected order', ( done ) => {
it( 'resolves in expected order', async () => {
const actions = {

@@ -78,17 +78,19 @@ wait: () => ( { type: 'WAIT' } ),

registry.subscribe( () => {
const isFinished = registry
.select( 'store' )
.hasFinishedResolution( 'getItems' );
if ( isFinished ) {
expect( registry.select( 'store' ).getItems() ).toEqual( [
1,
2,
3,
] );
done();
}
return new Promise( ( resolve ) => {
registry.subscribe( () => {
const isFinished = registry
.select( 'store' )
.hasFinishedResolution( 'getItems' );
if ( isFinished ) {
expect( registry.select( 'store' ).getItems() ).toEqual( [
1,
2,
3,
] );
}
resolve();
} );
registry.select( 'store' ).getItems();
} );
registry.select( 'store' ).getItems();
} );

@@ -95,0 +97,0 @@ describe( 'selectors have expected value for the `hasResolver` property', () => {

@@ -14,3 +14,3 @@ /**

describe( 'persistence', () => {
let registry, originalRegisterStore;
let registry;

@@ -25,14 +25,4 @@ beforeAll( () => {

// Since the exposed `registerStore` is a proxying function, mimic
// intercept of original call by adding an initial plugin.
// TODO: Remove the `use` function in favor of `registerGenericStore`
registry = createRegistry()
.use( ( originalRegistry ) => {
originalRegisterStore = jest.spyOn(
originalRegistry,
'registerStore'
);
return {};
} )
.use( plugin, { storage: objectStorage } );
registry = createRegistry().use( plugin, { storage: objectStorage } );
} );

@@ -186,13 +176,2 @@

it( 'override values passed to registerStore', () => {
const options = { persist: true, reducer() {} };
registry.registerStore( 'test', options );
expect( originalRegisterStore ).toHaveBeenCalledWith( 'test', {
persist: true,
reducer: expect.any( Function ),
} );
} );
it( 'should not persist if option not passed', () => {

@@ -199,0 +178,0 @@ const initialState = { foo: 'bar', baz: 'qux' };

@@ -35,2 +35,4 @@ /**

* @typedef {Object} WPDataPlugin An object of registry function overrides.
*
* @property {Function} registerStore registers store.
*/

@@ -37,0 +39,0 @@

@@ -399,3 +399,3 @@ /**

it( 'should resolve promise non-action to dispatch', ( done ) => {
it( 'should resolve promise non-action to dispatch', () => {
let shouldThrow = false;

@@ -421,5 +421,3 @@ registry.registerStore( 'demo', {

process.nextTick( () => {
done();
} );
return new Promise( ( resolve ) => process.nextTick( resolve ) );
} );

@@ -426,0 +424,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc