@wordpress/core-data 7.11.0 → 7.12.1-next.082ed6819.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/README.md +2 -0
- package/build/entities.js +3 -1
- package/build/entities.js.map +1 -1
- package/build/entity-types/settings.js.map +1 -1
- package/build/hooks/use-entity-record.js +2 -0
- package/build/hooks/use-entity-record.js.map +1 -1
- package/build/lock-unlock.js.map +1 -1
- package/build/private-apis.js +3 -1
- package/build/private-apis.js.map +1 -1
- package/build/private-selectors.js +110 -1
- package/build/private-selectors.js.map +1 -1
- package/build/resolvers.js +44 -45
- package/build/resolvers.js.map +1 -1
- package/build/selectors.js +0 -19
- package/build/selectors.js.map +1 -1
- package/build/utils/index.js +7 -0
- package/build/utils/index.js.map +1 -1
- package/build/utils/receive-intermediate-results.js +8 -0
- package/build/utils/receive-intermediate-results.js.map +1 -0
- package/build-module/entities.js +3 -1
- package/build-module/entities.js.map +1 -1
- package/build-module/entity-types/settings.js.map +1 -1
- package/build-module/hooks/use-entity-record.js +2 -0
- package/build-module/hooks/use-entity-record.js.map +1 -1
- package/build-module/lock-unlock.js.map +1 -1
- package/build-module/private-apis.js +3 -1
- package/build-module/private-apis.js.map +1 -1
- package/build-module/private-selectors.js +107 -1
- package/build-module/private-selectors.js.map +1 -1
- package/build-module/resolvers.js +44 -44
- package/build-module/resolvers.js.map +1 -1
- package/build-module/selectors.js +0 -18
- package/build-module/selectors.js.map +1 -1
- package/build-module/utils/index.js +1 -0
- package/build-module/utils/index.js.map +1 -1
- package/build-module/utils/receive-intermediate-results.js +2 -0
- package/build-module/utils/receive-intermediate-results.js.map +1 -0
- package/build-types/entities.d.ts.map +1 -1
- package/build-types/entity-types/settings.d.ts +4 -0
- package/build-types/entity-types/settings.d.ts.map +1 -1
- package/build-types/hooks/use-entity-record.d.ts +2 -0
- package/build-types/hooks/use-entity-record.d.ts.map +1 -1
- package/build-types/index.d.ts +0 -1
- package/build-types/index.d.ts.map +1 -1
- package/build-types/lock-unlock.d.ts +1 -2
- package/build-types/lock-unlock.d.ts.map +1 -1
- package/build-types/private-apis.d.ts.map +1 -1
- package/build-types/private-selectors.d.ts +4 -1
- package/build-types/private-selectors.d.ts.map +1 -1
- package/build-types/queried-data/reducer.d.ts +10 -2
- package/build-types/reducer.d.ts +24 -2
- package/build-types/reducer.d.ts.map +1 -1
- package/build-types/resolvers.d.ts +3 -8
- package/build-types/resolvers.d.ts.map +1 -1
- package/build-types/selectors.d.ts +0 -9
- package/build-types/selectors.d.ts.map +1 -1
- package/build-types/utils/index.d.ts +1 -0
- package/build-types/utils/receive-intermediate-results.d.ts +2 -0
- package/build-types/utils/receive-intermediate-results.d.ts.map +1 -0
- package/package.json +18 -18
- package/src/entities.js +4 -0
- package/src/entity-types/settings.ts +4 -0
- package/src/hooks/use-entity-record.ts +2 -0
- package/src/private-apis.js +2 -0
- package/src/private-selectors.ts +149 -1
- package/src/resolvers.js +66 -61
- package/src/selectors.ts +0 -32
- package/src/utils/index.js +1 -0
- package/src/utils/receive-intermediate-results.js +3 -0
- package/tsconfig.tsbuildinfo +1 -1
- /package/src/{lock-unlock.js → lock-unlock.ts} +0 -0
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -1083,6 +1083,8 @@ function PageRenameForm( { id } ) {
|
|
|
1083
1083
|
return (
|
|
1084
1084
|
<form onSubmit={ onRename }>
|
|
1085
1085
|
<TextControl
|
|
1086
|
+
__nextHasNoMarginBottom
|
|
1087
|
+
__next40pxDefaultSize
|
|
1086
1088
|
label={ __( 'Name' ) }
|
|
1087
1089
|
value={ page.editedRecord.title }
|
|
1088
1090
|
onChange={ setTitle }
|
package/build/entities.js
CHANGED
|
@@ -25,7 +25,9 @@ const rootEntitiesConfig = exports.rootEntitiesConfig = [{
|
|
|
25
25
|
name: '__unstableBase',
|
|
26
26
|
baseURL: '/',
|
|
27
27
|
baseURLParams: {
|
|
28
|
-
|
|
28
|
+
// Please also change the preload path when changing this.
|
|
29
|
+
// @see lib/compat/wordpress-6.8/preload.php
|
|
30
|
+
_fields: ['description', 'gmt_offset', 'home', 'name', 'site_icon', 'site_icon_url', 'site_logo', 'timezone_string', 'default_template_part_areas', 'default_template_types', 'url'].join(',')
|
|
29
31
|
},
|
|
30
32
|
// The entity doesn't support selecting multiple records.
|
|
31
33
|
// The property is maintained for backward compatibility.
|
package/build/entities.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_changeCase","require","_apiFetch","_interopRequireDefault","_i18n","_richText","DEFAULT_ENTITY_KEY","exports","POST_RAW_ATTRIBUTES","rootEntitiesConfig","label","__","kind","name","baseURL","baseURLParams","_fields","join","plural","syncConfig","fetch","apiFetch","path","applyChangesToDoc","doc","changes","document","getMap","Object","entries","forEach","key","value","get","set","fromCRDTDoc","toJSON","syncObjectType","getSyncObjectId","context","id","rawAttributes","supportsPagination","transientEdits","blocks","getTitle","record","title","rendered","getRevisionsUrl","parentId","revisionId","additionalEntityConfigLoaders","loadEntities","loadPostTypeEntities","loadTaxonomyEntities","loadSiteEntity","prePersistPostType","persistedRecord","edits","newEdits","status","serialisableBlocksCache","WeakMap","makeBlockAttributesSerializable","attributes","newAttributes","RichTextData","valueOf","makeBlocksSerializable","map","block","innerBlocks","rest","postTypes","postType","_postType$rest_namesp","isTemplate","includes","namespace","rest_namespace","rest_base","selection","mergedEdits","meta","_record$slug","capitalCase","slug","String","__unstablePrePersist","undefined","__unstable_rest_base","has","revisionKey","taxonomies","taxonomy","_taxonomy$rest_namesp","_site$schema$properti","entity","site","method","labels","schema","properties","getMethodName","prefix","kindPrefix","pascalCase","suffix"],"sources":["@wordpress/core-data/src/entities.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { capitalCase, pascalCase } from 'change-case';\n\n/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\nimport { __ } from '@wordpress/i18n';\nimport { RichTextData } from '@wordpress/rich-text';\n\nexport const DEFAULT_ENTITY_KEY = 'id';\nconst POST_RAW_ATTRIBUTES = [ 'title', 'excerpt', 'content' ];\n\nexport const rootEntitiesConfig = [\n\t{\n\t\tlabel: __( 'Base' ),\n\t\tkind: 'root',\n\t\tname: '__unstableBase',\n\t\tbaseURL: '/',\n\t\tbaseURLParams: {\n\t\t\t_fields: [\n\t\t\t\t'description',\n\t\t\t\t'gmt_offset',\n\t\t\t\t'home',\n\t\t\t\t'name',\n\t\t\t\t'site_icon',\n\t\t\t\t'site_icon_url',\n\t\t\t\t'site_logo',\n\t\t\t\t'timezone_string',\n\t\t\t\t'url',\n\t\t\t].join( ',' ),\n\t\t},\n\t\t// The entity doesn't support selecting multiple records.\n\t\t// The property is maintained for backward compatibility.\n\t\tplural: '__unstableBases',\n\t\tsyncConfig: {\n\t\t\tfetch: async () => {\n\t\t\t\treturn apiFetch( { path: '/' } );\n\t\t\t},\n\t\t\tapplyChangesToDoc: ( doc, changes ) => {\n\t\t\t\tconst document = doc.getMap( 'document' );\n\t\t\t\tObject.entries( changes ).forEach( ( [ key, value ] ) => {\n\t\t\t\t\tif ( document.get( key ) !== value ) {\n\t\t\t\t\t\tdocument.set( key, value );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t},\n\t\t\tfromCRDTDoc: ( doc ) => {\n\t\t\t\treturn doc.getMap( 'document' ).toJSON();\n\t\t\t},\n\t\t},\n\t\tsyncObjectType: 'root/base',\n\t\tgetSyncObjectId: () => 'index',\n\t},\n\t{\n\t\tlabel: __( 'Post Type' ),\n\t\tname: 'postType',\n\t\tkind: 'root',\n\t\tkey: 'slug',\n\t\tbaseURL: '/wp/v2/types',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'postTypes',\n\t\tsyncConfig: {\n\t\t\tfetch: async ( id ) => {\n\t\t\t\treturn apiFetch( {\n\t\t\t\t\tpath: `/wp/v2/types/${ id }?context=edit`,\n\t\t\t\t} );\n\t\t\t},\n\t\t\tapplyChangesToDoc: ( doc, changes ) => {\n\t\t\t\tconst document = doc.getMap( 'document' );\n\t\t\t\tObject.entries( changes ).forEach( ( [ key, value ] ) => {\n\t\t\t\t\tif ( document.get( key ) !== value ) {\n\t\t\t\t\t\tdocument.set( key, value );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t},\n\t\t\tfromCRDTDoc: ( doc ) => {\n\t\t\t\treturn doc.getMap( 'document' ).toJSON();\n\t\t\t},\n\t\t},\n\t\tsyncObjectType: 'root/postType',\n\t\tgetSyncObjectId: ( id ) => id,\n\t},\n\t{\n\t\tname: 'media',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/media',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'mediaItems',\n\t\tlabel: __( 'Media' ),\n\t\trawAttributes: [ 'caption', 'title', 'description' ],\n\t\tsupportsPagination: true,\n\t},\n\t{\n\t\tname: 'taxonomy',\n\t\tkind: 'root',\n\t\tkey: 'slug',\n\t\tbaseURL: '/wp/v2/taxonomies',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'taxonomies',\n\t\tlabel: __( 'Taxonomy' ),\n\t},\n\t{\n\t\tname: 'sidebar',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/sidebars',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'sidebars',\n\t\ttransientEdits: { blocks: true },\n\t\tlabel: __( 'Widget areas' ),\n\t},\n\t{\n\t\tname: 'widget',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/widgets',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'widgets',\n\t\ttransientEdits: { blocks: true },\n\t\tlabel: __( 'Widgets' ),\n\t},\n\t{\n\t\tname: 'widgetType',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/widget-types',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'widgetTypes',\n\t\tlabel: __( 'Widget types' ),\n\t},\n\t{\n\t\tlabel: __( 'User' ),\n\t\tname: 'user',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/users',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'users',\n\t},\n\t{\n\t\tname: 'comment',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/comments',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'comments',\n\t\tlabel: __( 'Comment' ),\n\t},\n\t{\n\t\tname: 'menu',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/menus',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'menus',\n\t\tlabel: __( 'Menu' ),\n\t},\n\t{\n\t\tname: 'menuItem',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/menu-items',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'menuItems',\n\t\tlabel: __( 'Menu Item' ),\n\t\trawAttributes: [ 'title' ],\n\t},\n\t{\n\t\tname: 'menuLocation',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/menu-locations',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'menuLocations',\n\t\tlabel: __( 'Menu Location' ),\n\t\tkey: 'name',\n\t},\n\t{\n\t\tlabel: __( 'Global Styles' ),\n\t\tname: 'globalStyles',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/global-styles',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'globalStylesVariations', // Should be different from name.\n\t\tgetTitle: ( record ) => record?.title?.rendered || record?.title,\n\t\tgetRevisionsUrl: ( parentId, revisionId ) =>\n\t\t\t`/wp/v2/global-styles/${ parentId }/revisions${\n\t\t\t\trevisionId ? '/' + revisionId : ''\n\t\t\t}`,\n\t\tsupportsPagination: true,\n\t},\n\t{\n\t\tlabel: __( 'Themes' ),\n\t\tname: 'theme',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/themes',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'themes',\n\t\tkey: 'stylesheet',\n\t},\n\t{\n\t\tlabel: __( 'Plugins' ),\n\t\tname: 'plugin',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/plugins',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'plugins',\n\t\tkey: 'plugin',\n\t},\n\t{\n\t\tlabel: __( 'Status' ),\n\t\tname: 'status',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/statuses',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'statuses',\n\t\tkey: 'slug',\n\t},\n];\n\nexport const additionalEntityConfigLoaders = [\n\t{ kind: 'postType', loadEntities: loadPostTypeEntities },\n\t{ kind: 'taxonomy', loadEntities: loadTaxonomyEntities },\n\t{\n\t\tkind: 'root',\n\t\tname: 'site',\n\t\tplural: 'sites',\n\t\tloadEntities: loadSiteEntity,\n\t},\n];\n\n/**\n * Returns a function to be used to retrieve extra edits to apply before persisting a post type.\n *\n * @param {Object} persistedRecord Already persisted Post\n * @param {Object} edits Edits.\n * @return {Object} Updated edits.\n */\nexport const prePersistPostType = ( persistedRecord, edits ) => {\n\tconst newEdits = {};\n\n\tif ( persistedRecord?.status === 'auto-draft' ) {\n\t\t// Saving an auto-draft should create a draft by default.\n\t\tif ( ! edits.status && ! newEdits.status ) {\n\t\t\tnewEdits.status = 'draft';\n\t\t}\n\n\t\t// Fix the auto-draft default title.\n\t\tif (\n\t\t\t( ! edits.title || edits.title === 'Auto Draft' ) &&\n\t\t\t! newEdits.title &&\n\t\t\t( ! persistedRecord?.title ||\n\t\t\t\tpersistedRecord?.title === 'Auto Draft' )\n\t\t) {\n\t\t\tnewEdits.title = '';\n\t\t}\n\t}\n\n\treturn newEdits;\n};\n\nconst serialisableBlocksCache = new WeakMap();\n\nfunction makeBlockAttributesSerializable( attributes ) {\n\tconst newAttributes = { ...attributes };\n\tfor ( const [ key, value ] of Object.entries( attributes ) ) {\n\t\tif ( value instanceof RichTextData ) {\n\t\t\tnewAttributes[ key ] = value.valueOf();\n\t\t}\n\t}\n\treturn newAttributes;\n}\n\nfunction makeBlocksSerializable( blocks ) {\n\treturn blocks.map( ( block ) => {\n\t\tconst { innerBlocks, attributes, ...rest } = block;\n\t\treturn {\n\t\t\t...rest,\n\t\t\tattributes: makeBlockAttributesSerializable( attributes ),\n\t\t\tinnerBlocks: makeBlocksSerializable( innerBlocks ),\n\t\t};\n\t} );\n}\n\n/**\n * Returns the list of post type entities.\n *\n * @return {Promise} Entities promise\n */\nasync function loadPostTypeEntities() {\n\tconst postTypes = await apiFetch( {\n\t\tpath: '/wp/v2/types?context=view',\n\t} );\n\treturn Object.entries( postTypes ?? {} ).map( ( [ name, postType ] ) => {\n\t\tconst isTemplate = [ 'wp_template', 'wp_template_part' ].includes(\n\t\t\tname\n\t\t);\n\t\tconst namespace = postType?.rest_namespace ?? 'wp/v2';\n\t\treturn {\n\t\t\tkind: 'postType',\n\t\t\tbaseURL: `/${ namespace }/${ postType.rest_base }`,\n\t\t\tbaseURLParams: { context: 'edit' },\n\t\t\tname,\n\t\t\tlabel: postType.name,\n\t\t\ttransientEdits: {\n\t\t\t\tblocks: true,\n\t\t\t\tselection: true,\n\t\t\t},\n\t\t\tmergedEdits: { meta: true },\n\t\t\trawAttributes: POST_RAW_ATTRIBUTES,\n\t\t\tgetTitle: ( record ) =>\n\t\t\t\trecord?.title?.rendered ||\n\t\t\t\trecord?.title ||\n\t\t\t\t( isTemplate\n\t\t\t\t\t? capitalCase( record.slug ?? '' )\n\t\t\t\t\t: String( record.id ) ),\n\t\t\t__unstablePrePersist: isTemplate ? undefined : prePersistPostType,\n\t\t\t__unstable_rest_base: postType.rest_base,\n\t\t\tsyncConfig: {\n\t\t\t\tfetch: async ( id ) => {\n\t\t\t\t\treturn apiFetch( {\n\t\t\t\t\t\tpath: `/${ namespace }/${ postType.rest_base }/${ id }?context=edit`,\n\t\t\t\t\t} );\n\t\t\t\t},\n\t\t\t\tapplyChangesToDoc: ( doc, changes ) => {\n\t\t\t\t\tconst document = doc.getMap( 'document' );\n\n\t\t\t\t\tObject.entries( changes ).forEach( ( [ key, value ] ) => {\n\t\t\t\t\t\tif ( typeof value !== 'function' ) {\n\t\t\t\t\t\t\tif ( key === 'blocks' ) {\n\t\t\t\t\t\t\t\tif ( ! serialisableBlocksCache.has( value ) ) {\n\t\t\t\t\t\t\t\t\tserialisableBlocksCache.set(\n\t\t\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t\t\t\tmakeBlocksSerializable( value )\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tvalue = serialisableBlocksCache.get( value );\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif ( document.get( key ) !== value ) {\n\t\t\t\t\t\t\t\tdocument.set( key, value );\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\tfromCRDTDoc: ( doc ) => {\n\t\t\t\t\treturn doc.getMap( 'document' ).toJSON();\n\t\t\t\t},\n\t\t\t},\n\t\t\tsyncObjectType: 'postType/' + postType.name,\n\t\t\tgetSyncObjectId: ( id ) => id,\n\t\t\tsupportsPagination: true,\n\t\t\tgetRevisionsUrl: ( parentId, revisionId ) =>\n\t\t\t\t`/${ namespace }/${\n\t\t\t\t\tpostType.rest_base\n\t\t\t\t}/${ parentId }/revisions${\n\t\t\t\t\trevisionId ? '/' + revisionId : ''\n\t\t\t\t}`,\n\t\t\trevisionKey: isTemplate ? 'wp_id' : DEFAULT_ENTITY_KEY,\n\t\t};\n\t} );\n}\n\n/**\n * Returns the list of the taxonomies entities.\n *\n * @return {Promise} Entities promise\n */\nasync function loadTaxonomyEntities() {\n\tconst taxonomies = await apiFetch( {\n\t\tpath: '/wp/v2/taxonomies?context=view',\n\t} );\n\treturn Object.entries( taxonomies ?? {} ).map( ( [ name, taxonomy ] ) => {\n\t\tconst namespace = taxonomy?.rest_namespace ?? 'wp/v2';\n\t\treturn {\n\t\t\tkind: 'taxonomy',\n\t\t\tbaseURL: `/${ namespace }/${ taxonomy.rest_base }`,\n\t\t\tbaseURLParams: { context: 'edit' },\n\t\t\tname,\n\t\t\tlabel: taxonomy.name,\n\t\t};\n\t} );\n}\n\n/**\n * Returns the Site entity.\n *\n * @return {Promise} Entity promise\n */\nasync function loadSiteEntity() {\n\tconst entity = {\n\t\tlabel: __( 'Site' ),\n\t\tname: 'site',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/settings',\n\t\tsyncConfig: {\n\t\t\tfetch: async () => {\n\t\t\t\treturn apiFetch( { path: '/wp/v2/settings' } );\n\t\t\t},\n\t\t\tapplyChangesToDoc: ( doc, changes ) => {\n\t\t\t\tconst document = doc.getMap( 'document' );\n\t\t\t\tObject.entries( changes ).forEach( ( [ key, value ] ) => {\n\t\t\t\t\tif ( document.get( key ) !== value ) {\n\t\t\t\t\t\tdocument.set( key, value );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t},\n\t\t\tfromCRDTDoc: ( doc ) => {\n\t\t\t\treturn doc.getMap( 'document' ).toJSON();\n\t\t\t},\n\t\t},\n\t\tsyncObjectType: 'root/site',\n\t\tgetSyncObjectId: () => 'index',\n\t\tmeta: {},\n\t};\n\n\tconst site = await apiFetch( {\n\t\tpath: entity.baseURL,\n\t\tmethod: 'OPTIONS',\n\t} );\n\n\tconst labels = {};\n\tObject.entries( site?.schema?.properties ?? {} ).forEach(\n\t\t( [ key, value ] ) => {\n\t\t\t// Ignore properties `title` and `type` keys.\n\t\t\tif ( typeof value === 'object' && value.title ) {\n\t\t\t\tlabels[ key ] = value.title;\n\t\t\t}\n\t\t}\n\t);\n\n\treturn [ { ...entity, meta: { labels } } ];\n}\n\n/**\n * Returns the entity's getter method name given its kind and name or plural name.\n *\n * @example\n * ```js\n * const nameSingular = getMethodName( 'root', 'theme', 'get' );\n * // nameSingular is getRootTheme\n *\n * const namePlural = getMethodName( 'root', 'themes', 'set' );\n * // namePlural is setRootThemes\n * ```\n *\n * @param {string} kind Entity kind.\n * @param {string} name Entity name or plural name.\n * @param {string} prefix Function prefix.\n *\n * @return {string} Method name\n */\nexport const getMethodName = ( kind, name, prefix = 'get' ) => {\n\tconst kindPrefix = kind === 'root' ? '' : pascalCase( kind );\n\tconst suffix = pascalCase( name );\n\treturn `${ prefix }${ kindPrefix }${ suffix }`;\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAKA,IAAAC,SAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AAVA;AACA;AACA;;AAGA;AACA;AACA;;AAKO,MAAMK,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAAG,IAAI;AACtC,MAAME,mBAAmB,GAAG,CAAE,OAAO,EAAE,SAAS,EAAE,SAAS,CAAE;AAEtD,MAAMC,kBAAkB,GAAAF,OAAA,CAAAE,kBAAA,GAAG,CACjC;EACCC,KAAK,EAAE,IAAAC,QAAE,EAAE,MAAO,CAAC;EACnBC,IAAI,EAAE,MAAM;EACZC,IAAI,EAAE,gBAAgB;EACtBC,OAAO,EAAE,GAAG;EACZC,aAAa,EAAE;IACdC,OAAO,EAAE,CACR,aAAa,EACb,YAAY,EACZ,MAAM,EACN,MAAM,EACN,WAAW,EACX,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,KAAK,CACL,CAACC,IAAI,CAAE,GAAI;EACb,CAAC;EACD;EACA;EACAC,MAAM,EAAE,iBAAiB;EACzBC,UAAU,EAAE;IACXC,KAAK,EAAE,MAAAA,CAAA,KAAY;MAClB,OAAO,IAAAC,iBAAQ,EAAE;QAAEC,IAAI,EAAE;MAAI,CAAE,CAAC;IACjC,CAAC;IACDC,iBAAiB,EAAEA,CAAEC,GAAG,EAAEC,OAAO,KAAM;MACtC,MAAMC,QAAQ,GAAGF,GAAG,CAACG,MAAM,CAAE,UAAW,CAAC;MACzCC,MAAM,CAACC,OAAO,CAAEJ,OAAQ,CAAC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C,IAAI,EAAE,CAAC;EACR,CAAC;EAED,MAAMe,IAAI,GAAG,MAAM,IAAA9E,iBAAQ,EAAE;IAC5BC,IAAI,EAAE4E,MAAM,CAACpF,OAAO;IACpBsF,MAAM,EAAE;EACT,CAAE,CAAC;EAEH,MAAMC,MAAM,GAAG,CAAC,CAAC;EACjBzE,MAAM,CAACC,OAAO,EAAAoE,qBAAA,GAAEE,IAAI,EAAEG,MAAM,EAAEC,UAAU,cAAAN,qBAAA,cAAAA,qBAAA,GAAI,CAAC,CAAE,CAAC,CAACnE,OAAO,CACvD,CAAE,CAAEC,GAAG,EAAEC,KAAK,CAAE,KAAM;IACrB;IACA,IAAK,OAAOA,KAAK,KAAK,QAAQ,IAAIA,KAAK,CAACe,KAAK,EAAG;MAC/CsD,MAAM,CAAEtE,GAAG,CAAE,GAAGC,KAAK,CAACe,KAAK;IAC5B;EACD,CACD,CAAC;EAED,OAAO,CAAE;IAAE,GAAGmD,MAAM;IAAEd,IAAI,EAAE;MAAEiB;IAAO;EAAE,CAAC,CAAE;AAC3C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMG,aAAa,GAAGA,CAAE5F,IAAI,EAAEC,IAAI,EAAE4F,MAAM,GAAG,KAAK,KAAM;EAC9D,MAAMC,UAAU,GAAG9F,IAAI,KAAK,MAAM,GAAG,EAAE,GAAG,IAAA+F,sBAAU,EAAE/F,IAAK,CAAC;EAC5D,MAAMgG,MAAM,GAAG,IAAAD,sBAAU,EAAE9F,IAAK,CAAC;EACjC,OAAO,GAAI4F,MAAM,GAAKC,UAAU,GAAKE,MAAM,EAAG;AAC/C,CAAC;AAACrG,OAAA,CAAAiG,aAAA,GAAAA,aAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_changeCase","require","_apiFetch","_interopRequireDefault","_i18n","_richText","DEFAULT_ENTITY_KEY","exports","POST_RAW_ATTRIBUTES","rootEntitiesConfig","label","__","kind","name","baseURL","baseURLParams","_fields","join","plural","syncConfig","fetch","apiFetch","path","applyChangesToDoc","doc","changes","document","getMap","Object","entries","forEach","key","value","get","set","fromCRDTDoc","toJSON","syncObjectType","getSyncObjectId","context","id","rawAttributes","supportsPagination","transientEdits","blocks","getTitle","record","title","rendered","getRevisionsUrl","parentId","revisionId","additionalEntityConfigLoaders","loadEntities","loadPostTypeEntities","loadTaxonomyEntities","loadSiteEntity","prePersistPostType","persistedRecord","edits","newEdits","status","serialisableBlocksCache","WeakMap","makeBlockAttributesSerializable","attributes","newAttributes","RichTextData","valueOf","makeBlocksSerializable","map","block","innerBlocks","rest","postTypes","postType","_postType$rest_namesp","isTemplate","includes","namespace","rest_namespace","rest_base","selection","mergedEdits","meta","_record$slug","capitalCase","slug","String","__unstablePrePersist","undefined","__unstable_rest_base","has","revisionKey","taxonomies","taxonomy","_taxonomy$rest_namesp","_site$schema$properti","entity","site","method","labels","schema","properties","getMethodName","prefix","kindPrefix","pascalCase","suffix"],"sources":["@wordpress/core-data/src/entities.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { capitalCase, pascalCase } from 'change-case';\n\n/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\nimport { __ } from '@wordpress/i18n';\nimport { RichTextData } from '@wordpress/rich-text';\n\nexport const DEFAULT_ENTITY_KEY = 'id';\nconst POST_RAW_ATTRIBUTES = [ 'title', 'excerpt', 'content' ];\n\nexport const rootEntitiesConfig = [\n\t{\n\t\tlabel: __( 'Base' ),\n\t\tkind: 'root',\n\t\tname: '__unstableBase',\n\t\tbaseURL: '/',\n\t\tbaseURLParams: {\n\t\t\t// Please also change the preload path when changing this.\n\t\t\t// @see lib/compat/wordpress-6.8/preload.php\n\t\t\t_fields: [\n\t\t\t\t'description',\n\t\t\t\t'gmt_offset',\n\t\t\t\t'home',\n\t\t\t\t'name',\n\t\t\t\t'site_icon',\n\t\t\t\t'site_icon_url',\n\t\t\t\t'site_logo',\n\t\t\t\t'timezone_string',\n\t\t\t\t'default_template_part_areas',\n\t\t\t\t'default_template_types',\n\t\t\t\t'url',\n\t\t\t].join( ',' ),\n\t\t},\n\t\t// The entity doesn't support selecting multiple records.\n\t\t// The property is maintained for backward compatibility.\n\t\tplural: '__unstableBases',\n\t\tsyncConfig: {\n\t\t\tfetch: async () => {\n\t\t\t\treturn apiFetch( { path: '/' } );\n\t\t\t},\n\t\t\tapplyChangesToDoc: ( doc, changes ) => {\n\t\t\t\tconst document = doc.getMap( 'document' );\n\t\t\t\tObject.entries( changes ).forEach( ( [ key, value ] ) => {\n\t\t\t\t\tif ( document.get( key ) !== value ) {\n\t\t\t\t\t\tdocument.set( key, value );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t},\n\t\t\tfromCRDTDoc: ( doc ) => {\n\t\t\t\treturn doc.getMap( 'document' ).toJSON();\n\t\t\t},\n\t\t},\n\t\tsyncObjectType: 'root/base',\n\t\tgetSyncObjectId: () => 'index',\n\t},\n\t{\n\t\tlabel: __( 'Post Type' ),\n\t\tname: 'postType',\n\t\tkind: 'root',\n\t\tkey: 'slug',\n\t\tbaseURL: '/wp/v2/types',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'postTypes',\n\t\tsyncConfig: {\n\t\t\tfetch: async ( id ) => {\n\t\t\t\treturn apiFetch( {\n\t\t\t\t\tpath: `/wp/v2/types/${ id }?context=edit`,\n\t\t\t\t} );\n\t\t\t},\n\t\t\tapplyChangesToDoc: ( doc, changes ) => {\n\t\t\t\tconst document = doc.getMap( 'document' );\n\t\t\t\tObject.entries( changes ).forEach( ( [ key, value ] ) => {\n\t\t\t\t\tif ( document.get( key ) !== value ) {\n\t\t\t\t\t\tdocument.set( key, value );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t},\n\t\t\tfromCRDTDoc: ( doc ) => {\n\t\t\t\treturn doc.getMap( 'document' ).toJSON();\n\t\t\t},\n\t\t},\n\t\tsyncObjectType: 'root/postType',\n\t\tgetSyncObjectId: ( id ) => id,\n\t},\n\t{\n\t\tname: 'media',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/media',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'mediaItems',\n\t\tlabel: __( 'Media' ),\n\t\trawAttributes: [ 'caption', 'title', 'description' ],\n\t\tsupportsPagination: true,\n\t},\n\t{\n\t\tname: 'taxonomy',\n\t\tkind: 'root',\n\t\tkey: 'slug',\n\t\tbaseURL: '/wp/v2/taxonomies',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'taxonomies',\n\t\tlabel: __( 'Taxonomy' ),\n\t},\n\t{\n\t\tname: 'sidebar',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/sidebars',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'sidebars',\n\t\ttransientEdits: { blocks: true },\n\t\tlabel: __( 'Widget areas' ),\n\t},\n\t{\n\t\tname: 'widget',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/widgets',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'widgets',\n\t\ttransientEdits: { blocks: true },\n\t\tlabel: __( 'Widgets' ),\n\t},\n\t{\n\t\tname: 'widgetType',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/widget-types',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'widgetTypes',\n\t\tlabel: __( 'Widget types' ),\n\t},\n\t{\n\t\tlabel: __( 'User' ),\n\t\tname: 'user',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/users',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'users',\n\t},\n\t{\n\t\tname: 'comment',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/comments',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'comments',\n\t\tlabel: __( 'Comment' ),\n\t},\n\t{\n\t\tname: 'menu',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/menus',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'menus',\n\t\tlabel: __( 'Menu' ),\n\t},\n\t{\n\t\tname: 'menuItem',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/menu-items',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'menuItems',\n\t\tlabel: __( 'Menu Item' ),\n\t\trawAttributes: [ 'title' ],\n\t},\n\t{\n\t\tname: 'menuLocation',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/menu-locations',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'menuLocations',\n\t\tlabel: __( 'Menu Location' ),\n\t\tkey: 'name',\n\t},\n\t{\n\t\tlabel: __( 'Global Styles' ),\n\t\tname: 'globalStyles',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/global-styles',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'globalStylesVariations', // Should be different from name.\n\t\tgetTitle: ( record ) => record?.title?.rendered || record?.title,\n\t\tgetRevisionsUrl: ( parentId, revisionId ) =>\n\t\t\t`/wp/v2/global-styles/${ parentId }/revisions${\n\t\t\t\trevisionId ? '/' + revisionId : ''\n\t\t\t}`,\n\t\tsupportsPagination: true,\n\t},\n\t{\n\t\tlabel: __( 'Themes' ),\n\t\tname: 'theme',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/themes',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'themes',\n\t\tkey: 'stylesheet',\n\t},\n\t{\n\t\tlabel: __( 'Plugins' ),\n\t\tname: 'plugin',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/plugins',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'plugins',\n\t\tkey: 'plugin',\n\t},\n\t{\n\t\tlabel: __( 'Status' ),\n\t\tname: 'status',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/statuses',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'statuses',\n\t\tkey: 'slug',\n\t},\n];\n\nexport const additionalEntityConfigLoaders = [\n\t{ kind: 'postType', loadEntities: loadPostTypeEntities },\n\t{ kind: 'taxonomy', loadEntities: loadTaxonomyEntities },\n\t{\n\t\tkind: 'root',\n\t\tname: 'site',\n\t\tplural: 'sites',\n\t\tloadEntities: loadSiteEntity,\n\t},\n];\n\n/**\n * Returns a function to be used to retrieve extra edits to apply before persisting a post type.\n *\n * @param {Object} persistedRecord Already persisted Post\n * @param {Object} edits Edits.\n * @return {Object} Updated edits.\n */\nexport const prePersistPostType = ( persistedRecord, edits ) => {\n\tconst newEdits = {};\n\n\tif ( persistedRecord?.status === 'auto-draft' ) {\n\t\t// Saving an auto-draft should create a draft by default.\n\t\tif ( ! edits.status && ! newEdits.status ) {\n\t\t\tnewEdits.status = 'draft';\n\t\t}\n\n\t\t// Fix the auto-draft default title.\n\t\tif (\n\t\t\t( ! edits.title || edits.title === 'Auto Draft' ) &&\n\t\t\t! newEdits.title &&\n\t\t\t( ! persistedRecord?.title ||\n\t\t\t\tpersistedRecord?.title === 'Auto Draft' )\n\t\t) {\n\t\t\tnewEdits.title = '';\n\t\t}\n\t}\n\n\treturn newEdits;\n};\n\nconst serialisableBlocksCache = new WeakMap();\n\nfunction makeBlockAttributesSerializable( attributes ) {\n\tconst newAttributes = { ...attributes };\n\tfor ( const [ key, value ] of Object.entries( attributes ) ) {\n\t\tif ( value instanceof RichTextData ) {\n\t\t\tnewAttributes[ key ] = value.valueOf();\n\t\t}\n\t}\n\treturn newAttributes;\n}\n\nfunction makeBlocksSerializable( blocks ) {\n\treturn blocks.map( ( block ) => {\n\t\tconst { innerBlocks, attributes, ...rest } = block;\n\t\treturn {\n\t\t\t...rest,\n\t\t\tattributes: makeBlockAttributesSerializable( attributes ),\n\t\t\tinnerBlocks: makeBlocksSerializable( innerBlocks ),\n\t\t};\n\t} );\n}\n\n/**\n * Returns the list of post type entities.\n *\n * @return {Promise} Entities promise\n */\nasync function loadPostTypeEntities() {\n\tconst postTypes = await apiFetch( {\n\t\tpath: '/wp/v2/types?context=view',\n\t} );\n\treturn Object.entries( postTypes ?? {} ).map( ( [ name, postType ] ) => {\n\t\tconst isTemplate = [ 'wp_template', 'wp_template_part' ].includes(\n\t\t\tname\n\t\t);\n\t\tconst namespace = postType?.rest_namespace ?? 'wp/v2';\n\t\treturn {\n\t\t\tkind: 'postType',\n\t\t\tbaseURL: `/${ namespace }/${ postType.rest_base }`,\n\t\t\tbaseURLParams: { context: 'edit' },\n\t\t\tname,\n\t\t\tlabel: postType.name,\n\t\t\ttransientEdits: {\n\t\t\t\tblocks: true,\n\t\t\t\tselection: true,\n\t\t\t},\n\t\t\tmergedEdits: { meta: true },\n\t\t\trawAttributes: POST_RAW_ATTRIBUTES,\n\t\t\tgetTitle: ( record ) =>\n\t\t\t\trecord?.title?.rendered ||\n\t\t\t\trecord?.title ||\n\t\t\t\t( isTemplate\n\t\t\t\t\t? capitalCase( record.slug ?? '' )\n\t\t\t\t\t: String( record.id ) ),\n\t\t\t__unstablePrePersist: isTemplate ? undefined : prePersistPostType,\n\t\t\t__unstable_rest_base: postType.rest_base,\n\t\t\tsyncConfig: {\n\t\t\t\tfetch: async ( id ) => {\n\t\t\t\t\treturn apiFetch( {\n\t\t\t\t\t\tpath: `/${ namespace }/${ postType.rest_base }/${ id }?context=edit`,\n\t\t\t\t\t} );\n\t\t\t\t},\n\t\t\t\tapplyChangesToDoc: ( doc, changes ) => {\n\t\t\t\t\tconst document = doc.getMap( 'document' );\n\n\t\t\t\t\tObject.entries( changes ).forEach( ( [ key, value ] ) => {\n\t\t\t\t\t\tif ( typeof value !== 'function' ) {\n\t\t\t\t\t\t\tif ( key === 'blocks' ) {\n\t\t\t\t\t\t\t\tif ( ! serialisableBlocksCache.has( value ) ) {\n\t\t\t\t\t\t\t\t\tserialisableBlocksCache.set(\n\t\t\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t\t\t\tmakeBlocksSerializable( value )\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tvalue = serialisableBlocksCache.get( value );\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif ( document.get( key ) !== value ) {\n\t\t\t\t\t\t\t\tdocument.set( key, value );\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\tfromCRDTDoc: ( doc ) => {\n\t\t\t\t\treturn doc.getMap( 'document' ).toJSON();\n\t\t\t\t},\n\t\t\t},\n\t\t\tsyncObjectType: 'postType/' + postType.name,\n\t\t\tgetSyncObjectId: ( id ) => id,\n\t\t\tsupportsPagination: true,\n\t\t\tgetRevisionsUrl: ( parentId, revisionId ) =>\n\t\t\t\t`/${ namespace }/${\n\t\t\t\t\tpostType.rest_base\n\t\t\t\t}/${ parentId }/revisions${\n\t\t\t\t\trevisionId ? '/' + revisionId : ''\n\t\t\t\t}`,\n\t\t\trevisionKey: isTemplate ? 'wp_id' : DEFAULT_ENTITY_KEY,\n\t\t};\n\t} );\n}\n\n/**\n * Returns the list of the taxonomies entities.\n *\n * @return {Promise} Entities promise\n */\nasync function loadTaxonomyEntities() {\n\tconst taxonomies = await apiFetch( {\n\t\tpath: '/wp/v2/taxonomies?context=view',\n\t} );\n\treturn Object.entries( taxonomies ?? {} ).map( ( [ name, taxonomy ] ) => {\n\t\tconst namespace = taxonomy?.rest_namespace ?? 'wp/v2';\n\t\treturn {\n\t\t\tkind: 'taxonomy',\n\t\t\tbaseURL: `/${ namespace }/${ taxonomy.rest_base }`,\n\t\t\tbaseURLParams: { context: 'edit' },\n\t\t\tname,\n\t\t\tlabel: taxonomy.name,\n\t\t};\n\t} );\n}\n\n/**\n * Returns the Site entity.\n *\n * @return {Promise} Entity promise\n */\nasync function loadSiteEntity() {\n\tconst entity = {\n\t\tlabel: __( 'Site' ),\n\t\tname: 'site',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/settings',\n\t\tsyncConfig: {\n\t\t\tfetch: async () => {\n\t\t\t\treturn apiFetch( { path: '/wp/v2/settings' } );\n\t\t\t},\n\t\t\tapplyChangesToDoc: ( doc, changes ) => {\n\t\t\t\tconst document = doc.getMap( 'document' );\n\t\t\t\tObject.entries( changes ).forEach( ( [ key, value ] ) => {\n\t\t\t\t\tif ( document.get( key ) !== value ) {\n\t\t\t\t\t\tdocument.set( key, value );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t},\n\t\t\tfromCRDTDoc: ( doc ) => {\n\t\t\t\treturn doc.getMap( 'document' ).toJSON();\n\t\t\t},\n\t\t},\n\t\tsyncObjectType: 'root/site',\n\t\tgetSyncObjectId: () => 'index',\n\t\tmeta: {},\n\t};\n\n\tconst site = await apiFetch( {\n\t\tpath: entity.baseURL,\n\t\tmethod: 'OPTIONS',\n\t} );\n\n\tconst labels = {};\n\tObject.entries( site?.schema?.properties ?? {} ).forEach(\n\t\t( [ key, value ] ) => {\n\t\t\t// Ignore properties `title` and `type` keys.\n\t\t\tif ( typeof value === 'object' && value.title ) {\n\t\t\t\tlabels[ key ] = value.title;\n\t\t\t}\n\t\t}\n\t);\n\n\treturn [ { ...entity, meta: { labels } } ];\n}\n\n/**\n * Returns the entity's getter method name given its kind and name or plural name.\n *\n * @example\n * ```js\n * const nameSingular = getMethodName( 'root', 'theme', 'get' );\n * // nameSingular is getRootTheme\n *\n * const namePlural = getMethodName( 'root', 'themes', 'set' );\n * // namePlural is setRootThemes\n * ```\n *\n * @param {string} kind Entity kind.\n * @param {string} name Entity name or plural name.\n * @param {string} prefix Function prefix.\n *\n * @return {string} Method name\n */\nexport const getMethodName = ( kind, name, prefix = 'get' ) => {\n\tconst kindPrefix = kind === 'root' ? '' : pascalCase( kind );\n\tconst suffix = pascalCase( name );\n\treturn `${ prefix }${ kindPrefix }${ suffix }`;\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAKA,IAAAC,SAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IA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AM,EAAEC,UAAU,cAAAN,qBAAA,cAAAA,qBAAA,GAAI,CAAC,CAAE,CAAC,CAACnE,OAAO,CACvD,CAAE,CAAEC,GAAG,EAAEC,KAAK,CAAE,KAAM;IACrB;IACA,IAAK,OAAOA,KAAK,KAAK,QAAQ,IAAIA,KAAK,CAACe,KAAK,EAAG;MAC/CsD,MAAM,CAAEtE,GAAG,CAAE,GAAGC,KAAK,CAACe,KAAK;IAC5B;EACD,CACD,CAAC;EAED,OAAO,CAAE;IAAE,GAAGmD,MAAM;IAAEd,IAAI,EAAE;MAAEiB;IAAO;EAAE,CAAC,CAAE;AAC3C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMG,aAAa,GAAGA,CAAE5F,IAAI,EAAEC,IAAI,EAAE4F,MAAM,GAAG,KAAK,KAAM;EAC9D,MAAMC,UAAU,GAAG9F,IAAI,KAAK,MAAM,GAAG,EAAE,GAAG,IAAA+F,sBAAU,EAAE/F,IAAK,CAAC;EAC5D,MAAMgG,MAAM,GAAG,IAAAD,sBAAU,EAAE9F,IAAK,CAAC;EACjC,OAAO,GAAI4F,MAAM,GAAKC,UAAU,GAAKE,MAAM,EAAG;AAC/C,CAAC;AAACrG,OAAA,CAAAiG,aAAA,GAAAA,aAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["@wordpress/core-data/src/entity-types/settings.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport type {\n\tCommentingStatus,\n\tContext,\n\tOmitNevers,\n\tPingStatus,\n} from './helpers';\n\nimport type { BaseEntityRecords as _BaseEntityRecords } from './base-entity-records';\n\ndeclare module './base-entity-records' {\n\texport namespace BaseEntityRecords {\n\t\t/* eslint-disable-next-line @typescript-eslint/no-unused-vars */\n\t\texport interface Settings< C extends Context > {\n\t\t\t/**\n\t\t\t * What to show on the front page\n\t\t\t */\n\t\t\tshow_on_front: string;\n\t\t\t/**\n\t\t\t * The ID of the page that should be displayed on the front page\n\t\t\t */\n\t\t\tpage_on_front: number;\n\t\t\t/**\n\t\t\t * Site title.\n\t\t\t */\n\t\t\ttitle: string;\n\t\t\t/**\n\t\t\t * Site tagline.\n\t\t\t */\n\t\t\tdescription: string;\n\t\t\t/**\n\t\t\t * Site URL.\n\t\t\t */\n\t\t\turl: string;\n\t\t\t/**\n\t\t\t * This address is used for admin purposes, like new user notification.\n\t\t\t */\n\t\t\temail: string;\n\t\t\t/**\n\t\t\t * A city in the same timezone as you.\n\t\t\t */\n\t\t\ttimezone: string;\n\t\t\t/**\n\t\t\t * A date format for all date strings.\n\t\t\t */\n\t\t\tdate_format: string;\n\t\t\t/**\n\t\t\t * A time format for all time strings.\n\t\t\t */\n\t\t\ttime_format: string;\n\t\t\t/**\n\t\t\t * A day number of the week that the week should start on.\n\t\t\t */\n\t\t\tstart_of_week: number;\n\t\t\t/**\n\t\t\t * WordPress locale code.\n\t\t\t */\n\t\t\tlanguage: string;\n\t\t\t/**\n\t\t\t * Convert emoticons like :-) and :-P to graphics on display.\n\t\t\t */\n\t\t\tuse_smilies: boolean;\n\t\t\t/**\n\t\t\t * Default post category.\n\t\t\t */\n\t\t\tdefault_category: number;\n\t\t\t/**\n\t\t\t * Default post format.\n\t\t\t */\n\t\t\tdefault_post_format: string;\n\t\t\t/**\n\t\t\t * Blog pages show at most.\n\t\t\t */\n\t\t\tposts_per_page: number;\n\t\t\t/**\n\t\t\t * Allow link notifications from other blogs (pingbacks and trackbacks) on new articles.\n\t\t\t */\n\t\t\tdefault_ping_status: PingStatus;\n\t\t\t/**\n\t\t\t * Allow people to submit comments on new posts.\n\t\t\t */\n\t\t\tdefault_comment_status: CommentingStatus;\n\t\t\t/**\n\t\t\t * Site logo.\n\t\t\t */\n\t\t\tsite_logo: number;\n\t\t\t/**\n\t\t\t * Site icon.\n\t\t\t */\n\t\t\tsite_icon: number;\n\t\t}\n\t}\n}\n\nexport type Settings< C extends Context = 'view' > = OmitNevers<\n\t_BaseEntityRecords.Settings< C >\n>;\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["@wordpress/core-data/src/entity-types/settings.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport type {\n\tCommentingStatus,\n\tContext,\n\tOmitNevers,\n\tPingStatus,\n} from './helpers';\n\nimport type { BaseEntityRecords as _BaseEntityRecords } from './base-entity-records';\n\ndeclare module './base-entity-records' {\n\texport namespace BaseEntityRecords {\n\t\t/* eslint-disable-next-line @typescript-eslint/no-unused-vars */\n\t\texport interface Settings< C extends Context > {\n\t\t\t/**\n\t\t\t * What to show on the front page\n\t\t\t */\n\t\t\tshow_on_front: string;\n\t\t\t/**\n\t\t\t * The ID of the page that should be displayed on the front page\n\t\t\t */\n\t\t\tpage_on_front: number;\n\t\t\t/**\n\t\t\t * The ID of the page that should display the latest posts\n\t\t\t */\n\t\t\tpage_for_posts: number;\n\t\t\t/**\n\t\t\t * Site title.\n\t\t\t */\n\t\t\ttitle: string;\n\t\t\t/**\n\t\t\t * Site tagline.\n\t\t\t */\n\t\t\tdescription: string;\n\t\t\t/**\n\t\t\t * Site URL.\n\t\t\t */\n\t\t\turl: string;\n\t\t\t/**\n\t\t\t * This address is used for admin purposes, like new user notification.\n\t\t\t */\n\t\t\temail: string;\n\t\t\t/**\n\t\t\t * A city in the same timezone as you.\n\t\t\t */\n\t\t\ttimezone: string;\n\t\t\t/**\n\t\t\t * A date format for all date strings.\n\t\t\t */\n\t\t\tdate_format: string;\n\t\t\t/**\n\t\t\t * A time format for all time strings.\n\t\t\t */\n\t\t\ttime_format: string;\n\t\t\t/**\n\t\t\t * A day number of the week that the week should start on.\n\t\t\t */\n\t\t\tstart_of_week: number;\n\t\t\t/**\n\t\t\t * WordPress locale code.\n\t\t\t */\n\t\t\tlanguage: string;\n\t\t\t/**\n\t\t\t * Convert emoticons like :-) and :-P to graphics on display.\n\t\t\t */\n\t\t\tuse_smilies: boolean;\n\t\t\t/**\n\t\t\t * Default post category.\n\t\t\t */\n\t\t\tdefault_category: number;\n\t\t\t/**\n\t\t\t * Default post format.\n\t\t\t */\n\t\t\tdefault_post_format: string;\n\t\t\t/**\n\t\t\t * Blog pages show at most.\n\t\t\t */\n\t\t\tposts_per_page: number;\n\t\t\t/**\n\t\t\t * Allow link notifications from other blogs (pingbacks and trackbacks) on new articles.\n\t\t\t */\n\t\t\tdefault_ping_status: PingStatus;\n\t\t\t/**\n\t\t\t * Allow people to submit comments on new posts.\n\t\t\t */\n\t\t\tdefault_comment_status: CommentingStatus;\n\t\t\t/**\n\t\t\t * Site logo.\n\t\t\t */\n\t\t\tsite_logo: number;\n\t\t\t/**\n\t\t\t * Site icon.\n\t\t\t */\n\t\t\tsite_icon: number;\n\t\t}\n\t}\n}\n\nexport type Settings< C extends Context = 'view' > = OmitNevers<\n\t_BaseEntityRecords.Settings< C >\n>;\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_deprecated","_interopRequireDefault","_element","_useQuerySelect","_","EMPTY_OBJECT","useEntityRecord","kind","name","recordId","options","enabled","editEntityRecord","saveEditedEntityRecord","useDispatch","coreStore","mutations","useMemo","edit","record","editOptions","save","saveOptions","throwOnError","editedRecord","hasEdits","edits","useSelect","select","getEditedEntityRecord","hasEditsForEntityRecord","getEntityRecordNonTransientEdits","data","querySelectRest","useQuerySelect","query","getEntityRecord","__experimentalUseEntityRecord","deprecated","alternative","since"],"sources":["@wordpress/core-data/src/hooks/use-entity-record.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport useQuerySelect from './use-query-select';\nimport { store as coreStore } from '../';\nimport type { Status } from './constants';\n\nexport interface EntityRecordResolution< RecordType > {\n\t/** The requested entity record */\n\trecord: RecordType | null;\n\n\t/** The edited entity record */\n\teditedRecord: Partial< RecordType >;\n\n\t/** The edits to the edited entity record */\n\tedits: Partial< RecordType >;\n\n\t/** Apply local (in-browser) edits to the edited entity record */\n\tedit: ( diff: Partial< RecordType > ) => void;\n\n\t/** Persist the edits to the server */\n\tsave: () => Promise< void >;\n\n\t/**\n\t * Is the record still being resolved?\n\t */\n\tisResolving: boolean;\n\n\t/**\n\t * Does the record have any local edits?\n\t */\n\thasEdits: boolean;\n\n\t/**\n\t * Is the record resolved by now?\n\t */\n\thasResolved: boolean;\n\n\t/** Resolution status */\n\tstatus: Status;\n}\n\nexport interface Options {\n\t/**\n\t * Whether to run the query or short-circuit and return null.\n\t *\n\t * @default true\n\t */\n\tenabled: boolean;\n}\n\nconst EMPTY_OBJECT = {};\n\n/**\n * Resolves the specified entity record.\n *\n * @since 6.1.0 Introduced in WordPress core.\n *\n * @param kind Kind of the entity, e.g. `root` or a `postType`. See rootEntitiesConfig in ../entities.ts for a list of available kinds.\n * @param name Name of the entity, e.g. `plugin` or a `post`. See rootEntitiesConfig in ../entities.ts for a list of available names.\n * @param recordId ID of the requested entity record.\n * @param options Optional hook options.\n * @example\n * ```js\n * import { useEntityRecord } from '@wordpress/core-data';\n *\n * function PageTitleDisplay( { id } ) {\n * const { record, isResolving } = useEntityRecord( 'postType', 'page', id );\n *\n * if ( isResolving ) {\n * return 'Loading...';\n * }\n *\n * return record.title;\n * }\n *\n * // Rendered in the application:\n * // <PageTitleDisplay id={ 1 } />\n * ```\n *\n * In the above example, when `PageTitleDisplay` is rendered into an\n * application, the page and the resolution details will be retrieved from\n * the store state using `getEntityRecord()`, or resolved if missing.\n *\n * @example\n * ```js\n * import { useCallback } from 'react';\n * import { useDispatch } from '@wordpress/data';\n * import { __ } from '@wordpress/i18n';\n * import { TextControl } from '@wordpress/components';\n * import { store as noticeStore } from '@wordpress/notices';\n * import { useEntityRecord } from '@wordpress/core-data';\n *\n * function PageRenameForm( { id } ) {\n * \tconst page = useEntityRecord( 'postType', 'page', id );\n * \tconst { createSuccessNotice, createErrorNotice } =\n * \t\tuseDispatch( noticeStore );\n *\n * \tconst setTitle = useCallback( ( title ) => {\n * \t\tpage.edit( { title } );\n * \t}, [ page.edit ] );\n *\n * \tif ( page.isResolving ) {\n * \t\treturn 'Loading...';\n * \t}\n *\n * \tasync function onRename( event ) {\n * \t\tevent.preventDefault();\n * \t\ttry {\n * \t\t\tawait page.save();\n * \t\t\tcreateSuccessNotice( __( 'Page renamed.' ), {\n * \t\t\t\ttype: 'snackbar',\n * \t\t\t} );\n * \t\t} catch ( error ) {\n * \t\t\tcreateErrorNotice( error.message, { type: 'snackbar' } );\n * \t\t}\n * \t}\n *\n * \treturn (\n * \t\t<form onSubmit={ onRename }>\n * \t\t\t<TextControl\n * \t\t\t\tlabel={ __( 'Name' ) }\n * \t\t\t\tvalue={ page.editedRecord.title }\n * \t\t\t\tonChange={ setTitle }\n * \t\t\t/>\n * \t\t\t<button type=\"submit\">{ __( 'Save' ) }</button>\n * \t\t</form>\n * \t);\n * }\n *\n * // Rendered in the application:\n * // <PageRenameForm id={ 1 } />\n * ```\n *\n * In the above example, updating and saving the page title is handled\n * via the `edit()` and `save()` mutation helpers provided by\n * `useEntityRecord()`;\n *\n * @return Entity record data.\n * @template RecordType\n */\nexport default function useEntityRecord< RecordType >(\n\tkind: string,\n\tname: string,\n\trecordId: string | number,\n\toptions: Options = { enabled: true }\n): EntityRecordResolution< RecordType > {\n\tconst { editEntityRecord, saveEditedEntityRecord } =\n\t\tuseDispatch( coreStore );\n\n\tconst mutations = useMemo(\n\t\t() => ( {\n\t\t\tedit: ( record, editOptions: any = {} ) =>\n\t\t\t\teditEntityRecord( kind, name, recordId, record, editOptions ),\n\t\t\tsave: ( saveOptions: any = {} ) =>\n\t\t\t\tsaveEditedEntityRecord( kind, name, recordId, {\n\t\t\t\t\tthrowOnError: true,\n\t\t\t\t\t...saveOptions,\n\t\t\t\t} ),\n\t\t} ),\n\t\t[ editEntityRecord, kind, name, recordId, saveEditedEntityRecord ]\n\t);\n\n\tconst { editedRecord, hasEdits, edits } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! options.enabled ) {\n\t\t\t\treturn {\n\t\t\t\t\teditedRecord: EMPTY_OBJECT,\n\t\t\t\t\thasEdits: false,\n\t\t\t\t\tedits: EMPTY_OBJECT,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\teditedRecord: select( coreStore ).getEditedEntityRecord(\n\t\t\t\t\tkind,\n\t\t\t\t\tname,\n\t\t\t\t\trecordId\n\t\t\t\t),\n\t\t\t\thasEdits: select( coreStore ).hasEditsForEntityRecord(\n\t\t\t\t\tkind,\n\t\t\t\t\tname,\n\t\t\t\t\trecordId\n\t\t\t\t),\n\t\t\t\tedits: select( coreStore ).getEntityRecordNonTransientEdits(\n\t\t\t\t\tkind,\n\t\t\t\t\tname,\n\t\t\t\t\trecordId\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ kind, name, recordId, options.enabled ]\n\t);\n\n\tconst { data: record, ...querySelectRest } = useQuerySelect(\n\t\t( query ) => {\n\t\t\tif ( ! options.enabled ) {\n\t\t\t\treturn {\n\t\t\t\t\tdata: null,\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn query( coreStore ).getEntityRecord( kind, name, recordId );\n\t\t},\n\t\t[ kind, name, recordId, options.enabled ]\n\t);\n\n\treturn {\n\t\trecord,\n\t\teditedRecord,\n\t\thasEdits,\n\t\tedits,\n\t\t...querySelectRest,\n\t\t...mutations,\n\t};\n}\n\nexport function __experimentalUseEntityRecord(\n\tkind: string,\n\tname: string,\n\trecordId: any,\n\toptions: any\n) {\n\tdeprecated( `wp.data.__experimentalUseEntityRecord`, {\n\t\talternative: 'wp.data.useEntityRecord',\n\t\tsince: '6.1',\n\t} );\n\treturn useEntityRecord( kind, name, recordId, options );\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA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,GAAGjB;EACJ,CAAC;AACF;AAEO,SAASqB,6BAA6BA,CAC5C9B,IAAY,EACZC,IAAY,EACZC,QAAa,EACbC,OAAY,EACX;EACD,IAAA4B,mBAAU,EAAE,uCAAuC,EAAE;IACpDC,WAAW,EAAE,yBAAyB;IACtCC,KAAK,EAAE;EACR,CAAE,CAAC;EACH,OAAOlC,eAAe,CAAEC,IAAI,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,OAAQ,CAAC;AACxD","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_data","require","_deprecated","_interopRequireDefault","_element","_useQuerySelect","_","EMPTY_OBJECT","useEntityRecord","kind","name","recordId","options","enabled","editEntityRecord","saveEditedEntityRecord","useDispatch","coreStore","mutations","useMemo","edit","record","editOptions","save","saveOptions","throwOnError","editedRecord","hasEdits","edits","useSelect","select","getEditedEntityRecord","hasEditsForEntityRecord","getEntityRecordNonTransientEdits","data","querySelectRest","useQuerySelect","query","getEntityRecord","__experimentalUseEntityRecord","deprecated","alternative","since"],"sources":["@wordpress/core-data/src/hooks/use-entity-record.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport useQuerySelect from './use-query-select';\nimport { store as coreStore } from '../';\nimport type { Status } from './constants';\n\nexport interface EntityRecordResolution< RecordType > {\n\t/** The requested entity record */\n\trecord: RecordType | null;\n\n\t/** The edited entity record */\n\teditedRecord: Partial< RecordType >;\n\n\t/** The edits to the edited entity record */\n\tedits: Partial< RecordType >;\n\n\t/** Apply local (in-browser) edits to the edited entity record */\n\tedit: ( diff: Partial< RecordType > ) => void;\n\n\t/** Persist the edits to the server */\n\tsave: () => Promise< void >;\n\n\t/**\n\t * Is the record still being resolved?\n\t */\n\tisResolving: boolean;\n\n\t/**\n\t * Does the record have any local edits?\n\t */\n\thasEdits: boolean;\n\n\t/**\n\t * Is the record resolved by now?\n\t */\n\thasResolved: boolean;\n\n\t/** Resolution status */\n\tstatus: Status;\n}\n\nexport interface Options {\n\t/**\n\t * Whether to run the query or short-circuit and return null.\n\t *\n\t * @default true\n\t */\n\tenabled: boolean;\n}\n\nconst EMPTY_OBJECT = {};\n\n/**\n * Resolves the specified entity record.\n *\n * @since 6.1.0 Introduced in WordPress core.\n *\n * @param kind Kind of the entity, e.g. `root` or a `postType`. See rootEntitiesConfig in ../entities.ts for a list of available kinds.\n * @param name Name of the entity, e.g. `plugin` or a `post`. See rootEntitiesConfig in ../entities.ts for a list of available names.\n * @param recordId ID of the requested entity record.\n * @param options Optional hook options.\n * @example\n * ```js\n * import { useEntityRecord } from '@wordpress/core-data';\n *\n * function PageTitleDisplay( { id } ) {\n * const { record, isResolving } = useEntityRecord( 'postType', 'page', id );\n *\n * if ( isResolving ) {\n * return 'Loading...';\n * }\n *\n * return record.title;\n * }\n *\n * // Rendered in the application:\n * // <PageTitleDisplay id={ 1 } />\n * ```\n *\n * In the above example, when `PageTitleDisplay` is rendered into an\n * application, the page and the resolution details will be retrieved from\n * the store state using `getEntityRecord()`, or resolved if missing.\n *\n * @example\n * ```js\n * import { useCallback } from 'react';\n * import { useDispatch } from '@wordpress/data';\n * import { __ } from '@wordpress/i18n';\n * import { TextControl } from '@wordpress/components';\n * import { store as noticeStore } from '@wordpress/notices';\n * import { useEntityRecord } from '@wordpress/core-data';\n *\n * function PageRenameForm( { id } ) {\n * \tconst page = useEntityRecord( 'postType', 'page', id );\n * \tconst { createSuccessNotice, createErrorNotice } =\n * \t\tuseDispatch( noticeStore );\n *\n * \tconst setTitle = useCallback( ( title ) => {\n * \t\tpage.edit( { title } );\n * \t}, [ page.edit ] );\n *\n * \tif ( page.isResolving ) {\n * \t\treturn 'Loading...';\n * \t}\n *\n * \tasync function onRename( event ) {\n * \t\tevent.preventDefault();\n * \t\ttry {\n * \t\t\tawait page.save();\n * \t\t\tcreateSuccessNotice( __( 'Page renamed.' ), {\n * \t\t\t\ttype: 'snackbar',\n * \t\t\t} );\n * \t\t} catch ( error ) {\n * \t\t\tcreateErrorNotice( error.message, { type: 'snackbar' } );\n * \t\t}\n * \t}\n *\n * \treturn (\n * \t\t<form onSubmit={ onRename }>\n * \t\t\t<TextControl\n *\t\t\t\t__nextHasNoMarginBottom\n *\t\t\t\t__next40pxDefaultSize\n * \t\t\t\tlabel={ __( 'Name' ) }\n * \t\t\t\tvalue={ page.editedRecord.title }\n * \t\t\t\tonChange={ setTitle }\n * \t\t\t/>\n * \t\t\t<button type=\"submit\">{ __( 'Save' ) }</button>\n * \t\t</form>\n * \t);\n * }\n *\n * // Rendered in the application:\n * // <PageRenameForm id={ 1 } />\n * ```\n *\n * In the above example, updating and saving the page title is handled\n * via the `edit()` and `save()` mutation helpers provided by\n * `useEntityRecord()`;\n *\n * @return Entity record data.\n * @template RecordType\n */\nexport default function useEntityRecord< RecordType >(\n\tkind: string,\n\tname: string,\n\trecordId: string | number,\n\toptions: Options = { enabled: true }\n): EntityRecordResolution< RecordType > {\n\tconst { editEntityRecord, saveEditedEntityRecord } =\n\t\tuseDispatch( coreStore );\n\n\tconst mutations = useMemo(\n\t\t() => ( {\n\t\t\tedit: ( record, editOptions: any = {} ) =>\n\t\t\t\teditEntityRecord( kind, name, recordId, record, editOptions ),\n\t\t\tsave: ( saveOptions: any = {} ) =>\n\t\t\t\tsaveEditedEntityRecord( kind, name, recordId, {\n\t\t\t\t\tthrowOnError: true,\n\t\t\t\t\t...saveOptions,\n\t\t\t\t} ),\n\t\t} ),\n\t\t[ editEntityRecord, kind, name, recordId, saveEditedEntityRecord ]\n\t);\n\n\tconst { editedRecord, hasEdits, edits } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! options.enabled ) {\n\t\t\t\treturn {\n\t\t\t\t\teditedRecord: EMPTY_OBJECT,\n\t\t\t\t\thasEdits: false,\n\t\t\t\t\tedits: EMPTY_OBJECT,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\teditedRecord: select( coreStore ).getEditedEntityRecord(\n\t\t\t\t\tkind,\n\t\t\t\t\tname,\n\t\t\t\t\trecordId\n\t\t\t\t),\n\t\t\t\thasEdits: select( coreStore ).hasEditsForEntityRecord(\n\t\t\t\t\tkind,\n\t\t\t\t\tname,\n\t\t\t\t\trecordId\n\t\t\t\t),\n\t\t\t\tedits: select( coreStore ).getEntityRecordNonTransientEdits(\n\t\t\t\t\tkind,\n\t\t\t\t\tname,\n\t\t\t\t\trecordId\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ kind, name, recordId, options.enabled ]\n\t);\n\n\tconst { data: record, ...querySelectRest } = useQuerySelect(\n\t\t( query ) => {\n\t\t\tif ( ! options.enabled ) {\n\t\t\t\treturn {\n\t\t\t\t\tdata: null,\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn query( coreStore ).getEntityRecord( kind, name, recordId );\n\t\t},\n\t\t[ kind, name, recordId, options.enabled ]\n\t);\n\n\treturn {\n\t\trecord,\n\t\teditedRecord,\n\t\thasEdits,\n\t\tedits,\n\t\t...querySelectRest,\n\t\t...mutations,\n\t};\n}\n\nexport function __experimentalUseEntityRecord(\n\tkind: string,\n\tname: string,\n\trecordId: any,\n\toptions: any\n) {\n\tdeprecated( `wp.data.__experimentalUseEntityRecord`, {\n\t\talternative: 'wp.data.useEntityRecord',\n\t\tsince: '6.1',\n\t} );\n\treturn useEntityRecord( kind, name, recordId, options );\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAKA,IAAAI,eAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,CAAA,GAAAL,OAAA;AAXA;AACA;AACA;;AAKA;AACA;AACA;;AAiDA,MAAMM,YAAY,GAAG,CAAC,CAAC;;AAEvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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AAI,EAAEC,QAAQ,EAAEC,OAAQ,CAAC;AACxD","ignoreList":[]}
|
package/build/lock-unlock.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_privateApis","require","lock","unlock","__dangerousOptInToUnstableAPIsOnlyForCoreModules","exports"],"sources":["@wordpress/core-data/src/lock-unlock.
|
|
1
|
+
{"version":3,"names":["_privateApis","require","lock","unlock","__dangerousOptInToUnstableAPIsOnlyForCoreModules","exports"],"sources":["@wordpress/core-data/src/lock-unlock.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\n\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',\n\t\t'@wordpress/core-data'\n\t);\n"],"mappings":";;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGO,MAAM;EAAEC,IAAI;EAAEC;AAAO,CAAC,GAC5B,IAAAC,6DAAgD,EAC/C,+HAA+H,EAC/H,sBACD,CAAC;AAACC,OAAA,CAAAF,MAAA,GAAAA,MAAA;AAAAE,OAAA,CAAAH,IAAA,GAAAA,IAAA","ignoreList":[]}
|
package/build/private-apis.js
CHANGED
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.privateApis = void 0;
|
|
7
7
|
var _useEntityRecords = require("./hooks/use-entity-records");
|
|
8
|
+
var _utils = require("./utils");
|
|
8
9
|
var _lockUnlock = require("./lock-unlock");
|
|
9
10
|
/**
|
|
10
11
|
* Internal dependencies
|
|
@@ -12,6 +13,7 @@ var _lockUnlock = require("./lock-unlock");
|
|
|
12
13
|
|
|
13
14
|
const privateApis = exports.privateApis = {};
|
|
14
15
|
(0, _lockUnlock.lock)(privateApis, {
|
|
15
|
-
useEntityRecordsWithPermissions: _useEntityRecords.useEntityRecordsWithPermissions
|
|
16
|
+
useEntityRecordsWithPermissions: _useEntityRecords.useEntityRecordsWithPermissions,
|
|
17
|
+
RECEIVE_INTERMEDIATE_RESULTS: _utils.RECEIVE_INTERMEDIATE_RESULTS
|
|
16
18
|
});
|
|
17
19
|
//# sourceMappingURL=private-apis.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_useEntityRecords","require","_lockUnlock","privateApis","exports","lock","useEntityRecordsWithPermissions"],"sources":["@wordpress/core-data/src/private-apis.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { useEntityRecordsWithPermissions } from './hooks/use-entity-records';\nimport { lock } from './lock-unlock';\n\nexport const privateApis = {};\nlock( privateApis, {\n\tuseEntityRecordsWithPermissions,\n} );\n"],"mappings":";;;;;;AAGA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,
|
|
1
|
+
{"version":3,"names":["_useEntityRecords","require","_utils","_lockUnlock","privateApis","exports","lock","useEntityRecordsWithPermissions","RECEIVE_INTERMEDIATE_RESULTS"],"sources":["@wordpress/core-data/src/private-apis.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { useEntityRecordsWithPermissions } from './hooks/use-entity-records';\nimport { RECEIVE_INTERMEDIATE_RESULTS } from './utils';\nimport { lock } from './lock-unlock';\n\nexport const privateApis = {};\nlock( privateApis, {\n\tuseEntityRecordsWithPermissions,\n\tRECEIVE_INTERMEDIATE_RESULTS,\n} );\n"],"mappings":";;;;;;AAGA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AALA;AACA;AACA;;AAKO,MAAMG,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAG,CAAC,CAAC;AAC7B,IAAAE,gBAAI,EAAEF,WAAW,EAAE;EAClBG,+BAA+B,EAA/BA,iDAA+B;EAC/BC,4BAA4B,EAA5BA;AACD,CAAE,CAAC","ignoreList":[]}
|
|
@@ -5,12 +5,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getBlockPatternsForPostType = void 0;
|
|
7
7
|
exports.getEntityRecordPermissions = getEntityRecordPermissions;
|
|
8
|
-
exports.getEntityRecordsPermissions = void 0;
|
|
8
|
+
exports.getHomePage = exports.getEntityRecordsPermissions = void 0;
|
|
9
9
|
exports.getNavigationFallbackId = getNavigationFallbackId;
|
|
10
|
+
exports.getPostsPageId = void 0;
|
|
10
11
|
exports.getRegisteredPostMeta = getRegisteredPostMeta;
|
|
12
|
+
exports.getTemplateId = void 0;
|
|
11
13
|
exports.getUndoManager = getUndoManager;
|
|
12
14
|
var _data = require("@wordpress/data");
|
|
15
|
+
var _selectors = require("./selectors");
|
|
13
16
|
var _name = require("./name");
|
|
17
|
+
var _lockUnlock = require("./lock-unlock");
|
|
14
18
|
/**
|
|
15
19
|
* WordPress dependencies
|
|
16
20
|
*/
|
|
@@ -89,4 +93,109 @@ function getRegisteredPostMeta(state, postType) {
|
|
|
89
93
|
var _state$registeredPost;
|
|
90
94
|
return (_state$registeredPost = state.registeredPostMeta?.[postType]) !== null && _state$registeredPost !== void 0 ? _state$registeredPost : {};
|
|
91
95
|
}
|
|
96
|
+
function normalizePageId(value) {
|
|
97
|
+
if (!value || !['number', 'string'].includes(typeof value)) {
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// We also need to check if it's not zero (`'0'`).
|
|
102
|
+
if (Number(value) === 0) {
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
return value.toString();
|
|
106
|
+
}
|
|
107
|
+
const getHomePage = exports.getHomePage = (0, _data.createRegistrySelector)(select => (0, _data.createSelector)(() => {
|
|
108
|
+
const siteData = select(_name.STORE_NAME).getEntityRecord('root', 'site');
|
|
109
|
+
if (!siteData) {
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
const homepageId = siteData?.show_on_front === 'page' ? normalizePageId(siteData.page_on_front) : null;
|
|
113
|
+
if (homepageId) {
|
|
114
|
+
return {
|
|
115
|
+
postType: 'page',
|
|
116
|
+
postId: homepageId
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
const frontPageTemplateId = select(_name.STORE_NAME).getDefaultTemplateId({
|
|
120
|
+
slug: 'front-page'
|
|
121
|
+
});
|
|
122
|
+
return {
|
|
123
|
+
postType: 'wp_template',
|
|
124
|
+
postId: frontPageTemplateId
|
|
125
|
+
};
|
|
126
|
+
}, state => [
|
|
127
|
+
// @ts-expect-error
|
|
128
|
+
(0, _selectors.getEntityRecord)(state, 'root', 'site'), (0, _selectors.getDefaultTemplateId)(state, {
|
|
129
|
+
slug: 'front-page'
|
|
130
|
+
})]));
|
|
131
|
+
const getPostsPageId = exports.getPostsPageId = (0, _data.createRegistrySelector)(select => () => {
|
|
132
|
+
const siteData = select(_name.STORE_NAME).getEntityRecord('root', 'site');
|
|
133
|
+
return siteData?.show_on_front === 'page' ? normalizePageId(siteData.page_for_posts) : null;
|
|
134
|
+
});
|
|
135
|
+
const getTemplateId = exports.getTemplateId = (0, _data.createRegistrySelector)(select => (state, postType, postId) => {
|
|
136
|
+
const homepage = (0, _lockUnlock.unlock)(select(_name.STORE_NAME)).getHomePage();
|
|
137
|
+
if (!homepage) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// For the front page, we always use the front page template if existing.
|
|
142
|
+
if (postType === 'page' && postType === homepage?.postType && postId.toString() === homepage?.postId) {
|
|
143
|
+
// The /lookup endpoint cannot currently handle a lookup
|
|
144
|
+
// when a page is set as the front page, so specifically in
|
|
145
|
+
// that case, we want to check if there is a front page
|
|
146
|
+
// template, and instead of falling back to the home
|
|
147
|
+
// template, we want to fall back to the page template.
|
|
148
|
+
const templates = select(_name.STORE_NAME).getEntityRecords('postType', 'wp_template', {
|
|
149
|
+
per_page: -1
|
|
150
|
+
});
|
|
151
|
+
if (!templates) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
const id = templates.find(({
|
|
155
|
+
slug
|
|
156
|
+
}) => slug === 'front-page')?.id;
|
|
157
|
+
if (id) {
|
|
158
|
+
return id;
|
|
159
|
+
}
|
|
160
|
+
// If no front page template is found, continue with the
|
|
161
|
+
// logic below (fetching the page template).
|
|
162
|
+
}
|
|
163
|
+
const editedEntity = select(_name.STORE_NAME).getEditedEntityRecord('postType', postType, postId);
|
|
164
|
+
if (!editedEntity) {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
const postsPageId = (0, _lockUnlock.unlock)(select(_name.STORE_NAME)).getPostsPageId();
|
|
168
|
+
// Check if the current page is the posts page.
|
|
169
|
+
if (postType === 'page' && postsPageId === postId.toString()) {
|
|
170
|
+
return select(_name.STORE_NAME).getDefaultTemplateId({
|
|
171
|
+
slug: 'home'
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
// First see if the post/page has an assigned template and fetch it.
|
|
175
|
+
const currentTemplateSlug = editedEntity.template;
|
|
176
|
+
if (currentTemplateSlug) {
|
|
177
|
+
const currentTemplate = select(_name.STORE_NAME).getEntityRecords('postType', 'wp_template', {
|
|
178
|
+
per_page: -1
|
|
179
|
+
})?.find(({
|
|
180
|
+
slug
|
|
181
|
+
}) => slug === currentTemplateSlug);
|
|
182
|
+
if (currentTemplate) {
|
|
183
|
+
return currentTemplate.id;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
// If no template is assigned, use the default template.
|
|
187
|
+
let slugToCheck;
|
|
188
|
+
// In `draft` status we might not have a slug available, so we use the `single`
|
|
189
|
+
// post type templates slug(ex page, single-post, single-product etc..).
|
|
190
|
+
// Pages do not need the `single` prefix in the slug to be prioritized
|
|
191
|
+
// through template hierarchy.
|
|
192
|
+
if (editedEntity.slug) {
|
|
193
|
+
slugToCheck = postType === 'page' ? `${postType}-${editedEntity.slug}` : `single-${postType}-${editedEntity.slug}`;
|
|
194
|
+
} else {
|
|
195
|
+
slugToCheck = postType === 'page' ? 'page' : `single-${postType}`;
|
|
196
|
+
}
|
|
197
|
+
return select(_name.STORE_NAME).getDefaultTemplateId({
|
|
198
|
+
slug: slugToCheck
|
|
199
|
+
});
|
|
200
|
+
});
|
|
92
201
|
//# sourceMappingURL=private-selectors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_name","getUndoManager","state","undoManager","getNavigationFallbackId","navigationFallbackId","getBlockPatternsForPostType","exports","createRegistrySelector","select","createSelector","postType","STORE_NAME","getBlockPatterns","filter","postTypes","Array","isArray","includes","getEntityRecordsPermissions","kind","name","ids","normalizedIds","map","id","delete","canUser","update","userPermissions","getEntityRecordPermissions","getRegisteredPostMeta","_state$registeredPost","registeredPostMeta"],"sources":["@wordpress/core-data/src/private-selectors.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSelector, createRegistrySelector } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport type { State } from './selectors';\nimport { STORE_NAME } from './name';\n\ntype EntityRecordKey = string | number;\n\n/**\n * Returns the previous edit from the current undo offset\n * for the entity records edits history, if any.\n *\n * @param state State tree.\n *\n * @return The undo manager.\n */\nexport function getUndoManager( state: State ) {\n\treturn state.undoManager;\n}\n\n/**\n * Retrieve the fallback Navigation.\n *\n * @param state Data state.\n * @return The ID for the fallback Navigation post.\n */\nexport function getNavigationFallbackId(\n\tstate: State\n): EntityRecordKey | undefined {\n\treturn state.navigationFallbackId;\n}\n\nexport const getBlockPatternsForPostType = createRegistrySelector(\n\t( select: any ) =>\n\t\tcreateSelector(\n\t\t\t( state, postType ) =>\n\t\t\t\tselect( STORE_NAME )\n\t\t\t\t\t.getBlockPatterns()\n\t\t\t\t\t.filter(\n\t\t\t\t\t\t( { postTypes } ) =>\n\t\t\t\t\t\t\t! postTypes ||\n\t\t\t\t\t\t\t( Array.isArray( postTypes ) &&\n\t\t\t\t\t\t\t\tpostTypes.includes( postType ) )\n\t\t\t\t\t),\n\t\t\t() => [ select( STORE_NAME ).getBlockPatterns() ]\n\t\t)\n);\n\n/**\n * Returns the entity records permissions for the given entity record ids.\n */\nexport const getEntityRecordsPermissions = createRegistrySelector( ( select ) =>\n\tcreateSelector(\n\t\t( state: State, kind: string, name: string, ids: string[] ) => {\n\t\t\tconst normalizedIds = Array.isArray( ids ) ? ids : [ ids ];\n\t\t\treturn normalizedIds.map( ( id ) => ( {\n\t\t\t\tdelete: select( STORE_NAME ).canUser( 'delete', {\n\t\t\t\t\tkind,\n\t\t\t\t\tname,\n\t\t\t\t\tid,\n\t\t\t\t} ),\n\t\t\t\tupdate: select( STORE_NAME ).canUser( 'update', {\n\t\t\t\t\tkind,\n\t\t\t\t\tname,\n\t\t\t\t\tid,\n\t\t\t\t} ),\n\t\t\t} ) );\n\t\t},\n\t\t( state ) => [ state.userPermissions ]\n\t)\n);\n\n/**\n * Returns the entity record permissions for the given entity record id.\n *\n * @param state Data state.\n * @param kind Entity kind.\n * @param name Entity name.\n * @param id Entity record id.\n *\n * @return The entity record permissions.\n */\nexport function getEntityRecordPermissions(\n\tstate: State,\n\tkind: string,\n\tname: string,\n\tid: string\n) {\n\treturn getEntityRecordsPermissions( state, kind, name, id )[ 0 ];\n}\n\n/**\n * Returns the registered post meta fields for a given post type.\n *\n * @param state Data state.\n * @param postType Post type.\n *\n * @return Registered post meta fields.\n */\nexport function getRegisteredPostMeta( state: State, postType: string ) {\n\treturn state.registeredPostMeta?.[ postType ] ?? {};\n}\n"],"mappings":";;;;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAMA,IAAAC,KAAA,GAAAD,OAAA;AATA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,cAAcA,CAAEC,KAAY,EAAG;EAC9C,OAAOA,KAAK,CAACC,WAAW;AACzB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,uBAAuBA,CACtCF,KAAY,EACkB;EAC9B,OAA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CACzC5B,KAAY,EACZkB,IAAY,EACZC,IAAY,EACZI,EAAU,EACT;EACD,OAAON,2BAA2B,CAAEjB,KAAK,EAAEkB,IAAI,EAAEC,IAAI,EAAEI,EAAG,CAAC,CAAE,CAAC,CAAE;AACjE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASM,qBAAqBA,CAAE7B,KAAY,EAAES,QAAgB,EAAG;EAAA,IAAAqB,qBAAA;EACvE,QAAAA,qBAAA,GAAO9B,KAAK,CAAC+B,kBAAkB,GAAItB,QAAQ,CAAE,cAAAqB,qBAAA,cAAAA,qBAAA,GAAI,CAAC,CAAC;AACpD","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_data","require","_selectors","_name","_lockUnlock","getUndoManager","state","undoManager","getNavigationFallbackId","navigationFallbackId","getBlockPatternsForPostType","exports","createRegistrySelector","select","createSelector","postType","STORE_NAME","getBlockPatterns","filter","postTypes","Array","isArray","includes","getEntityRecordsPermissions","kind","name","ids","normalizedIds","map","id","delete","canUser","update","userPermissions","getEntityRecordPermissions","getRegisteredPostMeta","_state$registeredPost","registeredPostMeta","normalizePageId","value","Number","toString","getHomePage","siteData","getEntityRecord","homepageId","show_on_front","page_on_front","postId","frontPageTemplateId","getDefaultTemplateId","slug","getPostsPageId","page_for_posts","getTemplateId","homepage","unlock","templates","getEntityRecords","per_page","find","editedEntity","getEditedEntityRecord","postsPageId","currentTemplateSlug","template","currentTemplate","slugToCheck"],"sources":["@wordpress/core-data/src/private-selectors.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSelector, createRegistrySelector } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { getDefaultTemplateId, getEntityRecord, type State } from './selectors';\nimport { STORE_NAME } from './name';\nimport { unlock } from './lock-unlock';\n\ntype EntityRecordKey = string | number;\n\n/**\n * Returns the previous edit from the current undo offset\n * for the entity records edits history, if any.\n *\n * @param state State tree.\n *\n * @return The undo manager.\n */\nexport function getUndoManager( state: State ) {\n\treturn state.undoManager;\n}\n\n/**\n * Retrieve the fallback Navigation.\n *\n * @param state Data state.\n * @return The ID for the fallback Navigation post.\n */\nexport function getNavigationFallbackId(\n\tstate: State\n): EntityRecordKey | undefined {\n\treturn state.navigationFallbackId;\n}\n\nexport const getBlockPatternsForPostType = createRegistrySelector(\n\t( select: any ) =>\n\t\tcreateSelector(\n\t\t\t( state, postType ) =>\n\t\t\t\tselect( STORE_NAME )\n\t\t\t\t\t.getBlockPatterns()\n\t\t\t\t\t.filter(\n\t\t\t\t\t\t( { postTypes } ) =>\n\t\t\t\t\t\t\t! postTypes ||\n\t\t\t\t\t\t\t( Array.isArray( postTypes ) &&\n\t\t\t\t\t\t\t\tpostTypes.includes( postType ) )\n\t\t\t\t\t),\n\t\t\t() => [ select( STORE_NAME ).getBlockPatterns() ]\n\t\t)\n);\n\n/**\n * Returns the entity records permissions for the given entity record ids.\n */\nexport const getEntityRecordsPermissions = createRegistrySelector( ( select ) =>\n\tcreateSelector(\n\t\t( state: State, kind: string, name: string, ids: string[] ) => {\n\t\t\tconst normalizedIds = Array.isArray( ids ) ? ids : [ ids ];\n\t\t\treturn normalizedIds.map( ( id ) => ( {\n\t\t\t\tdelete: select( STORE_NAME ).canUser( 'delete', {\n\t\t\t\t\tkind,\n\t\t\t\t\tname,\n\t\t\t\t\tid,\n\t\t\t\t} ),\n\t\t\t\tupdate: select( STORE_NAME ).canUser( 'update', {\n\t\t\t\t\tkind,\n\t\t\t\t\tname,\n\t\t\t\t\tid,\n\t\t\t\t} ),\n\t\t\t} ) );\n\t\t},\n\t\t( state ) => [ state.userPermissions ]\n\t)\n);\n\n/**\n * Returns the entity record permissions for the given entity record id.\n *\n * @param state Data state.\n * @param kind Entity kind.\n * @param name Entity name.\n * @param id Entity record id.\n *\n * @return The entity record permissions.\n */\nexport function getEntityRecordPermissions(\n\tstate: State,\n\tkind: string,\n\tname: string,\n\tid: string\n) {\n\treturn getEntityRecordsPermissions( state, kind, name, id )[ 0 ];\n}\n\n/**\n * Returns the registered post meta fields for a given post type.\n *\n * @param state Data state.\n * @param postType Post type.\n *\n * @return Registered post meta fields.\n */\nexport function getRegisteredPostMeta( state: State, postType: string ) {\n\treturn state.registeredPostMeta?.[ postType ] ?? {};\n}\n\nfunction normalizePageId( value: number | string | undefined ): string | null {\n\tif ( ! value || ! [ 'number', 'string' ].includes( typeof value ) ) {\n\t\treturn null;\n\t}\n\n\t// We also need to check if it's not zero (`'0'`).\n\tif ( Number( value ) === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn value.toString();\n}\n\ninterface SiteData {\n\tshow_on_front?: string;\n\tpage_on_front?: string | number;\n\tpage_for_posts?: string | number;\n}\n\nexport const getHomePage = createRegistrySelector( ( select ) =>\n\tcreateSelector(\n\t\t() => {\n\t\t\tconst siteData = select( STORE_NAME ).getEntityRecord(\n\t\t\t\t'root',\n\t\t\t\t'site'\n\t\t\t) as SiteData | undefined;\n\t\t\tif ( ! siteData ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tconst homepageId =\n\t\t\t\tsiteData?.show_on_front === 'page'\n\t\t\t\t\t? normalizePageId( siteData.page_on_front )\n\t\t\t\t\t: null;\n\t\t\tif ( homepageId ) {\n\t\t\t\treturn { postType: 'page', postId: homepageId };\n\t\t\t}\n\t\t\tconst frontPageTemplateId = select(\n\t\t\t\tSTORE_NAME\n\t\t\t).getDefaultTemplateId( {\n\t\t\t\tslug: 'front-page',\n\t\t\t} );\n\t\t\treturn { postType: 'wp_template', postId: frontPageTemplateId };\n\t\t},\n\t\t( state ) => [\n\t\t\t// @ts-expect-error\n\t\t\tgetEntityRecord( state, 'root', 'site' ),\n\t\t\tgetDefaultTemplateId( state, {\n\t\t\t\tslug: 'front-page',\n\t\t\t} ),\n\t\t]\n\t)\n);\n\nexport const getPostsPageId = createRegistrySelector( ( select ) => () => {\n\tconst siteData = select( STORE_NAME ).getEntityRecord( 'root', 'site' ) as\n\t\t| SiteData\n\t\t| undefined;\n\treturn siteData?.show_on_front === 'page'\n\t\t? normalizePageId( siteData.page_for_posts )\n\t\t: null;\n} );\n\nexport const getTemplateId = createRegistrySelector(\n\t( select ) => ( state, postType, postId ) => {\n\t\tconst homepage = unlock( select( STORE_NAME ) ).getHomePage();\n\n\t\tif ( ! homepage ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// For the front page, we always use the front page template if existing.\n\t\tif (\n\t\t\tpostType === 'page' &&\n\t\t\tpostType === homepage?.postType &&\n\t\t\tpostId.toString() === homepage?.postId\n\t\t) {\n\t\t\t// The /lookup endpoint cannot currently handle a lookup\n\t\t\t// when a page is set as the front page, so specifically in\n\t\t\t// that case, we want to check if there is a front page\n\t\t\t// template, and instead of falling back to the home\n\t\t\t// template, we want to fall back to the page template.\n\t\t\tconst templates = select( STORE_NAME ).getEntityRecords(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template',\n\t\t\t\t{\n\t\t\t\t\tper_page: -1,\n\t\t\t\t}\n\t\t\t);\n\t\t\tif ( ! templates ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst id = templates.find( ( { slug } ) => slug === 'front-page' )\n\t\t\t\t?.id;\n\t\t\tif ( id ) {\n\t\t\t\treturn id;\n\t\t\t}\n\t\t\t// If no front page template is found, continue with the\n\t\t\t// logic below (fetching the page template).\n\t\t}\n\n\t\tconst editedEntity = select( STORE_NAME ).getEditedEntityRecord(\n\t\t\t'postType',\n\t\t\tpostType,\n\t\t\tpostId\n\t\t);\n\t\tif ( ! editedEntity ) {\n\t\t\treturn;\n\t\t}\n\t\tconst postsPageId = unlock( select( STORE_NAME ) ).getPostsPageId();\n\t\t// Check if the current page is the posts page.\n\t\tif ( postType === 'page' && postsPageId === postId.toString() ) {\n\t\t\treturn select( STORE_NAME ).getDefaultTemplateId( {\n\t\t\t\tslug: 'home',\n\t\t\t} );\n\t\t}\n\t\t// First see if the post/page has an assigned template and fetch it.\n\t\tconst currentTemplateSlug = editedEntity.template;\n\t\tif ( currentTemplateSlug ) {\n\t\t\tconst currentTemplate = select( STORE_NAME )\n\t\t\t\t.getEntityRecords( 'postType', 'wp_template', {\n\t\t\t\t\tper_page: -1,\n\t\t\t\t} )\n\t\t\t\t?.find( ( { slug } ) => slug === currentTemplateSlug );\n\t\t\tif ( currentTemplate ) {\n\t\t\t\treturn currentTemplate.id;\n\t\t\t}\n\t\t}\n\t\t// If no template is assigned, use the default template.\n\t\tlet slugToCheck;\n\t\t// In `draft` status we might not have a slug available, so we use the `single`\n\t\t// post type templates slug(ex page, single-post, single-product etc..).\n\t\t// Pages do not need the `single` prefix in the slug to be prioritized\n\t\t// through template hierarchy.\n\t\tif ( editedEntity.slug ) {\n\t\t\tslugToCheck =\n\t\t\t\tpostType === 'page'\n\t\t\t\t\t? `${ postType }-${ editedEntity.slug }`\n\t\t\t\t\t: `single-${ postType }-${ editedEntity.slug }`;\n\t\t} else {\n\t\t\tslugToCheck = postType === 'page' ? 'page' : `single-${ postType }`;\n\t\t}\n\t\treturn select( STORE_NAME ).getDefaultTemplateId( {\n\t\t\tslug: slugToCheck,\n\t\t} );\n\t}\n);\n"],"mappings":";;;;;;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAKA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAVA;AACA;AACA;;AAGA;AACA;AACA;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASI,cAAcA,CAAEC,KAAY,EAAG;EAC9C,OAAOA,KAAK,CAACC,WAAW;AACzB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,uBAAuBA,CACtCF,KAAY,EACkB;EAC9B,OAAOA,KAAK,CAACG,oBAAoB;AAClC;AAEO,MAAMC,2BAA2B,GAAAC,OAAA,CAAAD,2BAAA,GAAG,IAAAE,4BAAsB,EAC9DC,MAAW,IACZ,IAAAC,oBAAc,EACb,CAAER,KAAK,EAAES,QAAQ,KAChBF,M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KAAK,MAAM,GAAG,MAAM,GAAG,UAAWA,QAAQ,EAAG;EACpE;EACA,OAAOF,MAAM,CAAEG,gBAAW,CAAC,CAACkC,oBAAoB,CAAE;IACjDC,IAAI,EAAEgB;EACP,CAAE,CAAC;AACJ,CACD,CAAC","ignoreList":[]}
|
package/build/resolvers.js
CHANGED
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.getUserPatternCategories = exports.getThemeSupports = exports.getRevisions = exports.getRevision = exports.getRegisteredPostMeta = exports.getRawEntityRecord = exports.getNavigationFallbackId = exports.getEntityRecords = exports.getEntityRecord = exports.getEntitiesConfig = exports.getEmbedPreview = exports.getEditedEntityRecord = exports.getDefaultTemplateId = exports.getCurrentUser = exports.getCurrentThemeGlobalStylesRevisions = exports.getCurrentTheme = exports.getBlockPatterns = exports.getBlockPatternCategories = exports.getAutosaves = exports.getAutosave = exports.getAuthors = exports.canUserEditEntityRecord = exports.canUser = exports.
|
|
8
|
+
exports.getUserPatternCategories = exports.getThemeSupports = exports.getRevisions = exports.getRevision = exports.getRegisteredPostMeta = exports.getRawEntityRecord = exports.getNavigationFallbackId = exports.getEntityRecords = exports.getEntityRecord = exports.getEntitiesConfig = exports.getEmbedPreview = exports.getEditedEntityRecord = exports.getDefaultTemplateId = exports.getCurrentUser = exports.getCurrentThemeGlobalStylesRevisions = exports.getCurrentTheme = exports.getBlockPatterns = exports.getBlockPatternCategories = exports.getAutosaves = exports.getAutosave = exports.getAuthors = exports.canUserEditEntityRecord = exports.canUser = exports.__experimentalGetCurrentThemeGlobalStylesVariations = exports.__experimentalGetCurrentThemeBaseGlobalStyles = exports.__experimentalGetCurrentGlobalStylesId = void 0;
|
|
9
9
|
var _changeCase = require("change-case");
|
|
10
10
|
var _url = require("@wordpress/url");
|
|
11
11
|
var _htmlEntities = require("@wordpress/html-entities");
|
|
@@ -206,6 +206,10 @@ const getEntityRecords = (kind, name, query = {}) => async ({
|
|
|
206
206
|
const lock = await dispatch.__unstableAcquireStoreLock(_name.STORE_NAME, ['entities', 'records', kind, name], {
|
|
207
207
|
exclusive: false
|
|
208
208
|
});
|
|
209
|
+
const key = entityConfig.key || _entities.DEFAULT_ENTITY_KEY;
|
|
210
|
+
function getResolutionsArgs(records) {
|
|
211
|
+
return records.filter(record => record?.[key]).map(record => [kind, name, record[key]]);
|
|
212
|
+
}
|
|
209
213
|
try {
|
|
210
214
|
if (query._fields) {
|
|
211
215
|
// If requesting specific fields, items and query association to said
|
|
@@ -220,7 +224,8 @@ const getEntityRecords = (kind, name, query = {}) => async ({
|
|
|
220
224
|
...entityConfig.baseURLParams,
|
|
221
225
|
...query
|
|
222
226
|
});
|
|
223
|
-
let records,
|
|
227
|
+
let records = [],
|
|
228
|
+
meta;
|
|
224
229
|
if (entityConfig.supportsPagination && query.per_page !== -1) {
|
|
225
230
|
const response = await (0, _apiFetch.default)({
|
|
226
231
|
path,
|
|
@@ -231,6 +236,30 @@ const getEntityRecords = (kind, name, query = {}) => async ({
|
|
|
231
236
|
totalItems: parseInt(response.headers.get('X-WP-Total')),
|
|
232
237
|
totalPages: parseInt(response.headers.get('X-WP-TotalPages'))
|
|
233
238
|
};
|
|
239
|
+
} else if (query.per_page === -1 && query[_utils.RECEIVE_INTERMEDIATE_RESULTS] === true) {
|
|
240
|
+
let page = 1;
|
|
241
|
+
let totalPages;
|
|
242
|
+
do {
|
|
243
|
+
const response = await (0, _apiFetch.default)({
|
|
244
|
+
path: (0, _url.addQueryArgs)(path, {
|
|
245
|
+
page,
|
|
246
|
+
per_page: 100
|
|
247
|
+
}),
|
|
248
|
+
parse: false
|
|
249
|
+
});
|
|
250
|
+
const pageRecords = Object.values(await response.json());
|
|
251
|
+
totalPages = parseInt(response.headers.get('X-WP-TotalPages'));
|
|
252
|
+
records.push(...pageRecords);
|
|
253
|
+
registry.batch(() => {
|
|
254
|
+
dispatch.receiveEntityRecords(kind, name, records, query);
|
|
255
|
+
dispatch.finishResolutions('getEntityRecord', getResolutionsArgs(pageRecords));
|
|
256
|
+
});
|
|
257
|
+
page++;
|
|
258
|
+
} while (page <= totalPages);
|
|
259
|
+
meta = {
|
|
260
|
+
totalItems: records.length,
|
|
261
|
+
totalPages: 1
|
|
262
|
+
};
|
|
234
263
|
} else {
|
|
235
264
|
records = Object.values(await (0, _apiFetch.default)({
|
|
236
265
|
path
|
|
@@ -262,8 +291,6 @@ const getEntityRecords = (kind, name, query = {}) => async ({
|
|
|
262
291
|
// See https://github.com/WordPress/gutenberg/pull/26575
|
|
263
292
|
// See https://github.com/WordPress/gutenberg/pull/64504
|
|
264
293
|
if (!query?._fields && !query.context) {
|
|
265
|
-
const key = entityConfig.key || _entities.DEFAULT_ENTITY_KEY;
|
|
266
|
-
const resolutionsArgs = records.filter(record => record?.[key]).map(record => [kind, name, record[key]]);
|
|
267
294
|
const targetHints = records.filter(record => record?.[key]).map(record => ({
|
|
268
295
|
id: record[key],
|
|
269
296
|
permissions: (0, _utils.getUserPermissionsFromAllowHeader)(record?._links?.self?.[0].targetHints.allow)
|
|
@@ -285,7 +312,7 @@ const getEntityRecords = (kind, name, query = {}) => async ({
|
|
|
285
312
|
}
|
|
286
313
|
}
|
|
287
314
|
dispatch.receiveUserPermissions(receiveUserPermissionArgs);
|
|
288
|
-
dispatch.finishResolutions('getEntityRecord',
|
|
315
|
+
dispatch.finishResolutions('getEntityRecord', getResolutionsArgs(records));
|
|
289
316
|
dispatch.finishResolutions('canUser', canUserResolutionsArgs);
|
|
290
317
|
}
|
|
291
318
|
dispatch.__unstableReleaseStoreLock(lock);
|
|
@@ -473,45 +500,7 @@ const getAutosave = (postType, postId) => async ({
|
|
|
473
500
|
}) => {
|
|
474
501
|
await resolveSelect.getAutosaves(postType, postId);
|
|
475
502
|
};
|
|
476
|
-
|
|
477
|
-
/**
|
|
478
|
-
* Retrieve the frontend template used for a given link.
|
|
479
|
-
*
|
|
480
|
-
* @param {string} link Link.
|
|
481
|
-
*/
|
|
482
503
|
exports.getAutosave = getAutosave;
|
|
483
|
-
const __experimentalGetTemplateForLink = link => async ({
|
|
484
|
-
dispatch,
|
|
485
|
-
resolveSelect
|
|
486
|
-
}) => {
|
|
487
|
-
let template;
|
|
488
|
-
try {
|
|
489
|
-
// This is NOT calling a REST endpoint but rather ends up with a response from
|
|
490
|
-
// an Ajax function which has a different shape from a WP_REST_Response.
|
|
491
|
-
template = await (0, _apiFetch.default)({
|
|
492
|
-
url: (0, _url.addQueryArgs)(link, {
|
|
493
|
-
'_wp-find-template': true
|
|
494
|
-
})
|
|
495
|
-
}).then(({
|
|
496
|
-
data
|
|
497
|
-
}) => data);
|
|
498
|
-
} catch (e) {
|
|
499
|
-
// For non-FSE themes, it is possible that this request returns an error.
|
|
500
|
-
}
|
|
501
|
-
if (!template) {
|
|
502
|
-
return;
|
|
503
|
-
}
|
|
504
|
-
const record = await resolveSelect.getEntityRecord('postType', 'wp_template', template.id);
|
|
505
|
-
if (record) {
|
|
506
|
-
dispatch.receiveEntityRecords('postType', 'wp_template', [record], {
|
|
507
|
-
'find-template': link
|
|
508
|
-
});
|
|
509
|
-
}
|
|
510
|
-
};
|
|
511
|
-
exports.__experimentalGetTemplateForLink = __experimentalGetTemplateForLink;
|
|
512
|
-
__experimentalGetTemplateForLink.shouldInvalidate = action => {
|
|
513
|
-
return (action.type === 'RECEIVE_ITEMS' || action.type === 'REMOVE_ITEMS') && action.invalidateCache && action.kind === 'postType' && action.name === 'wp_template';
|
|
514
|
-
};
|
|
515
504
|
const __experimentalGetCurrentGlobalStylesId = () => async ({
|
|
516
505
|
dispatch,
|
|
517
506
|
resolveSelect
|
|
@@ -652,14 +641,24 @@ const getNavigationFallbackId = () => async ({
|
|
|
652
641
|
};
|
|
653
642
|
exports.getNavigationFallbackId = getNavigationFallbackId;
|
|
654
643
|
const getDefaultTemplateId = query => async ({
|
|
655
|
-
dispatch
|
|
644
|
+
dispatch,
|
|
645
|
+
registry,
|
|
646
|
+
resolveSelect
|
|
656
647
|
}) => {
|
|
657
648
|
const template = await (0, _apiFetch.default)({
|
|
658
649
|
path: (0, _url.addQueryArgs)('/wp/v2/templates/lookup', query)
|
|
659
650
|
});
|
|
651
|
+
// Wait for the the entities config to be loaded, otherwise receiving
|
|
652
|
+
// the template as an entity will not work.
|
|
653
|
+
await resolveSelect.getEntitiesConfig('postType');
|
|
660
654
|
// Endpoint may return an empty object if no template is found.
|
|
661
655
|
if (template?.id) {
|
|
662
|
-
|
|
656
|
+
registry.batch(() => {
|
|
657
|
+
dispatch.receiveDefaultTemplateId(query, template.id);
|
|
658
|
+
dispatch.receiveEntityRecords('postType', 'wp_template', [template]);
|
|
659
|
+
// Avoid further network requests.
|
|
660
|
+
dispatch.finishResolution('getEntityRecord', ['postType', 'wp_template', template.id]);
|
|
661
|
+
});
|
|
663
662
|
}
|
|
664
663
|
};
|
|
665
664
|
|