@wordpress/data 9.12.6 → 9.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +6 -6
  3. package/build/components/async-mode-provider/context.js +1 -1
  4. package/build/components/async-mode-provider/context.js.map +1 -1
  5. package/build/components/use-dispatch/use-dispatch.js +1 -1
  6. package/build/components/use-dispatch/use-dispatch.js.map +1 -1
  7. package/build/components/with-dispatch/index.js +4 -4
  8. package/build/components/with-dispatch/index.js.map +1 -1
  9. package/build/components/with-registry/index.js +4 -4
  10. package/build/components/with-registry/index.js.map +1 -1
  11. package/build/components/with-select/index.js +4 -4
  12. package/build/components/with-select/index.js.map +1 -1
  13. package/build/index.js +2 -7
  14. package/build/index.js.map +1 -1
  15. package/build/lock-unlock.js +1 -1
  16. package/build/lock-unlock.js.map +1 -1
  17. package/build/redux-store/combine-reducers.js +22 -0
  18. package/build/redux-store/combine-reducers.js.map +1 -0
  19. package/build/redux-store/index.js +10 -4
  20. package/build/redux-store/index.js.map +1 -1
  21. package/build/resolvers-cache-middleware.js +18 -16
  22. package/build/resolvers-cache-middleware.js.map +1 -1
  23. package/build-module/components/async-mode-provider/context.js +1 -1
  24. package/build-module/components/async-mode-provider/context.js.map +1 -1
  25. package/build-module/components/use-dispatch/use-dispatch.js +1 -1
  26. package/build-module/components/use-dispatch/use-dispatch.js.map +1 -1
  27. package/build-module/components/with-dispatch/index.js +3 -3
  28. package/build-module/components/with-dispatch/index.js.map +1 -1
  29. package/build-module/components/with-registry/index.js +3 -3
  30. package/build-module/components/with-registry/index.js.map +1 -1
  31. package/build-module/components/with-select/index.js +3 -3
  32. package/build-module/components/with-select/index.js.map +1 -1
  33. package/build-module/index.js +2 -6
  34. package/build-module/index.js.map +1 -1
  35. package/build-module/lock-unlock.js +1 -1
  36. package/build-module/lock-unlock.js.map +1 -1
  37. package/build-module/redux-store/combine-reducers.js +16 -0
  38. package/build-module/redux-store/combine-reducers.js.map +1 -0
  39. package/build-module/redux-store/index.js +4 -3
  40. package/build-module/redux-store/index.js.map +1 -1
  41. package/build-module/resolvers-cache-middleware.js +18 -15
  42. package/build-module/resolvers-cache-middleware.js.map +1 -1
  43. package/build-types/components/use-dispatch/use-dispatch.d.ts +1 -1
  44. package/build-types/components/with-dispatch/index.d.ts +4 -4
  45. package/build-types/components/with-dispatch/index.d.ts.map +1 -1
  46. package/build-types/components/with-registry/index.d.ts +2 -2
  47. package/build-types/components/with-select/index.d.ts +4 -4
  48. package/build-types/components/with-select/index.d.ts.map +1 -1
  49. package/build-types/index.d.ts.map +1 -1
  50. package/build-types/redux-store/combine-reducers.d.ts +2 -0
  51. package/build-types/redux-store/combine-reducers.d.ts.map +1 -0
  52. package/build-types/redux-store/index.d.ts +5 -3
  53. package/build-types/redux-store/index.d.ts.map +1 -1
  54. package/build-types/resolvers-cache-middleware.d.ts +3 -5
  55. package/build-types/resolvers-cache-middleware.d.ts.map +1 -1
  56. package/package.json +9 -10
  57. package/src/components/async-mode-provider/context.js +1 -1
  58. package/src/components/use-dispatch/use-dispatch.js +1 -1
  59. package/src/components/with-dispatch/index.js +2 -2
  60. package/src/components/with-registry/index.js +2 -2
  61. package/src/components/with-select/index.js +2 -2
  62. package/src/index.js +2 -6
  63. package/src/lock-unlock.js +1 -1
  64. package/src/redux-store/combine-reducers.js +17 -0
  65. package/src/redux-store/index.js +5 -3
  66. package/src/redux-store/test/combine-reducers.js +66 -0
  67. package/src/resolvers-cache-middleware.js +32 -38
  68. package/tsconfig.tsbuildinfo +1 -1
