@wordpress/core-data 7.32.0 → 7.32.1-next.ff1cebbba.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/actions.js +375 -632
- package/build/actions.js.map +7 -1
- package/build/batch/create-batch.js +49 -62
- package/build/batch/create-batch.js.map +7 -1
- package/build/batch/default-processor.js +43 -39
- package/build/batch/default-processor.js.map +7 -1
- package/build/batch/index.js +38 -17
- package/build/batch/index.js.map +7 -1
- package/build/dynamic-entities.js +30 -32
- package/build/dynamic-entities.js.map +7 -1
- package/build/entities.js +298 -410
- package/build/entities.js.map +7 -1
- package/build/entity-context.js +29 -12
- package/build/entity-context.js.map +7 -1
- package/build/entity-provider.js +38 -46
- package/build/entity-provider.js.map +7 -1
- package/build/entity-types/attachment.js +16 -5
- package/build/entity-types/attachment.js.map +7 -1
- package/build/entity-types/base-entity-records.js +16 -42
- package/build/entity-types/base-entity-records.js.map +7 -1
- package/build/entity-types/base.js +16 -5
- package/build/entity-types/base.js.map +7 -1
- package/build/entity-types/comment.js +16 -5
- package/build/entity-types/comment.js.map +7 -1
- package/build/entity-types/global-styles-revision.js +16 -5
- package/build/entity-types/global-styles-revision.js.map +7 -1
- package/build/entity-types/helpers.js +16 -5
- package/build/entity-types/helpers.js.map +7 -1
- package/build/entity-types/index.js +16 -5
- package/build/entity-types/index.js.map +7 -1
- package/build/entity-types/menu-location.js +16 -5
- package/build/entity-types/menu-location.js.map +7 -1
- package/build/entity-types/nav-menu-item.js +16 -5
- package/build/entity-types/nav-menu-item.js.map +7 -1
- package/build/entity-types/nav-menu.js +16 -5
- package/build/entity-types/nav-menu.js.map +7 -1
- package/build/entity-types/page.js +16 -5
- package/build/entity-types/page.js.map +7 -1
- package/build/entity-types/plugin.js +16 -5
- package/build/entity-types/plugin.js.map +7 -1
- package/build/entity-types/post-revision.js +16 -5
- package/build/entity-types/post-revision.js.map +7 -1
- package/build/entity-types/post-status.js +16 -5
- package/build/entity-types/post-status.js.map +7 -1
- package/build/entity-types/post.js +16 -5
- package/build/entity-types/post.js.map +7 -1
- package/build/entity-types/settings.js +16 -5
- package/build/entity-types/settings.js.map +7 -1
- package/build/entity-types/sidebar.js +16 -5
- package/build/entity-types/sidebar.js.map +7 -1
- package/build/entity-types/taxonomy.js +16 -5
- package/build/entity-types/taxonomy.js.map +7 -1
- package/build/entity-types/term.js +16 -5
- package/build/entity-types/term.js.map +7 -1
- package/build/entity-types/theme.js +16 -5
- package/build/entity-types/theme.js.map +7 -1
- package/build/entity-types/type.js +16 -5
- package/build/entity-types/type.js.map +7 -1
- package/build/entity-types/user.js +16 -5
- package/build/entity-types/user.js.map +7 -1
- package/build/entity-types/widget-type.js +16 -5
- package/build/entity-types/widget-type.js.map +7 -1
- package/build/entity-types/widget.js +16 -5
- package/build/entity-types/widget.js.map +7 -1
- package/build/entity-types/wp-template-part.js +16 -5
- package/build/entity-types/wp-template-part.js.map +7 -1
- package/build/entity-types/wp-template.js +16 -5
- package/build/entity-types/wp-template.js.map +7 -1
- package/build/fetch/__experimental-fetch-link-suggestions.js +141 -154
- package/build/fetch/__experimental-fetch-link-suggestions.js.map +7 -1
- package/build/fetch/__experimental-fetch-url-data.js +47 -59
- package/build/fetch/__experimental-fetch-url-data.js.map +7 -1
- package/build/fetch/index.js +53 -32
- package/build/fetch/index.js.map +7 -1
- package/build/footnotes/get-footnotes-order.js +38 -25
- package/build/footnotes/get-footnotes-order.js.map +7 -1
- package/build/footnotes/get-rich-text-values-cached.js +26 -27
- package/build/footnotes/get-rich-text-values-cached.js.map +7 -1
- package/build/footnotes/index.js +68 -55
- package/build/footnotes/index.js.map +7 -1
- package/build/hooks/constants.js +33 -12
- package/build/hooks/constants.js.map +7 -1
- package/build/hooks/index.js +59 -68
- package/build/hooks/index.js.map +7 -1
- package/build/hooks/memoize.js +34 -12
- package/build/hooks/memoize.js.map +7 -1
- package/build/hooks/use-entity-block-editor.js +111 -119
- package/build/hooks/use-entity-block-editor.js.map +7 -1
- package/build/hooks/use-entity-id.js +25 -23
- package/build/hooks/use-entity-id.js.map +7 -1
- package/build/hooks/use-entity-prop.js +59 -60
- package/build/hooks/use-entity-prop.js.map +7 -1
- package/build/hooks/use-entity-record.js +95 -155
- package/build/hooks/use-entity-record.js.map +7 -1
- package/build/hooks/use-entity-records.js +131 -139
- package/build/hooks/use-entity-records.js.map +7 -1
- package/build/hooks/use-query-select.js +65 -84
- package/build/hooks/use-query-select.js.map +7 -1
- package/build/hooks/use-resource-permissions.js +92 -145
- package/build/hooks/use-resource-permissions.js.map +7 -1
- package/build/index.js +96 -153
- package/build/index.js.map +7 -1
- package/build/lock-unlock.js +31 -14
- package/build/lock-unlock.js.map +7 -1
- package/build/locks/actions.js +36 -19
- package/build/locks/actions.js.map +7 -1
- package/build/locks/engine.js +48 -47
- package/build/locks/engine.js.map +7 -1
- package/build/locks/reducer.js +54 -63
- package/build/locks/reducer.js.map +7 -1
- package/build/locks/selectors.js +35 -30
- package/build/locks/selectors.js.map +7 -1
- package/build/locks/utils.js +37 -16
- package/build/locks/utils.js.map +7 -1
- package/build/name.js +27 -12
- package/build/name.js.map +7 -1
- package/build/private-actions.js +67 -75
- package/build/private-actions.js.map +7 -1
- package/build/private-apis.js +33 -16
- package/build/private-apis.js.map +7 -1
- package/build/private-selectors.js +204 -184
- package/build/private-selectors.js.map +7 -1
- package/build/queried-data/actions.js +32 -41
- package/build/queried-data/actions.js.map +7 -1
- package/build/queried-data/get-query-parts.js +41 -79
- package/build/queried-data/get-query-parts.js.map +7 -1
- package/build/queried-data/index.js +39 -36
- package/build/queried-data/index.js.map +7 -1
- package/build/queried-data/reducer.js +162 -193
- package/build/queried-data/reducer.js.map +7 -1
- package/build/queried-data/selectors.js +57 -85
- package/build/queried-data/selectors.js.map +7 -1
- package/build/reducer.js +279 -404
- package/build/reducer.js.map +7 -1
- package/build/resolvers.js +553 -600
- package/build/resolvers.js.map +7 -1
- package/build/selectors.js +456 -981
- package/build/selectors.js.map +7 -1
- package/build/sync.js +34 -22
- package/build/sync.js.map +7 -1
- package/build/types.js +16 -5
- package/build/types.js.map +7 -1
- package/build/utils/conservative-map-item.js +34 -27
- package/build/utils/conservative-map-item.js.map +7 -1
- package/build/utils/crdt-blocks.js +289 -0
- package/build/utils/crdt-blocks.js.map +7 -0
- package/build/utils/crdt.js +202 -0
- package/build/utils/crdt.js.map +7 -0
- package/build/utils/forward-resolver.js +24 -16
- package/build/utils/forward-resolver.js.map +7 -1
- package/build/utils/get-nested-value.js +26 -21
- package/build/utils/get-nested-value.js.map +7 -1
- package/build/utils/get-normalized-comma-separable.js +25 -17
- package/build/utils/get-normalized-comma-separable.js.map +7 -1
- package/build/utils/if-matching-action.js +25 -19
- package/build/utils/if-matching-action.js.map +7 -1
- package/build/utils/index.js +77 -108
- package/build/utils/index.js.map +7 -1
- package/build/utils/is-numeric-id.js +22 -12
- package/build/utils/is-numeric-id.js.map +7 -1
- package/build/utils/is-raw-attribute.js +22 -13
- package/build/utils/is-raw-attribute.js.map +7 -1
- package/build/utils/log-entity-deprecation.js +37 -38
- package/build/utils/log-entity-deprecation.js.map +7 -1
- package/build/utils/on-sub-key.js +30 -24
- package/build/utils/on-sub-key.js.map +7 -1
- package/build/utils/receive-intermediate-results.js +29 -6
- package/build/utils/receive-intermediate-results.js.map +7 -1
- package/build/utils/replace-action.js +24 -17
- package/build/utils/replace-action.js.map +7 -1
- package/build/utils/set-nested-value.js +25 -30
- package/build/utils/set-nested-value.js.map +7 -1
- package/build/utils/user-permissions.js +41 -13
- package/build/utils/user-permissions.js.map +7 -1
- package/build/utils/with-weak-map-cache.js +26 -22
- package/build/utils/with-weak-map-cache.js.map +7 -1
- package/build-module/actions.js +322 -601
- package/build-module/actions.js.map +7 -1
- package/build-module/batch/create-batch.js +21 -57
- package/build-module/batch/create-batch.js.map +7 -1
- package/build-module/batch/default-processor.js +14 -33
- package/build-module/batch/default-processor.js.map +7 -1
- package/build-module/batch/index.js +7 -3
- package/build-module/batch/index.js.map +7 -1
- package/build-module/dynamic-entities.js +7 -28
- package/build-module/dynamic-entities.js.map +7 -1
- package/build-module/entities.js +263 -399
- package/build-module/entities.js.map +7 -1
- package/build-module/entity-context.js +7 -7
- package/build-module/entity-context.js.map +7 -1
- package/build-module/entity-provider.js +19 -42
- package/build-module/entity-provider.js.map +7 -1
- package/build-module/entity-types/attachment.js +1 -2
- package/build-module/entity-types/attachment.js.map +7 -1
- package/build-module/entity-types/base-entity-records.js +1 -37
- package/build-module/entity-types/base-entity-records.js.map +7 -1
- package/build-module/entity-types/base.js +1 -2
- package/build-module/entity-types/base.js.map +7 -1
- package/build-module/entity-types/comment.js +1 -2
- package/build-module/entity-types/comment.js.map +7 -1
- package/build-module/entity-types/global-styles-revision.js +1 -2
- package/build-module/entity-types/global-styles-revision.js.map +7 -1
- package/build-module/entity-types/helpers.js +1 -2
- package/build-module/entity-types/helpers.js.map +7 -1
- package/build-module/entity-types/index.js +1 -2
- package/build-module/entity-types/index.js.map +7 -1
- package/build-module/entity-types/menu-location.js +1 -2
- package/build-module/entity-types/menu-location.js.map +7 -1
- package/build-module/entity-types/nav-menu-item.js +1 -2
- package/build-module/entity-types/nav-menu-item.js.map +7 -1
- package/build-module/entity-types/nav-menu.js +1 -2
- package/build-module/entity-types/nav-menu.js.map +7 -1
- package/build-module/entity-types/page.js +1 -2
- package/build-module/entity-types/page.js.map +7 -1
- package/build-module/entity-types/plugin.js +1 -2
- package/build-module/entity-types/plugin.js.map +7 -1
- package/build-module/entity-types/post-revision.js +1 -2
- package/build-module/entity-types/post-revision.js.map +7 -1
- package/build-module/entity-types/post-status.js +1 -2
- package/build-module/entity-types/post-status.js.map +7 -1
- package/build-module/entity-types/post.js +1 -2
- package/build-module/entity-types/post.js.map +7 -1
- package/build-module/entity-types/settings.js +1 -2
- package/build-module/entity-types/settings.js.map +7 -1
- package/build-module/entity-types/sidebar.js +1 -2
- package/build-module/entity-types/sidebar.js.map +7 -1
- package/build-module/entity-types/taxonomy.js +1 -2
- package/build-module/entity-types/taxonomy.js.map +7 -1
- package/build-module/entity-types/term.js +1 -2
- package/build-module/entity-types/term.js.map +7 -1
- package/build-module/entity-types/theme.js +1 -2
- package/build-module/entity-types/theme.js.map +7 -1
- package/build-module/entity-types/type.js +1 -2
- package/build-module/entity-types/type.js.map +7 -1
- package/build-module/entity-types/user.js +1 -2
- package/build-module/entity-types/user.js.map +7 -1
- package/build-module/entity-types/widget-type.js +1 -2
- package/build-module/entity-types/widget-type.js.map +7 -1
- package/build-module/entity-types/widget.js +1 -2
- package/build-module/entity-types/widget.js.map +7 -1
- package/build-module/entity-types/wp-template-part.js +1 -2
- package/build-module/entity-types/wp-template-part.js.map +7 -1
- package/build-module/entity-types/wp-template.js +1 -2
- package/build-module/entity-types/wp-template.js.map +7 -1
- package/build-module/fetch/__experimental-fetch-link-suggestions.js +111 -149
- package/build-module/fetch/__experimental-fetch-link-suggestions.js.map +7 -1
- package/build-module/fetch/__experimental-fetch-url-data.js +20 -49
- package/build-module/fetch/__experimental-fetch-url-data.js.map +7 -1
- package/build-module/fetch/index.js +20 -15
- package/build-module/fetch/index.js.map +7 -1
- package/build-module/footnotes/get-footnotes-order.js +10 -19
- package/build-module/footnotes/get-footnotes-order.js.map +7 -1
- package/build-module/footnotes/get-rich-text-values-cached.js +8 -23
- package/build-module/footnotes/get-rich-text-values-cached.js.map +7 -1
- package/build-module/footnotes/index.js +34 -47
- package/build-module/footnotes/index.js.map +7 -1
- package/build-module/hooks/constants.js +11 -8
- package/build-module/hooks/constants.js.map +7 -1
- package/build-module/hooks/index.js +27 -15
- package/build-module/hooks/index.js.map +7 -1
- package/build-module/hooks/memoize.js +6 -8
- package/build-module/hooks/memoize.js.map +7 -1
- package/build-module/hooks/use-entity-block-editor.js +80 -110
- package/build-module/hooks/use-entity-block-editor.js.map +7 -1
- package/build-module/hooks/use-entity-id.js +7 -19
- package/build-module/hooks/use-entity-id.js.map +7 -1
- package/build-module/hooks/use-entity-prop.js +31 -55
- package/build-module/hooks/use-entity-prop.js.map +7 -1
- package/build-module/hooks/use-entity-record.js +63 -148
- package/build-module/hooks/use-entity-record.js.map +7 -1
- package/build-module/hooks/use-entity-records.js +98 -131
- package/build-module/hooks/use-entity-records.js.map +7 -1
- package/build-module/hooks/use-query-select.js +27 -71
- package/build-module/hooks/use-query-select.js.map +7 -1
- package/build-module/hooks/use-resource-permissions.js +57 -136
- package/build-module/hooks/use-resource-permissions.js.map +7 -1
- package/build-module/index.js +49 -71
- package/build-module/index.js.map +7 -1
- package/build-module/lock-unlock.js +8 -7
- package/build-module/lock-unlock.js.map +7 -1
- package/build-module/locks/actions.js +8 -13
- package/build-module/locks/actions.js.map +7 -1
- package/build-module/locks/engine.js +17 -38
- package/build-module/locks/engine.js.map +7 -1
- package/build-module/locks/reducer.js +37 -59
- package/build-module/locks/reducer.js.map +7 -1
- package/build-module/locks/selectors.js +16 -23
- package/build-module/locks/selectors.js.map +7 -1
- package/build-module/locks/utils.js +15 -12
- package/build-module/locks/utils.js.map +7 -1
- package/build-module/name.js +5 -8
- package/build-module/name.js.map +7 -1
- package/build-module/private-actions.js +35 -69
- package/build-module/private-actions.js.map +7 -1
- package/build-module/private-apis.js +8 -8
- package/build-module/private-apis.js.map +7 -1
- package/build-module/private-selectors.js +167 -174
- package/build-module/private-selectors.js.map +7 -1
- package/build-module/queried-data/actions.js +11 -38
- package/build-module/queried-data/actions.js.map +7 -1
- package/build-module/queried-data/get-query-parts.js +20 -75
- package/build-module/queried-data/get-query-parts.js.map +7 -1
- package/build-module/queried-data/index.js +7 -4
- package/build-module/queried-data/index.js.map +7 -1
- package/build-module/queried-data/reducer.js +134 -185
- package/build-module/queried-data/reducer.js.map +7 -1
- package/build-module/queried-data/selectors.js +23 -78
- package/build-module/queried-data/selectors.js.map +7 -1
- package/build-module/reducer.js +243 -393
- package/build-module/reducer.js.map +7 -1
- package/build-module/resolvers.js +478 -549
- package/build-module/resolvers.js.map +7 -1
- package/build-module/selectors.js +410 -953
- package/build-module/selectors.js.map +7 -1
- package/build-module/sync.js +14 -17
- package/build-module/sync.js.map +7 -1
- package/build-module/types.js +1 -2
- package/build-module/types.js.map +7 -1
- package/build-module/utils/conservative-map-item.js +6 -22
- package/build-module/utils/conservative-map-item.js.map +7 -1
- package/build-module/utils/crdt-blocks.js +255 -0
- package/build-module/utils/crdt-blocks.js.map +7 -0
- package/build-module/utils/crdt.js +167 -0
- package/build-module/utils/crdt.js.map +7 -0
- package/build-module/utils/forward-resolver.js +6 -12
- package/build-module/utils/forward-resolver.js.map +7 -1
- package/build-module/utils/get-nested-value.js +9 -18
- package/build-module/utils/get-nested-value.js.map +7 -1
- package/build-module/utils/get-normalized-comma-separable.js +7 -13
- package/build-module/utils/get-normalized-comma-separable.js.map +7 -1
- package/build-module/utils/if-matching-action.js +7 -15
- package/build-module/utils/if-matching-action.js.map +7 -1
- package/build-module/utils/index.js +35 -14
- package/build-module/utils/index.js.map +7 -1
- package/build-module/utils/is-numeric-id.js +5 -9
- package/build-module/utils/is-numeric-id.js.map +7 -1
- package/build-module/utils/is-raw-attribute.js +5 -10
- package/build-module/utils/is-raw-attribute.js.map +7 -1
- package/build-module/utils/log-entity-deprecation.js +8 -31
- package/build-module/utils/log-entity-deprecation.js.map +7 -1
- package/build-module/utils/on-sub-key.js +8 -19
- package/build-module/utils/on-sub-key.js.map +7 -1
- package/build-module/utils/receive-intermediate-results.js +7 -2
- package/build-module/utils/receive-intermediate-results.js.map +7 -1
- package/build-module/utils/replace-action.js +6 -13
- package/build-module/utils/replace-action.js.map +7 -1
- package/build-module/utils/set-nested-value.js +8 -27
- package/build-module/utils/set-nested-value.js.map +7 -1
- package/build-module/utils/user-permissions.js +19 -9
- package/build-module/utils/user-permissions.js.map +7 -1
- package/build-module/utils/with-weak-map-cache.js +8 -18
- package/build-module/utils/with-weak-map-cache.js.map +7 -1
- package/build-types/actions.d.ts.map +1 -1
- package/build-types/entities.d.ts +0 -56
- package/build-types/entities.d.ts.map +1 -1
- package/build-types/index.d.ts.map +1 -1
- package/build-types/private-selectors.d.ts.map +1 -1
- package/build-types/resolvers.d.ts +3 -0
- package/build-types/resolvers.d.ts.map +1 -1
- package/build-types/selectors.d.ts.map +1 -1
- package/build-types/sync.d.ts +6 -1
- package/build-types/sync.d.ts.map +1 -1
- package/build-types/types.d.ts +9 -0
- package/build-types/types.d.ts.map +1 -1
- package/build-types/utils/crdt-blocks.d.ts +30 -0
- package/build-types/utils/crdt-blocks.d.ts.map +1 -0
- package/build-types/utils/crdt.d.ts +49 -0
- package/build-types/utils/crdt.d.ts.map +1 -0
- package/package.json +26 -19
- package/src/actions.js +56 -74
- package/src/entities.js +59 -113
- package/src/private-selectors.ts +32 -7
- package/src/resolvers.js +173 -120
- package/src/selectors.ts +0 -13
- package/src/sync.ts +12 -0
- package/src/test/resolvers.js +183 -0
- package/src/types.ts +12 -0
- package/src/utils/crdt-blocks.ts +503 -0
- package/src/utils/crdt.ts +310 -0
- package/src/utils/test/crdt-blocks.ts +375 -0
- package/src/utils/test/crdt.ts +254 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/src/sync.js +0 -27
package/build/entities.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{"version":3,"names":["_changeCase","require","_apiFetch","_interopRequireDefault","_i18n","_richText","DEFAULT_ENTITY_KEY","exports","POST_RAW_ATTRIBUTES","rootEntitiesConfig","label","__","kind","name","baseURL","baseURLParams","_fields","join","plural","syncConfig","fetch","apiFetch","path","applyChangesToDoc","doc","changes","document","getMap","Object","entries","forEach","key","value","get","set","fromCRDTDoc","toJSON","syncObjectType","getSyncObjectId","context","id","rawAttributes","supportsPagination","transientEdits","blocks","getTitle","record","slug","getRevisionsUrl","parentId","revisionId","deprecatedEntities","root","media","since","alternative","additionalEntityConfigLoaders","loadEntities","loadPostTypeEntities","loadTaxonomyEntities","loadSiteEntity","prePersistPostType","persistedRecord","edits","newEdits","status","title","serialisableBlocksCache","WeakMap","makeBlockAttributesSerializable","attributes","newAttributes","RichTextData","valueOf","makeBlocksSerializable","map","block","innerBlocks","rest","postTypes","postType","_postType$rest_namesp","isTemplate","includes","namespace","rest_namespace","rest_base","selection","mergedEdits","meta","_record$slug","rendered","capitalCase","String","__unstablePrePersist","undefined","__unstable_rest_base","has","revisionKey","taxonomies","taxonomy","_taxonomy$rest_namesp","_site$schema$properti","entity","site","method","labels","schema","properties","getMethodName","prefix","kindPrefix","pascalCase","suffix"],"sources":["@wordpress/core-data/src/entities.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { capitalCase, pascalCase } from 'change-case';\n\n/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\nimport { __ } from '@wordpress/i18n';\nimport { RichTextData } from '@wordpress/rich-text';\n\nexport const DEFAULT_ENTITY_KEY = 'id';\nconst POST_RAW_ATTRIBUTES = [ 'title', 'excerpt', 'content' ];\n\nexport const rootEntitiesConfig = [\n\t{\n\t\tlabel: __( 'Base' ),\n\t\tkind: 'root',\n\t\tname: '__unstableBase',\n\t\tbaseURL: '/',\n\t\tbaseURLParams: {\n\t\t\t// Please also change the preload path when changing this.\n\t\t\t// @see lib/compat/wordpress-6.8/preload.php\n\t\t\t_fields: [\n\t\t\t\t'description',\n\t\t\t\t'gmt_offset',\n\t\t\t\t'home',\n\t\t\t\t'name',\n\t\t\t\t'site_icon',\n\t\t\t\t'site_icon_url',\n\t\t\t\t'site_logo',\n\t\t\t\t'timezone_string',\n\t\t\t\t'url',\n\t\t\t\t'page_for_posts',\n\t\t\t\t'page_on_front',\n\t\t\t\t'show_on_front',\n\t\t\t].join( ',' ),\n\t\t},\n\t\t// The entity doesn't support selecting multiple records.\n\t\t// The property is maintained for backward compatibility.\n\t\tplural: '__unstableBases',\n\t\tsyncConfig: {\n\t\t\tfetch: async () => {\n\t\t\t\treturn apiFetch( { path: '/' } );\n\t\t\t},\n\t\t\tapplyChangesToDoc: ( doc, changes ) => {\n\t\t\t\tconst document = doc.getMap( 'document' );\n\t\t\t\tObject.entries( changes ).forEach( ( [ key, value ] ) => {\n\t\t\t\t\tif ( document.get( key ) !== value ) {\n\t\t\t\t\t\tdocument.set( key, value );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t},\n\t\t\tfromCRDTDoc: ( doc ) => {\n\t\t\t\treturn doc.getMap( 'document' ).toJSON();\n\t\t\t},\n\t\t},\n\t\tsyncObjectType: 'root/base',\n\t\tgetSyncObjectId: () => 'index',\n\t},\n\t{\n\t\tlabel: __( 'Post Type' ),\n\t\tname: 'postType',\n\t\tkind: 'root',\n\t\tkey: 'slug',\n\t\tbaseURL: '/wp/v2/types',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'postTypes',\n\t\tsyncConfig: {\n\t\t\tfetch: async ( id ) => {\n\t\t\t\treturn apiFetch( {\n\t\t\t\t\tpath: `/wp/v2/types/${ id }?context=edit`,\n\t\t\t\t} );\n\t\t\t},\n\t\t\tapplyChangesToDoc: ( doc, changes ) => {\n\t\t\t\tconst document = doc.getMap( 'document' );\n\t\t\t\tObject.entries( changes ).forEach( ( [ key, value ] ) => {\n\t\t\t\t\tif ( document.get( key ) !== value ) {\n\t\t\t\t\t\tdocument.set( key, value );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t},\n\t\t\tfromCRDTDoc: ( doc ) => {\n\t\t\t\treturn doc.getMap( 'document' ).toJSON();\n\t\t\t},\n\t\t},\n\t\tsyncObjectType: 'root/postType',\n\t\tgetSyncObjectId: ( id ) => id,\n\t},\n\t{\n\t\tname: 'media',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/media',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'mediaItems',\n\t\tlabel: __( 'Media' ),\n\t\trawAttributes: [ 'caption', 'title', 'description' ],\n\t\tsupportsPagination: true,\n\t},\n\t{\n\t\tname: 'taxonomy',\n\t\tkind: 'root',\n\t\tkey: 'slug',\n\t\tbaseURL: '/wp/v2/taxonomies',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'taxonomies',\n\t\tlabel: __( 'Taxonomy' ),\n\t},\n\t{\n\t\tname: 'sidebar',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/sidebars',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'sidebars',\n\t\ttransientEdits: { blocks: true },\n\t\tlabel: __( 'Widget areas' ),\n\t},\n\t{\n\t\tname: 'widget',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/widgets',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'widgets',\n\t\ttransientEdits: { blocks: true },\n\t\tlabel: __( 'Widgets' ),\n\t},\n\t{\n\t\tname: 'widgetType',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/widget-types',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'widgetTypes',\n\t\tlabel: __( 'Widget types' ),\n\t},\n\t{\n\t\tlabel: __( 'User' ),\n\t\tname: 'user',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/users',\n\t\tgetTitle: ( record ) => record?.name || record?.slug,\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'users',\n\t\tsupportsPagination: true,\n\t},\n\t{\n\t\tname: 'comment',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/comments',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'comments',\n\t\tlabel: __( 'Comment' ),\n\t\tsupportsPagination: true,\n\t},\n\t{\n\t\tname: 'menu',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/menus',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'menus',\n\t\tlabel: __( 'Menu' ),\n\t\tsupportsPagination: true,\n\t},\n\t{\n\t\tname: 'menuItem',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/menu-items',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'menuItems',\n\t\tlabel: __( 'Menu Item' ),\n\t\trawAttributes: [ 'title' ],\n\t\tsupportsPagination: true,\n\t},\n\t{\n\t\tname: 'menuLocation',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/menu-locations',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'menuLocations',\n\t\tlabel: __( 'Menu Location' ),\n\t\tkey: 'name',\n\t},\n\t{\n\t\tlabel: __( 'Global Styles' ),\n\t\tname: 'globalStyles',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/global-styles',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'globalStylesVariations', // Should be different from name.\n\t\tgetTitle: () => __( 'Custom Styles' ),\n\t\tgetRevisionsUrl: ( parentId, revisionId ) =>\n\t\t\t`/wp/v2/global-styles/${ parentId }/revisions${\n\t\t\t\trevisionId ? '/' + revisionId : ''\n\t\t\t}`,\n\t\tsupportsPagination: true,\n\t},\n\t{\n\t\tlabel: __( 'Themes' ),\n\t\tname: 'theme',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/themes',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'themes',\n\t\tkey: 'stylesheet',\n\t},\n\t{\n\t\tlabel: __( 'Plugins' ),\n\t\tname: 'plugin',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/plugins',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'plugins',\n\t\tkey: 'plugin',\n\t},\n\t{\n\t\tlabel: __( 'Status' ),\n\t\tname: 'status',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/statuses',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'statuses',\n\t\tkey: 'slug',\n\t},\n];\n\nexport const deprecatedEntities = {\n\troot: {\n\t\tmedia: {\n\t\t\tsince: '6.9',\n\t\t\talternative: {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'attachment',\n\t\t\t},\n\t\t},\n\t},\n};\n\nexport const additionalEntityConfigLoaders = [\n\t{ kind: 'postType', loadEntities: loadPostTypeEntities },\n\t{ kind: 'taxonomy', loadEntities: loadTaxonomyEntities },\n\t{\n\t\tkind: 'root',\n\t\tname: 'site',\n\t\tplural: 'sites',\n\t\tloadEntities: loadSiteEntity,\n\t},\n];\n\n/**\n * Returns a function to be used to retrieve extra edits to apply before persisting a post type.\n *\n * @param {Object} persistedRecord Already persisted Post\n * @param {Object} edits Edits.\n * @return {Object} Updated edits.\n */\nexport const prePersistPostType = ( persistedRecord, edits ) => {\n\tconst newEdits = {};\n\n\tif ( persistedRecord?.status === 'auto-draft' ) {\n\t\t// Saving an auto-draft should create a draft by default.\n\t\tif ( ! edits.status && ! newEdits.status ) {\n\t\t\tnewEdits.status = 'draft';\n\t\t}\n\n\t\t// Fix the auto-draft default title.\n\t\tif (\n\t\t\t( ! edits.title || edits.title === 'Auto Draft' ) &&\n\t\t\t! newEdits.title &&\n\t\t\t( ! persistedRecord?.title ||\n\t\t\t\tpersistedRecord?.title === 'Auto Draft' )\n\t\t) {\n\t\t\tnewEdits.title = '';\n\t\t}\n\t}\n\n\treturn newEdits;\n};\n\nconst serialisableBlocksCache = new WeakMap();\n\nfunction makeBlockAttributesSerializable( attributes ) {\n\tconst newAttributes = { ...attributes };\n\tfor ( const [ key, value ] of Object.entries( attributes ) ) {\n\t\tif ( value instanceof RichTextData ) {\n\t\t\tnewAttributes[ key ] = value.valueOf();\n\t\t}\n\t}\n\treturn newAttributes;\n}\n\nfunction makeBlocksSerializable( blocks ) {\n\treturn blocks.map( ( block ) => {\n\t\tconst { innerBlocks, attributes, ...rest } = block;\n\t\treturn {\n\t\t\t...rest,\n\t\t\tattributes: makeBlockAttributesSerializable( attributes ),\n\t\t\tinnerBlocks: makeBlocksSerializable( innerBlocks ),\n\t\t};\n\t} );\n}\n\n/**\n * Returns the list of post type entities.\n *\n * @return {Promise} Entities promise\n */\nasync function loadPostTypeEntities() {\n\tconst postTypes = await apiFetch( {\n\t\tpath: '/wp/v2/types?context=view',\n\t} );\n\treturn Object.entries( postTypes ?? {} ).map( ( [ name, postType ] ) => {\n\t\tconst isTemplate = [ 'wp_template', 'wp_template_part' ].includes(\n\t\t\tname\n\t\t);\n\t\tconst namespace = postType?.rest_namespace ?? 'wp/v2';\n\t\treturn {\n\t\t\tkind: 'postType',\n\t\t\tbaseURL: `/${ namespace }/${ postType.rest_base }`,\n\t\t\tbaseURLParams: { context: 'edit' },\n\t\t\tname,\n\t\t\tlabel: postType.name,\n\t\t\ttransientEdits: {\n\t\t\t\tblocks: true,\n\t\t\t\tselection: true,\n\t\t\t},\n\t\t\tmergedEdits: { meta: true },\n\t\t\trawAttributes: POST_RAW_ATTRIBUTES,\n\t\t\tgetTitle: ( record ) =>\n\t\t\t\trecord?.title?.rendered ||\n\t\t\t\trecord?.title ||\n\t\t\t\t( isTemplate\n\t\t\t\t\t? capitalCase( record.slug ?? '' )\n\t\t\t\t\t: String( record.id ) ),\n\t\t\t__unstablePrePersist: isTemplate ? undefined : prePersistPostType,\n\t\t\t__unstable_rest_base: postType.rest_base,\n\t\t\tsyncConfig: {\n\t\t\t\tfetch: async ( id ) => {\n\t\t\t\t\treturn apiFetch( {\n\t\t\t\t\t\tpath: `/${ namespace }/${ postType.rest_base }/${ id }?context=edit`,\n\t\t\t\t\t} );\n\t\t\t\t},\n\t\t\t\tapplyChangesToDoc: ( doc, changes ) => {\n\t\t\t\t\tconst document = doc.getMap( 'document' );\n\n\t\t\t\t\tObject.entries( changes ).forEach( ( [ key, value ] ) => {\n\t\t\t\t\t\tif ( typeof value !== 'function' ) {\n\t\t\t\t\t\t\tif ( key === 'blocks' ) {\n\t\t\t\t\t\t\t\tif ( ! serialisableBlocksCache.has( value ) ) {\n\t\t\t\t\t\t\t\t\tserialisableBlocksCache.set(\n\t\t\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t\t\t\tmakeBlocksSerializable( value )\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tvalue = serialisableBlocksCache.get( value );\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif ( document.get( key ) !== value ) {\n\t\t\t\t\t\t\t\tdocument.set( key, value );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t},\n\t\t\t\tfromCRDTDoc: ( doc ) => {\n\t\t\t\t\treturn doc.getMap( 'document' ).toJSON();\n\t\t\t\t},\n\t\t\t},\n\t\t\tsyncObjectType: 'postType/' + postType.name,\n\t\t\tgetSyncObjectId: ( id ) => id,\n\t\t\tsupportsPagination: true,\n\t\t\tgetRevisionsUrl: ( parentId, revisionId ) =>\n\t\t\t\t`/${ namespace }/${\n\t\t\t\t\tpostType.rest_base\n\t\t\t\t}/${ parentId }/revisions${\n\t\t\t\t\trevisionId ? '/' + revisionId : ''\n\t\t\t\t}`,\n\t\t\trevisionKey: DEFAULT_ENTITY_KEY,\n\t\t};\n\t} );\n}\n\n/**\n * Returns the list of the taxonomies entities.\n *\n * @return {Promise} Entities promise\n */\nasync function loadTaxonomyEntities() {\n\tconst taxonomies = await apiFetch( {\n\t\tpath: '/wp/v2/taxonomies?context=view',\n\t} );\n\treturn Object.entries( taxonomies ?? {} ).map( ( [ name, taxonomy ] ) => {\n\t\tconst namespace = taxonomy?.rest_namespace ?? 'wp/v2';\n\t\treturn {\n\t\t\tkind: 'taxonomy',\n\t\t\tbaseURL: `/${ namespace }/${ taxonomy.rest_base }`,\n\t\t\tbaseURLParams: { context: 'edit' },\n\t\t\tname,\n\t\t\tlabel: taxonomy.name,\n\t\t\tgetTitle: ( record ) => record?.name,\n\t\t\tsupportsPagination: true,\n\t\t};\n\t} );\n}\n\n/**\n * Returns the Site entity.\n *\n * @return {Promise} Entity promise\n */\nasync function loadSiteEntity() {\n\tconst entity = {\n\t\tlabel: __( 'Site' ),\n\t\tname: 'site',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/settings',\n\t\tsyncConfig: {\n\t\t\tfetch: async () => {\n\t\t\t\treturn apiFetch( { path: '/wp/v2/settings' } );\n\t\t\t},\n\t\t\tapplyChangesToDoc: ( doc, changes ) => {\n\t\t\t\tconst document = doc.getMap( 'document' );\n\t\t\t\tObject.entries( changes ).forEach( ( [ key, value ] ) => {\n\t\t\t\t\tif ( document.get( key ) !== value ) {\n\t\t\t\t\t\tdocument.set( key, value );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t},\n\t\t\tfromCRDTDoc: ( doc ) => {\n\t\t\t\treturn doc.getMap( 'document' ).toJSON();\n\t\t\t},\n\t\t},\n\t\tsyncObjectType: 'root/site',\n\t\tgetSyncObjectId: () => 'index',\n\t\tmeta: {},\n\t};\n\n\tconst site = await apiFetch( {\n\t\tpath: entity.baseURL,\n\t\tmethod: 'OPTIONS',\n\t} );\n\n\tconst labels = {};\n\tObject.entries( site?.schema?.properties ?? {} ).forEach(\n\t\t( [ key, value ] ) => {\n\t\t\t// Ignore properties `title` and `type` keys.\n\t\t\tif ( typeof value === 'object' && value.title ) {\n\t\t\t\tlabels[ key ] = value.title;\n\t\t\t}\n\t\t}\n\t);\n\n\treturn [ { ...entity, meta: { labels } } ];\n}\n\n/**\n * Returns the entity's getter method name given its kind and name or plural name.\n *\n * @example\n * ```js\n * const nameSingular = getMethodName( 'root', 'theme', 'get' );\n * // nameSingular is getRootTheme\n *\n * const namePlural = getMethodName( 'root', 'themes', 'set' );\n * // namePlural is setRootThemes\n * ```\n *\n * @param {string} kind Entity kind.\n * @param {string} name Entity name or plural name.\n * @param {string} prefix Function prefix.\n *\n * @return {string} Method name\n */\nexport const getMethodName = ( kind, name, prefix = 'get' ) => {\n\tconst kindPrefix = kind === 'root' ? '' : pascalCase( kind );\n\tconst suffix = pascalCase( name );\n\treturn `${ prefix }${ kindPrefix }${ suffix }`;\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAKA,IAAAC,SAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AAVA;AACA;AACA;;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[]}
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/entities.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport { capitalCase, pascalCase } from 'change-case';\n\n/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\nimport { __unstableSerializeAndClean, parse } from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport {\n\tapplyPostChangesToCRDTDoc,\n\tdefaultApplyChangesToCRDTDoc,\n\tdefaultGetChangesFromCRDTDoc,\n\tgetPostChangesFromCRDTDoc,\n} from './utils/crdt';\n\nexport const DEFAULT_ENTITY_KEY = 'id';\nconst POST_RAW_ATTRIBUTES = [ 'title', 'excerpt', 'content' ];\n\nconst blocksTransientEdits = {\n\tblocks: {\n\t\tread: ( record ) => parse( record.content?.raw ?? '' ),\n\t\twrite: ( record ) => ( {\n\t\t\tcontent: __unstableSerializeAndClean( record.blocks ),\n\t\t} ),\n\t},\n};\n\nexport const rootEntitiesConfig = [\n\t{\n\t\tlabel: __( 'Base' ),\n\t\tkind: 'root',\n\t\tname: '__unstableBase',\n\t\tbaseURL: '/',\n\t\tbaseURLParams: {\n\t\t\t// Please also change the preload path when changing this.\n\t\t\t// @see lib/compat/wordpress-6.8/preload.php\n\t\t\t_fields: [\n\t\t\t\t'description',\n\t\t\t\t'gmt_offset',\n\t\t\t\t'home',\n\t\t\t\t'name',\n\t\t\t\t'site_icon',\n\t\t\t\t'site_icon_url',\n\t\t\t\t'site_logo',\n\t\t\t\t'timezone_string',\n\t\t\t\t'url',\n\t\t\t\t'page_for_posts',\n\t\t\t\t'page_on_front',\n\t\t\t\t'show_on_front',\n\t\t\t].join( ',' ),\n\t\t},\n\t\t// The entity doesn't support selecting multiple records.\n\t\t// The property is maintained for backward compatibility.\n\t\tplural: '__unstableBases',\n\t},\n\t{\n\t\tlabel: __( 'Post Type' ),\n\t\tname: 'postType',\n\t\tkind: 'root',\n\t\tkey: 'slug',\n\t\tbaseURL: '/wp/v2/types',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'postTypes',\n\t},\n\t{\n\t\tname: 'media',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/media',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'mediaItems',\n\t\tlabel: __( 'Media' ),\n\t\trawAttributes: [ 'caption', 'title', 'description' ],\n\t\tsupportsPagination: true,\n\t},\n\t{\n\t\tname: 'taxonomy',\n\t\tkind: 'root',\n\t\tkey: 'slug',\n\t\tbaseURL: '/wp/v2/taxonomies',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'taxonomies',\n\t\tlabel: __( 'Taxonomy' ),\n\t},\n\t{\n\t\tname: 'sidebar',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/sidebars',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'sidebars',\n\t\ttransientEdits: { blocks: true },\n\t\tlabel: __( 'Widget areas' ),\n\t},\n\t{\n\t\tname: 'widget',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/widgets',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'widgets',\n\t\ttransientEdits: { blocks: true },\n\t\tlabel: __( 'Widgets' ),\n\t},\n\t{\n\t\tname: 'widgetType',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/widget-types',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'widgetTypes',\n\t\tlabel: __( 'Widget types' ),\n\t},\n\t{\n\t\tlabel: __( 'User' ),\n\t\tname: 'user',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/users',\n\t\tgetTitle: ( record ) => record?.name || record?.slug,\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'users',\n\t\tsupportsPagination: true,\n\t},\n\t{\n\t\tname: 'comment',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/comments',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'comments',\n\t\tlabel: __( 'Comment' ),\n\t\tsupportsPagination: true,\n\t},\n\t{\n\t\tname: 'menu',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/menus',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'menus',\n\t\tlabel: __( 'Menu' ),\n\t\tsupportsPagination: true,\n\t},\n\t{\n\t\tname: 'menuItem',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/menu-items',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'menuItems',\n\t\tlabel: __( 'Menu Item' ),\n\t\trawAttributes: [ 'title' ],\n\t\tsupportsPagination: true,\n\t},\n\t{\n\t\tname: 'menuLocation',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/menu-locations',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'menuLocations',\n\t\tlabel: __( 'Menu Location' ),\n\t\tkey: 'name',\n\t},\n\t{\n\t\tlabel: __( 'Global Styles' ),\n\t\tname: 'globalStyles',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/global-styles',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'globalStylesVariations', // Should be different from name.\n\t\tgetTitle: () => __( 'Custom Styles' ),\n\t\tgetRevisionsUrl: ( parentId, revisionId ) =>\n\t\t\t`/wp/v2/global-styles/${ parentId }/revisions${\n\t\t\t\trevisionId ? '/' + revisionId : ''\n\t\t\t}`,\n\t\tsupportsPagination: true,\n\t},\n\t{\n\t\tlabel: __( 'Themes' ),\n\t\tname: 'theme',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/themes',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'themes',\n\t\tkey: 'stylesheet',\n\t},\n\t{\n\t\tlabel: __( 'Plugins' ),\n\t\tname: 'plugin',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/plugins',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'plugins',\n\t\tkey: 'plugin',\n\t},\n\t{\n\t\tlabel: __( 'Status' ),\n\t\tname: 'status',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/statuses',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'statuses',\n\t\tkey: 'slug',\n\t},\n];\n\nexport const deprecatedEntities = {\n\troot: {\n\t\tmedia: {\n\t\t\tsince: '6.9',\n\t\t\talternative: {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'attachment',\n\t\t\t},\n\t\t},\n\t},\n};\n\nexport const additionalEntityConfigLoaders = [\n\t{ kind: 'postType', loadEntities: loadPostTypeEntities },\n\t{ kind: 'taxonomy', loadEntities: loadTaxonomyEntities },\n\t{\n\t\tkind: 'root',\n\t\tname: 'site',\n\t\tplural: 'sites',\n\t\tloadEntities: loadSiteEntity,\n\t},\n];\n\n/**\n * Returns a function to be used to retrieve extra edits to apply before persisting a post type.\n *\n * @param {Object} persistedRecord Already persisted Post\n * @param {Object} edits Edits.\n * @return {Object} Updated edits.\n */\nexport const prePersistPostType = ( persistedRecord, edits ) => {\n\tconst newEdits = {};\n\n\tif ( persistedRecord?.status === 'auto-draft' ) {\n\t\t// Saving an auto-draft should create a draft by default.\n\t\tif ( ! edits.status && ! newEdits.status ) {\n\t\t\tnewEdits.status = 'draft';\n\t\t}\n\n\t\t// Fix the auto-draft default title.\n\t\tif (\n\t\t\t( ! edits.title || edits.title === 'Auto Draft' ) &&\n\t\t\t! newEdits.title &&\n\t\t\t( ! persistedRecord?.title ||\n\t\t\t\tpersistedRecord?.title === 'Auto Draft' )\n\t\t) {\n\t\t\tnewEdits.title = '';\n\t\t}\n\t}\n\n\treturn newEdits;\n};\n\n/**\n * Returns the list of post type entities.\n *\n * @return {Promise} Entities promise\n */\nasync function loadPostTypeEntities() {\n\tconst postTypes = await apiFetch( {\n\t\tpath: '/wp/v2/types?context=view',\n\t} );\n\treturn Object.entries( postTypes ?? {} ).map( ( [ name, postType ] ) => {\n\t\tconst isTemplate = [ 'wp_template', 'wp_template_part' ].includes(\n\t\t\tname\n\t\t);\n\t\tconst namespace = postType?.rest_namespace ?? 'wp/v2';\n\n\t\t/**\n\t\t * @type {import('@wordpress/sync').SyncConfig}\n\t\t */\n\t\tconst syncConfig = {\n\t\t\t/**\n\t\t\t * Apply changes from the local editor to the local CRDT document so\n\t\t\t * that those changes can be synced to other peers (via the provider).\n\t\t\t *\n\t\t\t * @param {import('@wordpress/sync').CRDTDoc} crdtDoc\n\t\t\t * @param {Partial< import('@wordpress/sync').ObjectData >} changes\n\t\t\t * @return {void}\n\t\t\t */\n\t\t\tapplyChangesToCRDTDoc: ( crdtDoc, changes ) =>\n\t\t\t\tapplyPostChangesToCRDTDoc( crdtDoc, changes, postType ),\n\n\t\t\t/**\n\t\t\t * Extract changes from a CRDT document that can be used to update the\n\t\t\t * local editor state.\n\t\t\t *\n\t\t\t * @param {import('@wordpress/sync').CRDTDoc} crdtDoc\n\t\t\t * @param {import('@wordpress/sync').ObjectData} editedRecord\n\t\t\t * @return {Partial< import('@wordpress/sync').ObjectData >} Changes to record\n\t\t\t */\n\t\t\tgetChangesFromCRDTDoc: ( crdtDoc, editedRecord ) =>\n\t\t\t\tgetPostChangesFromCRDTDoc( crdtDoc, editedRecord, postType ),\n\n\t\t\t/**\n\t\t\t * Sync features supported by the entity.\n\t\t\t *\n\t\t\t * @type {Record< string, boolean >}\n\t\t\t */\n\t\t\tsupports: {},\n\t\t};\n\n\t\treturn {\n\t\t\tkind: 'postType',\n\t\t\tbaseURL: `/${ namespace }/${ postType.rest_base }`,\n\t\t\tbaseURLParams: { context: 'edit' },\n\t\t\tname,\n\t\t\tlabel: postType.name,\n\t\t\ttransientEdits: {\n\t\t\t\t...blocksTransientEdits,\n\t\t\t\tselection: true,\n\t\t\t},\n\t\t\tmergedEdits: { meta: true },\n\t\t\trawAttributes: POST_RAW_ATTRIBUTES,\n\t\t\tgetTitle: ( record ) =>\n\t\t\t\trecord?.title?.rendered ||\n\t\t\t\trecord?.title ||\n\t\t\t\t( isTemplate\n\t\t\t\t\t? capitalCase( record.slug ?? '' )\n\t\t\t\t\t: String( record.id ) ),\n\t\t\t__unstablePrePersist: isTemplate ? undefined : prePersistPostType,\n\t\t\t__unstable_rest_base: postType.rest_base,\n\t\t\tsyncConfig,\n\t\t\tsupportsPagination: true,\n\t\t\tgetRevisionsUrl: ( parentId, revisionId ) =>\n\t\t\t\t`/${ namespace }/${\n\t\t\t\t\tpostType.rest_base\n\t\t\t\t}/${ parentId }/revisions${\n\t\t\t\t\trevisionId ? '/' + revisionId : ''\n\t\t\t\t}`,\n\t\t\trevisionKey: DEFAULT_ENTITY_KEY,\n\t\t};\n\t} );\n}\n\n/**\n * Returns the list of the taxonomies entities.\n *\n * @return {Promise} Entities promise\n */\nasync function loadTaxonomyEntities() {\n\tconst taxonomies = await apiFetch( {\n\t\tpath: '/wp/v2/taxonomies?context=view',\n\t} );\n\treturn Object.entries( taxonomies ?? {} ).map( ( [ name, taxonomy ] ) => {\n\t\tconst namespace = taxonomy?.rest_namespace ?? 'wp/v2';\n\t\treturn {\n\t\t\tkind: 'taxonomy',\n\t\t\tbaseURL: `/${ namespace }/${ taxonomy.rest_base }`,\n\t\t\tbaseURLParams: { context: 'edit' },\n\t\t\tname,\n\t\t\tlabel: taxonomy.name,\n\t\t\tgetTitle: ( record ) => record?.name,\n\t\t\tsupportsPagination: true,\n\t\t};\n\t} );\n}\n\n/**\n * Returns the Site entity.\n *\n * @return {Promise} Entity promise\n */\nasync function loadSiteEntity() {\n\tconst entity = {\n\t\tlabel: __( 'Site' ),\n\t\tname: 'site',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/settings',\n\t\tsyncConfig: {\n\t\t\tapplyChangesToCRDTDoc: defaultApplyChangesToCRDTDoc,\n\t\t\tgetChangesFromCRDTDoc: defaultGetChangesFromCRDTDoc,\n\t\t},\n\t\tmeta: {},\n\t};\n\n\tconst site = await apiFetch( {\n\t\tpath: entity.baseURL,\n\t\tmethod: 'OPTIONS',\n\t} );\n\n\tconst labels = {};\n\tObject.entries( site?.schema?.properties ?? {} ).forEach(\n\t\t( [ key, value ] ) => {\n\t\t\t// Ignore properties `title` and `type` keys.\n\t\t\tif ( typeof value === 'object' && value.title ) {\n\t\t\t\tlabels[ key ] = value.title;\n\t\t\t}\n\t\t}\n\t);\n\n\treturn [ { ...entity, meta: { labels } } ];\n}\n\n/**\n * Returns the entity's getter method name given its kind and name or plural name.\n *\n * @example\n * ```js\n * const nameSingular = getMethodName( 'root', 'theme', 'get' );\n * // nameSingular is getRootTheme\n *\n * const namePlural = getMethodName( 'root', 'themes', 'set' );\n * // namePlural is setRootThemes\n * ```\n *\n * @param {string} kind Entity kind.\n * @param {string} name Entity name or plural name.\n * @param {string} prefix Function prefix.\n *\n * @return {string} Method name\n */\nexport const getMethodName = ( kind, name, prefix = 'get' ) => {\n\tconst kindPrefix = kind === 'root' ? '' : pascalCase( kind );\n\tconst suffix = pascalCase( name );\n\treturn `${ prefix }${ kindPrefix }${ suffix }`;\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,yBAAwC;AAKxC,uBAAqB;AACrB,oBAAmD;AACnD,kBAAmB;AAKnB,kBAKO;AAEA,MAAM,qBAAqB;AAClC,MAAM,sBAAsB,CAAE,SAAS,WAAW,SAAU;AAE5D,MAAM,uBAAuB;AAAA,EAC5B,QAAQ;AAAA,IACP,MAAM,CAAE,eAAY,qBAAO,OAAO,SAAS,OAAO,EAAG;AAAA,IACrD,OAAO,CAAE,YAAc;AAAA,MACtB,aAAS,2CAA6B,OAAO,MAAO;AAAA,IACrD;AAAA,EACD;AACD;AAEO,MAAM,qBAAqB;AAAA,EACjC;AAAA,IACC,WAAO,gBAAI,MAAO;AAAA,IAClB,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,eAAe;AAAA;AAAA;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EAAE,CAAE;AAC1C;AAoBO,MAAM,gBAAgB,CAAE,MAAM,MAAM,SAAS,UAAW;AAC9D,QAAM,aAAa,SAAS,SAAS,SAAK,+BAAY,IAAK;AAC3D,QAAM,aAAS,+BAAY,IAAK;AAChC,SAAO,GAAI,MAAO,GAAI,UAAW,GAAI,MAAO;AAC7C;",
|
|
6
|
+
"names": ["apiFetch"]
|
|
7
|
+
}
|
package/build/entity-context.js
CHANGED
|
@@ -1,14 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var entity_context_exports = {};
|
|
20
|
+
__export(entity_context_exports, {
|
|
21
|
+
EntityContext: () => EntityContext
|
|
5
22
|
});
|
|
6
|
-
exports
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
//# sourceMappingURL=entity-context.js.map
|
|
23
|
+
module.exports = __toCommonJS(entity_context_exports);
|
|
24
|
+
var import_element = require("@wordpress/element");
|
|
25
|
+
const EntityContext = (0, import_element.createContext)({});
|
|
26
|
+
EntityContext.displayName = "EntityContext";
|
|
27
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
28
|
+
0 && (module.exports = {
|
|
29
|
+
EntityContext
|
|
30
|
+
});
|
|
31
|
+
//# sourceMappingURL=entity-context.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/entity-context.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createContext } from '@wordpress/element';\n\nexport const EntityContext = createContext( {} );\nEntityContext.displayName = 'EntityContext';\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAA8B;AAEvB,MAAM,oBAAgB,8BAAe,CAAC,CAAE;AAC/C,cAAc,cAAc;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/build/entity-provider.js
CHANGED
|
@@ -1,49 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var entity_provider_exports = {};
|
|
20
|
+
__export(entity_provider_exports, {
|
|
21
|
+
default: () => EntityProvider
|
|
5
22
|
});
|
|
6
|
-
exports
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
* @param {string} props.kind The entity kind.
|
|
24
|
-
* @param {string} props.type The entity name.
|
|
25
|
-
* @param {number} props.id The entity ID.
|
|
26
|
-
* @param {*} props.children The children to wrap.
|
|
27
|
-
*
|
|
28
|
-
* @return {Object} The provided children, wrapped with
|
|
29
|
-
* the entity's context provider.
|
|
30
|
-
*/function EntityProvider({
|
|
31
|
-
kind,
|
|
32
|
-
type: name,
|
|
33
|
-
id,
|
|
34
|
-
children
|
|
35
|
-
}) {
|
|
36
|
-
const parent = (0, _element.useContext)(_entityContext.EntityContext);
|
|
37
|
-
const childContext = (0, _element.useMemo)(() => ({
|
|
38
|
-
...parent,
|
|
39
|
-
[kind]: {
|
|
40
|
-
...parent?.[kind],
|
|
41
|
-
[name]: id
|
|
42
|
-
}
|
|
43
|
-
}), [parent, kind, name, id]);
|
|
44
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_entityContext.EntityContext.Provider, {
|
|
45
|
-
value: childContext,
|
|
46
|
-
children: children
|
|
47
|
-
});
|
|
23
|
+
module.exports = __toCommonJS(entity_provider_exports);
|
|
24
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
|
+
var import_element = require("@wordpress/element");
|
|
26
|
+
var import_entity_context = require("./entity-context");
|
|
27
|
+
function EntityProvider({ kind, type: name, id, children }) {
|
|
28
|
+
const parent = (0, import_element.useContext)(import_entity_context.EntityContext);
|
|
29
|
+
const childContext = (0, import_element.useMemo)(
|
|
30
|
+
() => ({
|
|
31
|
+
...parent,
|
|
32
|
+
[kind]: {
|
|
33
|
+
...parent?.[kind],
|
|
34
|
+
[name]: id
|
|
35
|
+
}
|
|
36
|
+
}),
|
|
37
|
+
[parent, kind, name, id]
|
|
38
|
+
);
|
|
39
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_entity_context.EntityContext.Provider, { value: childContext, children });
|
|
48
40
|
}
|
|
49
|
-
//# sourceMappingURL=entity-provider.js.map
|
|
41
|
+
//# sourceMappingURL=entity-provider.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/entity-provider.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useContext, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { EntityContext } from './entity-context';\n\n/**\n * Context provider component for providing\n * an entity for a specific entity.\n *\n * @param {Object} props The component's props.\n * @param {string} props.kind The entity kind.\n * @param {string} props.type The entity name.\n * @param {number} props.id The entity ID.\n * @param {*} props.children The children to wrap.\n *\n * @return {Object} The provided children, wrapped with\n * the entity's context provider.\n */\nexport default function EntityProvider( { kind, type: name, id, children } ) {\n\tconst parent = useContext( EntityContext );\n\tconst childContext = useMemo(\n\t\t() => ( {\n\t\t\t...parent,\n\t\t\t[ kind ]: {\n\t\t\t\t...parent?.[ kind ],\n\t\t\t\t[ name ]: id,\n\t\t\t},\n\t\t} ),\n\t\t[ parent, kind, name, id ]\n\t);\n\treturn (\n\t\t<EntityContext.Provider value={ childContext }>\n\t\t\t{ children }\n\t\t</EntityContext.Provider>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAoCE;AAjCF,qBAAoC;AAKpC,4BAA8B;AAef,SAAR,eAAiC,EAAE,MAAM,MAAM,MAAM,IAAI,SAAS,GAAI;AAC5E,QAAM,aAAS,2BAAY,mCAAc;AACzC,QAAM,mBAAe;AAAA,IACpB,OAAQ;AAAA,MACP,GAAG;AAAA,MACH,CAAE,IAAK,GAAG;AAAA,QACT,GAAG,SAAU,IAAK;AAAA,QAClB,CAAE,IAAK,GAAG;AAAA,MACX;AAAA,IACD;AAAA,IACA,CAAE,QAAQ,MAAM,MAAM,EAAG;AAAA,EAC1B;AACA,SACC,4CAAC,oCAAc,UAAd,EAAuB,OAAQ,cAC7B,UACH;AAEF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var attachment_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(attachment_exports);
|
|
17
|
+
//# sourceMappingURL=attachment.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/entity-types/attachment.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport type {\n\tContext,\n\tContextualField,\n\tMediaType,\n\tPostStatus,\n\tRenderedText,\n\tOmitNevers,\n\tCommentingStatus,\n\tPingStatus,\n} from './helpers';\n\nimport type { BaseEntityRecords as _BaseEntityRecords } from './base-entity-records';\n\ninterface MediaDetails {\n\twidth: number;\n\theight: number;\n\tfile: string;\n\tfilesize: number;\n\tsizes: { [ key: string ]: Size };\n\timage_meta: ImageMeta;\n\toriginal_image?: string;\n}\ninterface ImageMeta {\n\taperture: string;\n\tcredit: string;\n\tcamera: string;\n\tcaption: string;\n\tcreated_timestamp: string;\n\tcopyright: string;\n\tfocal_length: string;\n\tiso: string;\n\tshutter_speed: string;\n\ttitle: string;\n\torientation: string;\n\tkeywords: any[];\n}\n\ninterface Size {\n\tfile: string;\n\twidth: number;\n\theight: number;\n\tfilesize?: number;\n\tmime_type: string;\n\tsource_url: string;\n\tuncropped?: boolean;\n}\n\ndeclare module './base-entity-records' {\n\texport namespace BaseEntityRecords {\n\t\texport interface Attachment< C extends Context > {\n\t\t\t/**\n\t\t\t * The date the post was published, in the site's timezone.\n\t\t\t */\n\t\t\tdate: string | null;\n\t\t\t/**\n\t\t\t * The date the post was published, as GMT.\n\t\t\t */\n\t\t\tdate_gmt: ContextualField< string | null, 'view' | 'edit', C >;\n\t\t\t/**\n\t\t\t * The globally unique identifier for the post.\n\t\t\t */\n\t\t\tguid: ContextualField< RenderedText< C >, 'view' | 'edit', C >;\n\t\t\t/**\n\t\t\t * Unique identifier for the post.\n\t\t\t */\n\t\t\tid: number;\n\t\t\t/**\n\t\t\t * URL to the post.\n\t\t\t */\n\t\t\tlink: string;\n\t\t\t/**\n\t\t\t * The date the post was last modified, in the site's timezone.\n\t\t\t */\n\t\t\tmodified: ContextualField< string, 'view' | 'edit', C >;\n\t\t\t/**\n\t\t\t * The date the post was last modified, as GMT.\n\t\t\t */\n\t\t\tmodified_gmt: ContextualField< string, 'view' | 'edit', C >;\n\t\t\t/**\n\t\t\t * An alphanumeric identifier for the post unique to its type.\n\t\t\t */\n\t\t\tslug: string;\n\t\t\t/**\n\t\t\t * A named status for the post.\n\t\t\t */\n\t\t\tstatus: ContextualField< PostStatus, 'view' | 'edit', C >;\n\t\t\t/**\n\t\t\t * Type of post.\n\t\t\t */\n\t\t\ttype: string;\n\t\t\t/**\n\t\t\t * Permalink template for the post.\n\t\t\t */\n\t\t\tpermalink_template: ContextualField< string, 'edit', C >;\n\t\t\t/**\n\t\t\t * Slug automatically generated from the post title.\n\t\t\t */\n\t\t\tgenerated_slug: ContextualField< string, 'edit', C >;\n\t\t\t/**\n\t\t\t * The title for the post.\n\t\t\t */\n\t\t\ttitle: RenderedText< C >;\n\t\t\t/**\n\t\t\t * The ID for the author of the post.\n\t\t\t */\n\t\t\tauthor: number;\n\t\t\t/**\n\t\t\t * Whether or not comments are open on the post.\n\t\t\t */\n\t\t\tcomment_status: ContextualField<\n\t\t\t\tCommentingStatus,\n\t\t\t\t'view' | 'edit',\n\t\t\t\tC\n\t\t\t>;\n\t\t\t/**\n\t\t\t * Whether or not the post can be pinged.\n\t\t\t */\n\t\t\tping_status: ContextualField< PingStatus, 'view' | 'edit', C >;\n\t\t\t/**\n\t\t\t * Meta fields.\n\t\t\t */\n\t\t\tmeta: ContextualField<\n\t\t\t\tRecord< string, unknown >,\n\t\t\t\t'view' | 'edit',\n\t\t\t\tC\n\t\t\t>;\n\t\t\t/**\n\t\t\t * The theme file to use to display the post.\n\t\t\t */\n\t\t\ttemplate: ContextualField< string, 'view' | 'edit', C >;\n\t\t\t/**\n\t\t\t * Alternative text to display when attachment is not displayed.\n\t\t\t */\n\t\t\talt_text: string;\n\t\t\t/**\n\t\t\t * The attachment caption.\n\t\t\t */\n\t\t\tcaption: ContextualField< string, 'edit', C >;\n\t\t\t/**\n\t\t\t * The attachment description.\n\t\t\t */\n\t\t\tdescription: ContextualField<\n\t\t\t\tRenderedText< C >,\n\t\t\t\t'view' | 'edit',\n\t\t\t\tC\n\t\t\t>;\n\t\t\t/**\n\t\t\t * Attachment type.\n\t\t\t */\n\t\t\tmedia_type: MediaType;\n\t\t\t/**\n\t\t\t * The attachment MIME type.\n\t\t\t */\n\t\t\tmime_type: string;\n\t\t\t/**\n\t\t\t * Details about the media file, specific to its type.\n\t\t\t */\n\t\t\tmedia_details: MediaDetails;\n\t\t\t/**\n\t\t\t * The ID for the associated post of the attachment.\n\t\t\t */\n\t\t\tpost: ContextualField< number, 'view' | 'edit', C >;\n\t\t\t/**\n\t\t\t * URL to the original attachment file.\n\t\t\t */\n\t\t\tsource_url: string;\n\t\t\t/**\n\t\t\t * List of the missing image sizes of the attachment.\n\t\t\t */\n\t\t\tmissing_image_sizes: ContextualField< string[], 'edit', C >;\n\t\t}\n\t}\n}\n\nexport type Attachment< C extends Context = 'edit' > = OmitNevers<\n\t_BaseEntityRecords.Attachment< C >\n>;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,43 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
* }
|
|
19
|
-
* }
|
|
20
|
-
* ```
|
|
21
|
-
*
|
|
22
|
-
* The huge upside is that consumers of @wordpress/core-data may extend the
|
|
23
|
-
* exported data types using interface merging as follows:
|
|
24
|
-
*
|
|
25
|
-
* ```ts
|
|
26
|
-
* import type { Context } from '@wordpress/core-data';
|
|
27
|
-
* declare module '@wordpress/core-data' {
|
|
28
|
-
* export namespace BaseEntityRecords {
|
|
29
|
-
* export interface Comment< C extends Context > {
|
|
30
|
-
* numberOfViews: number;
|
|
31
|
-
* }
|
|
32
|
-
* }
|
|
33
|
-
* }
|
|
34
|
-
*
|
|
35
|
-
* import type { Comment } from '@wordpress/core-data';
|
|
36
|
-
* const c : Comment< 'view' > = ...;
|
|
37
|
-
*
|
|
38
|
-
* // c.numberOfViews is a number
|
|
39
|
-
* // c.id is still present
|
|
40
|
-
* ```
|
|
41
|
-
*/
|
|
42
|
-
let BaseEntityRecords = exports.BaseEntityRecords = void 0;
|
|
43
|
-
//# sourceMappingURL=base-entity-records.js.map
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var base_entity_records_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(base_entity_records_exports);
|
|
17
|
+
//# sourceMappingURL=base-entity-records.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/entity-types/base-entity-records.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * This module exists solely to make the BaseEntityRecords namespace extensible\n * with declaration merging:\n *\n * ```ts\n * declare module './base-entity-records' {\n * export namespace BaseEntityRecords {\n * \t\t export interface Comment< C extends Context > {\n * \t\t id: number;\n * \t\t // ...\n * \t }\n * \t }\n * }\n * ```\n *\n * The huge upside is that consumers of @wordpress/core-data may extend the\n * exported data types using interface merging as follows:\n *\n * ```ts\n * import type { Context } from '@wordpress/core-data';\n * declare module '@wordpress/core-data' {\n * export namespace BaseEntityRecords {\n * export interface Comment< C extends Context > {\n * numberOfViews: number;\n * }\n * }\n * }\n *\n * import type { Comment } from '@wordpress/core-data';\n * const c : Comment< 'view' > = ...;\n *\n * // c.numberOfViews is a number\n * // c.id is still present\n * ```\n */\nexport namespace BaseEntityRecords {}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var base_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(base_exports);
|
|
17
|
+
//# sourceMappingURL=base.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/entity-types/base.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { Context, OmitNevers } from './helpers';\nimport type { BaseEntityRecords as _BaseEntityRecords } from './base-entity-records';\n\nexport type TemplatePartArea = {\n\tarea: string;\n\tlabel: string;\n\ticon: string;\n\tdescription: string;\n};\n\nexport type TemplateType = {\n\ttitle: string;\n\tdescription: string;\n\tslug: string;\n};\n\ndeclare module './base-entity-records' {\n\texport namespace BaseEntityRecords {\n\t\t/* eslint-disable-next-line @typescript-eslint/no-unused-vars */\n\t\texport interface Base< C extends Context > {\n\t\t\t/**\n\t\t\t * Site description.\n\t\t\t */\n\t\t\tdescription: string;\n\n\t\t\t/**\n\t\t\t * GMT offset for the site.\n\t\t\t */\n\t\t\tgmt_offset: string;\n\n\t\t\t/**\n\t\t\t * Home URL.\n\t\t\t */\n\t\t\thome: string;\n\n\t\t\t/**\n\t\t\t * Site title\n\t\t\t */\n\t\t\tname: string;\n\n\t\t\t/**\n\t\t\t * Site icon ID.\n\t\t\t */\n\t\t\tsite_icon?: number;\n\n\t\t\t/**\n\t\t\t * Site icon URL.\n\t\t\t */\n\t\t\tsite_icon_url: string;\n\n\t\t\t/**\n\t\t\t * Site logo ID.\n\t\t\t */\n\t\t\tsite_logo?: number;\n\n\t\t\t/**\n\t\t\t * Site timezone string.\n\t\t\t */\n\t\t\ttimezone_string: string;\n\n\t\t\t/**\n\t\t\t * Site URL.\n\t\t\t */\n\t\t\turl: string;\n\n\t\t\t/**\n\t\t\t * Page for posts.\n\t\t\t */\n\t\t\tpage_for_posts: number;\n\n\t\t\t/**\n\t\t\t * Page on front.\n\t\t\t */\n\t\t\tpage_on_front: number;\n\n\t\t\t/**\n\t\t\t * Show on front.\n\t\t\t */\n\t\t\tshow_on_front: string;\n\t\t}\n\t}\n}\n\nexport type Base< C extends Context = 'edit' > = OmitNevers<\n\t_BaseEntityRecords.Base< C >\n>;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var comment_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(comment_exports);
|
|
17
|
+
//# sourceMappingURL=comment.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/entity-types/comment.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport type {\n\tAvatarUrls,\n\tContext,\n\tContextualField,\n\tOmitNevers,\n\tRenderedText,\n} from './helpers';\nimport type { BaseEntityRecords as _BaseEntityRecords } from './base-entity-records';\n\nexport type CommentStatus = 'hold' | 'approve' | 'spam' | 'trash' | '1' | '0';\n\ndeclare module './base-entity-records' {\n\texport namespace BaseEntityRecords {\n\t\texport interface Comment< C extends Context > {\n\t\t\t/**\n\t\t\t * Unique identifier for the comment.\n\t\t\t */\n\t\t\tid: number;\n\t\t\t/**\n\t\t\t * The ID of the user object, if author was a user.\n\t\t\t */\n\t\t\tauthor: number;\n\t\t\t/**\n\t\t\t * Email address for the comment author.\n\t\t\t */\n\t\t\tauthor_email: ContextualField< string, 'edit', C >;\n\t\t\t/**\n\t\t\t * IP address for the comment author.\n\t\t\t */\n\t\t\tauthor_ip: ContextualField< string, 'edit', C >;\n\t\t\t/**\n\t\t\t * Display name for the comment author.\n\t\t\t */\n\t\t\tauthor_name: string;\n\t\t\t/**\n\t\t\t * URL for the comment author.\n\t\t\t */\n\t\t\tauthor_url: string;\n\t\t\t/**\n\t\t\t * User agent for the comment author.\n\t\t\t */\n\t\t\tauthor_user_agent: ContextualField< string, 'edit', C >;\n\t\t\t/**\n\t\t\t * The content for the comment.\n\t\t\t */\n\t\t\tcontent: RenderedText< C >;\n\t\t\t/**\n\t\t\t * The date the comment was published, in the site's timezone.\n\t\t\t */\n\t\t\tdate: string;\n\t\t\t/**\n\t\t\t * The date the comment was published, as GMT.\n\t\t\t */\n\t\t\tdate_gmt: ContextualField< string, 'view' | 'edit', C >;\n\t\t\t/**\n\t\t\t * URL to the comment.\n\t\t\t */\n\t\t\tlink: string;\n\t\t\t/**\n\t\t\t * The ID for the parent of the comment.\n\t\t\t */\n\t\t\tparent: number;\n\t\t\t/**\n\t\t\t * The ID of the associated post object.\n\t\t\t */\n\t\t\tpost: ContextualField< number, 'view' | 'edit', C >;\n\t\t\t/**\n\t\t\t * State of the comment.\n\t\t\t */\n\t\t\tstatus: ContextualField< CommentStatus, 'view' | 'edit', C >;\n\t\t\t/**\n\t\t\t * Type of the comment.\n\t\t\t */\n\t\t\ttype: string;\n\t\t\t/**\n\t\t\t * Avatar URLs for the comment author.\n\t\t\t */\n\t\t\tauthor_avatar_urls: AvatarUrls;\n\t\t\t/**\n\t\t\t * Meta fields.\n\t\t\t */\n\t\t\tmeta: ContextualField<\n\t\t\t\tRecord< string, unknown >,\n\t\t\t\t'view' | 'edit',\n\t\t\t\tC\n\t\t\t>;\n\t\t}\n\t}\n}\n\nexport type Comment< C extends Context = 'edit' > = OmitNevers<\n\t_BaseEntityRecords.Comment< C >\n>;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var global_styles_revision_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(global_styles_revision_exports);
|
|
17
|
+
//# sourceMappingURL=global-styles-revision.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/entity-types/global-styles-revision.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { Context, ContextualField, OmitNevers } from './helpers';\n\nimport type { BaseEntityRecords as _BaseEntityRecords } from './base-entity-records';\n\ndeclare module './base-entity-records' {\n\texport namespace BaseEntityRecords {\n\t\texport interface GlobalStylesRevision< C extends Context > {\n\t\t\t/**\n\t\t\t * The ID for the author of the global styles revision.\n\t\t\t */\n\t\t\tauthor: number;\n\t\t\t/**\n\t\t\t * The date the post global styles revision published, in the site's timezone.\n\t\t\t */\n\t\t\tdate: string | null;\n\t\t\t/**\n\t\t\t * The date the global styles revision was published, as GMT.\n\t\t\t */\n\t\t\tdate_gmt: ContextualField< string | null, 'view' | 'edit', C >;\n\t\t\t/**\n\t\t\t * Unique identifier for the revision.\n\t\t\t */\n\t\t\tid: number;\n\t\t\t/**\n\t\t\t * The date the global styles revision was last modified, in the site's timezone.\n\t\t\t */\n\t\t\tmodified: ContextualField< string, 'view' | 'edit', C >;\n\t\t\t/**\n\t\t\t * The date the global styles revision was last modified, as GMT.\n\t\t\t */\n\t\t\tmodified_gmt: ContextualField< string, 'view' | 'edit', C >;\n\t\t\t/**\n\t\t\t * Identifier for the parent of the revision.\n\t\t\t */\n\t\t\tparent: number;\n\t\t\tstyles: Record< string, Object >;\n\t\t\tsettings: Record< string, Object >;\n\t\t}\n\t}\n}\n\nexport type GlobalStylesRevision< C extends Context = 'view' > = OmitNevers<\n\t_BaseEntityRecords.GlobalStylesRevision< C >\n>;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var helpers_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(helpers_exports);
|
|
17
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/entity-types/helpers.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { EntityRecord } from './index';\n\nexport interface AvatarUrls {\n\t/**\n\t * Avatar URL with image size of 24 pixels.\n\t */\n\t'24': string;\n\t/**\n\t * Avatar URL with image size of 48 pixels.\n\t */\n\t'48': string;\n\t/**\n\t * Avatar URL with image size of 96 pixels.\n\t */\n\t'96': string;\n}\n\nexport type MediaType = 'image' | 'file';\nexport type CommentingStatus = 'open' | 'closed';\nexport type PingStatus = 'open' | 'closed';\nexport type PostStatus = 'publish' | 'future' | 'draft' | 'pending' | 'private';\nexport type PostFormat =\n\t| 'standard'\n\t| 'aside'\n\t| 'chat'\n\t| 'gallery'\n\t| 'link'\n\t| 'image'\n\t| 'quote'\n\t| 'status'\n\t| 'video'\n\t| 'audio';\n\n/**\n * The REST API context parameter.\n */\nexport type Context = 'view' | 'edit' | 'embed';\n\n/**\n * ContextualField makes the field available only in the specified given contexts,\n * and ensure the field is absent from the object when in a different context.\n *\n * @example\n * ```ts\n * interface Post< C extends Context > {\n * \t\u2026\n * \tmodified: ContextualField< string, 'edit' | 'view', C >;\n * \tpassword: ContextualField< string, 'edit', C >;\n * \t\u2026\n * }\n *\n * const post: Post<'edit'> = \u2026\n * // post.modified exists as a string\n * // post.password exists as a string\n *\n * const post: Post<'view'> = \u2026\n * // post.modified still exists as a string\n * // post.password is missing, undefined, because we're not in the `edit` context.\n * ```\n */\nexport type ContextualField<\n\tFieldType,\n\tAvailableInContexts extends Context,\n\tC extends Context,\n> = AvailableInContexts extends C ? FieldType : never;\n\n/**\n * Removes all the properties of type never, even the deeply nested ones.\n *\n * @example\n * ```ts\n * type MyType = {\n * foo: string;\n * bar: never;\n * nested: {\n * foo: string;\n * bar: never;\n * }\n * }\n * const x = {} as OmitNevers<MyType>;\n * // x is of type { foo: string; nested: { foo: string; }}\n * // The `never` properties were removed entirely\n * ```\n */\nexport type OmitNevers<\n\tT,\n\tNevers = {\n\t\t[ K in keyof T ]: Exclude< T[ K ], undefined > extends never\n\t\t\t? never\n\t\t\t: T[ K ] extends Record< string, unknown >\n\t\t\t? OmitNevers< T[ K ] >\n\t\t\t: T[ K ];\n\t},\n> = Pick<\n\tNevers,\n\t{\n\t\t[ K in keyof Nevers ]: Nevers[ K ] extends never ? never : K;\n\t}[ keyof Nevers ]\n>;\n\n/**\n * A string that the server renders which often involves\n * modifications from the raw source string.\n *\n * For example, block HTML with the comment delimiters exists\n * in `post_content` but those comments are stripped out when\n * rendering to a page view. Similarly, plugins might modify\n * content or replace shortcodes.\n */\nexport interface RenderedText< C extends Context > {\n\t/**\n\t * The source string which will be rendered on page views.\n\t */\n\traw: ContextualField< string, 'edit', C >;\n\t/**\n\t * The output of the raw source after processing and filtering on the server.\n\t */\n\trendered: string;\n}\n\n/**\n * Updatable<EntityRecord> is a type describing Edited Entity Records. They are like\n * regular Entity Records, but they have all the local edits applied on top of the REST API data.\n *\n * This turns certain field from an object into a string.\n *\n * Entities like Post have fields that only be rendered on the server, like title, excerpt,\n * and content. The REST API exposes both the raw markup and the rendered version of those fields.\n * For example, in the block editor, content.rendered could used as a visual preview, and\n * content.raw could be used to populate the code editor.\n *\n * When updating these rendered fields, JavaScript is not be able to properly render arbitrary block\n * markup. Therefore, it stores only the raw markup without the rendered part. And since that's a string,\n * the entire field becomes a string.\n *\n * @example\n * ```ts\n * type Post< C extends Context > {\n * title: RenderedText< C >;\n * }\n * const post = {} as Post;\n * // post.title is an object with raw and rendered properties\n *\n * const updatablePost = {} as Updatable< Post >;\n * // updatablePost.title is a string\n * ```\n */\nexport type Updatable< T extends EntityRecord< 'edit' > > = {\n\t[ K in keyof T ]: T[ K ] extends RenderedText< any > ? string : T[ K ];\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|