@wordpress/core-data 7.3.0 → 7.5.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 (153) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +54 -6
  3. package/build/actions.js +1 -1
  4. package/build/actions.js.map +1 -1
  5. package/build/entity-context.js +13 -0
  6. package/build/entity-context.js.map +1 -0
  7. package/build/entity-provider.js +4 -189
  8. package/build/entity-provider.js.map +1 -1
  9. package/build/footnotes/get-rich-text-values-cached.js +2 -2
  10. package/build/footnotes/get-rich-text-values-cached.js.map +1 -1
  11. package/build/hooks/index.js +22 -0
  12. package/build/hooks/index.js.map +1 -1
  13. package/build/hooks/use-entity-block-editor.js +140 -0
  14. package/build/hooks/use-entity-block-editor.js.map +1 -0
  15. package/build/hooks/use-entity-id.js +28 -0
  16. package/build/hooks/use-entity-id.js.map +1 -0
  17. package/build/hooks/use-entity-prop.js +65 -0
  18. package/build/hooks/use-entity-prop.js.map +1 -0
  19. package/build/hooks/use-entity-records.js +39 -0
  20. package/build/hooks/use-entity-records.js.map +1 -1
  21. package/build/hooks/use-resource-permissions.js +25 -8
  22. package/build/hooks/use-resource-permissions.js.map +1 -1
  23. package/build/index.js +14 -2
  24. package/build/index.js.map +1 -1
  25. package/build/lock-unlock.js +18 -0
  26. package/build/lock-unlock.js.map +1 -0
  27. package/build/private-apis.js +8 -9
  28. package/build/private-apis.js.map +1 -1
  29. package/build/private-selectors.js +35 -0
  30. package/build/private-selectors.js.map +1 -1
  31. package/build/resolvers.js +64 -60
  32. package/build/resolvers.js.map +1 -1
  33. package/build/selectors.js +16 -8
  34. package/build/selectors.js.map +1 -1
  35. package/build/utils/index.js +19 -0
  36. package/build/utils/index.js.map +1 -1
  37. package/build/utils/user-permissions.js +32 -0
  38. package/build/utils/user-permissions.js.map +1 -0
  39. package/build-module/actions.js +1 -1
  40. package/build-module/actions.js.map +1 -1
  41. package/build-module/entity-context.js +6 -0
  42. package/build-module/entity-context.js.map +1 -0
  43. package/build-module/entity-provider.js +3 -183
  44. package/build-module/entity-provider.js.map +1 -1
  45. package/build-module/footnotes/get-rich-text-values-cached.js +1 -1
  46. package/build-module/footnotes/get-rich-text-values-cached.js.map +1 -1
  47. package/build-module/hooks/index.js +3 -0
  48. package/build-module/hooks/index.js.map +1 -1
  49. package/build-module/hooks/use-entity-block-editor.js +132 -0
  50. package/build-module/hooks/use-entity-block-editor.js.map +1 -0
  51. package/build-module/hooks/use-entity-id.js +22 -0
  52. package/build-module/hooks/use-entity-id.js.map +1 -0
  53. package/build-module/hooks/use-entity-prop.js +58 -0
  54. package/build-module/hooks/use-entity-prop.js.map +1 -0
  55. package/build-module/hooks/use-entity-records.js +38 -0
  56. package/build-module/hooks/use-entity-records.js.map +1 -1
  57. package/build-module/hooks/use-resource-permissions.js +25 -8
  58. package/build-module/hooks/use-resource-permissions.js.map +1 -1
  59. package/build-module/index.js +2 -1
  60. package/build-module/index.js.map +1 -1
  61. package/build-module/lock-unlock.js +9 -0
  62. package/build-module/lock-unlock.js.map +1 -0
  63. package/build-module/private-apis.js +7 -6
  64. package/build-module/private-apis.js.map +1 -1
  65. package/build-module/private-selectors.js +33 -0
  66. package/build-module/private-selectors.js.map +1 -1
  67. package/build-module/resolvers.js +65 -61
  68. package/build-module/resolvers.js.map +1 -1
  69. package/build-module/selectors.js +17 -9
  70. package/build-module/selectors.js.map +1 -1
  71. package/build-module/utils/index.js +1 -0
  72. package/build-module/utils/index.js.map +1 -1
  73. package/build-module/utils/user-permissions.js +24 -0
  74. package/build-module/utils/user-permissions.js.map +1 -0
  75. package/build-types/actions.d.ts +3 -3
  76. package/build-types/actions.d.ts.map +1 -1
  77. package/build-types/batch/create-batch.d.ts.map +1 -1
  78. package/build-types/entities.d.ts.map +1 -1
  79. package/build-types/entity-context.d.ts +2 -0
  80. package/build-types/entity-context.d.ts.map +1 -0
  81. package/build-types/entity-provider.d.ts +0 -47
  82. package/build-types/entity-provider.d.ts.map +1 -1
  83. package/build-types/fetch/__experimental-fetch-url-data.d.ts.map +1 -1
  84. package/build-types/hooks/index.d.ts +3 -0
  85. package/build-types/hooks/index.d.ts.map +1 -1
  86. package/build-types/hooks/use-entity-block-editor.d.ts +22 -0
  87. package/build-types/hooks/use-entity-block-editor.d.ts.map +1 -0
  88. package/build-types/hooks/use-entity-id.d.ts +9 -0
  89. package/build-types/hooks/use-entity-id.d.ts.map +1 -0
  90. package/build-types/hooks/use-entity-prop.d.ts +19 -0
  91. package/build-types/hooks/use-entity-prop.d.ts.map +1 -0
  92. package/build-types/hooks/use-entity-records.d.ts +1 -0
  93. package/build-types/hooks/use-entity-records.d.ts.map +1 -1
  94. package/build-types/hooks/use-resource-permissions.d.ts +8 -70
  95. package/build-types/hooks/use-resource-permissions.d.ts.map +1 -1
  96. package/build-types/index.d.ts +36 -32
  97. package/build-types/index.d.ts.map +1 -1
  98. package/build-types/lock-unlock.d.ts +3 -0
  99. package/build-types/lock-unlock.d.ts.map +1 -0
  100. package/build-types/locks/reducer.d.ts +1 -1
  101. package/build-types/locks/reducer.d.ts.map +1 -1
  102. package/build-types/private-apis.d.ts +1 -2
  103. package/build-types/private-apis.d.ts.map +1 -1
  104. package/build-types/private-selectors.d.ts +15 -0
  105. package/build-types/private-selectors.d.ts.map +1 -1
  106. package/build-types/queried-data/actions.d.ts +1 -1
  107. package/build-types/queried-data/actions.d.ts.map +1 -1
  108. package/build-types/queried-data/get-query-parts.d.ts.map +1 -1
  109. package/build-types/queried-data/reducer.d.ts +1 -1
  110. package/build-types/queried-data/reducer.d.ts.map +1 -1
  111. package/build-types/queried-data/selectors.d.ts +0 -1
  112. package/build-types/queried-data/selectors.d.ts.map +1 -1
  113. package/build-types/reducer.d.ts +13 -13
  114. package/build-types/reducer.d.ts.map +1 -1
  115. package/build-types/resolvers.d.ts +3 -2
  116. package/build-types/resolvers.d.ts.map +1 -1
  117. package/build-types/selectors.d.ts +11 -6
  118. package/build-types/selectors.d.ts.map +1 -1
  119. package/build-types/utils/get-nested-value.d.ts.map +1 -1
  120. package/build-types/utils/get-normalized-comma-separable.d.ts.map +1 -1
  121. package/build-types/utils/if-matching-action.d.ts +1 -1
  122. package/build-types/utils/index.d.ts +1 -0
  123. package/build-types/utils/on-sub-key.d.ts +1 -1
  124. package/build-types/utils/replace-action.d.ts +1 -1
  125. package/build-types/utils/set-nested-value.d.ts.map +1 -1
  126. package/build-types/utils/user-permissions.d.ts +4 -0
  127. package/build-types/utils/user-permissions.d.ts.map +1 -0
  128. package/package.json +18 -17
  129. package/src/actions.js +1 -1
  130. package/src/entity-context.js +6 -0
  131. package/src/entity-provider.js +2 -209
  132. package/src/footnotes/get-rich-text-values-cached.js +1 -1
  133. package/src/hooks/index.ts +3 -0
  134. package/src/hooks/test/use-entity-record.js +5 -3
  135. package/src/hooks/test/use-resource-permissions.js +96 -5
  136. package/src/hooks/use-entity-block-editor.js +148 -0
  137. package/src/hooks/use-entity-id.js +21 -0
  138. package/src/hooks/use-entity-prop.js +60 -0
  139. package/src/hooks/use-entity-records.ts +50 -0
  140. package/src/hooks/use-resource-permissions.ts +46 -9
  141. package/src/index.js +2 -1
  142. package/src/lock-unlock.js +10 -0
  143. package/src/private-apis.js +7 -7
  144. package/src/private-selectors.ts +43 -0
  145. package/src/resolvers.js +85 -67
  146. package/src/selectors.ts +18 -9
  147. package/src/test/entity-provider.js +6 -2
  148. package/src/test/resolvers.js +217 -50
  149. package/src/test/selectors.js +18 -55
  150. package/src/utils/index.js +5 -0
  151. package/src/utils/user-permissions.js +39 -0
  152. package/tsconfig.json +2 -1
  153. package/tsconfig.tsbuildinfo +1 -1
