@wordpress/core-data 6.23.0 → 6.25.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.
- package/CHANGELOG.md +5 -0
- package/README.md +51 -2
- package/build/actions.js +38 -0
- package/build/actions.js.map +1 -1
- package/build/entities.js +7 -3
- package/build/entities.js.map +1 -1
- package/build/entity-types/global-styles-revision.js +6 -0
- package/build/entity-types/global-styles-revision.js.map +1 -0
- package/build/entity-types/index.js.map +1 -1
- package/build/entity-types/post-revision.js +6 -0
- package/build/entity-types/post-revision.js.map +1 -0
- package/build/footnotes/get-footnotes-order.js +2 -9
- package/build/footnotes/get-footnotes-order.js.map +1 -1
- package/build/footnotes/index.js +5 -10
- package/build/footnotes/index.js.map +1 -1
- package/build/hooks/use-entity-record.js +16 -5
- package/build/hooks/use-entity-record.js.map +1 -1
- package/build/queried-data/reducer.js +1 -1
- package/build/queried-data/reducer.js.map +1 -1
- package/build/reducer.js +26 -2
- package/build/reducer.js.map +1 -1
- package/build/resolvers.js +133 -3
- package/build/resolvers.js.map +1 -1
- package/build/selectors.js +79 -1
- package/build/selectors.js.map +1 -1
- package/build-module/actions.js +36 -0
- package/build-module/actions.js.map +1 -1
- package/build-module/entities.js +7 -3
- package/build-module/entities.js.map +1 -1
- package/build-module/entity-types/global-styles-revision.js +2 -0
- package/build-module/entity-types/global-styles-revision.js.map +1 -0
- package/build-module/entity-types/index.js.map +1 -1
- package/build-module/entity-types/post-revision.js +2 -0
- package/build-module/entity-types/post-revision.js.map +1 -0
- package/build-module/footnotes/get-footnotes-order.js +2 -9
- package/build-module/footnotes/get-footnotes-order.js.map +1 -1
- package/build-module/footnotes/index.js +6 -11
- package/build-module/footnotes/index.js.map +1 -1
- package/build-module/hooks/use-entity-record.js +16 -5
- package/build-module/hooks/use-entity-record.js.map +1 -1
- package/build-module/queried-data/reducer.js +1 -1
- package/build-module/queried-data/reducer.js.map +1 -1
- package/build-module/reducer.js +26 -2
- package/build-module/reducer.js.map +1 -1
- package/build-module/resolvers.js +130 -2
- package/build-module/resolvers.js.map +1 -1
- package/build-module/selectors.js +76 -1
- package/build-module/selectors.js.map +1 -1
- package/build-types/actions.d.ts +5 -0
- package/build-types/actions.d.ts.map +1 -1
- package/build-types/entities.d.ts +11 -1
- package/build-types/entities.d.ts.map +1 -1
- package/build-types/entity-types/global-styles-revision.d.ts +43 -0
- package/build-types/entity-types/global-styles-revision.d.ts.map +1 -0
- package/build-types/entity-types/index.d.ts +4 -2
- package/build-types/entity-types/index.d.ts.map +1 -1
- package/build-types/entity-types/post-revision.d.ts +76 -0
- package/build-types/entity-types/post-revision.d.ts.map +1 -0
- package/build-types/footnotes/get-footnotes-order.d.ts.map +1 -1
- package/build-types/footnotes/index.d.ts.map +1 -1
- package/build-types/hooks/use-entity-record.d.ts.map +1 -1
- package/build-types/index.d.ts +13 -4
- package/build-types/index.d.ts.map +1 -1
- package/build-types/reducer.d.ts.map +1 -1
- package/build-types/resolvers.d.ts +9 -0
- package/build-types/resolvers.d.ts.map +1 -1
- package/build-types/selectors.d.ts +39 -3
- package/build-types/selectors.d.ts.map +1 -1
- package/package.json +17 -17
- package/src/actions.js +45 -0
- package/src/entities.js +13 -1
- package/src/entity-types/global-styles-revision.ts +47 -0
- package/src/entity-types/index.ts +6 -0
- package/src/entity-types/post-revision.ts +93 -0
- package/src/footnotes/get-footnotes-order.js +5 -12
- package/src/footnotes/index.js +14 -8
- package/src/hooks/test/use-entity-record.js +41 -0
- package/src/hooks/use-entity-record.ts +30 -18
- package/src/queried-data/reducer.js +1 -1
- package/src/reducer.js +33 -2
- package/src/resolvers.js +182 -2
- package/src/selectors.ts +119 -1
- package/src/test/entities.js +9 -0
- package/src/test/reducer.js +235 -0
- package/src/test/selectors.js +96 -0
- package/tsconfig.tsbuildinfo +1 -1
package/build/resolvers.js
CHANGED
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.getUserPatternCategories = exports.getThemeSupports = exports.getRawEntityRecord = exports.getNavigationFallbackId = exports.getEntityRecords = exports.getEntityRecord = exports.getEmbedPreview = exports.getEditedEntityRecord = exports.getDefaultTemplateId = exports.getCurrentUser = exports.getCurrentThemeGlobalStylesRevisions = exports.getCurrentTheme = exports.getBlockPatterns = exports.getBlockPatternCategories = exports.getAutosaves = exports.getAutosave = exports.getAuthors = exports.canUserEditEntityRecord = exports.canUser = exports.__experimentalGetTemplateForLink = exports.__experimentalGetCurrentThemeGlobalStylesVariations = exports.__experimentalGetCurrentThemeBaseGlobalStyles = exports.__experimentalGetCurrentGlobalStylesId = void 0;
|
|
7
|
+
exports.getUserPatternCategories = exports.getThemeSupports = exports.getRevisions = exports.getRevision = exports.getRawEntityRecord = exports.getNavigationFallbackId = exports.getEntityRecords = exports.getEntityRecord = exports.getEmbedPreview = exports.getEditedEntityRecord = exports.getDefaultTemplateId = exports.getCurrentUser = exports.getCurrentThemeGlobalStylesRevisions = exports.getCurrentTheme = exports.getBlockPatterns = exports.getBlockPatternCategories = exports.getAutosaves = exports.getAutosave = exports.getAuthors = exports.canUserEditEntityRecord = exports.canUser = exports.__experimentalGetTemplateForLink = exports.__experimentalGetCurrentThemeGlobalStylesVariations = exports.__experimentalGetCurrentThemeBaseGlobalStyles = exports.__experimentalGetCurrentGlobalStylesId = void 0;
|
|
8
8
|
var _changeCase = require("change-case");
|
|
9
9
|
var _url = require("@wordpress/url");
|
|
10
10
|
var _htmlEntities = require("@wordpress/html-entities");
|
|
@@ -213,7 +213,7 @@ const getEntityRecords = (kind, name, query = {}) => async ({
|
|
|
213
213
|
|
|
214
214
|
// If we request fields but the result doesn't contain the fields,
|
|
215
215
|
// explicitly set these fields as "undefined"
|
|
216
|
-
// that way we consider the query "
|
|
216
|
+
// that way we consider the query "fulfilled".
|
|
217
217
|
if (query._fields) {
|
|
218
218
|
records = records.map(record => {
|
|
219
219
|
query._fields.split(',').forEach(field => {
|
|
@@ -272,7 +272,7 @@ exports.getCurrentTheme = getCurrentTheme;
|
|
|
272
272
|
const getThemeSupports = (0, _utils.forwardResolver)('getCurrentTheme');
|
|
273
273
|
|
|
274
274
|
/**
|
|
275
|
-
* Requests a preview from the
|
|
275
|
+
* Requests a preview from the Embed API.
|
|
276
276
|
*
|
|
277
277
|
* @param {string} url URL to get the preview for.
|
|
278
278
|
*/
|
|
@@ -597,5 +597,135 @@ const getDefaultTemplateId = query => async ({
|
|
|
597
597
|
dispatch.receiveDefaultTemplateId(query, template.id);
|
|
598
598
|
}
|
|
599
599
|
};
|
|
600
|
+
|
|
601
|
+
/**
|
|
602
|
+
* Requests an entity's revisions from the REST API.
|
|
603
|
+
*
|
|
604
|
+
* @param {string} kind Entity kind.
|
|
605
|
+
* @param {string} name Entity name.
|
|
606
|
+
* @param {number|string} recordKey The key of the entity record whose revisions you want to fetch.
|
|
607
|
+
* @param {Object|undefined} query Optional object of query parameters to
|
|
608
|
+
* include with request. If requesting specific
|
|
609
|
+
* fields, fields must always include the ID.
|
|
610
|
+
*/
|
|
600
611
|
exports.getDefaultTemplateId = getDefaultTemplateId;
|
|
612
|
+
const getRevisions = (kind, name, recordKey, query = {}) => async ({
|
|
613
|
+
dispatch
|
|
614
|
+
}) => {
|
|
615
|
+
const configs = await dispatch((0, _entities.getOrLoadEntitiesConfig)(kind));
|
|
616
|
+
const entityConfig = configs.find(config => config.name === name && config.kind === kind);
|
|
617
|
+
if (!entityConfig || entityConfig?.__experimentalNoFetch) {
|
|
618
|
+
return;
|
|
619
|
+
}
|
|
620
|
+
if (query._fields) {
|
|
621
|
+
// If requesting specific fields, items and query association to said
|
|
622
|
+
// records are stored by ID reference. Thus, fields must always include
|
|
623
|
+
// the ID.
|
|
624
|
+
query = {
|
|
625
|
+
...query,
|
|
626
|
+
_fields: [...new Set([...((0, _utils.getNormalizedCommaSeparable)(query._fields) || []), entityConfig.revisionKey || _entities.DEFAULT_ENTITY_KEY])].join()
|
|
627
|
+
};
|
|
628
|
+
}
|
|
629
|
+
const path = (0, _url.addQueryArgs)(entityConfig.getRevisionsUrl(recordKey), query);
|
|
630
|
+
let records, response;
|
|
631
|
+
const meta = {};
|
|
632
|
+
const isPaginated = entityConfig.supportsPagination && query.per_page !== -1;
|
|
633
|
+
try {
|
|
634
|
+
response = await (0, _apiFetch.default)({
|
|
635
|
+
path,
|
|
636
|
+
parse: !isPaginated
|
|
637
|
+
});
|
|
638
|
+
} catch (error) {
|
|
639
|
+
// Do nothing if our request comes back with an API error.
|
|
640
|
+
return;
|
|
641
|
+
}
|
|
642
|
+
if (response) {
|
|
643
|
+
if (isPaginated) {
|
|
644
|
+
records = Object.values(await response.json());
|
|
645
|
+
meta.totalItems = parseInt(response.headers.get('X-WP-Total'));
|
|
646
|
+
} else {
|
|
647
|
+
records = Object.values(response);
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
// If we request fields but the result doesn't contain the fields,
|
|
651
|
+
// explicitly set these fields as "undefined"
|
|
652
|
+
// that way we consider the query "fulfilled".
|
|
653
|
+
if (query._fields) {
|
|
654
|
+
records = records.map(record => {
|
|
655
|
+
query._fields.split(',').forEach(field => {
|
|
656
|
+
if (!record.hasOwnProperty(field)) {
|
|
657
|
+
record[field] = undefined;
|
|
658
|
+
}
|
|
659
|
+
});
|
|
660
|
+
return record;
|
|
661
|
+
});
|
|
662
|
+
}
|
|
663
|
+
dispatch.receiveRevisions(kind, name, recordKey, records, query, false, meta);
|
|
664
|
+
|
|
665
|
+
// When requesting all fields, the list of results can be used to
|
|
666
|
+
// resolve the `getRevision` selector in addition to `getRevisions`.
|
|
667
|
+
if (!query?._fields && !query.context) {
|
|
668
|
+
const key = entityConfig.key || _entities.DEFAULT_ENTITY_KEY;
|
|
669
|
+
const resolutionsArgs = records.filter(record => record[key]).map(record => [kind, name, recordKey, record[key]]);
|
|
670
|
+
dispatch({
|
|
671
|
+
type: 'START_RESOLUTIONS',
|
|
672
|
+
selectorName: 'getRevision',
|
|
673
|
+
args: resolutionsArgs
|
|
674
|
+
});
|
|
675
|
+
dispatch({
|
|
676
|
+
type: 'FINISH_RESOLUTIONS',
|
|
677
|
+
selectorName: 'getRevision',
|
|
678
|
+
args: resolutionsArgs
|
|
679
|
+
});
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
};
|
|
683
|
+
|
|
684
|
+
// Invalidate cache when a new revision is created.
|
|
685
|
+
exports.getRevisions = getRevisions;
|
|
686
|
+
getRevisions.shouldInvalidate = (action, kind, name, recordKey) => action.type === 'SAVE_ENTITY_RECORD_FINISH' && name === action.name && kind === action.kind && !action.error && recordKey === action.recordId;
|
|
687
|
+
|
|
688
|
+
/**
|
|
689
|
+
* Requests a specific Entity revision from the REST API.
|
|
690
|
+
*
|
|
691
|
+
* @param {string} kind Entity kind.
|
|
692
|
+
* @param {string} name Entity name.
|
|
693
|
+
* @param {number|string} recordKey The key of the entity record whose revisions you want to fetch.
|
|
694
|
+
* @param {number|string} revisionKey The revision's key.
|
|
695
|
+
* @param {Object|undefined} query Optional object of query parameters to
|
|
696
|
+
* include with request. If requesting specific
|
|
697
|
+
* fields, fields must always include the ID.
|
|
698
|
+
*/
|
|
699
|
+
const getRevision = (kind, name, recordKey, revisionKey, query) => async ({
|
|
700
|
+
dispatch
|
|
701
|
+
}) => {
|
|
702
|
+
const configs = await dispatch((0, _entities.getOrLoadEntitiesConfig)(kind));
|
|
703
|
+
const entityConfig = configs.find(config => config.name === name && config.kind === kind);
|
|
704
|
+
if (!entityConfig || entityConfig?.__experimentalNoFetch) {
|
|
705
|
+
return;
|
|
706
|
+
}
|
|
707
|
+
if (query !== undefined && query._fields) {
|
|
708
|
+
// If requesting specific fields, items and query association to said
|
|
709
|
+
// records are stored by ID reference. Thus, fields must always include
|
|
710
|
+
// the ID.
|
|
711
|
+
query = {
|
|
712
|
+
...query,
|
|
713
|
+
_fields: [...new Set([...((0, _utils.getNormalizedCommaSeparable)(query._fields) || []), entityConfig.revisionKey || _entities.DEFAULT_ENTITY_KEY])].join()
|
|
714
|
+
};
|
|
715
|
+
}
|
|
716
|
+
const path = (0, _url.addQueryArgs)(entityConfig.getRevisionsUrl(recordKey, revisionKey), query);
|
|
717
|
+
let record;
|
|
718
|
+
try {
|
|
719
|
+
record = await (0, _apiFetch.default)({
|
|
720
|
+
path
|
|
721
|
+
});
|
|
722
|
+
} catch (error) {
|
|
723
|
+
// Do nothing if our request comes back with an API error.
|
|
724
|
+
return;
|
|
725
|
+
}
|
|
726
|
+
if (record) {
|
|
727
|
+
dispatch.receiveRevisions(kind, name, recordKey, record, query);
|
|
728
|
+
}
|
|
729
|
+
};
|
|
730
|
+
exports.getRevision = getRevision;
|
|
601
731
|
//# sourceMappingURL=resolvers.js.map
|
package/build/resolvers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_changeCase","require","_url","_htmlEntities","_apiFetch","_interopRequireDefault","_name","_entities","_utils","_sync","getAuthors","query","dispatch","path","addQueryArgs","users","apiFetch","receiveUserQuery","exports","getCurrentUser","currentUser","receiveCurrentUser","getEntityRecord","kind","name","key","select","configs","getOrLoadEntitiesConfig","entityConfig","find","config","__experimentalNoFetch","lock","__unstableAcquireStoreLock","STORE_NAME","exclusive","window","__experimentalEnableSync","syncConfig","process","env","IS_GUTENBERG_PLUGIN","objectId","getSyncObjectId","getSyncProvider","bootstrap","syncObjectType","record","receiveEntityRecords","type","recordId","edits","meta","undo","undefined","_fields","Set","getNormalizedCommaSeparable","DEFAULT_ENTITY_KEY","join","baseURL","baseURLParams","include","hasRecords","hasEntityRecords","__unstableReleaseStoreLock","getRawEntityRecord","forwardResolver","getEditedEntityRecord","getEntityRecords","records","supportsPagination","per_page","response","parse","Object","values","json","totalItems","parseInt","headers","get","map","split","forEach","field","hasOwnProperty","context","resolutionsArgs","filter","selectorName","args","shouldInvalidate","action","invalidateCache","getCurrentTheme","resolveSelect","activeThemes","status","receiveCurrentTheme","getThemeSupports","getEmbedPreview","url","embedProxyResponse","receiveEmbedPreview","error","canUser","requestedAction","resource","id","registry","hasStartedResolution","resourcePath","retrievedActions","includes","Error","relatedAction","isAlreadyResolving","method","allowHeader","allowedMethods","allow","permissions","methods","create","read","update","delete","actionName","methodName","entries","receiveUserPermission","canUserEditEntityRecord","__unstable_rest_base","getAutosaves","postType","postId","rest_base","restBase","rest_namespace","restNamespace","getPostType","autosaves","length","receiveAutosaves","getAutosave","__experimentalGetTemplateForLink","link","template","then","data","e","__experimentalGetCurrentGlobalStylesId","globalStylesURL","_links","href","globalStylesObject","__experimentalReceiveCurrentGlobalStylesId","__experimentalGetCurrentThemeBaseGlobalStyles","currentTheme","themeGlobalStyles","stylesheet","__experimentalReceiveThemeBaseGlobalStyles","__experimentalGetCurrentThemeGlobalStylesVariations","variations","__experimentalReceiveThemeGlobalStyleVariations","getCurrentThemeGlobalStylesRevisions","globalStylesId","revisionsURL","resetRevisions","revisions","revision","fromEntries","value","camelCase","receiveThemeGlobalStyleRevisions","getBlockPatterns","restPatterns","patterns","pattern","getBlockPatternCategories","categories","getUserPatternCategories","patternCategories","mappedPatternCategories","userCategory","label","decodeEntities","slug","getNavigationFallbackId","fallback","_embed","_embedded","self","receiveNavigationFallbackId","existingFallbackEntityRecord","invalidateNavigationQueries","finishResolution","getDefaultTemplateId","receiveDefaultTemplateId"],"sources":["@wordpress/core-data/src/resolvers.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { camelCase } from 'change-case';\n\n/**\n * WordPress dependencies\n */\nimport { addQueryArgs } from '@wordpress/url';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport apiFetch from '@wordpress/api-fetch';\n\n/**\n * Internal dependencies\n */\nimport { STORE_NAME } from './name';\nimport { getOrLoadEntitiesConfig, DEFAULT_ENTITY_KEY } from './entities';\nimport { forwardResolver, getNormalizedCommaSeparable } from './utils';\nimport { getSyncProvider } from './sync';\n\n/**\n * Requests authors from the REST API.\n *\n * @param {Object|undefined} query Optional object of query parameters to\n * include with request.\n */\nexport const getAuthors =\n\t( query ) =>\n\tasync ( { dispatch } ) => {\n\t\tconst path = addQueryArgs(\n\t\t\t'/wp/v2/users/?who=authors&per_page=100',\n\t\t\tquery\n\t\t);\n\t\tconst users = await apiFetch( { path } );\n\t\tdispatch.receiveUserQuery( path, users );\n\t};\n\n/**\n * Requests the current user from the REST API.\n */\nexport const getCurrentUser =\n\t() =>\n\tasync ( { dispatch } ) => {\n\t\tconst currentUser = await apiFetch( { path: '/wp/v2/users/me' } );\n\t\tdispatch.receiveCurrentUser( currentUser );\n\t};\n\n/**\n * Requests an entity's record from the REST API.\n *\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number|string} key Record's key\n * @param {Object|undefined} query Optional object of query parameters to\n * include with request. If requesting specific\n * fields, fields must always include the ID.\n */\nexport const getEntityRecord =\n\t( kind, name, key = '', query ) =>\n\tasync ( { select, dispatch } ) => {\n\t\tconst configs = await dispatch( getOrLoadEntitiesConfig( kind ) );\n\t\tconst entityConfig = configs.find(\n\t\t\t( config ) => config.name === name && config.kind === kind\n\t\t);\n\t\tif ( ! entityConfig || entityConfig?.__experimentalNoFetch ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst lock = await dispatch.__unstableAcquireStoreLock(\n\t\t\tSTORE_NAME,\n\t\t\t[ 'entities', 'records', kind, name, key ],\n\t\t\t{ exclusive: false }\n\t\t);\n\n\t\ttry {\n\t\t\t// Entity supports configs,\n\t\t\t// use the sync algorithm instead of the old fetch behavior.\n\t\t\tif (\n\t\t\t\twindow.__experimentalEnableSync &&\n\t\t\t\tentityConfig.syncConfig &&\n\t\t\t\t! query\n\t\t\t) {\n\t\t\t\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\t\t\t\tconst objectId = entityConfig.getSyncObjectId( key );\n\n\t\t\t\t\t// Loads the persisted document.\n\t\t\t\t\tawait getSyncProvider().bootstrap(\n\t\t\t\t\t\tentityConfig.syncObjectType,\n\t\t\t\t\t\tobjectId,\n\t\t\t\t\t\t( record ) => {\n\t\t\t\t\t\t\tdispatch.receiveEntityRecords(\n\t\t\t\t\t\t\t\tkind,\n\t\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\t\trecord,\n\t\t\t\t\t\t\t\tquery\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\n\t\t\t\t\t// Boostraps the edited document as well (and load from peers).\n\t\t\t\t\tawait getSyncProvider().bootstrap(\n\t\t\t\t\t\tentityConfig.syncObjectType + '--edit',\n\t\t\t\t\t\tobjectId,\n\t\t\t\t\t\t( record ) => {\n\t\t\t\t\t\t\tdispatch( {\n\t\t\t\t\t\t\t\ttype: 'EDIT_ENTITY_RECORD',\n\t\t\t\t\t\t\t\tkind,\n\t\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\t\trecordId: key,\n\t\t\t\t\t\t\t\tedits: record,\n\t\t\t\t\t\t\t\tmeta: {\n\t\t\t\t\t\t\t\t\tundo: undefined,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif ( query !== undefined && query._fields ) {\n\t\t\t\t\t// If requesting specific fields, items and query association to said\n\t\t\t\t\t// records are stored by ID reference. Thus, fields must always include\n\t\t\t\t\t// the ID.\n\t\t\t\t\tquery = {\n\t\t\t\t\t\t...query,\n\t\t\t\t\t\t_fields: [\n\t\t\t\t\t\t\t...new Set( [\n\t\t\t\t\t\t\t\t...( getNormalizedCommaSeparable(\n\t\t\t\t\t\t\t\t\tquery._fields\n\t\t\t\t\t\t\t\t) || [] ),\n\t\t\t\t\t\t\t\tentityConfig.key || DEFAULT_ENTITY_KEY,\n\t\t\t\t\t\t\t] ),\n\t\t\t\t\t\t].join(),\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\t// Disable reason: While true that an early return could leave `path`\n\t\t\t\t// unused, it's important that path is derived using the query prior to\n\t\t\t\t// additional query modifications in the condition below, since those\n\t\t\t\t// modifications are relevant to how the data is tracked in state, and not\n\t\t\t\t// for how the request is made to the REST API.\n\n\t\t\t\t// eslint-disable-next-line @wordpress/no-unused-vars-before-return\n\t\t\t\tconst path = addQueryArgs(\n\t\t\t\t\tentityConfig.baseURL + ( key ? '/' + key : '' ),\n\t\t\t\t\t{\n\t\t\t\t\t\t...entityConfig.baseURLParams,\n\t\t\t\t\t\t...query,\n\t\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t\tif ( query !== undefined ) {\n\t\t\t\t\tquery = { ...query, include: [ key ] };\n\n\t\t\t\t\t// The resolution cache won't consider query as reusable based on the\n\t\t\t\t\t// fields, so it's tested here, prior to initiating the REST request,\n\t\t\t\t\t// and without causing `getEntityRecords` resolution to occur.\n\t\t\t\t\tconst hasRecords = select.hasEntityRecords(\n\t\t\t\t\t\tkind,\n\t\t\t\t\t\tname,\n\t\t\t\t\t\tquery\n\t\t\t\t\t);\n\t\t\t\t\tif ( hasRecords ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst record = await apiFetch( { path } );\n\t\t\t\tdispatch.receiveEntityRecords( kind, name, record, query );\n\t\t\t}\n\t\t} finally {\n\t\t\tdispatch.__unstableReleaseStoreLock( lock );\n\t\t}\n\t};\n\n/**\n * Requests an entity's record from the REST API.\n */\nexport const getRawEntityRecord = forwardResolver( 'getEntityRecord' );\n\n/**\n * Requests an entity's record from the REST API.\n */\nexport const getEditedEntityRecord = forwardResolver( 'getEntityRecord' );\n\n/**\n * Requests the entity's records from the REST API.\n *\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {Object?} query Query Object. If requesting specific fields, fields\n * must always include the ID.\n */\nexport const getEntityRecords =\n\t( kind, name, query = {} ) =>\n\tasync ( { dispatch } ) => {\n\t\tconst configs = await dispatch( getOrLoadEntitiesConfig( kind ) );\n\t\tconst entityConfig = configs.find(\n\t\t\t( config ) => config.name === name && config.kind === kind\n\t\t);\n\t\tif ( ! entityConfig || entityConfig?.__experimentalNoFetch ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst lock = await dispatch.__unstableAcquireStoreLock(\n\t\t\tSTORE_NAME,\n\t\t\t[ 'entities', 'records', kind, name ],\n\t\t\t{ exclusive: false }\n\t\t);\n\n\t\ttry {\n\t\t\tif ( query._fields ) {\n\t\t\t\t// If requesting specific fields, items and query association to said\n\t\t\t\t// records are stored by ID reference. Thus, fields must always include\n\t\t\t\t// the ID.\n\t\t\t\tquery = {\n\t\t\t\t\t...query,\n\t\t\t\t\t_fields: [\n\t\t\t\t\t\t...new Set( [\n\t\t\t\t\t\t\t...( getNormalizedCommaSeparable( query._fields ) ||\n\t\t\t\t\t\t\t\t[] ),\n\t\t\t\t\t\t\tentityConfig.key || DEFAULT_ENTITY_KEY,\n\t\t\t\t\t\t] ),\n\t\t\t\t\t].join(),\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst path = addQueryArgs( entityConfig.baseURL, {\n\t\t\t\t...entityConfig.baseURLParams,\n\t\t\t\t...query,\n\t\t\t} );\n\n\t\t\tlet records, meta;\n\t\t\tif ( entityConfig.supportsPagination && query.per_page !== -1 ) {\n\t\t\t\tconst response = await apiFetch( { path, parse: false } );\n\t\t\t\trecords = Object.values( await response.json() );\n\t\t\t\tmeta = {\n\t\t\t\t\ttotalItems: parseInt(\n\t\t\t\t\t\tresponse.headers.get( 'X-WP-Total' )\n\t\t\t\t\t),\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\trecords = Object.values( await apiFetch( { path } ) );\n\t\t\t}\n\n\t\t\t// If we request fields but the result doesn't contain the fields,\n\t\t\t// explicitly set these fields as \"undefined\"\n\t\t\t// that way we consider the query \"fullfilled\".\n\t\t\tif ( query._fields ) {\n\t\t\t\trecords = records.map( ( record ) => {\n\t\t\t\t\tquery._fields.split( ',' ).forEach( ( field ) => {\n\t\t\t\t\t\tif ( ! record.hasOwnProperty( field ) ) {\n\t\t\t\t\t\t\trecord[ field ] = undefined;\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\n\t\t\t\t\treturn record;\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tdispatch.receiveEntityRecords(\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\trecords,\n\t\t\t\tquery,\n\t\t\t\tfalse,\n\t\t\t\tundefined,\n\t\t\t\tmeta\n\t\t\t);\n\n\t\t\t// When requesting all fields, the list of results can be used to\n\t\t\t// resolve the `getEntityRecord` selector in addition to `getEntityRecords`.\n\t\t\t// See https://github.com/WordPress/gutenberg/pull/26575\n\t\t\tif ( ! query?._fields && ! query.context ) {\n\t\t\t\tconst key = entityConfig.key || DEFAULT_ENTITY_KEY;\n\t\t\t\tconst resolutionsArgs = records\n\t\t\t\t\t.filter( ( record ) => record[ key ] )\n\t\t\t\t\t.map( ( record ) => [ kind, name, record[ key ] ] );\n\n\t\t\t\tdispatch( {\n\t\t\t\t\ttype: 'START_RESOLUTIONS',\n\t\t\t\t\tselectorName: 'getEntityRecord',\n\t\t\t\t\targs: resolutionsArgs,\n\t\t\t\t} );\n\t\t\t\tdispatch( {\n\t\t\t\t\ttype: 'FINISH_RESOLUTIONS',\n\t\t\t\t\tselectorName: 'getEntityRecord',\n\t\t\t\t\targs: resolutionsArgs,\n\t\t\t\t} );\n\t\t\t}\n\t\t} finally {\n\t\t\tdispatch.__unstableReleaseStoreLock( lock );\n\t\t}\n\t};\n\ngetEntityRecords.shouldInvalidate = ( action, kind, name ) => {\n\treturn (\n\t\t( action.type === 'RECEIVE_ITEMS' || action.type === 'REMOVE_ITEMS' ) &&\n\t\taction.invalidateCache &&\n\t\tkind === action.kind &&\n\t\tname === action.name\n\t);\n};\n\n/**\n * Requests the current theme.\n */\nexport const getCurrentTheme =\n\t() =>\n\tasync ( { dispatch, resolveSelect } ) => {\n\t\tconst activeThemes = await resolveSelect.getEntityRecords(\n\t\t\t'root',\n\t\t\t'theme',\n\t\t\t{ status: 'active' }\n\t\t);\n\n\t\tdispatch.receiveCurrentTheme( activeThemes[ 0 ] );\n\t};\n\n/**\n * Requests theme supports data from the index.\n */\nexport const getThemeSupports = forwardResolver( 'getCurrentTheme' );\n\n/**\n * Requests a preview from the from the Embed API.\n *\n * @param {string} url URL to get the preview for.\n */\nexport const getEmbedPreview =\n\t( url ) =>\n\tasync ( { dispatch } ) => {\n\t\ttry {\n\t\t\tconst embedProxyResponse = await apiFetch( {\n\t\t\t\tpath: addQueryArgs( '/oembed/1.0/proxy', { url } ),\n\t\t\t} );\n\t\t\tdispatch.receiveEmbedPreview( url, embedProxyResponse );\n\t\t} catch ( error ) {\n\t\t\t// Embed API 404s if the URL cannot be embedded, so we have to catch the error from the apiRequest here.\n\t\t\tdispatch.receiveEmbedPreview( url, false );\n\t\t}\n\t};\n\n/**\n * Checks whether the current user can perform the given action on the given\n * REST resource.\n *\n * @param {string} requestedAction Action to check. One of: 'create', 'read', 'update',\n * 'delete'.\n * @param {string} resource REST resource to check, e.g. 'media' or 'posts'.\n * @param {?string} id ID of the rest resource to check.\n */\nexport const canUser =\n\t( requestedAction, resource, id ) =>\n\tasync ( { dispatch, registry } ) => {\n\t\tconst { hasStartedResolution } = registry.select( STORE_NAME );\n\n\t\tconst resourcePath = id ? `${ resource }/${ id }` : resource;\n\t\tconst retrievedActions = [ 'create', 'read', 'update', 'delete' ];\n\n\t\tif ( ! retrievedActions.includes( requestedAction ) ) {\n\t\t\tthrow new Error( `'${ requestedAction }' is not a valid action.` );\n\t\t}\n\n\t\t// Prevent resolving the same resource twice.\n\t\tfor ( const relatedAction of retrievedActions ) {\n\t\t\tif ( relatedAction === requestedAction ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst isAlreadyResolving = hasStartedResolution( 'canUser', [\n\t\t\t\trelatedAction,\n\t\t\t\tresource,\n\t\t\t\tid,\n\t\t\t] );\n\t\t\tif ( isAlreadyResolving ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tlet response;\n\t\ttry {\n\t\t\tresponse = await apiFetch( {\n\t\t\t\tpath: `/wp/v2/${ resourcePath }`,\n\t\t\t\tmethod: 'OPTIONS',\n\t\t\t\tparse: false,\n\t\t\t} );\n\t\t} catch ( error ) {\n\t\t\t// Do nothing if our OPTIONS request comes back with an API error (4xx or\n\t\t\t// 5xx). The previously determined isAllowed value will remain in the store.\n\t\t\treturn;\n\t\t}\n\n\t\t// Optional chaining operator is used here because the API requests don't\n\t\t// return the expected result in the native version. Instead, API requests\n\t\t// only return the result, without including response properties like the headers.\n\t\tconst allowHeader = response.headers?.get( 'allow' );\n\t\tconst allowedMethods = allowHeader?.allow || allowHeader || '';\n\n\t\tconst permissions = {};\n\t\tconst methods = {\n\t\t\tcreate: 'POST',\n\t\t\tread: 'GET',\n\t\t\tupdate: 'PUT',\n\t\t\tdelete: 'DELETE',\n\t\t};\n\t\tfor ( const [ actionName, methodName ] of Object.entries( methods ) ) {\n\t\t\tpermissions[ actionName ] = allowedMethods.includes( methodName );\n\t\t}\n\n\t\tfor ( const action of retrievedActions ) {\n\t\t\tdispatch.receiveUserPermission(\n\t\t\t\t`${ action }/${ resourcePath }`,\n\t\t\t\tpermissions[ action ]\n\t\t\t);\n\t\t}\n\t};\n\n/**\n * Checks whether the current user can perform the given action on the given\n * REST resource.\n *\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {string} recordId Record's id.\n */\nexport const canUserEditEntityRecord =\n\t( kind, name, recordId ) =>\n\tasync ( { dispatch } ) => {\n\t\tconst configs = await dispatch( getOrLoadEntitiesConfig( kind ) );\n\t\tconst entityConfig = configs.find(\n\t\t\t( config ) => config.name === name && config.kind === kind\n\t\t);\n\t\tif ( ! entityConfig ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst resource = entityConfig.__unstable_rest_base;\n\t\tawait dispatch( canUser( 'update', resource, recordId ) );\n\t};\n\n/**\n * Request autosave data from the REST API.\n *\n * @param {string} postType The type of the parent post.\n * @param {number} postId The id of the parent post.\n */\nexport const getAutosaves =\n\t( postType, postId ) =>\n\tasync ( { dispatch, resolveSelect } ) => {\n\t\tconst { rest_base: restBase, rest_namespace: restNamespace = 'wp/v2' } =\n\t\t\tawait resolveSelect.getPostType( postType );\n\t\tconst autosaves = await apiFetch( {\n\t\t\tpath: `/${ restNamespace }/${ restBase }/${ postId }/autosaves?context=edit`,\n\t\t} );\n\n\t\tif ( autosaves && autosaves.length ) {\n\t\t\tdispatch.receiveAutosaves( postId, autosaves );\n\t\t}\n\t};\n\n/**\n * Request autosave data from the REST API.\n *\n * This resolver exists to ensure the underlying autosaves are fetched via\n * `getAutosaves` when a call to the `getAutosave` selector is made.\n *\n * @param {string} postType The type of the parent post.\n * @param {number} postId The id of the parent post.\n */\nexport const getAutosave =\n\t( postType, postId ) =>\n\tasync ( { resolveSelect } ) => {\n\t\tawait resolveSelect.getAutosaves( postType, postId );\n\t};\n\n/**\n * Retrieve the frontend template used for a given link.\n *\n * @param {string} link Link.\n */\nexport const __experimentalGetTemplateForLink =\n\t( link ) =>\n\tasync ( { dispatch, resolveSelect } ) => {\n\t\tlet template;\n\t\ttry {\n\t\t\t// This is NOT calling a REST endpoint but rather ends up with a response from\n\t\t\t// an Ajax function which has a different shape from a WP_REST_Response.\n\t\t\ttemplate = await apiFetch( {\n\t\t\t\turl: addQueryArgs( link, {\n\t\t\t\t\t'_wp-find-template': true,\n\t\t\t\t} ),\n\t\t\t} ).then( ( { data } ) => data );\n\t\t} catch ( e ) {\n\t\t\t// For non-FSE themes, it is possible that this request returns an error.\n\t\t}\n\n\t\tif ( ! template ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst record = await resolveSelect.getEntityRecord(\n\t\t\t'postType',\n\t\t\t'wp_template',\n\t\t\ttemplate.id\n\t\t);\n\n\t\tif ( record ) {\n\t\t\tdispatch.receiveEntityRecords(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template',\n\t\t\t\t[ record ],\n\t\t\t\t{\n\t\t\t\t\t'find-template': link,\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t};\n\n__experimentalGetTemplateForLink.shouldInvalidate = ( action ) => {\n\treturn (\n\t\t( action.type === 'RECEIVE_ITEMS' || action.type === 'REMOVE_ITEMS' ) &&\n\t\taction.invalidateCache &&\n\t\taction.kind === 'postType' &&\n\t\taction.name === 'wp_template'\n\t);\n};\n\nexport const __experimentalGetCurrentGlobalStylesId =\n\t() =>\n\tasync ( { dispatch, resolveSelect } ) => {\n\t\tconst activeThemes = await resolveSelect.getEntityRecords(\n\t\t\t'root',\n\t\t\t'theme',\n\t\t\t{ status: 'active' }\n\t\t);\n\t\tconst globalStylesURL =\n\t\t\tactiveThemes?.[ 0 ]?._links?.[ 'wp:user-global-styles' ]?.[ 0 ]\n\t\t\t\t?.href;\n\t\tif ( globalStylesURL ) {\n\t\t\tconst globalStylesObject = await apiFetch( {\n\t\t\t\turl: globalStylesURL,\n\t\t\t} );\n\t\t\tdispatch.__experimentalReceiveCurrentGlobalStylesId(\n\t\t\t\tglobalStylesObject.id\n\t\t\t);\n\t\t}\n\t};\n\nexport const __experimentalGetCurrentThemeBaseGlobalStyles =\n\t() =>\n\tasync ( { resolveSelect, dispatch } ) => {\n\t\tconst currentTheme = await resolveSelect.getCurrentTheme();\n\t\tconst themeGlobalStyles = await apiFetch( {\n\t\t\tpath: `/wp/v2/global-styles/themes/${ currentTheme.stylesheet }`,\n\t\t} );\n\t\tdispatch.__experimentalReceiveThemeBaseGlobalStyles(\n\t\t\tcurrentTheme.stylesheet,\n\t\t\tthemeGlobalStyles\n\t\t);\n\t};\n\nexport const __experimentalGetCurrentThemeGlobalStylesVariations =\n\t() =>\n\tasync ( { resolveSelect, dispatch } ) => {\n\t\tconst currentTheme = await resolveSelect.getCurrentTheme();\n\t\tconst variations = await apiFetch( {\n\t\t\tpath: `/wp/v2/global-styles/themes/${ currentTheme.stylesheet }/variations`,\n\t\t} );\n\t\tdispatch.__experimentalReceiveThemeGlobalStyleVariations(\n\t\t\tcurrentTheme.stylesheet,\n\t\t\tvariations\n\t\t);\n\t};\n\n/**\n * Fetches and returns the revisions of the current global styles theme.\n */\nexport const getCurrentThemeGlobalStylesRevisions =\n\t() =>\n\tasync ( { resolveSelect, dispatch } ) => {\n\t\tconst globalStylesId =\n\t\t\tawait resolveSelect.__experimentalGetCurrentGlobalStylesId();\n\t\tconst record = globalStylesId\n\t\t\t? await resolveSelect.getEntityRecord(\n\t\t\t\t\t'root',\n\t\t\t\t\t'globalStyles',\n\t\t\t\t\tglobalStylesId\n\t\t\t )\n\t\t\t: undefined;\n\t\tconst revisionsURL = record?._links?.[ 'version-history' ]?.[ 0 ]?.href;\n\n\t\tif ( revisionsURL ) {\n\t\t\tconst resetRevisions = await apiFetch( {\n\t\t\t\turl: revisionsURL,\n\t\t\t} );\n\t\t\tconst revisions = resetRevisions?.map( ( revision ) =>\n\t\t\t\tObject.fromEntries(\n\t\t\t\t\tObject.entries( revision ).map( ( [ key, value ] ) => [\n\t\t\t\t\t\tcamelCase( key ),\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t] )\n\t\t\t\t)\n\t\t\t);\n\t\t\tdispatch.receiveThemeGlobalStyleRevisions(\n\t\t\t\tglobalStylesId,\n\t\t\t\trevisions\n\t\t\t);\n\t\t}\n\t};\n\ngetCurrentThemeGlobalStylesRevisions.shouldInvalidate = ( action ) => {\n\treturn (\n\t\taction.type === 'SAVE_ENTITY_RECORD_FINISH' &&\n\t\taction.kind === 'root' &&\n\t\t! action.error &&\n\t\taction.name === 'globalStyles'\n\t);\n};\n\nexport const getBlockPatterns =\n\t() =>\n\tasync ( { dispatch } ) => {\n\t\tconst restPatterns = await apiFetch( {\n\t\t\tpath: '/wp/v2/block-patterns/patterns',\n\t\t} );\n\t\tconst patterns = restPatterns?.map( ( pattern ) =>\n\t\t\tObject.fromEntries(\n\t\t\t\tObject.entries( pattern ).map( ( [ key, value ] ) => [\n\t\t\t\t\tcamelCase( key ),\n\t\t\t\t\tvalue,\n\t\t\t\t] )\n\t\t\t)\n\t\t);\n\t\tdispatch( { type: 'RECEIVE_BLOCK_PATTERNS', patterns } );\n\t};\n\nexport const getBlockPatternCategories =\n\t() =>\n\tasync ( { dispatch } ) => {\n\t\tconst categories = await apiFetch( {\n\t\t\tpath: '/wp/v2/block-patterns/categories',\n\t\t} );\n\t\tdispatch( { type: 'RECEIVE_BLOCK_PATTERN_CATEGORIES', categories } );\n\t};\n\nexport const getUserPatternCategories =\n\t() =>\n\tasync ( { dispatch, resolveSelect } ) => {\n\t\tconst patternCategories = await resolveSelect.getEntityRecords(\n\t\t\t'taxonomy',\n\t\t\t'wp_pattern_category',\n\t\t\t{\n\t\t\t\tper_page: -1,\n\t\t\t\t_fields: 'id,name,description,slug',\n\t\t\t\tcontext: 'view',\n\t\t\t}\n\t\t);\n\n\t\tconst mappedPatternCategories =\n\t\t\tpatternCategories?.map( ( userCategory ) => ( {\n\t\t\t\t...userCategory,\n\t\t\t\tlabel: decodeEntities( userCategory.name ),\n\t\t\t\tname: userCategory.slug,\n\t\t\t} ) ) || [];\n\n\t\tdispatch( {\n\t\t\ttype: 'RECEIVE_USER_PATTERN_CATEGORIES',\n\t\t\tpatternCategories: mappedPatternCategories,\n\t\t} );\n\t};\n\nexport const getNavigationFallbackId =\n\t() =>\n\tasync ( { dispatch, select } ) => {\n\t\tconst fallback = await apiFetch( {\n\t\t\tpath: addQueryArgs( '/wp-block-editor/v1/navigation-fallback', {\n\t\t\t\t_embed: true,\n\t\t\t} ),\n\t\t} );\n\n\t\tconst record = fallback?._embedded?.self;\n\n\t\tdispatch.receiveNavigationFallbackId( fallback?.id );\n\n\t\tif ( record ) {\n\t\t\t// If the fallback is already in the store, don't invalidate navigation queries.\n\t\t\t// Otherwise, invalidate the cache for the scenario where there were no Navigation\n\t\t\t// posts in the state and the fallback created one.\n\t\t\tconst existingFallbackEntityRecord = select.getEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_navigation',\n\t\t\t\tfallback?.id\n\t\t\t);\n\t\t\tconst invalidateNavigationQueries = ! existingFallbackEntityRecord;\n\t\t\tdispatch.receiveEntityRecords(\n\t\t\t\t'postType',\n\t\t\t\t'wp_navigation',\n\t\t\t\trecord,\n\t\t\t\tundefined,\n\t\t\t\tinvalidateNavigationQueries\n\t\t\t);\n\n\t\t\t// Resolve to avoid further network requests.\n\t\t\tdispatch.finishResolution( 'getEntityRecord', [\n\t\t\t\t'postType',\n\t\t\t\t'wp_navigation',\n\t\t\t\tfallback?.id,\n\t\t\t] );\n\t\t}\n\t};\n\nexport const getDefaultTemplateId =\n\t( query ) =>\n\tasync ( { dispatch } ) => {\n\t\tconst template = await apiFetch( {\n\t\t\tpath: addQueryArgs( '/wp/v2/templates/lookup', query ),\n\t\t} );\n\t\tif ( template ) {\n\t\t\tdispatch.receiveDefaultTemplateId( query, template.id );\n\t\t}\n\t};\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAKA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAKA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,KAAA,GAAAR,OAAA;AAlBA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMS,UAAU,GACpBC,KAAK,IACP,OAAQ;EAAEC;AAAS,CAAC,KAAM;EACzB,MAAMC,IAAI,GAAG,IAAAC,iBAAY,EACxB,wCAAwC,EACxCH,KACD,CAAC;EACD,MAAMI,KAAK,GAAG,MAAM,IAAAC,iBAAQ,EAAE;IAAEH;EAAK,CAAE,CAAC;EACxCD,QAAQ,CAACK,gBAAgB,CAAEJ,IAAI,EAAEE,KAAM,CAAC;AACzC,CAAC;;AAEF;AACA;AACA;AAFAG,OA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AE,CAAC;EAEH,MAAMhJ,MAAM,GAAG+I,QAAQ,EAAEE,SAAS,EAAEC,IAAI;EAExCtL,QAAQ,CAACuL,2BAA2B,CAAEJ,QAAQ,EAAEjF,EAAG,CAAC;EAEpD,IAAK9D,MAAM,EAAG;IACb;IACA;IACA;IACA,MAAMoJ,4BAA4B,GAAG1K,MAAM,CAACJ,eAAe,CAC1D,UAAU,EACV,eAAe,EACfyK,QAAQ,EAAEjF,EACX,CAAC;IACD,MAAMuF,2BAA2B,GAAG,CAAED,4BAA4B;IAClExL,QAAQ,CAACqC,oBAAoB,CAC5B,UAAU,EACV,eAAe,EACfD,MAAM,EACNO,SAAS,EACT8I,2BACD,CAAC;;IAED;IACAzL,QAAQ,CAAC0L,gBAAgB,CAAE,iBAAiB,EAAE,CAC7C,UAAU,EACV,eAAe,EACfP,QAAQ,EAAEjF,EAAE,CACX,CAAC;EACJ;AACD,CAAC;AAAC5F,OAAA,CAAA4K,uBAAA,GAAAA,uBAAA;AAEI,MAAMS,oBAAoB,GAC9B5L,KAAK,IACP,OAAQ;EAAEC;AAAS,CAAC,KAAM;EACzB,MAAMyI,QAAQ,GAAG,MAAM,IAAArI,iBAAQ,EAAE;IAChCH,IAAI,EAAE,IAAAC,iBAAY,EAAE,yBAAyB,EAAEH,KAAM;EACtD,CAAE,CAAC;EACH,IAAK0I,QAAQ,EAAG;IACfzI,QAAQ,CAAC4L,wBAAwB,CAAE7L,KAAK,EAAE0I,QAAQ,CAACvC,EAAG,CAAC;EACxD;AACD,CAAC;AAAC5F,OAAA,CAAAqL,oBAAA,GAAAA,oBAAA"}
|
|
1
|
+
{"version":3,"names":["_changeCase","require","_url","_htmlEntities","_apiFetch","_interopRequireDefault","_name","_entities","_utils","_sync","getAuthors","query","dispatch","path","addQueryArgs","users","apiFetch","receiveUserQuery","exports","getCurrentUser","currentUser","receiveCurrentUser","getEntityRecord","kind","name","key","select","configs","getOrLoadEntitiesConfig","entityConfig","find","config","__experimentalNoFetch","lock","__unstableAcquireStoreLock","STORE_NAME","exclusive","window","__experimentalEnableSync","syncConfig","process","env","IS_GUTENBERG_PLUGIN","objectId","getSyncObjectId","getSyncProvider","bootstrap","syncObjectType","record","receiveEntityRecords","type","recordId","edits","meta","undo","undefined","_fields","Set","getNormalizedCommaSeparable","DEFAULT_ENTITY_KEY","join","baseURL","baseURLParams","include","hasRecords","hasEntityRecords","__unstableReleaseStoreLock","getRawEntityRecord","forwardResolver","getEditedEntityRecord","getEntityRecords","records","supportsPagination","per_page","response","parse","Object","values","json","totalItems","parseInt","headers","get","map","split","forEach","field","hasOwnProperty","context","resolutionsArgs","filter","selectorName","args","shouldInvalidate","action","invalidateCache","getCurrentTheme","resolveSelect","activeThemes","status","receiveCurrentTheme","getThemeSupports","getEmbedPreview","url","embedProxyResponse","receiveEmbedPreview","error","canUser","requestedAction","resource","id","registry","hasStartedResolution","resourcePath","retrievedActions","includes","Error","relatedAction","isAlreadyResolving","method","allowHeader","allowedMethods","allow","permissions","methods","create","read","update","delete","actionName","methodName","entries","receiveUserPermission","canUserEditEntityRecord","__unstable_rest_base","getAutosaves","postType","postId","rest_base","restBase","rest_namespace","restNamespace","getPostType","autosaves","length","receiveAutosaves","getAutosave","__experimentalGetTemplateForLink","link","template","then","data","e","__experimentalGetCurrentGlobalStylesId","globalStylesURL","_links","href","globalStylesObject","__experimentalReceiveCurrentGlobalStylesId","__experimentalGetCurrentThemeBaseGlobalStyles","currentTheme","themeGlobalStyles","stylesheet","__experimentalReceiveThemeBaseGlobalStyles","__experimentalGetCurrentThemeGlobalStylesVariations","variations","__experimentalReceiveThemeGlobalStyleVariations","getCurrentThemeGlobalStylesRevisions","globalStylesId","revisionsURL","resetRevisions","revisions","revision","fromEntries","value","camelCase","receiveThemeGlobalStyleRevisions","getBlockPatterns","restPatterns","patterns","pattern","getBlockPatternCategories","categories","getUserPatternCategories","patternCategories","mappedPatternCategories","userCategory","label","decodeEntities","slug","getNavigationFallbackId","fallback","_embed","_embedded","self","receiveNavigationFallbackId","existingFallbackEntityRecord","invalidateNavigationQueries","finishResolution","getDefaultTemplateId","receiveDefaultTemplateId","getRevisions","recordKey","revisionKey","getRevisionsUrl","isPaginated","receiveRevisions","getRevision"],"sources":["@wordpress/core-data/src/resolvers.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { camelCase } from 'change-case';\n\n/**\n * WordPress dependencies\n */\nimport { addQueryArgs } from '@wordpress/url';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport apiFetch from '@wordpress/api-fetch';\n\n/**\n * Internal dependencies\n */\nimport { STORE_NAME } from './name';\nimport { getOrLoadEntitiesConfig, DEFAULT_ENTITY_KEY } from './entities';\nimport { forwardResolver, getNormalizedCommaSeparable } from './utils';\nimport { getSyncProvider } from './sync';\n\n/**\n * Requests authors from the REST API.\n *\n * @param {Object|undefined} query Optional object of query parameters to\n * include with request.\n */\nexport const getAuthors =\n\t( query ) =>\n\tasync ( { dispatch } ) => {\n\t\tconst path = addQueryArgs(\n\t\t\t'/wp/v2/users/?who=authors&per_page=100',\n\t\t\tquery\n\t\t);\n\t\tconst users = await apiFetch( { path } );\n\t\tdispatch.receiveUserQuery( path, users );\n\t};\n\n/**\n * Requests the current user from the REST API.\n */\nexport const getCurrentUser =\n\t() =>\n\tasync ( { dispatch } ) => {\n\t\tconst currentUser = await apiFetch( { path: '/wp/v2/users/me' } );\n\t\tdispatch.receiveCurrentUser( currentUser );\n\t};\n\n/**\n * Requests an entity's record from the REST API.\n *\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number|string} key Record's key\n * @param {Object|undefined} query Optional object of query parameters to\n * include with request. If requesting specific\n * fields, fields must always include the ID.\n */\nexport const getEntityRecord =\n\t( kind, name, key = '', query ) =>\n\tasync ( { select, dispatch } ) => {\n\t\tconst configs = await dispatch( getOrLoadEntitiesConfig( kind ) );\n\t\tconst entityConfig = configs.find(\n\t\t\t( config ) => config.name === name && config.kind === kind\n\t\t);\n\t\tif ( ! entityConfig || entityConfig?.__experimentalNoFetch ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst lock = await dispatch.__unstableAcquireStoreLock(\n\t\t\tSTORE_NAME,\n\t\t\t[ 'entities', 'records', kind, name, key ],\n\t\t\t{ exclusive: false }\n\t\t);\n\n\t\ttry {\n\t\t\t// Entity supports configs,\n\t\t\t// use the sync algorithm instead of the old fetch behavior.\n\t\t\tif (\n\t\t\t\twindow.__experimentalEnableSync &&\n\t\t\t\tentityConfig.syncConfig &&\n\t\t\t\t! query\n\t\t\t) {\n\t\t\t\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\t\t\t\tconst objectId = entityConfig.getSyncObjectId( key );\n\n\t\t\t\t\t// Loads the persisted document.\n\t\t\t\t\tawait getSyncProvider().bootstrap(\n\t\t\t\t\t\tentityConfig.syncObjectType,\n\t\t\t\t\t\tobjectId,\n\t\t\t\t\t\t( record ) => {\n\t\t\t\t\t\t\tdispatch.receiveEntityRecords(\n\t\t\t\t\t\t\t\tkind,\n\t\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\t\trecord,\n\t\t\t\t\t\t\t\tquery\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\n\t\t\t\t\t// Boostraps the edited document as well (and load from peers).\n\t\t\t\t\tawait getSyncProvider().bootstrap(\n\t\t\t\t\t\tentityConfig.syncObjectType + '--edit',\n\t\t\t\t\t\tobjectId,\n\t\t\t\t\t\t( record ) => {\n\t\t\t\t\t\t\tdispatch( {\n\t\t\t\t\t\t\t\ttype: 'EDIT_ENTITY_RECORD',\n\t\t\t\t\t\t\t\tkind,\n\t\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\t\trecordId: key,\n\t\t\t\t\t\t\t\tedits: record,\n\t\t\t\t\t\t\t\tmeta: {\n\t\t\t\t\t\t\t\t\tundo: undefined,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif ( query !== undefined && query._fields ) {\n\t\t\t\t\t// If requesting specific fields, items and query association to said\n\t\t\t\t\t// records are stored by ID reference. Thus, fields must always include\n\t\t\t\t\t// the ID.\n\t\t\t\t\tquery = {\n\t\t\t\t\t\t...query,\n\t\t\t\t\t\t_fields: [\n\t\t\t\t\t\t\t...new Set( [\n\t\t\t\t\t\t\t\t...( getNormalizedCommaSeparable(\n\t\t\t\t\t\t\t\t\tquery._fields\n\t\t\t\t\t\t\t\t) || [] ),\n\t\t\t\t\t\t\t\tentityConfig.key || DEFAULT_ENTITY_KEY,\n\t\t\t\t\t\t\t] ),\n\t\t\t\t\t\t].join(),\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\t// Disable reason: While true that an early return could leave `path`\n\t\t\t\t// unused, it's important that path is derived using the query prior to\n\t\t\t\t// additional query modifications in the condition below, since those\n\t\t\t\t// modifications are relevant to how the data is tracked in state, and not\n\t\t\t\t// for how the request is made to the REST API.\n\n\t\t\t\t// eslint-disable-next-line @wordpress/no-unused-vars-before-return\n\t\t\t\tconst path = addQueryArgs(\n\t\t\t\t\tentityConfig.baseURL + ( key ? '/' + key : '' ),\n\t\t\t\t\t{\n\t\t\t\t\t\t...entityConfig.baseURLParams,\n\t\t\t\t\t\t...query,\n\t\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t\tif ( query !== undefined ) {\n\t\t\t\t\tquery = { ...query, include: [ key ] };\n\n\t\t\t\t\t// The resolution cache won't consider query as reusable based on the\n\t\t\t\t\t// fields, so it's tested here, prior to initiating the REST request,\n\t\t\t\t\t// and without causing `getEntityRecords` resolution to occur.\n\t\t\t\t\tconst hasRecords = select.hasEntityRecords(\n\t\t\t\t\t\tkind,\n\t\t\t\t\t\tname,\n\t\t\t\t\t\tquery\n\t\t\t\t\t);\n\t\t\t\t\tif ( hasRecords ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst record = await apiFetch( { path } );\n\t\t\t\tdispatch.receiveEntityRecords( kind, name, record, query );\n\t\t\t}\n\t\t} finally {\n\t\t\tdispatch.__unstableReleaseStoreLock( lock );\n\t\t}\n\t};\n\n/**\n * Requests an entity's record from the REST API.\n */\nexport const getRawEntityRecord = forwardResolver( 'getEntityRecord' );\n\n/**\n * Requests an entity's record from the REST API.\n */\nexport const getEditedEntityRecord = forwardResolver( 'getEntityRecord' );\n\n/**\n * Requests the entity's records from the REST API.\n *\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {Object?} query Query Object. If requesting specific fields, fields\n * must always include the ID.\n */\nexport const getEntityRecords =\n\t( kind, name, query = {} ) =>\n\tasync ( { dispatch } ) => {\n\t\tconst configs = await dispatch( getOrLoadEntitiesConfig( kind ) );\n\t\tconst entityConfig = configs.find(\n\t\t\t( config ) => config.name === name && config.kind === kind\n\t\t);\n\t\tif ( ! entityConfig || entityConfig?.__experimentalNoFetch ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst lock = await dispatch.__unstableAcquireStoreLock(\n\t\t\tSTORE_NAME,\n\t\t\t[ 'entities', 'records', kind, name ],\n\t\t\t{ exclusive: false }\n\t\t);\n\n\t\ttry {\n\t\t\tif ( query._fields ) {\n\t\t\t\t// If requesting specific fields, items and query association to said\n\t\t\t\t// records are stored by ID reference. Thus, fields must always include\n\t\t\t\t// the ID.\n\t\t\t\tquery = {\n\t\t\t\t\t...query,\n\t\t\t\t\t_fields: [\n\t\t\t\t\t\t...new Set( [\n\t\t\t\t\t\t\t...( getNormalizedCommaSeparable( query._fields ) ||\n\t\t\t\t\t\t\t\t[] ),\n\t\t\t\t\t\t\tentityConfig.key || DEFAULT_ENTITY_KEY,\n\t\t\t\t\t\t] ),\n\t\t\t\t\t].join(),\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst path = addQueryArgs( entityConfig.baseURL, {\n\t\t\t\t...entityConfig.baseURLParams,\n\t\t\t\t...query,\n\t\t\t} );\n\n\t\t\tlet records, meta;\n\t\t\tif ( entityConfig.supportsPagination && query.per_page !== -1 ) {\n\t\t\t\tconst response = await apiFetch( { path, parse: false } );\n\t\t\t\trecords = Object.values( await response.json() );\n\t\t\t\tmeta = {\n\t\t\t\t\ttotalItems: parseInt(\n\t\t\t\t\t\tresponse.headers.get( 'X-WP-Total' )\n\t\t\t\t\t),\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\trecords = Object.values( await apiFetch( { path } ) );\n\t\t\t}\n\n\t\t\t// If we request fields but the result doesn't contain the fields,\n\t\t\t// explicitly set these fields as \"undefined\"\n\t\t\t// that way we consider the query \"fulfilled\".\n\t\t\tif ( query._fields ) {\n\t\t\t\trecords = records.map( ( record ) => {\n\t\t\t\t\tquery._fields.split( ',' ).forEach( ( field ) => {\n\t\t\t\t\t\tif ( ! record.hasOwnProperty( field ) ) {\n\t\t\t\t\t\t\trecord[ field ] = undefined;\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\n\t\t\t\t\treturn record;\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tdispatch.receiveEntityRecords(\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\trecords,\n\t\t\t\tquery,\n\t\t\t\tfalse,\n\t\t\t\tundefined,\n\t\t\t\tmeta\n\t\t\t);\n\n\t\t\t// When requesting all fields, the list of results can be used to\n\t\t\t// resolve the `getEntityRecord` selector in addition to `getEntityRecords`.\n\t\t\t// See https://github.com/WordPress/gutenberg/pull/26575\n\t\t\tif ( ! query?._fields && ! query.context ) {\n\t\t\t\tconst key = entityConfig.key || DEFAULT_ENTITY_KEY;\n\t\t\t\tconst resolutionsArgs = records\n\t\t\t\t\t.filter( ( record ) => record[ key ] )\n\t\t\t\t\t.map( ( record ) => [ kind, name, record[ key ] ] );\n\n\t\t\t\tdispatch( {\n\t\t\t\t\ttype: 'START_RESOLUTIONS',\n\t\t\t\t\tselectorName: 'getEntityRecord',\n\t\t\t\t\targs: resolutionsArgs,\n\t\t\t\t} );\n\t\t\t\tdispatch( {\n\t\t\t\t\ttype: 'FINISH_RESOLUTIONS',\n\t\t\t\t\tselectorName: 'getEntityRecord',\n\t\t\t\t\targs: resolutionsArgs,\n\t\t\t\t} );\n\t\t\t}\n\t\t} finally {\n\t\t\tdispatch.__unstableReleaseStoreLock( lock );\n\t\t}\n\t};\n\ngetEntityRecords.shouldInvalidate = ( action, kind, name ) => {\n\treturn (\n\t\t( action.type === 'RECEIVE_ITEMS' || action.type === 'REMOVE_ITEMS' ) &&\n\t\taction.invalidateCache &&\n\t\tkind === action.kind &&\n\t\tname === action.name\n\t);\n};\n\n/**\n * Requests the current theme.\n */\nexport const getCurrentTheme =\n\t() =>\n\tasync ( { dispatch, resolveSelect } ) => {\n\t\tconst activeThemes = await resolveSelect.getEntityRecords(\n\t\t\t'root',\n\t\t\t'theme',\n\t\t\t{ status: 'active' }\n\t\t);\n\n\t\tdispatch.receiveCurrentTheme( activeThemes[ 0 ] );\n\t};\n\n/**\n * Requests theme supports data from the index.\n */\nexport const getThemeSupports = forwardResolver( 'getCurrentTheme' );\n\n/**\n * Requests a preview from the Embed API.\n *\n * @param {string} url URL to get the preview for.\n */\nexport const getEmbedPreview =\n\t( url ) =>\n\tasync ( { dispatch } ) => {\n\t\ttry {\n\t\t\tconst embedProxyResponse = await apiFetch( {\n\t\t\t\tpath: addQueryArgs( '/oembed/1.0/proxy', { url } ),\n\t\t\t} );\n\t\t\tdispatch.receiveEmbedPreview( url, embedProxyResponse );\n\t\t} catch ( error ) {\n\t\t\t// Embed API 404s if the URL cannot be embedded, so we have to catch the error from the apiRequest here.\n\t\t\tdispatch.receiveEmbedPreview( url, false );\n\t\t}\n\t};\n\n/**\n * Checks whether the current user can perform the given action on the given\n * REST resource.\n *\n * @param {string} requestedAction Action to check. One of: 'create', 'read', 'update',\n * 'delete'.\n * @param {string} resource REST resource to check, e.g. 'media' or 'posts'.\n * @param {?string} id ID of the rest resource to check.\n */\nexport const canUser =\n\t( requestedAction, resource, id ) =>\n\tasync ( { dispatch, registry } ) => {\n\t\tconst { hasStartedResolution } = registry.select( STORE_NAME );\n\n\t\tconst resourcePath = id ? `${ resource }/${ id }` : resource;\n\t\tconst retrievedActions = [ 'create', 'read', 'update', 'delete' ];\n\n\t\tif ( ! retrievedActions.includes( requestedAction ) ) {\n\t\t\tthrow new Error( `'${ requestedAction }' is not a valid action.` );\n\t\t}\n\n\t\t// Prevent resolving the same resource twice.\n\t\tfor ( const relatedAction of retrievedActions ) {\n\t\t\tif ( relatedAction === requestedAction ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst isAlreadyResolving = hasStartedResolution( 'canUser', [\n\t\t\t\trelatedAction,\n\t\t\t\tresource,\n\t\t\t\tid,\n\t\t\t] );\n\t\t\tif ( isAlreadyResolving ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tlet response;\n\t\ttry {\n\t\t\tresponse = await apiFetch( {\n\t\t\t\tpath: `/wp/v2/${ resourcePath }`,\n\t\t\t\tmethod: 'OPTIONS',\n\t\t\t\tparse: false,\n\t\t\t} );\n\t\t} catch ( error ) {\n\t\t\t// Do nothing if our OPTIONS request comes back with an API error (4xx or\n\t\t\t// 5xx). The previously determined isAllowed value will remain in the store.\n\t\t\treturn;\n\t\t}\n\n\t\t// Optional chaining operator is used here because the API requests don't\n\t\t// return the expected result in the native version. Instead, API requests\n\t\t// only return the result, without including response properties like the headers.\n\t\tconst allowHeader = response.headers?.get( 'allow' );\n\t\tconst allowedMethods = allowHeader?.allow || allowHeader || '';\n\n\t\tconst permissions = {};\n\t\tconst methods = {\n\t\t\tcreate: 'POST',\n\t\t\tread: 'GET',\n\t\t\tupdate: 'PUT',\n\t\t\tdelete: 'DELETE',\n\t\t};\n\t\tfor ( const [ actionName, methodName ] of Object.entries( methods ) ) {\n\t\t\tpermissions[ actionName ] = allowedMethods.includes( methodName );\n\t\t}\n\n\t\tfor ( const action of retrievedActions ) {\n\t\t\tdispatch.receiveUserPermission(\n\t\t\t\t`${ action }/${ resourcePath }`,\n\t\t\t\tpermissions[ action ]\n\t\t\t);\n\t\t}\n\t};\n\n/**\n * Checks whether the current user can perform the given action on the given\n * REST resource.\n *\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {string} recordId Record's id.\n */\nexport const canUserEditEntityRecord =\n\t( kind, name, recordId ) =>\n\tasync ( { dispatch } ) => {\n\t\tconst configs = await dispatch( getOrLoadEntitiesConfig( kind ) );\n\t\tconst entityConfig = configs.find(\n\t\t\t( config ) => config.name === name && config.kind === kind\n\t\t);\n\t\tif ( ! entityConfig ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst resource = entityConfig.__unstable_rest_base;\n\t\tawait dispatch( canUser( 'update', resource, recordId ) );\n\t};\n\n/**\n * Request autosave data from the REST API.\n *\n * @param {string} postType The type of the parent post.\n * @param {number} postId The id of the parent post.\n */\nexport const getAutosaves =\n\t( postType, postId ) =>\n\tasync ( { dispatch, resolveSelect } ) => {\n\t\tconst { rest_base: restBase, rest_namespace: restNamespace = 'wp/v2' } =\n\t\t\tawait resolveSelect.getPostType( postType );\n\t\tconst autosaves = await apiFetch( {\n\t\t\tpath: `/${ restNamespace }/${ restBase }/${ postId }/autosaves?context=edit`,\n\t\t} );\n\n\t\tif ( autosaves && autosaves.length ) {\n\t\t\tdispatch.receiveAutosaves( postId, autosaves );\n\t\t}\n\t};\n\n/**\n * Request autosave data from the REST API.\n *\n * This resolver exists to ensure the underlying autosaves are fetched via\n * `getAutosaves` when a call to the `getAutosave` selector is made.\n *\n * @param {string} postType The type of the parent post.\n * @param {number} postId The id of the parent post.\n */\nexport const getAutosave =\n\t( postType, postId ) =>\n\tasync ( { resolveSelect } ) => {\n\t\tawait resolveSelect.getAutosaves( postType, postId );\n\t};\n\n/**\n * Retrieve the frontend template used for a given link.\n *\n * @param {string} link Link.\n */\nexport const __experimentalGetTemplateForLink =\n\t( link ) =>\n\tasync ( { dispatch, resolveSelect } ) => {\n\t\tlet template;\n\t\ttry {\n\t\t\t// This is NOT calling a REST endpoint but rather ends up with a response from\n\t\t\t// an Ajax function which has a different shape from a WP_REST_Response.\n\t\t\ttemplate = await apiFetch( {\n\t\t\t\turl: addQueryArgs( link, {\n\t\t\t\t\t'_wp-find-template': true,\n\t\t\t\t} ),\n\t\t\t} ).then( ( { data } ) => data );\n\t\t} catch ( e ) {\n\t\t\t// For non-FSE themes, it is possible that this request returns an error.\n\t\t}\n\n\t\tif ( ! template ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst record = await resolveSelect.getEntityRecord(\n\t\t\t'postType',\n\t\t\t'wp_template',\n\t\t\ttemplate.id\n\t\t);\n\n\t\tif ( record ) {\n\t\t\tdispatch.receiveEntityRecords(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template',\n\t\t\t\t[ record ],\n\t\t\t\t{\n\t\t\t\t\t'find-template': link,\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t};\n\n__experimentalGetTemplateForLink.shouldInvalidate = ( action ) => {\n\treturn (\n\t\t( action.type === 'RECEIVE_ITEMS' || action.type === 'REMOVE_ITEMS' ) &&\n\t\taction.invalidateCache &&\n\t\taction.kind === 'postType' &&\n\t\taction.name === 'wp_template'\n\t);\n};\n\nexport const __experimentalGetCurrentGlobalStylesId =\n\t() =>\n\tasync ( { dispatch, resolveSelect } ) => {\n\t\tconst activeThemes = await resolveSelect.getEntityRecords(\n\t\t\t'root',\n\t\t\t'theme',\n\t\t\t{ status: 'active' }\n\t\t);\n\t\tconst globalStylesURL =\n\t\t\tactiveThemes?.[ 0 ]?._links?.[ 'wp:user-global-styles' ]?.[ 0 ]\n\t\t\t\t?.href;\n\t\tif ( globalStylesURL ) {\n\t\t\tconst globalStylesObject = await apiFetch( {\n\t\t\t\turl: globalStylesURL,\n\t\t\t} );\n\t\t\tdispatch.__experimentalReceiveCurrentGlobalStylesId(\n\t\t\t\tglobalStylesObject.id\n\t\t\t);\n\t\t}\n\t};\n\nexport const __experimentalGetCurrentThemeBaseGlobalStyles =\n\t() =>\n\tasync ( { resolveSelect, dispatch } ) => {\n\t\tconst currentTheme = await resolveSelect.getCurrentTheme();\n\t\tconst themeGlobalStyles = await apiFetch( {\n\t\t\tpath: `/wp/v2/global-styles/themes/${ currentTheme.stylesheet }`,\n\t\t} );\n\t\tdispatch.__experimentalReceiveThemeBaseGlobalStyles(\n\t\t\tcurrentTheme.stylesheet,\n\t\t\tthemeGlobalStyles\n\t\t);\n\t};\n\nexport const __experimentalGetCurrentThemeGlobalStylesVariations =\n\t() =>\n\tasync ( { resolveSelect, dispatch } ) => {\n\t\tconst currentTheme = await resolveSelect.getCurrentTheme();\n\t\tconst variations = await apiFetch( {\n\t\t\tpath: `/wp/v2/global-styles/themes/${ currentTheme.stylesheet }/variations`,\n\t\t} );\n\t\tdispatch.__experimentalReceiveThemeGlobalStyleVariations(\n\t\t\tcurrentTheme.stylesheet,\n\t\t\tvariations\n\t\t);\n\t};\n\n/**\n * Fetches and returns the revisions of the current global styles theme.\n */\nexport const getCurrentThemeGlobalStylesRevisions =\n\t() =>\n\tasync ( { resolveSelect, dispatch } ) => {\n\t\tconst globalStylesId =\n\t\t\tawait resolveSelect.__experimentalGetCurrentGlobalStylesId();\n\t\tconst record = globalStylesId\n\t\t\t? await resolveSelect.getEntityRecord(\n\t\t\t\t\t'root',\n\t\t\t\t\t'globalStyles',\n\t\t\t\t\tglobalStylesId\n\t\t\t )\n\t\t\t: undefined;\n\t\tconst revisionsURL = record?._links?.[ 'version-history' ]?.[ 0 ]?.href;\n\n\t\tif ( revisionsURL ) {\n\t\t\tconst resetRevisions = await apiFetch( {\n\t\t\t\turl: revisionsURL,\n\t\t\t} );\n\t\t\tconst revisions = resetRevisions?.map( ( revision ) =>\n\t\t\t\tObject.fromEntries(\n\t\t\t\t\tObject.entries( revision ).map( ( [ key, value ] ) => [\n\t\t\t\t\t\tcamelCase( key ),\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t] )\n\t\t\t\t)\n\t\t\t);\n\t\t\tdispatch.receiveThemeGlobalStyleRevisions(\n\t\t\t\tglobalStylesId,\n\t\t\t\trevisions\n\t\t\t);\n\t\t}\n\t};\n\ngetCurrentThemeGlobalStylesRevisions.shouldInvalidate = ( action ) => {\n\treturn (\n\t\taction.type === 'SAVE_ENTITY_RECORD_FINISH' &&\n\t\taction.kind === 'root' &&\n\t\t! action.error &&\n\t\taction.name === 'globalStyles'\n\t);\n};\n\nexport const getBlockPatterns =\n\t() =>\n\tasync ( { dispatch } ) => {\n\t\tconst restPatterns = await apiFetch( {\n\t\t\tpath: '/wp/v2/block-patterns/patterns',\n\t\t} );\n\t\tconst patterns = restPatterns?.map( ( pattern ) =>\n\t\t\tObject.fromEntries(\n\t\t\t\tObject.entries( pattern ).map( ( [ key, value ] ) => [\n\t\t\t\t\tcamelCase( key ),\n\t\t\t\t\tvalue,\n\t\t\t\t] )\n\t\t\t)\n\t\t);\n\t\tdispatch( { type: 'RECEIVE_BLOCK_PATTERNS', patterns } );\n\t};\n\nexport const getBlockPatternCategories =\n\t() =>\n\tasync ( { dispatch } ) => {\n\t\tconst categories = await apiFetch( {\n\t\t\tpath: '/wp/v2/block-patterns/categories',\n\t\t} );\n\t\tdispatch( { type: 'RECEIVE_BLOCK_PATTERN_CATEGORIES', categories } );\n\t};\n\nexport const getUserPatternCategories =\n\t() =>\n\tasync ( { dispatch, resolveSelect } ) => {\n\t\tconst patternCategories = await resolveSelect.getEntityRecords(\n\t\t\t'taxonomy',\n\t\t\t'wp_pattern_category',\n\t\t\t{\n\t\t\t\tper_page: -1,\n\t\t\t\t_fields: 'id,name,description,slug',\n\t\t\t\tcontext: 'view',\n\t\t\t}\n\t\t);\n\n\t\tconst mappedPatternCategories =\n\t\t\tpatternCategories?.map( ( userCategory ) => ( {\n\t\t\t\t...userCategory,\n\t\t\t\tlabel: decodeEntities( userCategory.name ),\n\t\t\t\tname: userCategory.slug,\n\t\t\t} ) ) || [];\n\n\t\tdispatch( {\n\t\t\ttype: 'RECEIVE_USER_PATTERN_CATEGORIES',\n\t\t\tpatternCategories: mappedPatternCategories,\n\t\t} );\n\t};\n\nexport const getNavigationFallbackId =\n\t() =>\n\tasync ( { dispatch, select } ) => {\n\t\tconst fallback = await apiFetch( {\n\t\t\tpath: addQueryArgs( '/wp-block-editor/v1/navigation-fallback', {\n\t\t\t\t_embed: true,\n\t\t\t} ),\n\t\t} );\n\n\t\tconst record = fallback?._embedded?.self;\n\n\t\tdispatch.receiveNavigationFallbackId( fallback?.id );\n\n\t\tif ( record ) {\n\t\t\t// If the fallback is already in the store, don't invalidate navigation queries.\n\t\t\t// Otherwise, invalidate the cache for the scenario where there were no Navigation\n\t\t\t// posts in the state and the fallback created one.\n\t\t\tconst existingFallbackEntityRecord = select.getEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_navigation',\n\t\t\t\tfallback?.id\n\t\t\t);\n\t\t\tconst invalidateNavigationQueries = ! existingFallbackEntityRecord;\n\t\t\tdispatch.receiveEntityRecords(\n\t\t\t\t'postType',\n\t\t\t\t'wp_navigation',\n\t\t\t\trecord,\n\t\t\t\tundefined,\n\t\t\t\tinvalidateNavigationQueries\n\t\t\t);\n\n\t\t\t// Resolve to avoid further network requests.\n\t\t\tdispatch.finishResolution( 'getEntityRecord', [\n\t\t\t\t'postType',\n\t\t\t\t'wp_navigation',\n\t\t\t\tfallback?.id,\n\t\t\t] );\n\t\t}\n\t};\n\nexport const getDefaultTemplateId =\n\t( query ) =>\n\tasync ( { dispatch } ) => {\n\t\tconst template = await apiFetch( {\n\t\t\tpath: addQueryArgs( '/wp/v2/templates/lookup', query ),\n\t\t} );\n\t\tif ( template ) {\n\t\t\tdispatch.receiveDefaultTemplateId( query, template.id );\n\t\t}\n\t};\n\n/**\n * Requests an entity's revisions from the REST API.\n *\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number|string} recordKey The key of the entity record whose revisions you want to fetch.\n * @param {Object|undefined} query Optional object of query parameters to\n * include with request. If requesting specific\n * fields, fields must always include the ID.\n */\nexport const getRevisions =\n\t( kind, name, recordKey, query = {} ) =>\n\tasync ( { dispatch } ) => {\n\t\tconst configs = await dispatch( getOrLoadEntitiesConfig( kind ) );\n\t\tconst entityConfig = configs.find(\n\t\t\t( config ) => config.name === name && config.kind === kind\n\t\t);\n\n\t\tif ( ! entityConfig || entityConfig?.__experimentalNoFetch ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( query._fields ) {\n\t\t\t// If requesting specific fields, items and query association to said\n\t\t\t// records are stored by ID reference. Thus, fields must always include\n\t\t\t// the ID.\n\t\t\tquery = {\n\t\t\t\t...query,\n\t\t\t\t_fields: [\n\t\t\t\t\t...new Set( [\n\t\t\t\t\t\t...( getNormalizedCommaSeparable( query._fields ) ||\n\t\t\t\t\t\t\t[] ),\n\t\t\t\t\t\tentityConfig.revisionKey || DEFAULT_ENTITY_KEY,\n\t\t\t\t\t] ),\n\t\t\t\t].join(),\n\t\t\t};\n\t\t}\n\n\t\tconst path = addQueryArgs(\n\t\t\tentityConfig.getRevisionsUrl( recordKey ),\n\t\t\tquery\n\t\t);\n\n\t\tlet records, response;\n\t\tconst meta = {};\n\t\tconst isPaginated =\n\t\t\tentityConfig.supportsPagination && query.per_page !== -1;\n\t\ttry {\n\t\t\tresponse = await apiFetch( { path, parse: ! isPaginated } );\n\t\t} catch ( error ) {\n\t\t\t// Do nothing if our request comes back with an API error.\n\t\t\treturn;\n\t\t}\n\n\t\tif ( response ) {\n\t\t\tif ( isPaginated ) {\n\t\t\t\trecords = Object.values( await response.json() );\n\t\t\t\tmeta.totalItems = parseInt(\n\t\t\t\t\tresponse.headers.get( 'X-WP-Total' )\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\trecords = Object.values( response );\n\t\t\t}\n\n\t\t\t// If we request fields but the result doesn't contain the fields,\n\t\t\t// explicitly set these fields as \"undefined\"\n\t\t\t// that way we consider the query \"fulfilled\".\n\t\t\tif ( query._fields ) {\n\t\t\t\trecords = records.map( ( record ) => {\n\t\t\t\t\tquery._fields.split( ',' ).forEach( ( field ) => {\n\t\t\t\t\t\tif ( ! record.hasOwnProperty( field ) ) {\n\t\t\t\t\t\t\trecord[ field ] = undefined;\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\n\t\t\t\t\treturn record;\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tdispatch.receiveRevisions(\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\trecordKey,\n\t\t\t\trecords,\n\t\t\t\tquery,\n\t\t\t\tfalse,\n\t\t\t\tmeta\n\t\t\t);\n\n\t\t\t// When requesting all fields, the list of results can be used to\n\t\t\t// resolve the `getRevision` selector in addition to `getRevisions`.\n\t\t\tif ( ! query?._fields && ! query.context ) {\n\t\t\t\tconst key = entityConfig.key || DEFAULT_ENTITY_KEY;\n\t\t\t\tconst resolutionsArgs = records\n\t\t\t\t\t.filter( ( record ) => record[ key ] )\n\t\t\t\t\t.map( ( record ) => [\n\t\t\t\t\t\tkind,\n\t\t\t\t\t\tname,\n\t\t\t\t\t\trecordKey,\n\t\t\t\t\t\trecord[ key ],\n\t\t\t\t\t] );\n\n\t\t\t\tdispatch( {\n\t\t\t\t\ttype: 'START_RESOLUTIONS',\n\t\t\t\t\tselectorName: 'getRevision',\n\t\t\t\t\targs: resolutionsArgs,\n\t\t\t\t} );\n\t\t\t\tdispatch( {\n\t\t\t\t\ttype: 'FINISH_RESOLUTIONS',\n\t\t\t\t\tselectorName: 'getRevision',\n\t\t\t\t\targs: resolutionsArgs,\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t};\n\n// Invalidate cache when a new revision is created.\ngetRevisions.shouldInvalidate = ( action, kind, name, recordKey ) =>\n\taction.type === 'SAVE_ENTITY_RECORD_FINISH' &&\n\tname === action.name &&\n\tkind === action.kind &&\n\t! action.error &&\n\trecordKey === action.recordId;\n\n/**\n * Requests a specific Entity revision from the REST API.\n *\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number|string} recordKey The key of the entity record whose revisions you want to fetch.\n * @param {number|string} revisionKey The revision's key.\n * @param {Object|undefined} query Optional object of query parameters to\n * include with request. If requesting specific\n * fields, fields must always include the ID.\n */\nexport const getRevision =\n\t( kind, name, recordKey, revisionKey, query ) =>\n\tasync ( { dispatch } ) => {\n\t\tconst configs = await dispatch( getOrLoadEntitiesConfig( kind ) );\n\t\tconst entityConfig = configs.find(\n\t\t\t( config ) => config.name === name && config.kind === kind\n\t\t);\n\n\t\tif ( ! entityConfig || entityConfig?.__experimentalNoFetch ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( query !== undefined && query._fields ) {\n\t\t\t// If requesting specific fields, items and query association to said\n\t\t\t// records are stored by ID reference. Thus, fields must always include\n\t\t\t// the ID.\n\t\t\tquery = {\n\t\t\t\t...query,\n\t\t\t\t_fields: [\n\t\t\t\t\t...new Set( [\n\t\t\t\t\t\t...( getNormalizedCommaSeparable( query._fields ) ||\n\t\t\t\t\t\t\t[] ),\n\t\t\t\t\t\tentityConfig.revisionKey || DEFAULT_ENTITY_KEY,\n\t\t\t\t\t] ),\n\t\t\t\t].join(),\n\t\t\t};\n\t\t}\n\t\tconst path = addQueryArgs(\n\t\t\tentityConfig.getRevisionsUrl( recordKey, revisionKey ),\n\t\t\tquery\n\t\t);\n\n\t\tlet record;\n\t\ttry {\n\t\t\trecord = await apiFetch( { path } );\n\t\t} catch ( error ) {\n\t\t\t// Do nothing if our request comes back with an API error.\n\t\t\treturn;\n\t\t}\n\n\t\tif ( record ) {\n\t\t\tdispatch.receiveRevisions( kind, name, recordKey, record, query );\n\t\t}\n\t};\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAKA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAKA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AACA,I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EM,YAAY,IAAIA,YAAY,EAAEG,qBAAqB,EAAG;IAC5D;EACD;EAEA,IAAKrB,KAAK,KAAK4C,SAAS,IAAI5C,KAAK,CAAC6C,OAAO,EAAG;IAC3C;IACA;IACA;IACA7C,KAAK,GAAG;MACP,GAAGA,KAAK;MACR6C,OAAO,EAAE,CACR,GAAG,IAAIC,GAAG,CAAE,CACX,IAAK,IAAAC,kCAA2B,EAAE/C,KAAK,CAAC6C,OAAQ,CAAC,IAChD,EAAE,CAAE,EACL3B,YAAY,CAAC8K,WAAW,IAAIhJ,4BAAkB,CAC7C,CAAC,CACH,CAACC,IAAI,CAAC;IACR,CAAC;EACF;EACA,MAAM/C,IAAI,GAAG,IAAAC,iBAAY,EACxBe,YAAY,CAAC+K,eAAe,CAAEF,SAAS,EAAEC,WAAY,CAAC,EACtDhM,KACD,CAAC;EAED,IAAIqC,MAAM;EACV,IAAI;IACHA,MAAM,GAAG,MAAM,IAAAhC,iBAAQ,EAAE;MAAEH;IAAK,CAAE,CAAC;EACpC,CAAC,CAAC,OAAQ6F,KAAK,EAAG;IACjB;IACA;EACD;EAEA,IAAK1D,MAAM,EAAG;IACbpC,QAAQ,CAACkM,gBAAgB,CAAEvL,IAAI,EAAEC,IAAI,EAAEkL,SAAS,EAAE1J,MAAM,EAAErC,KAAM,CAAC;EAClE;AACD,CAAC;AAACO,OAAA,CAAA6L,WAAA,GAAAA,WAAA"}
|
package/build/selectors.js
CHANGED
|
@@ -35,6 +35,7 @@ exports.getLastEntitySaveError = getLastEntitySaveError;
|
|
|
35
35
|
exports.getRawEntityRecord = void 0;
|
|
36
36
|
exports.getRedoEdit = getRedoEdit;
|
|
37
37
|
exports.getReferenceByDistinctEdits = getReferenceByDistinctEdits;
|
|
38
|
+
exports.getRevisions = exports.getRevision = void 0;
|
|
38
39
|
exports.getThemeSupports = getThemeSupports;
|
|
39
40
|
exports.getUndoEdit = getUndoEdit;
|
|
40
41
|
exports.getUserPatternCategories = getUserPatternCategories;
|
|
@@ -989,11 +990,17 @@ function getUserPatternCategories(state) {
|
|
|
989
990
|
/**
|
|
990
991
|
* Returns the revisions of the current global styles theme.
|
|
991
992
|
*
|
|
992
|
-
* @
|
|
993
|
+
* @deprecated since WordPress 6.5.0. Callers should use `select( 'core' ).getRevisions( 'root', 'globalStyles', ${ recordKey } )` instead, where `recordKey` is the id of the global styles parent post.
|
|
994
|
+
*
|
|
995
|
+
* @param state Data state.
|
|
993
996
|
*
|
|
994
997
|
* @return The current global styles.
|
|
995
998
|
*/
|
|
996
999
|
function getCurrentThemeGlobalStylesRevisions(state) {
|
|
1000
|
+
(0, _deprecated.default)("select( 'core' ).getCurrentThemeGlobalStylesRevisions()", {
|
|
1001
|
+
since: '6.5.0',
|
|
1002
|
+
alternative: "select( 'core' ).getRevisions( 'root', 'globalStyles', ${ recordKey } )"
|
|
1003
|
+
});
|
|
997
1004
|
const currentGlobalStylesId = __experimentalGetCurrentGlobalStylesId(state);
|
|
998
1005
|
if (!currentGlobalStylesId) {
|
|
999
1006
|
return null;
|
|
@@ -1012,4 +1019,75 @@ function getCurrentThemeGlobalStylesRevisions(state) {
|
|
|
1012
1019
|
function getDefaultTemplateId(state, query) {
|
|
1013
1020
|
return state.defaultTemplates[JSON.stringify(query)];
|
|
1014
1021
|
}
|
|
1022
|
+
|
|
1023
|
+
/**
|
|
1024
|
+
* Returns an entity's revisions.
|
|
1025
|
+
*
|
|
1026
|
+
* @param state State tree
|
|
1027
|
+
* @param kind Entity kind.
|
|
1028
|
+
* @param name Entity name.
|
|
1029
|
+
* @param recordKey The key of the entity record whose revisions you want to fetch.
|
|
1030
|
+
* @param query Optional query. If requesting specific
|
|
1031
|
+
* fields, fields must always include the ID. For valid query parameters see revisions schema in [the REST API Handbook](https://developer.wordpress.org/rest-api/reference/). Then see the arguments available "Retrieve a [Entity kind]".
|
|
1032
|
+
*
|
|
1033
|
+
* @return Record.
|
|
1034
|
+
*/
|
|
1035
|
+
const getRevisions = (state, kind, name, recordKey, query) => {
|
|
1036
|
+
const queriedStateRevisions = state.entities.records?.[kind]?.[name]?.revisions?.[recordKey];
|
|
1037
|
+
if (!queriedStateRevisions) {
|
|
1038
|
+
return null;
|
|
1039
|
+
}
|
|
1040
|
+
return (0, _queriedData.getQueriedItems)(queriedStateRevisions, query);
|
|
1041
|
+
};
|
|
1042
|
+
|
|
1043
|
+
/**
|
|
1044
|
+
* Returns a single, specific revision of a parent entity.
|
|
1045
|
+
*
|
|
1046
|
+
* @param state State tree
|
|
1047
|
+
* @param kind Entity kind.
|
|
1048
|
+
* @param name Entity name.
|
|
1049
|
+
* @param recordKey The key of the entity record whose revisions you want to fetch.
|
|
1050
|
+
* @param revisionKey The revision's key.
|
|
1051
|
+
* @param query Optional query. If requesting specific
|
|
1052
|
+
* fields, fields must always include the ID. For valid query parameters see revisions schema in [the REST API Handbook](https://developer.wordpress.org/rest-api/reference/). Then see the arguments available "Retrieve a [entity kind]".
|
|
1053
|
+
*
|
|
1054
|
+
* @return Record.
|
|
1055
|
+
*/
|
|
1056
|
+
exports.getRevisions = getRevisions;
|
|
1057
|
+
const getRevision = (0, _rememo.default)((state, kind, name, recordKey, revisionKey, query) => {
|
|
1058
|
+
var _query$context5;
|
|
1059
|
+
const queriedState = state.entities.records?.[kind]?.[name]?.revisions?.[recordKey];
|
|
1060
|
+
if (!queriedState) {
|
|
1061
|
+
return undefined;
|
|
1062
|
+
}
|
|
1063
|
+
const context = (_query$context5 = query?.context) !== null && _query$context5 !== void 0 ? _query$context5 : 'default';
|
|
1064
|
+
if (query === undefined) {
|
|
1065
|
+
// If expecting a complete item, validate that completeness.
|
|
1066
|
+
if (!queriedState.itemIsComplete[context]?.[revisionKey]) {
|
|
1067
|
+
return undefined;
|
|
1068
|
+
}
|
|
1069
|
+
return queriedState.items[context][revisionKey];
|
|
1070
|
+
}
|
|
1071
|
+
const item = queriedState.items[context]?.[revisionKey];
|
|
1072
|
+
if (item && query._fields) {
|
|
1073
|
+
var _getNormalizedCommaSe2;
|
|
1074
|
+
const filteredItem = {};
|
|
1075
|
+
const fields = (_getNormalizedCommaSe2 = (0, _utils.getNormalizedCommaSeparable)(query._fields)) !== null && _getNormalizedCommaSe2 !== void 0 ? _getNormalizedCommaSe2 : [];
|
|
1076
|
+
for (let f = 0; f < fields.length; f++) {
|
|
1077
|
+
const field = fields[f].split('.');
|
|
1078
|
+
let value = item;
|
|
1079
|
+
field.forEach(fieldName => {
|
|
1080
|
+
value = value?.[fieldName];
|
|
1081
|
+
});
|
|
1082
|
+
(0, _utils.setNestedValue)(filteredItem, field, value);
|
|
1083
|
+
}
|
|
1084
|
+
return filteredItem;
|
|
1085
|
+
}
|
|
1086
|
+
return item;
|
|
1087
|
+
}, (state, kind, name, recordKey, revisionKey, query) => {
|
|
1088
|
+
var _query$context6;
|
|
1089
|
+
const context = (_query$context6 = query?.context) !== null && _query$context6 !== void 0 ? _query$context6 : 'default';
|
|
1090
|
+
return [state.entities.records?.[kind]?.[name]?.revisions?.[recordKey]?.items?.[context]?.[revisionKey], state.entities.records?.[kind]?.[name]?.revisions?.[recordKey]?.itemIsComplete?.[context]?.[revisionKey]];
|
|
1091
|
+
});
|
|
1092
|
+
exports.getRevision = getRevision;
|
|
1015
1093
|
//# sourceMappingURL=selectors.js.map
|