@wordpress/core-data 7.8.6 → 7.10.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.
@@ -1,3 +1,4 @@
1
+ /* wp:polyfill */
1
2
  /**
2
3
  * Internal dependencies
3
4
  */
@@ -1 +1 @@
1
- {"version":3,"names":["defaultProcessor","createBatch","processor","lastId","queue","pending","ObservableSet","add","inputOrThunk","id","input","Promise","resolve","reject","push","delete","finally","run","size","unsubscribe","subscribe","undefined","results","map","length","Error","error","isSuccess","forEach","result","key","queueItem","_result$output","output","constructor","args","set","Set","subscribers","value","subscriber"],"sources":["@wordpress/core-data/src/batch/create-batch.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport defaultProcessor from './default-processor';\n\n/**\n * Creates a batch, which can be used to combine multiple API requests into one\n * API request using the WordPress batch processing API (/v1/batch).\n *\n * ```\n * const batch = createBatch();\n * const dunePromise = batch.add( {\n * path: '/v1/books',\n * method: 'POST',\n * data: { title: 'Dune' }\n * } );\n * const lotrPromise = batch.add( {\n * path: '/v1/books',\n * method: 'POST',\n * data: { title: 'Lord of the Rings' }\n * } );\n * const isSuccess = await batch.run(); // Sends one POST to /v1/batch.\n * if ( isSuccess ) {\n * console.log(\n * 'Saved two books:',\n * await dunePromise,\n * await lotrPromise\n * );\n * }\n * ```\n *\n * @param {Function} [processor] Processor function. Can be used to replace the\n * default functionality which is to send an API\n * request to /v1/batch. Is given an array of\n * inputs and must return a promise that\n * resolves to an array of objects containing\n * either `output` or `error`.\n */\nexport default function createBatch( processor = defaultProcessor ) {\n\tlet lastId = 0;\n\t/** @type {Array<{ input: any; resolve: ( value: any ) => void; reject: ( error: any ) => void }>} */\n\tlet queue = [];\n\tconst pending = new ObservableSet();\n\n\treturn {\n\t\t/**\n\t\t * Adds an input to the batch and returns a promise that is resolved or\n\t\t * rejected when the input is processed by `batch.run()`.\n\t\t *\n\t\t * You may also pass a thunk which allows inputs to be added\n\t\t * asychronously.\n\t\t *\n\t\t * ```\n\t\t * // Both are allowed:\n\t\t * batch.add( { path: '/v1/books', ... } );\n\t\t * batch.add( ( add ) => add( { path: '/v1/books', ... } ) );\n\t\t * ```\n\t\t *\n\t\t * If a thunk is passed, `batch.run()` will pause until either:\n\t\t *\n\t\t * - The thunk calls its `add` argument, or;\n\t\t * - The thunk returns a promise and that promise resolves, or;\n\t\t * - The thunk returns a non-promise.\n\t\t *\n\t\t * @param {any|Function} inputOrThunk Input to add or thunk to execute.\n\t\t *\n\t\t * @return {Promise|any} If given an input, returns a promise that\n\t\t * is resolved or rejected when the batch is\n\t\t * processed. If given a thunk, returns the return\n\t\t * value of that thunk.\n\t\t */\n\t\tadd( inputOrThunk ) {\n\t\t\tconst id = ++lastId;\n\t\t\tpending.add( id );\n\n\t\t\tconst add = ( input ) =>\n\t\t\t\tnew Promise( ( resolve, reject ) => {\n\t\t\t\t\tqueue.push( {\n\t\t\t\t\t\tinput,\n\t\t\t\t\t\tresolve,\n\t\t\t\t\t\treject,\n\t\t\t\t\t} );\n\t\t\t\t\tpending.delete( id );\n\t\t\t\t} );\n\n\t\t\tif ( typeof inputOrThunk === 'function' ) {\n\t\t\t\treturn Promise.resolve( inputOrThunk( add ) ).finally( () => {\n\t\t\t\t\tpending.delete( id );\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\treturn add( inputOrThunk );\n\t\t},\n\n\t\t/**\n\t\t * Runs the batch. This calls `batchProcessor` and resolves or rejects\n\t\t * all promises returned by `add()`.\n\t\t *\n\t\t * @return {Promise<boolean>} A promise that resolves to a boolean that is true\n\t\t * if the processor returned no errors.\n\t\t */\n\t\tasync run() {\n\t\t\tif ( pending.size ) {\n\t\t\t\tawait new Promise( ( resolve ) => {\n\t\t\t\t\tconst unsubscribe = pending.subscribe( () => {\n\t\t\t\t\t\tif ( ! pending.size ) {\n\t\t\t\t\t\t\tunsubscribe();\n\t\t\t\t\t\t\tresolve( undefined );\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tlet results;\n\n\t\t\ttry {\n\t\t\t\tresults = await processor(\n\t\t\t\t\tqueue.map( ( { input } ) => input )\n\t\t\t\t);\n\n\t\t\t\tif ( results.length !== queue.length ) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t'run: Array returned by processor must be same size as input array.'\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} catch ( error ) {\n\t\t\t\tfor ( const { reject } of queue ) {\n\t\t\t\t\treject( error );\n\t\t\t\t}\n\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\tlet isSuccess = true;\n\n\t\t\tresults.forEach( ( result, key ) => {\n\t\t\t\tconst queueItem = queue[ key ];\n\n\t\t\t\tif ( result?.error ) {\n\t\t\t\t\tqueueItem?.reject( result.error );\n\t\t\t\t\tisSuccess = false;\n\t\t\t\t} else {\n\t\t\t\t\tqueueItem?.resolve( result?.output ?? result );\n\t\t\t\t}\n\t\t\t} );\n\n\t\t\tqueue = [];\n\n\t\t\treturn isSuccess;\n\t\t},\n\t};\n}\n\nclass ObservableSet {\n\tconstructor( ...args ) {\n\t\tthis.set = new Set( ...args );\n\t\tthis.subscribers = new Set();\n\t}\n\n\tget size() {\n\t\treturn this.set.size;\n\t}\n\n\tadd( value ) {\n\t\tthis.set.add( value );\n\t\tthis.subscribers.forEach( ( subscriber ) => subscriber() );\n\t\treturn this;\n\t}\n\n\tdelete( value ) {\n\t\tconst isSuccess = this.set.delete( value );\n\t\tthis.subscribers.forEach( ( subscriber ) => subscriber() );\n\t\treturn isSuccess;\n\t}\n\n\tsubscribe( subscriber ) {\n\t\tthis.subscribers.add( subscriber );\n\t\treturn () => {\n\t\t\tthis.subscribers.delete( subscriber );\n\t\t};\n\t}\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,gBAAgB,MAAM,qBAAqB;;AAElD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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,CAAC;EAC7B;EAEA,IAAInB,IAAIA,CAAA,EAAG;IACV,OAAO,IAAI,CAACkB,GAAG,CAAClB,IAAI;EACrB;EAEAX,GAAGA,CAAEgC,KAAK,EAAG;IACZ,IAAI,CAACH,GAAG,CAAC7B,GAAG,CAAEgC,KAAM,CAAC;IACrB,IAAI,CAACD,WAAW,CAACV,OAAO,CAAIY,UAAU,IAAMA,UAAU,CAAC,CAAE,CAAC;IAC1D,OAAO,IAAI;EACZ;EAEAzB,MAAMA,CAAEwB,KAAK,EAAG;IACf,MAAMZ,SAAS,GAAG,IAAI,CAACS,GAAG,CAACrB,MAAM,CAAEwB,KAAM,CAAC;IAC1C,IAAI,CAACD,WAAW,CAACV,OAAO,CAAIY,UAAU,IAAMA,UAAU,CAAC,CAAE,CAAC;IAC1D,OAAOb,SAAS;EACjB;EAEAP,SAASA,CAAEoB,UAAU,EAAG;IACvB,IAAI,CAACF,WAAW,CAAC/B,GAAG,CAAEiC,UAAW,CAAC;IAClC,OAAO,MAAM;MACZ,IAAI,CAACF,WAAW,CAACvB,MAAM,CAAEyB,UAAW,CAAC;IACtC,CAAC;EACF;AACD","ignoreList":[]}
1
+ {"version":3,"names":["defaultProcessor","createBatch","processor","lastId","queue","pending","ObservableSet","add","inputOrThunk","id","input","Promise","resolve","reject","push","delete","finally","run","size","unsubscribe","subscribe","undefined","results","map","length","Error","error","isSuccess","forEach","result","key","queueItem","_result$output","output","constructor","args","set","Set","subscribers","value","subscriber"],"sources":["@wordpress/core-data/src/batch/create-batch.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport defaultProcessor from './default-processor';\n\n/**\n * Creates a batch, which can be used to combine multiple API requests into one\n * API request using the WordPress batch processing API (/v1/batch).\n *\n * ```\n * const batch = createBatch();\n * const dunePromise = batch.add( {\n * path: '/v1/books',\n * method: 'POST',\n * data: { title: 'Dune' }\n * } );\n * const lotrPromise = batch.add( {\n * path: '/v1/books',\n * method: 'POST',\n * data: { title: 'Lord of the Rings' }\n * } );\n * const isSuccess = await batch.run(); // Sends one POST to /v1/batch.\n * if ( isSuccess ) {\n * console.log(\n * 'Saved two books:',\n * await dunePromise,\n * await lotrPromise\n * );\n * }\n * ```\n *\n * @param {Function} [processor] Processor function. Can be used to replace the\n * default functionality which is to send an API\n * request to /v1/batch. Is given an array of\n * inputs and must return a promise that\n * resolves to an array of objects containing\n * either `output` or `error`.\n */\nexport default function createBatch( processor = defaultProcessor ) {\n\tlet lastId = 0;\n\t/** @type {Array<{ input: any; resolve: ( value: any ) => void; reject: ( error: any ) => void }>} */\n\tlet queue = [];\n\tconst pending = new ObservableSet();\n\n\treturn {\n\t\t/**\n\t\t * Adds an input to the batch and returns a promise that is resolved or\n\t\t * rejected when the input is processed by `batch.run()`.\n\t\t *\n\t\t * You may also pass a thunk which allows inputs to be added\n\t\t * asychronously.\n\t\t *\n\t\t * ```\n\t\t * // Both are allowed:\n\t\t * batch.add( { path: '/v1/books', ... } );\n\t\t * batch.add( ( add ) => add( { path: '/v1/books', ... } ) );\n\t\t * ```\n\t\t *\n\t\t * If a thunk is passed, `batch.run()` will pause until either:\n\t\t *\n\t\t * - The thunk calls its `add` argument, or;\n\t\t * - The thunk returns a promise and that promise resolves, or;\n\t\t * - The thunk returns a non-promise.\n\t\t *\n\t\t * @param {any|Function} inputOrThunk Input to add or thunk to execute.\n\t\t *\n\t\t * @return {Promise|any} If given an input, returns a promise that\n\t\t * is resolved or rejected when the batch is\n\t\t * processed. If given a thunk, returns the return\n\t\t * value of that thunk.\n\t\t */\n\t\tadd( inputOrThunk ) {\n\t\t\tconst id = ++lastId;\n\t\t\tpending.add( id );\n\n\t\t\tconst add = ( input ) =>\n\t\t\t\tnew Promise( ( resolve, reject ) => {\n\t\t\t\t\tqueue.push( {\n\t\t\t\t\t\tinput,\n\t\t\t\t\t\tresolve,\n\t\t\t\t\t\treject,\n\t\t\t\t\t} );\n\t\t\t\t\tpending.delete( id );\n\t\t\t\t} );\n\n\t\t\tif ( typeof inputOrThunk === 'function' ) {\n\t\t\t\treturn Promise.resolve( inputOrThunk( add ) ).finally( () => {\n\t\t\t\t\tpending.delete( id );\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\treturn add( inputOrThunk );\n\t\t},\n\n\t\t/**\n\t\t * Runs the batch. This calls `batchProcessor` and resolves or rejects\n\t\t * all promises returned by `add()`.\n\t\t *\n\t\t * @return {Promise<boolean>} A promise that resolves to a boolean that is true\n\t\t * if the processor returned no errors.\n\t\t */\n\t\tasync run() {\n\t\t\tif ( pending.size ) {\n\t\t\t\tawait new Promise( ( resolve ) => {\n\t\t\t\t\tconst unsubscribe = pending.subscribe( () => {\n\t\t\t\t\t\tif ( ! pending.size ) {\n\t\t\t\t\t\t\tunsubscribe();\n\t\t\t\t\t\t\tresolve( undefined );\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tlet results;\n\n\t\t\ttry {\n\t\t\t\tresults = await processor(\n\t\t\t\t\tqueue.map( ( { input } ) => input )\n\t\t\t\t);\n\n\t\t\t\tif ( results.length !== queue.length ) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t'run: Array returned by processor must be same size as input array.'\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} catch ( error ) {\n\t\t\t\tfor ( const { reject } of queue ) {\n\t\t\t\t\treject( error );\n\t\t\t\t}\n\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\tlet isSuccess = true;\n\n\t\t\tresults.forEach( ( result, key ) => {\n\t\t\t\tconst queueItem = queue[ key ];\n\n\t\t\t\tif ( result?.error ) {\n\t\t\t\t\tqueueItem?.reject( result.error );\n\t\t\t\t\tisSuccess = false;\n\t\t\t\t} else {\n\t\t\t\t\tqueueItem?.resolve( result?.output ?? result );\n\t\t\t\t}\n\t\t\t} );\n\n\t\t\tqueue = [];\n\n\t\t\treturn isSuccess;\n\t\t},\n\t};\n}\n\nclass ObservableSet {\n\tconstructor( ...args ) {\n\t\tthis.set = new Set( ...args );\n\t\tthis.subscribers = new Set();\n\t}\n\n\tget size() {\n\t\treturn this.set.size;\n\t}\n\n\tadd( value ) {\n\t\tthis.set.add( value );\n\t\tthis.subscribers.forEach( ( subscriber ) => subscriber() );\n\t\treturn this;\n\t}\n\n\tdelete( value ) {\n\t\tconst isSuccess = this.set.delete( value );\n\t\tthis.subscribers.forEach( ( subscriber ) => subscriber() );\n\t\treturn isSuccess;\n\t}\n\n\tsubscribe( subscriber ) {\n\t\tthis.subscribers.add( subscriber );\n\t\treturn () => {\n\t\t\tthis.subscribers.delete( subscriber );\n\t\t};\n\t}\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,gBAAgB,MAAM,qBAAqB;;AAElD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,WAAWA,CAAEC,SAAS,GAAGF,gBAAgB,EAAG;EACnE,IAAIG,MAAM,GAAG,CAAC;EACd;EACA,IAAIC,KAAK,GAAG,EAAE;EACd,MAAMC,OAAO,GAAG,IAAIC,aAAa,CAAC,CAAC;EAEnC,OAAO;IACN;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACEC,GAAGA,CAAEC,YAAY,EAAG;MACnB,MAAMC,EAAE,GAAG,EAAEN,MAAM;MACnBE,OAAO,CAACE,GAAG,CAAEE,EAAG,CAAC;MAEjB,MAAMF,GAAG,GAAKG,KAAK,IAClB,IAAIC,OAAO,CAAE,CAAEC,OAAO,EAAEC,MAAM,KAAM;QACnCT,KAAK,CAACU,IAAI,CAAE;UACXJ,KAAK;UACLE,OAAO;UACPC;QACD,CAAE,CAAC;QACHR,OAAO,CAACU,MAAM,CAAEN,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oreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["capitalCase","pascalCase","apiFetch","__","RichTextData","addEntities","getSyncProvider","DEFAULT_ENTITY_KEY","POST_RAW_ATTRIBUTES","rootEntitiesConfig","label","kind","name","baseURL","baseURLParams","_fields","join","plural","syncConfig","fetch","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","valueOf","makeBlocksSerializable","map","block","innerBlocks","rest","postTypes","postType","_postType$rest_namesp","isTemplate","includes","namespace","rest_namespace","rest_base","selection","mergedEdits","meta","_record$slug","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","suffix","registerSyncConfigs","configs","register","editSyncConfig","getOrLoadEntitiesConfig","select","dispatch","getEntitiesConfig","hasConfig","getEntityConfig","length","window","__experimentalEnableSync","globalThis","IS_GUTENBERG_PLUGIN","loader","find","l"],"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\n/**\n * Internal dependencies\n */\nimport { addEntities } from './actions';\nimport { getSyncProvider } from './sync';\n\nexport const DEFAULT_ENTITY_KEY = 'id';\n\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\nfunction registerSyncConfigs( configs ) {\n\tconfigs.forEach( ( { syncObjectType, syncConfig } ) => {\n\t\tgetSyncProvider().register( syncObjectType, syncConfig );\n\t\tconst editSyncConfig = { ...syncConfig };\n\t\tdelete editSyncConfig.fetch;\n\t\tgetSyncProvider().register( syncObjectType + '--edit', editSyncConfig );\n\t} );\n}\n\n/**\n * Loads the entities into the store.\n *\n * Note: The `name` argument is used for `root` entities requiring additional server data.\n *\n * @param {string} kind Kind\n * @param {string} name Name\n * @return {(thunkArgs: object) => Promise<Array>} Entities\n */\nexport const getOrLoadEntitiesConfig =\n\t( kind, name ) =>\n\tasync ( { select, dispatch } ) => {\n\t\tlet configs = select.getEntitiesConfig( kind );\n\t\tconst hasConfig = !! select.getEntityConfig( kind, name );\n\n\t\tif ( configs?.length > 0 && hasConfig ) {\n\t\t\tif ( window.__experimentalEnableSync ) {\n\t\t\t\tif ( globalThis.IS_GUTENBERG_PLUGIN ) {\n\t\t\t\t\tregisterSyncConfigs( configs );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn configs;\n\t\t}\n\n\t\tconst loader = additionalEntityConfigLoaders.find( ( l ) => {\n\t\t\tif ( ! name || ! l.name ) {\n\t\t\t\treturn l.kind === kind;\n\t\t\t}\n\n\t\t\treturn l.kind === kind && l.name === name;\n\t\t} );\n\t\tif ( ! loader ) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconfigs = await loader.loadEntities();\n\t\tif ( window.__experimentalEnableSync ) {\n\t\t\tif ( globalThis.IS_GUTENBERG_PLUGIN ) {\n\t\t\t\tregisterSyncConfigs( configs );\n\t\t\t}\n\t\t}\n\n\t\tdispatch( addEntities( configs ) );\n\n\t\treturn configs;\n\t};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,UAAU,QAAQ,aAAa;;AAErD;AACA;AACA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S,GAAG,CAAC,CAAEH,MAAM,CAACI,eAAe,CAAEtG,IAAI,EAAEC,IAAK,CAAC;EAEzD,IAAK6F,OAAO,EAAES,MAAM,GAAG,CAAC,IAAIF,SAAS,EAAG;IACvC,IAAKG,MAAM,CAACC,wBAAwB,EAAG;MACtC,IAAKC,UAAU,CAACC,mBAAmB,EAAG;QACrCd,mBAAmB,CAAEC,OAAQ,CAAC;MAC/B;IACD;IAEA,OAAOA,OAAO;EACf;EAEA,MAAMc,MAAM,GAAGrE,6BAA6B,CAACsE,IAAI,CAAIC,CAAC,IAAM;IAC3D,IAAK,CAAE7G,IAAI,IAAI,CAAE6G,CAAC,CAAC7G,IAAI,EAAG;MACzB,OAAO6G,CAAC,CAAC9G,IAAI,KAAKA,IAAI;IACvB;IAEA,OAAO8G,CAAC,CAAC9G,IAAI,KAAKA,IAAI,IAAI8G,CAAC,CAAC7G,IAAI,KAAKA,IAAI;EAC1C,CAAE,CAAC;EACH,IAAK,CAAE2G,MAAM,EAAG;IACf,OAAO,EAAE;EACV;EAEAd,OAAO,GAAG,MAAMc,MAAM,CAACpE,YAAY,CAAC,CAAC;EACrC,IAAKgE,MAAM,CAACC,wBAAwB,EAAG;IACtC,IAAKC,UAAU,CAACC,mBAAmB,EAAG;MACrCd,mBAAmB,CAAEC,OAAQ,CAAC;IAC/B;EACD;EAEAK,QAAQ,CAAEzG,WAAW,CAAEoG,OAAQ,CAAE,CAAC;EAElC,OAAOA,OAAO;AACf,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["capitalCase","pascalCase","apiFetch","__","RichTextData","addEntities","getSyncProvider","DEFAULT_ENTITY_KEY","POST_RAW_ATTRIBUTES","rootEntitiesConfig","label","kind","name","baseURL","baseURLParams","_fields","join","plural","syncConfig","fetch","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","valueOf","makeBlocksSerializable","map","block","innerBlocks","rest","postTypes","postType","_postType$rest_namesp","isTemplate","includes","namespace","rest_namespace","rest_base","selection","mergedEdits","meta","_record$slug","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","suffix","registerSyncConfigs","configs","register","editSyncConfig","getOrLoadEntitiesConfig","select","dispatch","getEntitiesConfig","hasConfig","getEntityConfig","length","window","__experimentalEnableSync","globalThis","IS_GUTENBERG_PLUGIN","loader","find","l"],"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\n/**\n * Internal dependencies\n */\nimport { addEntities } from './actions';\nimport { getSyncProvider } from './sync';\n\nexport const DEFAULT_ENTITY_KEY = 'id';\n\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\nfunction registerSyncConfigs( configs ) {\n\tconfigs.forEach( ( { syncObjectType, syncConfig } ) => {\n\t\tgetSyncProvider().register( syncObjectType, syncConfig );\n\t\tconst editSyncConfig = { ...syncConfig };\n\t\tdelete editSyncConfig.fetch;\n\t\tgetSyncProvider().register( syncObjectType + '--edit', editSyncConfig );\n\t} );\n}\n\n/**\n * Loads the entities into the store.\n *\n * Note: The `name` argument is used for `root` entities requiring additional server data.\n *\n * @param {string} kind Kind\n * @param {string} name Name\n * @return {(thunkArgs: object) => Promise<Array>} Entities\n */\nexport const getOrLoadEntitiesConfig =\n\t( kind, name ) =>\n\tasync ( { select, dispatch } ) => {\n\t\tlet configs = select.getEntitiesConfig( kind );\n\t\tconst hasConfig = !! select.getEntityConfig( kind, name );\n\n\t\tif ( configs?.length > 0 && hasConfig ) {\n\t\t\tif ( window.__experimentalEnableSync ) {\n\t\t\t\tif ( globalThis.IS_GUTENBERG_PLUGIN ) {\n\t\t\t\t\tregisterSyncConfigs( configs );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn configs;\n\t\t}\n\n\t\tconst loader = additionalEntityConfigLoaders.find( ( l ) => {\n\t\t\tif ( ! name || ! l.name ) {\n\t\t\t\treturn l.kind === kind;\n\t\t\t}\n\n\t\t\treturn l.kind === kind && l.name === name;\n\t\t} );\n\t\tif ( ! loader ) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconfigs = await loader.loadEntities();\n\t\tif ( window.__experimentalEnableSync ) {\n\t\t\tif ( globalThis.IS_GUTENBERG_PLUGIN ) {\n\t\t\t\tregisterSyncConfigs( configs );\n\t\t\t}\n\t\t}\n\n\t\tdispatch( addEntities( configs ) );\n\n\t\treturn configs;\n\t};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,UAAU,QAAQ,aAAa;;AAErD;AACA;AACA;AACA,OAAOC,QAAQ,MAAM,sBAAsB;AAC3C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,YAAY,QAAQ,sBAAsB;;AAEnD;AACA;AACA;AACA,SAASC,WAAW,QAAQ,WAAW;AACvC,SAASC,eAAe,QAAQ,QAAQ;AAExC,OAAO,MAAMC,kBAAkB,GAAG,IAAI;AAEtC,MAAMC,mBAAmB,GAAG,CAAE,OAAO,EAAE,SAAS,EAAE,SAAS,CAAE;AAE7D,OAAO,MAAMC,kBAAkB,GA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AACsE,IAAI,CAAIC,CAAC,IAAM;IAC3D,IAAK,CAAE7G,IAAI,IAAI,CAAE6G,CAAC,CAAC7G,IAAI,EAAG;MACzB,OAAO6G,CAAC,CAAC9G,IAAI,KAAKA,IAAI;IACvB;IAEA,OAAO8G,CAAC,CAAC9G,IAAI,KAAKA,IAAI,IAAI8G,CAAC,CAAC7G,IAAI,KAAKA,IAAI;EAC1C,CAAE,CAAC;EACH,IAAK,CAAE2G,MAAM,EAAG;IACf,OAAO,EAAE;EACV;EAEAd,OAAO,GAAG,MAAMc,MAAM,CAACpE,YAAY,CAAC,CAAC;EACrC,IAAKgE,MAAM,CAACC,wBAAwB,EAAG;IACtC,IAAKC,UAAU,CAACC,mBAAmB,EAAG;MACrCd,mBAAmB,CAAEC,OAAQ,CAAC;IAC/B;EACD;EAEAK,QAAQ,CAAEzG,WAAW,CAAEoG,OAAQ,CAAE,CAAC;EAElC,OAAOA,OAAO;AACf,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["apiFetch","addQueryArgs","prependHTTP","isURL","getProtocol","isValidProtocol","CACHE","Map","fetchUrlData","url","options","endpoint","args","Promise","reject","protocol","startsWith","test","has","get","path","then","res","set"],"sources":["@wordpress/core-data/src/fetch/__experimental-fetch-url-data.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\nimport {\n\taddQueryArgs,\n\tprependHTTP,\n\tisURL,\n\tgetProtocol,\n\tisValidProtocol,\n} from '@wordpress/url';\n\n/**\n * A simple in-memory cache for requests.\n * This avoids repeat HTTP requests which may be beneficial\n * for those wishing to preserve low-bandwidth.\n */\nconst CACHE = new Map();\n\n/**\n * @typedef WPRemoteUrlData\n *\n * @property {string} title contents of the remote URL's `<title>` tag.\n */\n\n/**\n * Fetches data about a remote URL.\n * eg: <title> tag, favicon...etc.\n *\n * @async\n * @param {string} url the URL to request details from.\n * @param {Object?} options any options to pass to the underlying fetch.\n * @example\n * ```js\n * import { __experimentalFetchUrlData as fetchUrlData } from '@wordpress/core-data';\n *\n * //...\n *\n * export function initialize( id, settings ) {\n *\n * settings.__experimentalFetchUrlData = (\n * url\n * ) => fetchUrlData( url );\n * ```\n * @return {Promise< WPRemoteUrlData[] >} Remote URL data.\n */\nconst fetchUrlData = async ( url, options = {} ) => {\n\tconst endpoint = '/wp-block-editor/v1/url-details';\n\n\tconst args = {\n\t\turl: prependHTTP( url ),\n\t};\n\n\tif ( ! isURL( url ) ) {\n\t\treturn Promise.reject( `${ url } is not a valid URL.` );\n\t}\n\n\t// Test for \"http\" based URL as it is possible for valid\n\t// yet unusable URLs such as `tel:123456` to be passed.\n\tconst protocol = getProtocol( url );\n\n\tif (\n\t\t! protocol ||\n\t\t! isValidProtocol( protocol ) ||\n\t\t! protocol.startsWith( 'http' ) ||\n\t\t! /^https?:\\/\\/[^\\/\\s]/i.test( url )\n\t) {\n\t\treturn Promise.reject(\n\t\t\t`${ url } does not have a valid protocol. URLs must be \"http\" based`\n\t\t);\n\t}\n\n\tif ( CACHE.has( url ) ) {\n\t\treturn CACHE.get( url );\n\t}\n\n\treturn apiFetch( {\n\t\tpath: addQueryArgs( endpoint, args ),\n\t\t...options,\n\t} ).then( ( res ) => {\n\t\tCACHE.set( url, res );\n\t\treturn res;\n\t} );\n};\n\nexport default fetchUrlData;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,QAAQ,MAAM,sBAAsB;AAC3C,SACCC,YAAY,EACZC,WAAW,EACXC,KAAK,EACLC,WAAW,EACXC,eAAe,QACT,gBAAgB;;AAEvB;AACA;AACA;AACA;AACA;AACA,MAAMC,KAAK,GAAG,IAAIC,GAAG,CAAC,CAAC;;AAEvB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,YAAY,GAAG,MAAAA,CAAQC,GAAG,EAAEC,OAAO,GAAG,CAAC,CAAC,KAAM;EACnD,MAAMC,QAAQ,GAAG,iCAAiC;EAElD,MAAMC,IAAI,GAAG;IACZH,GAAG,EAAEP,WAAW,CAAEO,GAAI;EACvB,CAAC;EAED,IAAK,CAAEN,KAAK,CAAEM,GAAI,CAAC,EAAG;IACrB,OAAOI,OAAO,CAACC,MAAM,CAAG,GAAGL,GAAK,sBAAsB,CAAC;EACxD;;EAEA;EACA;EACA,MAAMM,QAAQ,GAAGX,WAAW,CAAEK,GAAI,CAAC;EAEnC,IACC,CAAEM,QAAQ,IACV,CAAEV,eAAe,CAAEU,QAAS,CAAC,IAC7B,CAAEA,QAAQ,CAACC,UAAU,CAAE,MAAO,CAAC,IAC/B,CAAE,sBAAsB,CAACC,IAAI,CAAER,GAAI,CAAC,EACnC;IACD,OAAOI,OAAO,CAACC,MAAM,CACnB,GAAGL,GAAK,4DACV,CAAC;EACF;EAEA,IAAKH,KAAK,CAACY,GAAG,CAAET,GAAI,CAAC,EAAG;IACvB,OAAOH,KAAK,CAACa,GAAG,CAAEV,GAAI,CAAC;EACxB;EAEA,OAAOT,QAAQ,CAAE;IAChBoB,IAAI,EAAEnB,YAAY,CAAEU,QAAQ,EAAEC,IAAK,CAAC;IACpC,GAAGF;EACJ,CAAE,CAAC,CAACW,IAAI,CAAIC,GAAG,IAAM;IACpBhB,KAAK,CAACiB,GAAG,CAAEd,GAAG,EAAEa,GAAI,CAAC;IACrB,OAAOA,GAAG;EACX,CAAE,CAAC;AACJ,CAAC;AAED,eAAed,YAAY","ignoreList":[]}
1
+ {"version":3,"names":["apiFetch","addQueryArgs","prependHTTP","isURL","getProtocol","isValidProtocol","CACHE","Map","fetchUrlData","url","options","endpoint","args","Promise","reject","protocol","startsWith","test","has","get","path","then","res","set"],"sources":["@wordpress/core-data/src/fetch/__experimental-fetch-url-data.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\nimport {\n\taddQueryArgs,\n\tprependHTTP,\n\tisURL,\n\tgetProtocol,\n\tisValidProtocol,\n} from '@wordpress/url';\n\n/**\n * A simple in-memory cache for requests.\n * This avoids repeat HTTP requests which may be beneficial\n * for those wishing to preserve low-bandwidth.\n */\nconst CACHE = new Map();\n\n/**\n * @typedef WPRemoteUrlData\n *\n * @property {string} title contents of the remote URL's `<title>` tag.\n */\n\n/**\n * Fetches data about a remote URL.\n * eg: <title> tag, favicon...etc.\n *\n * @async\n * @param {string} url the URL to request details from.\n * @param {Object?} options any options to pass to the underlying fetch.\n * @example\n * ```js\n * import { __experimentalFetchUrlData as fetchUrlData } from '@wordpress/core-data';\n *\n * //...\n *\n * export function initialize( id, settings ) {\n *\n * settings.__experimentalFetchUrlData = (\n * url\n * ) => fetchUrlData( url );\n * ```\n * @return {Promise< WPRemoteUrlData[] >} Remote URL data.\n */\nconst fetchUrlData = async ( url, options = {} ) => {\n\tconst endpoint = '/wp-block-editor/v1/url-details';\n\n\tconst args = {\n\t\turl: prependHTTP( url ),\n\t};\n\n\tif ( ! isURL( url ) ) {\n\t\treturn Promise.reject( `${ url } is not a valid URL.` );\n\t}\n\n\t// Test for \"http\" based URL as it is possible for valid\n\t// yet unusable URLs such as `tel:123456` to be passed.\n\tconst protocol = getProtocol( url );\n\n\tif (\n\t\t! protocol ||\n\t\t! isValidProtocol( protocol ) ||\n\t\t! protocol.startsWith( 'http' ) ||\n\t\t! /^https?:\\/\\/[^\\/\\s]/i.test( url )\n\t) {\n\t\treturn Promise.reject(\n\t\t\t`${ url } does not have a valid protocol. URLs must be \"http\" based`\n\t\t);\n\t}\n\n\tif ( CACHE.has( url ) ) {\n\t\treturn CACHE.get( url );\n\t}\n\n\treturn apiFetch( {\n\t\tpath: addQueryArgs( endpoint, args ),\n\t\t...options,\n\t} ).then( ( res ) => {\n\t\tCACHE.set( url, res );\n\t\treturn res;\n\t} );\n};\n\nexport default fetchUrlData;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,QAAQ,MAAM,sBAAsB;AAC3C,SACCC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AG;EACX,CAAE,CAAC;AACJ,CAAC;AAED,eAAed,YAAY","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["useDispatch","useSelect","deprecated","useMemo","useQuerySelect","store","coreStore","EMPTY_OBJECT","useEntityRecord","kind","name","recordId","options","enabled","editEntityRecord","saveEditedEntityRecord","mutations","edit","record","editOptions","save","saveOptions","throwOnError","editedRecord","hasEdits","edits","select","getEditedEntityRecord","hasEditsForEntityRecord","getEntityRecordNonTransientEdits","data","querySelectRest","query","getEntityRecord","__experimentalUseEntityRecord","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":"AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,OAAOC,UAAU,MAAM,uBAAuB;AAC9C,SAASC,OAAO,QAAQ,oBAAoB;;AAE5C;AACA;AACA;AACA,OAAOC,cAAc,MAAM,oBAAoB;AAC/C,SAASC,KAAK,IAAIC,SAAS,QAAQ,KAAK;AA+CxC,MAAMC,YAAY,GAAG,CAAC,CAAC;;AAEvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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AAgC,CAC1DpB,IAAI,EACJC,IAAI,EACJC,QACD;IACD,CAAC;EACF,CAAC,EACD,CAAEF,IAAI,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,CAACC,OAAO,CACxC,CAAC;EAED,MAAM;IAAEiB,IAAI,EAAEZ,MAAM;IAAE,GAAGa;EAAgB,CAAC,GAAG3B,cAAc,CACxD4B,KAAK,IAAM;IACZ,IAAK,CAAEpB,OAAO,CAACC,OAAO,EAAG;MACxB,OAAO;QACNiB,IAAI,EAAE;MACP,CAAC;IACF;IACA,OAAOE,KAAK,CAAE1B,SAAU,CAAC,CAAC2B,eAAe,CAAExB,IAAI,EAAEC,IAAI,EAAEC,QAAS,CAAC;EAClE,CAAC,EACD,CAAEF,IAAI,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,CAACC,OAAO,CACxC,CAAC;EAED,OAAO;IACNK,MAAM;IACNK,YAAY;IACZC,QAAQ;IACRC,KAAK;IACL,GAAGM,eAAe;IAClB,GAAGf;EACJ,CAAC;AACF;AAEA,OAAO,SAASkB,6BAA6BA,CAC5CzB,IAAY,EACZC,IAAY,EACZC,QAAa,EACbC,OAAY,EACX;EACDV,UAAU,CAAG,uCAAsC,EAAE;IACpDiC,WAAW,EAAE,yBAAyB;IACtCC,KAAK,EAAE;EACR,CAAE,CAAC;EACH,OAAO5B,eAAe,CAAEC,IAAI,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,OAAQ,CAAC;AACxD","ignoreList":[]}
1
+ {"version":3,"names":["useDispatch","useSelect","deprecated","useMemo","useQuerySelect","store","coreStore","EMPTY_OBJECT","useEntityRecord","kind","name","recordId","options","enabled","editEntityRecord","saveEditedEntityRecord","mutations","edit","record","editOptions","save","saveOptions","throwOnError","editedRecord","hasEdits","edits","select","getEditedEntityRecord","hasEditsForEntityRecord","getEntityRecordNonTransientEdits","data","querySelectRest","query","getEntityRecord","__experimentalUseEntityRecord","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":"AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,OAAOC,UAAU,MAAM,uBAAuB;AAC9C,SAASC,OAAO,QAAQ,oBAAoB;;AAE5C;AACA;AACA;AACA,OAAOC,cAAc,MAAM,oBAAoB;AAC/C,SAASC,KAAK,IAAIC,SAAS,QAAQ,KAAK;AA+CxC,MAAMC,YAAY,GAAG,CAAC,CAAC;;AAEvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,eAAeA,CACtCC,IAAY,EACZC,IAAY,EACZC,QAAyB,EACzBC,OAAgB,GAAG;EAAEC,OAAO,EAAE;AAAK,CAAC,EACG;EACvC,MAAM;IAAEC,gBAAgB;IAAEC;EAAuB,CAAC,GACjDf,WAAW,CAAEM,SAAU,CAAC;EAEzB,MAAMU,SAAS,GAAGb,OAAO,CACxB,OAAQ;IACPc,IAAI,EAAEA,CAAEC,MAAM,EAAEC,WAAgB,GAAG,CAAC,CAAC,KACpCL,gBAAgB,CAAEL,IAAI,EAA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AAC2B,eAAe,CAAExB,IAAI,EAAEC,IAAI,EAAEC,QAAS,CAAC;EAClE,CAAC,EACD,CAAEF,IAAI,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,CAACC,OAAO,CACxC,CAAC;EAED,OAAO;IACNK,MAAM;IACNK,YAAY;IACZC,QAAQ;IACRC,KAAK;IACL,GAAGM,eAAe;IAClB,GAAGf;EACJ,CAAC;AACF;AAEA,OAAO,SAASkB,6BAA6BA,CAC5CzB,IAAY,EACZC,IAAY,EACZC,QAAa,EACbC,OAAY,EACX;EACDV,UAAU,CAAE,uCAAuC,EAAE;IACpDiC,WAAW,EAAE,yBAAyB;IACtCC,KAAK,EAAE;EACR,CAAE,CAAC;EACH,OAAO5B,eAAe,CAAEC,IAAI,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,OAAQ,CAAC;AACxD","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["addQueryArgs","deprecated","useSelect","useMemo","useQuerySelect","store","coreStore","unlock","EMPTY_ARRAY","useEntityRecords","kind","name","queryArgs","options","enabled","queryAsString","data","records","rest","query","getEntityRecords","totalItems","totalPages","select","getEntityRecordsTotalItems","getEntityRecordsTotalPages","__experimentalUseEntityRecords","alternative","since","useEntityRecordsWithPermissions","entityConfig","getEntityConfig","ret","ids","_data$map","map","record","_entityConfig$key","key","permissions","getEntityRecordsPermissions","dataWithPermissions","_data$map2","index"],"sources":["@wordpress/core-data/src/hooks/use-entity-records.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addQueryArgs } from '@wordpress/url';\nimport deprecated from '@wordpress/deprecated';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport useQuerySelect from './use-query-select';\nimport { store as coreStore } from '../';\nimport type { Options } from './use-entity-record';\nimport type { Status } from './constants';\nimport { unlock } from '../lock-unlock';\n\ninterface EntityRecordsResolution< RecordType > {\n\t/** The requested entity record */\n\trecords: RecordType[] | null;\n\n\t/**\n\t * Is the record still being resolved?\n\t */\n\tisResolving: 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\t/**\n\t * The total number of available items (if not paginated).\n\t */\n\ttotalItems: number | null;\n\n\t/**\n\t * The total number of pages.\n\t */\n\ttotalPages: number | null;\n}\n\nconst EMPTY_ARRAY = [];\n\n/**\n * Resolves the specified entity records.\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 queryArgs Optional HTTP query description for how to fetch the data, passed to the requested API endpoint.\n * @param options Optional hook options.\n * @example\n * ```js\n * import { useEntityRecords } from '@wordpress/core-data';\n *\n * function PageTitlesList() {\n * const { records, isResolving } = useEntityRecords( 'postType', 'page' );\n *\n * if ( isResolving ) {\n * return 'Loading...';\n * }\n *\n * return (\n * <ul>\n * {records.map(( page ) => (\n * <li>{ page.title }</li>\n * ))}\n * </ul>\n * );\n * }\n *\n * // Rendered in the application:\n * // <PageTitlesList />\n * ```\n *\n * In the above example, when `PageTitlesList` is rendered into an\n * application, the list of records and the resolution details will be retrieved from\n * the store state using `getEntityRecords()`, or resolved if missing.\n *\n * @return Entity records data.\n * @template RecordType\n */\nexport default function useEntityRecords< RecordType >(\n\tkind: string,\n\tname: string,\n\tqueryArgs: Record< string, unknown > = {},\n\toptions: Options = { enabled: true }\n): EntityRecordsResolution< RecordType > {\n\t// Serialize queryArgs to a string that can be safely used as a React dep.\n\t// We can't just pass queryArgs as one of the deps, because if it is passed\n\t// as an object literal, then it will be a different object on each call even\n\t// if the values remain the same.\n\tconst queryAsString = addQueryArgs( '', queryArgs );\n\n\tconst { data: records, ...rest } = useQuerySelect(\n\t\t( query ) => {\n\t\t\tif ( ! options.enabled ) {\n\t\t\t\treturn {\n\t\t\t\t\t// Avoiding returning a new reference on every execution.\n\t\t\t\t\tdata: EMPTY_ARRAY,\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn query( coreStore ).getEntityRecords( kind, name, queryArgs );\n\t\t},\n\t\t[ kind, name, queryAsString, options.enabled ]\n\t);\n\n\tconst { totalItems, totalPages } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! options.enabled ) {\n\t\t\t\treturn {\n\t\t\t\t\ttotalItems: null,\n\t\t\t\t\ttotalPages: null,\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn {\n\t\t\t\ttotalItems: select( coreStore ).getEntityRecordsTotalItems(\n\t\t\t\t\tkind,\n\t\t\t\t\tname,\n\t\t\t\t\tqueryArgs\n\t\t\t\t),\n\t\t\t\ttotalPages: select( coreStore ).getEntityRecordsTotalPages(\n\t\t\t\t\tkind,\n\t\t\t\t\tname,\n\t\t\t\t\tqueryArgs\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ kind, name, queryAsString, options.enabled ]\n\t);\n\n\treturn {\n\t\trecords,\n\t\ttotalItems,\n\t\ttotalPages,\n\t\t...rest,\n\t};\n}\n\nexport function __experimentalUseEntityRecords(\n\tkind: string,\n\tname: string,\n\tqueryArgs: any,\n\toptions: any\n) {\n\tdeprecated( `wp.data.__experimentalUseEntityRecords`, {\n\t\talternative: 'wp.data.useEntityRecords',\n\t\tsince: '6.1',\n\t} );\n\treturn useEntityRecords( kind, name, queryArgs, options );\n}\n\nexport function useEntityRecordsWithPermissions< RecordType >(\n\tkind: string,\n\tname: string,\n\tqueryArgs: Record< string, unknown > = {},\n\toptions: Options = { enabled: true }\n): EntityRecordsResolution< RecordType > {\n\tconst entityConfig = useSelect(\n\t\t( select ) => select( coreStore ).getEntityConfig( kind, name ),\n\t\t[ kind, name ]\n\t);\n\tconst { records: data, ...ret } = useEntityRecords(\n\t\tkind,\n\t\tname,\n\t\tqueryArgs,\n\t\toptions\n\t);\n\tconst ids = useMemo(\n\t\t() =>\n\t\t\tdata?.map(\n\t\t\t\t// @ts-ignore\n\t\t\t\t( record: RecordType ) => record[ entityConfig?.key ?? 'id' ]\n\t\t\t) ?? [],\n\t\t[ data, entityConfig?.key ]\n\t);\n\n\tconst permissions = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecordsPermissions } = unlock(\n\t\t\t\tselect( coreStore )\n\t\t\t);\n\t\t\treturn getEntityRecordsPermissions( kind, name, ids );\n\t\t},\n\t\t[ ids, kind, name ]\n\t);\n\n\tconst dataWithPermissions = useMemo(\n\t\t() =>\n\t\t\tdata?.map( ( record, index ) => ( {\n\t\t\t\t// @ts-ignore\n\t\t\t\t...record,\n\t\t\t\tpermissions: permissions[ index ],\n\t\t\t} ) ) ?? [],\n\t\t[ data, permissions ]\n\t);\n\n\treturn { records: dataWithPermissions, ...ret };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,YAAY,QAAQ,gBAAgB;AAC7C,OAAOC,UAAU,MAAM,uBAAuB;AAC9C,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,OAAO,QAAQ,oBAAoB;;AAE5C;AACA;AACA;AACA,OAAOC,cAAc,MAAM,oBAAoB;AAC/C,SAASC,KAAK,IAAIC,SAAS,QAAQ,KAAK;AAGxC,SAASC,MAAM,QAAQ,gBAAgB;AA8BvC,MAAMC,WAAW,GAAG,EAAE;;AAEtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,gBAAgBA,CACvCC,IAAY,EACZC,IAAY,EACZC,SAAoC,GAAG,CAAC,CAAC,EACzCC,OAAgB,GAAG;EAAEC,OAAO,EAAE;AAAK,CAAC,EACI;EACxC;EACA;EACA;EACA;EACA,MAAMC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A;IAAA,QAAAA,UAAA,GACC1B,IAAI,EAAEmB,GAAG,CAAE,CAAEC,MAAM,EAAEO,KAAK,MAAQ;MACjC;MACA,GAAGP,MAAM;MACTG,WAAW,EAAEA,WAAW,CAAEI,KAAK;IAChC,CAAC,CAAG,CAAC,cAAAD,UAAA,cAAAA,UAAA,GAAI,EAAE;EAAA,GACZ,CAAE1B,IAAI,EAAEuB,WAAW,CACpB,CAAC;EAED,OAAO;IAAEtB,OAAO,EAAEwB,mBAAmB;IAAE,GAAGT;EAAI,CAAC;AAChD","ignoreList":[]}
1
+ {"version":3,"names":["addQueryArgs","deprecated","useSelect","useMemo","useQuerySelect","store","coreStore","unlock","EMPTY_ARRAY","useEntityRecords","kind","name","queryArgs","options","enabled","queryAsString","data","records","rest","query","getEntityRecords","totalItems","totalPages","select","getEntityRecordsTotalItems","getEntityRecordsTotalPages","__experimentalUseEntityRecords","alternative","since","useEntityRecordsWithPermissions","entityConfig","getEntityConfig","ret","ids","_data$map","map","record","_entityConfig$key","key","permissions","getEntityRecordsPermissions","dataWithPermissions","_data$map2","index"],"sources":["@wordpress/core-data/src/hooks/use-entity-records.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addQueryArgs } from '@wordpress/url';\nimport deprecated from '@wordpress/deprecated';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport useQuerySelect from './use-query-select';\nimport { store as coreStore } from '../';\nimport type { Options } from './use-entity-record';\nimport type { Status } from './constants';\nimport { unlock } from '../lock-unlock';\n\ninterface EntityRecordsResolution< RecordType > {\n\t/** The requested entity record */\n\trecords: RecordType[] | null;\n\n\t/**\n\t * Is the record still being resolved?\n\t */\n\tisResolving: 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\t/**\n\t * The total number of available items (if not paginated).\n\t */\n\ttotalItems: number | null;\n\n\t/**\n\t * The total number of pages.\n\t */\n\ttotalPages: number | null;\n}\n\nconst EMPTY_ARRAY = [];\n\n/**\n * Resolves the specified entity records.\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 queryArgs Optional HTTP query description for how to fetch the data, passed to the requested API endpoint.\n * @param options Optional hook options.\n * @example\n * ```js\n * import { useEntityRecords } from '@wordpress/core-data';\n *\n * function PageTitlesList() {\n * const { records, isResolving } = useEntityRecords( 'postType', 'page' );\n *\n * if ( isResolving ) {\n * return 'Loading...';\n * }\n *\n * return (\n * <ul>\n * {records.map(( page ) => (\n * <li>{ page.title }</li>\n * ))}\n * </ul>\n * );\n * }\n *\n * // Rendered in the application:\n * // <PageTitlesList />\n * ```\n *\n * In the above example, when `PageTitlesList` is rendered into an\n * application, the list of records and the resolution details will be retrieved from\n * the store state using `getEntityRecords()`, or resolved if missing.\n *\n * @return Entity records data.\n * @template RecordType\n */\nexport default function useEntityRecords< RecordType >(\n\tkind: string,\n\tname: string,\n\tqueryArgs: Record< string, unknown > = {},\n\toptions: Options = { enabled: true }\n): EntityRecordsResolution< RecordType > {\n\t// Serialize queryArgs to a string that can be safely used as a React dep.\n\t// We can't just pass queryArgs as one of the deps, because if it is passed\n\t// as an object literal, then it will be a different object on each call even\n\t// if the values remain the same.\n\tconst queryAsString = addQueryArgs( '', queryArgs );\n\n\tconst { data: records, ...rest } = useQuerySelect(\n\t\t( query ) => {\n\t\t\tif ( ! options.enabled ) {\n\t\t\t\treturn {\n\t\t\t\t\t// Avoiding returning a new reference on every execution.\n\t\t\t\t\tdata: EMPTY_ARRAY,\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn query( coreStore ).getEntityRecords( kind, name, queryArgs );\n\t\t},\n\t\t[ kind, name, queryAsString, options.enabled ]\n\t);\n\n\tconst { totalItems, totalPages } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! options.enabled ) {\n\t\t\t\treturn {\n\t\t\t\t\ttotalItems: null,\n\t\t\t\t\ttotalPages: null,\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn {\n\t\t\t\ttotalItems: select( coreStore ).getEntityRecordsTotalItems(\n\t\t\t\t\tkind,\n\t\t\t\t\tname,\n\t\t\t\t\tqueryArgs\n\t\t\t\t),\n\t\t\t\ttotalPages: select( coreStore ).getEntityRecordsTotalPages(\n\t\t\t\t\tkind,\n\t\t\t\t\tname,\n\t\t\t\t\tqueryArgs\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ kind, name, queryAsString, options.enabled ]\n\t);\n\n\treturn {\n\t\trecords,\n\t\ttotalItems,\n\t\ttotalPages,\n\t\t...rest,\n\t};\n}\n\nexport function __experimentalUseEntityRecords(\n\tkind: string,\n\tname: string,\n\tqueryArgs: any,\n\toptions: any\n) {\n\tdeprecated( `wp.data.__experimentalUseEntityRecords`, {\n\t\talternative: 'wp.data.useEntityRecords',\n\t\tsince: '6.1',\n\t} );\n\treturn useEntityRecords( kind, name, queryArgs, options );\n}\n\nexport function useEntityRecordsWithPermissions< RecordType >(\n\tkind: string,\n\tname: string,\n\tqueryArgs: Record< string, unknown > = {},\n\toptions: Options = { enabled: true }\n): EntityRecordsResolution< RecordType > {\n\tconst entityConfig = useSelect(\n\t\t( select ) => select( coreStore ).getEntityConfig( kind, name ),\n\t\t[ kind, name ]\n\t);\n\tconst { records: data, ...ret } = useEntityRecords(\n\t\tkind,\n\t\tname,\n\t\tqueryArgs,\n\t\toptions\n\t);\n\tconst ids = useMemo(\n\t\t() =>\n\t\t\tdata?.map(\n\t\t\t\t// @ts-ignore\n\t\t\t\t( record: RecordType ) => record[ entityConfig?.key ?? 'id' ]\n\t\t\t) ?? [],\n\t\t[ data, entityConfig?.key ]\n\t);\n\n\tconst permissions = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecordsPermissions } = unlock(\n\t\t\t\tselect( coreStore )\n\t\t\t);\n\t\t\treturn getEntityRecordsPermissions( kind, name, ids );\n\t\t},\n\t\t[ ids, kind, name ]\n\t);\n\n\tconst dataWithPermissions = useMemo(\n\t\t() =>\n\t\t\tdata?.map( ( record, index ) => ( {\n\t\t\t\t// @ts-ignore\n\t\t\t\t...record,\n\t\t\t\tpermissions: permissions[ index ],\n\t\t\t} ) ) ?? [],\n\t\t[ data, permissions ]\n\t);\n\n\treturn { records: dataWithPermissions, ...ret };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,YAAY,QAAQ,gBAAgB;AAC7C,OAAOC,UAAU,MAAM,uBAAuB;AAC9C,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,OAAO,QAAQ,oBAAoB;;AAE5C;AACA;AACA;AACA,OAAOC,cAAc,MAAM,oBAAoB;AAC/C,SAASC,KAAK,IAAIC,SAAS,QAAQ,KAAK;AAGxC,SAASC,MAAM,QAAQ,gBAAgB;AA8BvC,MAAMC,WAAW,GAAG,EAAE;;AAEtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,gBAAgBA,CACvCC,IAAY,EACZC,IAAY,EACZC,SAAoC,GAAG,CAAC,CAAC,EACzCC,OAAgB,GAAG;EAAEC,OAAO,EAAE;AAAK,CAAC,EACI;EACxC;EACA;EACA;EACA;EACA,MAAMC,aAAa,GAAGf,YAAY,CAAE,EAAE,EAAEY,SAAU,CAAC;EAEnD,MAAM;IAAEI,IAAI,EAAEC,OAAO;IAAE,GAAGC;EAAK,CAAC,GAAGd,cAAc,CAC9Ce,KAAK,IAAM;IACZ,IAAK,CAAEN,OAAO,CAACC,OAAO,EAAG;MACxB,OAA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AI,EAAE;EAAA,GACZ,CAAE1B,IAAI,EAAEuB,WAAW,CACpB,CAAC;EAED,OAAO;IAAEtB,OAAO,EAAEwB,mBAAmB;IAAE,GAAGT;EAAI,CAAC;AAChD","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["deprecated","warning","store","coreStore","Status","useQuerySelect","useResourcePermissions","resource","id","isEntity","resourceAsString","JSON","stringify","globalThis","SCRIPT_DEBUG","resolve","hasId","canUser","create","kind","name","read","isResolving","hasResolved","status","Idle","Resolving","Success","canCreate","data","canRead","update","_delete","canUpdate","canDelete","__experimentalUseResourcePermissions","alternative","since"],"sources":["@wordpress/core-data/src/hooks/use-resource-permissions.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\nimport warning from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport { store as coreStore } from '../';\nimport { Status } from './constants';\nimport useQuerySelect from './use-query-select';\n\ninterface GlobalResourcePermissionsResolution {\n\t/** Can the current user create new resources of this type? */\n\tcanCreate: boolean;\n}\ninterface SpecificResourcePermissionsResolution {\n\t/** Can the current user update resources of this type? */\n\tcanUpdate: boolean;\n\t/** Can the current user delete resources of this type? */\n\tcanDelete: boolean;\n}\ninterface ResolutionDetails {\n\t/** Resolution status */\n\tstatus: Status;\n\t/**\n\t * Is the data still being resolved?\n\t */\n\tisResolving: boolean;\n}\n\n/**\n * Is the data resolved by now?\n */\ntype HasResolved = boolean;\n\ntype ResourcePermissionsResolution< IdType > = [\n\tHasResolved,\n\tResolutionDetails &\n\t\tGlobalResourcePermissionsResolution &\n\t\t( IdType extends void ? SpecificResourcePermissionsResolution : {} ),\n];\n\ntype EntityResource = { kind: string; name: string; id?: string | number };\n\nfunction useResourcePermissions< IdType = void >(\n\tresource: string,\n\tid?: IdType\n): ResourcePermissionsResolution< IdType >;\n\nfunction useResourcePermissions< IdType = void >(\n\tresource: EntityResource,\n\tid?: never\n): ResourcePermissionsResolution< IdType >;\n\n/**\n * Resolves resource permissions.\n *\n * @since 6.1.0 Introduced in WordPress core.\n *\n * @param resource Entity resource to check. Accepts entity object `{ kind: 'root', name: 'media', id: 1 }`\n * or REST base as a string - `media`.\n * @param id Optional ID of the resource to check, e.g. 10. Note: This argument is discouraged\n * when using an entity object as a resource to check permissions and will be ignored.\n *\n * @example\n * ```js\n * import { useResourcePermissions } from '@wordpress/core-data';\n *\n * function PagesList() {\n * const { canCreate, isResolving } = useResourcePermissions( { kind: 'postType', name: 'page' } );\n *\n * if ( isResolving ) {\n * return 'Loading ...';\n * }\n *\n * return (\n * <div>\n * {canCreate ? (<button>+ Create a new page</button>) : false}\n * // ...\n * </div>\n * );\n * }\n *\n * // Rendered in the application:\n * // <PagesList />\n * ```\n *\n * @example\n * ```js\n * import { useResourcePermissions } from '@wordpress/core-data';\n *\n * function Page({ pageId }) {\n * const {\n * canCreate,\n * canUpdate,\n * canDelete,\n * isResolving\n * } = useResourcePermissions( { kind: 'postType', name: 'page', id: pageId } );\n *\n * if ( isResolving ) {\n * return 'Loading ...';\n * }\n *\n * return (\n * <div>\n * {canCreate ? (<button>+ Create a new page</button>) : false}\n * {canUpdate ? (<button>Edit page</button>) : false}\n * {canDelete ? (<button>Delete page</button>) : false}\n * // ...\n * </div>\n * );\n * }\n *\n * // Rendered in the application:\n * // <Page pageId={ 15 } />\n * ```\n *\n * In the above example, when `PagesList` is rendered into an\n * application, the appropriate permissions and the resolution details will be retrieved from\n * the store state using `canUser()`, or resolved if missing.\n *\n * @return Entity records data.\n * @template IdType\n */\nfunction useResourcePermissions< IdType = void >(\n\tresource: string | EntityResource,\n\tid?: IdType\n): ResourcePermissionsResolution< IdType > {\n\t// Serialize `resource` to a string that can be safely used as a React dep.\n\t// We can't just pass `resource` as one of the deps, because if it is passed\n\t// as an object literal, then it will be a different object on each call even\n\t// if the values remain the same.\n\tconst isEntity = typeof resource === 'object';\n\tconst resourceAsString = isEntity ? JSON.stringify( resource ) : resource;\n\n\tif ( isEntity && typeof id !== 'undefined' ) {\n\t\twarning(\n\t\t\t`When 'resource' is an entity object, passing 'id' as a separate argument isn't supported.`\n\t\t);\n\t}\n\n\treturn useQuerySelect(\n\t\t( resolve ) => {\n\t\t\tconst hasId = isEntity ? !! resource.id : !! id;\n\t\t\tconst { canUser } = resolve( coreStore );\n\t\t\tconst create = canUser(\n\t\t\t\t'create',\n\t\t\t\tisEntity\n\t\t\t\t\t? { kind: resource.kind, name: resource.name }\n\t\t\t\t\t: resource\n\t\t\t);\n\n\t\t\tif ( ! hasId ) {\n\t\t\t\tconst read = canUser( 'read', resource );\n\n\t\t\t\tconst isResolving = create.isResolving || read.isResolving;\n\t\t\t\tconst hasResolved = create.hasResolved && read.hasResolved;\n\t\t\t\tlet status = Status.Idle;\n\t\t\t\tif ( isResolving ) {\n\t\t\t\t\tstatus = Status.Resolving;\n\t\t\t\t} else if ( hasResolved ) {\n\t\t\t\t\tstatus = Status.Success;\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\tstatus,\n\t\t\t\t\tisResolving,\n\t\t\t\t\thasResolved,\n\t\t\t\t\tcanCreate: create.hasResolved && create.data,\n\t\t\t\t\tcanRead: read.hasResolved && read.data,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst read = canUser( 'read', resource, id );\n\t\t\tconst update = canUser( 'update', resource, id );\n\t\t\tconst _delete = canUser( 'delete', resource, id );\n\t\t\tconst isResolving =\n\t\t\t\tread.isResolving ||\n\t\t\t\tcreate.isResolving ||\n\t\t\t\tupdate.isResolving ||\n\t\t\t\t_delete.isResolving;\n\t\t\tconst hasResolved =\n\t\t\t\tread.hasResolved &&\n\t\t\t\tcreate.hasResolved &&\n\t\t\t\tupdate.hasResolved &&\n\t\t\t\t_delete.hasResolved;\n\n\t\t\tlet status = Status.Idle;\n\t\t\tif ( isResolving ) {\n\t\t\t\tstatus = Status.Resolving;\n\t\t\t} else if ( hasResolved ) {\n\t\t\t\tstatus = Status.Success;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tstatus,\n\t\t\t\tisResolving,\n\t\t\t\thasResolved,\n\t\t\t\tcanRead: hasResolved && read.data,\n\t\t\t\tcanCreate: hasResolved && create.data,\n\t\t\t\tcanUpdate: hasResolved && update.data,\n\t\t\t\tcanDelete: hasResolved && _delete.data,\n\t\t\t};\n\t\t},\n\t\t[ resourceAsString, id ]\n\t);\n}\n\nexport default useResourcePermissions;\n\nexport function __experimentalUseResourcePermissions(\n\tresource: string,\n\tid?: unknown\n) {\n\tdeprecated( `wp.data.__experimentalUseResourcePermissions`, {\n\t\talternative: 'wp.data.useResourcePermissions',\n\t\tsince: '6.1',\n\t} );\n\treturn useResourcePermissions( resource, id );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,uBAAuB;AAC9C,OAAOC,OAAO,MAAM,oBAAoB;;AAExC;AACA;AACA;AACA,SAASC,KAAK,IAAIC,SAAS,QAAQ,KAAK;AACxC,SAASC,MAAM,QAAQ,aAAa;AACpC,OAAOC,cAAc,MAAM,oBAAoB;;AAqB/C;AACA;AACA;;AAsBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,sBAAsBA,CAC9BC,QAAiC,EACjCC,EAAW,EAC+B;EAC1C;EACA;EACA;EACA;EACA,MAAMC,QAAQ,GAAG,OAAOF,QAAQ,KAAK,QAAQ;EAC7C,MAAMG,gBAAgB,GAAGD,QAAQ,GAAGE,IAAI,CAACC,SAAS,CAAEL,QAAS,CAAC,GAAGA,QAAQ;E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,QAAQ,EAAEV,QAAQ,EAAEC,EAAG,CAAC;IAChD,MAAMwB,OAAO,GAAGf,OAAO,CAAE,QAAQ,EAAEV,QAAQ,EAAEC,EAAG,CAAC;IACjD,MAAMc,WAAW,GAChBD,IAAI,CAACC,WAAW,IAChBJ,MAAM,CAACI,WAAW,IAClBS,MAAM,CAACT,WAAW,IAClBU,OAAO,CAACV,WAAW;IACpB,MAAMC,WAAW,GAChBF,IAAI,CAACE,WAAW,IAChBL,MAAM,CAACK,WAAW,IAClBQ,MAAM,CAACR,WAAW,IAClBS,OAAO,CAACT,WAAW;IAEpB,IAAIC,MAAM,GAAGpB,MAAM,CAACqB,IAAI;IACxB,IAAKH,WAAW,EAAG;MAClBE,MAAM,GAAGpB,MAAM,CAACsB,SAAS;IAC1B,CAAC,MAAM,IAAKH,WAAW,EAAG;MACzBC,MAAM,GAAGpB,MAAM,CAACuB,OAAO;IACxB;IACA,OAAO;MACNH,MAAM;MACNF,WAAW;MACXC,WAAW;MACXO,OAAO,EAAEP,WAAW,IAAIF,IAAI,CAACQ,IAAI;MACjCD,SAAS,EAAEL,WAAW,IAAIL,MAAM,CAACW,IAAI;MACrCI,SAAS,EAAEV,WAAW,IAAIQ,MAAM,CAACF,IAAI;MACrCK,SAAS,EAAEX,WAAW,IAAIS,OAAO,CAACH;IACnC,CAAC;EACF,CAAC,EACD,CAAEnB,gBAAgB,EAAEF,EAAE,CACvB,CAAC;AACF;AAEA,eAAeF,sBAAsB;AAErC,OAAO,SAAS6B,oCAAoCA,CACnD5B,QAAgB,EAChBC,EAAY,EACX;EACDR,UAAU,CAAG,8CAA6C,EAAE;IAC3DoC,WAAW,EAAE,gCAAgC;IAC7CC,KAAK,EAAE;EACR,CAAE,CAAC;EACH,OAAO/B,sBAAsB,CAAEC,QAAQ,EAAEC,EAAG,CAAC;AAC9C","ignoreList":[]}
1
+ {"version":3,"names":["deprecated","warning","store","coreStore","Status","useQuerySelect","useResourcePermissions","resource","id","isEntity","resourceAsString","JSON","stringify","globalThis","SCRIPT_DEBUG","resolve","hasId","canUser","create","kind","name","read","isResolving","hasResolved","status","Idle","Resolving","Success","canCreate","data","canRead","update","_delete","canUpdate","canDelete","__experimentalUseResourcePermissions","alternative","since"],"sources":["@wordpress/core-data/src/hooks/use-resource-permissions.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\nimport warning from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport { store as coreStore } from '../';\nimport { Status } from './constants';\nimport useQuerySelect from './use-query-select';\n\ninterface GlobalResourcePermissionsResolution {\n\t/** Can the current user create new resources of this type? */\n\tcanCreate: boolean;\n}\ninterface SpecificResourcePermissionsResolution {\n\t/** Can the current user update resources of this type? */\n\tcanUpdate: boolean;\n\t/** Can the current user delete resources of this type? */\n\tcanDelete: boolean;\n}\ninterface ResolutionDetails {\n\t/** Resolution status */\n\tstatus: Status;\n\t/**\n\t * Is the data still being resolved?\n\t */\n\tisResolving: boolean;\n}\n\n/**\n * Is the data resolved by now?\n */\ntype HasResolved = boolean;\n\ntype ResourcePermissionsResolution< IdType > = [\n\tHasResolved,\n\tResolutionDetails &\n\t\tGlobalResourcePermissionsResolution &\n\t\t( IdType extends void ? SpecificResourcePermissionsResolution : {} ),\n];\n\ntype EntityResource = { kind: string; name: string; id?: string | number };\n\nfunction useResourcePermissions< IdType = void >(\n\tresource: string,\n\tid?: IdType\n): ResourcePermissionsResolution< IdType >;\n\nfunction useResourcePermissions< IdType = void >(\n\tresource: EntityResource,\n\tid?: never\n): ResourcePermissionsResolution< IdType >;\n\n/**\n * Resolves resource permissions.\n *\n * @since 6.1.0 Introduced in WordPress core.\n *\n * @param resource Entity resource to check. Accepts entity object `{ kind: 'root', name: 'media', id: 1 }`\n * or REST base as a string - `media`.\n * @param id Optional ID of the resource to check, e.g. 10. Note: This argument is discouraged\n * when using an entity object as a resource to check permissions and will be ignored.\n *\n * @example\n * ```js\n * import { useResourcePermissions } from '@wordpress/core-data';\n *\n * function PagesList() {\n * const { canCreate, isResolving } = useResourcePermissions( { kind: 'postType', name: 'page' } );\n *\n * if ( isResolving ) {\n * return 'Loading ...';\n * }\n *\n * return (\n * <div>\n * {canCreate ? (<button>+ Create a new page</button>) : false}\n * // ...\n * </div>\n * );\n * }\n *\n * // Rendered in the application:\n * // <PagesList />\n * ```\n *\n * @example\n * ```js\n * import { useResourcePermissions } from '@wordpress/core-data';\n *\n * function Page({ pageId }) {\n * const {\n * canCreate,\n * canUpdate,\n * canDelete,\n * isResolving\n * } = useResourcePermissions( { kind: 'postType', name: 'page', id: pageId } );\n *\n * if ( isResolving ) {\n * return 'Loading ...';\n * }\n *\n * return (\n * <div>\n * {canCreate ? (<button>+ Create a new page</button>) : false}\n * {canUpdate ? (<button>Edit page</button>) : false}\n * {canDelete ? (<button>Delete page</button>) : false}\n * // ...\n * </div>\n * );\n * }\n *\n * // Rendered in the application:\n * // <Page pageId={ 15 } />\n * ```\n *\n * In the above example, when `PagesList` is rendered into an\n * application, the appropriate permissions and the resolution details will be retrieved from\n * the store state using `canUser()`, or resolved if missing.\n *\n * @return Entity records data.\n * @template IdType\n */\nfunction useResourcePermissions< IdType = void >(\n\tresource: string | EntityResource,\n\tid?: IdType\n): ResourcePermissionsResolution< IdType > {\n\t// Serialize `resource` to a string that can be safely used as a React dep.\n\t// We can't just pass `resource` as one of the deps, because if it is passed\n\t// as an object literal, then it will be a different object on each call even\n\t// if the values remain the same.\n\tconst isEntity = typeof resource === 'object';\n\tconst resourceAsString = isEntity ? JSON.stringify( resource ) : resource;\n\n\tif ( isEntity && typeof id !== 'undefined' ) {\n\t\twarning(\n\t\t\t`When 'resource' is an entity object, passing 'id' as a separate argument isn't supported.`\n\t\t);\n\t}\n\n\treturn useQuerySelect(\n\t\t( resolve ) => {\n\t\t\tconst hasId = isEntity ? !! resource.id : !! id;\n\t\t\tconst { canUser } = resolve( coreStore );\n\t\t\tconst create = canUser(\n\t\t\t\t'create',\n\t\t\t\tisEntity\n\t\t\t\t\t? { kind: resource.kind, name: resource.name }\n\t\t\t\t\t: resource\n\t\t\t);\n\n\t\t\tif ( ! hasId ) {\n\t\t\t\tconst read = canUser( 'read', resource );\n\n\t\t\t\tconst isResolving = create.isResolving || read.isResolving;\n\t\t\t\tconst hasResolved = create.hasResolved && read.hasResolved;\n\t\t\t\tlet status = Status.Idle;\n\t\t\t\tif ( isResolving ) {\n\t\t\t\t\tstatus = Status.Resolving;\n\t\t\t\t} else if ( hasResolved ) {\n\t\t\t\t\tstatus = Status.Success;\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\tstatus,\n\t\t\t\t\tisResolving,\n\t\t\t\t\thasResolved,\n\t\t\t\t\tcanCreate: create.hasResolved && create.data,\n\t\t\t\t\tcanRead: read.hasResolved && read.data,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst read = canUser( 'read', resource, id );\n\t\t\tconst update = canUser( 'update', resource, id );\n\t\t\tconst _delete = canUser( 'delete', resource, id );\n\t\t\tconst isResolving =\n\t\t\t\tread.isResolving ||\n\t\t\t\tcreate.isResolving ||\n\t\t\t\tupdate.isResolving ||\n\t\t\t\t_delete.isResolving;\n\t\t\tconst hasResolved =\n\t\t\t\tread.hasResolved &&\n\t\t\t\tcreate.hasResolved &&\n\t\t\t\tupdate.hasResolved &&\n\t\t\t\t_delete.hasResolved;\n\n\t\t\tlet status = Status.Idle;\n\t\t\tif ( isResolving ) {\n\t\t\t\tstatus = Status.Resolving;\n\t\t\t} else if ( hasResolved ) {\n\t\t\t\tstatus = Status.Success;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tstatus,\n\t\t\t\tisResolving,\n\t\t\t\thasResolved,\n\t\t\t\tcanRead: hasResolved && read.data,\n\t\t\t\tcanCreate: hasResolved && create.data,\n\t\t\t\tcanUpdate: hasResolved && update.data,\n\t\t\t\tcanDelete: hasResolved && _delete.data,\n\t\t\t};\n\t\t},\n\t\t[ resourceAsString, id ]\n\t);\n}\n\nexport default useResourcePermissions;\n\nexport function __experimentalUseResourcePermissions(\n\tresource: string,\n\tid?: unknown\n) {\n\tdeprecated( `wp.data.__experimentalUseResourcePermissions`, {\n\t\talternative: 'wp.data.useResourcePermissions',\n\t\tsince: '6.1',\n\t} );\n\treturn useResourcePermissions( resource, id );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,uBAAuB;AAC9C,OAAOC,OAAO,MAAM,oBAAoB;;AAExC;AACA;AACA;AACA,SAASC,KAAK,IAAIC,SAAS,QAAQ,KAAK;AACxC,SAASC,MAAM,QAAQ,aAAa;AACpC,OAAOC,cAAc,MAAM,oBAAoB;;AAqB/C;AACA;AACA;;AAsBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,sBAAsBA,CAC9BC,QAAiC,EACjCC,EAAW,EAC+B;EAC1C;EACA;EACA;EACA;EACA,MAAMC,QAAQ,GAAG,OAAOF,QAAQ,KAAK,QAAQ;EAC7C,MAAMG,gBAAgB,GAAGD,QAAQ,GAAGE,IAAI,CAACC,SAAS,CAAEL,QAAS,CAAC,GAAGA,QAAQ;EAEzE,IAAKE,QAAQ,IAAI,OAAOD,EAAE,KAAK,WAAW,EAAG;IAC5CK,UAAA,CAAAC,YAAA,YAAAb,OAAO,CACN,2FACD,CAAC;EACF;EAEA,OAAOI,cAAc,CAClBU,OAAO,IAAM;IACd,MAAMC,KAAK,GAAGP,QAAQ,GAAG,CAAC,CAAEF,QAAQ,CAACC,EAAE,GAAG,CAAC,CA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