package/build/index.js CHANGED
@@ -24,7 +24,7 @@ var resolvers = _interopRequireWildcard(require("./resolvers"));
24
24
  var _actions2 = _interopRequireDefault(require("./locks/actions"));
25
25
  var _entities = require("./entities");
26
26
  var _name = require("./name");
27
- var _privateApis = require("./private-apis");
27
+ var _lockUnlock = require("./lock-unlock");
28
28
  var _entityProvider = _interopRequireWildcard(require("./entity-provider"));
29
29
  Object.keys(_entityProvider).forEach(function (key) {
30
30
  if (key === "default" || key === "__esModule") return;
@@ -73,6 +73,18 @@ Object.keys(_hooks).forEach(function (key) {
73
73
  }
74
74
  });
75
75
  });
76
+ var _privateApis = require("./private-apis");
77
+ Object.keys(_privateApis).forEach(function (key) {
78
+ if (key === "default" || key === "__esModule") return;
79
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
80
+ if (key in exports && exports[key] === _privateApis[key]) return;
81
+ Object.defineProperty(exports, key, {
82
+ enumerable: true,
83
+ get: function () {
84
+ return _privateApis[key];
85
+ }
86
+ });
87
+ });
76
88
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
77
89
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
78
90
  /**
@@ -146,6 +158,6 @@ const storeConfig = () => ({
146
158
  * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
147
159
  */
148
160
  const store = exports.store = (0, _data.createReduxStore)(_name.STORE_NAME, storeConfig());
149
- (0, _privateApis.unlock)(store).registerPrivateSelectors(privateSelectors);
161
+ (0, _lockUnlock.unlock)(store).registerPrivateSelectors(privateSelectors);
150
162
  (0, _data.register)(store); // Register store after unlocking private selectors to allow resolvers to use them.
