[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-includes/js/dist/ -> core-data.js (summary)

(no description)

File Size: 5376 lines (164 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

ObservableSet:: (82 methods):
  regularFetch()
  getDispatch()
  receiveUserQuery()
  receiveCurrentUser()
  addEntities()
  receiveEntityRecords()
  receiveCurrentTheme()
  receiveThemeSupports()
  receiveEmbedPreview()
  actions_unstableCreateUndoLevel()
  receiveUploadPermissions()
  receiveUserPermission()
  receiveAutosaves()
  getNormalizedCommaSeparable()
  withWeakMapCache()
  getQueryParts()
  getContextFromAction()
  getMergedItemIds()
  reducer_items()
  itemIsComplete()
  deepCopyLocksTreePath()
  getNode()
  hasConflictingLock()
  reducer_locks()
  terms()
  reducer_users()
  reducer_currentUser()
  reducer_taxonomies()
  currentTheme()
  themes()
  themeSupports()
  reducer_entity()
  entitiesConfig()
  reducer_undo()
  embedPreviews()
  userPermissions()
  reducer_autosaves()
  getQueriedItemsUncached()
  getAuthors()
  __unstableGetAuthor()
  getCurrentUser()
  getEntitiesByKind()
  getEntity()
  getEntityRecord()
  __experimentalGetEntityRecordNoResolver()
  hasEntityRecords()
  getEntityRecords()
  getEntityRecordEdits()
  hasEditsForEntityRecord()
  isAutosavingEntityRecord()
  isSavingEntityRecord()
  isDeletingEntityRecord()
  getLastEntitySaveError()
  getLastEntityDeleteError()
  getCurrentUndoOffset()
  getUndoEdit()
  getRedoEdit()
  hasUndo()
  hasRedo()
  getCurrentTheme()
  getThemeSupports()
  getEmbedPreview()
  isPreviewEmbedFallback()
  canUser()
  canUserEditEntityRecord()
  getAutosaves()
  getAutosave()
  __experimentalGetTemplateForLink()
  __unstableGetPendingLockRequests()
  __unstableIsLockAvailable()
  EntityProvider()
  useEntityId()
  useEntityProp()
  useEntityBlockEditor()
  arrayOf()
  isObjectLike()
  createCache()
  isShallowEqual()
  getRootCache()
  getWeakMapCache()
  clear()
  callSelector()

Defines 82 functions

  __webpack_require__()
  getDefault()
  getModuleExports()
  rng()
  validate()
  stringify()
  v4()
  _typeof()
  _classCallCheck()
  _defineProperties()
  _createClass()
  getValuePair()
  EquivalentKeyMap()
  conservativeMapItem()
  receiveItems()
  removeItems()
  receiveQueriedItems()
  createBatch()

Class: ObservableSet  - X-Ref

regularFetch(url)   X-Ref
WordPress dependencies


getDispatch()   X-Ref
No description

receiveUserQuery(queryID, users)   X-Ref
Returns an action object used in signalling that authors have been received.

return: {Object} Action object.
param: {string}       queryID Query ID.
param: {Array|Object} users   Users received.

receiveCurrentUser(currentUser)   X-Ref
Returns an action used in signalling that the current user has been received.

return: {Object} Action object.
param: {Object} currentUser Current user object.

addEntities(entities)   X-Ref
Returns an action object used in adding new entities.

return: {Object} Action object.
param: {Array} entities  Entities received.

receiveEntityRecords(kind, name, records, query, invalidateCache = false, edits)   X-Ref
Returns an action object used in signalling that entity records have been received.

return: {Object} Action object.
param: {string}       kind            Kind of the received entity.
param: {string}       name            Name of the received entity.
param: {Array|Object} records         Records received.
param: {?Object}      query           Query Object.
param: {?boolean}     invalidateCache Should invalidate query caches.
param: {?Object}      edits           Edits to reset.

receiveCurrentTheme(currentTheme)   X-Ref
Returns an action object used in signalling that the current theme has been received.

return: {Object} Action object.
param: {Object} currentTheme The current theme.

receiveThemeSupports(themeSupports)   X-Ref
Returns an action object used in signalling that the index has been received.

return: {Object} Action object.
param: {Object} themeSupports Theme support for the current theme.

receiveEmbedPreview(url, preview)   X-Ref
Returns an action object used in signalling that the preview data for
a given URl has been received.

return: {Object} Action object.
param: {string}  url     URL to preview the embed for.
param: {*}       preview Preview data.

actions_unstableCreateUndoLevel()   X-Ref
No description

receiveUploadPermissions(hasUploadPermissions)   X-Ref
No description

receiveUserPermission(key, isAllowed)   X-Ref
Returns an action object used in signalling that the current user has
permission to perform an action on a REST resource.

return: {Object} Action object.
param: {string}  key       A key that represents the action and REST resource.
param: {boolean} isAllowed Whether or not the user can perform the action.

receiveAutosaves(postId, autosaves)   X-Ref
Returns an action object used in signalling that the autosaves for a
post have been received.

return: {Object} Action object.
param: {number}       postId    The id of the post that is parent to the autosave.
param: {Array|Object} autosaves An array of autosaves or singular autosave object.

getNormalizedCommaSeparable(value)   X-Ref
No description

withWeakMapCache(fn)   X-Ref
Given a function, returns an enhanced function which caches the result and
tracks in WeakMap. The result is only cached if the original function is
passed a valid object-like argument (requirement for WeakMap key).

return: {Function} Enhanced caching function.
param: {Function} fn Original function.

getQueryParts(query)   X-Ref
Given a query object, returns an object of parts, including pagination
details (`page` and `perPage`, or default values). All other properties are
encoded into a stable (idempotent) `stableKey` value.

return: {WPQueriedDataQueryParts} Query parts.
param: {Object} query Optional query object.

getContextFromAction(action)   X-Ref
No description

getMergedItemIds(itemIds, nextItemIds, page, perPage)   X-Ref
Returns a merged array of item IDs, given details of the received paginated
items. The array is sparse-like with `undefined` entries where holes exist.

return: {number[]} Merged array of item IDs.
param: {?Array<number>} itemIds     Original item IDs (default empty array).
param: {number[]}       nextItemIds Item IDs to merge.
param: {number}         page        Page of items merged.
param: {number}         perPage     Number of items per page.

reducer_items(state = {}, action)   X-Ref
Reducer tracking items state, keyed by ID. Items are assumed to be normal,
where identifiers are common across all queries.

return: {Object} Next state.
param: {Object} state  Current state.
param: {Object} action Dispatched action.

itemIsComplete(state = {}, action)   X-Ref
Reducer tracking item completeness, keyed by ID. A complete item is one for
which all fields are known. This is used in supporting `_fields` queries,
where not all properties associated with an entity are necessarily returned.
In such cases, completeness is used as an indication of whether it would be
safe to use queried data for a non-`_fields`-limited request.

return: {Object<string,boolean>} Next state.
param: {Object<string,boolean>} state  Current state.
param: {Object} action Dispatched action.

deepCopyLocksTreePath(tree, path)   X-Ref
No description

getNode(tree, path)   X-Ref
No description

hasConflictingLock({exclusive}, locks)   X-Ref
No description

reducer_locks(state = DEFAULT_STATE, action)   X-Ref
Reducer returning locks.

return: {Object} Updated state.
param: {Object} state  Current state.
param: {Object} action Dispatched action.

terms(state = {}, action)   X-Ref
Reducer managing terms state. Keyed by taxonomy slug, the value is either
undefined (if no request has been made for given taxonomy), null (if a
request is in-flight for given taxonomy), or the array of terms for the
taxonomy.

return: {Object} Updated state.
param: {Object} state  Current state.
param: {Object} action Dispatched action.

reducer_users(state = {byId: {},queries: {}}, action)   X-Ref
Reducer managing authors state. Keyed by id.

return: {Object} Updated state.
param: {Object} state  Current state.
param: {Object} action Dispatched action.

reducer_currentUser(state = {}, action)   X-Ref
Reducer managing current user state.

return: {Object} Updated state.
param: {Object} state  Current state.
param: {Object} action Dispatched action.

reducer_taxonomies(state = [], action)   X-Ref
Reducer managing taxonomies.

return: {Object} Updated state.
param: {Object} state  Current state.
param: {Object} action Dispatched action.

currentTheme(state = undefined, action)   X-Ref
Reducer managing the current theme.

return: {string} Updated state.
param: {string} state  Current state.
param: {Object} action Dispatched action.

themes(state = {}, action)   X-Ref
Reducer managing installed themes.

return: {Object} Updated state.
param: {Object} state  Current state.
param: {Object} action Dispatched action.

themeSupports(state = {}, action)   X-Ref
Reducer managing theme supports data.

return: {Object} Updated state.
param: {Object} state  Current state.
param: {Object} action Dispatched action.

reducer_entity(entityConfig)   X-Ref
Higher Order Reducer for a given entity config. It supports:

- Fetching
- Editing
- Saving

return: {Function} Reducer.
param: {Object} entityConfig  Entity config.

entitiesConfig(state = defaultEntities, action)   X-Ref
Reducer keeping track of the registered entities.

return: {Object} Updated state.
param: {Object} state  Current state.
param: {Object} action Dispatched action.

reducer_undo(state = UNDO_INITIAL_STATE, action)   X-Ref
No description

embedPreviews(state = {}, action)   X-Ref
Reducer managing embed preview data.

return: {Object} Updated state.
param: {Object} state  Current state.
param: {Object} action Dispatched action.

userPermissions(state = {}, action)   X-Ref
State which tracks whether the user can perform an action on a REST
resource.

return: {Object} Updated state.
param: {Object} state  Current state.
param: {Object} action Dispatched action.

reducer_autosaves(state = {}, action)   X-Ref
Reducer returning autosaves keyed by their parent's post id.

return: {Object} Updated state.
param: {Object} state  Current state.
param: {Object} action Dispatched action.

getQueriedItemsUncached(state, query)   X-Ref
Returns items for a given query, or null if the items are not known.

return: {?Array} Query items.
param: {Object}  state State object.
param: {?Object} query Optional query.

getAuthors(state, query)   X-Ref
Returns all available authors.

return: {Array} Authors list.
param: {Object}           state Data state.
param: {Object|undefined} query Optional object of query parameters to

__unstableGetAuthor(state, id)   X-Ref
Returns all available authors.

return: {Array} Authors list.
param: {Object} state Data state.
param: {number} id The author id.

getCurrentUser(state)   X-Ref
Returns the current user.

return: {Object} Current user object.
param: {Object} state Data state.

getEntitiesByKind(state, kind)   X-Ref
Returns whether the entities for the give kind are loaded.

return: {Array<Object>} Array of entities with config matching kind.
param: {Object} state   Data state.
param: {string} kind  Entity kind.

getEntity(state, kind, name)   X-Ref
Returns the entity object given its kind and name.

return: {Object} Entity
param: {Object} state   Data state.
param: {string} kind  Entity kind.
param: {string} name  Entity name.

getEntityRecord(state, kind, name, key, query)   X-Ref
Returns the Entity's record object by key. Returns `null` if the value is not
yet received, undefined if the value entity is known to not exist, or the
entity object if it exists and is received.

return: {Object?} Record.
param: {Object}  state State tree
param: {string}  kind  Entity kind.
param: {string}  name  Entity name.
param: {number}  key   Record's key
param: {?Object} query Optional query.

__experimentalGetEntityRecordNoResolver(state, kind, name, key)   X-Ref
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.

return: {Object|null} Record.
param: {Object} state  State tree
param: {string} kind   Entity kind.
param: {string} name   Entity name.
param: {number} key    Record's key

hasEntityRecords(state, kind, name, query)   X-Ref
Returns true if records have been received for the given set of parameters,
or false otherwise.

return: {boolean} Whether entity records have been received.
param: {Object}  state State tree
param: {string}  kind  Entity kind.
param: {string}  name  Entity name.
param: {?Object} query Optional terms query.

getEntityRecords(state, kind, name, query)   X-Ref
Returns the Entity's records.

return: {?Array} Records.
param: {Object}  state State tree
param: {string}  kind  Entity kind.
param: {string}  name  Entity name.
param: {?Object} query Optional terms query.

getEntityRecordEdits(state, kind, name, recordId)   X-Ref
Returns the specified entity record's edits.

return: {Object?} The entity record's edits.
param: {Object} state    State tree.
param: {string} kind     Entity kind.
param: {string} name     Entity name.
param: {number} recordId Record ID.

hasEditsForEntityRecord(state, kind, name, recordId)   X-Ref
Returns true if the specified entity record has edits,
and false otherwise.

return: {boolean} Whether the entity record has edits or not.
param: {Object} state    State tree.
param: {string} kind     Entity kind.
param: {string} name     Entity name.
param: {number} recordId Record ID.

isAutosavingEntityRecord(state, kind, name, recordId)   X-Ref
Returns true if the specified entity record is autosaving, and false otherwise.

return: {boolean} Whether the entity record is autosaving or not.
param: {Object} state    State tree.
param: {string} kind     Entity kind.
param: {string} name     Entity name.
param: {number} recordId Record ID.

isSavingEntityRecord(state, kind, name, recordId)   X-Ref
Returns true if the specified entity record is saving, and false otherwise.

return: {boolean} Whether the entity record is saving or not.
param: {Object} state    State tree.
param: {string} kind     Entity kind.
param: {string} name     Entity name.
param: {number} recordId Record ID.

isDeletingEntityRecord(state, kind, name, recordId)   X-Ref
Returns true if the specified entity record is deleting, and false otherwise.

return: {boolean} Whether the entity record is deleting or not.
param: {Object} state    State tree.
param: {string} kind     Entity kind.
param: {string} name     Entity name.
param: {number} recordId Record ID.

getLastEntitySaveError(state, kind, name, recordId)   X-Ref
Returns the specified entity record's last save error.

return: {Object?} The entity record's save error.
param: {Object} state    State tree.
param: {string} kind     Entity kind.
param: {string} name     Entity name.
param: {number} recordId Record ID.

getLastEntityDeleteError(state, kind, name, recordId)   X-Ref
Returns the specified entity record's last delete error.

return: {Object?} The entity record's save error.
param: {Object} state    State tree.
param: {string} kind     Entity kind.
param: {string} name     Entity name.
param: {number} recordId Record ID.

getCurrentUndoOffset(state)   X-Ref
Returns the current undo offset for the
entity records edits history. The offset
represents how many items from the end
of the history stack we are at. 0 is the
last edit, -1 is the second last, and so on.

return: {number} The current undo offset.
param: {Object} state State tree.

getUndoEdit(state)   X-Ref
Returns the previous edit from the current undo offset
for the entity records edits history, if any.

return: {Object?} The edit.
param: {Object} state State tree.

getRedoEdit(state)   X-Ref
Returns the next edit from the current undo offset
for the entity records edits history, if any.

return: {Object?} The edit.
param: {Object} state State tree.

hasUndo(state)   X-Ref
Returns true if there is a previous edit from the current undo offset
for the entity records edits history, and false otherwise.

return: {boolean} Whether there is a previous edit or not.
param: {Object} state State tree.

hasRedo(state)   X-Ref
Returns true if there is a next edit from the current undo offset
for the entity records edits history, and false otherwise.

return: {boolean} Whether there is a next edit or not.
param: {Object} state State tree.

getCurrentTheme(state)   X-Ref
Return the current theme.

return: {Object}      The current theme.
param: {Object} state Data state.

getThemeSupports(state)   X-Ref
Return theme supports data in the index.

return: {*}           Index data.
param: {Object} state Data state.

getEmbedPreview(state, url)   X-Ref
Returns the embed preview for the given URL.

return: {*} Undefined if the preview has not been fetched, otherwise, the preview fetched from the embed preview API.
param: {Object} state    Data state.
param: {string} url      Embedded URL.

isPreviewEmbedFallback(state, url)   X-Ref
Determines if the returned preview is an oEmbed link fallback.

WordPress can be configured to return a simple link to a URL if it is not embeddable.
We need to be able to determine if a URL is embeddable or not, based on what we
get back from the oEmbed preview API.

return: {boolean} Is the preview for the URL an oEmbed link fallback.
param: {Object} state    Data state.
param: {string} url      Embedded URL.

canUser(state, action, resource, id)   X-Ref
Returns whether the current user can perform the given action on the given
REST resource.

Calling this may trigger an OPTIONS request to the REST API via the
`canUser()` resolver.

https://developer.wordpress.org/rest-api/reference/

return: {boolean|undefined} Whether or not the user can perform the action,
param: {Object}   state            Data state.
param: {string}   action           Action to check. One of: 'create', 'read', 'update', 'delete'.
param: {string}   resource         REST resource to check, e.g. 'media' or 'posts'.
param: {string=}  id               Optional ID of the rest resource to check.

canUserEditEntityRecord(state, kind, name, recordId)   X-Ref
Returns whether the current user can edit the given entity.

Calling this may trigger an OPTIONS request to the REST API via the
`canUser()` resolver.

https://developer.wordpress.org/rest-api/reference/

return: {boolean|undefined} Whether or not the user can edit,
param: {Object} state    Data state.
param: {string} kind     Entity kind.
param: {string} name     Entity name.
param: {string} recordId Record's id.

getAutosaves(state, postType, postId)   X-Ref
Returns the latest autosaves for the post.

May return multiple autosaves since the backend stores one autosave per
author for each post.

return: {?Array} An array of autosaves for the post, or undefined if there is none.
param: {Object} state    State tree.
param: {string} postType The type of the parent post.
param: {number} postId   The id of the parent post.

getAutosave(state, postType, postId, authorId)   X-Ref
Returns the autosave for the post and author.

return: {?Object} The autosave for the post and author.
param: {Object} state    State tree.
param: {string} postType The type of the parent post.
param: {number} postId   The id of the parent post.
param: {number} authorId The id of the author.

__experimentalGetTemplateForLink(state, link)   X-Ref
Retrieve the frontend template used for a given link.

return: {Object?} The template record.
param: {Object} state Editor state.
param: {string} link  Link.

__unstableGetPendingLockRequests(state)   X-Ref

param: {...any} args Original resolver arguments.

__unstableIsLockAvailable(state, store, path, {exclusive})   X-Ref
No description

EntityProvider({kind,type,id,children})   X-Ref
Context provider component for providing
an entity for a specific entity type.

return: {Object} The provided children, wrapped with
param: {Object} props          The component's props.
param: {string} props.kind     The entity kind.
param: {string} props.type     The entity type.
param: {number} props.id       The entity ID.
param: {*}      props.children The children to wrap.

useEntityId(kind, type)   X-Ref
Hook that returns the ID for the nearest
provided entity of the specified type.

param: {string} kind The entity kind.
param: {string} type The entity type.

useEntityProp(kind, type, prop, _id)   X-Ref
Hook that returns the value and a setter for the
specified property of the nearest provided
entity of the specified type.

return: {[*, Function, *]} An array where the first item is the
param: {string} kind  The entity kind.
param: {string} type  The entity type.
param: {string} prop  The property name.
param: {string} [_id] An entity ID to use instead of the context-provided one.

useEntityBlockEditor(kind, type, {id: _id} = {})   X-Ref
Hook that returns block content getters and setters for
the nearest provided entity of the specified type.

The return value has the shape `[ blocks, onInput, onChange ]`.
`onInput` is for block changes that don't create undo levels
or dirty the post, non-persistent changes, and `onChange` is for
peristent changes. They map directly to the props of a
`BlockEditorProvider` and are intended to be used with it,
or similar components or hooks.

return: {[WPBlock[], Function, Function]} The block array and setters.
param: {string} kind                            The entity kind.
param: {string} type                            The entity type.
param: {Object} options
param: {string} [options.id]                    An entity ID to use instead of the context-provided one.

arrayOf( value )   X-Ref
Returns the first argument as the sole entry in an array.

return: {Array} Value returned as entry in array.
param: {*} value Value to return.

isObjectLike( value )   X-Ref
Returns true if the value passed is object-like, or false otherwise. A value
is object-like if it can support property assignment, e.g. object or array.

return: {boolean} Whether value is object-like.
param: {*} value Value to test.

createCache()   X-Ref
Creates and returns a new cache object.

return: {Object} Cache object.

isShallowEqual( a, b, fromIndex )   X-Ref
Returns true if entries within the two arrays are strictly equal by
reference from a starting index.

return: {boolean} Whether arrays are shallowly equal.
param: {Array}  a         First array.
param: {Array}  b         Second array.
param: {number} fromIndex Index from which to start comparison.

getRootCache()   X-Ref
Returns the root cache. If WeakMap is supported, this is assigned to the
root WeakMap cache set, otherwise it is a shared instance of the default
cache object.

return: {(WeakMap|Object)} Root cache object.

getWeakMapCache( dependants )   X-Ref
Returns the cache for a given dependants array. When possible, a WeakMap
will be used to create a unique cache for each set of dependants. This
is feasible due to the nature of WeakMap in allowing garbage collection
to occur on entries where the key object is no longer referenced. Since
WeakMap requires the key to be an object, this is only possible when the
dependant is object-like. The root cache is created as a hierarchy where
each top-level key is the first entry in a dependants set, the value a
WeakMap where each key is the next dependant, and so on. This continues
so long as the dependants are object-like. If no dependants are object-
like, then the cache is shared across all invocations.

return: {Object} Cache object.
param: {Array} dependants Selector dependants.

clear()   X-Ref
Resets root memoization cache.


callSelector( )   X-Ref
The augmented selector call, considering first whether dependants have
changed before passing it to underlying memoize function.

return: {*} Selector result.
param: {Object} source    Source object for derivation.
param: {...*}   extraArgs Additional arguments to pass to selector.

Functions
Functions that are not part of a class:

__webpack_require__(moduleId)   X-Ref
No description

getDefault()   X-Ref
No description

getModuleExports()   X-Ref
No description

rng()   X-Ref
No description

validate(uuid)   X-Ref
No description

stringify(arr)   X-Ref
No description

v4(options, buf, offset)   X-Ref
No description

_typeof(obj)   X-Ref
No description

_classCallCheck(instance, Constructor)   X-Ref
No description

_defineProperties(target, props)   X-Ref
No description

_createClass(Constructor, protoProps, staticProps)   X-Ref
No description

getValuePair(instance, key)   X-Ref
Given an instance of EquivalentKeyMap, returns its internal value pair tuple
for a key, if one exists. The tuple members consist of the last reference
value for the key (used in efficient subsequent lookups) and the value
assigned for the key at the leaf node.

return: {?Array} Value pair, if exists.
param: {EquivalentKeyMap} instance EquivalentKeyMap instance.
param: {*} key                     The key for which to return value pair.

EquivalentKeyMap(iterable)   X-Ref
No description

conservativeMapItem(item, nextItem)   X-Ref
Given the current and next item entity, returns the minimally "modified"
result of the next item, preferring value references from the original item
if equal. If all values match, the original item is returned.

return: {Object} Minimally modified merged item.
param: {Object} item     Original item.
param: {Object} nextItem Next item.

receiveItems(items, edits)   X-Ref
Returns an action object used in signalling that items have been received.

return: {Object} Action object.
param: {Array}   items Items received.
param: {?Object} edits Optional edits to reset.

removeItems(kind, name, records, invalidateCache = false)   X-Ref
Returns an action object used in signalling that entity records have been
deleted and they need to be removed from entities state.

return: {Object} Action object.
param: {string}       kind             Kind of the removed entities.
param: {string}       name             Name of the removed entities.
param: {Array|number} records          Record IDs of the removed entities.
param: {boolean}      invalidateCache  Controls whether we want to invalidate the cache.

receiveQueriedItems(items, query = {}, edits)   X-Ref
Returns an action object used in signalling that queried data has been
received.

return: {Object} Action object.
param: {Array}   items Queried items received.
param: {?Object} query Optional query object.
param: {?Object} edits Optional edits to reset.

createBatch(processor = defaultProcessor)   X-Ref
No description



Generated: Wed Aug 4 01:00:05 2021 Cross-referenced by PHPXref 0.7.1