@wordpress/data 6.2.2-next.f435e9e01b.0 → 6.3.0

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 (39) hide show
  1. package/CHANGELOG.md +7 -1
  2. package/build/redux-store/index.js +1 -6
  3. package/build/redux-store/index.js.map +1 -1
  4. package/build/redux-store/metadata/actions.js +4 -4
  5. package/build/redux-store/metadata/actions.js.map +1 -1
  6. package/build/redux-store/metadata/reducer.js +3 -3
  7. package/build/redux-store/metadata/reducer.js.map +1 -1
  8. package/build/redux-store/metadata/selectors.js +22 -19
  9. package/build/redux-store/metadata/selectors.js.map +1 -1
  10. package/build/redux-store/metadata/utils.js +31 -13
  11. package/build/redux-store/metadata/utils.js.map +1 -1
  12. package/build-module/redux-store/index.js +1 -6
  13. package/build-module/redux-store/index.js.map +1 -1
  14. package/build-module/redux-store/metadata/actions.js +4 -4
  15. package/build-module/redux-store/metadata/actions.js.map +1 -1
  16. package/build-module/redux-store/metadata/reducer.js +4 -4
  17. package/build-module/redux-store/metadata/reducer.js.map +1 -1
  18. package/build-module/redux-store/metadata/selectors.js +21 -19
  19. package/build-module/redux-store/metadata/selectors.js.map +1 -1
  20. package/build-module/redux-store/metadata/utils.js +29 -13
  21. package/build-module/redux-store/metadata/utils.js.map +1 -1
  22. package/build-types/redux-store/metadata/actions.d.ts +8 -8
  23. package/build-types/redux-store/metadata/actions.d.ts.map +1 -1
  24. package/build-types/redux-store/metadata/reducer.d.ts.map +1 -1
  25. package/build-types/redux-store/metadata/selectors.d.ts +16 -16
  26. package/build-types/redux-store/metadata/selectors.d.ts.map +1 -1
  27. package/build-types/redux-store/metadata/utils.d.ts +20 -1
  28. package/build-types/redux-store/metadata/utils.d.ts.map +1 -1
  29. package/package.json +8 -8
  30. package/src/redux-store/index.js +1 -4
  31. package/src/redux-store/metadata/actions.js +4 -4
  32. package/src/redux-store/metadata/reducer.ts +7 -4
  33. package/src/redux-store/metadata/selectors.js +21 -16
  34. package/src/redux-store/metadata/test/reducer.js +40 -0
  35. package/src/redux-store/metadata/test/selectors.js +11 -0
  36. package/src/redux-store/metadata/test/utils.js +28 -1
  37. package/src/redux-store/metadata/utils.ts +59 -0
  38. package/tsconfig.tsbuildinfo +1 -1
  39. package/src/redux-store/metadata/utils.js +0 -37
@@ -3,6 +3,11 @@
3
3
  */
4
4
  import { get } from 'lodash';
5
5
 
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ import { selectorArgsToStateKey } from './utils';
10
+
6
11
  /** @typedef {Record<string, import('./reducer').State>} State */
7
12
 
8
13
  /**
@@ -11,9 +16,9 @@ import { get } from 'lodash';
11
16
  * or not resolved for the given set of arguments, otherwise true or false for
12
17
  * resolution started and completed respectively.
13
18
  *
14
- * @param {State} state Data state.
15
- * @param {string} selectorName Selector name.
16
- * @param {unknown[]} args Arguments passed to selector.
19
+ * @param {State} state Data state.
20
+ * @param {string} selectorName Selector name.
21
+ * @param {unknown[]?} args Arguments passed to selector.
17
22
  *
18
23
  * @return {boolean | undefined} isResolving value.
19
24
  */
@@ -23,20 +28,20 @@ export function getIsResolving( state, selectorName, args ) {
23
28
  return undefined;
24
29
  }
25
30
 
26
- return map.get( args );
31
+ return map.get( selectorArgsToStateKey( args ) );
27
32
  }
28
33
 
29
34
  /**
30
35
  * Returns true if resolution has already been triggered for a given
31
36
  * selector name, and arguments set.
32
37
  *
33
- * @param {State} state Data state.
34
- * @param {string} selectorName Selector name.
35
- * @param {unknown[]} [args] Arguments passed to selector (default `[]`).
38
+ * @param {State} state Data state.
39
+ * @param {string} selectorName Selector name.
40
+ * @param {unknown[]?} args Arguments passed to selector.
36
41
  *
37
42
  * @return {boolean} Whether resolution has been triggered.
38
43
  */