151
163
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_reducer","_interopRequireDefault","selectors","_interopRequireWildcard","privateSelectors","actions","resolvers","_actions2","_entities","_name","_privateApis","_entityProvider","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_entityTypes","_fetch","_hooks","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","n","__proto__","a","getOwnPropertyDescriptor","u","i","set","entitiesConfig","rootEntitiesConfig","additionalEntityConfigLoaders","filter","config","name","entitySelectors","reduce","result","entity","kind","plural","getMethodName","state","query","getEntityRecord","getEntityRecords","entityResolvers","pluralMethodName","args","shouldInvalidate","action","entityActions","record","options","saveEntityRecord","deleteEntityRecord","storeConfig","reducer","createLocksActions","store","createReduxStore","STORE_NAME","unlock","registerPrivateSelectors","register"],"sources":["@wordpress/core-data/src/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createReduxStore, register } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport reducer from './reducer';\nimport * as selectors from './selectors';\nimport * as privateSelectors from './private-selectors';\nimport * as actions from './actions';\nimport * as resolvers from './resolvers';\nimport createLocksActions from './locks/actions';\nimport {\n\trootEntitiesConfig,\n\tadditionalEntityConfigLoaders,\n\tgetMethodName,\n} from './entities';\nimport { STORE_NAME } from './name';\nimport { unlock } from './private-apis';\n\n// The entity selectors/resolvers and actions are shortcuts to their generic equivalents\n// (getEntityRecord, getEntityRecords, updateEntityRecord, updateEntityRecords)\n// Instead of getEntityRecord, the consumer could use more user-friendly named selector: getPostType, getTaxonomy...\n// The \"kind\" and the \"name\" of the entity are combined to generate these shortcuts.\nconst entitiesConfig = [\n\t...rootEntitiesConfig,\n\t...additionalEntityConfigLoaders.filter( ( config ) => !! config.name ),\n];\n\nconst entitySelectors = entitiesConfig.reduce( ( result, entity ) => {\n\tconst { kind, name, plural } = entity;\n\tresult[ getMethodName( kind, name ) ] = ( state, key, query ) =>\n\t\tselectors.getEntityRecord( state, kind, name, key, query );\n\n\tif ( plural ) {\n\t\tresult[ getMethodName( kind, plural, 'get' ) ] = ( state, query ) =>\n\t\t\tselectors.getEntityRecords( state, kind, name, query );\n\t}\n\treturn result;\n}, {} );\n\nconst entityResolvers = entitiesConfig.reduce( ( result, entity ) => {\n\tconst { kind, name, plural } = entity;\n\tresult[ getMethodName( kind, name ) ] = ( key, query ) =>\n\t\tresolvers.getEntityRecord( kind, name, key, query );\n\n\tif ( plural ) {\n\t\tconst pluralMethodName = getMethodName( kind, plural, 'get' );\n\t\tresult[ pluralMethodName ] = ( ...args ) =>\n\t\t\tresolvers.getEntityRecords( kind, name, ...args );\n\t\tresult[ pluralMethodName ].shouldInvalidate = ( action ) =>\n\t\t\tresolvers.getEntityRecords.shouldInvalidate( action, kind, name );\n\t}\n\treturn result;\n}, {} );\n\nconst entityActions = entitiesConfig.reduce( ( result, entity ) => {\n\tconst { kind, name } = entity;\n\tresult[ getMethodName( kind, name, 'save' ) ] = ( record, options ) =>\n\t\tactions.saveEntityRecord( kind, name, record, options );\n\tresult[ getMethodName( kind, name, 'delete' ) ] = ( key, query, options ) =>\n\t\tactions.deleteEntityRecord( kind, name, key, query, options );\n\treturn result;\n}, {} );\n\nconst storeConfig = () => ( {\n\treducer,\n\tactions: { ...actions, ...entityActions, ...createLocksActions() },\n\tselectors: { ...selectors, ...entitySelectors },\n\tresolvers: { ...resolvers, ...entityResolvers },\n} );\n\n/**\n * Store definition for the code data namespace.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore\n */\nexport const store = createReduxStore( STORE_NAME, storeConfig() );\nunlock( store ).registerPrivateSelectors( privateSelectors );\nregister( store ); // Register store after unlocking private selectors to allow resolvers to use them.\n\nexport { default as EntityProvider } from './entity-provider';\nexport * from './entity-provider';\nexport * from './entity-types';\nexport * from './fetch';\nexport * from './hooks';\n"],"mappings":";;;;;;;;;;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,SAAA,GAAA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","_reducer","_interopRequireDefault","selectors","_interopRequireWildcard","privateSelectors","actions","resolvers","_actions2","_entities","_name","_lockUnlock","_entityProvider","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_entityTypes","_fetch","_hooks","_privateApis","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","n","__proto__","a","getOwnPropertyDescriptor","u","i","set","entitiesConfig","rootEntitiesConfig","additionalEntityConfigLoaders","filter","config","name","entitySelectors","reduce","result","entity","kind","plural","getMethodName","state","query","getEntityRecord","getEntityRecords","entityResolvers","pluralMethodName","args","shouldInvalidate","action","entityActions","record","options","saveEntityRecord","deleteEntityRecord","storeConfig","reducer","createLocksActions","store","createReduxStore","STORE_NAME","unlock","registerPrivateSelectors","register"],"sources":["@wordpress/core-data/src/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createReduxStore, register } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport reducer from './reducer';\nimport * as selectors from './selectors';\nimport * as privateSelectors from './private-selectors';\nimport * as actions from './actions';\nimport * as resolvers from './resolvers';\nimport createLocksActions from './locks/actions';\nimport {\n\trootEntitiesConfig,\n\tadditionalEntityConfigLoaders,\n\tgetMethodName,\n} from './entities';\nimport { STORE_NAME } from './name';\nimport { unlock } from './lock-unlock';\n\n// The entity selectors/resolvers and actions are shortcuts to their generic equivalents\n// (getEntityRecord, getEntityRecords, updateEntityRecord, updateEntityRecords)\n// Instead of getEntityRecord, the consumer could use more user-friendly named selector: getPostType, getTaxonomy...\n// The \"kind\" and the \"name\" of the entity are combined to generate these shortcuts.\nconst entitiesConfig = [\n\t...rootEntitiesConfig,\n\t...additionalEntityConfigLoaders.filter( ( config ) => !! config.name ),\n];\n\nconst entitySelectors = entitiesConfig.reduce( ( result, entity ) => {\n\tconst { kind, name, plural } = entity;\n\tresult[ getMethodName( kind, name ) ] = ( state, key, query ) =>\n\t\tselectors.getEntityRecord( state, kind, name, key, query );\n\n\tif ( plural ) {\n\t\tresult[ getMethodName( kind, plural, 'get' ) ] = ( state, query ) =>\n\t\t\tselectors.getEntityRecords( state, kind, name, query );\n\t}\n\treturn result;\n}, {} );\n\nconst entityResolvers = entitiesConfig.reduce( ( result, entity ) => {\n\tconst { kind, name, plural } = entity;\n\tresult[ getMethodName( kind, name ) ] = ( key, query ) =>\n\t\tresolvers.getEntityRecord( kind, name, key, query );\n\n\tif ( plural ) {\n\t\tconst pluralMethodName = getMethodName( kind, plural, 'get' );\n\t\tresult[ pluralMethodName ] = ( ...args ) =>\n\t\t\tresolvers.getEntityRecords( kind, name, ...args );\n\t\tresult[ pluralMethodName ].shouldInvalidate = ( action ) =>\n\t\t\tresolvers.getEntityRecords.shouldInvalidate( action, kind, name );\n\t}\n\treturn result;\n}, {} );\n\nconst entityActions = entitiesConfig.reduce( ( result, entity ) => {\n\tconst { kind, name } = entity;\n\tresult[ getMethodName( kind, name, 'save' ) ] = ( record, options ) =>\n\t\tactions.saveEntityRecord( kind, name, record, options );\n\tresult[ getMethodName( kind, name, 'delete' ) ] = ( key, query, options ) =>\n\t\tactions.deleteEntityRecord( kind, name, key, query, options );\n\treturn result;\n}, {} );\n\nconst storeConfig = () => ( {\n\treducer,\n\tactions: { ...actions, ...entityActions, ...createLocksActions() },\n\tselectors: { ...selectors, ...entitySelectors },\n\tresolvers: { ...resolvers, ...entityResolvers },\n} );\n\n/**\n * Store definition for the code data namespace.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore\n */\nexport const store = createReduxStore( STORE_NAME, storeConfig() );\nunlock( store ).registerPrivateSelectors( privateSelectors );\nregister( store ); // Register store after unlocking private selectors to allow resolvers to use them.\n\nexport { default as EntityProvider } from './entity-provider';\nexport * from './entity-provider';\nexport * from './entity-types';\nexport * from './fetch';\nexport * from './hooks';\nexport * from './private-apis';\n"],"mappings":";;;;;;;;;;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,G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a;IAAE,GAAG,IAAAO,iBAAkB,EAAC;EAAE,CAAC;EAClEtE,SAAS,EAAE;IAAE,GAAGA,SAAS;IAAE,GAAG+C;EAAgB,CAAC;EAC/C3C,SAAS,EAAE;IAAE,GAAGA,SAAS;IAAE,GAAGsD;EAAgB;AAC/C,CAAC,CAAE;;AAEH;AACA;AACA;AACA;AACA;AACO,MAAMa,KAAK,GAAArD,OAAA,CAAAqD,KAAA,GAAG,IAAAC,sBAAgB,EAAEC,gBAAU,EAAEL,WAAW,CAAC,CAAE,CAAC;AAClE,IAAAM,kBAAM,EAAEH,KAAM,CAAC,CAACI,wBAAwB,CAAEzE,gBAAiB,CAAC;AAC5D,IAAA0E,cAAQ,EAAEL,KAAM,CAAC,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.unlock = exports.lock = void 0;
7
+ var _privateApis = require("@wordpress/private-apis");
8
+ /**
9
+ * WordPress dependencies
10
+ */
11
+
12
+ const {
13
+ lock,
14
+ unlock
15
+ } = (0, _privateApis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.', '@wordpress/core-data');
16
+ exports.unlock = unlock;
17
+ exports.lock = lock;
18
+ //# sourceMappingURL=lock-unlock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_privateApis","require","lock","unlock","__dangerousOptInToUnstableAPIsOnlyForCoreModules","exports"],"sources":["@wordpress/core-data/src/lock-unlock.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\n\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',\n\t\t'@wordpress/core-data'\n\t);\n"],"mappings":";;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGO,MAAM;EAAEC,IAAI;EAAEC;AAAO,CAAC,GAC5B,IAAAC,6DAAgD,EAC/C,+HAA+H,EAC/H,sBACD,CAAC;AAACC,OAAA,CAAAF,MAAA,GAAAA,MAAA;AAAAE,OAAA,CAAAH,IAAA,GAAAA,IAAA","ignoreList":[]}
@@ -3,16 +3,15 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.unlock = exports.lock = void 0;
7
- var _privateApis = require("@wordpress/private-apis");
6
+ exports.privateApis = void 0;
7
+ var _useEntityRecords = require("./hooks/use-entity-records");
8
+ var _lockUnlock = require("./lock-unlock");
8
9
  /**
9
- * WordPress dependencies
10
+ * Internal dependencies
10
11
  */
11
12
 
12
- const {
13
- lock,
14
- unlock
15
- } = (0, _privateApis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.', '@wordpress/core-data');
16
- exports.unlock = unlock;
17
- exports.lock = lock;
13
+ const privateApis = exports.privateApis = {};
14
+ (0, _lockUnlock.lock)(privateApis, {
15
+ useEntityRecordsWithPermissions: _useEntityRecords.useEntityRecordsWithPermissions
16
+ });
18
17
  //# sourceMappingURL=private-apis.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_privateApis","require","lock","unlock","__dangerousOptInToUnstableAPIsOnlyForCoreModules","exports"],"sources":["@wordpress/core-data/src/private-apis.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\n\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',\n\t\t'@wordpress/core-data'\n\t);\n"],"mappings":";;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGO,MAAM;EAAEC,IAAI;EAAEC;AAAO,CAAC,GAC5B,IAAAC,6DAAgD,EAC/C,+HAA+H,EAC/H,sBACD,CAAC;AAACC,OAAA,CAAAF,MAAA,GAAAA,MAAA;AAAAE,OAAA,CAAAH,IAAA,GAAAA,IAAA","ignoreList":[]}
1
+ {"version":3,"names":["_useEntityRecords","require","_lockUnlock","privateApis","exports","lock","useEntityRecordsWithPermissions"],"sources":["@wordpress/core-data/src/private-apis.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { useEntityRecordsWithPermissions } from './hooks/use-entity-records';\nimport { lock } from './lock-unlock';\n\nexport const privateApis = {};\nlock( privateApis, {\n\tuseEntityRecordsWithPermissions,\n} );\n"],"mappings":";;;;;;AAGA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAIO,MAAME,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAG,CAAC,CAAC;AAC7B,IAAAE,gBAAI,EAAEF,WAAW,EAAE;EAClBG,+BAA+B,EAA/BA;AACD,CAAE,CAAC","ignoreList":[]}
@@ -4,6 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getBlockPatternsForPostType = void 0;
7
+ exports.getEntityRecordPermissions = getEntityRecordPermissions;
8
+ exports.getEntityRecordsPermissions = void 0;
7
9
  exports.getNavigationFallbackId = getNavigationFallbackId;
8
10
  exports.getUndoManager = getUndoManager;
9
11
  var _data = require("@wordpress/data");
@@ -40,4 +42,37 @@ function getNavigationFallbackId(state) {
40
42
  const getBlockPatternsForPostType = exports.getBlockPatternsForPostType = (0, _data.createRegistrySelector)(select => (0, _data.createSelector)((state, postType) => select(_name.STORE_NAME).getBlockPatterns().filter(({
41
43
  postTypes
42
44
  }) => !postTypes || Array.isArray(postTypes) && postTypes.includes(postType)), () => [select(_name.STORE_NAME).getBlockPatterns()]));
45
+
46
+ /**
47
+ * Returns the entity records permissions for the given entity record ids.
48
+ */
49
+ const getEntityRecordsPermissions = exports.getEntityRecordsPermissions = (0, _data.createRegistrySelector)(select => (0, _data.createSelector)((state, kind, name, ids) => {
50
+ const normalizedIds = Array.isArray(ids) ? ids : [ids];
51
+ return normalizedIds.map(id => ({
52
+ delete: select(_name.STORE_NAME).canUser('delete', {
53
+ kind,
54
+ name,
55
+ id
56
+ }),
57
+ update: select(_name.STORE_NAME).canUser('update', {
58
+ kind,
59
+ name,
60
+ id
61
+ })
62
+ }));
63
+ }, state => [state.userPermissions]));
64
+
65
+ /**
66
+ * Returns the entity record permissions for the given entity record id.
67
+ *
68
+ * @param state Data state.
69
+ * @param kind Entity kind.
70
+ * @param name Entity name.
71
+ * @param id Entity record id.
72
+ *
73
+ * @return The entity record permissions.
74
+ */
75
+ function getEntityRecordPermissions(state, kind, name, id) {
76
+ return getEntityRecordsPermissions(state, kind, name, id)[0];
77
+ }
43
78
  //# sourceMappingURL=private-selectors.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_name","getUndoManager","state","undoManager","getNavigationFallbackId","navigationFallbackId","getBlockPatternsForPostType","exports","createRegistrySelector","select","createSelector","postType","STORE_NAME","getBlockPatterns","filter","postTypes","Array","isArray","includes"],"sources":["@wordpress/core-data/src/private-selectors.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSelector, createRegistrySelector } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport type { State } from './selectors';\nimport { STORE_NAME } from './name';\n\ntype EntityRecordKey = string | number;\n\n/**\n * Returns the previous edit from the current undo offset\n * for the entity records edits history, if any.\n *\n * @param state State tree.\n *\n * @return The undo manager.\n */\nexport function getUndoManager( state: State ) {\n\treturn state.undoManager;\n}\n\n/**\n * Retrieve the fallback Navigation.\n *\n * @param state Data state.\n * @return The ID for the fallback Navigation post.\n */\nexport function getNavigationFallbackId(\n\tstate: State\n): EntityRecordKey | undefined {\n\treturn state.navigationFallbackId;\n}\n\nexport const getBlockPatternsForPostType = createRegistrySelector(\n\t( select: any ) =>\n\t\tcreateSelector(\n\t\t\t( state, postType ) =>\n\t\t\t\tselect( STORE_NAME )\n\t\t\t\t\t.getBlockPatterns()\n\t\t\t\t\t.filter(\n\t\t\t\t\t\t( { postTypes } ) =>\n\t\t\t\t\t\t\t! postTypes ||\n\t\t\t\t\t\t\t( Array.isArray( postTypes ) &&\n\t\t\t\t\t\t\t\tpostTypes.includes( postType ) )\n\t\t\t\t\t),\n\t\t\t() => [ select( STORE_NAME ).getBlockPatterns() ]\n\t\t)\n);\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAMA,IAAAC,KAAA,GAAAD,OAAA;AATA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,cAAcA,CAAEC,KAAY,EAAG;EAC9C,OAAOA,KAAK,CAACC,WAAW;AACzB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,uBAAuBA,CACtCF,KAAY,EACkB;EAC9B,OAAOA,KAAK,CAACG,oBAAoB;AAClC;AAEO,MAAMC,2BAA2B,GAAAC,OAAA,CAAAD,2BAAA,GAAG,IAAAE,4BAAsB,EAC9DC,MAAW,IACZ,IAAAC,oBAAc,EACb,CAAER,KAAK,EAAES,QAAQ,KAChBF,MAAM,CAAEG,gBAAW,CAAC,CAClBC,gBAAgB,CAAC,CAAC,CAClBC,MAAM,CACN,CAAE;EAAEC;AAAU,CAAC,KACd,CAAEA,SAAS,IACTC,KAAK,CAACC,OAAO,CAAEF,SAAU,CAAC,IAC3BA,SAAS,CAACG,QAAQ,CAAEP,QAAS,CAChC,CAAC,EACH,MAAM,CAAEF,MAAM,CAAEG,gBAAW,CAAC,CAACC,gBAAgB,CAAC,CAAC,CAChD,CACF,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_data","require","_name","getUndoManager","state","undoManager","getNavigationFallbackId","navigationFallbackId","getBlockPatternsForPostType","exports","createRegistrySelector","select","createSelector","postType","STORE_NAME","getBlockPatterns","filter","postTypes","Array","isArray","includes","getEntityRecordsPermissions","kind","name","ids","normalizedIds","map","id","delete","canUser","update","userPermissions","getEntityRecordPermissions"],"sources":["@wordpress/core-data/src/private-selectors.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSelector, createRegistrySelector } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport type { State } from './selectors';\nimport { STORE_NAME } from './name';\n\ntype EntityRecordKey = string | number;\n\n/**\n * Returns the previous edit from the current undo offset\n * for the entity records edits history, if any.\n *\n * @param state State tree.\n *\n * @return The undo manager.\n */\nexport function getUndoManager( state: State ) {\n\treturn state.undoManager;\n}\n\n/**\n * Retrieve the fallback Navigation.\n *\n * @param state Data state.\n * @return The ID for the fallback Navigation post.\n */\nexport function getNavigationFallbackId(\n\tstate: State\n): EntityRecordKey | undefined {\n\treturn state.navigationFallbackId;\n}\n\nexport const getBlockPatternsForPostType = createRegistrySelector(\n\t( select: any ) =>\n\t\tcreateSelector(\n\t\t\t( state, postType ) =>\n\t\t\t\tselect( STORE_NAME )\n\t\t\t\t\t.getBlockPatterns()\n\t\t\t\t\t.filter(\n\t\t\t\t\t\t( { postTypes } ) =>\n\t\t\t\t\t\t\t! postTypes ||\n\t\t\t\t\t\t\t( Array.isArray( postTypes ) &&\n\t\t\t\t\t\t\t\tpostTypes.includes( postType ) )\n\t\t\t\t\t),\n\t\t\t() => [ select( STORE_NAME ).getBlockPatterns() ]\n\t\t)\n);\n\n/**\n * Returns the entity records permissions for the given entity record ids.\n */\nexport const getEntityRecordsPermissions = createRegistrySelector( ( select ) =>\n\tcreateSelector(\n\t\t( state: State, kind: string, name: string, ids: string[] ) => {\n\t\t\tconst normalizedIds = Array.isArray( ids ) ? ids : [ ids ];\n\t\t\treturn normalizedIds.map( ( id ) => ( {\n\t\t\t\tdelete: select( STORE_NAME ).canUser( 'delete', {\n\t\t\t\t\tkind,\n\t\t\t\t\tname,\n\t\t\t\t\tid,\n\t\t\t\t} ),\n\t\t\t\tupdate: select( STORE_NAME ).canUser( 'update', {\n\t\t\t\t\tkind,\n\t\t\t\t\tname,\n\t\t\t\t\tid,\n\t\t\t\t} ),\n\t\t\t} ) );\n\t\t},\n\t\t( state ) => [ state.userPermissions ]\n\t)\n);\n\n/**\n * Returns the entity record permissions for the given entity record id.\n *\n * @param state Data state.\n * @param kind Entity kind.\n * @param name Entity name.\n * @param id Entity record id.\n *\n * @return The entity record permissions.\n */\nexport function getEntityRecordPermissions(\n\tstate: State,\n\tkind: string,\n\tname: string,\n\tid: string\n) {\n\treturn getEntityRecordsPermissions( state, kind, name, id )[ 0 ];\n}\n"],"mappings":";;;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAMA,IAAAC,KAAA,GAAAD,OAAA;AATA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,cAAcA,CAAEC,KAAY,EAAG;EAC9C,OAAOA,KAAK,CAACC,WAAW;AACzB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,uBAAuBA,CACtCF,KAAY,EACkB;EAC9B,OAAOA,KAAK,CAACG,oBAAoB;AAClC;AAEO,MAAMC,2BAA2B,GAAAC,OAAA,CAAAD,2BAAA,GAAG,IAAAE,4BAAsB,EAC9DC,MAAW,IACZ,IAAAC,oBAAc,EACb,CAAER,KAAK,EAAES,QAAQ,KAChBF,MAAM,CAAEG,gBAAW,CAAC,CAClBC,gBAAgB,CAAC,CAAC,CAClBC,MAAM,CACN,CAAE;EAAEC;AAAU,CAAC,KACd,CAAEA,SAAS,IACTC,KAAK,CAACC,OAAO,CAAEF,SAAU,CAAC,IAC3BA,SAAS,CAACG,QAAQ,CAAEP,QAAS,CAChC,CAAC,EACH,MAAM,CAAEF,MAAM,CAAEG,gBAAW,CAAC,CAACC,gBAAgB,CAAC,CAAC,CAChD,CACF,CAAC;;AAED;AACA;AACA;AACO,MAAMM,2BAA2B,GAAAZ,OAAA,CAAAY,2BAAA,GAAG,IAAAX,4BAAsB,EAAIC,MAAM,IAC1E,IAAAC,oBAAc,EACb,CAAER,KAAY,EAAEkB,IAAY,EAAEC,IAAY,EAAEC,GAAa,KAAM;EAC9D,MAAMC,aAAa,GAAGP,KAAK,CAACC,OAAO,CAAEK,GAAI,CAAC,GAAGA,GAAG,GAAG,CAAEA,GAAG,CAAE;EAC1D,OAAOC,aAAa,CAACC,GAAG,CAAIC,EAAE,KAAQ;IACrCC,MAAM,EAAEjB,MAAM,CAAEG,gBAAW,CAAC,CAACe,OAAO,CAAE,QAAQ,EAAE;MAC/CP,IAAI;MACJC,IAAI;MACJI;IACD,CAAE,CAAC;IACHG,MAAM,EAAEnB,MAAM,CAAEG,gBAAW,CAAC,CAACe,OAAO,CAAE,QAAQ,EAAE;MAC/CP,IAAI;MACJC,IAAI;MACJI;IACD,CAAE;EACH,CAAC,CAAG,CAAC;AACN,CAAC,EACCvB,KAAK,IAAM,CAAEA,KAAK,CAAC2B,eAAe,CACrC,CACD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,0BAA0BA,CACzC5B,KAAY,EACZkB,IAAY,EACZC,IAAY,EACZI,EAAU,EACT;EACD,OAAON,2BAA2B,CAAEjB,KAAK,EAAEkB,IAAI,EAAEC,IAAI,EAAEI,EAAG,CAAC,CAAE,CAAC,CAAE;AACjE","ignoreList":[]}
@@ -68,7 +68,8 @@ const getCurrentUser = () => async ({
68
68
  exports.getCurrentUser = getCurrentUser;
69
69
  const getEntityRecord = (kind, name, key = '', query) => async ({
70
70
  select,
71
- dispatch
71
+ dispatch,
72
+ registry
72
73
  }) => {
73
74
  const configs = await dispatch((0, _entities.getOrLoadEntitiesConfig)(kind, name));
74
75
  const entityConfig = configs.find(config => config.name === name && config.kind === kind);
@@ -140,10 +141,28 @@ const getEntityRecord = (kind, name, key = '', query) => async ({
140
141
  return;
141
142
  }
142
143
  }
143
- const record = await (0, _apiFetch.default)({
144
- path
144
+ const response = await (0, _apiFetch.default)({
145
+ path,
146
+ parse: false
147
+ });
148
+ const record = await response.json();
149
+ const permissions = (0, _utils.getUserPermissionsFromResponse)(response);
150
+ registry.batch(() => {
151
+ dispatch.receiveEntityRecords(kind, name, record, query);
152
+ for (const action of _utils.ALLOWED_RESOURCE_ACTIONS) {
153
+ const permissionKey = (0, _utils.getUserPermissionCacheKey)(action, {
154
+ kind,
155
+ name,
156
+ id: key
157
+ });
158
+ dispatch.receiveUserPermission(permissionKey, permissions[action]);
159
+ dispatch.finishResolution('canUser', [action, {
160
+ kind,
161
+ name,
162
+ id: key
163
+ }]);
164
+ }
145
165
  });
146
- dispatch.receiveEntityRecords(kind, name, record, query);
147
166
  }
148
167
  } finally {
149
168
  dispatch.__unstableReleaseStoreLock(lock);
@@ -234,16 +253,7 @@ const getEntityRecords = (kind, name, query = {}) => async ({
234
253
  if (!query?._fields && !query.context) {
235
254
  const key = entityConfig.key || _entities.DEFAULT_ENTITY_KEY;
236
255
  const resolutionsArgs = records.filter(record => record?.[key]).map(record => [kind, name, record[key]]);
237
- dispatch({
238
- type: 'START_RESOLUTIONS',
239
- selectorName: 'getEntityRecord',
240
- args: resolutionsArgs
241
- });
242
- dispatch({
243
- type: 'FINISH_RESOLUTIONS',
244
- selectorName: 'getEntityRecord',
245
- args: resolutionsArgs
246
- });
256
+ dispatch.finishResolutions('getEntityRecord', resolutionsArgs);
247
257
  }
248
258
  dispatch.__unstableReleaseStoreLock(lock);
249
259
  });
@@ -300,27 +310,40 @@ const getEmbedPreview = url => async ({
300
310
  * Checks whether the current user can perform the given action on the given
301
311
  * REST resource.
302
312
  *
303
- * @param {string} requestedAction Action to check. One of: 'create', 'read', 'update',
304
- * 'delete'.
305
- * @param {string} resource REST resource to check, e.g. 'media' or 'posts'.
306
- * @param {?string} id ID of the rest resource to check.
313
+ * @param {string} requestedAction Action to check. One of: 'create', 'read', 'update',
314
+ * 'delete'.
315
+ * @param {string|Object} resource Entity resource to check. Accepts entity object `{ kind: 'root', name: 'media', id: 1 }`
316
+ * or REST base as a string - `media`.
317
+ * @param {?string} id ID of the rest resource to check.
307
318
  */
308
319
  exports.getEmbedPreview = getEmbedPreview;
309
320
  const canUser = (requestedAction, resource, id) => async ({
310
321
  dispatch,
311
322
  registry
312
323
  }) => {
324
+ if (!_utils.ALLOWED_RESOURCE_ACTIONS.includes(requestedAction)) {
325
+ throw new Error(`'${requestedAction}' is not a valid action.`);
326
+ }
327
+ let resourcePath = null;
328
+ if (typeof resource === 'object') {
329
+ if (!resource.kind || !resource.name) {
330
+ throw new Error('The entity resource object is not valid.');
331
+ }
332
+ const configs = await dispatch((0, _entities.getOrLoadEntitiesConfig)(resource.kind, resource.name));
333
+ const entityConfig = configs.find(config => config.name === resource.name && config.kind === resource.kind);
334
+ if (!entityConfig) {
335
+ return;
336
+ }
337
+ resourcePath = entityConfig.baseURL + (resource.id ? '/' + resource.id : '');
338
+ } else {
339
+ resourcePath = `/wp/v2/${resource}` + (id ? '/' + id : '');
340
+ }
313
341
  const {
314
342
  hasStartedResolution
315
343
  } = registry.select(_name.STORE_NAME);
316
- const resourcePath = id ? `${resource}/${id}` : resource;
317
- const retrievedActions = ['create', 'read', 'update', 'delete'];
318
- if (!retrievedActions.includes(requestedAction)) {
319
- throw new Error(`'${requestedAction}' is not a valid action.`);
320
- }
321
344
 
322
345
  // Prevent resolving the same resource twice.
323
- for (const relatedAction of retrievedActions) {
346
+ for (const relatedAction of _utils.ALLOWED_RESOURCE_ACTIONS) {
324
347
  if (relatedAction === requestedAction) {
325
348
  continue;
326
349
  }
@@ -332,7 +355,7 @@ const canUser = (requestedAction, resource, id) => async ({
332
355
  let response;
333
356
  try {
334
357
  response = await (0, _apiFetch.default)({
335
- path: `/wp/v2/${resourcePath}`,
358
+ path: resourcePath,
336
359
  method: 'OPTIONS',
337
360
  parse: false
338
361
  });
@@ -341,25 +364,16 @@ const canUser = (requestedAction, resource, id) => async ({
341
364
  // 5xx). The previously determined isAllowed value will remain in the store.
342
365
  return;
343
366
  }
344
-
345
- // Optional chaining operator is used here because the API requests don't
346
- // return the expected result in the native version. Instead, API requests
347
- // only return the result, without including response properties like the headers.
348
- const allowHeader = response.headers?.get('allow');
349
- const allowedMethods = allowHeader?.allow || allowHeader || '';
350
- const permissions = {};
351
- const methods = {
352
- create: 'POST',
353
- read: 'GET',
354
- update: 'PUT',
355
- delete: 'DELETE'
356
- };
357
- for (const [actionName, methodName] of Object.entries(methods)) {
358
- permissions[actionName] = allowedMethods.includes(methodName);
359
- }
367
+ const permissions = (0, _utils.getUserPermissionsFromResponse)(response);
360
368
  registry.batch(() => {
361
- for (const action of retrievedActions) {
362
- dispatch.receiveUserPermission(`${action}/${resourcePath}`, permissions[action]);
369
+ for (const action of _utils.ALLOWED_RESOURCE_ACTIONS) {
370
+ const key = (0, _utils.getUserPermissionCacheKey)(action, resource, id);
371
+ dispatch.receiveUserPermission(key, permissions[action]);
372
+
373
+ // Mark related action resolutions as finished.
374
+ if (action !== requestedAction) {
375
+ dispatch.finishResolution('canUser', [action, resource, id]);
376
+ }
363
377
  }
364
378
  });
365
379
  };
@@ -376,13 +390,11 @@ exports.canUser = canUser;
376
390
  const canUserEditEntityRecord = (kind, name, recordId) => async ({
377
391
  dispatch
378
392
  }) => {
379
- const configs = await dispatch((0, _entities.getOrLoadEntitiesConfig)(kind, name));
380
- const entityConfig = configs.find(config => config.name === name && config.kind === kind);
381
- if (!entityConfig) {
382
- return;
383
- }
384
- const resource = entityConfig.__unstable_rest_base;
385
- await dispatch(canUser('update', resource, recordId));
393
+ await dispatch(canUser('update', {
394
+ kind,
395
+ name,
396
+ id: recordId
397
+ }));
386
398
  };
387
399
 
388
400
  /**
@@ -675,16 +687,8 @@ const getRevisions = (kind, name, recordKey, query = {}) => async ({
675
687
  if (!query?._fields && !query.context) {
676
688
  const key = entityConfig.key || _entities.DEFAULT_ENTITY_KEY;
677
689
  const resolutionsArgs = records.filter(record => record[key]).map(record => [kind, name, recordKey, record[key]]);
678
- dispatch({
679
- type: 'START_RESOLUTIONS',
680
- selectorName: 'getRevision',
681
- args: resolutionsArgs
682
- });
683
- dispatch({
684
- type: 'FINISH_RESOLUTIONS',
685
- selectorName: 'getRevision',
686
- args: resolutionsArgs
687
- });
690
+ dispatch.startResolutions('getRevision', resolutionsArgs);
691
+ dispatch.finishResolutions('getRevision', resolutionsArgs);
688
692
  }
689
693
  }
690
694
  };