@wordpress/core-data 7.0.0 → 7.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/entity-types/theme.js.map +1 -1
- package/build/queried-data/reducer.js +3 -3
- package/build/queried-data/reducer.js.map +1 -1
- package/build/reducer.js +1 -1
- package/build/reducer.js.map +1 -1
- package/build/resolvers.js +1 -1
- package/build/resolvers.js.map +1 -1
- package/build-module/entity-types/theme.js.map +1 -1
- package/build-module/queried-data/reducer.js +3 -3
- package/build-module/queried-data/reducer.js.map +1 -1
- package/build-module/reducer.js +1 -1
- package/build-module/reducer.js.map +1 -1
- package/build-module/resolvers.js +1 -1
- package/build-module/resolvers.js.map +1 -1
- package/build-types/entity-types/theme.d.ts +9 -0
- package/build-types/entity-types/theme.d.ts.map +1 -1
- package/build-types/queried-data/reducer.d.ts.map +1 -1
- package/package.json +17 -17
- package/src/entity-types/theme.ts +10 -0
- package/src/queried-data/reducer.js +4 -3
- package/src/reducer.js +1 -1
- package/src/resolvers.js +1 -1
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["@wordpress/core-data/src/entity-types/theme.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport type { Context, PostFormat, RenderedText, OmitNevers } from './helpers';\n\nimport type { BaseEntityRecords as _BaseEntityRecords } from './base-entity-records';\n\ndeclare module './base-entity-records' {\n\texport namespace BaseEntityRecords {\n\t\texport interface Theme< C extends Context > {\n\t\t\t/**\n\t\t\t * The theme's stylesheet. This uniquely identifies the theme.\n\t\t\t */\n\t\t\tstylesheet: string;\n\t\t\t/**\n\t\t\t * The theme's template. If this is a child theme, this refers to the parent theme, otherwise this is the same as the theme's stylesheet.\n\t\t\t */\n\t\t\ttemplate: string;\n\t\t\t/**\n\t\t\t * The theme author.\n\t\t\t */\n\t\t\tauthor: RenderedText< 'edit' >;\n\t\t\t/**\n\t\t\t * The website of the theme author.\n\t\t\t */\n\t\t\tauthor_uri: RenderedText< 'edit' >;\n\t\t\t/**\n\t\t\t * A description of the theme.\n\t\t\t */\n\t\t\tdescription: RenderedText< 'edit' >;\n\t\t\t/**\n\t\t\t * The name of the theme.\n\t\t\t */\n\t\t\tname: RenderedText< 'edit' >;\n\t\t\t/**\n\t\t\t * The minimum PHP version required for the theme to work.\n\t\t\t */\n\t\t\trequires_php: string;\n\t\t\t/**\n\t\t\t * The minimum WordPress version required for the theme to work.\n\t\t\t */\n\t\t\trequires_wp: string;\n\t\t\t/**\n\t\t\t * The theme's screenshot URL.\n\t\t\t */\n\t\t\tscreenshot: string;\n\t\t\t/**\n\t\t\t * Tags indicating styles and features of the theme.\n\t\t\t */\n\t\t\ttags: RenderedText< 'edit' >;\n\t\t\t/**\n\t\t\t * The theme's text domain.\n\t\t\t */\n\t\t\ttextdomain: string;\n\t\t\t/**\n\t\t\t * Features supported by this theme.\n\t\t\t */\n\t\t\ttheme_supports: ThemeSupports;\n\t\t\t/**\n\t\t\t * The URI of the theme's webpage.\n\t\t\t */\n\t\t\ttheme_uri: RenderedText< 'edit' >;\n\t\t\t/**\n\t\t\t * The theme's current version.\n\t\t\t */\n\t\t\tversion: string;\n\t\t\t/**\n\t\t\t * A named status for the theme.\n\t\t\t */\n\t\t\tstatus: ThemeStatus;\n\t\t}\n\n\t\texport type ThemeStatus = 'active' | 'inactive';\n\n\t\texport interface ThemeSupports {\n\t\t\t/**\n\t\t\t * Whether theme opts in to wide alignment CSS class.\n\t\t\t */\n\t\t\t'align-wide': boolean;\n\t\t\t/**\n\t\t\t * Whether appearanceTools are enabled in Global Styles.\n\t\t\t */\n\t\t\t'appearance-tools': boolean;\n\t\t\t/**\n\t\t\t * Whether posts and comments RSS feed links are added to head.\n\t\t\t */\n\t\t\t'automatic-feed-links': boolean;\n\t\t\t/**\n\t\t\t * Whether border settings are enabled.\n\t\t\t */\n\t\t\tborder: boolean;\n\t\t\t/**\n\t\t\t * Custom background if defined by the theme.\n\t\t\t */\n\t\t\t'custom-background': boolean | CustomBackground;\n\t\t\t/**\n\t\t\t * Custom header if defined by the theme.\n\t\t\t */\n\t\t\t'custom-header': boolean | CustomHeader;\n\t\t\t/**\n\t\t\t * Custom logo if defined by the theme.\n\t\t\t */\n\t\t\t'custom-logo': boolean | CustomLogo;\n\t\t\t/**\n\t\t\t * Whether the theme enables Selective Refresh for Widgets being managed with the Customizer.\n\t\t\t */\n\t\t\t'customize-selective-refresh-widgets': boolean;\n\t\t\t/**\n\t\t\t * Whether theme opts in to the dark editor style UI.\n\t\t\t */\n\t\t\t'dark-editor-style': boolean;\n\t\t\t/**\n\t\t\t * Whether the theme disables custom colors.\n\t\t\t */\n\t\t\t'disable-custom-colors': boolean;\n\t\t\t/**\n\t\t\t * Whether the theme disables custom font sizes.\n\t\t\t */\n\t\t\t'disable-custom-font-sizes': boolean;\n\t\t\t/**\n\t\t\t * Whether the theme disables custom gradients.\n\t\t\t */\n\t\t\t'disable-custom-gradients': boolean;\n\t\t\t/**\n\t\t\t * Custom color palette if defined by the theme.\n\t\t\t */\n\t\t\t'editor-color-palette': boolean | Color[];\n\t\t\t/**\n\t\t\t * Custom font sizes if defined by the theme.\n\t\t\t */\n\t\t\t'editor-font-sizes': boolean | FontSize[];\n\t\t\t/**\n\t\t\t * Custom gradient presets if defined by the theme.\n\t\t\t */\n\t\t\t'editor-gradient-presets': boolean | GradientPreset[];\n\t\t\t/**\n\t\t\t * Whether theme opts in to the editor styles CSS wrapper.\n\t\t\t */\n\t\t\t'editor-styles': boolean;\n\t\t\t/**\n\t\t\t * Allows use of HTML5 markup for search forms, comment forms, comment lists, gallery, and caption.\n\t\t\t */\n\t\t\thtml5: boolean | Html5Option[];\n\t\t\t/**\n\t\t\t * Post formats supported.\n\t\t\t */\n\t\t\tformats: PostFormat[];\n\t\t\t/**\n\t\t\t * Whether link colors are enabled.\n\t\t\t */\n\t\t\t'link-color': boolean;\n\t\t\t/**\n\t\t\t * The post types that support thumbnails or true if all post types are supported.\n\t\t\t */\n\t\t\t'post-thumbnails': boolean | string[];\n\t\t\t/**\n\t\t\t * Whether the theme supports responsive embedded content.\n\t\t\t */\n\t\t\t'responsive-embeds': boolean;\n\t\t\t/**\n\t\t\t * Whether the theme can manage the document title tag.\n\t\t\t */\n\t\t\t'title-tag': boolean;\n\t\t\t/**\n\t\t\t * Whether theme opts in to default WordPress block styles for viewing.\n\t\t\t */\n\t\t\t'wp-block-styles': boolean;\n\t\t}\n\n\t\texport interface CustomBackground {\n\t\t\t'default-image': string;\n\t\t\t'default-preset': 'default' | 'fill' | 'fit' | 'repeat' | 'custom';\n\t\t\t'default-position-x': 'left' | 'center' | 'right';\n\t\t\t'default-position-y': 'left' | 'center' | 'right';\n\t\t\t'default-size': 'auto' | 'contain' | 'cover';\n\t\t\t'default-repeat': 'repeat-x' | 'repeat-y' | 'repeat' | 'no-repeat';\n\t\t\t'default-attachment': 'scroll' | 'fixed';\n\t\t\t'default-color': string;\n\t\t}\n\n\t\texport interface CustomHeader {\n\t\t\t'default-image': string;\n\t\t\t'random-default': boolean;\n\t\t\twidth: number;\n\t\t\theight: number;\n\t\t\t'flex-height': boolean;\n\t\t\t'flex-width': boolean;\n\t\t\t'default-text-color': string;\n\t\t\t'header-text': boolean;\n\t\t\tuploads: boolean;\n\t\t\tvideo: boolean;\n\t\t}\n\n\t\texport interface CustomLogo {\n\t\t\twidth: number;\n\t\t\theight: number;\n\t\t\t'flex-width': boolean;\n\t\t\t'flex-height': boolean;\n\t\t\t'header-text': string[];\n\t\t\t'unlink-homepage-logo': boolean;\n\t\t}\n\n\t\texport interface Color {\n\t\t\tname: string;\n\t\t\tslug: string;\n\t\t\tcolor: string;\n\t\t}\n\n\t\texport interface FontSize {\n\t\t\tname: string;\n\t\t\tsize: number;\n\t\t\tslug: string;\n\t\t}\n\n\t\texport interface GradientPreset {\n\t\t\tname: string;\n\t\t\tgradient: string;\n\t\t\tslug: string;\n\t\t}\n\n\t\texport type Html5Option =\n\t\t\t| 'search-form'\n\t\t\t| 'comment-form'\n\t\t\t| 'comment-list'\n\t\t\t| 'gallery'\n\t\t\t| 'caption'\n\t\t\t| 'script'\n\t\t\t| 'style';\n\t}\n}\n\nexport type Theme< C extends Context = 'edit' > = OmitNevers<\n\t_BaseEntityRecords.Theme< C >\n>;\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["@wordpress/core-data/src/entity-types/theme.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport type { Context, PostFormat, RenderedText, OmitNevers } from './helpers';\n\nimport type { BaseEntityRecords as _BaseEntityRecords } from './base-entity-records';\n\ndeclare module './base-entity-records' {\n\texport namespace BaseEntityRecords {\n\t\texport interface Theme< C extends Context > {\n\t\t\t/**\n\t\t\t * The theme's stylesheet. This uniquely identifies the theme.\n\t\t\t */\n\t\t\tstylesheet: string;\n\t\t\t/**\n\t\t\t * The theme's template. If this is a child theme, this refers to the parent theme, otherwise this is the same as the theme's stylesheet.\n\t\t\t */\n\t\t\ttemplate: string;\n\t\t\t/**\n\t\t\t * The theme author.\n\t\t\t */\n\t\t\tauthor: RenderedText< 'edit' >;\n\t\t\t/**\n\t\t\t * The website of the theme author.\n\t\t\t */\n\t\t\tauthor_uri: RenderedText< 'edit' >;\n\t\t\t/**\n\t\t\t * A description of the theme.\n\t\t\t */\n\t\t\tdescription: RenderedText< 'edit' >;\n\t\t\t/**\n\t\t\t * The name of the theme.\n\t\t\t */\n\t\t\tname: RenderedText< 'edit' >;\n\t\t\t/**\n\t\t\t * The minimum PHP version required for the theme to work.\n\t\t\t */\n\t\t\trequires_php: string;\n\t\t\t/**\n\t\t\t * The minimum WordPress version required for the theme to work.\n\t\t\t */\n\t\t\trequires_wp: string;\n\t\t\t/**\n\t\t\t * The theme's screenshot URL.\n\t\t\t */\n\t\t\tscreenshot: string;\n\t\t\t/**\n\t\t\t * Tags indicating styles and features of the theme.\n\t\t\t */\n\t\t\ttags: RenderedText< 'edit' >;\n\t\t\t/**\n\t\t\t * The theme's text domain.\n\t\t\t */\n\t\t\ttextdomain: string;\n\t\t\t/**\n\t\t\t * Features supported by this theme.\n\t\t\t */\n\t\t\ttheme_supports: ThemeSupports;\n\t\t\t/**\n\t\t\t * The URI of the theme's webpage.\n\t\t\t */\n\t\t\ttheme_uri: RenderedText< 'edit' >;\n\t\t\t/**\n\t\t\t * The theme's current version.\n\t\t\t */\n\t\t\tversion: string;\n\t\t\t/**\n\t\t\t * A named status for the theme.\n\t\t\t */\n\t\t\tstatus: ThemeStatus;\n\t\t}\n\n\t\texport type ThemeStatus = 'active' | 'inactive';\n\n\t\texport interface ThemeSupports {\n\t\t\t/**\n\t\t\t * Whether theme opts in to wide alignment CSS class.\n\t\t\t */\n\t\t\t'align-wide': boolean;\n\t\t\t/**\n\t\t\t * Whether appearanceTools are enabled in Global Styles.\n\t\t\t */\n\t\t\t'appearance-tools': boolean;\n\t\t\t/**\n\t\t\t * Whether posts and comments RSS feed links are added to head.\n\t\t\t */\n\t\t\t'automatic-feed-links': boolean;\n\t\t\t/**\n\t\t\t * Whether border settings are enabled.\n\t\t\t */\n\t\t\tborder: boolean;\n\t\t\t/**\n\t\t\t * Custom background if defined by the theme.\n\t\t\t */\n\t\t\t'custom-background': boolean | CustomBackground;\n\t\t\t/**\n\t\t\t * Custom header if defined by the theme.\n\t\t\t */\n\t\t\t'custom-header': boolean | CustomHeader;\n\t\t\t/**\n\t\t\t * Custom logo if defined by the theme.\n\t\t\t */\n\t\t\t'custom-logo': boolean | CustomLogo;\n\t\t\t/**\n\t\t\t * Whether the theme enables Selective Refresh for Widgets being managed with the Customizer.\n\t\t\t */\n\t\t\t'customize-selective-refresh-widgets': boolean;\n\t\t\t/**\n\t\t\t * Whether theme opts in to the dark editor style UI.\n\t\t\t */\n\t\t\t'dark-editor-style': boolean;\n\t\t\t/**\n\t\t\t * Whether the theme disables custom colors.\n\t\t\t */\n\t\t\t'disable-custom-colors': boolean;\n\t\t\t/**\n\t\t\t * Whether the theme disables custom font sizes.\n\t\t\t */\n\t\t\t'disable-custom-font-sizes': boolean;\n\t\t\t/**\n\t\t\t * Whether the theme disables custom gradients.\n\t\t\t */\n\t\t\t'disable-custom-gradients': boolean;\n\t\t\t/**\n\t\t\t * Custom color palette if defined by the theme.\n\t\t\t */\n\t\t\t'editor-color-palette': boolean | Color[];\n\t\t\t/**\n\t\t\t * Custom font sizes if defined by the theme.\n\t\t\t */\n\t\t\t'editor-font-sizes': boolean | FontSize[];\n\t\t\t/**\n\t\t\t * Custom spacing sizes if defined by the theme.\n\t\t\t */\n\t\t\t'editor-spacing-sizes': boolean | SpacingSize[];\n\t\t\t/**\n\t\t\t * Custom gradient presets if defined by the theme.\n\t\t\t */\n\t\t\t'editor-gradient-presets': boolean | GradientPreset[];\n\t\t\t/**\n\t\t\t * Whether theme opts in to the editor styles CSS wrapper.\n\t\t\t */\n\t\t\t'editor-styles': boolean;\n\t\t\t/**\n\t\t\t * Allows use of HTML5 markup for search forms, comment forms, comment lists, gallery, and caption.\n\t\t\t */\n\t\t\thtml5: boolean | Html5Option[];\n\t\t\t/**\n\t\t\t * Post formats supported.\n\t\t\t */\n\t\t\tformats: PostFormat[];\n\t\t\t/**\n\t\t\t * Whether link colors are enabled.\n\t\t\t */\n\t\t\t'link-color': boolean;\n\t\t\t/**\n\t\t\t * The post types that support thumbnails or true if all post types are supported.\n\t\t\t */\n\t\t\t'post-thumbnails': boolean | string[];\n\t\t\t/**\n\t\t\t * Whether the theme supports responsive embedded content.\n\t\t\t */\n\t\t\t'responsive-embeds': boolean;\n\t\t\t/**\n\t\t\t * Whether the theme can manage the document title tag.\n\t\t\t */\n\t\t\t'title-tag': boolean;\n\t\t\t/**\n\t\t\t * Whether theme opts in to default WordPress block styles for viewing.\n\t\t\t */\n\t\t\t'wp-block-styles': boolean;\n\t\t}\n\n\t\texport interface CustomBackground {\n\t\t\t'default-image': string;\n\t\t\t'default-preset': 'default' | 'fill' | 'fit' | 'repeat' | 'custom';\n\t\t\t'default-position-x': 'left' | 'center' | 'right';\n\t\t\t'default-position-y': 'left' | 'center' | 'right';\n\t\t\t'default-size': 'auto' | 'contain' | 'cover';\n\t\t\t'default-repeat': 'repeat-x' | 'repeat-y' | 'repeat' | 'no-repeat';\n\t\t\t'default-attachment': 'scroll' | 'fixed';\n\t\t\t'default-color': string;\n\t\t}\n\n\t\texport interface CustomHeader {\n\t\t\t'default-image': string;\n\t\t\t'random-default': boolean;\n\t\t\twidth: number;\n\t\t\theight: number;\n\t\t\t'flex-height': boolean;\n\t\t\t'flex-width': boolean;\n\t\t\t'default-text-color': string;\n\t\t\t'header-text': boolean;\n\t\t\tuploads: boolean;\n\t\t\tvideo: boolean;\n\t\t}\n\n\t\texport interface CustomLogo {\n\t\t\twidth: number;\n\t\t\theight: number;\n\t\t\t'flex-width': boolean;\n\t\t\t'flex-height': boolean;\n\t\t\t'header-text': string[];\n\t\t\t'unlink-homepage-logo': boolean;\n\t\t}\n\n\t\texport interface Color {\n\t\t\tname: string;\n\t\t\tslug: string;\n\t\t\tcolor: string;\n\t\t}\n\n\t\texport interface FontSize {\n\t\t\tname: string;\n\t\t\tsize: number;\n\t\t\tslug: string;\n\t\t}\n\n\t\texport interface SpacingSize {\n\t\t\tname: string;\n\t\t\tsize: number;\n\t\t\tslug: string;\n\t\t}\n\n\t\texport interface GradientPreset {\n\t\t\tname: string;\n\t\t\tgradient: string;\n\t\t\tslug: string;\n\t\t}\n\n\t\texport type Html5Option =\n\t\t\t| 'search-form'\n\t\t\t| 'comment-form'\n\t\t\t| 'comment-list'\n\t\t\t| 'gallery'\n\t\t\t| 'caption'\n\t\t\t| 'script'\n\t\t\t| 'style';\n\t}\n}\n\nexport type Theme< C extends Context = 'edit' > = OmitNevers<\n\t_BaseEntityRecords.Theme< C >\n>;\n"],"mappings":"","ignoreList":[]}
|
|
@@ -94,7 +94,7 @@ export function items(state = {}, action) {
|
|
|
94
94
|
[context]: {
|
|
95
95
|
...state[context],
|
|
96
96
|
...action.items.reduce((accumulator, value) => {
|
|
97
|
-
const itemId = value[key];
|
|
97
|
+
const itemId = value?.[key];
|
|
98
98
|
accumulator[itemId] = conservativeMapItem(state?.[context]?.[itemId], value);
|
|
99
99
|
return accumulator;
|
|
100
100
|
}, {})
|
|
@@ -142,7 +142,7 @@ export function itemIsComplete(state = {}, action) {
|
|
|
142
142
|
[context]: {
|
|
143
143
|
...state[context],
|
|
144
144
|
...action.items.reduce((result, item) => {
|
|
145
|
-
const itemId = item[key];
|
|
145
|
+
const itemId = item?.[key];
|
|
146
146
|
|
|
147
147
|
// Defer to completeness if already assigned. Technically the
|
|
148
148
|
// data may be outdated if receiving items for a field subset.
|
|
@@ -197,7 +197,7 @@ onSubKey('stableKey')])((state = {}, action) => {
|
|
|
197
197
|
return state;
|
|
198
198
|
}
|
|
199
199
|
return {
|
|
200
|
-
itemIds: getMergedItemIds(state?.itemIds || [], action.items.map(item => item[key]), page, perPage),
|
|
200
|
+
itemIds: getMergedItemIds(state?.itemIds || [], action.items.map(item => item?.[key]).filter(Boolean), page, perPage),
|
|
201
201
|
meta: action.meta
|
|
202
202
|
};
|
|
203
203
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["combineReducers","compose","conservativeMapItem","ifMatchingAction","replaceAction","onSubKey","DEFAULT_ENTITY_KEY","getQueryParts","getContextFromAction","action","query","queryParts","context","getMergedItemIds","itemIds","nextItemIds","page","perPage","_itemIds$length","receivedAllIds","nextItemIdsStartIndex","size","Math","max","length","mergedItemIds","Array","i","isInNextItemsRange","removeEntitiesById","entities","ids","Object","fromEntries","entries","filter","id","some","itemId","Number","isInteger","items","state","type","key","reduce","accumulator","value","map","contextState","itemIsComplete","isCompleteQuery","isArray","fields","result","item","receiveQueries","meta","queries","removedItems","queryGroup","contextQueries","queryItems","queryId"],"sources":["@wordpress/core-data/src/queried-data/reducer.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport {\n\tconservativeMapItem,\n\tifMatchingAction,\n\treplaceAction,\n\tonSubKey,\n} from '../utils';\nimport { DEFAULT_ENTITY_KEY } from '../entities';\nimport getQueryParts from './get-query-parts';\n\nfunction getContextFromAction( action ) {\n\tconst { query } = action;\n\tif ( ! query ) {\n\t\treturn 'default';\n\t}\n\n\tconst queryParts = getQueryParts( query );\n\treturn queryParts.context;\n}\n\n/**\n * Returns a merged array of item IDs, given details of the received paginated\n * items. The array is sparse-like with `undefined` entries where holes exist.\n *\n * @param {?Array<number>} itemIds Original item IDs (default empty array).\n * @param {number[]} nextItemIds Item IDs to merge.\n * @param {number} page Page of items merged.\n * @param {number} perPage Number of items per page.\n *\n * @return {number[]} Merged array of item IDs.\n */\nexport function getMergedItemIds( itemIds, nextItemIds, page, perPage ) {\n\tconst receivedAllIds = page === 1 && perPage === -1;\n\tif ( receivedAllIds ) {\n\t\treturn nextItemIds;\n\t}\n\tconst nextItemIdsStartIndex = ( page - 1 ) * perPage;\n\n\t// If later page has already been received, default to the larger known\n\t// size of the existing array, else calculate as extending the existing.\n\tconst size = Math.max(\n\t\titemIds?.length ?? 0,\n\t\tnextItemIdsStartIndex + nextItemIds.length\n\t);\n\n\t// Preallocate array since size is known.\n\tconst mergedItemIds = new Array( size );\n\n\tfor ( let i = 0; i < size; i++ ) {\n\t\t// Preserve existing item ID except for subset of range of next items.\n\t\t// We need to check against the possible maximum upper boundary because\n\t\t// a page could receive fewer than what was previously stored.\n\t\tconst isInNextItemsRange =\n\t\t\ti >= nextItemIdsStartIndex && i < nextItemIdsStartIndex + perPage;\n\t\tmergedItemIds[ i ] = isInNextItemsRange\n\t\t\t? nextItemIds[ i - nextItemIdsStartIndex ]\n\t\t\t: itemIds?.[ i ];\n\t}\n\n\treturn mergedItemIds;\n}\n\n/**\n * Helper function to filter out entities with certain IDs.\n * Entities are keyed by their ID.\n *\n * @param {Object} entities Entity objects, keyed by entity ID.\n * @param {Array} ids Entity IDs to filter out.\n *\n * @return {Object} Filtered entities.\n */\nfunction removeEntitiesById( entities, ids ) {\n\treturn Object.fromEntries(\n\t\tObject.entries( entities ).filter(\n\t\t\t( [ id ] ) =>\n\t\t\t\t! ids.some( ( itemId ) => {\n\t\t\t\t\tif ( Number.isInteger( itemId ) ) {\n\t\t\t\t\t\treturn itemId === +id;\n\t\t\t\t\t}\n\t\t\t\t\treturn itemId === id;\n\t\t\t\t} )\n\t\t)\n\t);\n}\n\n/**\n * Reducer tracking items state, keyed by ID. Items are assumed to be normal,\n * where identifiers are common across all queries.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Next state.\n */\nexport function items( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_ITEMS': {\n\t\t\tconst context = getContextFromAction( action );\n\t\t\tconst key = action.key || DEFAULT_ENTITY_KEY;\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ context ]: {\n\t\t\t\t\t...state[ context ],\n\t\t\t\t\t...action.items.reduce( ( accumulator, value ) => {\n\t\t\t\t\t\tconst itemId = value[ key ];\n\t\t\t\t\t\taccumulator[ itemId ] = conservativeMapItem(\n\t\t\t\t\t\t\tstate?.[ context ]?.[ itemId ],\n\t\t\t\t\t\t\tvalue\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn accumulator;\n\t\t\t\t\t}, {} ),\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tcase 'REMOVE_ITEMS':\n\t\t\treturn Object.fromEntries(\n\t\t\t\tObject.entries( state ).map( ( [ itemId, contextState ] ) => [\n\t\t\t\t\titemId,\n\t\t\t\t\tremoveEntitiesById( contextState, action.itemIds ),\n\t\t\t\t] )\n\t\t\t);\n\t}\n\treturn state;\n}\n\n/**\n * Reducer tracking item completeness, keyed by ID. A complete item is one for\n * which all fields are known. This is used in supporting `_fields` queries,\n * where not all properties associated with an entity are necessarily returned.\n * In such cases, completeness is used as an indication of whether it would be\n * safe to use queried data for a non-`_fields`-limited request.\n *\n * @param {Object<string,Object<string,boolean>>} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object<string,Object<string,boolean>>} Next state.\n */\nexport function itemIsComplete( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_ITEMS': {\n\t\t\tconst context = getContextFromAction( action );\n\t\t\tconst { query, key = DEFAULT_ENTITY_KEY } = action;\n\n\t\t\t// An item is considered complete if it is received without an associated\n\t\t\t// fields query. Ideally, this would be implemented in such a way where the\n\t\t\t// complete aggregate of all fields would satisfy completeness. Since the\n\t\t\t// fields are not consistent across all entities, this would require\n\t\t\t// introspection on the REST schema for each entity to know which fields\n\t\t\t// compose a complete item for that entity.\n\t\t\tconst queryParts = query ? getQueryParts( query ) : {};\n\t\t\tconst isCompleteQuery =\n\t\t\t\t! query || ! Array.isArray( queryParts.fields );\n\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ context ]: {\n\t\t\t\t\t...state[ context ],\n\t\t\t\t\t...action.items.reduce( ( result, item ) => {\n\t\t\t\t\t\tconst itemId = item[ key ];\n\n\t\t\t\t\t\t// Defer to completeness if already assigned. Technically the\n\t\t\t\t\t\t// data may be outdated if receiving items for a field subset.\n\t\t\t\t\t\tresult[ itemId ] =\n\t\t\t\t\t\t\tstate?.[ context ]?.[ itemId ] || isCompleteQuery;\n\n\t\t\t\t\t\treturn result;\n\t\t\t\t\t}, {} ),\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tcase 'REMOVE_ITEMS':\n\t\t\treturn Object.fromEntries(\n\t\t\t\tObject.entries( state ).map( ( [ itemId, contextState ] ) => [\n\t\t\t\t\titemId,\n\t\t\t\t\tremoveEntitiesById( contextState, action.itemIds ),\n\t\t\t\t] )\n\t\t\t);\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer tracking queries state, keyed by stable query key. Each reducer\n * query object includes `itemIds` and `requestingPageByPerPage`.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Next state.\n */\nconst receiveQueries = compose( [\n\t// Limit to matching action type so we don't attempt to replace action on\n\t// an unhandled action.\n\tifMatchingAction( ( action ) => 'query' in action ),\n\n\t// Inject query parts into action for use both in `onSubKey` and reducer.\n\treplaceAction( ( action ) => {\n\t\t// `ifMatchingAction` still passes on initialization, where state is\n\t\t// undefined and a query is not assigned. Avoid attempting to parse\n\t\t// parts. `onSubKey` will omit by lack of `stableKey`.\n\t\tif ( action.query ) {\n\t\t\treturn {\n\t\t\t\t...action,\n\t\t\t\t...getQueryParts( action.query ),\n\t\t\t};\n\t\t}\n\n\t\treturn action;\n\t} ),\n\n\tonSubKey( 'context' ),\n\n\t// Queries shape is shared, but keyed by query `stableKey` part. Original\n\t// reducer tracks only a single query object.\n\tonSubKey( 'stableKey' ),\n] )( ( state = {}, action ) => {\n\tconst { type, page, perPage, key = DEFAULT_ENTITY_KEY } = action;\n\n\tif ( type !== 'RECEIVE_ITEMS' ) {\n\t\treturn state;\n\t}\n\n\treturn {\n\t\titemIds: getMergedItemIds(\n\t\t\tstate?.itemIds || [],\n\t\t\taction.items.map( ( item ) => item[ key ] ),\n\t\t\tpage,\n\t\t\tperPage\n\t\t),\n\t\tmeta: action.meta,\n\t};\n} );\n\n/**\n * Reducer tracking queries state.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Next state.\n */\nconst queries = ( state = {}, action ) => {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_ITEMS':\n\t\t\treturn receiveQueries( state, action );\n\t\tcase 'REMOVE_ITEMS':\n\t\t\tconst removedItems = action.itemIds.reduce( ( result, itemId ) => {\n\t\t\t\tresult[ itemId ] = true;\n\t\t\t\treturn result;\n\t\t\t}, {} );\n\n\t\t\treturn Object.fromEntries(\n\t\t\t\tObject.entries( state ).map(\n\t\t\t\t\t( [ queryGroup, contextQueries ] ) => [\n\t\t\t\t\t\tqueryGroup,\n\t\t\t\t\t\tObject.fromEntries(\n\t\t\t\t\t\t\tObject.entries( contextQueries ).map(\n\t\t\t\t\t\t\t\t( [ query, queryItems ] ) => [\n\t\t\t\t\t\t\t\t\tquery,\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t...queryItems,\n\t\t\t\t\t\t\t\t\t\titemIds: queryItems.itemIds.filter(\n\t\t\t\t\t\t\t\t\t\t\t( queryId ) =>\n\t\t\t\t\t\t\t\t\t\t\t\t! removedItems[ queryId ]\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t},\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);\n\t\tdefault:\n\t\t\treturn state;\n\t}\n};\n\nexport default combineReducers( {\n\titems,\n\titemIsComplete,\n\tqueries,\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAe,QAAQ,iBAAiB;AACjD,SAASC,OAAO,QAAQ,oBAAoB;;AAE5C;AACA;AACA;AACA,SACCC,mBAAmB,EACnBC,gBAAgB,EAChBC,aAAa,EACbC,QAAQ,QACF,UAAU;AACjB,SAASC,kBAAkB,QAAQ,aAAa;AAChD,OAAOC,aAAa,MAAM,mBAAmB;AAE7C,SAASC,oBAAoBA,CAAEC,MAAM,EAAG;EACvC,MAAM;IAAEC;EAAM,CAAC,GAAGD,MAAM;EACxB,IAAK,CAAEC,KAAK,EAAG;IACd,OAAO,SAAS;EACjB;EAEA,MAAMC,UAAU,GAAGJ,aAAa,CAAEG,KAAM,CAAC;EACzC,OAAOC,UAAU,CAACC,OAAO;AAC1B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,gBAAgBA,CAAEC,OAAO,EAAEC,WAAW,EAAEC,IAAI,EAAEC,OAAO,EAAG;EAAA,IAAAC,eAAA;EACvE,MAAMC,cAAc,GAAGH,IAAI,KAAK,CAAC,IAAIC,OAA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EY,UAAU,EAAEC,cAAc,CAAE,KAAM,CACrCD,UAAU,EACV5B,MAAM,CAACC,WAAW,CACjBD,MAAM,CAACE,OAAO,CAAE2B,cAAe,CAAC,CAACb,GAAG,CACnC,CAAE,CAAEtC,KAAK,EAAEoD,UAAU,CAAE,KAAM,CAC5BpD,KAAK,EACL;QACC,GAAGoD,UAAU;QACbhD,OAAO,EAAEgD,UAAU,CAAChD,OAAO,CAACqB,MAAM,CAC/B4B,OAAO,IACR,CAAEJ,YAAY,CAAEI,OAAO,CACzB;MACD,CAAC,CAEH,CACD,CAAC,CAEH,CACD,CAAC;IACF;MACC,OAAOrB,KAAK;EACd;AACD,CAAC;AAED,eAAe1C,eAAe,CAAE;EAC/ByC,KAAK;EACLS,cAAc;EACdQ;AACD,CAAE,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["combineReducers","compose","conservativeMapItem","ifMatchingAction","replaceAction","onSubKey","DEFAULT_ENTITY_KEY","getQueryParts","getContextFromAction","action","query","queryParts","context","getMergedItemIds","itemIds","nextItemIds","page","perPage","_itemIds$length","receivedAllIds","nextItemIdsStartIndex","size","Math","max","length","mergedItemIds","Array","i","isInNextItemsRange","removeEntitiesById","entities","ids","Object","fromEntries","entries","filter","id","some","itemId","Number","isInteger","items","state","type","key","reduce","accumulator","value","map","contextState","itemIsComplete","isCompleteQuery","isArray","fields","result","item","receiveQueries","Boolean","meta","queries","removedItems","queryGroup","contextQueries","queryItems","queryId"],"sources":["@wordpress/core-data/src/queried-data/reducer.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport {\n\tconservativeMapItem,\n\tifMatchingAction,\n\treplaceAction,\n\tonSubKey,\n} from '../utils';\nimport { DEFAULT_ENTITY_KEY } from '../entities';\nimport getQueryParts from './get-query-parts';\n\nfunction getContextFromAction( action ) {\n\tconst { query } = action;\n\tif ( ! query ) {\n\t\treturn 'default';\n\t}\n\n\tconst queryParts = getQueryParts( query );\n\treturn queryParts.context;\n}\n\n/**\n * Returns a merged array of item IDs, given details of the received paginated\n * items. The array is sparse-like with `undefined` entries where holes exist.\n *\n * @param {?Array<number>} itemIds Original item IDs (default empty array).\n * @param {number[]} nextItemIds Item IDs to merge.\n * @param {number} page Page of items merged.\n * @param {number} perPage Number of items per page.\n *\n * @return {number[]} Merged array of item IDs.\n */\nexport function getMergedItemIds( itemIds, nextItemIds, page, perPage ) {\n\tconst receivedAllIds = page === 1 && perPage === -1;\n\tif ( receivedAllIds ) {\n\t\treturn nextItemIds;\n\t}\n\tconst nextItemIdsStartIndex = ( page - 1 ) * perPage;\n\n\t// If later page has already been received, default to the larger known\n\t// size of the existing array, else calculate as extending the existing.\n\tconst size = Math.max(\n\t\titemIds?.length ?? 0,\n\t\tnextItemIdsStartIndex + nextItemIds.length\n\t);\n\n\t// Preallocate array since size is known.\n\tconst mergedItemIds = new Array( size );\n\n\tfor ( let i = 0; i < size; i++ ) {\n\t\t// Preserve existing item ID except for subset of range of next items.\n\t\t// We need to check against the possible maximum upper boundary because\n\t\t// a page could receive fewer than what was previously stored.\n\t\tconst isInNextItemsRange =\n\t\t\ti >= nextItemIdsStartIndex && i < nextItemIdsStartIndex + perPage;\n\t\tmergedItemIds[ i ] = isInNextItemsRange\n\t\t\t? nextItemIds[ i - nextItemIdsStartIndex ]\n\t\t\t: itemIds?.[ i ];\n\t}\n\n\treturn mergedItemIds;\n}\n\n/**\n * Helper function to filter out entities with certain IDs.\n * Entities are keyed by their ID.\n *\n * @param {Object} entities Entity objects, keyed by entity ID.\n * @param {Array} ids Entity IDs to filter out.\n *\n * @return {Object} Filtered entities.\n */\nfunction removeEntitiesById( entities, ids ) {\n\treturn Object.fromEntries(\n\t\tObject.entries( entities ).filter(\n\t\t\t( [ id ] ) =>\n\t\t\t\t! ids.some( ( itemId ) => {\n\t\t\t\t\tif ( Number.isInteger( itemId ) ) {\n\t\t\t\t\t\treturn itemId === +id;\n\t\t\t\t\t}\n\t\t\t\t\treturn itemId === id;\n\t\t\t\t} )\n\t\t)\n\t);\n}\n\n/**\n * Reducer tracking items state, keyed by ID. Items are assumed to be normal,\n * where identifiers are common across all queries.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Next state.\n */\nexport function items( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_ITEMS': {\n\t\t\tconst context = getContextFromAction( action );\n\t\t\tconst key = action.key || DEFAULT_ENTITY_KEY;\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ context ]: {\n\t\t\t\t\t...state[ context ],\n\t\t\t\t\t...action.items.reduce( ( accumulator, value ) => {\n\t\t\t\t\t\tconst itemId = value?.[ key ];\n\n\t\t\t\t\t\taccumulator[ itemId ] = conservativeMapItem(\n\t\t\t\t\t\t\tstate?.[ context ]?.[ itemId ],\n\t\t\t\t\t\t\tvalue\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn accumulator;\n\t\t\t\t\t}, {} ),\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tcase 'REMOVE_ITEMS':\n\t\t\treturn Object.fromEntries(\n\t\t\t\tObject.entries( state ).map( ( [ itemId, contextState ] ) => [\n\t\t\t\t\titemId,\n\t\t\t\t\tremoveEntitiesById( contextState, action.itemIds ),\n\t\t\t\t] )\n\t\t\t);\n\t}\n\treturn state;\n}\n\n/**\n * Reducer tracking item completeness, keyed by ID. A complete item is one for\n * which all fields are known. This is used in supporting `_fields` queries,\n * where not all properties associated with an entity are necessarily returned.\n * In such cases, completeness is used as an indication of whether it would be\n * safe to use queried data for a non-`_fields`-limited request.\n *\n * @param {Object<string,Object<string,boolean>>} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object<string,Object<string,boolean>>} Next state.\n */\nexport function itemIsComplete( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_ITEMS': {\n\t\t\tconst context = getContextFromAction( action );\n\t\t\tconst { query, key = DEFAULT_ENTITY_KEY } = action;\n\n\t\t\t// An item is considered complete if it is received without an associated\n\t\t\t// fields query. Ideally, this would be implemented in such a way where the\n\t\t\t// complete aggregate of all fields would satisfy completeness. Since the\n\t\t\t// fields are not consistent across all entities, this would require\n\t\t\t// introspection on the REST schema for each entity to know which fields\n\t\t\t// compose a complete item for that entity.\n\t\t\tconst queryParts = query ? getQueryParts( query ) : {};\n\t\t\tconst isCompleteQuery =\n\t\t\t\t! query || ! Array.isArray( queryParts.fields );\n\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ context ]: {\n\t\t\t\t\t...state[ context ],\n\t\t\t\t\t...action.items.reduce( ( result, item ) => {\n\t\t\t\t\t\tconst itemId = item?.[ key ];\n\n\t\t\t\t\t\t// Defer to completeness if already assigned. Technically the\n\t\t\t\t\t\t// data may be outdated if receiving items for a field subset.\n\t\t\t\t\t\tresult[ itemId ] =\n\t\t\t\t\t\t\tstate?.[ context ]?.[ itemId ] || isCompleteQuery;\n\n\t\t\t\t\t\treturn result;\n\t\t\t\t\t}, {} ),\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tcase 'REMOVE_ITEMS':\n\t\t\treturn Object.fromEntries(\n\t\t\t\tObject.entries( state ).map( ( [ itemId, contextState ] ) => [\n\t\t\t\t\titemId,\n\t\t\t\t\tremoveEntitiesById( contextState, action.itemIds ),\n\t\t\t\t] )\n\t\t\t);\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer tracking queries state, keyed by stable query key. Each reducer\n * query object includes `itemIds` and `requestingPageByPerPage`.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Next state.\n */\nconst receiveQueries = compose( [\n\t// Limit to matching action type so we don't attempt to replace action on\n\t// an unhandled action.\n\tifMatchingAction( ( action ) => 'query' in action ),\n\n\t// Inject query parts into action for use both in `onSubKey` and reducer.\n\treplaceAction( ( action ) => {\n\t\t// `ifMatchingAction` still passes on initialization, where state is\n\t\t// undefined and a query is not assigned. Avoid attempting to parse\n\t\t// parts. `onSubKey` will omit by lack of `stableKey`.\n\t\tif ( action.query ) {\n\t\t\treturn {\n\t\t\t\t...action,\n\t\t\t\t...getQueryParts( action.query ),\n\t\t\t};\n\t\t}\n\n\t\treturn action;\n\t} ),\n\n\tonSubKey( 'context' ),\n\n\t// Queries shape is shared, but keyed by query `stableKey` part. Original\n\t// reducer tracks only a single query object.\n\tonSubKey( 'stableKey' ),\n] )( ( state = {}, action ) => {\n\tconst { type, page, perPage, key = DEFAULT_ENTITY_KEY } = action;\n\n\tif ( type !== 'RECEIVE_ITEMS' ) {\n\t\treturn state;\n\t}\n\n\treturn {\n\t\titemIds: getMergedItemIds(\n\t\t\tstate?.itemIds || [],\n\t\t\taction.items.map( ( item ) => item?.[ key ] ).filter( Boolean ),\n\t\t\tpage,\n\t\t\tperPage\n\t\t),\n\t\tmeta: action.meta,\n\t};\n} );\n\n/**\n * Reducer tracking queries state.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Next state.\n */\nconst queries = ( state = {}, action ) => {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_ITEMS':\n\t\t\treturn receiveQueries( state, action );\n\t\tcase 'REMOVE_ITEMS':\n\t\t\tconst removedItems = action.itemIds.reduce( ( result, itemId ) => {\n\t\t\t\tresult[ itemId ] = true;\n\t\t\t\treturn result;\n\t\t\t}, {} );\n\n\t\t\treturn Object.fromEntries(\n\t\t\t\tObject.entries( state ).map(\n\t\t\t\t\t( [ queryGroup, contextQueries ] ) => [\n\t\t\t\t\t\tqueryGroup,\n\t\t\t\t\t\tObject.fromEntries(\n\t\t\t\t\t\t\tObject.entries( contextQueries ).map(\n\t\t\t\t\t\t\t\t( [ query, queryItems ] ) => [\n\t\t\t\t\t\t\t\t\tquery,\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t...queryItems,\n\t\t\t\t\t\t\t\t\t\titemIds: queryItems.itemIds.filter(\n\t\t\t\t\t\t\t\t\t\t\t( queryId ) =>\n\t\t\t\t\t\t\t\t\t\t\t\t! removedItems[ queryId ]\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t},\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);\n\t\tdefault:\n\t\t\treturn state;\n\t}\n};\n\nexport default combineReducers( {\n\titems,\n\titemIsComplete,\n\tqueries,\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAe,QAAQ,iBAAiB;AACjD,SAASC,OAAO,QAAQ,oBAAoB;;AAE5C;AACA;AACA;AACA,SACCC,mBAAmB,EACnBC,gBAAgB,EAChBC,aAAa,EACbC,QAAQ,QACF,UAAU;AACjB,SAASC,kBAAkB,QAAQ,aAAa;AAChD,OAAOC,aAAa,MAAM,mBAAmB;AAE7C,SAASC,oBAAoBA,CAAEC,MAAM,EAAG;EACvC,MAAM;IAAEC;EAAM,CAAC,GAAGD,MAAM;EACxB,IAAK,CAAEC,KAAK,EAAG;IACd,OAAO,SAAS;EACjB;EAEA,MAAMC,UAAU,GAAGJ,aAAa,CAAEG,KAAM,CAAC;EACzC,OAAOC,UAAU,CAACC,OAAO;AAC1B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,gBAAgBA,CAAEC,OAAO,EAAEC,WAAW,EAAEC,IAAI,EAAEC,OAAO,EAAG;EAAA,IAAAC,eAAA;EACvE,MAAMC,cAAc,GAAGH,IAAI,KAAK,CAAC,IAAIC,OAAO,KAAK,CAAC,CAAC;EACnD,IAAKE,cAAc,EAAG;IACrB,OAAOJ,WAAW;EACnB;EACA,MAAMK,qBAAqB,GAAG,CAAEJ,IAAI,GAAG,CAAC,IAAKC,OAAO;;EAEpD;EACA;EACA,MAAMI,IAAI,GAAGC,IAAI,CAAC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AAK,EAAEqD,UAAU,CAAE,KAAM,CAC5BrD,KAAK,EACL;QACC,GAAGqD,UAAU;QACbjD,OAAO,EAAEiD,UAAU,CAACjD,OAAO,CAACqB,MAAM,CAC/B6B,OAAO,IACR,CAAEJ,YAAY,CAAEI,OAAO,CACzB;MACD,CAAC,CAEH,CACD,CAAC,CAEH,CACD,CAAC;IACF;MACC,OAAOtB,KAAK;EACd;AACD,CAAC;AAED,eAAe1C,eAAe,CAAE;EAC/ByC,KAAK;EACLS,cAAc;EACdS;AACD,CAAE,CAAC","ignoreList":[]}
|
package/build-module/reducer.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["fastDeepEqual","compose","combineReducers","createUndoManager","ifMatchingAction","replaceAction","reducer","queriedDataReducer","rootEntitiesConfig","DEFAULT_ENTITY_KEY","terms","state","action","type","taxonomy","users","byId","queries","reduce","newUsers","user","id","queryID","map","currentUser","taxonomies","currentTheme","undefined","stylesheet","currentGlobalStylesId","themeBaseGlobalStyles","globalStyles","themeGlobalStyleVariations","variations","withMultiEntityRecordEdits","record","newState","forEach","kind","name","recordId","changes","edits","Object","entries","acc","key","value","from","to","entity","entityConfig","queriedData","_action$query$context","context","query","nextState","items","nextEdits","keys","_record$key$raw","raw","persistedEdits","length","saving","pending","error","isAutosave","deleting","revisions","recordKey","fromEntries","filter","itemIds","some","itemId","Number","isInteger","entitiesConfig","entities","newConfig","config","entitiesDataReducer","entitiesByKind","push","memo","subEntities","kindReducer","kindMemo","newData","records","undoManager","editsReference","embedPreviews","url","preview","userPermissions","isAllowed","autosaves","postId","autosavesData","blockPatterns","patterns","blockPatternCategories","categories","userPatternCategories","patternCategories","navigationFallbackId","fallbackId","themeGlobalStyleRevisions","currentId","defaultTemplates","JSON","stringify","templateId"],"sources":["@wordpress/core-data/src/reducer.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal/es6';\n\n/**\n * WordPress dependencies\n */\nimport { compose } from '@wordpress/compose';\nimport { combineReducers } from '@wordpress/data';\nimport { createUndoManager } from '@wordpress/undo-manager';\n\n/**\n * Internal dependencies\n */\nimport { ifMatchingAction, replaceAction } from './utils';\nimport { reducer as queriedDataReducer } from './queried-data';\nimport { rootEntitiesConfig, DEFAULT_ENTITY_KEY } from './entities';\n\n/** @typedef {import('./types').AnyFunction} AnyFunction */\n\n/**\n * Reducer managing terms state. Keyed by taxonomy slug, the value is either\n * undefined (if no request has been made for given taxonomy), null (if a\n * request is in-flight for given taxonomy), or the array of terms for the\n * taxonomy.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function terms( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_TERMS':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.taxonomy ]: action.terms,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer managing authors state. Keyed by id.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function users( state = { byId: {}, queries: {} }, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_USER_QUERY':\n\t\t\treturn {\n\t\t\t\tbyId: {\n\t\t\t\t\t...state.byId,\n\t\t\t\t\t// Key users by their ID.\n\t\t\t\t\t...action.users.reduce(\n\t\t\t\t\t\t( newUsers, user ) => ( {\n\t\t\t\t\t\t\t...newUsers,\n\t\t\t\t\t\t\t[ user.id ]: user,\n\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\tqueries: {\n\t\t\t\t\t...state.queries,\n\t\t\t\t\t[ action.queryID ]: action.users.map( ( user ) => user.id ),\n\t\t\t\t},\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer managing current user state.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function currentUser( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_CURRENT_USER':\n\t\t\treturn action.currentUser;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer managing taxonomies.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function taxonomies( state = [], action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_TAXONOMIES':\n\t\t\treturn action.taxonomies;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer managing the current theme.\n *\n * @param {string|undefined} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {string|undefined} Updated state.\n */\nexport function currentTheme( state = undefined, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_CURRENT_THEME':\n\t\t\treturn action.currentTheme.stylesheet;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer managing the current global styles id.\n *\n * @param {string|undefined} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {string|undefined} Updated state.\n */\nexport function currentGlobalStylesId( state = undefined, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_CURRENT_GLOBAL_STYLES_ID':\n\t\t\treturn action.id;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer managing the theme base global styles.\n *\n * @param {Record<string, object>} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Record<string, object>} Updated state.\n */\nexport function themeBaseGlobalStyles( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_THEME_GLOBAL_STYLES':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.stylesheet ]: action.globalStyles,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer managing the theme global styles variations.\n *\n * @param {Record<string, object>} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Record<string, object>} Updated state.\n */\nexport function themeGlobalStyleVariations( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_THEME_GLOBAL_STYLE_VARIATIONS':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.stylesheet ]: action.variations,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\nconst withMultiEntityRecordEdits = ( reducer ) => ( state, action ) => {\n\tif ( action.type === 'UNDO' || action.type === 'REDO' ) {\n\t\tconst { record } = action;\n\n\t\tlet newState = state;\n\t\trecord.forEach( ( { id: { kind, name, recordId }, changes } ) => {\n\t\t\tnewState = reducer( newState, {\n\t\t\t\ttype: 'EDIT_ENTITY_RECORD',\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\trecordId,\n\t\t\t\tedits: Object.entries( changes ).reduce(\n\t\t\t\t\t( acc, [ key, value ] ) => {\n\t\t\t\t\t\tacc[ key ] =\n\t\t\t\t\t\t\taction.type === 'UNDO' ? value.from : value.to;\n\t\t\t\t\t\treturn acc;\n\t\t\t\t\t},\n\t\t\t\t\t{}\n\t\t\t\t),\n\t\t\t} );\n\t\t} );\n\t\treturn newState;\n\t}\n\n\treturn reducer( state, action );\n};\n\n/**\n * Higher Order Reducer for a given entity config. It supports:\n *\n * - Fetching\n * - Editing\n * - Saving\n *\n * @param {Object} entityConfig Entity config.\n *\n * @return {AnyFunction} Reducer.\n */\nfunction entity( entityConfig ) {\n\treturn compose( [\n\t\twithMultiEntityRecordEdits,\n\n\t\t// Limit to matching action type so we don't attempt to replace action on\n\t\t// an unhandled action.\n\t\tifMatchingAction(\n\t\t\t( action ) =>\n\t\t\t\taction.name &&\n\t\t\t\taction.kind &&\n\t\t\t\taction.name === entityConfig.name &&\n\t\t\t\taction.kind === entityConfig.kind\n\t\t),\n\n\t\t// Inject the entity config into the action.\n\t\treplaceAction( ( action ) => {\n\t\t\treturn {\n\t\t\t\tkey: entityConfig.key || DEFAULT_ENTITY_KEY,\n\t\t\t\t...action,\n\t\t\t};\n\t\t} ),\n\t] )(\n\t\tcombineReducers( {\n\t\t\tqueriedData: queriedDataReducer,\n\t\t\tedits: ( state = {}, action ) => {\n\t\t\t\tswitch ( action.type ) {\n\t\t\t\t\tcase 'RECEIVE_ITEMS':\n\t\t\t\t\t\tconst context = action?.query?.context ?? 'default';\n\t\t\t\t\t\tif ( context !== 'default' ) {\n\t\t\t\t\t\t\treturn state;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst nextState = { ...state };\n\n\t\t\t\t\t\tfor ( const record of action.items ) {\n\t\t\t\t\t\t\tconst recordId = record[ action.key ];\n\t\t\t\t\t\t\tconst edits = nextState[ recordId ];\n\t\t\t\t\t\t\tif ( ! edits ) {\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst nextEdits = Object.keys( edits ).reduce(\n\t\t\t\t\t\t\t\t( acc, key ) => {\n\t\t\t\t\t\t\t\t\t// If the edited value is still different to the persisted value,\n\t\t\t\t\t\t\t\t\t// keep the edited value in edits.\n\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t// Edits are the \"raw\" attribute values, but records may have\n\t\t\t\t\t\t\t\t\t\t// objects with more properties, so we use `get` here for the\n\t\t\t\t\t\t\t\t\t\t// comparison.\n\t\t\t\t\t\t\t\t\t\t! fastDeepEqual(\n\t\t\t\t\t\t\t\t\t\t\tedits[ key ],\n\t\t\t\t\t\t\t\t\t\t\trecord[ key ]?.raw ?? record[ key ]\n\t\t\t\t\t\t\t\t\t\t) &&\n\t\t\t\t\t\t\t\t\t\t// Sometimes the server alters the sent value which means\n\t\t\t\t\t\t\t\t\t\t// we need to also remove the edits before the api request.\n\t\t\t\t\t\t\t\t\t\t( ! action.persistedEdits ||\n\t\t\t\t\t\t\t\t\t\t\t! fastDeepEqual(\n\t\t\t\t\t\t\t\t\t\t\t\tedits[ key ],\n\t\t\t\t\t\t\t\t\t\t\t\taction.persistedEdits[ key ]\n\t\t\t\t\t\t\t\t\t\t\t) )\n\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\tacc[ key ] = edits[ key ];\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\treturn acc;\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{}\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tif ( Object.keys( nextEdits ).length ) {\n\t\t\t\t\t\t\t\tnextState[ recordId ] = nextEdits;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tdelete nextState[ recordId ];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn nextState;\n\n\t\t\t\t\tcase 'EDIT_ENTITY_RECORD':\n\t\t\t\t\t\tconst nextEdits = {\n\t\t\t\t\t\t\t...state[ action.recordId ],\n\t\t\t\t\t\t\t...action.edits,\n\t\t\t\t\t\t};\n\t\t\t\t\t\tObject.keys( nextEdits ).forEach( ( key ) => {\n\t\t\t\t\t\t\t// Delete cleared edits so that the properties\n\t\t\t\t\t\t\t// are not considered dirty.\n\t\t\t\t\t\t\tif ( nextEdits[ key ] === undefined ) {\n\t\t\t\t\t\t\t\tdelete nextEdits[ key ];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} );\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t...state,\n\t\t\t\t\t\t\t[ action.recordId ]: nextEdits,\n\t\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\treturn state;\n\t\t\t},\n\n\t\t\tsaving: ( state = {}, action ) => {\n\t\t\t\tswitch ( action.type ) {\n\t\t\t\t\tcase 'SAVE_ENTITY_RECORD_START':\n\t\t\t\t\tcase 'SAVE_ENTITY_RECORD_FINISH':\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t...state,\n\t\t\t\t\t\t\t[ action.recordId ]: {\n\t\t\t\t\t\t\t\tpending:\n\t\t\t\t\t\t\t\t\taction.type === 'SAVE_ENTITY_RECORD_START',\n\t\t\t\t\t\t\t\terror: action.error,\n\t\t\t\t\t\t\t\tisAutosave: action.isAutosave,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\treturn state;\n\t\t\t},\n\n\t\t\tdeleting: ( state = {}, action ) => {\n\t\t\t\tswitch ( action.type ) {\n\t\t\t\t\tcase 'DELETE_ENTITY_RECORD_START':\n\t\t\t\t\tcase 'DELETE_ENTITY_RECORD_FINISH':\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t...state,\n\t\t\t\t\t\t\t[ action.recordId ]: {\n\t\t\t\t\t\t\t\tpending:\n\t\t\t\t\t\t\t\t\taction.type ===\n\t\t\t\t\t\t\t\t\t'DELETE_ENTITY_RECORD_START',\n\t\t\t\t\t\t\t\terror: action.error,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\treturn state;\n\t\t\t},\n\n\t\t\trevisions: ( state = {}, action ) => {\n\t\t\t\t// Use the same queriedDataReducer shape for revisions.\n\t\t\t\tif ( action.type === 'RECEIVE_ITEM_REVISIONS' ) {\n\t\t\t\t\tconst recordKey = action.recordKey;\n\t\t\t\t\tdelete action.recordKey;\n\t\t\t\t\tconst newState = queriedDataReducer( state[ recordKey ], {\n\t\t\t\t\t\t...action,\n\t\t\t\t\t\ttype: 'RECEIVE_ITEMS',\n\t\t\t\t\t} );\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...state,\n\t\t\t\t\t\t[ recordKey ]: newState,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tif ( action.type === 'REMOVE_ITEMS' ) {\n\t\t\t\t\treturn Object.fromEntries(\n\t\t\t\t\t\tObject.entries( state ).filter(\n\t\t\t\t\t\t\t( [ id ] ) =>\n\t\t\t\t\t\t\t\t! action.itemIds.some( ( itemId ) => {\n\t\t\t\t\t\t\t\t\tif ( Number.isInteger( itemId ) ) {\n\t\t\t\t\t\t\t\t\t\treturn itemId === +id;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\treturn itemId === id;\n\t\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\n\t\t\t\treturn state;\n\t\t\t},\n\t\t} )\n\t);\n}\n\n/**\n * Reducer keeping track of the registered entities.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function entitiesConfig( state = rootEntitiesConfig, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'ADD_ENTITIES':\n\t\t\treturn [ ...state, ...action.entities ];\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer keeping track of the registered entities config and data.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport const entities = ( state = {}, action ) => {\n\tconst newConfig = entitiesConfig( state.config, action );\n\n\t// Generates a dynamic reducer for the entities.\n\tlet entitiesDataReducer = state.reducer;\n\tif ( ! entitiesDataReducer || newConfig !== state.config ) {\n\t\tconst entitiesByKind = newConfig.reduce( ( acc, record ) => {\n\t\t\tconst { kind } = record;\n\t\t\tif ( ! acc[ kind ] ) {\n\t\t\t\tacc[ kind ] = [];\n\t\t\t}\n\t\t\tacc[ kind ].push( record );\n\t\t\treturn acc;\n\t\t}, {} );\n\n\t\tentitiesDataReducer = combineReducers(\n\t\t\tObject.entries( entitiesByKind ).reduce(\n\t\t\t\t( memo, [ kind, subEntities ] ) => {\n\t\t\t\t\tconst kindReducer = combineReducers(\n\t\t\t\t\t\tsubEntities.reduce(\n\t\t\t\t\t\t\t( kindMemo, entityConfig ) => ( {\n\t\t\t\t\t\t\t\t...kindMemo,\n\t\t\t\t\t\t\t\t[ entityConfig.name ]: entity( entityConfig ),\n\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\n\t\t\t\t\tmemo[ kind ] = kindReducer;\n\t\t\t\t\treturn memo;\n\t\t\t\t},\n\t\t\t\t{}\n\t\t\t)\n\t\t);\n\t}\n\n\tconst newData = entitiesDataReducer( state.records, action );\n\n\tif (\n\t\tnewData === state.records &&\n\t\tnewConfig === state.config &&\n\t\tentitiesDataReducer === state.reducer\n\t) {\n\t\treturn state;\n\t}\n\n\treturn {\n\t\treducer: entitiesDataReducer,\n\t\trecords: newData,\n\t\tconfig: newConfig,\n\t};\n};\n\n/**\n * @type {UndoManager}\n */\nexport function undoManager( state = createUndoManager() ) {\n\treturn state;\n}\n\nexport function editsReference( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'EDIT_ENTITY_RECORD':\n\t\tcase 'UNDO':\n\t\tcase 'REDO':\n\t\t\treturn {};\n\t}\n\treturn state;\n}\n\n/**\n * Reducer managing embed preview data.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function embedPreviews( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_EMBED_PREVIEW':\n\t\t\tconst { url, preview } = action;\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ url ]: preview,\n\t\t\t};\n\t}\n\treturn state;\n}\n\n/**\n * State which tracks whether the user can perform an action on a REST\n * resource.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function userPermissions( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_USER_PERMISSION':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.key ]: action.isAllowed,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer returning autosaves keyed by their parent's post id.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function autosaves( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_AUTOSAVES':\n\t\t\tconst { postId, autosaves: autosavesData } = action;\n\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ postId ]: autosavesData,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\nexport function blockPatterns( state = [], action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_BLOCK_PATTERNS':\n\t\t\treturn action.patterns;\n\t}\n\n\treturn state;\n}\n\nexport function blockPatternCategories( state = [], action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_BLOCK_PATTERN_CATEGORIES':\n\t\t\treturn action.categories;\n\t}\n\n\treturn state;\n}\n\nexport function userPatternCategories( state = [], action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_USER_PATTERN_CATEGORIES':\n\t\t\treturn action.patternCategories;\n\t}\n\treturn state;\n}\n\nexport function navigationFallbackId( state = null, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_NAVIGATION_FALLBACK_ID':\n\t\t\treturn action.fallbackId;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer managing the theme global styles revisions.\n *\n * @param {Record<string, object>} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Record<string, object>} Updated state.\n */\nexport function themeGlobalStyleRevisions( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_THEME_GLOBAL_STYLE_REVISIONS':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.currentId ]: action.revisions,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer managing the template lookup per query.\n *\n * @param {Record<string, string>} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Record<string, string>} Updated state.\n */\nexport function defaultTemplates( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_DEFAULT_TEMPLATE':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ JSON.stringify( action.query ) ]: action.templateId,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\nexport default combineReducers( {\n\tterms,\n\tusers,\n\tcurrentTheme,\n\tcurrentGlobalStylesId,\n\tcurrentUser,\n\tthemeGlobalStyleVariations,\n\tthemeBaseGlobalStyles,\n\tthemeGlobalStyleRevisions,\n\ttaxonomies,\n\tentities,\n\teditsReference,\n\tundoManager,\n\tembedPreviews,\n\tuserPermissions,\n\tautosaves,\n\tblockPatterns,\n\tblockPatternCategories,\n\tuserPatternCategories,\n\tnavigationFallbackId,\n\tdefaultTemplates,\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,aAAa,MAAM,qBAAqB;;AAE/C;AACA;AACA;AACA,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,eAAe,QAAQ,iBAAiB;AACjD,SAASC,iBAAiB,QAAQ,yBAAyB;;AAE3D;AACA;AACA;AACA,SAASC,gBAAgB,EAAEC,aAAa,QAAQ,SAAS;AACzD,SAASC,OAAO,IAAIC,kBAAkB,QAAQ,gBAAgB;AAC9D,SAASC,kBAAkB,EAAEC,kBAAkB,QAAQ,YAAY;;AAEnE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,KAAKA,CAAEC,KAAK,GAAG,CAAC,CAAC,EAAEC,MAAM,EAAG;EAC3C,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,eAAe;MACnB,OAAO;QACN,GAAGF,KAAK;QACR,CAAEC,MAAM,CAACE,QAAQ,GAAIF,MAAM,CAACF;MAC7B,CAAC;EACH;EAEA,OAAOC,KAAK;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASI,KAAKA,CAAEJ,KAAK,GAAG;EAAEK,IAAI,EAAE,CAAC,CAAC;EAAEC,OAAO,EAAE,CAAC;AAAE,CAAC,EAAEL,MAAM,EAAG;EAClE,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,oBAAoB;MACxB,OAAO;QACNG,IAAI,EAAE;UACL,GAAGL,KAAK,CAACK,IAAI;UACb;UACA,GAAGJ,MAAM,CAACG,KAAK,CAACG,MAAM,CACrB,CAAEC,QAAQ,EAAEC,IAAI,MA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AAO,SAASoG,gBAAgBA,CAAEpG,KAAK,GAAG,CAAC,CAAC,EAAEC,MAAM,EAAG;EACtD,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,0BAA0B;MAC9B,OAAO;QACN,GAAGF,KAAK;QACR,CAAEqG,IAAI,CAACC,SAAS,CAAErG,MAAM,CAAC2C,KAAM,CAAC,GAAI3C,MAAM,CAACsG;MAC5C,CAAC;EACH;EAEA,OAAOvG,KAAK;AACb;AAEA,eAAeT,eAAe,CAAE;EAC/BQ,KAAK;EACLK,KAAK;EACLW,YAAY;EACZG,qBAAqB;EACrBL,WAAW;EACXQ,0BAA0B;EAC1BF,qBAAqB;EACrB+E,yBAAyB;EACzBpF,UAAU;EACVsD,QAAQ;EACRa,cAAc;EACdD,WAAW;EACXE,aAAa;EACbG,eAAe;EACfE,SAAS;EACTG,aAAa;EACbE,sBAAsB;EACtBE,qBAAqB;EACrBE,oBAAoB;EACpBI;AACD,CAAE,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["fastDeepEqual","compose","combineReducers","createUndoManager","ifMatchingAction","replaceAction","reducer","queriedDataReducer","rootEntitiesConfig","DEFAULT_ENTITY_KEY","terms","state","action","type","taxonomy","users","byId","queries","reduce","newUsers","user","id","queryID","map","currentUser","taxonomies","currentTheme","undefined","stylesheet","currentGlobalStylesId","themeBaseGlobalStyles","globalStyles","themeGlobalStyleVariations","variations","withMultiEntityRecordEdits","record","newState","forEach","kind","name","recordId","changes","edits","Object","entries","acc","key","value","from","to","entity","entityConfig","queriedData","_action$query$context","context","query","nextState","items","nextEdits","keys","_record$key$raw","raw","persistedEdits","length","saving","pending","error","isAutosave","deleting","revisions","recordKey","fromEntries","filter","itemIds","some","itemId","Number","isInteger","entitiesConfig","entities","newConfig","config","entitiesDataReducer","entitiesByKind","push","memo","subEntities","kindReducer","kindMemo","newData","records","undoManager","editsReference","embedPreviews","url","preview","userPermissions","isAllowed","autosaves","postId","autosavesData","blockPatterns","patterns","blockPatternCategories","categories","userPatternCategories","patternCategories","navigationFallbackId","fallbackId","themeGlobalStyleRevisions","currentId","defaultTemplates","JSON","stringify","templateId"],"sources":["@wordpress/core-data/src/reducer.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal/es6';\n\n/**\n * WordPress dependencies\n */\nimport { compose } from '@wordpress/compose';\nimport { combineReducers } from '@wordpress/data';\nimport { createUndoManager } from '@wordpress/undo-manager';\n\n/**\n * Internal dependencies\n */\nimport { ifMatchingAction, replaceAction } from './utils';\nimport { reducer as queriedDataReducer } from './queried-data';\nimport { rootEntitiesConfig, DEFAULT_ENTITY_KEY } from './entities';\n\n/** @typedef {import('./types').AnyFunction} AnyFunction */\n\n/**\n * Reducer managing terms state. Keyed by taxonomy slug, the value is either\n * undefined (if no request has been made for given taxonomy), null (if a\n * request is in-flight for given taxonomy), or the array of terms for the\n * taxonomy.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function terms( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_TERMS':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.taxonomy ]: action.terms,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer managing authors state. Keyed by id.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function users( state = { byId: {}, queries: {} }, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_USER_QUERY':\n\t\t\treturn {\n\t\t\t\tbyId: {\n\t\t\t\t\t...state.byId,\n\t\t\t\t\t// Key users by their ID.\n\t\t\t\t\t...action.users.reduce(\n\t\t\t\t\t\t( newUsers, user ) => ( {\n\t\t\t\t\t\t\t...newUsers,\n\t\t\t\t\t\t\t[ user.id ]: user,\n\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\tqueries: {\n\t\t\t\t\t...state.queries,\n\t\t\t\t\t[ action.queryID ]: action.users.map( ( user ) => user.id ),\n\t\t\t\t},\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer managing current user state.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function currentUser( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_CURRENT_USER':\n\t\t\treturn action.currentUser;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer managing taxonomies.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function taxonomies( state = [], action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_TAXONOMIES':\n\t\t\treturn action.taxonomies;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer managing the current theme.\n *\n * @param {string|undefined} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {string|undefined} Updated state.\n */\nexport function currentTheme( state = undefined, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_CURRENT_THEME':\n\t\t\treturn action.currentTheme.stylesheet;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer managing the current global styles id.\n *\n * @param {string|undefined} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {string|undefined} Updated state.\n */\nexport function currentGlobalStylesId( state = undefined, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_CURRENT_GLOBAL_STYLES_ID':\n\t\t\treturn action.id;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer managing the theme base global styles.\n *\n * @param {Record<string, object>} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Record<string, object>} Updated state.\n */\nexport function themeBaseGlobalStyles( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_THEME_GLOBAL_STYLES':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.stylesheet ]: action.globalStyles,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer managing the theme global styles variations.\n *\n * @param {Record<string, object>} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Record<string, object>} Updated state.\n */\nexport function themeGlobalStyleVariations( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_THEME_GLOBAL_STYLE_VARIATIONS':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.stylesheet ]: action.variations,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\nconst withMultiEntityRecordEdits = ( reducer ) => ( state, action ) => {\n\tif ( action.type === 'UNDO' || action.type === 'REDO' ) {\n\t\tconst { record } = action;\n\n\t\tlet newState = state;\n\t\trecord.forEach( ( { id: { kind, name, recordId }, changes } ) => {\n\t\t\tnewState = reducer( newState, {\n\t\t\t\ttype: 'EDIT_ENTITY_RECORD',\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\trecordId,\n\t\t\t\tedits: Object.entries( changes ).reduce(\n\t\t\t\t\t( acc, [ key, value ] ) => {\n\t\t\t\t\t\tacc[ key ] =\n\t\t\t\t\t\t\taction.type === 'UNDO' ? value.from : value.to;\n\t\t\t\t\t\treturn acc;\n\t\t\t\t\t},\n\t\t\t\t\t{}\n\t\t\t\t),\n\t\t\t} );\n\t\t} );\n\t\treturn newState;\n\t}\n\n\treturn reducer( state, action );\n};\n\n/**\n * Higher Order Reducer for a given entity config. It supports:\n *\n * - Fetching\n * - Editing\n * - Saving\n *\n * @param {Object} entityConfig Entity config.\n *\n * @return {AnyFunction} Reducer.\n */\nfunction entity( entityConfig ) {\n\treturn compose( [\n\t\twithMultiEntityRecordEdits,\n\n\t\t// Limit to matching action type so we don't attempt to replace action on\n\t\t// an unhandled action.\n\t\tifMatchingAction(\n\t\t\t( action ) =>\n\t\t\t\taction.name &&\n\t\t\t\taction.kind &&\n\t\t\t\taction.name === entityConfig.name &&\n\t\t\t\taction.kind === entityConfig.kind\n\t\t),\n\n\t\t// Inject the entity config into the action.\n\t\treplaceAction( ( action ) => {\n\t\t\treturn {\n\t\t\t\tkey: entityConfig.key || DEFAULT_ENTITY_KEY,\n\t\t\t\t...action,\n\t\t\t};\n\t\t} ),\n\t] )(\n\t\tcombineReducers( {\n\t\t\tqueriedData: queriedDataReducer,\n\t\t\tedits: ( state = {}, action ) => {\n\t\t\t\tswitch ( action.type ) {\n\t\t\t\t\tcase 'RECEIVE_ITEMS':\n\t\t\t\t\t\tconst context = action?.query?.context ?? 'default';\n\t\t\t\t\t\tif ( context !== 'default' ) {\n\t\t\t\t\t\t\treturn state;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst nextState = { ...state };\n\n\t\t\t\t\t\tfor ( const record of action.items ) {\n\t\t\t\t\t\t\tconst recordId = record?.[ action.key ];\n\t\t\t\t\t\t\tconst edits = nextState[ recordId ];\n\t\t\t\t\t\t\tif ( ! edits ) {\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst nextEdits = Object.keys( edits ).reduce(\n\t\t\t\t\t\t\t\t( acc, key ) => {\n\t\t\t\t\t\t\t\t\t// If the edited value is still different to the persisted value,\n\t\t\t\t\t\t\t\t\t// keep the edited value in edits.\n\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t// Edits are the \"raw\" attribute values, but records may have\n\t\t\t\t\t\t\t\t\t\t// objects with more properties, so we use `get` here for the\n\t\t\t\t\t\t\t\t\t\t// comparison.\n\t\t\t\t\t\t\t\t\t\t! fastDeepEqual(\n\t\t\t\t\t\t\t\t\t\t\tedits[ key ],\n\t\t\t\t\t\t\t\t\t\t\trecord[ key ]?.raw ?? record[ key ]\n\t\t\t\t\t\t\t\t\t\t) &&\n\t\t\t\t\t\t\t\t\t\t// Sometimes the server alters the sent value which means\n\t\t\t\t\t\t\t\t\t\t// we need to also remove the edits before the api request.\n\t\t\t\t\t\t\t\t\t\t( ! action.persistedEdits ||\n\t\t\t\t\t\t\t\t\t\t\t! fastDeepEqual(\n\t\t\t\t\t\t\t\t\t\t\t\tedits[ key ],\n\t\t\t\t\t\t\t\t\t\t\t\taction.persistedEdits[ key ]\n\t\t\t\t\t\t\t\t\t\t\t) )\n\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\tacc[ key ] = edits[ key ];\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\treturn acc;\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{}\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tif ( Object.keys( nextEdits ).length ) {\n\t\t\t\t\t\t\t\tnextState[ recordId ] = nextEdits;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tdelete nextState[ recordId ];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn nextState;\n\n\t\t\t\t\tcase 'EDIT_ENTITY_RECORD':\n\t\t\t\t\t\tconst nextEdits = {\n\t\t\t\t\t\t\t...state[ action.recordId ],\n\t\t\t\t\t\t\t...action.edits,\n\t\t\t\t\t\t};\n\t\t\t\t\t\tObject.keys( nextEdits ).forEach( ( key ) => {\n\t\t\t\t\t\t\t// Delete cleared edits so that the properties\n\t\t\t\t\t\t\t// are not considered dirty.\n\t\t\t\t\t\t\tif ( nextEdits[ key ] === undefined ) {\n\t\t\t\t\t\t\t\tdelete nextEdits[ key ];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} );\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t...state,\n\t\t\t\t\t\t\t[ action.recordId ]: nextEdits,\n\t\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\treturn state;\n\t\t\t},\n\n\t\t\tsaving: ( state = {}, action ) => {\n\t\t\t\tswitch ( action.type ) {\n\t\t\t\t\tcase 'SAVE_ENTITY_RECORD_START':\n\t\t\t\t\tcase 'SAVE_ENTITY_RECORD_FINISH':\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t...state,\n\t\t\t\t\t\t\t[ action.recordId ]: {\n\t\t\t\t\t\t\t\tpending:\n\t\t\t\t\t\t\t\t\taction.type === 'SAVE_ENTITY_RECORD_START',\n\t\t\t\t\t\t\t\terror: action.error,\n\t\t\t\t\t\t\t\tisAutosave: action.isAutosave,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\treturn state;\n\t\t\t},\n\n\t\t\tdeleting: ( state = {}, action ) => {\n\t\t\t\tswitch ( action.type ) {\n\t\t\t\t\tcase 'DELETE_ENTITY_RECORD_START':\n\t\t\t\t\tcase 'DELETE_ENTITY_RECORD_FINISH':\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t...state,\n\t\t\t\t\t\t\t[ action.recordId ]: {\n\t\t\t\t\t\t\t\tpending:\n\t\t\t\t\t\t\t\t\taction.type ===\n\t\t\t\t\t\t\t\t\t'DELETE_ENTITY_RECORD_START',\n\t\t\t\t\t\t\t\terror: action.error,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\treturn state;\n\t\t\t},\n\n\t\t\trevisions: ( state = {}, action ) => {\n\t\t\t\t// Use the same queriedDataReducer shape for revisions.\n\t\t\t\tif ( action.type === 'RECEIVE_ITEM_REVISIONS' ) {\n\t\t\t\t\tconst recordKey = action.recordKey;\n\t\t\t\t\tdelete action.recordKey;\n\t\t\t\t\tconst newState = queriedDataReducer( state[ recordKey ], {\n\t\t\t\t\t\t...action,\n\t\t\t\t\t\ttype: 'RECEIVE_ITEMS',\n\t\t\t\t\t} );\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...state,\n\t\t\t\t\t\t[ recordKey ]: newState,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tif ( action.type === 'REMOVE_ITEMS' ) {\n\t\t\t\t\treturn Object.fromEntries(\n\t\t\t\t\t\tObject.entries( state ).filter(\n\t\t\t\t\t\t\t( [ id ] ) =>\n\t\t\t\t\t\t\t\t! action.itemIds.some( ( itemId ) => {\n\t\t\t\t\t\t\t\t\tif ( Number.isInteger( itemId ) ) {\n\t\t\t\t\t\t\t\t\t\treturn itemId === +id;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\treturn itemId === id;\n\t\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\n\t\t\t\treturn state;\n\t\t\t},\n\t\t} )\n\t);\n}\n\n/**\n * Reducer keeping track of the registered entities.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function entitiesConfig( state = rootEntitiesConfig, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'ADD_ENTITIES':\n\t\t\treturn [ ...state, ...action.entities ];\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer keeping track of the registered entities config and data.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport const entities = ( state = {}, action ) => {\n\tconst newConfig = entitiesConfig( state.config, action );\n\n\t// Generates a dynamic reducer for the entities.\n\tlet entitiesDataReducer = state.reducer;\n\tif ( ! entitiesDataReducer || newConfig !== state.config ) {\n\t\tconst entitiesByKind = newConfig.reduce( ( acc, record ) => {\n\t\t\tconst { kind } = record;\n\t\t\tif ( ! acc[ kind ] ) {\n\t\t\t\tacc[ kind ] = [];\n\t\t\t}\n\t\t\tacc[ kind ].push( record );\n\t\t\treturn acc;\n\t\t}, {} );\n\n\t\tentitiesDataReducer = combineReducers(\n\t\t\tObject.entries( entitiesByKind ).reduce(\n\t\t\t\t( memo, [ kind, subEntities ] ) => {\n\t\t\t\t\tconst kindReducer = combineReducers(\n\t\t\t\t\t\tsubEntities.reduce(\n\t\t\t\t\t\t\t( kindMemo, entityConfig ) => ( {\n\t\t\t\t\t\t\t\t...kindMemo,\n\t\t\t\t\t\t\t\t[ entityConfig.name ]: entity( entityConfig ),\n\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\n\t\t\t\t\tmemo[ kind ] = kindReducer;\n\t\t\t\t\treturn memo;\n\t\t\t\t},\n\t\t\t\t{}\n\t\t\t)\n\t\t);\n\t}\n\n\tconst newData = entitiesDataReducer( state.records, action );\n\n\tif (\n\t\tnewData === state.records &&\n\t\tnewConfig === state.config &&\n\t\tentitiesDataReducer === state.reducer\n\t) {\n\t\treturn state;\n\t}\n\n\treturn {\n\t\treducer: entitiesDataReducer,\n\t\trecords: newData,\n\t\tconfig: newConfig,\n\t};\n};\n\n/**\n * @type {UndoManager}\n */\nexport function undoManager( state = createUndoManager() ) {\n\treturn state;\n}\n\nexport function editsReference( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'EDIT_ENTITY_RECORD':\n\t\tcase 'UNDO':\n\t\tcase 'REDO':\n\t\t\treturn {};\n\t}\n\treturn state;\n}\n\n/**\n * Reducer managing embed preview data.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function embedPreviews( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_EMBED_PREVIEW':\n\t\t\tconst { url, preview } = action;\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ url ]: preview,\n\t\t\t};\n\t}\n\treturn state;\n}\n\n/**\n * State which tracks whether the user can perform an action on a REST\n * resource.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function userPermissions( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_USER_PERMISSION':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.key ]: action.isAllowed,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer returning autosaves keyed by their parent's post id.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function autosaves( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_AUTOSAVES':\n\t\t\tconst { postId, autosaves: autosavesData } = action;\n\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ postId ]: autosavesData,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\nexport function blockPatterns( state = [], action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_BLOCK_PATTERNS':\n\t\t\treturn action.patterns;\n\t}\n\n\treturn state;\n}\n\nexport function blockPatternCategories( state = [], action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_BLOCK_PATTERN_CATEGORIES':\n\t\t\treturn action.categories;\n\t}\n\n\treturn state;\n}\n\nexport function userPatternCategories( state = [], action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_USER_PATTERN_CATEGORIES':\n\t\t\treturn action.patternCategories;\n\t}\n\treturn state;\n}\n\nexport function navigationFallbackId( state = null, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_NAVIGATION_FALLBACK_ID':\n\t\t\treturn action.fallbackId;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer managing the theme global styles revisions.\n *\n * @param {Record<string, object>} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Record<string, object>} Updated state.\n */\nexport function themeGlobalStyleRevisions( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_THEME_GLOBAL_STYLE_REVISIONS':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.currentId ]: action.revisions,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer managing the template lookup per query.\n *\n * @param {Record<string, string>} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Record<string, string>} Updated state.\n */\nexport function defaultTemplates( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_DEFAULT_TEMPLATE':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ JSON.stringify( action.query ) ]: action.templateId,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\nexport default combineReducers( {\n\tterms,\n\tusers,\n\tcurrentTheme,\n\tcurrentGlobalStylesId,\n\tcurrentUser,\n\tthemeGlobalStyleVariations,\n\tthemeBaseGlobalStyles,\n\tthemeGlobalStyleRevisions,\n\ttaxonomies,\n\tentities,\n\teditsReference,\n\tundoManager,\n\tembedPreviews,\n\tuserPermissions,\n\tautosaves,\n\tblockPatterns,\n\tblockPatternCategories,\n\tuserPatternCategories,\n\tnavigationFallbackId,\n\tdefaultTemplates,\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,aAAa,MAAM,qBAAqB;;AAE/C;AACA;AACA;AACA,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,eAAe,QAAQ,iBAAiB;AACjD,SAASC,iBAAiB,QAAQ,yBAAyB;;AAE3D;AACA;AACA;AACA,SAASC,gBAAgB,EAAEC,aAAa,QAAQ,SAAS;AACzD,SAASC,OAAO,IAAIC,kBAAkB,QAAQ,gBAAgB;AAC9D,SAASC,kBAAkB,EAAEC,kBAAkB,QAAQ,YAAY;;AAEnE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,KAAKA,CAAEC,KAAK,GAAG,CAAC,CAAC,EAAEC,MAAM,EAAG;EAC3C,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,eAAe;MACnB,OAAO;QACN,GAAGF,KAAK;QACR,CAAEC,MAAM,CAACE,QAAQ,GAAIF,MAAM,CAACF;MAC7B,CAAC;EACH;EAEA,OAAOC,KAAK;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASI,KAAKA,CAAEJ,KAAK,GAAG;EAAEK,IAAI,EAAE,CAAC,CAAC;EAAEC,OAAO,EAAE,CAAC;AAAE,CA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AASA,MAAM,CAACC,IAAI;IACnB,KAAK,sCAAsC;MAC1C,OAAO;QACN,GAAGF,KAAK;QACR,CAAEC,MAAM,CAACkG,SAAS,GAAIlG,MAAM,CAACyD;MAC9B,CAAC;EACH;EAEA,OAAO1D,KAAK;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASoG,gBAAgBA,CAAEpG,KAAK,GAAG,CAAC,CAAC,EAAEC,MAAM,EAAG;EACtD,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,0BAA0B;MAC9B,OAAO;QACN,GAAGF,KAAK;QACR,CAAEqG,IAAI,CAACC,SAAS,CAAErG,MAAM,CAAC2C,KAAM,CAAC,GAAI3C,MAAM,CAACsG;MAC5C,CAAC;EACH;EAEA,OAAOvG,KAAK;AACb;AAEA,eAAeT,eAAe,CAAE;EAC/BQ,KAAK;EACLK,KAAK;EACLW,YAAY;EACZG,qBAAqB;EACrBL,WAAW;EACXQ,0BAA0B;EAC1BF,qBAAqB;EACrB+E,yBAAyB;EACzBpF,UAAU;EACVsD,QAAQ;EACRa,cAAc;EACdD,WAAW;EACXE,aAAa;EACbG,eAAe;EACfE,SAAS;EACTG,aAAa;EACbE,sBAAsB;EACtBE,qBAAqB;EACrBE,oBAAoB;EACpBI;AACD,CAAE,CAAC","ignoreList":[]}
|
|
@@ -223,7 +223,7 @@ export const getEntityRecords = (kind, name, query = {}) => async ({
|
|
|
223
223
|
// See https://github.com/WordPress/gutenberg/pull/26575
|
|
224
224
|
if (!query?._fields && !query.context) {
|
|
225
225
|
const key = entityConfig.key || DEFAULT_ENTITY_KEY;
|
|
226
|
-
const resolutionsArgs = records.filter(record => record[key]).map(record => [kind, name, record[key]]);
|
|
226
|
+
const resolutionsArgs = records.filter(record => record?.[key]).map(record => [kind, name, record[key]]);
|
|
227
227
|
dispatch({
|
|
228
228
|
type: 'START_RESOLUTIONS',
|
|
229
229
|
selectorName: 'getEntityRecord',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["camelCase","addQueryArgs","decodeEntities","apiFetch","STORE_NAME","getOrLoadEntitiesConfig","DEFAULT_ENTITY_KEY","forwardResolver","getNormalizedCommaSeparable","getSyncProvider","fetchBlockPatterns","getAuthors","query","dispatch","path","users","receiveUserQuery","getCurrentUser","currentUser","receiveCurrentUser","getEntityRecord","kind","name","key","select","configs","entityConfig","find","config","__experimentalNoFetch","lock","__unstableAcquireStoreLock","exclusive","window","__experimentalEnableSync","syncConfig","globalThis","IS_GUTENBERG_PLUGIN","objectId","getSyncObjectId","bootstrap","syncObjectType","record","receiveEntityRecords","type","recordId","edits","meta","undo","undefined","_fields","Set","join","baseURL","baseURLParams","include","hasRecords","hasEntityRecords","__unstableReleaseStoreLock","getRawEntityRecord","getEditedEntityRecord","getEntityRecords","registry","records","supportsPagination","per_page","response","parse","Object","values","json","totalItems","parseInt","headers","get","totalPages","map","split","forEach","field","hasOwnProperty","batch","context","resolutionsArgs","filter","selectorName","args","e","shouldInvalidate","action","invalidateCache","getCurrentTheme","resolveSelect","activeThemes","status","receiveCurrentTheme","getThemeSupports","getEmbedPreview","url","embedProxyResponse","receiveEmbedPreview","error","canUser","requestedAction","resource","id","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","__experimentalGetCurrentGlobalStylesId","globalStylesURL","_links","href","globalStylesObject","__experimentalReceiveCurrentGlobalStylesId","__experimentalGetCurrentThemeBaseGlobalStyles","currentTheme","themeGlobalStyles","stylesheet","__experimentalReceiveThemeBaseGlobalStyles","__experimentalGetCurrentThemeGlobalStylesVariations","variations","__experimentalReceiveThemeGlobalStyleVariations","getCurrentThemeGlobalStylesRevisions","globalStylesId","revisionsURL","resetRevisions","revisions","revision","fromEntries","value","receiveThemeGlobalStyleRevisions","getBlockPatterns","patterns","getBlockPatternCategories","categories","getUserPatternCategories","patternCategories","mappedPatternCategories","userCategory","label","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';\nimport { fetchBlockPatterns } from './fetch';\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, name ) );\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 ( globalThis.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, registry } ) => {\n\t\tconst configs = await dispatch( getOrLoadEntitiesConfig( kind, name ) );\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\ttotalPages: parseInt(\n\t\t\t\t\t\tresponse.headers.get( 'X-WP-TotalPages' )\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\tregistry.batch( () => {\n\t\t\t\tdispatch.receiveEntityRecords(\n\t\t\t\t\tkind,\n\t\t\t\t\tname,\n\t\t\t\t\trecords,\n\t\t\t\t\tquery,\n\t\t\t\t\tfalse,\n\t\t\t\t\tundefined,\n\t\t\t\t\tmeta\n\t\t\t\t);\n\n\t\t\t\t// When requesting all fields, the list of results can be used to\n\t\t\t\t// resolve the `getEntityRecord` selector in addition to `getEntityRecords`.\n\t\t\t\t// See https://github.com/WordPress/gutenberg/pull/26575\n\t\t\t\tif ( ! query?._fields && ! query.context ) {\n\t\t\t\t\tconst key = entityConfig.key || DEFAULT_ENTITY_KEY;\n\t\t\t\t\tconst resolutionsArgs = records\n\t\t\t\t\t\t.filter( ( record ) => record[ key ] )\n\t\t\t\t\t\t.map( ( record ) => [ kind, name, record[ key ] ] );\n\n\t\t\t\t\tdispatch( {\n\t\t\t\t\t\ttype: 'START_RESOLUTIONS',\n\t\t\t\t\t\tselectorName: 'getEntityRecord',\n\t\t\t\t\t\targs: resolutionsArgs,\n\t\t\t\t\t} );\n\t\t\t\t\tdispatch( {\n\t\t\t\t\t\ttype: 'FINISH_RESOLUTIONS',\n\t\t\t\t\t\tselectorName: 'getEntityRecord',\n\t\t\t\t\t\targs: resolutionsArgs,\n\t\t\t\t\t} );\n\t\t\t\t}\n\n\t\t\t\tdispatch.__unstableReleaseStoreLock( lock );\n\t\t\t} );\n\t\t} catch ( e ) {\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, name ) );\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 patterns = await fetchBlockPatterns();\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\t// Endpoint may return an empty object if no template is found.\n\t\tif ( template?.id ) {\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, name ) );\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, name ) );\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\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names":["camelCase","addQueryArgs","decodeEntities","apiFetch","STORE_NAME","getOrLoadEntitiesConfig","DEFAULT_ENTITY_KEY","forwardResolver","getNormalizedCommaSeparable","getSyncProvider","fetchBlockPatterns","getAuthors","query","dispatch","path","users","receiveUserQuery","getCurrentUser","currentUser","receiveCurrentUser","getEntityRecord","kind","name","key","select","configs","entityConfig","find","config","__experimentalNoFetch","lock","__unstableAcquireStoreLock","exclusive","window","__experimentalEnableSync","syncConfig","globalThis","IS_GUTENBERG_PLUGIN","objectId","getSyncObjectId","bootstrap","syncObjectType","record","receiveEntityRecords","type","recordId","edits","meta","undo","undefined","_fields","Set","join","baseURL","baseURLParams","include","hasRecords","hasEntityRecords","__unstableReleaseStoreLock","getRawEntityRecord","getEditedEntityRecord","getEntityRecords","registry","records","supportsPagination","per_page","response","parse","Object","values","json","totalItems","parseInt","headers","get","totalPages","map","split","forEach","field","hasOwnProperty","batch","context","resolutionsArgs","filter","selectorName","args","e","shouldInvalidate","action","invalidateCache","getCurrentTheme","resolveSelect","activeThemes","status","receiveCurrentTheme","getThemeSupports","getEmbedPreview","url","embedProxyResponse","receiveEmbedPreview","error","canUser","requestedAction","resource","id","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","__experimentalGetCurrentGlobalStylesId","globalStylesURL","_links","href","globalStylesObject","__experimentalReceiveCurrentGlobalStylesId","__experimentalGetCurrentThemeBaseGlobalStyles","currentTheme","themeGlobalStyles","stylesheet","__experimentalReceiveThemeBaseGlobalStyles","__experimentalGetCurrentThemeGlobalStylesVariations","variations","__experimentalReceiveThemeGlobalStyleVariations","getCurrentThemeGlobalStylesRevisions","globalStylesId","revisionsURL","resetRevisions","revisions","revision","fromEntries","value","receiveThemeGlobalStyleRevisions","getBlockPatterns","patterns","getBlockPatternCategories","categories","getUserPatternCategories","patternCategories","mappedPatternCategories","userCategory","label","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';\nimport { fetchBlockPatterns } from './fetch';\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, name ) );\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 ( globalThis.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, registry } ) => {\n\t\tconst configs = await dispatch( getOrLoadEntitiesConfig( kind, name ) );\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\ttotalPages: parseInt(\n\t\t\t\t\t\tresponse.headers.get( 'X-WP-TotalPages' )\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\tregistry.batch( () => {\n\t\t\t\tdispatch.receiveEntityRecords(\n\t\t\t\t\tkind,\n\t\t\t\t\tname,\n\t\t\t\t\trecords,\n\t\t\t\t\tquery,\n\t\t\t\t\tfalse,\n\t\t\t\t\tundefined,\n\t\t\t\t\tmeta\n\t\t\t\t);\n\n\t\t\t\t// When requesting all fields, the list of results can be used to\n\t\t\t\t// resolve the `getEntityRecord` selector in addition to `getEntityRecords`.\n\t\t\t\t// See https://github.com/WordPress/gutenberg/pull/26575\n\t\t\t\tif ( ! query?._fields && ! query.context ) {\n\t\t\t\t\tconst key = entityConfig.key || DEFAULT_ENTITY_KEY;\n\t\t\t\t\tconst resolutionsArgs = records\n\t\t\t\t\t\t.filter( ( record ) => record?.[ key ] )\n\t\t\t\t\t\t.map( ( record ) => [ kind, name, record[ key ] ] );\n\n\t\t\t\t\tdispatch( {\n\t\t\t\t\t\ttype: 'START_RESOLUTIONS',\n\t\t\t\t\t\tselectorName: 'getEntityRecord',\n\t\t\t\t\t\targs: resolutionsArgs,\n\t\t\t\t\t} );\n\t\t\t\t\tdispatch( {\n\t\t\t\t\t\ttype: 'FINISH_RESOLUTIONS',\n\t\t\t\t\t\tselectorName: 'getEntityRecord',\n\t\t\t\t\t\targs: resolutionsArgs,\n\t\t\t\t\t} );\n\t\t\t\t}\n\n\t\t\t\tdispatch.__unstableReleaseStoreLock( lock );\n\t\t\t} );\n\t\t} catch ( e ) {\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, name ) );\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 patterns = await fetchBlockPatterns();\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\t// Endpoint may return an empty object if no template is found.\n\t\tif ( template?.id ) {\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, name ) );\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, name ) );\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"],"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
|
|
|
125
125
|
* Custom font sizes if defined by the theme.
|
|
126
126
|
*/
|
|
127
127
|
'editor-font-sizes': boolean | FontSize[];
|
|
128
|
+
/**
|
|
129
|
+
* Custom spacing sizes if defined by the theme.
|
|
130
|
+
*/
|
|
131
|
+
'editor-spacing-sizes': boolean | SpacingSize[];
|
|
128
132
|
/**
|
|
129
133
|
* Custom gradient presets if defined by the theme.
|
|
130
134
|
*/
|
|
@@ -202,6 +206,11 @@ declare module './base-entity-records' {
|
|
|
202
206
|
size: number;
|
|
203
207
|
slug: string;
|
|
204
208
|
}
|
|
209
|
+
interface SpacingSize {
|
|
210
|
+
name: string;
|
|
211
|
+
size: number;
|
|
212
|
+
slug: string;
|
|
213
|
+
}
|
|
205
214
|
interface GradientPreset {
|
|
206
215
|
name: string;
|
|
207
216
|
gradient: string;
|