@@ -1 +1 @@
1
- {"version":3,"names":["createStore","applyMiddleware","combineReducers","EquivalentKeyMap","createReduxRoutineMiddleware","compose","builtinControls","lock","promise","createResolversCacheMiddleware","createThunkMiddleware","metadataReducer","metadataSelectors","metadataActions","trimUndefinedValues","array","result","i","length","undefined","splice","mapValues","obj","callback","Object","fromEntries","entries","map","key","value","mapToObject","state","Map","createResolversCache","cache","isRunning","selectorName","args","get","clear","delete","markAsRunning","set","createBindingCache","bind","WeakMap","item","itemName","boundItem","createReduxStore","options","privateActions","privateSelectors","privateRegistrationFunctions","registerPrivateActions","actions","assign","registerPrivateSelectors","selectors","storeDescriptor","name","instantiate","registry","listeners","Set","reducer","thunkArgs","dispatch","thunkActions","select","thunkSelectors","resolveSelect","getResolveSelectors","store","instantiateReduxStore","resolversCache","bindAction","action","Promise","resolve","boundPrivateActions","allActions","Proxy","target","prop","privateAction","apply","thisArg","resolvers","mapResolvers","bindSelector","selector","isRegistrySelector","boundSelector","__unstableOriginalGetState","root","resolver","hasResolver","mapSelectorWithResolver","bindMetadataSelector","metadata","boundPrivateSelectors","allSelectors","privateSelector","resolveSelectors","mapResolveSelectors","suspendSelectors","mapSuspendSelectors","getSelectors","getActions","getSuspendSelectors","getState","subscribe","listener","add","lastState","hasChanged","controls","normalizedControls","control","isRegistryControl","middlewares","enhancers","window","__REDUX_DEVTOOLS_EXTENSION__","push","instanceId","serialize","replacer","initialState","enhancedReducer","getIsResolving","hasStartedResolution","hasFinishedResolution","hasResolutionFailed","isResolving","getCachedResolvers","getResolutionState","getResolutionError","hasResolvingSelectors","countSelectorsByStatus","storeSelectors","reject","hasFinished","finalize","hasFailed","error","getResult","unsubscribe","fulfill","fulfillSelector","isFulfilled","setTimeout","startResolution","finishResolution","failResolution","selectorResolver"],"sources":["@wordpress/data/src/redux-store/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { createStore, applyMiddleware } from 'redux';\nimport combineReducers from 'turbo-combine-reducers';\nimport EquivalentKeyMap from 'equivalent-key-map';\n\n/**\n * WordPress dependencies\n */\nimport createReduxRoutineMiddleware from '@wordpress/redux-routine';\nimport { compose } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { builtinControls } from '../controls';\nimport { lock } from '../lock-unlock';\nimport promise from '../promise-middleware';\nimport createResolversCacheMiddleware from '../resolvers-cache-middleware';\nimport createThunkMiddleware from './thunk-middleware';\nimport metadataReducer from './metadata/reducer';\nimport * as metadataSelectors from './metadata/selectors';\nimport * as metadataActions from './metadata/actions';\n\n/** @typedef {import('../types').DataRegistry} DataRegistry */\n/** @typedef {import('../types').ListenerFunction} ListenerFunction */\n/**\n * @typedef {import('../types').StoreDescriptor<C>} StoreDescriptor\n * @template {import('../types').AnyConfig} C\n */\n/**\n * @typedef {import('../types').ReduxStoreConfig<State,Actions,Selectors>} ReduxStoreConfig\n * @template State\n * @template {Record<string,import('../../types').ActionCreator>} Actions\n * @template Selectors\n */\n\nconst trimUndefinedValues = ( array ) => {\n\tconst result = [ ...array ];\n\tfor ( let i = result.length - 1; i >= 0; i-- ) {\n\t\tif ( result[ i ] === undefined ) {\n\t\t\tresult.splice( i, 1 );\n\t\t}\n\t}\n\treturn result;\n};\n\n/**\n * Creates a new object with the same keys, but with `callback()` called as\n * a transformer function on each of the values.\n *\n * @param {Object} obj The object to transform.\n * @param {Function} callback The function to transform each object value.\n * @return {Array} Transformed object.\n */\nconst mapValues = ( obj, callback ) =>\n\tObject.fromEntries(\n\t\tObject.entries( obj ?? {} ).map( ( [ key, value ] ) => [\n\t\t\tkey,\n\t\t\tcallback( value, key ),\n\t\t] )\n\t);\n\n// Convert Map objects to plain objects\nconst mapToObject = ( key, state ) => {\n\tif ( state instanceof Map ) {\n\t\treturn Object.fromEntries( state );\n\t}\n\n\treturn state;\n};\n\n/**\n * Create a cache to track whether resolvers started running or not.\n *\n * @return {Object} Resolvers Cache.\n */\nfunction createResolversCache() {\n\tconst cache = {};\n\treturn {\n\t\tisRunning( selectorName, args ) {\n\t\t\treturn (\n\t\t\t\tcache[ selectorName ] &&\n\t\t\t\tcache[ selectorName ].get( trimUndefinedValues( args ) )\n\t\t\t);\n\t\t},\n\n\t\tclear( selectorName, args ) {\n\t\t\tif ( cache[ selectorName ] ) {\n\t\t\t\tcache[ selectorName ].delete( trimUndefinedValues( args ) );\n\t\t\t}\n\t\t},\n\n\t\tmarkAsRunning( selectorName, args ) {\n\t\t\tif ( ! cache[ selectorName ] ) {\n\t\t\t\tcache[ selectorName ] = new EquivalentKeyMap();\n\t\t\t}\n\n\t\t\tcache[ selectorName ].set( trimUndefinedValues( args ), true );\n\t\t},\n\t};\n}\n\nfunction createBindingCache( bind ) {\n\tconst cache = new WeakMap();\n\n\treturn {\n\t\tget( item, itemName ) {\n\t\t\tlet boundItem = cache.get( item );\n\t\t\tif ( ! boundItem ) {\n\t\t\t\tboundItem = bind( item, itemName );\n\t\t\t\tcache.set( item, boundItem );\n\t\t\t}\n\t\t\treturn boundItem;\n\t\t},\n\t};\n}\n\n/**\n * Creates a data store descriptor for the provided Redux store configuration containing\n * properties describing reducer, actions, selectors, controls and resolvers.\n *\n * @example\n * ```js\n * import { createReduxStore } from '@wordpress/data';\n *\n * const store = createReduxStore( 'demo', {\n * reducer: ( state = 'OK' ) => state,\n * selectors: {\n * getValue: ( state ) => state,\n * },\n * } );\n * ```\n *\n * @template State\n * @template {Record<string,import('../../types').ActionCreator>} Actions\n * @template Selectors\n * @param {string} key Unique namespace identifier.\n * @param {ReduxStoreConfig<State,Actions,Selectors>} options Registered store options, with properties\n * describing reducer, actions, selectors,\n * and resolvers.\n *\n * @return {StoreDescriptor<ReduxStoreConfig<State,Actions,Selectors>>} Store Object.\n */\nexport default function createReduxStore( key, options ) {\n\tconst privateActions = {};\n\tconst privateSelectors = {};\n\tconst privateRegistrationFunctions = {\n\t\tprivateActions,\n\t\tregisterPrivateActions: ( actions ) => {\n\t\t\tObject.assign( privateActions, actions );\n\t\t},\n\t\tprivateSelectors,\n\t\tregisterPrivateSelectors: ( selectors ) => {\n\t\t\tObject.assign( privateSelectors, selectors );\n\t\t},\n\t};\n\tconst storeDescriptor = {\n\t\tname: key,\n\t\tinstantiate: ( registry ) => {\n\t\t\t/**\n\t\t\t * Stores listener functions registered with `subscribe()`.\n\t\t\t *\n\t\t\t * When functions register to listen to store changes with\n\t\t\t * `subscribe()` they get added here. Although Redux offers\n\t\t\t * its own `subscribe()` function directly, by wrapping the\n\t\t\t * subscription in this store instance it's possible to\n\t\t\t * optimize checking if the state has changed before calling\n\t\t\t * each listener.\n\t\t\t *\n\t\t\t * @type {Set<ListenerFunction>}\n\t\t\t */\n\t\t\tconst listeners = new Set();\n\t\t\tconst reducer = options.reducer;\n\t\t\tconst thunkArgs = {\n\t\t\t\tregistry,\n\t\t\t\tget dispatch() {\n\t\t\t\t\treturn thunkActions;\n\t\t\t\t},\n\t\t\t\tget select() {\n\t\t\t\t\treturn thunkSelectors;\n\t\t\t\t},\n\t\t\t\tget resolveSelect() {\n\t\t\t\t\treturn getResolveSelectors();\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tconst store = instantiateReduxStore(\n\t\t\t\tkey,\n\t\t\t\toptions,\n\t\t\t\tregistry,\n\t\t\t\tthunkArgs\n\t\t\t);\n\t\t\t// Expose the private registration functions on the store\n\t\t\t// so they can be copied to a sub registry in registry.js.\n\t\t\tlock( store, privateRegistrationFunctions );\n\t\t\tconst resolversCache = createResolversCache();\n\n\t\t\tfunction bindAction( action ) {\n\t\t\t\treturn ( ...args ) =>\n\t\t\t\t\tPromise.resolve( store.dispatch( action( ...args ) ) );\n\t\t\t}\n\n\t\t\tconst actions = {\n\t\t\t\t...mapValues( metadataActions, bindAction ),\n\t\t\t\t...mapValues( options.actions, bindAction ),\n\t\t\t};\n\n\t\t\tconst boundPrivateActions = createBindingCache( bindAction );\n\t\t\tconst allActions = new Proxy( () => {}, {\n\t\t\t\tget: ( target, prop ) => {\n\t\t\t\t\tconst privateAction = privateActions[ prop ];\n\t\t\t\t\treturn privateAction\n\t\t\t\t\t\t? boundPrivateActions.get( privateAction, prop )\n\t\t\t\t\t\t: actions[ prop ];\n\t\t\t\t},\n\t\t\t} );\n\n\t\t\tconst thunkActions = new Proxy( allActions, {\n\t\t\t\tapply: ( target, thisArg, [ action ] ) =>\n\t\t\t\t\tstore.dispatch( action ),\n\t\t\t} );\n\n\t\t\tlock( actions, allActions );\n\n\t\t\tconst resolvers = options.resolvers\n\t\t\t\t? mapResolvers( options.resolvers )\n\t\t\t\t: {};\n\n\t\t\tfunction bindSelector( selector, selectorName ) {\n\t\t\t\tif ( selector.isRegistrySelector ) {\n\t\t\t\t\tselector.registry = registry;\n\t\t\t\t}\n\t\t\t\tconst boundSelector = ( ...args ) => {\n\t\t\t\t\tconst state = store.__unstableOriginalGetState();\n\t\t\t\t\treturn selector( state.root, ...args );\n\t\t\t\t};\n\n\t\t\t\tconst resolver = resolvers[ selectorName ];\n\t\t\t\tif ( ! resolver ) {\n\t\t\t\t\tboundSelector.hasResolver = false;\n\t\t\t\t\treturn boundSelector;\n\t\t\t\t}\n\n\t\t\t\treturn mapSelectorWithResolver(\n\t\t\t\t\tboundSelector,\n\t\t\t\t\tselectorName,\n\t\t\t\t\tresolver,\n\t\t\t\t\tstore,\n\t\t\t\t\tresolversCache\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tfunction bindMetadataSelector( selector ) {\n\t\t\t\tconst boundSelector = ( ...args ) => {\n\t\t\t\t\tconst state = store.__unstableOriginalGetState();\n\t\t\t\t\treturn selector( state.metadata, ...args );\n\t\t\t\t};\n\t\t\t\tboundSelector.hasResolver = false;\n\t\t\t\treturn boundSelector;\n\t\t\t}\n\n\t\t\tconst selectors = {\n\t\t\t\t...mapValues( metadataSelectors, bindMetadataSelector ),\n\t\t\t\t...mapValues( options.selectors, bindSelector ),\n\t\t\t};\n\n\t\t\tconst boundPrivateSelectors = createBindingCache( bindSelector );\n\n\t\t\t// Pre-bind the private selectors that have been registered by the time of\n\t\t\t// instantiation, so that registry selectors are bound to the registry.\n\t\t\tfor ( const [ selectorName, selector ] of Object.entries(\n\t\t\t\tprivateSelectors\n\t\t\t) ) {\n\t\t\t\tboundPrivateSelectors.get( selector, selectorName );\n\t\t\t}\n\n\t\t\tconst allSelectors = new Proxy( () => {}, {\n\t\t\t\tget: ( target, prop ) => {\n\t\t\t\t\tconst privateSelector = privateSelectors[ prop ];\n\t\t\t\t\treturn privateSelector\n\t\t\t\t\t\t? boundPrivateSelectors.get( privateSelector, prop )\n\t\t\t\t\t\t: selectors[ prop ];\n\t\t\t\t},\n\t\t\t} );\n\n\t\t\tconst thunkSelectors = new Proxy( allSelectors, {\n\t\t\t\tapply: ( target, thisArg, [ selector ] ) =>\n\t\t\t\t\tselector( store.__unstableOriginalGetState() ),\n\t\t\t} );\n\n\t\t\tlock( selectors, allSelectors );\n\n\t\t\tconst resolveSelectors = mapResolveSelectors( selectors, store );\n\t\t\tconst suspendSelectors = mapSuspendSelectors( selectors, store );\n\n\t\t\tconst getSelectors = () => selectors;\n\t\t\tconst getActions = () => actions;\n\t\t\tconst getResolveSelectors = () => resolveSelectors;\n\t\t\tconst getSuspendSelectors = () => suspendSelectors;\n\n\t\t\t// We have some modules monkey-patching the store object\n\t\t\t// It's wrong to do so but until we refactor all of our effects to controls\n\t\t\t// We need to keep the same \"store\" instance here.\n\t\t\tstore.__unstableOriginalGetState = store.getState;\n\t\t\tstore.getState = () => store.__unstableOriginalGetState().root;\n\n\t\t\t// Customize subscribe behavior to call listeners only on effective change,\n\t\t\t// not on every dispatch.\n\t\t\tconst subscribe =\n\t\t\t\tstore &&\n\t\t\t\t( ( listener ) => {\n\t\t\t\t\tlisteners.add( listener );\n\n\t\t\t\t\treturn () => listeners.delete( listener );\n\t\t\t\t} );\n\n\t\t\tlet lastState = store.__unstableOriginalGetState();\n\t\t\tstore.subscribe( () => {\n\t\t\t\tconst state = store.__unstableOriginalGetState();\n\t\t\t\tconst hasChanged = state !== lastState;\n\t\t\t\tlastState = state;\n\n\t\t\t\tif ( hasChanged ) {\n\t\t\t\t\tfor ( const listener of listeners ) {\n\t\t\t\t\t\tlistener();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} );\n\n\t\t\t// This can be simplified to just { subscribe, getSelectors, getActions }\n\t\t\t// Once we remove the use function.\n\t\t\treturn {\n\t\t\t\treducer,\n\t\t\t\tstore,\n\t\t\t\tactions,\n\t\t\t\tselectors,\n\t\t\t\tresolvers,\n\t\t\t\tgetSelectors,\n\t\t\t\tgetResolveSelectors,\n\t\t\t\tgetSuspendSelectors,\n\t\t\t\tgetActions,\n\t\t\t\tsubscribe,\n\t\t\t};\n\t\t},\n\t};\n\n\t// Expose the private registration functions on the store\n\t// descriptor. That's a natural choice since that's where the\n\t// public actions and selectors are stored .\n\tlock( storeDescriptor, privateRegistrationFunctions );\n\n\treturn storeDescriptor;\n}\n\n/**\n * Creates a redux store for a namespace.\n *\n * @param {string} key Unique namespace identifier.\n * @param {Object} options Registered store options, with properties\n * describing reducer, actions, selectors,\n * and resolvers.\n * @param {DataRegistry} registry Registry reference.\n * @param {Object} thunkArgs Argument object for the thunk middleware.\n * @return {Object} Newly created redux store.\n */\nfunction instantiateReduxStore( key, options, registry, thunkArgs ) {\n\tconst controls = {\n\t\t...options.controls,\n\t\t...builtinControls,\n\t};\n\n\tconst normalizedControls = mapValues( controls, ( control ) =>\n\t\tcontrol.isRegistryControl ? control( registry ) : control\n\t);\n\n\tconst middlewares = [\n\t\tcreateResolversCacheMiddleware( registry, key ),\n\t\tpromise,\n\t\tcreateReduxRoutineMiddleware( normalizedControls ),\n\t\tcreateThunkMiddleware( thunkArgs ),\n\t];\n\n\tconst enhancers = [ applyMiddleware( ...middlewares ) ];\n\tif (\n\t\ttypeof window !== 'undefined' &&\n\t\twindow.__REDUX_DEVTOOLS_EXTENSION__\n\t) {\n\t\tenhancers.push(\n\t\t\twindow.__REDUX_DEVTOOLS_EXTENSION__( {\n\t\t\t\tname: key,\n\t\t\t\tinstanceId: key,\n\t\t\t\tserialize: {\n\t\t\t\t\treplacer: mapToObject,\n\t\t\t\t},\n\t\t\t} )\n\t\t);\n\t}\n\n\tconst { reducer, initialState } = options;\n\tconst enhancedReducer = combineReducers( {\n\t\tmetadata: metadataReducer,\n\t\troot: reducer,\n\t} );\n\n\treturn createStore(\n\t\tenhancedReducer,\n\t\t{ root: initialState },\n\t\tcompose( enhancers )\n\t);\n}\n\n/**\n * Maps selectors to functions that return a resolution promise for them\n *\n * @param {Object} selectors Selectors to map.\n * @param {Object} store The redux store the selectors select from.\n *\n * @return {Object} Selectors mapped to their resolution functions.\n */\nfunction mapResolveSelectors( selectors, store ) {\n\tconst {\n\t\tgetIsResolving,\n\t\thasStartedResolution,\n\t\thasFinishedResolution,\n\t\thasResolutionFailed,\n\t\tisResolving,\n\t\tgetCachedResolvers,\n\t\tgetResolutionState,\n\t\tgetResolutionError,\n\t\thasResolvingSelectors,\n\t\tcountSelectorsByStatus,\n\t\t...storeSelectors\n\t} = selectors;\n\n\treturn mapValues( storeSelectors, ( selector, selectorName ) => {\n\t\t// If the selector doesn't have a resolver, just convert the return value\n\t\t// (including exceptions) to a Promise, no additional extra behavior is needed.\n\t\tif ( ! selector.hasResolver ) {\n\t\t\treturn async ( ...args ) => selector.apply( null, args );\n\t\t}\n\n\t\treturn ( ...args ) => {\n\t\t\treturn new Promise( ( resolve, reject ) => {\n\t\t\t\tconst hasFinished = () =>\n\t\t\t\t\tselectors.hasFinishedResolution( selectorName, args );\n\t\t\t\tconst finalize = ( result ) => {\n\t\t\t\t\tconst hasFailed = selectors.hasResolutionFailed(\n\t\t\t\t\t\tselectorName,\n\t\t\t\t\t\targs\n\t\t\t\t\t);\n\t\t\t\t\tif ( hasFailed ) {\n\t\t\t\t\t\tconst error = selectors.getResolutionError(\n\t\t\t\t\t\t\tselectorName,\n\t\t\t\t\t\t\targs\n\t\t\t\t\t\t);\n\t\t\t\t\t\treject( error );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresolve( result );\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\tconst getResult = () => selector.apply( null, args );\n\t\t\t\t// Trigger the selector (to trigger the resolver)\n\t\t\t\tconst result = getResult();\n\t\t\t\tif ( hasFinished() ) {\n\t\t\t\t\treturn finalize( result );\n\t\t\t\t}\n\n\t\t\t\tconst unsubscribe = store.subscribe( () => {\n\t\t\t\t\tif ( hasFinished() ) {\n\t\t\t\t\t\tunsubscribe();\n\t\t\t\t\t\tfinalize( getResult() );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t} );\n\t\t};\n\t} );\n}\n\n/**\n * Maps selectors to functions that throw a suspense promise if not yet resolved.\n *\n * @param {Object} selectors Selectors to map.\n * @param {Object} store The redux store the selectors select from.\n *\n * @return {Object} Selectors mapped to their suspense functions.\n */\nfunction mapSuspendSelectors( selectors, store ) {\n\treturn mapValues( selectors, ( selector, selectorName ) => {\n\t\t// Selector without a resolver doesn't have any extra suspense behavior.\n\t\tif ( ! selector.hasResolver ) {\n\t\t\treturn selector;\n\t\t}\n\n\t\treturn ( ...args ) => {\n\t\t\tconst result = selector.apply( null, args );\n\n\t\t\tif ( selectors.hasFinishedResolution( selectorName, args ) ) {\n\t\t\t\tif ( selectors.hasResolutionFailed( selectorName, args ) ) {\n\t\t\t\t\tthrow selectors.getResolutionError( selectorName, args );\n\t\t\t\t}\n\n\t\t\t\treturn result;\n\t\t\t}\n\n\t\t\tthrow new Promise( ( resolve ) => {\n\t\t\t\tconst unsubscribe = store.subscribe( () => {\n\t\t\t\t\tif (\n\t\t\t\t\t\tselectors.hasFinishedResolution( selectorName, args )\n\t\t\t\t\t) {\n\t\t\t\t\t\tresolve();\n\t\t\t\t\t\tunsubscribe();\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t} );\n\t\t};\n\t} );\n}\n\n/**\n * Convert resolvers to a normalized form, an object with `fulfill` method and\n * optional methods like `isFulfilled`.\n *\n * @param {Object} resolvers Resolver to convert\n */\nfunction mapResolvers( resolvers ) {\n\treturn mapValues( resolvers, ( resolver ) => {\n\t\tif ( resolver.fulfill ) {\n\t\t\treturn resolver;\n\t\t}\n\n\t\treturn {\n\t\t\t...resolver, // Copy the enumerable properties of the resolver function.\n\t\t\tfulfill: resolver, // Add the fulfill method.\n\t\t};\n\t} );\n}\n\n/**\n * Returns a selector with a matched resolver.\n * Resolvers are side effects invoked once per argument set of a given selector call,\n * used in ensuring that the data needs for the selector are satisfied.\n *\n * @param {Object} selector The selector function to be bound.\n * @param {string} selectorName The selector name.\n * @param {Object} resolver Resolver to call.\n * @param {Object} store The redux store to which the resolvers should be mapped.\n * @param {Object} resolversCache Resolvers Cache.\n */\nfunction mapSelectorWithResolver(\n\tselector,\n\tselectorName,\n\tresolver,\n\tstore,\n\tresolversCache\n) {\n\tfunction fulfillSelector( args ) {\n\t\tconst state = store.getState();\n\n\t\tif (\n\t\t\tresolversCache.isRunning( selectorName, args ) ||\n\t\t\t( typeof resolver.isFulfilled === 'function' &&\n\t\t\t\tresolver.isFulfilled( state, ...args ) )\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { metadata } = store.__unstableOriginalGetState();\n\n\t\tif (\n\t\t\tmetadataSelectors.hasStartedResolution(\n\t\t\t\tmetadata,\n\t\t\t\tselectorName,\n\t\t\t\targs\n\t\t\t)\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tresolversCache.markAsRunning( selectorName, args );\n\n\t\tsetTimeout( async () => {\n\t\t\tresolversCache.clear( selectorName, args );\n\t\t\tstore.dispatch(\n\t\t\t\tmetadataActions.startResolution( selectorName, args )\n\t\t\t);\n\t\t\ttry {\n\t\t\t\tconst action = resolver.fulfill( ...args );\n\t\t\t\tif ( action ) {\n\t\t\t\t\tawait store.dispatch( action );\n\t\t\t\t}\n\t\t\t\tstore.dispatch(\n\t\t\t\t\tmetadataActions.finishResolution( selectorName, args )\n\t\t\t\t);\n\t\t\t} catch ( error ) {\n\t\t\t\tstore.dispatch(\n\t\t\t\t\tmetadataActions.failResolution( selectorName, args, error )\n\t\t\t\t);\n\t\t\t}\n\t\t}, 0 );\n\t}\n\n\tconst selectorResolver = ( ...args ) => {\n\t\tfulfillSelector( args );\n\t\treturn selector( ...args );\n\t};\n\tselectorResolver.hasResolver = true;\n\treturn selectorResolver;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,eAAe,QAAQ,OAAO;AACpD,OAA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AGtD,IAAK,CAAC;EAC3B,CAAC;EACDuH,gBAAgB,CAAC3D,WAAW,GAAG,IAAI;EACnC,OAAO2D,gBAAgB;AACxB"}
1
+ {"version":3,"names":["createStore","applyMiddleware","EquivalentKeyMap","createReduxRoutineMiddleware","compose","combineReducers","builtinControls","lock","promise","createResolversCacheMiddleware","createThunkMiddleware","metadataReducer","metadataSelectors","metadataActions","trimUndefinedValues","array","result","i","length","undefined","splice","mapValues","obj","callback","Object","fromEntries","entries","map","key","value","mapToObject","state","Map","createResolversCache","cache","isRunning","selectorName","args","get","clear","delete","markAsRunning","set","createBindingCache","bind","WeakMap","item","itemName","boundItem","createReduxStore","options","privateActions","privateSelectors","privateRegistrationFunctions","registerPrivateActions","actions","assign","registerPrivateSelectors","selectors","storeDescriptor","name","instantiate","registry","listeners","Set","reducer","thunkArgs","dispatch","thunkActions","select","thunkSelectors","resolveSelect","getResolveSelectors","store","instantiateReduxStore","resolversCache","bindAction","action","Promise","resolve","boundPrivateActions","allActions","Proxy","target","prop","privateAction","apply","thisArg","resolvers","mapResolvers","bindSelector","selector","isRegistrySelector","boundSelector","__unstableOriginalGetState","root","resolver","hasResolver","mapSelectorWithResolver","bindMetadataSelector","metadata","boundPrivateSelectors","allSelectors","privateSelector","resolveSelectors","mapResolveSelectors","suspendSelectors","mapSuspendSelectors","getSelectors","getActions","getSuspendSelectors","getState","subscribe","listener","add","lastState","hasChanged","controls","normalizedControls","control","isRegistryControl","middlewares","enhancers","window","__REDUX_DEVTOOLS_EXTENSION__","push","instanceId","serialize","replacer","initialState","enhancedReducer","getIsResolving","hasStartedResolution","hasFinishedResolution","hasResolutionFailed","isResolving","getCachedResolvers","getResolutionState","getResolutionError","hasResolvingSelectors","countSelectorsByStatus","storeSelectors","reject","hasFinished","finalize","hasFailed","error","getResult","unsubscribe","fulfill","fulfillSelector","isFulfilled","setTimeout","startResolution","finishResolution","failResolution","selectorResolver"],"sources":["@wordpress/data/src/redux-store/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { createStore, applyMiddleware } from 'redux';\nimport EquivalentKeyMap from 'equivalent-key-map';\n\n/**\n * WordPress dependencies\n */\nimport createReduxRoutineMiddleware from '@wordpress/redux-routine';\nimport { compose } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { combineReducers } from './combine-reducers';\nimport { builtinControls } from '../controls';\nimport { lock } from '../lock-unlock';\nimport promise from '../promise-middleware';\nimport createResolversCacheMiddleware from '../resolvers-cache-middleware';\nimport createThunkMiddleware from './thunk-middleware';\nimport metadataReducer from './metadata/reducer';\nimport * as metadataSelectors from './metadata/selectors';\nimport * as metadataActions from './metadata/actions';\n\nexport { combineReducers };\n\n/** @typedef {import('../types').DataRegistry} DataRegistry */\n/** @typedef {import('../types').ListenerFunction} ListenerFunction */\n/**\n * @typedef {import('../types').StoreDescriptor<C>} StoreDescriptor\n * @template {import('../types').AnyConfig} C\n */\n/**\n * @typedef {import('../types').ReduxStoreConfig<State,Actions,Selectors>} ReduxStoreConfig\n * @template State\n * @template {Record<string,import('../types').ActionCreator>} Actions\n * @template Selectors\n */\n\nconst trimUndefinedValues = ( array ) => {\n\tconst result = [ ...array ];\n\tfor ( let i = result.length - 1; i >= 0; i-- ) {\n\t\tif ( result[ i ] === undefined ) {\n\t\t\tresult.splice( i, 1 );\n\t\t}\n\t}\n\treturn result;\n};\n\n/**\n * Creates a new object with the same keys, but with `callback()` called as\n * a transformer function on each of the values.\n *\n * @param {Object} obj The object to transform.\n * @param {Function} callback The function to transform each object value.\n * @return {Array} Transformed object.\n */\nconst mapValues = ( obj, callback ) =>\n\tObject.fromEntries(\n\t\tObject.entries( obj ?? {} ).map( ( [ key, value ] ) => [\n\t\t\tkey,\n\t\t\tcallback( value, key ),\n\t\t] )\n\t);\n\n// Convert Map objects to plain objects\nconst mapToObject = ( key, state ) => {\n\tif ( state instanceof Map ) {\n\t\treturn Object.fromEntries( state );\n\t}\n\n\treturn state;\n};\n\n/**\n * Create a cache to track whether resolvers started running or not.\n *\n * @return {Object} Resolvers Cache.\n */\nfunction createResolversCache() {\n\tconst cache = {};\n\treturn {\n\t\tisRunning( selectorName, args ) {\n\t\t\treturn (\n\t\t\t\tcache[ selectorName ] &&\n\t\t\t\tcache[ selectorName ].get( trimUndefinedValues( args ) )\n\t\t\t);\n\t\t},\n\n\t\tclear( selectorName, args ) {\n\t\t\tif ( cache[ selectorName ] ) {\n\t\t\t\tcache[ selectorName ].delete( trimUndefinedValues( args ) );\n\t\t\t}\n\t\t},\n\n\t\tmarkAsRunning( selectorName, args ) {\n\t\t\tif ( ! cache[ selectorName ] ) {\n\t\t\t\tcache[ selectorName ] = new EquivalentKeyMap();\n\t\t\t}\n\n\t\t\tcache[ selectorName ].set( trimUndefinedValues( args ), true );\n\t\t},\n\t};\n}\n\nfunction createBindingCache( bind ) {\n\tconst cache = new WeakMap();\n\n\treturn {\n\t\tget( item, itemName ) {\n\t\t\tlet boundItem = cache.get( item );\n\t\t\tif ( ! boundItem ) {\n\t\t\t\tboundItem = bind( item, itemName );\n\t\t\t\tcache.set( item, boundItem );\n\t\t\t}\n\t\t\treturn boundItem;\n\t\t},\n\t};\n}\n\n/**\n * Creates a data store descriptor for the provided Redux store configuration containing\n * properties describing reducer, actions, selectors, controls and resolvers.\n *\n * @example\n * ```js\n * import { createReduxStore } from '@wordpress/data';\n *\n * const store = createReduxStore( 'demo', {\n * reducer: ( state = 'OK' ) => state,\n * selectors: {\n * getValue: ( state ) => state,\n * },\n * } );\n * ```\n *\n * @template State\n * @template {Record<string,import('../types').ActionCreator>} Actions\n * @template Selectors\n * @param {string} key Unique namespace identifier.\n * @param {ReduxStoreConfig<State,Actions,Selectors>} options Registered store options, with properties\n * describing reducer, actions, selectors,\n * and resolvers.\n *\n * @return {StoreDescriptor<ReduxStoreConfig<State,Actions,Selectors>>} Store Object.\n */\nexport default function createReduxStore( key, options ) {\n\tconst privateActions = {};\n\tconst privateSelectors = {};\n\tconst privateRegistrationFunctions = {\n\t\tprivateActions,\n\t\tregisterPrivateActions: ( actions ) => {\n\t\t\tObject.assign( privateActions, actions );\n\t\t},\n\t\tprivateSelectors,\n\t\tregisterPrivateSelectors: ( selectors ) => {\n\t\t\tObject.assign( privateSelectors, selectors );\n\t\t},\n\t};\n\tconst storeDescriptor = {\n\t\tname: key,\n\t\tinstantiate: ( registry ) => {\n\t\t\t/**\n\t\t\t * Stores listener functions registered with `subscribe()`.\n\t\t\t *\n\t\t\t * When functions register to listen to store changes with\n\t\t\t * `subscribe()` they get added here. Although Redux offers\n\t\t\t * its own `subscribe()` function directly, by wrapping the\n\t\t\t * subscription in this store instance it's possible to\n\t\t\t * optimize checking if the state has changed before calling\n\t\t\t * each listener.\n\t\t\t *\n\t\t\t * @type {Set<ListenerFunction>}\n\t\t\t */\n\t\t\tconst listeners = new Set();\n\t\t\tconst reducer = options.reducer;\n\t\t\tconst thunkArgs = {\n\t\t\t\tregistry,\n\t\t\t\tget dispatch() {\n\t\t\t\t\treturn thunkActions;\n\t\t\t\t},\n\t\t\t\tget select() {\n\t\t\t\t\treturn thunkSelectors;\n\t\t\t\t},\n\t\t\t\tget resolveSelect() {\n\t\t\t\t\treturn getResolveSelectors();\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tconst store = instantiateReduxStore(\n\t\t\t\tkey,\n\t\t\t\toptions,\n\t\t\t\tregistry,\n\t\t\t\tthunkArgs\n\t\t\t);\n\t\t\t// Expose the private registration functions on the store\n\t\t\t// so they can be copied to a sub registry in registry.js.\n\t\t\tlock( store, privateRegistrationFunctions );\n\t\t\tconst resolversCache = createResolversCache();\n\n\t\t\tfunction bindAction( action ) {\n\t\t\t\treturn ( ...args ) =>\n\t\t\t\t\tPromise.resolve( store.dispatch( action( ...args ) ) );\n\t\t\t}\n\n\t\t\tconst actions = {\n\t\t\t\t...mapValues( metadataActions, bindAction ),\n\t\t\t\t...mapValues( options.actions, bindAction ),\n\t\t\t};\n\n\t\t\tconst boundPrivateActions = createBindingCache( bindAction );\n\t\t\tconst allActions = new Proxy( () => {}, {\n\t\t\t\tget: ( target, prop ) => {\n\t\t\t\t\tconst privateAction = privateActions[ prop ];\n\t\t\t\t\treturn privateAction\n\t\t\t\t\t\t? boundPrivateActions.get( privateAction, prop )\n\t\t\t\t\t\t: actions[ prop ];\n\t\t\t\t},\n\t\t\t} );\n\n\t\t\tconst thunkActions = new Proxy( allActions, {\n\t\t\t\tapply: ( target, thisArg, [ action ] ) =>\n\t\t\t\t\tstore.dispatch( action ),\n\t\t\t} );\n\n\t\t\tlock( actions, allActions );\n\n\t\t\tconst resolvers = options.resolvers\n\t\t\t\t? mapResolvers( options.resolvers )\n\t\t\t\t: {};\n\n\t\t\tfunction bindSelector( selector, selectorName ) {\n\t\t\t\tif ( selector.isRegistrySelector ) {\n\t\t\t\t\tselector.registry = registry;\n\t\t\t\t}\n\t\t\t\tconst boundSelector = ( ...args ) => {\n\t\t\t\t\tconst state = store.__unstableOriginalGetState();\n\t\t\t\t\treturn selector( state.root, ...args );\n\t\t\t\t};\n\n\t\t\t\tconst resolver = resolvers[ selectorName ];\n\t\t\t\tif ( ! resolver ) {\n\t\t\t\t\tboundSelector.hasResolver = false;\n\t\t\t\t\treturn boundSelector;\n\t\t\t\t}\n\n\t\t\t\treturn mapSelectorWithResolver(\n\t\t\t\t\tboundSelector,\n\t\t\t\t\tselectorName,\n\t\t\t\t\tresolver,\n\t\t\t\t\tstore,\n\t\t\t\t\tresolversCache\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tfunction bindMetadataSelector( selector ) {\n\t\t\t\tconst boundSelector = ( ...args ) => {\n\t\t\t\t\tconst state = store.__unstableOriginalGetState();\n\t\t\t\t\treturn selector( state.metadata, ...args );\n\t\t\t\t};\n\t\t\t\tboundSelector.hasResolver = false;\n\t\t\t\treturn boundSelector;\n\t\t\t}\n\n\t\t\tconst selectors = {\n\t\t\t\t...mapValues( metadataSelectors, bindMetadataSelector ),\n\t\t\t\t...mapValues( options.selectors, bindSelector ),\n\t\t\t};\n\n\t\t\tconst boundPrivateSelectors = createBindingCache( bindSelector );\n\n\t\t\t// Pre-bind the private selectors that have been registered by the time of\n\t\t\t// instantiation, so that registry selectors are bound to the registry.\n\t\t\tfor ( const [ selectorName, selector ] of Object.entries(\n\t\t\t\tprivateSelectors\n\t\t\t) ) {\n\t\t\t\tboundPrivateSelectors.get( selector, selectorName );\n\t\t\t}\n\n\t\t\tconst allSelectors = new Proxy( () => {}, {\n\t\t\t\tget: ( target, prop ) => {\n\t\t\t\t\tconst privateSelector = privateSelectors[ prop ];\n\t\t\t\t\treturn privateSelector\n\t\t\t\t\t\t? boundPrivateSelectors.get( privateSelector, prop )\n\t\t\t\t\t\t: selectors[ prop ];\n\t\t\t\t},\n\t\t\t} );\n\n\t\t\tconst thunkSelectors = new Proxy( allSelectors, {\n\t\t\t\tapply: ( target, thisArg, [ selector ] ) =>\n\t\t\t\t\tselector( store.__unstableOriginalGetState() ),\n\t\t\t} );\n\n\t\t\tlock( selectors, allSelectors );\n\n\t\t\tconst resolveSelectors = mapResolveSelectors( selectors, store );\n\t\t\tconst suspendSelectors = mapSuspendSelectors( selectors, store );\n\n\t\t\tconst getSelectors = () => selectors;\n\t\t\tconst getActions = () => actions;\n\t\t\tconst getResolveSelectors = () => resolveSelectors;\n\t\t\tconst getSuspendSelectors = () => suspendSelectors;\n\n\t\t\t// We have some modules monkey-patching the store object\n\t\t\t// It's wrong to do so but until we refactor all of our effects to controls\n\t\t\t// We need to keep the same \"store\" instance here.\n\t\t\tstore.__unstableOriginalGetState = store.getState;\n\t\t\tstore.getState = () => store.__unstableOriginalGetState().root;\n\n\t\t\t// Customize subscribe behavior to call listeners only on effective change,\n\t\t\t// not on every dispatch.\n\t\t\tconst subscribe =\n\t\t\t\tstore &&\n\t\t\t\t( ( listener ) => {\n\t\t\t\t\tlisteners.add( listener );\n\n\t\t\t\t\treturn () => listeners.delete( listener );\n\t\t\t\t} );\n\n\t\t\tlet lastState = store.__unstableOriginalGetState();\n\t\t\tstore.subscribe( () => {\n\t\t\t\tconst state = store.__unstableOriginalGetState();\n\t\t\t\tconst hasChanged = state !== lastState;\n\t\t\t\tlastState = state;\n\n\t\t\t\tif ( hasChanged ) {\n\t\t\t\t\tfor ( const listener of listeners ) {\n\t\t\t\t\t\tlistener();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} );\n\n\t\t\t// This can be simplified to just { subscribe, getSelectors, getActions }\n\t\t\t// Once we remove the use function.\n\t\t\treturn {\n\t\t\t\treducer,\n\t\t\t\tstore,\n\t\t\t\tactions,\n\t\t\t\tselectors,\n\t\t\t\tresolvers,\n\t\t\t\tgetSelectors,\n\t\t\t\tgetResolveSelectors,\n\t\t\t\tgetSuspendSelectors,\n\t\t\t\tgetActions,\n\t\t\t\tsubscribe,\n\t\t\t};\n\t\t},\n\t};\n\n\t// Expose the private registration functions on the store\n\t// descriptor. That's a natural choice since that's where the\n\t// public actions and selectors are stored .\n\tlock( storeDescriptor, privateRegistrationFunctions );\n\n\treturn storeDescriptor;\n}\n\n/**\n * Creates a redux store for a namespace.\n *\n * @param {string} key Unique namespace identifier.\n * @param {Object} options Registered store options, with properties\n * describing reducer, actions, selectors,\n * and resolvers.\n * @param {DataRegistry} registry Registry reference.\n * @param {Object} thunkArgs Argument object for the thunk middleware.\n * @return {Object} Newly created redux store.\n */\nfunction instantiateReduxStore( key, options, registry, thunkArgs ) {\n\tconst controls = {\n\t\t...options.controls,\n\t\t...builtinControls,\n\t};\n\n\tconst normalizedControls = mapValues( controls, ( control ) =>\n\t\tcontrol.isRegistryControl ? control( registry ) : control\n\t);\n\n\tconst middlewares = [\n\t\tcreateResolversCacheMiddleware( registry, key ),\n\t\tpromise,\n\t\tcreateReduxRoutineMiddleware( normalizedControls ),\n\t\tcreateThunkMiddleware( thunkArgs ),\n\t];\n\n\tconst enhancers = [ applyMiddleware( ...middlewares ) ];\n\tif (\n\t\ttypeof window !== 'undefined' &&\n\t\twindow.__REDUX_DEVTOOLS_EXTENSION__\n\t) {\n\t\tenhancers.push(\n\t\t\twindow.__REDUX_DEVTOOLS_EXTENSION__( {\n\t\t\t\tname: key,\n\t\t\t\tinstanceId: key,\n\t\t\t\tserialize: {\n\t\t\t\t\treplacer: mapToObject,\n\t\t\t\t},\n\t\t\t} )\n\t\t);\n\t}\n\n\tconst { reducer, initialState } = options;\n\tconst enhancedReducer = combineReducers( {\n\t\tmetadata: metadataReducer,\n\t\troot: reducer,\n\t} );\n\n\treturn createStore(\n\t\tenhancedReducer,\n\t\t{ root: initialState },\n\t\tcompose( enhancers )\n\t);\n}\n\n/**\n * Maps selectors to functions that return a resolution promise for them\n *\n * @param {Object} selectors Selectors to map.\n * @param {Object} store The redux store the selectors select from.\n *\n * @return {Object} Selectors mapped to their resolution functions.\n */\nfunction mapResolveSelectors( selectors, store ) {\n\tconst {\n\t\tgetIsResolving,\n\t\thasStartedResolution,\n\t\thasFinishedResolution,\n\t\thasResolutionFailed,\n\t\tisResolving,\n\t\tgetCachedResolvers,\n\t\tgetResolutionState,\n\t\tgetResolutionError,\n\t\thasResolvingSelectors,\n\t\tcountSelectorsByStatus,\n\t\t...storeSelectors\n\t} = selectors;\n\n\treturn mapValues( storeSelectors, ( selector, selectorName ) => {\n\t\t// If the selector doesn't have a resolver, just convert the return value\n\t\t// (including exceptions) to a Promise, no additional extra behavior is needed.\n\t\tif ( ! selector.hasResolver ) {\n\t\t\treturn async ( ...args ) => selector.apply( null, args );\n\t\t}\n\n\t\treturn ( ...args ) => {\n\t\t\treturn new Promise( ( resolve, reject ) => {\n\t\t\t\tconst hasFinished = () =>\n\t\t\t\t\tselectors.hasFinishedResolution( selectorName, args );\n\t\t\t\tconst finalize = ( result ) => {\n\t\t\t\t\tconst hasFailed = selectors.hasResolutionFailed(\n\t\t\t\t\t\tselectorName,\n\t\t\t\t\t\targs\n\t\t\t\t\t);\n\t\t\t\t\tif ( hasFailed ) {\n\t\t\t\t\t\tconst error = selectors.getResolutionError(\n\t\t\t\t\t\t\tselectorName,\n\t\t\t\t\t\t\targs\n\t\t\t\t\t\t);\n\t\t\t\t\t\treject( error );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresolve( result );\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\tconst getResult = () => selector.apply( null, args );\n\t\t\t\t// Trigger the selector (to trigger the resolver)\n\t\t\t\tconst result = getResult();\n\t\t\t\tif ( hasFinished() ) {\n\t\t\t\t\treturn finalize( result );\n\t\t\t\t}\n\n\t\t\t\tconst unsubscribe = store.subscribe( () => {\n\t\t\t\t\tif ( hasFinished() ) {\n\t\t\t\t\t\tunsubscribe();\n\t\t\t\t\t\tfinalize( getResult() );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t} );\n\t\t};\n\t} );\n}\n\n/**\n * Maps selectors to functions that throw a suspense promise if not yet resolved.\n *\n * @param {Object} selectors Selectors to map.\n * @param {Object} store The redux store the selectors select from.\n *\n * @return {Object} Selectors mapped to their suspense functions.\n */\nfunction mapSuspendSelectors( selectors, store ) {\n\treturn mapValues( selectors, ( selector, selectorName ) => {\n\t\t// Selector without a resolver doesn't have any extra suspense behavior.\n\t\tif ( ! selector.hasResolver ) {\n\t\t\treturn selector;\n\t\t}\n\n\t\treturn ( ...args ) => {\n\t\t\tconst result = selector.apply( null, args );\n\n\t\t\tif ( selectors.hasFinishedResolution( selectorName, args ) ) {\n\t\t\t\tif ( selectors.hasResolutionFailed( selectorName, args ) ) {\n\t\t\t\t\tthrow selectors.getResolutionError( selectorName, args );\n\t\t\t\t}\n\n\t\t\t\treturn result;\n\t\t\t}\n\n\t\t\tthrow new Promise( ( resolve ) => {\n\t\t\t\tconst unsubscribe = store.subscribe( () => {\n\t\t\t\t\tif (\n\t\t\t\t\t\tselectors.hasFinishedResolution( selectorName, args )\n\t\t\t\t\t) {\n\t\t\t\t\t\tresolve();\n\t\t\t\t\t\tunsubscribe();\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t} );\n\t\t};\n\t} );\n}\n\n/**\n * Convert resolvers to a normalized form, an object with `fulfill` method and\n * optional methods like `isFulfilled`.\n *\n * @param {Object} resolvers Resolver to convert\n */\nfunction mapResolvers( resolvers ) {\n\treturn mapValues( resolvers, ( resolver ) => {\n\t\tif ( resolver.fulfill ) {\n\t\t\treturn resolver;\n\t\t}\n\n\t\treturn {\n\t\t\t...resolver, // Copy the enumerable properties of the resolver function.\n\t\t\tfulfill: resolver, // Add the fulfill method.\n\t\t};\n\t} );\n}\n\n/**\n * Returns a selector with a matched resolver.\n * Resolvers are side effects invoked once per argument set of a given selector call,\n * used in ensuring that the data needs for the selector are satisfied.\n *\n * @param {Object} selector The selector function to be bound.\n * @param {string} selectorName The selector name.\n * @param {Object} resolver Resolver to call.\n * @param {Object} store The redux store to which the resolvers should be mapped.\n * @param {Object} resolversCache Resolvers Cache.\n */\nfunction mapSelectorWithResolver(\n\tselector,\n\tselectorName,\n\tresolver,\n\tstore,\n\tresolversCache\n) {\n\tfunction fulfillSelector( args ) {\n\t\tconst state = store.getState();\n\n\t\tif (\n\t\t\tresolversCache.isRunning( selectorName, args ) ||\n\t\t\t( typeof resolver.isFulfilled === 'function' &&\n\t\t\t\tresolver.isFulfilled( state, ...args ) )\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { metadata } = store.__unstableOriginalGetState();\n\n\t\tif (\n\t\t\tmetadataSelectors.hasStartedResolution(\n\t\t\t\tmetadata,\n\t\t\t\tselectorName,\n\t\t\t\targs\n\t\t\t)\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tresolversCache.markAsRunning( selectorName, args );\n\n\t\tsetTimeout( async () => {\n\t\t\tresolversCache.clear( selectorName, args );\n\t\t\tstore.dispatch(\n\t\t\t\tmetadataActions.startResolution( selectorName, args )\n\t\t\t);\n\t\t\ttry {\n\t\t\t\tconst action = resolver.fulfill( ...args );\n\t\t\t\tif ( action ) {\n\t\t\t\t\tawait store.dispatch( action );\n\t\t\t\t}\n\t\t\t\tstore.dispatch(\n\t\t\t\t\tmetadataActions.finishResolution( selectorName, args )\n\t\t\t\t);\n\t\t\t} catch ( error ) {\n\t\t\t\tstore.dispatch(\n\t\t\t\t\tmetadataActions.failResolution( selectorName, args, error )\n\t\t\t\t);\n\t\t\t}\n\t\t}, 0 );\n\t}\n\n\tconst selectorResolver = ( ...args ) => {\n\t\tfulfillSelector( args );\n\t\treturn selector( ...args );\n\t};\n\tselectorResolver.hasResolver = true;\n\treturn selectorResolver;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,eAAe,QAAQ,OAAO;AACpD,OAAOC,gBAAgB,MAAM,oBAAoB;;AAEjD;AACA;AACA;AACA,OAAOC,4BAA4B,MAAM,0BAA0B;AACnE,SAASC,OAAO,QAAQ,oBAAoB;;AAE5C;AACA;AACA;AACA,SAASC,eAAe,QAAQ,oBAAoB;AACpD,SAASC,eAAe,QAAQ,aAAa;AAC7C,SAASC,IAAI,QAAQ,gBAAgB;AACrC,OAAOC,OAAO,MAAM,uBAAuB;AAC3C,OAAOC,8BAA8B,MAAM,+BAA+B;AAC1E,OAAOC,qBAAqB,MAAM,oBAAoB;AACtD,OAAOC,eAAe,MAAM,oBAAoB;AAChD,OAAO,KAAKC,iBAAiB,MAAM,sBAAsB;AACzD,OAAO,KAAKC,eAAe,MAAM,oBAAoB;AAErD,SAASR,eAAe;;AAExB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMS,mBAAmB,GAAKC,KAAK,IAAM;EACxC,MAAMC,MAAM,GAAG,CAAE,GAAGD,KAAK,CAAE;EAC3B,KAAM,IAAIE,CAAC,GAAGD,MAAM,CAACE,MAAM,GAAG,CAAC,EAAED,CAAC,IAAI,CAAC,EAAEA,CAAC,EAAE,EAAG;IAC9C,IAAKD,MAAM,CAAEC,CAAC,CAAE,KAAKE,SAAS,EAAG;MAChCH,MAAM,CAACI,MAAM,CAAEH,CAAC,EAAE,CAAE,CAAC;IACtB;EACD;EACA,OAAOD,MAAM;AACd,CAAC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,gBAAgB,CAAEtH,YAAY,EAAEC,IAAK,CACtD,CAAC;MACF,CAAC,CAAC,OAAQ6G,KAAK,EAAG;QACjBzE,KAAK,CAACN,QAAQ,CACbtD,eAAe,CAAC8I,cAAc,CAAEvH,YAAY,EAAEC,IAAI,EAAE6G,KAAM,CAC3D,CAAC;MACF;IACD,CAAC,EAAE,CAAE,CAAC;EACP;EAEA,MAAMU,gBAAgB,GAAGA,CAAE,GAAGvH,IAAI,KAAM;IACvCiH,eAAe,CAAEjH,IAAK,CAAC;IACvB,OAAOsD,QAAQ,CAAE,GAAGtD,IAAK,CAAC;EAC3B,CAAC;EACDuH,gBAAgB,CAAC3D,WAAW,GAAG,IAAI;EACnC,OAAO2D,gBAAgB;AACxB"}
@@ -1,37 +1,40 @@
1
- /**
2
- * Internal dependencies
3
- */
4
- import coreDataStore from './store';
5
-
6
1
  /** @typedef {import('./registry').WPDataRegistry} WPDataRegistry */
7
2
 
8
3
  /**
9
4
  * Creates a middleware handling resolvers cache invalidation.
10
5
  *
11
- * @param {WPDataRegistry} registry The registry reference for which to create
12
- * the middleware.
13
- * @param {string} reducerKey The namespace for which to create the
14
- * middleware.
6
+ * @param {WPDataRegistry} registry Registry for which to create the middleware.
7
+ * @param {string} storeName Name of the store for which to create the middleware.
15
8
  *
16
9
  * @return {Function} Middleware function.
17
10
  */
18
- const createResolversCacheMiddleware = (registry, reducerKey) => () => next => action => {
19
- const resolvers = registry.select(coreDataStore).getCachedResolvers(reducerKey);
20
- Object.entries(resolvers).forEach(([selectorName, resolversByArgs]) => {
21
- const resolver = registry.stores?.[reducerKey]?.resolvers?.[selectorName];
11
+ const createResolversCacheMiddleware = (registry, storeName) => () => next => action => {
12
+ const resolvers = registry.select(storeName).getCachedResolvers();
13
+ const resolverEntries = Object.entries(resolvers);
14
+ resolverEntries.forEach(([selectorName, resolversByArgs]) => {
15
+ const resolver = registry.stores[storeName]?.resolvers?.[selectorName];
22
16
  if (!resolver || !resolver.shouldInvalidate) {
23
17
  return;
24
18
  }
25
19
  resolversByArgs.forEach((value, args) => {
20
+ // Works around a bug in `EquivalentKeyMap` where `map.delete` merely sets an entry value
21
+ // to `undefined` and `map.forEach` then iterates also over these orphaned entries.
22
+ if (value === undefined) {
23
+ return;
24
+ }
25
+
26
26
  // resolversByArgs is the map Map([ args ] => boolean) storing the cache resolution status for a given selector.
27
27
  // If the value is "finished" or "error" it means this resolver has finished its resolution which means we need
28
28
  // to invalidate it, if it's true it means it's inflight and the invalidation is not necessary.
29
- if (value?.status !== 'finished' && value?.status !== 'error' || !resolver.shouldInvalidate(action, ...args)) {
29
+ if (value.status !== 'finished' && value.status !== 'error') {
30
+ return;
31
+ }
32
+ if (!resolver.shouldInvalidate(action, ...args)) {
30
33
  return;
31
34
  }
32
35
 
33
36
  // Trigger cache invalidation
34
- registry.dispatch(coreDataStore).invalidateResolution(reducerKey, selectorName, args);
37
+ registry.dispatch(storeName).invalidateResolution(selectorName, args);
35
38
  });
36
39
  });
37
40
  return next(action);
@@ -1 +1 @@
1
- {"version":3,"names":["coreDataStore","createResolversCacheMiddleware","registry","reducerKey","next","action","resolvers","select","getCachedResolvers","Object","entries","forEach","selectorName","resolversByArgs","resolver","stores","shouldInvalidate","value","args","status","dispatch","invalidateResolution"],"sources":["@wordpress/data/src/resolvers-cache-middleware.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport coreDataStore from './store';\n\n/** @typedef {import('./registry').WPDataRegistry} WPDataRegistry */\n\n/**\n * Creates a middleware handling resolvers cache invalidation.\n *\n * @param {WPDataRegistry} registry The registry reference for which to create\n * the middleware.\n * @param {string} reducerKey The namespace for which to create the\n * middleware.\n *\n * @return {Function} Middleware function.\n */\nconst createResolversCacheMiddleware =\n\t( registry, reducerKey ) => () => ( next ) => ( action ) => {\n\t\tconst resolvers = registry\n\t\t\t.select( coreDataStore )\n\t\t\t.getCachedResolvers( reducerKey );\n\t\tObject.entries( resolvers ).forEach(\n\t\t\t( [ selectorName, resolversByArgs ] ) => {\n\t\t\t\tconst resolver =\n\t\t\t\t\tregistry.stores?.[ reducerKey ]?.resolvers?.[\n\t\t\t\t\t\tselectorName\n\t\t\t\t\t];\n\t\t\t\tif ( ! resolver || ! resolver.shouldInvalidate ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tresolversByArgs.forEach( ( value, args ) => {\n\t\t\t\t\t// resolversByArgs is the map Map([ args ] => boolean) storing the cache resolution status for a given selector.\n\t\t\t\t\t// If the value is \"finished\" or \"error\" it means this resolver has finished its resolution which means we need\n\t\t\t\t\t// to invalidate it, if it's true it means it's inflight and the invalidation is not necessary.\n\t\t\t\t\tif (\n\t\t\t\t\t\t( value?.status !== 'finished' &&\n\t\t\t\t\t\t\tvalue?.status !== 'error' ) ||\n\t\t\t\t\t\t! resolver.shouldInvalidate( action, ...args )\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Trigger cache invalidation\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.dispatch( coreDataStore )\n\t\t\t\t\t\t.invalidateResolution( reducerKey, selectorName, args );\n\t\t\t\t} );\n\t\t\t}\n\t\t);\n\t\treturn next( action );\n\t};\n\nexport default createResolversCacheMiddleware;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,aAAa,MAAM,SAAS;;AAEnC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,8BAA8B,GACnCA,CAAEC,QAAQ,EAAEC,UAAU,KAAM,MAAQC,IAAI,IAAQC,MAAM,IAAM;EAC3D,MAAMC,SAAS,GAAGJ,QAAQ,CACxBK,MAAM,CAAEP,aAAc,CAAC,CACvBQ,kBAAkB,CAAEL,UAAW,CAAC;EAClCM,MAAM,CAACC,OAAO,CAAEJ,SAAU,CAAC,CAACK,OAAO,CAClC,CAAE,CAAEC,YAAY,EAAEC,eAAe,CAAE,KAAM;IACxC,MAAMC,QAAQ,GACbZ,QAAQ,CAACa,MAAM,GAAIZ,UAAU,CAAE,EAAEG,SAAS,GACzCM,YAAY,CACZ;IACF,IAAK,CAAEE,QAAQ,IAAI,CAAEA,QAAQ,CAACE,gBAAgB,EAAG;MAChD;IACD;IACAH,eAAe,CAACF,OAAO,CAAE,CAAEM,KAAK,EAAEC,IAAI,KAAM;MAC3C;MACA;MACA;MACA,IACGD,KAAK,EAAEE,MAAM,KAAK,UAAU,IAC7BF,KAAK,EAAEE,MAAM,KAAK,OAAO,IAC1B,CAAEL,QAAQ,CAACE,gBAAgB,CAAEX,MAAM,EAAE,GAAGa,IAAK,CAAC,EAC7C;QACD;MACD;;MAEA;MACAhB,QAAQ,CACNkB,QAAQ,CAAEpB,aAAc,CAAC,CACzBqB,oBAAoB,CAAElB,UAAU,EAAES,YAAY,EAAEM,IAAK,CAAC;IACzD,CAAE,CAAC;EACJ,CACD,CAAC;EACD,OAAOd,IAAI,CAAEC,MAAO,CAAC;AACtB,CAAC;AAEF,eAAeJ,8BAA8B"}
1
+ {"version":3,"names":["createResolversCacheMiddleware","registry","storeName","next","action","resolvers","select","getCachedResolvers","resolverEntries","Object","entries","forEach","selectorName","resolversByArgs","resolver","stores","shouldInvalidate","value","args","undefined","status","dispatch","invalidateResolution"],"sources":["@wordpress/data/src/resolvers-cache-middleware.js"],"sourcesContent":["/** @typedef {import('./registry').WPDataRegistry} WPDataRegistry */\n\n/**\n * Creates a middleware handling resolvers cache invalidation.\n *\n * @param {WPDataRegistry} registry Registry for which to create the middleware.\n * @param {string} storeName Name of the store for which to create the middleware.\n *\n * @return {Function} Middleware function.\n */\nconst createResolversCacheMiddleware =\n\t( registry, storeName ) => () => ( next ) => ( action ) => {\n\t\tconst resolvers = registry.select( storeName ).getCachedResolvers();\n\t\tconst resolverEntries = Object.entries( resolvers );\n\t\tresolverEntries.forEach( ( [ selectorName, resolversByArgs ] ) => {\n\t\t\tconst resolver =\n\t\t\t\tregistry.stores[ storeName ]?.resolvers?.[ selectorName ];\n\t\t\tif ( ! resolver || ! resolver.shouldInvalidate ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tresolversByArgs.forEach( ( value, args ) => {\n\t\t\t\t// Works around a bug in `EquivalentKeyMap` where `map.delete` merely sets an entry value\n\t\t\t\t// to `undefined` and `map.forEach` then iterates also over these orphaned entries.\n\t\t\t\tif ( value === undefined ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// resolversByArgs is the map Map([ args ] => boolean) storing the cache resolution status for a given selector.\n\t\t\t\t// If the value is \"finished\" or \"error\" it means this resolver has finished its resolution which means we need\n\t\t\t\t// to invalidate it, if it's true it means it's inflight and the invalidation is not necessary.\n\t\t\t\tif ( value.status !== 'finished' && value.status !== 'error' ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( ! resolver.shouldInvalidate( action, ...args ) ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Trigger cache invalidation\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( storeName )\n\t\t\t\t\t.invalidateResolution( selectorName, args );\n\t\t\t} );\n\t\t} );\n\t\treturn next( action );\n\t};\n\nexport default createResolversCacheMiddleware;\n"],"mappings":"AAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,8BAA8B,GACnCA,CAAEC,QAAQ,EAAEC,SAAS,KAAM,MAAQC,IAAI,IAAQC,MAAM,IAAM;EAC1D,MAAMC,SAAS,GAAGJ,QAAQ,CAACK,MAAM,CAAEJ,SAAU,CAAC,CAACK,kBAAkB,CAAC,CAAC;EACnE,MAAMC,eAAe,GAAGC,MAAM,CAACC,OAAO,CAAEL,SAAU,CAAC;EACnDG,eAAe,CAACG,OAAO,CAAE,CAAE,CAAEC,YAAY,EAAEC,eAAe,CAAE,KAAM;IACjE,MAAMC,QAAQ,GACbb,QAAQ,CAACc,MAAM,CAAEb,SAAS,CAAE,EAAEG,SAAS,GAAIO,YAAY,CAAE;IAC1D,IAAK,CAAEE,QAAQ,IAAI,CAAEA,QAAQ,CAACE,gBAAgB,EAAG;MAChD;IACD;IACAH,eAAe,CAACF,OAAO,CAAE,CAAEM,KAAK,EAAEC,IAAI,KAAM;MAC3C;MACA;MACA,IAAKD,KAAK,KAAKE,SAAS,EAAG;QAC1B;MACD;;MAEA;MACA;MACA;MACA,IAAKF,KAAK,CAACG,MAAM,KAAK,UAAU,IAAIH,KAAK,CAACG,MAAM,KAAK,OAAO,EAAG;QAC9D;MACD;MAEA,IAAK,CAAEN,QAAQ,CAACE,gBAAgB,CAAEZ,MAAM,EAAE,GAAGc,IAAK,CAAC,EAAG;QACrD;MACD;;MAEA;MACAjB,QAAQ,CACNoB,QAAQ,CAAEnB,SAAU,CAAC,CACrBoB,oBAAoB,CAAEV,YAAY,EAAEM,IAAK,CAAC;IAC7C,CAAE,CAAC;EACJ,CAAE,CAAC;EACH,OAAOf,IAAI,CAAEC,MAAO,CAAC;AACtB,CAAC;AAEF,eAAeJ,8BAA8B"}
@@ -28,8 +28,8 @@ export type UseDispatchReturn<StoreNameOrDescriptor> = import('../../types').Use
28
28
  * action.
29
29
  *
30
30
  * ```jsx
31
+ * import { useCallback } from 'react';
31
32
  * import { useDispatch, useSelect } from '@wordpress/data';
32
- * import { useCallback } from '@wordpress/element';
33
33
  * import { store as myCustomStore } from 'my-custom-store';
34
34
  *
35
35
  * function Button( { onClick, children } ) {
@@ -1,6 +1,6 @@
1
1
  export default withDispatch;
2
- export type WPComponent = import('@wordpress/element').WPComponent;
3
- /** @typedef {import('@wordpress/element').WPComponent} WPComponent */
2
+ export type ComponentType = import('react').ComponentType;
3
+ /** @typedef {import('react').ComponentType} ComponentType */
4
4
  /**
5
5
  * Higher-order component used to add dispatch props using registered action
6
6
  * creators.
@@ -80,7 +80,7 @@ export type WPComponent = import('@wordpress/element').WPComponent;
80
80
  * returns an object with the same keys. For example, it should not contain
81
81
  * conditions under which a different value would be returned.
82
82
  *
83
- * @return {WPComponent} Enhanced component with merged dispatcher props.
83
+ * @return {ComponentType} Enhanced component with merged dispatcher props.
84
84
  */
85
- declare function withDispatch(mapDispatchToProps: Function): WPComponent;
85
+ declare function withDispatch(mapDispatchToProps: Function): ComponentType;
86
86
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/with-dispatch/index.js"],"names":[],"mappings":";0BAUc,OAAO,oBAAoB,EAAE,WAAW;AAAtD,sEAAsE;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgFG;AACH,6DAFY,WAAW,CAWrB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/with-dispatch/index.js"],"names":[],"mappings":";4BAUc,OAAO,OAAO,EAAE,aAAa;AAA3C,6DAA6D;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgFG;AACH,6DAFY,aAAa,CAWvB"}
@@ -3,9 +3,9 @@ export default withRegistry;
3
3
  * Higher-order component which renders the original component with the current
4
4
  * registry context passed as its `registry` prop.
5
5
  *
6
- * @param {WPComponent} OriginalComponent Original component.
6
+ * @param {Component} OriginalComponent Original component.
7
7
  *
8
- * @return {WPComponent} Enhanced component.
8
+ * @return {Component} Enhanced component.
9
9
  */
10
10
  declare const withRegistry: (Inner: import("react").ComponentType<any>) => (props: any) => JSX.Element;
11
11
  //# sourceMappingURL=index.d.ts.map
@@ -1,6 +1,6 @@
1
1
  export default withSelect;
2
- export type WPComponent = import('@wordpress/element').WPComponent;
3
- /** @typedef {import('@wordpress/element').WPComponent} WPComponent */
2
+ export type ComponentType = import('react').ComponentType;
3
+ /** @typedef {import('react').ComponentType} ComponentType */
4
4
  /**
5
5
  * Higher-order component used to inject state-derived props using registered
6
6
  * selectors.
@@ -39,7 +39,7 @@ export type WPComponent = import('@wordpress/element').WPComponent;
39
39
  * component and update automatically if the price of a hammer ever changes in
40
40
  * the store.
41
41
  *
42
- * @return {WPComponent} Enhanced component with merged state data props.
42
+ * @return {ComponentType} Enhanced component with merged state data props.
43
43
  */
44
- declare function withSelect(mapSelectToProps: Function): WPComponent;
44
+ declare function withSelect(mapSelectToProps: Function): ComponentType;
45
45
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/with-select/index.js"],"names":[],"mappings":";0BAUc,OAAO,oBAAoB,EAAE,WAAW;AAAtD,sEAAsE;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,yDAFY,WAAW,CAYrB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/with-select/index.js"],"names":[],"mappings":";4BAUc,OAAO,OAAO,EAAE,aAAa;AAA3C,6DAA6D;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,yDAFY,aAAa,CAYvB"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":";;;;;;;;;;;AA2CA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,8BAnCW,OAAO,SAAS,EAAE,eAAe,CAmCQ;AAEpD;;;;;;;;;;;;;;;;;;GAkBG;AACH,gCAA2D;AAE3D;;;;;;;;;;GAUG;AACH,gCAA2D;AAE3D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,iCAAmD;AAEnD;;;;;;;GAOG;AACH,4CAAyE;AAEzE;;;;;;;;;GASG;AACH,qCAA2D;AAE3D;;;;;;GAMG;AACH,sBAAuC;AAEvC;;;;;;;;;;;;;;;;;GAiBG;AACH,2BAAiD;;yBAxLxB,WAAW"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":";;;;;;;;;;;AAuCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,8BAnCW,OAAO,SAAS,EAAE,eAAe,CAmCS;AAErD;;;;;;;;;;;;;;;;;;GAkBG;AACH,gCAA2D;AAE3D;;;;;;;;;;GAUG;AACH,gCAA2D;AAE3D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,iCAAmD;AAEnD;;;;;;;GAOG;AACH,4CAAyE;AAEzE;;;;;;;;;GASG;AACH,qCAA2D;AAE3D;;;;;;GAMG;AACH,sBAAuC;AAEvC;;;;;;;;;;;;;;;;;GAiBG;AACH,2BAAiD;;yBAzLxB,WAAW"}
@@ -0,0 +1,2 @@
1
+ export function combineReducers(reducers: any): (state: {} | undefined, action: any) => {};
2
+ //# sourceMappingURL=combine-reducers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"combine-reducers.d.ts","sourceRoot":"","sources":["../../src/redux-store/combine-reducers.js"],"names":[],"mappings":"AAAA,2FAgBC"}
@@ -15,7 +15,7 @@
15
15
  * ```
16
16
  *
17
17
  * @template State
18
- * @template {Record<string,import('../../types').ActionCreator>} Actions
18
+ * @template {Record<string,import('../types').ActionCreator>} Actions
19
19
  * @template Selectors
20
20
  * @param {string} key Unique namespace identifier.
21
21
  * @param {ReduxStoreConfig<State,Actions,Selectors>} options Registered store options, with properties
@@ -24,9 +24,11 @@
24
24
  *
25
25
  * @return {StoreDescriptor<ReduxStoreConfig<State,Actions,Selectors>>} Store Object.
26
26
  */
27
- export default function createReduxStore<State, Actions extends Record<string, any>, Selectors>(key: string, options: import("../types").ReduxStoreConfig<State, Actions, Selectors>): import("../types").StoreDescriptor<import("../types").ReduxStoreConfig<State, Actions, Selectors>>;
27
+ export default function createReduxStore<State, Actions extends Record<string, import("../types").ActionCreator>, Selectors>(key: string, options: import("../types").ReduxStoreConfig<State, Actions, Selectors>): import("../types").StoreDescriptor<import("../types").ReduxStoreConfig<State, Actions, Selectors>>;
28
+ export { combineReducers };
28
29
  export type DataRegistry = import('../types').DataRegistry;
29
30
  export type ListenerFunction = import('../types').ListenerFunction;
30
31
  export type StoreDescriptor<C extends import("../types").AnyConfig> = import('../types').StoreDescriptor<C>;
31
- export type ReduxStoreConfig<State, Actions extends Record<string, any>, Selectors> = import('../types').ReduxStoreConfig<State, Actions, Selectors>;
32
+ export type ReduxStoreConfig<State, Actions extends Record<string, import("../types").ActionCreator>, Selectors> = import('../types').ReduxStoreConfig<State, Actions, Selectors>;
33
+ import { combineReducers } from './combine-reducers';
32
34
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/redux-store/index.js"],"names":[],"mappings":"AAuHA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qGAPW,MAAM,+KAwNhB;2BAzUa,OAAO,UAAU,EAAE,YAAY;+BAC/B,OAAO,UAAU,EAAE,gBAAgB;sEAEpC,OAAO,UAAU,EAAE,eAAe,CAAC,CAAC,CAAC;sFAIrC,OAAO,UAAU,EAAE,gBAAgB,CAAC,KAAK,EAAC,OAAO,EAAC,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/redux-store/index.js"],"names":[],"mappings":"AAyHA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,kIAPW,MAAM,+KAwNhB;;2BAzUa,OAAO,UAAU,EAAE,YAAY;+BAC/B,OAAO,UAAU,EAAE,gBAAgB;sEAEpC,OAAO,UAAU,EAAE,eAAe,CAAC,CAAC,CAAC;mHAIrC,OAAO,UAAU,EAAE,gBAAgB,CAAC,KAAK,EAAC,OAAO,EAAC,SAAS,CAAC;gCAnBzC,oBAAoB"}
@@ -4,12 +4,10 @@ export type WPDataRegistry = import('./registry').WPDataRegistry;
4
4
  /**
5
5
  * Creates a middleware handling resolvers cache invalidation.
6
6
  *
7
- * @param {WPDataRegistry} registry The registry reference for which to create
8
- * the middleware.
9
- * @param {string} reducerKey The namespace for which to create the
10
- * middleware.
7
+ * @param {WPDataRegistry} registry Registry for which to create the middleware.
8
+ * @param {string} storeName Name of the store for which to create the middleware.
11
9
  *
12
10
  * @return {Function} Middleware function.
13
11
  */
14
- declare function createResolversCacheMiddleware(registry: WPDataRegistry, reducerKey: string): Function;
12
+ declare function createResolversCacheMiddleware(registry: WPDataRegistry, storeName: string): Function;
15
13
  //# sourceMappingURL=resolvers-cache-middleware.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolvers-cache-middleware.d.ts","sourceRoot":"","sources":["../src/resolvers-cache-middleware.js"],"names":[],"mappings":";6BAKc,OAAO,YAAY,EAAE,cAAc;AAAjD,oEAAoE;AAEpE;;;;;;;;;GASG;AACH,0DAPW,cAAc,cAEd,MAAM,YAuCf"}
1
+ {"version":3,"file":"resolvers-cache-middleware.d.ts","sourceRoot":"","sources":["../src/resolvers-cache-middleware.js"],"names":[],"mappings":";6BAAc,OAAO,YAAY,EAAE,cAAc;AAAjD,oEAAoE;AAEpE;;;;;;;GAOG;AACH,0DALW,cAAc,aACd,MAAM,YAuCf"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/data",
3
- "version": "9.12.6",
3
+ "version": "9.13.1",
4
4
  "description": "Data module for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -29,20 +29,19 @@
29
29
  "sideEffects": false,
30
30
  "dependencies": {
31
31
  "@babel/runtime": "^7.16.0",
32
- "@wordpress/compose": "^6.19.6",
33
- "@wordpress/deprecated": "^3.42.6",
34
- "@wordpress/element": "^5.19.6",
35
- "@wordpress/is-shallow-equal": "^4.42.6",
36
- "@wordpress/priority-queue": "^2.42.6",
37
- "@wordpress/private-apis": "^0.24.6",
38
- "@wordpress/redux-routine": "^4.42.6",
32
+ "@wordpress/compose": "^6.20.0",
33
+ "@wordpress/deprecated": "^3.43.0",
34
+ "@wordpress/element": "^5.20.0",
35
+ "@wordpress/is-shallow-equal": "^4.43.0",
36
+ "@wordpress/priority-queue": "^2.43.0",
37
+ "@wordpress/private-apis": "^0.25.0",
38
+ "@wordpress/redux-routine": "^4.43.0",
39
39
  "deepmerge": "^4.3.0",
40
40
  "equivalent-key-map": "^0.2.2",
41
41
  "is-plain-object": "^5.0.0",
42
42
  "is-promise": "^4.0.0",
43
43
  "redux": "^4.1.2",
44
44
  "rememo": "^4.0.2",
45
- "turbo-combine-reducers": "^1.0.2",
46
45
  "use-memo-one": "^1.1.1"
47
46
  },
48
47
  "peerDependencies": {
@@ -51,5 +50,5 @@
51
50
  "publishConfig": {
52
51
  "access": "public"
53
52
  },
54
- "gitHead": "640c80ab0fb4e0e2bce87e33895939f257e674df"
53
+ "gitHead": "e17f760ed0dc11cce78157d7c2f2086b1b3c09d8"
55
54
  }
@@ -42,6 +42,6 @@ export const AsyncModeConsumer = Consumer;
42
42
  * It is possible to nest multiple levels of AsyncModeProvider to fine-tune the rendering behavior.
43
43
  *
44
44
  * @param {boolean} props.value Enable Async Mode.
45
- * @return {WPComponent} The component to be rendered.
45
+ * @return {Component} The component to be rendered.
46
46
  */
47
47
  export default Provider;
@@ -31,8 +31,8 @@ import useRegistry from '../registry-provider/use-registry';
31
31
  * action.
32
32
  *
33
33
  * ```jsx
34
+ * import { useCallback } from 'react';
34
35
  * import { useDispatch, useSelect } from '@wordpress/data';
35
- * import { useCallback } from '@wordpress/element';
36
36
  * import { store as myCustomStore } from 'my-custom-store';
37
37
  *
38
38
  * function Button( { onClick, children } ) {
@@ -8,7 +8,7 @@ import { createHigherOrderComponent } from '@wordpress/compose';
8
8
  */
9
9
  import { useDispatchWithMap } from '../use-dispatch';
10
10
 
11
- /** @typedef {import('@wordpress/element').WPComponent} WPComponent */
11
+ /** @typedef {import('react').ComponentType} ComponentType */
12
12
 
13
13
  /**
14
14
  * Higher-order component used to add dispatch props using registered action
@@ -89,7 +89,7 @@ import { useDispatchWithMap } from '../use-dispatch';
89
89
  * returns an object with the same keys. For example, it should not contain
90
90
  * conditions under which a different value would be returned.
91
91
  *
92
- * @return {WPComponent} Enhanced component with merged dispatcher props.
92
+ * @return {ComponentType} Enhanced component with merged dispatcher props.
93
93
  */
94
94
  const withDispatch = ( mapDispatchToProps ) =>
95
95
  createHigherOrderComponent(
@@ -12,9 +12,9 @@ import { RegistryConsumer } from '../registry-provider';
12
12
  * Higher-order component which renders the original component with the current
13
13
  * registry context passed as its `registry` prop.
14
14
  *
15
- * @param {WPComponent} OriginalComponent Original component.
15
+ * @param {Component} OriginalComponent Original component.
16
16
  *
17
- * @return {WPComponent} Enhanced component.
17
+ * @return {Component} Enhanced component.
18
18
  */
19
19
  const withRegistry = createHigherOrderComponent(
20
20
  ( OriginalComponent ) => ( props ) => (
@@ -8,7 +8,7 @@ import { createHigherOrderComponent, pure } from '@wordpress/compose';
8
8
  */
9
9
  import useSelect from '../use-select';
10
10
 
11
- /** @typedef {import('@wordpress/element').WPComponent} WPComponent */
11
+ /** @typedef {import('react').ComponentType} ComponentType */
12
12
 
13
13
  /**
14
14
  * Higher-order component used to inject state-derived props using registered
@@ -48,7 +48,7 @@ import useSelect from '../use-select';
48
48
  * component and update automatically if the price of a hammer ever changes in
49
49
  * the store.
50
50
  *
51
- * @return {WPComponent} Enhanced component with merged state data props.
51
+ * @return {ComponentType} Enhanced component with merged state data props.
52
52
  */
53
53
  const withSelect = ( mapSelectToProps ) =>
54
54
  createHigherOrderComponent(
package/src/index.js CHANGED
@@ -1,13 +1,9 @@
1
- /**
2
- * External dependencies
3
- */
4
- import turboCombineReducers from 'turbo-combine-reducers';
5
-
6
1
  /**
7
2
  * Internal dependencies
8
3
  */
9
4
  import defaultRegistry from './default-registry';
10
5
  import * as plugins from './plugins';
6
+ import { combineReducers as combineReducersModule } from './redux-store';
11
7
 
12
8
  /** @typedef {import('./types').StoreDescriptor} StoreDescriptor */
13
9
 
@@ -80,7 +76,7 @@ export { plugins };
80
76
  * @return {Function} A reducer that invokes every reducer inside the reducers
81
77
  * object, and constructs a state object with the same shape.
82
78
  */
83
- export const combineReducers = turboCombineReducers;
79
+ export const combineReducers = combineReducersModule;
84
80
 
85
81
  /**
86
82
  * Given a store descriptor, returns an object containing the store's selectors pre-bound to state
@@ -5,6 +5,6 @@ import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/pri
5
5
 
6
6
  export const { lock, unlock } =
7
7
  __dangerousOptInToUnstableAPIsOnlyForCoreModules(
8
- 'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.',
8
+ 'I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.',
9
9
  '@wordpress/data'
10
10
  );
@@ -0,0 +1,17 @@
1
+ export function combineReducers( reducers ) {
2
+ const keys = Object.keys( reducers );
3
+
4
+ return function combinedReducer( state = {}, action ) {
5
+ const nextState = {};
6
+ let hasChanged = false;
7
+ for ( const key of keys ) {
8
+ const reducer = reducers[ key ];
9
+ const prevStateForKey = state[ key ];
10
+ const nextStateForKey = reducer( prevStateForKey, action );
11
+ nextState[ key ] = nextStateForKey;
12
+ hasChanged = hasChanged || nextStateForKey !== prevStateForKey;
13
+ }
14
+
15
+ return hasChanged ? nextState : state;
16
+ };
17
+ }
@@ -2,7 +2,6 @@
2
2
  * External dependencies
3
3
  */
4
4
  import { createStore, applyMiddleware } from 'redux';
5
- import combineReducers from 'turbo-combine-reducers';
6
5
  import EquivalentKeyMap from 'equivalent-key-map';
7
6
 
8
7
  /**
@@ -14,6 +13,7 @@ import { compose } from '@wordpress/compose';
14
13
  /**
15
14
  * Internal dependencies
16
15
  */
16
+ import { combineReducers } from './combine-reducers';
17
17
  import { builtinControls } from '../controls';
18
18
  import { lock } from '../lock-unlock';
19
19
  import promise from '../promise-middleware';
@@ -23,6 +23,8 @@ import metadataReducer from './metadata/reducer';
23
23
  import * as metadataSelectors from './metadata/selectors';
24
24
  import * as metadataActions from './metadata/actions';
25
25
 
26
+ export { combineReducers };
27
+
26
28
  /** @typedef {import('../types').DataRegistry} DataRegistry */
27
29
  /** @typedef {import('../types').ListenerFunction} ListenerFunction */
28
30
  /**
@@ -32,7 +34,7 @@ import * as metadataActions from './metadata/actions';
32
34
  /**
33
35
  * @typedef {import('../types').ReduxStoreConfig<State,Actions,Selectors>} ReduxStoreConfig
34
36
  * @template State
35
- * @template {Record<string,import('../../types').ActionCreator>} Actions
37
+ * @template {Record<string,import('../types').ActionCreator>} Actions
36
38
  * @template Selectors
37
39
  */
38
40
 
@@ -134,7 +136,7 @@ function createBindingCache( bind ) {
134
136
  * ```
135
137
  *
136
138
  * @template State
137
- * @template {Record<string,import('../../types').ActionCreator>} Actions
139
+ * @template {Record<string,import('../types').ActionCreator>} Actions
138
140
  * @template Selectors
139
141
  * @param {string} key Unique namespace identifier.
140
142
  * @param {ReduxStoreConfig<State,Actions,Selectors>} options Registered store options, with properties