39
- export function hasStartedResolution( state, selectorName, args = [] ) {
44
+ export function hasStartedResolution( state, selectorName, args ) {
40
45
  return getIsResolving( state, selectorName, args ) !== undefined;
41
46
  }
42
47
 
@@ -44,13 +49,13 @@ export function hasStartedResolution( state, selectorName, args = [] ) {
44
49
  * Returns true if resolution has completed for a given selector
45
50
  * name, and arguments set.
46
51
  *
47
- * @param {State} state Data state.
48
- * @param {string} selectorName Selector name.
49
- * @param {unknown[]} [args] Arguments passed to selector.
52
+ * @param {State} state Data state.
53
+ * @param {string} selectorName Selector name.
54
+ * @param {unknown[]?} args Arguments passed to selector.
50
55
  *
51
56
  * @return {boolean} Whether resolution has completed.
52
57
  */
53
- export function hasFinishedResolution( state, selectorName, args = [] ) {
58
+ export function hasFinishedResolution( state, selectorName, args ) {
54
59
  return getIsResolving( state, selectorName, args ) === false;
55
60
  }
56
61
 
@@ -58,13 +63,13 @@ export function hasFinishedResolution( state, selectorName, args = [] ) {
58
63
  * Returns true if resolution has been triggered but has not yet completed for
59
64
  * a given selector name, and arguments set.
60
65
  *
61
- * @param {State} state Data state.
62
- * @param {string} selectorName Selector name.
63
- * @param {unknown[]} [args] Arguments passed to selector.
66
+ * @param {State} state Data state.
67
+ * @param {string} selectorName Selector name.
68
+ * @param {unknown[]?} args Arguments passed to selector.
64
69
  *
65
70
  * @return {boolean} Whether resolution is in progress.
66
71
  */
67
- export function isResolving( state, selectorName, args = [] ) {
72
+ export function isResolving( state, selectorName, args ) {
68
73
  return getIsResolving( state, selectorName, args ) === true;
69
74
  }
70
75
 
@@ -127,6 +127,22 @@ describe( 'reducer', () => {
127
127
  expect( state.getFoo.get( [ 'post' ] ) ).toBe( false );
128
128
  }
129
129
  );
130
+
131
+ it( 'should normalize args array when dispatching actions', () => {
132
+ const started = reducer( undefined, {
133
+ type: 'START_RESOLUTION',
134
+ selectorName: 'getFoo',
135
+ args: [ 1, undefined ],
136
+ } );
137
+ expect( started.getFoo.get( [ 1 ] ) ).toBe( true );
138
+
139
+ const finished = reducer( started, {
140
+ type: 'FINISH_RESOLUTION',
141
+ selectorName: 'getFoo',
142
+ args: [ 1, undefined, undefined ],
143
+ } );
144
+ expect( finished.getFoo.get( [ 1 ] ) ).toBe( false );
145
+ } );
130
146
  } );
131
147
 
132
148
  describe( 'resolution batch', () => {
@@ -240,5 +256,29 @@ describe( 'reducer', () => {
240
256
  expect( state.getFoo.get( [ 'block' ] ) ).toBe( false );
241
257
  }
242
258
  );
259
+
260
+ it( 'should normalize args array when dispatching actions', () => {
261
+ const started = reducer( undefined, {
262
+ type: 'START_RESOLUTIONS',
263
+ selectorName: 'getFoo',
264
+ args: [
265
+ [ 1, undefined ],
266
+ [ 2, undefined, undefined ],
267
+ ],
268
+ } );
269
+ expect( started.getFoo.get( [ 1 ] ) ).toBe( true );
270
+ expect( started.getFoo.get( [ 2 ] ) ).toBe( true );
271
+
272
+ const finished = reducer( started, {
273
+ type: 'FINISH_RESOLUTIONS',
274
+ selectorName: 'getFoo',
275
+ args: [
276
+ [ 1, undefined, undefined ],
277
+ [ 2, undefined ],
278
+ ],
279
+ } );
280
+ expect( finished.getFoo.get( [ 1 ] ) ).toBe( false );
281
+ expect( finished.getFoo.get( [ 2 ] ) ).toBe( false );
282
+ } );
243
283
  } );
244
284
  } );
@@ -38,6 +38,17 @@ describe( 'getIsResolving', () => {
38
38
 
39
39
  expect( result ).toBe( true );
40
40
  } );
41
+
42
+ it( 'should normalize args ard return the right value', () => {
43
+ const state = {
44
+ getFoo: new EquivalentKeyMap( [ [ [], true ] ] ),
45
+ };
46
+ expect( getIsResolving( state, 'getFoo' ) ).toBe( true );
47
+ expect( getIsResolving( state, 'getFoo', [ undefined ] ) ).toBe( true );
48
+ expect(
49
+ getIsResolving( state, 'getFoo', [ undefined, undefined ] )
50
+ ).toBe( true );
51
+ } );
41
52
  } );
