@wordpress/core-data 4.0.4 → 4.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -4
- package/build/actions.js +321 -247
- package/build/actions.js.map +1 -1
- package/build/batch/create-batch.js +17 -9
- package/build/batch/create-batch.js.map +1 -1
- package/build/entities.js +67 -14
- package/build/entities.js.map +1 -1
- package/build/entity-provider.js +18 -13
- package/build/entity-provider.js.map +1 -1
- package/build/fetch/__experimental-fetch-link-suggestions.js +3 -1
- package/build/fetch/__experimental-fetch-link-suggestions.js.map +1 -1
- package/build/fetch/__experimental-fetch-url-data.js +3 -2
- package/build/fetch/__experimental-fetch-url-data.js.map +1 -1
- package/build/index.js +25 -5
- package/build/index.js.map +1 -1
- package/build/locks/actions.js +4 -3
- package/build/locks/actions.js.map +1 -1
- package/build/locks/reducer.js +4 -1
- package/build/locks/reducer.js.map +1 -1
- package/build/locks/selectors.js +4 -3
- package/build/locks/selectors.js.map +1 -1
- package/build/locks/utils.js +7 -5
- package/build/locks/utils.js.map +1 -1
- package/build/queried-data/actions.js +6 -3
- package/build/queried-data/actions.js.map +1 -1
- package/build/queried-data/get-query-parts.js +1 -1
- package/build/queried-data/reducer.js +17 -6
- package/build/queried-data/reducer.js.map +1 -1
- package/build/queried-data/selectors.js +2 -1
- package/build/queried-data/selectors.js.map +1 -1
- package/build/reducer.js +90 -43
- package/build/reducer.js.map +1 -1
- package/build/resolvers.js +216 -163
- package/build/resolvers.js.map +1 -1
- package/build/selectors.js +75 -22
- package/build/selectors.js.map +1 -1
- package/build/utils/forward-resolver.js +30 -0
- package/build/utils/forward-resolver.js.map +1 -0
- package/build/utils/index.js +9 -9
- package/build/utils/index.js.map +1 -1
- package/build/utils/on-sub-key.js +4 -2
- package/build/utils/on-sub-key.js.map +1 -1
- package/build-module/actions.js +306 -240
- package/build-module/actions.js.map +1 -1
- package/build-module/batch/create-batch.js +17 -9
- package/build-module/batch/create-batch.js.map +1 -1
- package/build-module/entities.js +66 -13
- package/build-module/entities.js.map +1 -1
- package/build-module/entity-provider.js +17 -12
- package/build-module/entity-provider.js.map +1 -1
- package/build-module/fetch/__experimental-fetch-link-suggestions.js +3 -1
- package/build-module/fetch/__experimental-fetch-link-suggestions.js.map +1 -1
- package/build-module/fetch/__experimental-fetch-url-data.js +3 -2
- package/build-module/fetch/__experimental-fetch-url-data.js.map +1 -1
- package/build-module/index.js +21 -3
- package/build-module/index.js.map +1 -1
- package/build-module/locks/actions.js +4 -3
- package/build-module/locks/actions.js.map +1 -1
- package/build-module/locks/reducer.js +4 -1
- package/build-module/locks/reducer.js.map +1 -1
- package/build-module/locks/selectors.js +4 -3
- package/build-module/locks/selectors.js.map +1 -1
- package/build-module/locks/utils.js +5 -3
- package/build-module/locks/utils.js.map +1 -1
- package/build-module/queried-data/actions.js +5 -2
- package/build-module/queried-data/actions.js.map +1 -1
- package/build-module/queried-data/reducer.js +15 -4
- package/build-module/queried-data/reducer.js.map +1 -1
- package/build-module/queried-data/selectors.js +2 -1
- package/build-module/queried-data/selectors.js.map +1 -1
- package/build-module/reducer.js +80 -34
- package/build-module/reducer.js.map +1 -1
- package/build-module/resolvers.js +211 -161
- package/build-module/resolvers.js.map +1 -1
- package/build-module/selectors.js +44 -3
- package/build-module/selectors.js.map +1 -1
- package/build-module/utils/forward-resolver.js +22 -0
- package/build-module/utils/forward-resolver.js.map +1 -0
- package/build-module/utils/index.js +1 -1
- package/build-module/utils/index.js.map +1 -1
- package/build-module/utils/on-sub-key.js +3 -1
- package/build-module/utils/on-sub-key.js.map +1 -1
- package/package.json +12 -12
- package/src/actions.js +51 -5
- package/src/entities.js +43 -6
- package/src/fetch/__experimental-fetch-url-data.js +1 -1
- package/src/reducer.js +14 -17
- package/src/resolvers.js +56 -19
- package/src/selectors.js +43 -4
- package/src/test/actions.js +89 -0
- package/src/test/selectors.js +56 -1
- package/src/utils/forward-resolver.js +14 -0
- package/src/utils/index.js +1 -1
- package/build/utils/if-not-resolved.js +0 -31
- package/build/utils/if-not-resolved.js.map +0 -1
- package/build-module/utils/if-not-resolved.js +0 -23
- package/build-module/utils/if-not-resolved.js.map +0 -1
- package/src/utils/if-not-resolved.js +0 -22
- package/src/utils/test/if-not-resolved.js +0 -76
|
@@ -18,6 +18,15 @@ import { STORE_NAME } from './name';
|
|
|
18
18
|
import { getQueriedItems } from './queried-data';
|
|
19
19
|
import { DEFAULT_ENTITY_KEY } from './entities';
|
|
20
20
|
import { getNormalizedCommaSeparable, isRawAttribute } from './utils';
|
|
21
|
+
/**
|
|
22
|
+
* Shared reference to an empty object for cases where it is important to avoid
|
|
23
|
+
* returning a new object reference on every invocation, as in a connected or
|
|
24
|
+
* other pure component which performs `shouldComponentUpdate` check on props.
|
|
25
|
+
* This should be used as a last resort, since the normalized data should be
|
|
26
|
+
* maintained by the reducer result in state.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
const EMPTY_OBJECT = {};
|
|
21
30
|
/**
|
|
22
31
|
* Shared reference to an empty array for cases where it is important to avoid
|
|
23
32
|
* returning a new array reference on every invocation, as in a connected or
|
|
@@ -275,7 +284,9 @@ export const __experimentalGetDirtyEntityRecords = createSelector(state => {
|
|
|
275
284
|
const dirtyRecords = [];
|
|
276
285
|
Object.keys(data).forEach(kind => {
|
|
277
286
|
Object.keys(data[kind]).forEach(name => {
|
|
278
|
-
const primaryKeys = Object.keys(data[kind][name].edits).filter(primaryKey =>
|
|
287
|
+
const primaryKeys = Object.keys(data[kind][name].edits).filter(primaryKey => // The entity record must exist (not be deleted),
|
|
288
|
+
// and it must have edits.
|
|
289
|
+
getEntityRecord(state, kind, name, primaryKey) && hasEditsForEntityRecord(state, kind, name, primaryKey));
|
|
279
290
|
|
|
280
291
|
if (primaryKeys.length) {
|
|
281
292
|
const entity = getEntity(state, kind, name);
|
|
@@ -564,7 +575,18 @@ export function hasRedo(state) {
|
|
|
564
575
|
*/
|
|
565
576
|
|
|
566
577
|
export function getCurrentTheme(state) {
|
|
567
|
-
return state
|
|
578
|
+
return getEntityRecord(state, 'root', 'theme', state.currentTheme);
|
|
579
|
+
}
|
|
580
|
+
/**
|
|
581
|
+
* Return the ID of the current global styles object.
|
|
582
|
+
*
|
|
583
|
+
* @param {Object} state Data state.
|
|
584
|
+
*
|
|
585
|
+
* @return {string} The current global styles ID.
|
|
586
|
+
*/
|
|
587
|
+
|
|
588
|
+
export function __experimentalGetCurrentGlobalStylesId(state) {
|
|
589
|
+
return state.currentGlobalStylesId;
|
|
568
590
|
}
|
|
569
591
|
/**
|
|
570
592
|
* Return theme supports data in the index.
|
|
@@ -575,7 +597,9 @@ export function getCurrentTheme(state) {
|
|
|
575
597
|
*/
|
|
576
598
|
|
|
577
599
|
export function getThemeSupports(state) {
|
|
578
|
-
|
|
600
|
+
var _getCurrentTheme$them, _getCurrentTheme;
|
|
601
|
+
|
|
602
|
+
return (_getCurrentTheme$them = (_getCurrentTheme = getCurrentTheme(state)) === null || _getCurrentTheme === void 0 ? void 0 : _getCurrentTheme.theme_supports) !== null && _getCurrentTheme$them !== void 0 ? _getCurrentTheme$them : EMPTY_OBJECT;
|
|
579
603
|
}
|
|
580
604
|
/**
|
|
581
605
|
* Returns the embed preview for the given URL.
|
|
@@ -751,4 +775,21 @@ export function __experimentalGetTemplateForLink(state, link) {
|
|
|
751
775
|
|
|
752
776
|
return template;
|
|
753
777
|
}
|
|
778
|
+
/**
|
|
779
|
+
* Retrieve the current theme's base global styles
|
|
780
|
+
*
|
|
781
|
+
* @param {Object} state Editor state.
|
|
782
|
+
*
|
|
783
|
+
* @return {Object?} The Global Styles object.
|
|
784
|
+
*/
|
|
785
|
+
|
|
786
|
+
export function __experimentalGetCurrentThemeBaseGlobalStyles(state) {
|
|
787
|
+
const currentTheme = getCurrentTheme(state);
|
|
788
|
+
|
|
789
|
+
if (!currentTheme) {
|
|
790
|
+
return null;
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
return state.themeBaseGlobalStyles[currentTheme.stylesheet];
|
|
794
|
+
}
|
|
754
795
|
//# sourceMappingURL=selectors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/core-data/src/selectors.js"],"names":["createSelector","set","map","find","get","filter","compact","createRegistrySelector","addQueryArgs","deprecated","STORE_NAME","getQueriedItems","DEFAULT_ENTITY_KEY","getNormalizedCommaSeparable","isRawAttribute","EMPTY_ARRAY","isRequestingEmbedPreview","select","state","url","isResolving","getAuthors","query","since","alternative","path","getUserQueryResults","getCurrentUser","currentUser","queryID","queryResults","users","queries","id","byId","getEntitiesByKind","kind","entities","config","getEntity","name","getEntityRecord","key","queriedState","data","undefined","context","itemIsComplete","items","item","_fields","filteredItem","fields","f","length","field","split","value","recordId","__experimentalGetEntityRecordNoResolver","getRawEntityRecord","record","Object","keys","reduce","accumulator","_key","hasEntityRecords","Array","isArray","getEntityRecords","__experimentalGetDirtyEntityRecords","dirtyRecords","forEach","primaryKeys","edits","primaryKey","hasEditsForEntityRecord","entity","entityRecord","getEditedEntityRecord","push","title","getTitle","__experimentalGetEntitiesBeingSaved","recordsBeingSaved","saving","isSavingEntityRecord","getEntityRecordEdits","getEntityRecordNonTransientEdits","transientEdits","acc","isAutosavingEntityRecord","pending","isAutosave","Boolean","isDeletingEntityRecord","getLastEntitySaveError","getLastEntityDeleteError","getCurrentUndoOffset","undo","offset","getUndoEdit","getRedoEdit","hasUndo","hasRedo","getCurrentTheme","themes","currentTheme","getThemeSupports","themeSupports","getEmbedPreview","embedPreviews","isPreviewEmbedFallback","preview","oEmbedLinkCheck","html","canUser","action","resource","join","canUserEditEntityRecord","__unstable_rest_base","getAutosaves","postType","postId","autosaves","getAutosave","authorId","author","hasFetchedAutosaves","hasFinishedResolution","getReferenceByDistinctEdits","flattenedUndo","__experimentalGetTemplateForLink","link","records","template"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,cAAP,MAA2B,QAA3B;AACA,SAASC,GAAT,EAAcC,GAAd,EAAmBC,IAAnB,EAAyBC,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B,CAAV;AAOA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASyC,oBAAT,CAA+BjF,KAA/B,EAAuC;AACtC,SAAOA,KAAK,CAACkF,IAAN,CAAWC,MAAlB;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,OAAO,SAASC,WAAT,CAAsBpF,KAAtB,EAA8B;AACpC,SAAOA,KAAK,CAACkF,IAAN,CAAYlF,KAAK,CAACkF,IAAN,CAAW9C,MAAX,GAAoB,CAApB,GAAwB6C,oBAAoB,CAAEjF,KAAF,CAAxD,CAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASqF,WAAT,CAAsBrF,KAAtB,EAA8B;AACpC,SAAOA,KAAK,CAACkF,IAAN,CAAYlF,KAAK,CAACkF,IAAN,CAAW9C,MAAX,GAAoB6C,oBAAoB,CAAEjF,KAAF,CAApD,CAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASsF,OAAT,CAAkBtF,KAAlB,EAA0B;AAChC,SAAO6E,OAAO,CAAEO,WAAW,CAAEpF,KAAF,CAAb,CAAd;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASuF,OAAT,CAAkBvF,KAAlB,EAA0B;AAChC,SAAO6E,OAAO,CAAEQ,WAAW,CAAErF,KAAF,CAAb,CAAd;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASwF,eAAT,CAA0BxF,KAA1B,EAAkC;AACxC,SAAOA,KAAK,CAACyF,MAAN,CAAczF,KAAK,CAAC0F,YAApB,CAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,gBAAT,CAA2B3F,KAA3B,EAAmC;AACzC,SAAOA,KAAK,CAAC4F,aAAb;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO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AAK,CAACkF,IAAN,CAAWiC,aAHC,CAF2C,CAAlD;AASP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,gCAAT,CAA2CpH,KAA3C,EAAkDqH,IAAlD,EAAyD;AAC/D,QAAMC,OAAO,GAAGlE,gBAAgB,CAAEpD,KAAF,EAAS,UAAT,EAAqB,aAArB,EAAoC;AACnE,qBAAiBqH;AADkD,GAApC,CAAhC;AAIA,QAAME,QAAQ,GAAGD,OAAO,SAAP,IAAAA,OAAO,WAAP,IAAAA,OAAO,CAAElF,MAAT,GAAkBkF,OAAO,CAAE,CAAF,CAAzB,GAAiC,IAAlD;;AACA,MAAKC,QAAL,EAAgB;AACf,WAAOzD,qBAAqB,CAC3B9D,KAD2B,EAE3B,UAF2B,EAG3B,aAH2B,EAI3BuH,QAAQ,CAACxG,EAJkB,CAA5B;AAMA;;AACD,SAAOwG,QAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport createSelector from 'rememo';\nimport { set, map, find, get, filter, compact } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { createRegistrySelector } from '@wordpress/data';\nimport { addQueryArgs } from '@wordpress/url';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { STORE_NAME } from './name';\nimport { getQueriedItems } from './queried-data';\nimport { DEFAULT_ENTITY_KEY } from './entities';\nimport { getNormalizedCommaSeparable, isRawAttribute } from './utils';\n\n/**\n * Shared reference to an empty array for cases where it is important to avoid\n * returning a new array reference on every invocation, as in a connected or\n * other pure component which performs `shouldComponentUpdate` check on props.\n * This should be used as a last resort, since the normalized data should be\n * maintained by the reducer result in state.\n *\n * @type {Array}\n */\nconst EMPTY_ARRAY = [];\n\n/**\n * Returns true if a request is in progress for embed preview data, or false\n * otherwise.\n *\n * @param {Object} state Data state.\n * @param {string} url URL the preview would be for.\n *\n * @return {boolean} Whether a request is in progress for an embed preview.\n */\nexport const isRequestingEmbedPreview = createRegistrySelector(\n\t( select ) => ( state, url ) => {\n\t\treturn select( STORE_NAME ).isResolving( 'getEmbedPreview', [ url ] );\n\t}\n);\n\n/**\n * Returns all available authors.\n *\n * @deprecated since 11.3. Callers should use `select( 'core' ).getUsers({ who: 'authors' })` instead.\n *\n * @param {Object} state Data state.\n * @param {Object|undefined} query Optional object of query parameters to\n * include with request.\n * @return {Array} Authors list.\n */\nexport function getAuthors( state, query ) {\n\tdeprecated( \"select( 'core' ).getAuthors()\", {\n\t\tsince: '5.9',\n\t\talternative: \"select( 'core' ).getUsers({ who: 'authors' })\",\n\t} );\n\n\tconst path = addQueryArgs(\n\t\t'/wp/v2/users/?who=authors&per_page=100',\n\t\tquery\n\t);\n\treturn getUserQueryResults( state, path );\n}\n\n/**\n * Returns the current user.\n *\n * @param {Object} state Data state.\n *\n * @return {Object} Current user object.\n */\nexport function getCurrentUser( state ) {\n\treturn state.currentUser;\n}\n\n/**\n * Returns all the users returned by a query ID.\n *\n * @param {Object} state Data state.\n * @param {string} queryID Query ID.\n *\n * @return {Array} Users list.\n */\nexport const getUserQueryResults = createSelector(\n\t( state, queryID ) => {\n\t\tconst queryResults = state.users.queries[ queryID ];\n\n\t\treturn map( queryResults, ( id ) => state.users.byId[ id ] );\n\t},\n\t( state, queryID ) => [ state.users.queries[ queryID ], state.users.byId ]\n);\n\n/**\n * Returns whether the entities for the give kind are loaded.\n *\n * @param {Object} state Data state.\n * @param {string} kind Entity kind.\n *\n * @return {Array<Object>} Array of entities with config matching kind.\n */\nexport function getEntitiesByKind( state, kind ) {\n\treturn filter( state.entities.config, { kind } );\n}\n\n/**\n * Returns the entity object given its kind and name.\n *\n * @param {Object} state Data state.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n *\n * @return {Object} Entity\n */\nexport function getEntity( state, kind, name ) {\n\treturn find( state.entities.config, { kind, name } );\n}\n\n/**\n * Returns the Entity's record object by key. Returns `null` if the value is not\n * yet received, undefined if the value entity is known to not exist, or the\n * entity object if it exists and is received.\n *\n * @param {Object} state State tree\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} key Record's key\n * @param {?Object} query Optional query.\n *\n * @return {Object?} Record.\n */\nexport const getEntityRecord = createSelector(\n\t( state, kind, name, key, query ) => {\n\t\tconst queriedState = get( state.entities.data, [\n\t\t\tkind,\n\t\t\tname,\n\t\t\t'queriedData',\n\t\t] );\n\t\tif ( ! queriedState ) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst context = query?.context ?? 'default';\n\n\t\tif ( query === undefined ) {\n\t\t\t// If expecting a complete item, validate that completeness.\n\t\t\tif ( ! queriedState.itemIsComplete[ context ]?.[ key ] ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\treturn queriedState.items[ context ][ key ];\n\t\t}\n\n\t\tconst item = queriedState.items[ context ]?.[ key ];\n\t\tif ( item && query._fields ) {\n\t\t\tconst filteredItem = {};\n\t\t\tconst fields = getNormalizedCommaSeparable( query._fields );\n\t\t\tfor ( let f = 0; f < fields.length; f++ ) {\n\t\t\t\tconst field = fields[ f ].split( '.' );\n\t\t\t\tconst value = get( item, field );\n\t\t\t\tset( filteredItem, field, value );\n\t\t\t}\n\t\t\treturn filteredItem;\n\t\t}\n\n\t\treturn item;\n\t},\n\t( state, kind, name, recordId, query ) => {\n\t\tconst context = query?.context ?? 'default';\n\t\treturn [\n\t\t\tget( state.entities.data, [\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\t'queriedData',\n\t\t\t\t'items',\n\t\t\t\tcontext,\n\t\t\t\trecordId,\n\t\t\t] ),\n\t\t\tget( state.entities.data, [\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\t'queriedData',\n\t\t\t\t'itemIsComplete',\n\t\t\t\tcontext,\n\t\t\t\trecordId,\n\t\t\t] ),\n\t\t];\n\t}\n);\n\n/**\n * Returns the Entity's record object by key. Doesn't trigger a resolver nor requests the entity from the API if the entity record isn't available in the local state.\n *\n * @param {Object} state State tree\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} key Record's key\n *\n * @return {Object|null} Record.\n */\nexport function __experimentalGetEntityRecordNoResolver(\n\tstate,\n\tkind,\n\tname,\n\tkey\n) {\n\treturn getEntityRecord( state, kind, name, key );\n}\n\n/**\n * Returns the entity's record object by key,\n * with its attributes mapped to their raw values.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} key Record's key.\n *\n * @return {Object?} Object with the entity's raw attributes.\n */\nexport const getRawEntityRecord = createSelector(\n\t( state, kind, name, key ) => {\n\t\tconst record = getEntityRecord( state, kind, name, key );\n\t\treturn (\n\t\t\trecord &&\n\t\t\tObject.keys( record ).reduce( ( accumulator, _key ) => {\n\t\t\t\tif ( isRawAttribute( getEntity( state, kind, name ), _key ) ) {\n\t\t\t\t\t// Because edits are the \"raw\" attribute values,\n\t\t\t\t\t// we return those from record selectors to make rendering,\n\t\t\t\t\t// comparisons, and joins with edits easier.\n\t\t\t\t\taccumulator[ _key ] = get(\n\t\t\t\t\t\trecord[ _key ],\n\t\t\t\t\t\t'raw',\n\t\t\t\t\t\trecord[ _key ]\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\taccumulator[ _key ] = record[ _key ];\n\t\t\t\t}\n\t\t\t\treturn accumulator;\n\t\t\t}, {} )\n\t\t);\n\t},\n\t( state, kind, name, recordId, query ) => {\n\t\tconst context = query?.context ?? 'default';\n\t\treturn [\n\t\t\tstate.entities.config,\n\t\t\tget( state.entities.data, [\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\t'queriedData',\n\t\t\t\t'items',\n\t\t\t\tcontext,\n\t\t\t\trecordId,\n\t\t\t] ),\n\t\t\tget( state.entities.data, [\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\t'queriedData',\n\t\t\t\t'itemIsComplete',\n\t\t\t\tcontext,\n\t\t\t\trecordId,\n\t\t\t] ),\n\t\t];\n\t}\n);\n\n/**\n * Returns true if records have been received for the given set of parameters,\n * or false otherwise.\n *\n * @param {Object} state State tree\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {?Object} query Optional terms query.\n *\n * @return {boolean} Whether entity records have been received.\n */\nexport function hasEntityRecords( state, kind, name, query ) {\n\treturn Array.isArray( getEntityRecords( state, kind, name, query ) );\n}\n\n/**\n * Returns the Entity's records.\n *\n * @param {Object} state State tree\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {?Object} query Optional terms query.\n *\n * @return {?Array} Records.\n */\nexport function getEntityRecords( state, kind, name, query ) {\n\t// Queried data state is prepopulated for all known entities. If this is not\n\t// assigned for the given parameters, then it is known to not exist. Thus, a\n\t// return value of an empty array is used instead of `null` (where `null` is\n\t// otherwise used to represent an unknown state).\n\tconst queriedState = get( state.entities.data, [\n\t\tkind,\n\t\tname,\n\t\t'queriedData',\n\t] );\n\tif ( ! queriedState ) {\n\t\treturn EMPTY_ARRAY;\n\t}\n\treturn getQueriedItems( queriedState, query );\n}\n\n/**\n * Returns the list of dirty entity records.\n *\n * @param {Object} state State tree.\n *\n * @return {[{ title: string, key: string, name: string, kind: string }]} The list of updated records\n */\nexport const __experimentalGetDirtyEntityRecords = createSelector(\n\t( state ) => {\n\t\tconst {\n\t\t\tentities: { data },\n\t\t} = state;\n\t\tconst dirtyRecords = [];\n\t\tObject.keys( data ).forEach( ( kind ) => {\n\t\t\tObject.keys( data[ kind ] ).forEach( ( name ) => {\n\t\t\t\tconst primaryKeys = Object.keys(\n\t\t\t\t\tdata[ kind ][ name ].edits\n\t\t\t\t).filter( ( primaryKey ) =>\n\t\t\t\t\thasEditsForEntityRecord( state, kind, name, primaryKey )\n\t\t\t\t);\n\n\t\t\t\tif ( primaryKeys.length ) {\n\t\t\t\t\tconst entity = getEntity( state, kind, name );\n\t\t\t\t\tprimaryKeys.forEach( ( primaryKey ) => {\n\t\t\t\t\t\tconst entityRecord = getEditedEntityRecord(\n\t\t\t\t\t\t\tstate,\n\t\t\t\t\t\t\tkind,\n\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\tprimaryKey\n\t\t\t\t\t\t);\n\t\t\t\t\t\tdirtyRecords.push( {\n\t\t\t\t\t\t\t// We avoid using primaryKey because it's transformed into a string\n\t\t\t\t\t\t\t// when it's used as an object key.\n\t\t\t\t\t\t\tkey:\n\t\t\t\t\t\t\t\tentityRecord[\n\t\t\t\t\t\t\t\t\tentity.key || DEFAULT_ENTITY_KEY\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\ttitle: entity?.getTitle?.( entityRecord ) || '',\n\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\tkind,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\t\t} );\n\n\t\treturn dirtyRecords;\n\t},\n\t( state ) => [ state.entities.data ]\n);\n\n/**\n * Returns the list of entities currently being saved.\n *\n * @param {Object} state State tree.\n *\n * @return {[{ title: string, key: string, name: string, kind: string }]} The list of records being saved.\n */\nexport const __experimentalGetEntitiesBeingSaved = createSelector(\n\t( state ) => {\n\t\tconst {\n\t\t\tentities: { data },\n\t\t} = state;\n\t\tconst recordsBeingSaved = [];\n\t\tObject.keys( data ).forEach( ( kind ) => {\n\t\t\tObject.keys( data[ kind ] ).forEach( ( name ) => {\n\t\t\t\tconst primaryKeys = Object.keys(\n\t\t\t\t\tdata[ kind ][ name ].saving\n\t\t\t\t).filter( ( primaryKey ) =>\n\t\t\t\t\tisSavingEntityRecord( state, kind, name, primaryKey )\n\t\t\t\t);\n\n\t\t\t\tif ( primaryKeys.length ) {\n\t\t\t\t\tconst entity = getEntity( state, kind, name );\n\t\t\t\t\tprimaryKeys.forEach( ( primaryKey ) => {\n\t\t\t\t\t\tconst entityRecord = getEditedEntityRecord(\n\t\t\t\t\t\t\tstate,\n\t\t\t\t\t\t\tkind,\n\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\tprimaryKey\n\t\t\t\t\t\t);\n\t\t\t\t\t\trecordsBeingSaved.push( {\n\t\t\t\t\t\t\t// We avoid using primaryKey because it's transformed into a string\n\t\t\t\t\t\t\t// when it's used as an object key.\n\t\t\t\t\t\t\tkey:\n\t\t\t\t\t\t\t\tentityRecord[\n\t\t\t\t\t\t\t\t\tentity.key || DEFAULT_ENTITY_KEY\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\ttitle: entity?.getTitle?.( entityRecord ) || '',\n\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\tkind,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\t\t} );\n\t\treturn recordsBeingSaved;\n\t},\n\t( state ) => [ state.entities.data ]\n);\n\n/**\n * Returns the specified entity record's edits.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {Object?} The entity record's edits.\n */\nexport function getEntityRecordEdits( state, kind, name, recordId ) {\n\treturn get( state.entities.data, [ kind, name, 'edits', recordId ] );\n}\n\n/**\n * Returns the specified entity record's non transient edits.\n *\n * Transient edits don't create an undo level, and\n * are not considered for change detection.\n * They are defined in the entity's config.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {Object?} The entity record's non transient edits.\n */\nexport const getEntityRecordNonTransientEdits = createSelector(\n\t( state, kind, name, recordId ) => {\n\t\tconst { transientEdits } = getEntity( state, kind, name ) || {};\n\t\tconst edits = getEntityRecordEdits( state, kind, name, recordId ) || {};\n\t\tif ( ! transientEdits ) {\n\t\t\treturn edits;\n\t\t}\n\t\treturn Object.keys( edits ).reduce( ( acc, key ) => {\n\t\t\tif ( ! transientEdits[ key ] ) {\n\t\t\t\tacc[ key ] = edits[ key ];\n\t\t\t}\n\t\t\treturn acc;\n\t\t}, {} );\n\t},\n\t( state, kind, name, recordId ) => [\n\t\tstate.entities.config,\n\t\tget( state.entities.data, [ kind, name, 'edits', recordId ] ),\n\t]\n);\n\n/**\n * Returns true if the specified entity record has edits,\n * and false otherwise.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {boolean} Whether the entity record has edits or not.\n */\nexport function hasEditsForEntityRecord( state, kind, name, recordId ) {\n\treturn (\n\t\tisSavingEntityRecord( state, kind, name, recordId ) ||\n\t\tObject.keys(\n\t\t\tgetEntityRecordNonTransientEdits( state, kind, name, recordId )\n\t\t).length > 0\n\t);\n}\n\n/**\n * Returns the specified entity record, merged with its edits.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {Object?} The entity record, merged with its edits.\n */\nexport const getEditedEntityRecord = createSelector(\n\t( state, kind, name, recordId ) => ( {\n\t\t...getRawEntityRecord( state, kind, name, recordId ),\n\t\t...getEntityRecordEdits( state, kind, name, recordId ),\n\t} ),\n\t( state, kind, name, recordId, query ) => {\n\t\tconst context = query?.context ?? 'default';\n\t\treturn [\n\t\t\tstate.entities.config,\n\t\t\tget( state.entities.data, [\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\t'queriedData',\n\t\t\t\t'items',\n\t\t\t\tcontext,\n\t\t\t\trecordId,\n\t\t\t] ),\n\t\t\tget( state.entities.data, [\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\t'queriedData',\n\t\t\t\t'itemIsComplete',\n\t\t\t\tcontext,\n\t\t\t\trecordId,\n\t\t\t] ),\n\t\t\tget( state.entities.data, [ kind, name, 'edits', recordId ] ),\n\t\t];\n\t}\n);\n\n/**\n * Returns true if the specified entity record is autosaving, and false otherwise.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {boolean} Whether the entity record is autosaving or not.\n */\nexport function isAutosavingEntityRecord( state, kind, name, recordId ) {\n\tconst { pending, isAutosave } = get(\n\t\tstate.entities.data,\n\t\t[ kind, name, 'saving', recordId ],\n\t\t{}\n\t);\n\treturn Boolean( pending && isAutosave );\n}\n\n/**\n * Returns true if the specified entity record is saving, and false otherwise.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {boolean} Whether the entity record is saving or not.\n */\nexport function isSavingEntityRecord( state, kind, name, recordId ) {\n\treturn get(\n\t\tstate.entities.data,\n\t\t[ kind, name, 'saving', recordId, 'pending' ],\n\t\tfalse\n\t);\n}\n\n/**\n * Returns true if the specified entity record is deleting, and false otherwise.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {boolean} Whether the entity record is deleting or not.\n */\nexport function isDeletingEntityRecord( state, kind, name, recordId ) {\n\treturn get(\n\t\tstate.entities.data,\n\t\t[ kind, name, 'deleting', recordId, 'pending' ],\n\t\tfalse\n\t);\n}\n\n/**\n * Returns the specified entity record's last save error.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {Object?} The entity record's save error.\n */\nexport function getLastEntitySaveError( state, kind, name, recordId ) {\n\treturn get( state.entities.data, [\n\t\tkind,\n\t\tname,\n\t\t'saving',\n\t\trecordId,\n\t\t'error',\n\t] );\n}\n\n/**\n * Returns the specified entity record's last delete error.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {Object?} The entity record's save error.\n */\nexport function getLastEntityDeleteError( state, kind, name, recordId ) {\n\treturn get( state.entities.data, [\n\t\tkind,\n\t\tname,\n\t\t'deleting',\n\t\trecordId,\n\t\t'error',\n\t] );\n}\n\n/**\n * Returns the current undo offset for the\n * entity records edits history. The offset\n * represents how many items from the end\n * of the history stack we are at. 0 is the\n * last edit, -1 is the second last, and so on.\n *\n * @param {Object} state State tree.\n *\n * @return {number} The current undo offset.\n */\nfunction getCurrentUndoOffset( state ) {\n\treturn state.undo.offset;\n}\n\n/**\n * Returns the previous edit from the current undo offset\n * for the entity records edits history, if any.\n *\n * @param {Object} state State tree.\n *\n * @return {Object?} The edit.\n */\nexport function getUndoEdit( state ) {\n\treturn state.undo[ state.undo.length - 2 + getCurrentUndoOffset( state ) ];\n}\n\n/**\n * Returns the next edit from the current undo offset\n * for the entity records edits history, if any.\n *\n * @param {Object} state State tree.\n *\n * @return {Object?} The edit.\n */\nexport function getRedoEdit( state ) {\n\treturn state.undo[ state.undo.length + getCurrentUndoOffset( state ) ];\n}\n\n/**\n * Returns true if there is a previous edit from the current undo offset\n * for the entity records edits history, and false otherwise.\n *\n * @param {Object} state State tree.\n *\n * @return {boolean} Whether there is a previous edit or not.\n */\nexport function hasUndo( state ) {\n\treturn Boolean( getUndoEdit( state ) );\n}\n\n/**\n * Returns true if there is a next edit from the current undo offset\n * for the entity records edits history, and false otherwise.\n *\n * @param {Object} state State tree.\n *\n * @return {boolean} Whether there is a next edit or not.\n */\nexport function hasRedo( state ) {\n\treturn Boolean( getRedoEdit( state ) );\n}\n\n/**\n * Return the current theme.\n *\n * @param {Object} state Data state.\n *\n * @return {Object} The current theme.\n */\nexport function getCurrentTheme( state ) {\n\treturn state.themes[ state.currentTheme ];\n}\n\n/**\n * Return theme supports data in the index.\n *\n * @param {Object} state Data state.\n *\n * @return {*} Index data.\n */\nexport function getThemeSupports( state ) {\n\treturn state.themeSupports;\n}\n\n/**\n * Returns the embed preview for the given URL.\n *\n * @param {Object} state Data state.\n * @param {string} url Embedded URL.\n *\n * @return {*} Undefined if the preview has not been fetched, otherwise, the preview fetched from the embed preview API.\n */\nexport function getEmbedPreview( state, url ) {\n\treturn state.embedPreviews[ url ];\n}\n\n/**\n * Determines if the returned preview is an oEmbed link fallback.\n *\n * WordPress can be configured to return a simple link to a URL if it is not embeddable.\n * We need to be able to determine if a URL is embeddable or not, based on what we\n * get back from the oEmbed preview API.\n *\n * @param {Object} state Data state.\n * @param {string} url Embedded URL.\n *\n * @return {boolean} Is the preview for the URL an oEmbed link fallback.\n */\nexport function isPreviewEmbedFallback( state, url ) {\n\tconst preview = state.embedPreviews[ url ];\n\tconst oEmbedLinkCheck = '<a href=\"' + url + '\">' + url + '</a>';\n\tif ( ! preview ) {\n\t\treturn false;\n\t}\n\treturn preview.html === oEmbedLinkCheck;\n}\n\n/**\n * Returns whether the current user can perform the given action on the given\n * REST resource.\n *\n * Calling this may trigger an OPTIONS request to the REST API via the\n * `canUser()` resolver.\n *\n * https://developer.wordpress.org/rest-api/reference/\n *\n * @param {Object} state Data state.\n * @param {string} action Action to check. One of: 'create', 'read', 'update', 'delete'.\n * @param {string} resource REST resource to check, e.g. 'media' or 'posts'.\n * @param {string=} id Optional ID of the rest resource to check.\n *\n * @return {boolean|undefined} Whether or not the user can perform the action,\n * or `undefined` if the OPTIONS request is still being made.\n */\nexport function canUser( state, action, resource, id ) {\n\tconst key = compact( [ action, resource, id ] ).join( '/' );\n\treturn get( state, [ 'userPermissions', key ] );\n}\n\n/**\n * Returns whether the current user can edit the given entity.\n *\n * Calling this may trigger an OPTIONS request to the REST API via the\n * `canUser()` resolver.\n *\n * https://developer.wordpress.org/rest-api/reference/\n *\n * @param {Object} state Data state.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {string} recordId Record's id.\n * @return {boolean|undefined} Whether or not the user can edit,\n * or `undefined` if the OPTIONS request is still being made.\n */\nexport function canUserEditEntityRecord( state, kind, name, recordId ) {\n\tconst entity = getEntity( state, kind, name );\n\tif ( ! entity ) {\n\t\treturn false;\n\t}\n\tconst resource = entity.__unstable_rest_base;\n\n\treturn canUser( state, 'update', resource, recordId );\n}\n\n/**\n * Returns the latest autosaves for the post.\n *\n * May return multiple autosaves since the backend stores one autosave per\n * author for each post.\n *\n * @param {Object} state State tree.\n * @param {string} postType The type of the parent post.\n * @param {number} postId The id of the parent post.\n *\n * @return {?Array} An array of autosaves for the post, or undefined if there is none.\n */\nexport function getAutosaves( state, postType, postId ) {\n\treturn state.autosaves[ postId ];\n}\n\n/**\n * Returns the autosave for the post and author.\n *\n * @param {Object} state State tree.\n * @param {string} postType The type of the parent post.\n * @param {number} postId The id of the parent post.\n * @param {number} authorId The id of the author.\n *\n * @return {?Object} The autosave for the post and author.\n */\nexport function getAutosave( state, postType, postId, authorId ) {\n\tif ( authorId === undefined ) {\n\t\treturn;\n\t}\n\n\tconst autosaves = state.autosaves[ postId ];\n\treturn find( autosaves, { author: authorId } );\n}\n\n/**\n * Returns true if the REST request for autosaves has completed.\n *\n * @param {Object} state State tree.\n * @param {string} postType The type of the parent post.\n * @param {number} postId The id of the parent post.\n *\n * @return {boolean} True if the REST request was completed. False otherwise.\n */\nexport const hasFetchedAutosaves = createRegistrySelector(\n\t( select ) => ( state, postType, postId ) => {\n\t\treturn select( STORE_NAME ).hasFinishedResolution( 'getAutosaves', [\n\t\t\tpostType,\n\t\t\tpostId,\n\t\t] );\n\t}\n);\n\n/**\n * Returns a new reference when edited values have changed. This is useful in\n * inferring where an edit has been made between states by comparison of the\n * return values using strict equality.\n *\n * @example\n *\n * ```\n * const hasEditOccurred = (\n * getReferenceByDistinctEdits( beforeState ) !==\n * getReferenceByDistinctEdits( afterState )\n * );\n * ```\n *\n * @param {Object} state Editor state.\n *\n * @return {*} A value whose reference will change only when an edit occurs.\n */\nexport const getReferenceByDistinctEdits = createSelector(\n\t() => [],\n\t( state ) => [\n\t\tstate.undo.length,\n\t\tstate.undo.offset,\n\t\tstate.undo.flattenedUndo,\n\t]\n);\n\n/**\n * Retrieve the frontend template used for a given link.\n *\n * @param {Object} state Editor state.\n * @param {string} link Link.\n *\n * @return {Object?} The template record.\n */\nexport function __experimentalGetTemplateForLink( state, link ) {\n\tconst records = getEntityRecords( state, 'postType', 'wp_template', {\n\t\t'find-template': link,\n\t} );\n\n\tconst template = records?.length ? records[ 0 ] : null;\n\tif ( template ) {\n\t\treturn getEditedEntityRecord(\n\t\t\tstate,\n\t\t\t'postType',\n\t\t\t'wp_template',\n\t\t\ttemplate.id\n\t\t);\n\t}\n\treturn template;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/core-data/src/selectors.js"],"names":["createSelector","set","map","find","get","filter","compact","createRegistrySelector","addQueryArgs","deprecated","STORE_NAME","getQueriedItems","DEFAULT_ENTITY_KEY","getNormalizedCommaSeparable","isRawAttribute","EMPTY_OBJECT","EMPTY_ARRAY","isRequestingEmbedPreview","select","state","url","isResolving","getAuthors","query","since","alternative","path","getUserQueryResults","getCurrentUser","currentUser","queryID","queryResults","users","queries","id","byId","getEntitiesByKind","kind","entities","config","getEntity","name","getEntityRecord","key","queriedState","data","undefined","context","itemIsComplete","items","item","_fields","filteredItem","fields","f","length","field","split","value","recordId","__experimentalGetEntityRecordNoResolver","getRawEntityRecord","record","Object","keys","reduce","accumulator","_key","hasEntityRecords","Array","isArray","getEntityRecords","__experimentalGetDirtyEntityRecords","dirtyRecords","forEach","primaryKeys","edits","primaryKey","hasEditsForEntityRecord","entity","entityRecord","getEditedEntityRecord","push","title","getTitle","__experimentalGetEntitiesBeingSaved","recordsBeingSaved","saving","isSavingEntityRecord","getEntityRecordEdits","getEntityRecordNonTransientEdits","transientEdits","acc","isAutosavingEntityRecord","pending","isAutosave","Boolean","isDeletingEntityRecord","getLastEntitySaveError","getLastEntityDeleteError","getCurrentUndoOffset","undo","offset","getUndoEdit","getRedoEdit","hasUndo","hasRedo","getCurrentTheme","currentTheme","__experimentalGetCurrentGlobalStylesId","currentGlobalStylesId","getThemeSupports","theme_supports","getEmbedPreview","embedPreviews","isPreviewEmbedFallback","preview","oEmbedLinkCheck","html","canUser","action","resource","join","canUserEditEntityRecord","__unstable_rest_base","getAutosaves","postType","postId","autosaves","getAutosave","authorId","author","hasFetchedAutosaves","hasFinishedResolution","getReferenceByDistinctEdits","flattenedUndo","__experimentalGetTemplateForLink","link","records","template","__experimentalGetCurrentThemeBaseGlobalSt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CAAEyF,YAAP,EAAsB;AACrB,WAAO,IAAP;AACA;;AACD,SAAOzF,KAAK,CAAC0H,qBAAN,CAA6BjC,YAAY,CAACkC,UAA1C,CAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport createSelector from 'rememo';\nimport { set, map, find, get, filter, compact } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { createRegistrySelector } from '@wordpress/data';\nimport { addQueryArgs } from '@wordpress/url';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { STORE_NAME } from './name';\nimport { getQueriedItems } from './queried-data';\nimport { DEFAULT_ENTITY_KEY } from './entities';\nimport { getNormalizedCommaSeparable, isRawAttribute } from './utils';\n\n/**\n * Shared reference to an empty object for cases where it is important to avoid\n * returning a new object reference on every invocation, as in a connected or\n * other pure component which performs `shouldComponentUpdate` check on props.\n * This should be used as a last resort, since the normalized data should be\n * maintained by the reducer result in state.\n */\nconst EMPTY_OBJECT = {};\n\n/**\n * Shared reference to an empty array for cases where it is important to avoid\n * returning a new array reference on every invocation, as in a connected or\n * other pure component which performs `shouldComponentUpdate` check on props.\n * This should be used as a last resort, since the normalized data should be\n * maintained by the reducer result in state.\n *\n * @type {Array}\n */\nconst EMPTY_ARRAY = [];\n\n/**\n * Returns true if a request is in progress for embed preview data, or false\n * otherwise.\n *\n * @param {Object} state Data state.\n * @param {string} url URL the preview would be for.\n *\n * @return {boolean} Whether a request is in progress for an embed preview.\n */\nexport const isRequestingEmbedPreview = createRegistrySelector(\n\t( select ) => ( state, url ) => {\n\t\treturn select( STORE_NAME ).isResolving( 'getEmbedPreview', [ url ] );\n\t}\n);\n\n/**\n * Returns all available authors.\n *\n * @deprecated since 11.3. Callers should use `select( 'core' ).getUsers({ who: 'authors' })` instead.\n *\n * @param {Object} state Data state.\n * @param {Object|undefined} query Optional object of query parameters to\n * include with request.\n * @return {Array} Authors list.\n */\nexport function getAuthors( state, query ) {\n\tdeprecated( \"select( 'core' ).getAuthors()\", {\n\t\tsince: '5.9',\n\t\talternative: \"select( 'core' ).getUsers({ who: 'authors' })\",\n\t} );\n\n\tconst path = addQueryArgs(\n\t\t'/wp/v2/users/?who=authors&per_page=100',\n\t\tquery\n\t);\n\treturn getUserQueryResults( state, path );\n}\n\n/**\n * Returns the current user.\n *\n * @param {Object} state Data state.\n *\n * @return {Object} Current user object.\n */\nexport function getCurrentUser( state ) {\n\treturn state.currentUser;\n}\n\n/**\n * Returns all the users returned by a query ID.\n *\n * @param {Object} state Data state.\n * @param {string} queryID Query ID.\n *\n * @return {Array} Users list.\n */\nexport const getUserQueryResults = createSelector(\n\t( state, queryID ) => {\n\t\tconst queryResults = state.users.queries[ queryID ];\n\n\t\treturn map( queryResults, ( id ) => state.users.byId[ id ] );\n\t},\n\t( state, queryID ) => [ state.users.queries[ queryID ], state.users.byId ]\n);\n\n/**\n * Returns whether the entities for the give kind are loaded.\n *\n * @param {Object} state Data state.\n * @param {string} kind Entity kind.\n *\n * @return {Array<Object>} Array of entities with config matching kind.\n */\nexport function getEntitiesByKind( state, kind ) {\n\treturn filter( state.entities.config, { kind } );\n}\n\n/**\n * Returns the entity object given its kind and name.\n *\n * @param {Object} state Data state.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n *\n * @return {Object} Entity\n */\nexport function getEntity( state, kind, name ) {\n\treturn find( state.entities.config, { kind, name } );\n}\n\n/**\n * Returns the Entity's record object by key. Returns `null` if the value is not\n * yet received, undefined if the value entity is known to not exist, or the\n * entity object if it exists and is received.\n *\n * @param {Object} state State tree\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} key Record's key\n * @param {?Object} query Optional query.\n *\n * @return {Object?} Record.\n */\nexport const getEntityRecord = createSelector(\n\t( state, kind, name, key, query ) => {\n\t\tconst queriedState = get( state.entities.data, [\n\t\t\tkind,\n\t\t\tname,\n\t\t\t'queriedData',\n\t\t] );\n\t\tif ( ! queriedState ) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst context = query?.context ?? 'default';\n\n\t\tif ( query === undefined ) {\n\t\t\t// If expecting a complete item, validate that completeness.\n\t\t\tif ( ! queriedState.itemIsComplete[ context ]?.[ key ] ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\treturn queriedState.items[ context ][ key ];\n\t\t}\n\n\t\tconst item = queriedState.items[ context ]?.[ key ];\n\t\tif ( item && query._fields ) {\n\t\t\tconst filteredItem = {};\n\t\t\tconst fields = getNormalizedCommaSeparable( query._fields );\n\t\t\tfor ( let f = 0; f < fields.length; f++ ) {\n\t\t\t\tconst field = fields[ f ].split( '.' );\n\t\t\t\tconst value = get( item, field );\n\t\t\t\tset( filteredItem, field, value );\n\t\t\t}\n\t\t\treturn filteredItem;\n\t\t}\n\n\t\treturn item;\n\t},\n\t( state, kind, name, recordId, query ) => {\n\t\tconst context = query?.context ?? 'default';\n\t\treturn [\n\t\t\tget( state.entities.data, [\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\t'queriedData',\n\t\t\t\t'items',\n\t\t\t\tcontext,\n\t\t\t\trecordId,\n\t\t\t] ),\n\t\t\tget( state.entities.data, [\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\t'queriedData',\n\t\t\t\t'itemIsComplete',\n\t\t\t\tcontext,\n\t\t\t\trecordId,\n\t\t\t] ),\n\t\t];\n\t}\n);\n\n/**\n * Returns the Entity's record object by key. Doesn't trigger a resolver nor requests the entity from the API if the entity record isn't available in the local state.\n *\n * @param {Object} state State tree\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} key Record's key\n *\n * @return {Object|null} Record.\n */\nexport function __experimentalGetEntityRecordNoResolver(\n\tstate,\n\tkind,\n\tname,\n\tkey\n) {\n\treturn getEntityRecord( state, kind, name, key );\n}\n\n/**\n * Returns the entity's record object by key,\n * with its attributes mapped to their raw values.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} key Record's key.\n *\n * @return {Object?} Object with the entity's raw attributes.\n */\nexport const getRawEntityRecord = createSelector(\n\t( state, kind, name, key ) => {\n\t\tconst record = getEntityRecord( state, kind, name, key );\n\t\treturn (\n\t\t\trecord &&\n\t\t\tObject.keys( record ).reduce( ( accumulator, _key ) => {\n\t\t\t\tif ( isRawAttribute( getEntity( state, kind, name ), _key ) ) {\n\t\t\t\t\t// Because edits are the \"raw\" attribute values,\n\t\t\t\t\t// we return those from record selectors to make rendering,\n\t\t\t\t\t// comparisons, and joins with edits easier.\n\t\t\t\t\taccumulator[ _key ] = get(\n\t\t\t\t\t\trecord[ _key ],\n\t\t\t\t\t\t'raw',\n\t\t\t\t\t\trecord[ _key ]\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\taccumulator[ _key ] = record[ _key ];\n\t\t\t\t}\n\t\t\t\treturn accumulator;\n\t\t\t}, {} )\n\t\t);\n\t},\n\t( state, kind, name, recordId, query ) => {\n\t\tconst context = query?.context ?? 'default';\n\t\treturn [\n\t\t\tstate.entities.config,\n\t\t\tget( state.entities.data, [\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\t'queriedData',\n\t\t\t\t'items',\n\t\t\t\tcontext,\n\t\t\t\trecordId,\n\t\t\t] ),\n\t\t\tget( state.entities.data, [\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\t'queriedData',\n\t\t\t\t'itemIsComplete',\n\t\t\t\tcontext,\n\t\t\t\trecordId,\n\t\t\t] ),\n\t\t];\n\t}\n);\n\n/**\n * Returns true if records have been received for the given set of parameters,\n * or false otherwise.\n *\n * @param {Object} state State tree\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {?Object} query Optional terms query.\n *\n * @return {boolean} Whether entity records have been received.\n */\nexport function hasEntityRecords( state, kind, name, query ) {\n\treturn Array.isArray( getEntityRecords( state, kind, name, query ) );\n}\n\n/**\n * Returns the Entity's records.\n *\n * @param {Object} state State tree\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {?Object} query Optional terms query.\n *\n * @return {?Array} Records.\n */\nexport function getEntityRecords( state, kind, name, query ) {\n\t// Queried data state is prepopulated for all known entities. If this is not\n\t// assigned for the given parameters, then it is known to not exist. Thus, a\n\t// return value of an empty array is used instead of `null` (where `null` is\n\t// otherwise used to represent an unknown state).\n\tconst queriedState = get( state.entities.data, [\n\t\tkind,\n\t\tname,\n\t\t'queriedData',\n\t] );\n\tif ( ! queriedState ) {\n\t\treturn EMPTY_ARRAY;\n\t}\n\treturn getQueriedItems( queriedState, query );\n}\n\n/**\n * Returns the list of dirty entity records.\n *\n * @param {Object} state State tree.\n *\n * @return {[{ title: string, key: string, name: string, kind: string }]} The list of updated records\n */\nexport const __experimentalGetDirtyEntityRecords = createSelector(\n\t( state ) => {\n\t\tconst {\n\t\t\tentities: { data },\n\t\t} = state;\n\t\tconst dirtyRecords = [];\n\t\tObject.keys( data ).forEach( ( kind ) => {\n\t\t\tObject.keys( data[ kind ] ).forEach( ( name ) => {\n\t\t\t\tconst primaryKeys = Object.keys(\n\t\t\t\t\tdata[ kind ][ name ].edits\n\t\t\t\t).filter(\n\t\t\t\t\t( primaryKey ) =>\n\t\t\t\t\t\t// The entity record must exist (not be deleted),\n\t\t\t\t\t\t// and it must have edits.\n\t\t\t\t\t\tgetEntityRecord( state, kind, name, primaryKey ) &&\n\t\t\t\t\t\thasEditsForEntityRecord( state, kind, name, primaryKey )\n\t\t\t\t);\n\n\t\t\t\tif ( primaryKeys.length ) {\n\t\t\t\t\tconst entity = getEntity( state, kind, name );\n\t\t\t\t\tprimaryKeys.forEach( ( primaryKey ) => {\n\t\t\t\t\t\tconst entityRecord = getEditedEntityRecord(\n\t\t\t\t\t\t\tstate,\n\t\t\t\t\t\t\tkind,\n\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\tprimaryKey\n\t\t\t\t\t\t);\n\t\t\t\t\t\tdirtyRecords.push( {\n\t\t\t\t\t\t\t// We avoid using primaryKey because it's transformed into a string\n\t\t\t\t\t\t\t// when it's used as an object key.\n\t\t\t\t\t\t\tkey:\n\t\t\t\t\t\t\t\tentityRecord[\n\t\t\t\t\t\t\t\t\tentity.key || DEFAULT_ENTITY_KEY\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\ttitle: entity?.getTitle?.( entityRecord ) || '',\n\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\tkind,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\t\t} );\n\n\t\treturn dirtyRecords;\n\t},\n\t( state ) => [ state.entities.data ]\n);\n\n/**\n * Returns the list of entities currently being saved.\n *\n * @param {Object} state State tree.\n *\n * @return {[{ title: string, key: string, name: string, kind: string }]} The list of records being saved.\n */\nexport const __experimentalGetEntitiesBeingSaved = createSelector(\n\t( state ) => {\n\t\tconst {\n\t\t\tentities: { data },\n\t\t} = state;\n\t\tconst recordsBeingSaved = [];\n\t\tObject.keys( data ).forEach( ( kind ) => {\n\t\t\tObject.keys( data[ kind ] ).forEach( ( name ) => {\n\t\t\t\tconst primaryKeys = Object.keys(\n\t\t\t\t\tdata[ kind ][ name ].saving\n\t\t\t\t).filter( ( primaryKey ) =>\n\t\t\t\t\tisSavingEntityRecord( state, kind, name, primaryKey )\n\t\t\t\t);\n\n\t\t\t\tif ( primaryKeys.length ) {\n\t\t\t\t\tconst entity = getEntity( state, kind, name );\n\t\t\t\t\tprimaryKeys.forEach( ( primaryKey ) => {\n\t\t\t\t\t\tconst entityRecord = getEditedEntityRecord(\n\t\t\t\t\t\t\tstate,\n\t\t\t\t\t\t\tkind,\n\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\tprimaryKey\n\t\t\t\t\t\t);\n\t\t\t\t\t\trecordsBeingSaved.push( {\n\t\t\t\t\t\t\t// We avoid using primaryKey because it's transformed into a string\n\t\t\t\t\t\t\t// when it's used as an object key.\n\t\t\t\t\t\t\tkey:\n\t\t\t\t\t\t\t\tentityRecord[\n\t\t\t\t\t\t\t\t\tentity.key || DEFAULT_ENTITY_KEY\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\ttitle: entity?.getTitle?.( entityRecord ) || '',\n\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\tkind,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\t\t} );\n\t\treturn recordsBeingSaved;\n\t},\n\t( state ) => [ state.entities.data ]\n);\n\n/**\n * Returns the specified entity record's edits.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {Object?} The entity record's edits.\n */\nexport function getEntityRecordEdits( state, kind, name, recordId ) {\n\treturn get( state.entities.data, [ kind, name, 'edits', recordId ] );\n}\n\n/**\n * Returns the specified entity record's non transient edits.\n *\n * Transient edits don't create an undo level, and\n * are not considered for change detection.\n * They are defined in the entity's config.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {Object?} The entity record's non transient edits.\n */\nexport const getEntityRecordNonTransientEdits = createSelector(\n\t( state, kind, name, recordId ) => {\n\t\tconst { transientEdits } = getEntity( state, kind, name ) || {};\n\t\tconst edits = getEntityRecordEdits( state, kind, name, recordId ) || {};\n\t\tif ( ! transientEdits ) {\n\t\t\treturn edits;\n\t\t}\n\t\treturn Object.keys( edits ).reduce( ( acc, key ) => {\n\t\t\tif ( ! transientEdits[ key ] ) {\n\t\t\t\tacc[ key ] = edits[ key ];\n\t\t\t}\n\t\t\treturn acc;\n\t\t}, {} );\n\t},\n\t( state, kind, name, recordId ) => [\n\t\tstate.entities.config,\n\t\tget( state.entities.data, [ kind, name, 'edits', recordId ] ),\n\t]\n);\n\n/**\n * Returns true if the specified entity record has edits,\n * and false otherwise.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {boolean} Whether the entity record has edits or not.\n */\nexport function hasEditsForEntityRecord( state, kind, name, recordId ) {\n\treturn (\n\t\tisSavingEntityRecord( state, kind, name, recordId ) ||\n\t\tObject.keys(\n\t\t\tgetEntityRecordNonTransientEdits( state, kind, name, recordId )\n\t\t).length > 0\n\t);\n}\n\n/**\n * Returns the specified entity record, merged with its edits.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {Object?} The entity record, merged with its edits.\n */\nexport const getEditedEntityRecord = createSelector(\n\t( state, kind, name, recordId ) => ( {\n\t\t...getRawEntityRecord( state, kind, name, recordId ),\n\t\t...getEntityRecordEdits( state, kind, name, recordId ),\n\t} ),\n\t( state, kind, name, recordId, query ) => {\n\t\tconst context = query?.context ?? 'default';\n\t\treturn [\n\t\t\tstate.entities.config,\n\t\t\tget( state.entities.data, [\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\t'queriedData',\n\t\t\t\t'items',\n\t\t\t\tcontext,\n\t\t\t\trecordId,\n\t\t\t] ),\n\t\t\tget( state.entities.data, [\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\t'queriedData',\n\t\t\t\t'itemIsComplete',\n\t\t\t\tcontext,\n\t\t\t\trecordId,\n\t\t\t] ),\n\t\t\tget( state.entities.data, [ kind, name, 'edits', recordId ] ),\n\t\t];\n\t}\n);\n\n/**\n * Returns true if the specified entity record is autosaving, and false otherwise.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {boolean} Whether the entity record is autosaving or not.\n */\nexport function isAutosavingEntityRecord( state, kind, name, recordId ) {\n\tconst { pending, isAutosave } = get(\n\t\tstate.entities.data,\n\t\t[ kind, name, 'saving', recordId ],\n\t\t{}\n\t);\n\treturn Boolean( pending && isAutosave );\n}\n\n/**\n * Returns true if the specified entity record is saving, and false otherwise.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {boolean} Whether the entity record is saving or not.\n */\nexport function isSavingEntityRecord( state, kind, name, recordId ) {\n\treturn get(\n\t\tstate.entities.data,\n\t\t[ kind, name, 'saving', recordId, 'pending' ],\n\t\tfalse\n\t);\n}\n\n/**\n * Returns true if the specified entity record is deleting, and false otherwise.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {boolean} Whether the entity record is deleting or not.\n */\nexport function isDeletingEntityRecord( state, kind, name, recordId ) {\n\treturn get(\n\t\tstate.entities.data,\n\t\t[ kind, name, 'deleting', recordId, 'pending' ],\n\t\tfalse\n\t);\n}\n\n/**\n * Returns the specified entity record's last save error.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {Object?} The entity record's save error.\n */\nexport function getLastEntitySaveError( state, kind, name, recordId ) {\n\treturn get( state.entities.data, [\n\t\tkind,\n\t\tname,\n\t\t'saving',\n\t\trecordId,\n\t\t'error',\n\t] );\n}\n\n/**\n * Returns the specified entity record's last delete error.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {Object?} The entity record's save error.\n */\nexport function getLastEntityDeleteError( state, kind, name, recordId ) {\n\treturn get( state.entities.data, [\n\t\tkind,\n\t\tname,\n\t\t'deleting',\n\t\trecordId,\n\t\t'error',\n\t] );\n}\n\n/**\n * Returns the current undo offset for the\n * entity records edits history. The offset\n * represents how many items from the end\n * of the history stack we are at. 0 is the\n * last edit, -1 is the second last, and so on.\n *\n * @param {Object} state State tree.\n *\n * @return {number} The current undo offset.\n */\nfunction getCurrentUndoOffset( state ) {\n\treturn state.undo.offset;\n}\n\n/**\n * Returns the previous edit from the current undo offset\n * for the entity records edits history, if any.\n *\n * @param {Object} state State tree.\n *\n * @return {Object?} The edit.\n */\nexport function getUndoEdit( state ) {\n\treturn state.undo[ state.undo.length - 2 + getCurrentUndoOffset( state ) ];\n}\n\n/**\n * Returns the next edit from the current undo offset\n * for the entity records edits history, if any.\n *\n * @param {Object} state State tree.\n *\n * @return {Object?} The edit.\n */\nexport function getRedoEdit( state ) {\n\treturn state.undo[ state.undo.length + getCurrentUndoOffset( state ) ];\n}\n\n/**\n * Returns true if there is a previous edit from the current undo offset\n * for the entity records edits history, and false otherwise.\n *\n * @param {Object} state State tree.\n *\n * @return {boolean} Whether there is a previous edit or not.\n */\nexport function hasUndo( state ) {\n\treturn Boolean( getUndoEdit( state ) );\n}\n\n/**\n * Returns true if there is a next edit from the current undo offset\n * for the entity records edits history, and false otherwise.\n *\n * @param {Object} state State tree.\n *\n * @return {boolean} Whether there is a next edit or not.\n */\nexport function hasRedo( state ) {\n\treturn Boolean( getRedoEdit( state ) );\n}\n\n/**\n * Return the current theme.\n *\n * @param {Object} state Data state.\n *\n * @return {Object} The current theme.\n */\nexport function getCurrentTheme( state ) {\n\treturn getEntityRecord( state, 'root', 'theme', state.currentTheme );\n}\n\n/**\n * Return the ID of the current global styles object.\n *\n * @param {Object} state Data state.\n *\n * @return {string} The current global styles ID.\n */\nexport function __experimentalGetCurrentGlobalStylesId( state ) {\n\treturn state.currentGlobalStylesId;\n}\n\n/**\n * Return theme supports data in the index.\n *\n * @param {Object} state Data state.\n *\n * @return {*} Index data.\n */\nexport function getThemeSupports( state ) {\n\treturn getCurrentTheme( state )?.theme_supports ?? EMPTY_OBJECT;\n}\n\n/**\n * Returns the embed preview for the given URL.\n *\n * @param {Object} state Data state.\n * @param {string} url Embedded URL.\n *\n * @return {*} Undefined if the preview has not been fetched, otherwise, the preview fetched from the embed preview API.\n */\nexport function getEmbedPreview( state, url ) {\n\treturn state.embedPreviews[ url ];\n}\n\n/**\n * Determines if the returned preview is an oEmbed link fallback.\n *\n * WordPress can be configured to return a simple link to a URL if it is not embeddable.\n * We need to be able to determine if a URL is embeddable or not, based on what we\n * get back from the oEmbed preview API.\n *\n * @param {Object} state Data state.\n * @param {string} url Embedded URL.\n *\n * @return {boolean} Is the preview for the URL an oEmbed link fallback.\n */\nexport function isPreviewEmbedFallback( state, url ) {\n\tconst preview = state.embedPreviews[ url ];\n\tconst oEmbedLinkCheck = '<a href=\"' + url + '\">' + url + '</a>';\n\tif ( ! preview ) {\n\t\treturn false;\n\t}\n\treturn preview.html === oEmbedLinkCheck;\n}\n\n/**\n * Returns whether the current user can perform the given action on the given\n * REST resource.\n *\n * Calling this may trigger an OPTIONS request to the REST API via the\n * `canUser()` resolver.\n *\n * https://developer.wordpress.org/rest-api/reference/\n *\n * @param {Object} state Data state.\n * @param {string} action Action to check. One of: 'create', 'read', 'update', 'delete'.\n * @param {string} resource REST resource to check, e.g. 'media' or 'posts'.\n * @param {string=} id Optional ID of the rest resource to check.\n *\n * @return {boolean|undefined} Whether or not the user can perform the action,\n * or `undefined` if the OPTIONS request is still being made.\n */\nexport function canUser( state, action, resource, id ) {\n\tconst key = compact( [ action, resource, id ] ).join( '/' );\n\treturn get( state, [ 'userPermissions', key ] );\n}\n\n/**\n * Returns whether the current user can edit the given entity.\n *\n * Calling this may trigger an OPTIONS request to the REST API via the\n * `canUser()` resolver.\n *\n * https://developer.wordpress.org/rest-api/reference/\n *\n * @param {Object} state Data state.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {string} recordId Record's id.\n * @return {boolean|undefined} Whether or not the user can edit,\n * or `undefined` if the OPTIONS request is still being made.\n */\nexport function canUserEditEntityRecord( state, kind, name, recordId ) {\n\tconst entity = getEntity( state, kind, name );\n\tif ( ! entity ) {\n\t\treturn false;\n\t}\n\tconst resource = entity.__unstable_rest_base;\n\n\treturn canUser( state, 'update', resource, recordId );\n}\n\n/**\n * Returns the latest autosaves for the post.\n *\n * May return multiple autosaves since the backend stores one autosave per\n * author for each post.\n *\n * @param {Object} state State tree.\n * @param {string} postType The type of the parent post.\n * @param {number} postId The id of the parent post.\n *\n * @return {?Array} An array of autosaves for the post, or undefined if there is none.\n */\nexport function getAutosaves( state, postType, postId ) {\n\treturn state.autosaves[ postId ];\n}\n\n/**\n * Returns the autosave for the post and author.\n *\n * @param {Object} state State tree.\n * @param {string} postType The type of the parent post.\n * @param {number} postId The id of the parent post.\n * @param {number} authorId The id of the author.\n *\n * @return {?Object} The autosave for the post and author.\n */\nexport function getAutosave( state, postType, postId, authorId ) {\n\tif ( authorId === undefined ) {\n\t\treturn;\n\t}\n\n\tconst autosaves = state.autosaves[ postId ];\n\treturn find( autosaves, { author: authorId } );\n}\n\n/**\n * Returns true if the REST request for autosaves has completed.\n *\n * @param {Object} state State tree.\n * @param {string} postType The type of the parent post.\n * @param {number} postId The id of the parent post.\n *\n * @return {boolean} True if the REST request was completed. False otherwise.\n */\nexport const hasFetchedAutosaves = createRegistrySelector(\n\t( select ) => ( state, postType, postId ) => {\n\t\treturn select( STORE_NAME ).hasFinishedResolution( 'getAutosaves', [\n\t\t\tpostType,\n\t\t\tpostId,\n\t\t] );\n\t}\n);\n\n/**\n * Returns a new reference when edited values have changed. This is useful in\n * inferring where an edit has been made between states by comparison of the\n * return values using strict equality.\n *\n * @example\n *\n * ```\n * const hasEditOccurred = (\n * getReferenceByDistinctEdits( beforeState ) !==\n * getReferenceByDistinctEdits( afterState )\n * );\n * ```\n *\n * @param {Object} state Editor state.\n *\n * @return {*} A value whose reference will change only when an edit occurs.\n */\nexport const getReferenceByDistinctEdits = createSelector(\n\t() => [],\n\t( state ) => [\n\t\tstate.undo.length,\n\t\tstate.undo.offset,\n\t\tstate.undo.flattenedUndo,\n\t]\n);\n\n/**\n * Retrieve the frontend template used for a given link.\n *\n * @param {Object} state Editor state.\n * @param {string} link Link.\n *\n * @return {Object?} The template record.\n */\nexport function __experimentalGetTemplateForLink( state, link ) {\n\tconst records = getEntityRecords( state, 'postType', 'wp_template', {\n\t\t'find-template': link,\n\t} );\n\n\tconst template = records?.length ? records[ 0 ] : null;\n\tif ( template ) {\n\t\treturn getEditedEntityRecord(\n\t\t\tstate,\n\t\t\t'postType',\n\t\t\t'wp_template',\n\t\t\ttemplate.id\n\t\t);\n\t}\n\treturn template;\n}\n\n/**\n * Retrieve the current theme's base global styles\n *\n * @param {Object} state Editor state.\n *\n * @return {Object?} The Global Styles object.\n */\nexport function __experimentalGetCurrentThemeBaseGlobalStyles( state ) {\n\tconst currentTheme = getCurrentTheme( state );\n\tif ( ! currentTheme ) {\n\t\treturn null;\n\t}\n\treturn state.themeBaseGlobalStyles[ currentTheme.stylesheet ];\n}\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Higher-order function which forward the resolution to another resolver with the same arguments.
|
|
3
|
+
*
|
|
4
|
+
* @param {string} resolverName forwarded resolver.
|
|
5
|
+
*
|
|
6
|
+
* @return {Function} Enhanced resolver.
|
|
7
|
+
*/
|
|
8
|
+
const forwardResolver = resolverName => function () {
|
|
9
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
10
|
+
args[_key] = arguments[_key];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return async _ref => {
|
|
14
|
+
let {
|
|
15
|
+
resolveSelect
|
|
16
|
+
} = _ref;
|
|
17
|
+
await resolveSelect[resolverName](...args);
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export default forwardResolver;
|
|
22
|
+
//# sourceMappingURL=forward-resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/core-data/src/utils/forward-resolver.js"],"names":["forwardResolver","resolverName","args","resolveSelect"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,eAAe,GAAKC,YAAF,IAAoB;AAAA,oCAAKC,IAAL;AAAKA,IAAAA,IAAL;AAAA;;AAAA,SAAe,cAEpD;AAAA,QAF4D;AAClEC,MAAAA;AADkE,KAE5D;AACN,UAAMA,aAAa,CAAEF,YAAF,CAAb,CAA+B,GAAGC,IAAlC,CAAN;AACA,GAJ2C;AAAA,CAA5C;;AAMA,eAAeF,eAAf","sourcesContent":["/**\n * Higher-order function which forward the resolution to another resolver with the same arguments.\n *\n * @param {string} resolverName forwarded resolver.\n *\n * @return {Function} Enhanced resolver.\n */\nconst forwardResolver = ( resolverName ) => ( ...args ) => async ( {\n\tresolveSelect,\n} ) => {\n\tawait resolveSelect[ resolverName ]( ...args );\n};\n\nexport default forwardResolver;\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { default as conservativeMapItem } from './conservative-map-item';
|
|
2
2
|
export { default as getNormalizedCommaSeparable } from './get-normalized-comma-separable';
|
|
3
3
|
export { default as ifMatchingAction } from './if-matching-action';
|
|
4
|
-
export { default as
|
|
4
|
+
export { default as forwardResolver } from './forward-resolver';
|
|
5
5
|
export { default as onSubKey } from './on-sub-key';
|
|
6
6
|
export { default as replaceAction } from './replace-action';
|
|
7
7
|
export { default as withWeakMapCache } from './with-weak-map-cache';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/core-data/src/utils/index.js"],"names":["default","conservativeMapItem","getNormalizedCommaSeparable","ifMatchingAction","
|
|
1
|
+
{"version":3,"sources":["@wordpress/core-data/src/utils/index.js"],"names":["default","conservativeMapItem","getNormalizedCommaSeparable","ifMatchingAction","forwardResolver","onSubKey","replaceAction","withWeakMapCache","isRawAttribute"],"mappings":"AAAA,SAASA,OAAO,IAAIC,mBAApB,QAA+C,yBAA/C;AACA,SAASD,OAAO,IAAIE,2BAApB,QAAuD,kCAAvD;AACA,SAASF,OAAO,IAAIG,gBAApB,QAA4C,sBAA5C;AACA,SAASH,OAAO,IAAII,eAApB,QAA2C,oBAA3C;AACA,SAASJ,OAAO,IAAIK,QAApB,QAAoC,cAApC;AACA,SAASL,OAAO,IAAIM,aAApB,QAAyC,kBAAzC;AACA,SAASN,OAAO,IAAIO,gBAApB,QAA4C,uBAA5C;AACA,SAASP,OAAO,IAAIQ,cAApB,QAA0C,oBAA1C","sourcesContent":["export { default as conservativeMapItem } from './conservative-map-item';\nexport { default as getNormalizedCommaSeparable } from './get-normalized-comma-separable';\nexport { default as ifMatchingAction } from './if-matching-action';\nexport { default as forwardResolver } from './forward-resolver';\nexport { default as onSubKey } from './on-sub-key';\nexport { default as replaceAction } from './replace-action';\nexport { default as withWeakMapCache } from './with-weak-map-cache';\nexport { default as isRawAttribute } from './is-raw-attribute';\n"]}
|
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @return {Function} Higher-order reducer.
|
|
8
8
|
*/
|
|
9
|
-
export const onSubKey = actionProperty => reducer => (
|
|
9
|
+
export const onSubKey = actionProperty => reducer => function () {
|
|
10
|
+
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
11
|
+
let action = arguments.length > 1 ? arguments[1] : undefined;
|
|
10
12
|
// Retrieve subkey from action. Do not track if undefined; useful for cases
|
|
11
13
|
// where reducer is scoped by action shape.
|
|
12
14
|
const key = action[actionProperty];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/core-data/src/utils/on-sub-key.js"],"names":["onSubKey","actionProperty","reducer","state","action","key","undefined","nextKeyState"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,QAAQ,GAAKC,cAAF,IAAwBC,OAAF,IAAe,
|
|
1
|
+
{"version":3,"sources":["@wordpress/core-data/src/utils/on-sub-key.js"],"names":["onSubKey","actionProperty","reducer","state","action","key","undefined","nextKeyState"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,QAAQ,GAAKC,cAAF,IAAwBC,OAAF,IAAe,YAGxD;AAAA,MAFJC,KAEI,uEAFI,EAEJ;AAAA,MADJC,MACI;AACJ;AACA;AACA,QAAMC,GAAG,GAAGD,MAAM,CAAEH,cAAF,CAAlB;;AACA,MAAKI,GAAG,KAAKC,SAAb,EAAyB;AACxB,WAAOH,KAAP;AACA,GANG,CAQJ;AACA;;;AACA,QAAMI,YAAY,GAAGL,OAAO,CAAEC,KAAK,CAAEE,GAAF,CAAP,EAAgBD,MAAhB,CAA5B;;AACA,MAAKG,YAAY,KAAKJ,KAAK,CAAEE,GAAF,CAA3B,EAAqC;AACpC,WAAOF,KAAP;AACA;;AAED,SAAO,EACN,GAAGA,KADG;AAEN,KAAEE,GAAF,GAASE;AAFH,GAAP;AAIA,CAtBM;AAwBP,eAAeP,QAAf","sourcesContent":["/**\n * Higher-order reducer creator which creates a combined reducer object, keyed\n * by a property on the action object.\n *\n * @param {string} actionProperty Action property by which to key object.\n *\n * @return {Function} Higher-order reducer.\n */\nexport const onSubKey = ( actionProperty ) => ( reducer ) => (\n\tstate = {},\n\taction\n) => {\n\t// Retrieve subkey from action. Do not track if undefined; useful for cases\n\t// where reducer is scoped by action shape.\n\tconst key = action[ actionProperty ];\n\tif ( key === undefined ) {\n\t\treturn state;\n\t}\n\n\t// Avoid updating state if unchanged. Note that this also accounts for a\n\t// reducer which returns undefined on a key which is not yet tracked.\n\tconst nextKeyState = reducer( state[ key ], action );\n\tif ( nextKeyState === state[ key ] ) {\n\t\treturn state;\n\t}\n\n\treturn {\n\t\t...state,\n\t\t[ key ]: nextKeyState,\n\t};\n};\n\nexport default onSubKey;\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/core-data",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.8",
|
|
4
4
|
"description": "Access to and manipulation of core WordPress entities.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -29,16 +29,16 @@
|
|
|
29
29
|
"{src,build,build-module}/index.js"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@babel/runtime": "^7.
|
|
33
|
-
"@wordpress/api-fetch": "^5.2.
|
|
34
|
-
"@wordpress/blocks": "^11.1.
|
|
35
|
-
"@wordpress/data": "^6.1.
|
|
36
|
-
"@wordpress/deprecated": "^3.2.
|
|
37
|
-
"@wordpress/element": "^4.0.
|
|
38
|
-
"@wordpress/html-entities": "^3.2.
|
|
39
|
-
"@wordpress/i18n": "^4.2.
|
|
40
|
-
"@wordpress/is-shallow-equal": "^4.2.
|
|
41
|
-
"@wordpress/url": "^3.
|
|
32
|
+
"@babel/runtime": "^7.16.0",
|
|
33
|
+
"@wordpress/api-fetch": "^5.2.6",
|
|
34
|
+
"@wordpress/blocks": "^11.1.4",
|
|
35
|
+
"@wordpress/data": "^6.1.4",
|
|
36
|
+
"@wordpress/deprecated": "^3.2.3",
|
|
37
|
+
"@wordpress/element": "^4.0.4",
|
|
38
|
+
"@wordpress/html-entities": "^3.2.3",
|
|
39
|
+
"@wordpress/i18n": "^4.2.4",
|
|
40
|
+
"@wordpress/is-shallow-equal": "^4.2.1",
|
|
41
|
+
"@wordpress/url": "^3.3.1",
|
|
42
42
|
"equivalent-key-map": "^0.2.2",
|
|
43
43
|
"lodash": "^4.17.21",
|
|
44
44
|
"rememo": "^3.0.0",
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"publishConfig": {
|
|
48
48
|
"access": "public"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "6d3bd917064b4b194677233ee426f5988fa441b9"
|
|
51
51
|
}
|
package/src/actions.js
CHANGED
|
@@ -9,6 +9,7 @@ import { v4 as uuid } from 'uuid';
|
|
|
9
9
|
*/
|
|
10
10
|
import apiFetch from '@wordpress/api-fetch';
|
|
11
11
|
import { addQueryArgs } from '@wordpress/url';
|
|
12
|
+
import deprecated from '@wordpress/deprecated';
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* Internal dependencies
|
|
@@ -117,17 +118,55 @@ export function receiveCurrentTheme( currentTheme ) {
|
|
|
117
118
|
};
|
|
118
119
|
}
|
|
119
120
|
|
|
121
|
+
/**
|
|
122
|
+
* Returns an action object used in signalling that the current global styles id has been received.
|
|
123
|
+
*
|
|
124
|
+
* @param {string} currentGlobalStylesId The current global styles id.
|
|
125
|
+
*
|
|
126
|
+
* @return {Object} Action object.
|
|
127
|
+
*/
|
|
128
|
+
export function __experimentalReceiveCurrentGlobalStylesId(
|
|
129
|
+
currentGlobalStylesId
|
|
130
|
+
) {
|
|
131
|
+
return {
|
|
132
|
+
type: 'RECEIVE_CURRENT_GLOBAL_STYLES_ID',
|
|
133
|
+
id: currentGlobalStylesId,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Returns an action object used in signalling that the theme base global styles have been received
|
|
139
|
+
*
|
|
140
|
+
* @param {string} stylesheet The theme's identifier
|
|
141
|
+
* @param {Object} globalStyles The global styles object.
|
|
142
|
+
*
|
|
143
|
+
* @return {Object} Action object.
|
|
144
|
+
*/
|
|
145
|
+
export function __experimentalReceiveThemeBaseGlobalStyles(
|
|
146
|
+
stylesheet,
|
|
147
|
+
globalStyles
|
|
148
|
+
) {
|
|
149
|
+
return {
|
|
150
|
+
type: 'RECEIVE_THEME_GLOBAL_STYLES',
|
|
151
|
+
stylesheet,
|
|
152
|
+
globalStyles,
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
|
|
120
156
|
/**
|
|
121
157
|
* Returns an action object used in signalling that the index has been received.
|
|
122
158
|
*
|
|
123
|
-
* @
|
|
159
|
+
* @deprecated since WP 5.9, this is not useful anymore, use the selector direclty.
|
|
124
160
|
*
|
|
125
161
|
* @return {Object} Action object.
|
|
126
162
|
*/
|
|
127
|
-
export function receiveThemeSupports(
|
|
163
|
+
export function receiveThemeSupports() {
|
|
164
|
+
deprecated( "wp.data.dispatch( 'core' ).receiveThemeSupports", {
|
|
165
|
+
since: '5.9',
|
|
166
|
+
} );
|
|
167
|
+
|
|
128
168
|
return {
|
|
129
|
-
type: '
|
|
130
|
-
themeSupports,
|
|
169
|
+
type: 'DO_NOTHING',
|
|
131
170
|
};
|
|
132
171
|
}
|
|
133
172
|
|
|
@@ -605,12 +644,19 @@ export const saveEditedEntityRecord = (
|
|
|
605
644
|
if ( ! select.hasEditsForEntityRecord( kind, name, recordId ) ) {
|
|
606
645
|
return;
|
|
607
646
|
}
|
|
647
|
+
const entities = await dispatch( getKindEntities( kind ) );
|
|
648
|
+
const entity = find( entities, { kind, name } );
|
|
649
|
+
if ( ! entity ) {
|
|
650
|
+
return;
|
|
651
|
+
}
|
|
652
|
+
const entityIdKey = entity.key || DEFAULT_ENTITY_KEY;
|
|
653
|
+
|
|
608
654
|
const edits = select.getEntityRecordNonTransientEdits(
|
|
609
655
|
kind,
|
|
610
656
|
name,
|
|
611
657
|
recordId
|
|
612
658
|
);
|
|
613
|
-
const record = {
|
|
659
|
+
const record = { [ entityIdKey ]: recordId, ...edits };
|
|
614
660
|
return await dispatch.saveEntityRecord( kind, name, record, options );
|
|
615
661
|
};
|
|
616
662
|
|
package/src/entities.js
CHANGED
|
@@ -23,7 +23,7 @@ export const defaultEntities = [
|
|
|
23
23
|
label: __( 'Base' ),
|
|
24
24
|
name: '__unstableBase',
|
|
25
25
|
kind: 'root',
|
|
26
|
-
baseURL: '',
|
|
26
|
+
baseURL: '/',
|
|
27
27
|
},
|
|
28
28
|
{
|
|
29
29
|
label: __( 'Site' ),
|
|
@@ -104,7 +104,7 @@ export const defaultEntities = [
|
|
|
104
104
|
{
|
|
105
105
|
name: 'menu',
|
|
106
106
|
kind: 'root',
|
|
107
|
-
baseURL: '/
|
|
107
|
+
baseURL: '/wp/v2/menus',
|
|
108
108
|
baseURLParams: { context: 'edit' },
|
|
109
109
|
plural: 'menus',
|
|
110
110
|
label: __( 'Menu' ),
|
|
@@ -112,7 +112,7 @@ export const defaultEntities = [
|
|
|
112
112
|
{
|
|
113
113
|
name: 'menuItem',
|
|
114
114
|
kind: 'root',
|
|
115
|
-
baseURL: '/
|
|
115
|
+
baseURL: '/wp/v2/menu-items',
|
|
116
116
|
baseURLParams: { context: 'edit' },
|
|
117
117
|
plural: 'menuItems',
|
|
118
118
|
label: __( 'Menu Item' ),
|
|
@@ -121,12 +121,47 @@ export const defaultEntities = [
|
|
|
121
121
|
{
|
|
122
122
|
name: 'menuLocation',
|
|
123
123
|
kind: 'root',
|
|
124
|
-
baseURL: '/
|
|
124
|
+
baseURL: '/wp/v2/menu-locations',
|
|
125
125
|
baseURLParams: { context: 'edit' },
|
|
126
126
|
plural: 'menuLocations',
|
|
127
127
|
label: __( 'Menu Location' ),
|
|
128
128
|
key: 'name',
|
|
129
129
|
},
|
|
130
|
+
{
|
|
131
|
+
name: 'navigationArea',
|
|
132
|
+
kind: 'root',
|
|
133
|
+
baseURL: '/wp/v2/block-navigation-areas',
|
|
134
|
+
baseURLParams: { context: 'edit' },
|
|
135
|
+
plural: 'navigationAreas',
|
|
136
|
+
label: __( 'Navigation Area' ),
|
|
137
|
+
key: 'name',
|
|
138
|
+
getTitle: ( record ) => record?.description,
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
label: __( 'Global Styles' ),
|
|
142
|
+
name: 'globalStyles',
|
|
143
|
+
kind: 'root',
|
|
144
|
+
baseURL: '/wp/v2/global-styles',
|
|
145
|
+
baseURLParams: { context: 'edit' },
|
|
146
|
+
plural: 'globalStylesVariations', // should be different than name
|
|
147
|
+
getTitle: ( record ) => record?.title?.rendered || record?.title,
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
label: __( 'Themes' ),
|
|
151
|
+
name: 'theme',
|
|
152
|
+
kind: 'root',
|
|
153
|
+
baseURL: '/wp/v2/themes',
|
|
154
|
+
baseURLParams: { context: 'edit' },
|
|
155
|
+
key: 'stylesheet',
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
label: __( 'Plugins' ),
|
|
159
|
+
name: 'plugin',
|
|
160
|
+
kind: 'root',
|
|
161
|
+
baseURL: '/wp/v2/plugins',
|
|
162
|
+
baseURLParams: { context: 'edit' },
|
|
163
|
+
key: 'plugin',
|
|
164
|
+
},
|
|
130
165
|
];
|
|
131
166
|
|
|
132
167
|
export const kinds = [
|
|
@@ -175,9 +210,10 @@ async function loadPostTypeEntities() {
|
|
|
175
210
|
const isTemplate = [ 'wp_template', 'wp_template_part' ].includes(
|
|
176
211
|
name
|
|
177
212
|
);
|
|
213
|
+
const namespace = postType?.rest_namespace ?? 'wp/v2';
|
|
178
214
|
return {
|
|
179
215
|
kind: 'postType',
|
|
180
|
-
baseURL:
|
|
216
|
+
baseURL: `/${ namespace }/${ postType.rest_base }`,
|
|
181
217
|
baseURLParams: { context: 'edit' },
|
|
182
218
|
name,
|
|
183
219
|
label: postType.labels.singular_name,
|
|
@@ -207,9 +243,10 @@ async function loadTaxonomyEntities() {
|
|
|
207
243
|
path: '/wp/v2/taxonomies?context=edit',
|
|
208
244
|
} );
|
|
209
245
|
return map( taxonomies, ( taxonomy, name ) => {
|
|
246
|
+
const namespace = taxonomy?.rest_namespace ?? 'wp/v2';
|
|
210
247
|
return {
|
|
211
248
|
kind: 'taxonomy',
|
|
212
|
-
baseURL:
|
|
249
|
+
baseURL: `/${ namespace }/${ taxonomy.rest_base }`,
|
|
213
250
|
baseURLParams: { context: 'edit' },
|
|
214
251
|
name,
|
|
215
252
|
label: taxonomy.labels.singular_name,
|
|
@@ -45,7 +45,7 @@ const CACHE = new Map();
|
|
|
45
45
|
* @return {Promise< WPRemoteUrlData[] >} Remote URL data.
|
|
46
46
|
*/
|
|
47
47
|
const fetchUrlData = async ( url, options = {} ) => {
|
|
48
|
-
const endpoint = '/
|
|
48
|
+
const endpoint = '/wp-block-editor/v1/url-details';
|
|
49
49
|
|
|
50
50
|
const args = {
|
|
51
51
|
url: prependHTTP( url ),
|