42
53
 
43
54
  describe( 'hasStartedResolution', () => {
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Internal dependencies
3
3
  */
4
- import { onSubKey } from '../utils';
4
+ import { selectorArgsToStateKey, onSubKey } from '../utils';
5
5
 
6
6
  describe( 'onSubKey', () => {
7
7
  function createEnhancedReducer( actionProperty ) {
@@ -39,3 +39,30 @@ describe( 'onSubKey', () => {
39
39
  } );
40
40
  } );
41
41
  } );
42
+
43
+ describe( 'selectorArgsToStateKey', () => {
44
+ it( 'should default to an empty array', () => {
45
+ expect( selectorArgsToStateKey( undefined ) ).toEqual( [] );
46
+ } );
47
+
48
+ it( 'should remove trailing undefined values', () => {
49
+ expect( selectorArgsToStateKey( [ 1, 2, undefined ] ) ).toEqual( [
50
+ 1,
51
+ 2,
52
+ ] );
53
+ expect(
54
+ selectorArgsToStateKey( [ 1, 2, undefined, undefined ] )
55
+ ).toEqual( [ 1, 2 ] );
56
+ } );
57
+
58
+ it( 'should leave non-trailing undefined values alone', () => {
59
+ expect(
60
+ selectorArgsToStateKey( [ 1, undefined, 2, undefined ] )
61
+ ).toEqual( [ 1, undefined, 2 ] );
62
+ } );
63
+
64
+ it( 'should return already normalized array unchanged', () => {
65
+ const args = [ 1, 2, 3 ];
66
+ expect( selectorArgsToStateKey( args ) ).toBe( args );
67
+ } );
68
+ } );
@@ -0,0 +1,59 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import type { AnyAction, Reducer } from 'redux';
5
+
6
+ /**
7
+ * Higher-order reducer creator which creates a combined reducer object, keyed
8
+ * by a property on the action object.
9
+ *
10
+ * @param actionProperty Action property by which to key object.
11
+ * @return Higher-order reducer.
12
+ */
13
+ export const onSubKey = < TState extends unknown, TAction extends AnyAction >(
14
+ actionProperty: string
15
+ ) => (
16
+ reducer: Reducer< TState, TAction >
17
+ ): Reducer< Record< string, TState >, TAction > => (
18
+ state: Record< string, TState > = {},
19
+ action
20
+ ) => {
21
+ // Retrieve subkey from action. Do not track if undefined; useful for cases
22
+ // where reducer is scoped by action shape.
23
+ const key = action[ actionProperty ];
24
+ if ( key === undefined ) {
25
+ return state;
26
+ }
27
+
28
+ // Avoid updating state if unchanged. Note that this also accounts for a
29
+ // reducer which returns undefined on a key which is not yet tracked.
30
+ const nextKeyState = reducer( state[ key ], action );
31
+ if ( nextKeyState === state[ key ] ) {
32
+ return state;
33
+ }
34
+
35
+ return {
36
+ ...state,
37
+ [ key ]: nextKeyState,
38
+ };
39
+ };
40
+
41
+ /**
42
+ * Normalize selector argument array by defaulting `undefined` value to an empty array
43
+ * and removing trailing `undefined` values.
44
+ *
45
+ * @param args Selector argument array
46
+ * @return Normalized state key array
47
+ */
48
+ export function selectorArgsToStateKey( args: unknown[] | null | undefined ) {
49
+ if ( args === undefined || args === null ) {
50
+ return [];
51
+ }
52
+
53
+ const len = args.length;
54
+ let idx = len;
55
+ while ( idx > 0 && args[ idx - 1 ] === undefined ) {
56
+ idx--;
57
+ }
58
+ return idx === len ? args : args.slice( 0, idx );
59
+ }
@@ -1 +1 @@
1
- {"program":{"fileNames":["../../node_modules/typescript/lib/lib.es5.d.ts","../../node_modules/typescript/lib/lib.es2015.d.ts","../../node_modules/typescript/lib/lib.es2016.d.ts","../../node_modules/typescript/lib/lib.es2017.d.ts","../../node_modules/typescript/lib/lib.es2018.d.ts","../../node_modules/typescript/lib/lib.es2019.d.ts","../../node_modules/typescript/lib/lib.es2020.d.ts","../../node_modules/typescript/lib/lib.es2021.d.ts","../../node_modules/typescript/lib/lib.esnext.d.ts","../../node_modules/typescript/lib/lib.dom.d.ts","../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../node_modules/typescript/lib/lib.es2021.promise.d.ts","../../node_modules/typescript/lib/lib.es2021.string.d.ts","../../node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../node_modules/typescript/lib/lib.esnext.intl.d.ts","./src/redux-store/metadata/actions.js","./src/redux-store/metadata/equivalent-key-map.d.ts","../../node_modules/@types/lodash/common/common.d.ts","../../node_modules/@types/lodash/common/array.d.ts","../../node_modules/@types/lodash/common/collection.d.ts","../../node_modules/@types/lodash/common/date.d.ts","../../node_modules/@types/lodash/common/function.d.ts","../../node_modules/@types/lodash/common/lang.d.ts","../../node_modules/@types/lodash/common/math.d.ts","../../node_modules/@types/lodash/common/number.d.ts","../../node_modules/@types/lodash/common/object.d.ts","../../node_modules/@types/lodash/common/seq.d.ts","../../node_modules/@types/lodash/common/string.d.ts","../../node_modules/@types/lodash/common/util.d.ts","../../node_modules/@types/lodash/index.d.ts","../../node_modules/redux/index.d.ts","./src/redux-store/metadata/utils.js","./src/redux-store/metadata/reducer.ts","./src/redux-store/metadata/selectors.js","../../node_modules/is-promise/index.d.ts","./src/promise-middleware.js","./src/types.ts","./src/utils/emitter.js"],"fileInfos":[{"version":"aa9fb4c70f369237c2f45f9d969c9a59e0eae9a192962eb48581fe864aa609db","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","e6b724280c694a9f588847f754198fb96c43d805f065c3a5b28bbc9594541c84","e21c071ca3e1b4a815d5f04a7475adcaeea5d64367e840dd0154096d705c3940","eb75e89d63b3b72dd9ca8b0cac801cecae5be352307c004adeaa60bc9d6df51f","2cc028cd0bdb35b1b5eb723d84666a255933fffbea607f72cbd0c7c7b4bee144",{"version":"e54c8715a4954cfdc66cd69489f2b725c09ebf37492dbd91cff0a1688b1159e8","affectsGlobalScope":true},{"version":"51b8b27c21c066bf877646e320bf6a722b80d1ade65e686923cd9d4494aef1ca","affectsGlobalScope":true},{"version":"43fb1d932e4966a39a41b464a12a81899d9ae5f2c829063f5571b6b87e6d2f9c","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"2c8c5ee58f30e7c944e04ab1fb5506fdbb4dd507c9efa6972cf4b91cec90c503","affectsGlobalScope":true},{"version":"2bb4b3927299434052b37851a47bf5c39764f2ba88a888a107b32262e9292b7c","affectsGlobalScope":true},{"version":"810627a82ac06fb5166da5ada4159c4ec11978dfbb0805fe804c86406dab8357","affectsGlobalScope":true},{"version":"62d80405c46c3f4c527ee657ae9d43fda65a0bf582292429aea1e69144a522a6","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"75ec0bdd727d887f1b79ed6619412ea72ba3c81d92d0787ccb64bab18d261f14","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"12a310447c5d23c7d0d5ca2af606e3bd08afda69100166730ab92c62999ebb9d","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"df9c8a72ca8b0ed62f5470b41208a0587f0f73f0a7db28e5a1272cf92537518e","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"93544ca2f26a48716c1b6c5091842cad63129daac422dfa4bc52460465f22bb1","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"1b3fe904465430e030c93239a348f05e1be80640d91f2f004c3512c2c2c89f34","affectsGlobalScope":true},{"version":"7435b75fdf3509622e79622dbe5091cf4b09688410ee2034e4fc17d0c99d0862","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"9f1817f7c3f02f6d56e0f403b927e90bb133f371dcebc36fa7d6d208ef6899da","affectsGlobalScope":true},{"version":"cd6efb9467a8b6338ece2e2855e37765700f2cd061ca54b01b33878cf5c7677e","affectsGlobalScope":true},{"version":"fb4416144c1bf0323ccbc9afb0ab289c07312214e8820ad17d709498c865a3fe","affectsGlobalScope":true},{"version":"5b0ca94ec819d68d33da516306c15297acec88efeb0ae9e2b39f71dbd9685ef7","affectsGlobalScope":true},{"version":"4632665b87204bb1caa8b44d165bce0c50dfab177df5b561b345a567cabacf9a","affectsGlobalScope":true},"575681593b7e88e6eb00d5f678393eaa9733e101d02c30a068d3a24a32897460","8eed414bd2305e20163d35205b450204002bf20e14c7241d7fec46bb18f174d2","675e702f2032766a91eeadee64f51014c64688525da99dccd8178f0c599f13a8","438284c7c455a29b9c0e2d1e72abc62ee93d9a163029ffe918a34c5db3b92da2","0c75b204aed9cf6ff1c7b4bed87a3ece0d9d6fc857a6350c0c95ed0c38c814e8","187119ff4f9553676a884e296089e131e8cc01691c546273b1d0089c3533ce42","c24ad9be9adf28f0927e3d9d9e9cec1c677022356f241ccbbfb97bfe8fb3d1a1","0ec0998e2d085e8ea54266f547976ae152c9dd6cdb9ac4d8a520a230f5ebae84","9364c7566b0be2f7b70ff5285eb34686f83ccb01bda529b82d23b2a844653bfb","00baffbe8a2f2e4875367479489b5d43b5fc1429ecb4a4cc98cfc3009095f52a","82251920b05f30981c9a4109cb5f3169dce4b477effc845c6d781044a30e7672","3c92b6dfd43cc1c2485d9eba5ff0b74a19bb8725b692773ef1d66dac48cda4bd","3e59f00ab03c33717b3130066d4debb272da90eeded4935ff0604c2bc25a5cae","9fa6b83a35e897f340858995ca5d77e901d89fd18644cd4c9e8a4afe0b2e6363",{"version":"0714e2046df66c0e93c3330d30dbc0565b3e8cd3ee302cf99e4ede6220e5fec8","affectsGlobalScope":true},{"version":"8f19251323456195ec9236df857bac3b8f97b73b540ef06ead2ceccc3884954f","affectsGlobalScope":true},"eb299028527009e3de3f323eb1c1f4fcbe8ad0f4ac51caa08844b654d2e8ea98","a0ece1260105335b3dd81d6e16472ecd6e862b30141e287d5eff75ff889e4600","84afb9594b09b54f793629627078ce4ba723cb95055aa5148f1d0cf5be7f4344","5ac6404ddc5d622905e131dbc5da0362a82e89d1cb97cc8256bf06ca9fad4b24","9fcfbc2dd0c0614b3a25d41e4425dd86cdfa574a9e7d2febffc85badcee1a0b8","586497840516a1f07c90869da5c3aa5431f8b6ad4dd1989b5587bcbae5ad276f","412e9398be155d644b609b06bb2d0b6f99d86bf3d7db81b27a357ad8df07e0c0"],"options":{"allowSyntheticDefaultImports":true,"composite":true,"declaration":true,"declarationDir":"./build-types","declarationMap":true,"emitDeclarationOnly":true,"esModuleInterop":false,"importsNotUsedAsValues":2,"jsx":1,"module":99,"noFallthroughCasesInSwitch":true,"noImplicitReturns":true,"noUnusedLocals":true,"noUnusedParameters":false,"rootDir":"./src","strict":true,"target":99},"fileIdsList":[[47,49,50,51,52,53,54,55,56,57,58,59],[47,48,50,51,52,53,54,55,56,57,58,59],[48,49,50,51,52,53,54,55,56,57,58,59],[47,48,49,51,52,53,54,55,56,57,58,59],[47,48,49,50,52,53,54,55,56,57,58,59],[47,48,49,50,51,53,54,55,56,57,58,59],[47,48,49,50,51,52,54,55,56,57,58,59],[47,48,49,50,51,52,53,55,56,57,58,59],[47,48,49,50,51,52,53,54,56,57,58,59],[47,48,49,50,51,52,53,54,55,57,58,59],[47,48,49,50,51,52,53,54,55,56,58,59],[47,48,49,50,51,52,53,54,55,56,57,59],[47,48,49,50,51,52,53,54,55,56,57,58],[60,64],[45,46,59,60,61],[59,62],[60],[66]],"referencedMap":[[48,1],[49,2],[47,3],[50,4],[51,5],[52,6],[53,7],[54,8],[55,9],[56,10],[57,11],[58,12],[59,13],[65,14],[62,15],[63,16],[61,17],[67,18]],"exportedModulesMap":[[48,1],[49,2],[47,3],[50,4],[51,5],[52,6],[53,7],[54,8],[55,9],[56,10],[57,11],[58,12],[59,13],[65,14],[62,15],[63,16],[61,17],[67,18]],"semanticDiagnosticsPerFile":[48,49,47,50,51,52,53,54,55,56,57,58,59,64,60,10,12,11,2,13,14,15,16,17,18,19,20,3,4,24,21,22,23,25,26,27,5,28,29,30,31,6,32,33,34,35,7,40,36,37,38,39,8,41,42,43,1,9,44,65,45,46,62,63,61,66,67]},"version":"4.4.2"}
1
+ {"program":{"fileNames":["../../node_modules/typescript/lib/lib.es5.d.ts","../../node_modules/typescript/lib/lib.es2015.d.ts","../../node_modules/typescript/lib/lib.es2016.d.ts","../../node_modules/typescript/lib/lib.es2017.d.ts","../../node_modules/typescript/lib/lib.es2018.d.ts","../../node_modules/typescript/lib/lib.es2019.d.ts","../../node_modules/typescript/lib/lib.es2020.d.ts","../../node_modules/typescript/lib/lib.es2021.d.ts","../../node_modules/typescript/lib/lib.esnext.d.ts","../../node_modules/typescript/lib/lib.dom.d.ts","../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../node_modules/typescript/lib/lib.es2021.promise.d.ts","../../node_modules/typescript/lib/lib.es2021.string.d.ts","../../node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../node_modules/typescript/lib/lib.esnext.intl.d.ts","./src/redux-store/metadata/actions.js","./src/redux-store/metadata/equivalent-key-map.d.ts","../../node_modules/@types/lodash/common/common.d.ts","../../node_modules/@types/lodash/common/array.d.ts","../../node_modules/@types/lodash/common/collection.d.ts","../../node_modules/@types/lodash/common/date.d.ts","../../node_modules/@types/lodash/common/function.d.ts","../../node_modules/@types/lodash/common/lang.d.ts","../../node_modules/@types/lodash/common/math.d.ts","../../node_modules/@types/lodash/common/number.d.ts","../../node_modules/@types/lodash/common/object.d.ts","../../node_modules/@types/lodash/common/seq.d.ts","../../node_modules/@types/lodash/common/string.d.ts","../../node_modules/@types/lodash/common/util.d.ts","../../node_modules/@types/lodash/index.d.ts","../../node_modules/redux/index.d.ts","./src/redux-store/metadata/utils.ts","./src/redux-store/metadata/reducer.ts","./src/redux-store/metadata/selectors.js","../../node_modules/is-promise/index.d.ts","./src/promise-middleware.js","./src/types.ts","./src/utils/emitter.js"],"fileInfos":[{"version":"aa9fb4c70f369237c2f45f9d969c9a59e0eae9a192962eb48581fe864aa609db","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","e6b724280c694a9f588847f754198fb96c43d805f065c3a5b28bbc9594541c84","e21c071ca3e1b4a815d5f04a7475adcaeea5d64367e840dd0154096d705c3940","eb75e89d63b3b72dd9ca8b0cac801cecae5be352307c004adeaa60bc9d6df51f","2cc028cd0bdb35b1b5eb723d84666a255933fffbea607f72cbd0c7c7b4bee144",{"version":"e54c8715a4954cfdc66cd69489f2b725c09ebf37492dbd91cff0a1688b1159e8","affectsGlobalScope":true},{"version":"51b8b27c21c066bf877646e320bf6a722b80d1ade65e686923cd9d4494aef1ca","affectsGlobalScope":true},{"version":"43fb1d932e4966a39a41b464a12a81899d9ae5f2c829063f5571b6b87e6d2f9c","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"2c8c5ee58f30e7c944e04ab1fb5506fdbb4dd507c9efa6972cf4b91cec90c503","affectsGlobalScope":true},{"version":"2bb4b3927299434052b37851a47bf5c39764f2ba88a888a107b32262e9292b7c","affectsGlobalScope":true},{"version":"810627a82ac06fb5166da5ada4159c4ec11978dfbb0805fe804c86406dab8357","affectsGlobalScope":true},{"version":"62d80405c46c3f4c527ee657ae9d43fda65a0bf582292429aea1e69144a522a6","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"75ec0bdd727d887f1b79ed6619412ea72ba3c81d92d0787ccb64bab18d261f14","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"12a310447c5d23c7d0d5ca2af606e3bd08afda69100166730ab92c62999ebb9d","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"df9c8a72ca8b0ed62f5470b41208a0587f0f73f0a7db28e5a1272cf92537518e","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"93544ca2f26a48716c1b6c5091842cad63129daac422dfa4bc52460465f22bb1","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"1b3fe904465430e030c93239a348f05e1be80640d91f2f004c3512c2c2c89f34","affectsGlobalScope":true},{"version":"7435b75fdf3509622e79622dbe5091cf4b09688410ee2034e4fc17d0c99d0862","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"9f1817f7c3f02f6d56e0f403b927e90bb133f371dcebc36fa7d6d208ef6899da","affectsGlobalScope":true},{"version":"cd6efb9467a8b6338ece2e2855e37765700f2cd061ca54b01b33878cf5c7677e","affectsGlobalScope":true},{"version":"fb4416144c1bf0323ccbc9afb0ab289c07312214e8820ad17d709498c865a3fe","affectsGlobalScope":true},{"version":"5b0ca94ec819d68d33da516306c15297acec88efeb0ae9e2b39f71dbd9685ef7","affectsGlobalScope":true},{"version":"4632665b87204bb1caa8b44d165bce0c50dfab177df5b561b345a567cabacf9a","affectsGlobalScope":true},"10675960d8de6a76a3f8818b6e74c40f54ddacba50aaebf9132022f27736697d","8eed414bd2305e20163d35205b450204002bf20e14c7241d7fec46bb18f174d2","675e702f2032766a91eeadee64f51014c64688525da99dccd8178f0c599f13a8","438284c7c455a29b9c0e2d1e72abc62ee93d9a163029ffe918a34c5db3b92da2","0c75b204aed9cf6ff1c7b4bed87a3ece0d9d6fc857a6350c0c95ed0c38c814e8","187119ff4f9553676a884e296089e131e8cc01691c546273b1d0089c3533ce42","c24ad9be9adf28f0927e3d9d9e9cec1c677022356f241ccbbfb97bfe8fb3d1a1","0ec0998e2d085e8ea54266f547976ae152c9dd6cdb9ac4d8a520a230f5ebae84","9364c7566b0be2f7b70ff5285eb34686f83ccb01bda529b82d23b2a844653bfb","00baffbe8a2f2e4875367479489b5d43b5fc1429ecb4a4cc98cfc3009095f52a","82251920b05f30981c9a4109cb5f3169dce4b477effc845c6d781044a30e7672","3c92b6dfd43cc1c2485d9eba5ff0b74a19bb8725b692773ef1d66dac48cda4bd","3e59f00ab03c33717b3130066d4debb272da90eeded4935ff0604c2bc25a5cae","9fa6b83a35e897f340858995ca5d77e901d89fd18644cd4c9e8a4afe0b2e6363",{"version":"0714e2046df66c0e93c3330d30dbc0565b3e8cd3ee302cf99e4ede6220e5fec8","affectsGlobalScope":true},{"version":"8f19251323456195ec9236df857bac3b8f97b73b540ef06ead2ceccc3884954f","affectsGlobalScope":true},"7c0e0a014730cc0c78fcf150c12bf07b47493a4b66c0809bdd8ba793a9752b74","a0e01384d0a4f97eec851bb1be99a73de8fb257df243ec189caee267ddc06cf6","a9ddbbd1b8648f020ffa7c11994ff015eac5416d4ecd78c396377f77eab8d284","5ac6404ddc5d622905e131dbc5da0362a82e89d1cb97cc8256bf06ca9fad4b24","9fcfbc2dd0c0614b3a25d41e4425dd86cdfa574a9e7d2febffc85badcee1a0b8","586497840516a1f07c90869da5c3aa5431f8b6ad4dd1989b5587bcbae5ad276f","412e9398be155d644b609b06bb2d0b6f99d86bf3d7db81b27a357ad8df07e0c0"],"options":{"allowSyntheticDefaultImports":true,"composite":true,"declaration":true,"declarationDir":"./build-types","declarationMap":true,"emitDeclarationOnly":true,"esModuleInterop":false,"importsNotUsedAsValues":2,"jsx":1,"module":99,"noFallthroughCasesInSwitch":true,"noImplicitReturns":true,"noUnusedLocals":true,"noUnusedParameters":false,"rootDir":"./src","strict":true,"target":99},"fileIdsList":[[47,49,50,51,52,53,54,55,56,57,58,59],[47,48,50,51,52,53,54,55,56,57,58,59],[48,49,50,51,52,53,54,55,56,57,58,59],[47,48,49,51,52,53,54,55,56,57,58,59],[47,48,49,50,52,53,54,55,56,57,58,59],[47,48,49,50,51,53,54,55,56,57,58,59],[47,48,49,50,51,52,54,55,56,57,58,59],[47,48,49,50,51,52,53,55,56,57,58,59],[47,48,49,50,51,52,53,54,56,57,58,59],[47,48,49,50,51,52,53,54,55,57,58,59],[47,48,49,50,51,52,53,54,55,56,58,59],[47,48,49,50,51,52,53,54,55,56,57,59],[47,48,49,50,51,52,53,54,55,56,57,58],[60,64],[45,46,59,60,61],[59,61,62],[60],[66]],"referencedMap":[[48,1],[49,2],[47,3],[50,4],[51,5],[52,6],[53,7],[54,8],[55,9],[56,10],[57,11],[58,12],[59,13],[65,14],[62,15],[63,16],[61,17],[67,18]],"exportedModulesMap":[[48,1],[49,2],[47,3],[50,4],[51,5],[52,6],[53,7],[54,8],[55,9],[56,10],[57,11],[58,12],[59,13],[65,14],[62,15],[63,16],[61,17],[67,18]],"semanticDiagnosticsPerFile":[48,49,47,50,51,52,53,54,55,56,57,58,59,64,60,10,12,11,2,13,14,15,16,17,18,19,20,3,4,24,21,22,23,25,26,27,5,28,29,30,31,6,32,33,34,35,7,40,36,37,38,39,8,41,42,43,1,9,44,65,45,46,62,63,61,66,67]},"version":"4.4.2"}
@@ -1,37 +0,0 @@
1
- /**
2
- * Higher-order reducer creator which creates a combined reducer object, keyed
3
- * by a property on the action object.
4
- *
5
- * @template {any} TState
6
- * @template {import('redux').AnyAction} TAction
7
- *
8
- * @param {string} actionProperty Action property by which to key object.
9
- *
10
- * @return {(reducer: import('redux').Reducer<TState, TAction>) => import('redux').Reducer<Record<string, TState>, TAction>} Higher-order reducer.
11
- */
12
- export const onSubKey = ( actionProperty ) => ( reducer ) => (
13
- /* eslint-disable jsdoc/no-undefined-types */
14
- state = /** @type {Record<string, TState>} */ ( {} ),
15
- action
16
- ) => {
17
- // Retrieve subkey from action. Do not track if undefined; useful for cases
18
- // where reducer is scoped by action shape.
19
- /** @type {keyof state} */
20
- /* eslint-enable jsdoc/no-undefined-types */
21
- const key = action[ actionProperty ];
22
- if ( key === undefined ) {
23
- return state;
24
- }
25
-
26
- // Avoid updating state if unchanged. Note that this also accounts for a
27
- // reducer which returns undefined on a key which is not yet tracked.
28
- const nextKeyState = reducer( state[ key ], action );
29
- if ( nextKeyState === state[ key ] ) {
30
- return state;
31
- }
32
-
33
- return {
34
- ...state,
35
- [ key ]: nextKeyState,
36
- };
37
- };