@wordpress/core-data 7.26.1-next.719a03cbe.0 → 7.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/build/entity-types/attachment.js.map +1 -1
- package/build/entity-types/comment.js.map +1 -1
- package/build/entity-types/nav-menu-item.js.map +1 -1
- package/build/entity-types/nav-menu.js.map +1 -1
- package/build/entity-types/page.js.map +1 -1
- package/build/entity-types/post-revision.js.map +1 -1
- package/build/entity-types/post.js.map +1 -1
- package/build/entity-types/term.js.map +1 -1
- package/build/entity-types/user.js.map +1 -1
- package/build/hooks/use-entity-records.js +8 -1
- package/build/hooks/use-entity-records.js.map +1 -1
- package/build/resolvers.js +11 -6
- package/build/resolvers.js.map +1 -1
- package/build-module/entity-types/attachment.js.map +1 -1
- package/build-module/entity-types/comment.js.map +1 -1
- package/build-module/entity-types/nav-menu-item.js.map +1 -1
- package/build-module/entity-types/nav-menu.js.map +1 -1
- package/build-module/entity-types/page.js.map +1 -1
- package/build-module/entity-types/post-revision.js.map +1 -1
- package/build-module/entity-types/post.js.map +1 -1
- package/build-module/entity-types/term.js.map +1 -1
- package/build-module/entity-types/user.js.map +1 -1
- package/build-module/hooks/use-entity-records.js +8 -1
- package/build-module/hooks/use-entity-records.js.map +1 -1
- package/build-module/resolvers.js +11 -6
- package/build-module/resolvers.js.map +1 -1
- package/build-types/entity-types/attachment.d.ts +1 -1
- package/build-types/entity-types/attachment.d.ts.map +1 -1
- package/build-types/entity-types/comment.d.ts +1 -1
- package/build-types/entity-types/comment.d.ts.map +1 -1
- package/build-types/entity-types/nav-menu-item.d.ts +1 -1
- package/build-types/entity-types/nav-menu-item.d.ts.map +1 -1
- package/build-types/entity-types/nav-menu.d.ts +1 -1
- package/build-types/entity-types/nav-menu.d.ts.map +1 -1
- package/build-types/entity-types/page.d.ts +1 -1
- package/build-types/entity-types/page.d.ts.map +1 -1
- package/build-types/entity-types/post-revision.d.ts +1 -1
- package/build-types/entity-types/post-revision.d.ts.map +1 -1
- package/build-types/entity-types/post.d.ts +1 -1
- package/build-types/entity-types/post.d.ts.map +1 -1
- package/build-types/entity-types/term.d.ts +1 -1
- package/build-types/entity-types/term.d.ts.map +1 -1
- package/build-types/entity-types/user.d.ts +1 -1
- package/build-types/entity-types/user.d.ts.map +1 -1
- package/build-types/hooks/use-entity-records.d.ts.map +1 -1
- package/build-types/resolvers.d.ts.map +1 -1
- package/package.json +18 -18
- package/src/entity-types/attachment.ts +1 -1
- package/src/entity-types/comment.ts +1 -1
- package/src/entity-types/nav-menu-item.ts +1 -1
- package/src/entity-types/nav-menu.ts +1 -1
- package/src/entity-types/page.ts +1 -1
- package/src/entity-types/post-revision.ts +1 -1
- package/src/entity-types/post.ts +1 -1
- package/src/entity-types/term.ts +1 -1
- package/src/entity-types/user.ts +1 -1
- package/src/hooks/test/use-entity-records.js +104 -1
- package/src/hooks/use-entity-records.ts +17 -1
- package/src/resolvers.js +25 -14
- package/src/test/resolvers.js +101 -0
- package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["@wordpress/core-data/src/entity-types/attachment.ts"],"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,
|
|
1
|
+
{"version":3,"names":[],"sources":["@wordpress/core-data/src/entity-types/attachment.ts"],"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"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["@wordpress/core-data/src/entity-types/comment.ts"],"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,
|
|
1
|
+
{"version":3,"names":[],"sources":["@wordpress/core-data/src/entity-types/comment.ts"],"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"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["@wordpress/core-data/src/entity-types/nav-menu-item.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport type {\n\tRenderedText,\n\tContext,\n\tContextualField,\n\tOmitNevers,\n} from './helpers';\n\nimport type { BaseEntityRecords as _BaseEntityRecords } from './base-entity-records';\n\nexport type NavMenuItemType =\n\t| 'taxonomy'\n\t| 'post_type'\n\t| 'post_type_archive'\n\t| 'custom';\nexport type NavMenuItemStatus =\n\t| 'publish'\n\t| 'future'\n\t| 'draft'\n\t| 'pending'\n\t| 'private';\nexport type Target = '_blank' | '';\n\ndeclare module './base-entity-records' {\n\texport namespace BaseEntityRecords {\n\t\texport interface NavMenuItem< C extends Context > {\n\t\t\t/**\n\t\t\t * The title for the object.\n\t\t\t */\n\t\t\ttitle: RenderedText< C >;\n\t\t\t/**\n\t\t\t * Unique identifier for the object.\n\t\t\t */\n\t\t\tid: number;\n\t\t\t/**\n\t\t\t * The singular label used to describe this type of menu item.\n\t\t\t */\n\t\t\ttype_label: string;\n\t\t\t/**\n\t\t\t * The family of objects originally represented, such as \"post_type\" or \"taxonomy\".\n\t\t\t */\n\t\t\ttype: NavMenuItemType;\n\t\t\t/**\n\t\t\t * A named status for the object.\n\t\t\t */\n\t\t\tstatus: NavMenuItemStatus;\n\t\t\t/**\n\t\t\t * The ID for the parent of the object.\n\t\t\t */\n\t\t\tparent: number;\n\t\t\t/**\n\t\t\t * Text for the title attribute of the link element for this menu item.\n\t\t\t */\n\t\t\tattr_title: string;\n\t\t\t/**\n\t\t\t * Class names for the link element of this menu item.\n\t\t\t */\n\t\t\tclasses: string[];\n\t\t\t/**\n\t\t\t * The description of this menu item.\n\t\t\t */\n\t\t\tdescription: string;\n\t\t\t/**\n\t\t\t * The DB ID of the nav_menu_item that is this item's menu parent, if any, otherwise 0.\n\t\t\t */\n\t\t\tmenu_order: number;\n\t\t\t/**\n\t\t\t * The type of object originally represented, such as \"category\", \"post\", or \"attachment\".\n\t\t\t */\n\t\t\tobject: string;\n\t\t\t/**\n\t\t\t * The database ID of the original object this menu item represents, for example the ID for posts or the term_id for categories.\n\t\t\t */\n\t\t\tobject_id: number;\n\t\t\t/**\n\t\t\t * The target attribute of the link element for this menu item.\n\t\t\t */\n\t\t\ttarget: Target;\n\t\t\t/**\n\t\t\t * The URL to which this menu item points.\n\t\t\t */\n\t\t\turl: string;\n\t\t\t/**\n\t\t\t * The XFN relationship expressed in the link of this menu item.\n\t\t\t */\n\t\t\txfn: string[];\n\t\t\t/**\n\t\t\t * Whether the menu item represents an object that no longer exists.\n\t\t\t */\n\t\t\tinvalid: boolean;\n\t\t\t/**\n\t\t\t * The terms assigned to the object in the nav_menu taxonomy.\n\t\t\t */\n\t\t\tmenus: ContextualField< number, '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,
|
|
1
|
+
{"version":3,"names":[],"sources":["@wordpress/core-data/src/entity-types/nav-menu-item.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport type {\n\tRenderedText,\n\tContext,\n\tContextualField,\n\tOmitNevers,\n} from './helpers';\n\nimport type { BaseEntityRecords as _BaseEntityRecords } from './base-entity-records';\n\nexport type NavMenuItemType =\n\t| 'taxonomy'\n\t| 'post_type'\n\t| 'post_type_archive'\n\t| 'custom';\nexport type NavMenuItemStatus =\n\t| 'publish'\n\t| 'future'\n\t| 'draft'\n\t| 'pending'\n\t| 'private';\nexport type Target = '_blank' | '';\n\ndeclare module './base-entity-records' {\n\texport namespace BaseEntityRecords {\n\t\texport interface NavMenuItem< C extends Context > {\n\t\t\t/**\n\t\t\t * The title for the object.\n\t\t\t */\n\t\t\ttitle: RenderedText< C >;\n\t\t\t/**\n\t\t\t * Unique identifier for the object.\n\t\t\t */\n\t\t\tid: number;\n\t\t\t/**\n\t\t\t * The singular label used to describe this type of menu item.\n\t\t\t */\n\t\t\ttype_label: string;\n\t\t\t/**\n\t\t\t * The family of objects originally represented, such as \"post_type\" or \"taxonomy\".\n\t\t\t */\n\t\t\ttype: NavMenuItemType;\n\t\t\t/**\n\t\t\t * A named status for the object.\n\t\t\t */\n\t\t\tstatus: NavMenuItemStatus;\n\t\t\t/**\n\t\t\t * The ID for the parent of the object.\n\t\t\t */\n\t\t\tparent: number;\n\t\t\t/**\n\t\t\t * Text for the title attribute of the link element for this menu item.\n\t\t\t */\n\t\t\tattr_title: string;\n\t\t\t/**\n\t\t\t * Class names for the link element of this menu item.\n\t\t\t */\n\t\t\tclasses: string[];\n\t\t\t/**\n\t\t\t * The description of this menu item.\n\t\t\t */\n\t\t\tdescription: string;\n\t\t\t/**\n\t\t\t * The DB ID of the nav_menu_item that is this item's menu parent, if any, otherwise 0.\n\t\t\t */\n\t\t\tmenu_order: number;\n\t\t\t/**\n\t\t\t * The type of object originally represented, such as \"category\", \"post\", or \"attachment\".\n\t\t\t */\n\t\t\tobject: string;\n\t\t\t/**\n\t\t\t * The database ID of the original object this menu item represents, for example the ID for posts or the term_id for categories.\n\t\t\t */\n\t\t\tobject_id: number;\n\t\t\t/**\n\t\t\t * The target attribute of the link element for this menu item.\n\t\t\t */\n\t\t\ttarget: Target;\n\t\t\t/**\n\t\t\t * The URL to which this menu item points.\n\t\t\t */\n\t\t\turl: string;\n\t\t\t/**\n\t\t\t * The XFN relationship expressed in the link of this menu item.\n\t\t\t */\n\t\t\txfn: string[];\n\t\t\t/**\n\t\t\t * Whether the menu item represents an object that no longer exists.\n\t\t\t */\n\t\t\tinvalid: boolean;\n\t\t\t/**\n\t\t\t * The terms assigned to the object in the nav_menu taxonomy.\n\t\t\t */\n\t\t\tmenus: ContextualField< number, '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}\n\t}\n}\n\nexport type NavMenuItem< C extends Context = 'edit' > = OmitNevers<\n\t_BaseEntityRecords.NavMenuItem< C >\n>;\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["@wordpress/core-data/src/entity-types/nav-menu.ts"],"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 NavMenu< C extends Context > {\n\t\t\t/**\n\t\t\t * Unique identifier for the term.\n\t\t\t */\n\t\t\tid: number;\n\t\t\t/**\n\t\t\t * HTML description of the term.\n\t\t\t */\n\t\t\tdescription: ContextualField< string, 'view' | 'edit', C >;\n\t\t\t/**\n\t\t\t * HTML title for the term.\n\t\t\t */\n\t\t\tname: string;\n\t\t\t/**\n\t\t\t * An alphanumeric identifier for the term unique to its type.\n\t\t\t */\n\t\t\tslug: string;\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,
|
|
1
|
+
{"version":3,"names":[],"sources":["@wordpress/core-data/src/entity-types/nav-menu.ts"],"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 NavMenu< C extends Context > {\n\t\t\t/**\n\t\t\t * Unique identifier for the term.\n\t\t\t */\n\t\t\tid: number;\n\t\t\t/**\n\t\t\t * HTML description of the term.\n\t\t\t */\n\t\t\tdescription: ContextualField< string, 'view' | 'edit', C >;\n\t\t\t/**\n\t\t\t * HTML title for the term.\n\t\t\t */\n\t\t\tname: string;\n\t\t\t/**\n\t\t\t * An alphanumeric identifier for the term unique to its type.\n\t\t\t */\n\t\t\tslug: string;\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 locations assigned to the menu.\n\t\t\t */\n\t\t\tlocations: ContextualField< string[], 'view' | 'edit', C >;\n\t\t\t/**\n\t\t\t * The DB ID of the original object this menu item represents, e . g . ID for posts and term_id for categories.\n\t\t\t */\n\t\t\tobject_id: number;\n\t\t\t/**\n\t\t\t * Whether to automatically add top level pages to this menu.\n\t\t\t */\n\t\t\tauto_add: ContextualField< boolean, 'view' | 'edit', C >;\n\t\t}\n\t}\n}\n\nexport type NavMenu< C extends Context = 'edit' > = OmitNevers<\n\t_BaseEntityRecords.NavMenu< C >\n>;\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["@wordpress/core-data/src/entity-types/page.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport type {\n\tCommentingStatus,\n\tContext,\n\tContextualField,\n\tPingStatus,\n\tPostStatus,\n\tRenderedText,\n\tOmitNevers,\n} from './helpers';\n\nimport type { BaseEntityRecords as _BaseEntityRecords } from './base-entity-records';\n\ndeclare module './base-entity-records' {\n\texport namespace BaseEntityRecords {\n\t\texport interface Page< 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 * A password to protect access to the content and excerpt.\n\t\t\t */\n\t\t\tpassword: ContextualField< string, 'edit', C >;\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 ID for the parent of the post.\n\t\t\t */\n\t\t\tparent: ContextualField< number, 'view' | '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 content for the post.\n\t\t\t */\n\t\t\tcontent: ContextualField<\n\t\t\t\tRenderedText< C > & {\n\t\t\t\t\t/**\n\t\t\t\t\t * Whether the content is protected with a password.\n\t\t\t\t\t */\n\t\t\t\t\tis_protected: boolean;\n\t\t\t\t\t/**\n\t\t\t\t\t * Version of the content block format used by the page.\n\t\t\t\t\t */\n\t\t\t\t\tblock_version: ContextualField< string, 'edit', C >;\n\t\t\t\t},\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 ID for the author of the post.\n\t\t\t */\n\t\t\tauthor: number;\n\t\t\t/**\n\t\t\t * The excerpt for the post.\n\t\t\t */\n\t\t\texcerpt: RenderedText< C > & {\n\t\t\t\tprotected: boolean;\n\t\t\t};\n\t\t\t/**\n\t\t\t * The ID of the featured media for the post.\n\t\t\t */\n\t\t\tfeatured_media: 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 * The order of the post in relation to other posts.\n\t\t\t */\n\t\t\tmenu_order: ContextualField< number, '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,
|
|
1
|
+
{"version":3,"names":[],"sources":["@wordpress/core-data/src/entity-types/page.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport type {\n\tCommentingStatus,\n\tContext,\n\tContextualField,\n\tPingStatus,\n\tPostStatus,\n\tRenderedText,\n\tOmitNevers,\n} from './helpers';\n\nimport type { BaseEntityRecords as _BaseEntityRecords } from './base-entity-records';\n\ndeclare module './base-entity-records' {\n\texport namespace BaseEntityRecords {\n\t\texport interface Page< 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 * A password to protect access to the content and excerpt.\n\t\t\t */\n\t\t\tpassword: ContextualField< string, 'edit', C >;\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 ID for the parent of the post.\n\t\t\t */\n\t\t\tparent: ContextualField< number, 'view' | '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 content for the post.\n\t\t\t */\n\t\t\tcontent: ContextualField<\n\t\t\t\tRenderedText< C > & {\n\t\t\t\t\t/**\n\t\t\t\t\t * Whether the content is protected with a password.\n\t\t\t\t\t */\n\t\t\t\t\tis_protected: boolean;\n\t\t\t\t\t/**\n\t\t\t\t\t * Version of the content block format used by the page.\n\t\t\t\t\t */\n\t\t\t\t\tblock_version: ContextualField< string, 'edit', C >;\n\t\t\t\t},\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 ID for the author of the post.\n\t\t\t */\n\t\t\tauthor: number;\n\t\t\t/**\n\t\t\t * The excerpt for the post.\n\t\t\t */\n\t\t\texcerpt: RenderedText< C > & {\n\t\t\t\tprotected: boolean;\n\t\t\t};\n\t\t\t/**\n\t\t\t * The ID of the featured media for the post.\n\t\t\t */\n\t\t\tfeatured_media: 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 * The order of the post in relation to other posts.\n\t\t\t */\n\t\t\tmenu_order: ContextualField< number, '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}\n\t}\n}\n\nexport type Page< C extends Context = 'edit' > = OmitNevers<\n\t_BaseEntityRecords.Page< C >\n>;\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["@wordpress/core-data/src/entity-types/post-revision.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport type {\n\tContext,\n\tContextualField,\n\tRenderedText,\n\tOmitNevers,\n} from './helpers';\n\nimport type { BaseEntityRecords as _BaseEntityRecords } from './base-entity-records';\n\ndeclare module './base-entity-records' {\n\texport namespace BaseEntityRecords {\n\t\texport interface PostRevision< C extends Context > {\n\t\t\t/**\n\t\t\t * The ID for the author of the post revision.\n\t\t\t */\n\t\t\tauthor: number;\n\t\t\t/**\n\t\t\t * The content for the post.\n\t\t\t */\n\t\t\tcontent: ContextualField<\n\t\t\t\tRenderedText< C > & {\n\t\t\t\t\t/**\n\t\t\t\t\t * Whether the content is protected with a password.\n\t\t\t\t\t */\n\t\t\t\t\tis_protected: boolean;\n\t\t\t\t\t/**\n\t\t\t\t\t * Version of the content block format used by the post.\n\t\t\t\t\t */\n\t\t\t\t\tblock_version: ContextualField< string, 'edit', C >;\n\t\t\t\t},\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 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 excerpt for the post revision.\n\t\t\t */\n\t\t\texcerpt: RenderedText< C > & {\n\t\t\t\tprotected: boolean;\n\t\t\t};\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 revision.\n\t\t\t */\n\t\t\tid: number;\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,
|
|
1
|
+
{"version":3,"names":[],"sources":["@wordpress/core-data/src/entity-types/post-revision.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport type {\n\tContext,\n\tContextualField,\n\tRenderedText,\n\tOmitNevers,\n} from './helpers';\n\nimport type { BaseEntityRecords as _BaseEntityRecords } from './base-entity-records';\n\ndeclare module './base-entity-records' {\n\texport namespace BaseEntityRecords {\n\t\texport interface PostRevision< C extends Context > {\n\t\t\t/**\n\t\t\t * The ID for the author of the post revision.\n\t\t\t */\n\t\t\tauthor: number;\n\t\t\t/**\n\t\t\t * The content for the post.\n\t\t\t */\n\t\t\tcontent: ContextualField<\n\t\t\t\tRenderedText< C > & {\n\t\t\t\t\t/**\n\t\t\t\t\t * Whether the content is protected with a password.\n\t\t\t\t\t */\n\t\t\t\t\tis_protected: boolean;\n\t\t\t\t\t/**\n\t\t\t\t\t * Version of the content block format used by the post.\n\t\t\t\t\t */\n\t\t\t\t\tblock_version: ContextualField< string, 'edit', C >;\n\t\t\t\t},\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 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 excerpt for the post revision.\n\t\t\t */\n\t\t\texcerpt: RenderedText< C > & {\n\t\t\t\tprotected: boolean;\n\t\t\t};\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 revision.\n\t\t\t */\n\t\t\tid: number;\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 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 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\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 * The title for the post revision.\n\t\t\t */\n\t\t\ttitle: RenderedText< C >;\n\t\t}\n\t}\n}\n\nexport type PostRevision< C extends Context = 'view' > = OmitNevers<\n\t_BaseEntityRecords.PostRevision< C >\n>;\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["@wordpress/core-data/src/entity-types/post.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport type {\n\tCommentingStatus,\n\tContext,\n\tContextualField,\n\tPingStatus,\n\tPostFormat,\n\tPostStatus,\n\tRenderedText,\n\tOmitNevers,\n} from './helpers';\n\nimport type { BaseEntityRecords as _BaseEntityRecords } from './base-entity-records';\n\ndeclare module './base-entity-records' {\n\texport namespace BaseEntityRecords {\n\t\texport interface Post< 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 * A password to protect access to the content and excerpt.\n\t\t\t */\n\t\t\tpassword: ContextualField< string, 'edit', C >;\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 content for the post.\n\t\t\t */\n\t\t\tcontent: ContextualField<\n\t\t\t\tRenderedText< C > & {\n\t\t\t\t\t/**\n\t\t\t\t\t * Whether the content is protected with a password.\n\t\t\t\t\t */\n\t\t\t\t\tis_protected: boolean;\n\t\t\t\t\t/**\n\t\t\t\t\t * Version of the content block format used by the page.\n\t\t\t\t\t */\n\t\t\t\t\tblock_version: ContextualField< string, 'edit', C >;\n\t\t\t\t},\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 ID for the author of the post.\n\t\t\t */\n\t\t\tauthor: number;\n\t\t\t/**\n\t\t\t * The excerpt for the post.\n\t\t\t */\n\t\t\texcerpt: RenderedText< C > & {\n\t\t\t\tprotected: boolean;\n\t\t\t};\n\t\t\t/**\n\t\t\t * The ID of the featured media for the post.\n\t\t\t */\n\t\t\tfeatured_media: 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 * The format for the post.\n\t\t\t */\n\t\t\tformat: ContextualField< PostFormat, '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,
|
|
1
|
+
{"version":3,"names":[],"sources":["@wordpress/core-data/src/entity-types/post.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport type {\n\tCommentingStatus,\n\tContext,\n\tContextualField,\n\tPingStatus,\n\tPostFormat,\n\tPostStatus,\n\tRenderedText,\n\tOmitNevers,\n} from './helpers';\n\nimport type { BaseEntityRecords as _BaseEntityRecords } from './base-entity-records';\n\ndeclare module './base-entity-records' {\n\texport namespace BaseEntityRecords {\n\t\texport interface Post< 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 * A password to protect access to the content and excerpt.\n\t\t\t */\n\t\t\tpassword: ContextualField< string, 'edit', C >;\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 content for the post.\n\t\t\t */\n\t\t\tcontent: ContextualField<\n\t\t\t\tRenderedText< C > & {\n\t\t\t\t\t/**\n\t\t\t\t\t * Whether the content is protected with a password.\n\t\t\t\t\t */\n\t\t\t\t\tis_protected: boolean;\n\t\t\t\t\t/**\n\t\t\t\t\t * Version of the content block format used by the page.\n\t\t\t\t\t */\n\t\t\t\t\tblock_version: ContextualField< string, 'edit', C >;\n\t\t\t\t},\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 ID for the author of the post.\n\t\t\t */\n\t\t\tauthor: number;\n\t\t\t/**\n\t\t\t * The excerpt for the post.\n\t\t\t */\n\t\t\texcerpt: RenderedText< C > & {\n\t\t\t\tprotected: boolean;\n\t\t\t};\n\t\t\t/**\n\t\t\t * The ID of the featured media for the post.\n\t\t\t */\n\t\t\tfeatured_media: 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 * The format for the post.\n\t\t\t */\n\t\t\tformat: ContextualField< PostFormat, '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 * Whether or not the post should be treated as sticky.\n\t\t\t */\n\t\t\tsticky: ContextualField< boolean, 'view' | 'edit', C >;\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 * The terms assigned to the post in the category taxonomy.\n\t\t\t */\n\t\t\tcategories: ContextualField< number[], 'view' | 'edit', C >;\n\t\t\t/**\n\t\t\t * The terms assigned to the post in the post_tag taxonomy.\n\t\t\t */\n\t\t\ttags: ContextualField< number[], 'view' | 'edit', C >;\n\t\t}\n\t}\n}\n\nexport type Post< C extends Context = 'edit' > = OmitNevers<\n\t_BaseEntityRecords.Post< C >\n>;\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["@wordpress/core-data/src/entity-types/term.ts"],"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 Term< C extends Context > {\n\t\t\t/**\n\t\t\t * Unique identifier for the term.\n\t\t\t */\n\t\t\tid: number;\n\t\t\t/**\n\t\t\t * Number of published posts for the term.\n\t\t\t */\n\t\t\tcount: ContextualField< number, 'view' | 'edit', C >;\n\t\t\t/**\n\t\t\t * HTML description of the term.\n\t\t\t */\n\t\t\tdescription: ContextualField< string, 'view' | 'edit', C >;\n\t\t\t/**\n\t\t\t * URL of the term.\n\t\t\t */\n\t\t\tlink: string;\n\t\t\t/**\n\t\t\t * HTML title for the term.\n\t\t\t */\n\t\t\tname: string;\n\t\t\t/**\n\t\t\t * An alphanumeric identifier for the term unique to its type.\n\t\t\t */\n\t\t\tslug: string;\n\t\t\t/**\n\t\t\t * Type attribution for the term.\n\t\t\t */\n\t\t\ttaxonomy: string;\n\t\t\t/**\n\t\t\t * The parent term ID. Only present for hierarchical taxonomies.\n\t\t\t */\n\t\t\tparent?: number;\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,
|
|
1
|
+
{"version":3,"names":[],"sources":["@wordpress/core-data/src/entity-types/term.ts"],"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 Term< C extends Context > {\n\t\t\t/**\n\t\t\t * Unique identifier for the term.\n\t\t\t */\n\t\t\tid: number;\n\t\t\t/**\n\t\t\t * Number of published posts for the term.\n\t\t\t */\n\t\t\tcount: ContextualField< number, 'view' | 'edit', C >;\n\t\t\t/**\n\t\t\t * HTML description of the term.\n\t\t\t */\n\t\t\tdescription: ContextualField< string, 'view' | 'edit', C >;\n\t\t\t/**\n\t\t\t * URL of the term.\n\t\t\t */\n\t\t\tlink: string;\n\t\t\t/**\n\t\t\t * HTML title for the term.\n\t\t\t */\n\t\t\tname: string;\n\t\t\t/**\n\t\t\t * An alphanumeric identifier for the term unique to its type.\n\t\t\t */\n\t\t\tslug: string;\n\t\t\t/**\n\t\t\t * Type attribution for the term.\n\t\t\t */\n\t\t\ttaxonomy: string;\n\t\t\t/**\n\t\t\t * The parent term ID. Only present for hierarchical taxonomies.\n\t\t\t */\n\t\t\tparent?: number;\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 Term< C extends Context = 'edit' > = OmitNevers<\n\t_BaseEntityRecords.Term< C >\n>;\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["@wordpress/core-data/src/entity-types/user.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport type {\n\tAvatarUrls,\n\tContext,\n\tContextualField,\n\tOmitNevers,\n} from './helpers';\n\nimport type { BaseEntityRecords as _BaseEntityRecords } from './base-entity-records';\n\ndeclare module './base-entity-records' {\n\texport namespace BaseEntityRecords {\n\t\texport interface User< C extends Context > {\n\t\t\t/**\n\t\t\t * Unique identifier for the user.\n\t\t\t */\n\t\t\tid: number;\n\t\t\t/**\n\t\t\t * Login name for the user.\n\t\t\t */\n\t\t\tusername: ContextualField< string, 'edit', C >;\n\t\t\t/**\n\t\t\t * Display name for the user.\n\t\t\t */\n\t\t\tname: string;\n\t\t\t/**\n\t\t\t * First name for the user.\n\t\t\t */\n\t\t\tfirst_name: ContextualField< string, 'edit', C >;\n\t\t\t/**\n\t\t\t * Last name for the user.\n\t\t\t */\n\t\t\tlast_name: ContextualField< string, 'edit', C >;\n\t\t\t/**\n\t\t\t * The email address for the user.\n\t\t\t */\n\t\t\temail: ContextualField< string, 'edit', C >;\n\t\t\t/**\n\t\t\t * URL of the user.\n\t\t\t */\n\t\t\turl: string;\n\t\t\t/**\n\t\t\t * Description of the user.\n\t\t\t */\n\t\t\tdescription: string;\n\t\t\t/**\n\t\t\t * Author URL of the user.\n\t\t\t */\n\t\t\tlink: string;\n\t\t\t/**\n\t\t\t * Locale for the user.\n\t\t\t */\n\t\t\tlocale: ContextualField< string, 'edit', C >;\n\t\t\t/**\n\t\t\t * The nickname for the user.\n\t\t\t */\n\t\t\tnickname: ContextualField< string, 'edit', C >;\n\t\t\t/**\n\t\t\t * An alphanumeric identifier for the user.\n\t\t\t */\n\t\t\tslug: string;\n\t\t\t/**\n\t\t\t * Registration date for the user.\n\t\t\t */\n\t\t\tregistered_date: ContextualField< string, 'edit', C >;\n\t\t\t/**\n\t\t\t * Roles assigned to the user.\n\t\t\t */\n\t\t\troles: ContextualField< string[], 'edit', C >;\n\t\t\t/**\n\t\t\t * Password for the user.\n\t\t\t *\n\t\t\t * This is never sent from the server to the client\n\t\t\t * but exists because we might send an update to the\n\t\t\t * server with a new password to set.\n\t\t\t */\n\t\t\tpassword?: string;\n\t\t\t/**\n\t\t\t * All capabilities assigned to the user.\n\t\t\t */\n\t\t\tcapabilities: ContextualField<\n\t\t\t\tRecord< string, string >,\n\t\t\t\t'edit',\n\t\t\t\tC\n\t\t\t>;\n\t\t\t/**\n\t\t\t * Any extra capabilities assigned to the user.\n\t\t\t */\n\t\t\textra_capabilities: ContextualField<\n\t\t\t\tRecord< string, string >,\n\t\t\t\t'edit',\n\t\t\t\tC\n\t\t\t>;\n\t\t\t/**\n\t\t\t * Avatar URLs for the user.\n\t\t\t */\n\t\t\tavatar_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,
|
|
1
|
+
{"version":3,"names":[],"sources":["@wordpress/core-data/src/entity-types/user.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport type {\n\tAvatarUrls,\n\tContext,\n\tContextualField,\n\tOmitNevers,\n} from './helpers';\n\nimport type { BaseEntityRecords as _BaseEntityRecords } from './base-entity-records';\n\ndeclare module './base-entity-records' {\n\texport namespace BaseEntityRecords {\n\t\texport interface User< C extends Context > {\n\t\t\t/**\n\t\t\t * Unique identifier for the user.\n\t\t\t */\n\t\t\tid: number;\n\t\t\t/**\n\t\t\t * Login name for the user.\n\t\t\t */\n\t\t\tusername: ContextualField< string, 'edit', C >;\n\t\t\t/**\n\t\t\t * Display name for the user.\n\t\t\t */\n\t\t\tname: string;\n\t\t\t/**\n\t\t\t * First name for the user.\n\t\t\t */\n\t\t\tfirst_name: ContextualField< string, 'edit', C >;\n\t\t\t/**\n\t\t\t * Last name for the user.\n\t\t\t */\n\t\t\tlast_name: ContextualField< string, 'edit', C >;\n\t\t\t/**\n\t\t\t * The email address for the user.\n\t\t\t */\n\t\t\temail: ContextualField< string, 'edit', C >;\n\t\t\t/**\n\t\t\t * URL of the user.\n\t\t\t */\n\t\t\turl: string;\n\t\t\t/**\n\t\t\t * Description of the user.\n\t\t\t */\n\t\t\tdescription: string;\n\t\t\t/**\n\t\t\t * Author URL of the user.\n\t\t\t */\n\t\t\tlink: string;\n\t\t\t/**\n\t\t\t * Locale for the user.\n\t\t\t */\n\t\t\tlocale: ContextualField< string, 'edit', C >;\n\t\t\t/**\n\t\t\t * The nickname for the user.\n\t\t\t */\n\t\t\tnickname: ContextualField< string, 'edit', C >;\n\t\t\t/**\n\t\t\t * An alphanumeric identifier for the user.\n\t\t\t */\n\t\t\tslug: string;\n\t\t\t/**\n\t\t\t * Registration date for the user.\n\t\t\t */\n\t\t\tregistered_date: ContextualField< string, 'edit', C >;\n\t\t\t/**\n\t\t\t * Roles assigned to the user.\n\t\t\t */\n\t\t\troles: ContextualField< string[], 'edit', C >;\n\t\t\t/**\n\t\t\t * Password for the user.\n\t\t\t *\n\t\t\t * This is never sent from the server to the client\n\t\t\t * but exists because we might send an update to the\n\t\t\t * server with a new password to set.\n\t\t\t */\n\t\t\tpassword?: string;\n\t\t\t/**\n\t\t\t * All capabilities assigned to the user.\n\t\t\t */\n\t\t\tcapabilities: ContextualField<\n\t\t\t\tRecord< string, string >,\n\t\t\t\t'edit',\n\t\t\t\tC\n\t\t\t>;\n\t\t\t/**\n\t\t\t * Any extra capabilities assigned to the user.\n\t\t\t */\n\t\t\textra_capabilities: ContextualField<\n\t\t\t\tRecord< string, string >,\n\t\t\t\t'edit',\n\t\t\t\tC\n\t\t\t>;\n\t\t\t/**\n\t\t\t * Avatar URLs for the user.\n\t\t\t */\n\t\t\tavatar_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 User< C extends Context = 'edit' > = OmitNevers<\n\t_BaseEntityRecords.User< C >\n>;\n"],"mappings":"","ignoreList":[]}
|
|
@@ -14,6 +14,7 @@ var _element = require("@wordpress/element");
|
|
|
14
14
|
var _useQuerySelect = _interopRequireDefault(require("./use-query-select"));
|
|
15
15
|
var _ = require("../");
|
|
16
16
|
var _lockUnlock = require("../lock-unlock");
|
|
17
|
+
var _utils = require("../utils");
|
|
17
18
|
/**
|
|
18
19
|
* WordPress dependencies
|
|
19
20
|
*/
|
|
@@ -120,7 +121,13 @@ function useEntityRecordsWithPermissions(kind, name, queryArgs = {}, options = {
|
|
|
120
121
|
const {
|
|
121
122
|
records: data,
|
|
122
123
|
...ret
|
|
123
|
-
} = useEntityRecords(kind, name,
|
|
124
|
+
} = useEntityRecords(kind, name, {
|
|
125
|
+
...queryArgs,
|
|
126
|
+
// If _fields is provided, we need to include _links in the request for permission caching to work.
|
|
127
|
+
...(queryArgs._fields ? {
|
|
128
|
+
_fields: [...new Set([...((0, _utils.getNormalizedCommaSeparable)(queryArgs._fields) || []), '_links'])].join()
|
|
129
|
+
} : {})
|
|
130
|
+
}, options);
|
|
124
131
|
const ids = (0, _element.useMemo)(() => {
|
|
125
132
|
var _data$map;
|
|
126
133
|
return (_data$map = data?.map(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_url","require","_deprecated","_interopRequireDefault","_data","_element","_useQuerySelect","_","_lockUnlock","EMPTY_ARRAY","useEntityRecords","kind","name","queryArgs","options","enabled","queryAsString","addQueryArgs","data","records","rest","useQuerySelect","query","coreStore","getEntityRecords","totalItems","totalPages","useSelect","select","getEntityRecordsTotalItems","getEntityRecordsTotalPages","__experimentalUseEntityRecords","deprecated","alternative","since","useEntityRecordsWithPermissions","entityConfig","getEntityConfig","ret","ids","useMemo","_data$map","map","record","_entityConfig$key","key","permissions","getEntityRecordsPermissions","unlock","dataWithPermissions","_data$map2","index"],"sources":["@wordpress/core-data/src/hooks/use-entity-records.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addQueryArgs } from '@wordpress/url';\nimport deprecated from '@wordpress/deprecated';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport useQuerySelect from './use-query-select';\nimport { store as coreStore } from '../';\nimport type { Options } from './use-entity-record';\nimport type { Status } from './constants';\nimport { unlock } from '../lock-unlock';\n\ninterface EntityRecordsResolution< RecordType > {\n\t/** The requested entity record */\n\trecords: RecordType[] | null;\n\n\t/**\n\t * Is the record still being resolved?\n\t */\n\tisResolving: boolean;\n\n\t/**\n\t * Is the record resolved by now?\n\t */\n\thasResolved: boolean;\n\n\t/** Resolution status */\n\tstatus: Status;\n\n\t/**\n\t * The total number of available items (if not paginated).\n\t */\n\ttotalItems: number | null;\n\n\t/**\n\t * The total number of pages.\n\t */\n\ttotalPages: number | null;\n}\n\nconst EMPTY_ARRAY = [];\n\n/**\n * Resolves the specified entity records.\n *\n * @since 6.1.0 Introduced in WordPress core.\n *\n * @param kind Kind of the entity, e.g. `root` or a `postType`. See rootEntitiesConfig in ../entities.ts for a list of available kinds.\n * @param name Name of the entity, e.g. `plugin` or a `post`. See rootEntitiesConfig in ../entities.ts for a list of available names.\n * @param queryArgs Optional HTTP query description for how to fetch the data, passed to the requested API endpoint.\n * @param options Optional hook options.\n * @example\n * ```js\n * import { useEntityRecords } from '@wordpress/core-data';\n *\n * function PageTitlesList() {\n * const { records, isResolving } = useEntityRecords( 'postType', 'page' );\n *\n * if ( isResolving ) {\n * return 'Loading...';\n * }\n *\n * return (\n * <ul>\n * {records.map(( page ) => (\n * <li>{ page.title }</li>\n * ))}\n * </ul>\n * );\n * }\n *\n * // Rendered in the application:\n * // <PageTitlesList />\n * ```\n *\n * In the above example, when `PageTitlesList` is rendered into an\n * application, the list of records and the resolution details will be retrieved from\n * the store state using `getEntityRecords()`, or resolved if missing.\n *\n * @return Entity records data.\n * @template RecordType\n */\nexport default function useEntityRecords< RecordType >(\n\tkind: string,\n\tname: string,\n\tqueryArgs: Record< string, unknown > = {},\n\toptions: Options = { enabled: true }\n): EntityRecordsResolution< RecordType > {\n\t// Serialize queryArgs to a string that can be safely used as a React dep.\n\t// We can't just pass queryArgs as one of the deps, because if it is passed\n\t// as an object literal, then it will be a different object on each call even\n\t// if the values remain the same.\n\tconst queryAsString = addQueryArgs( '', queryArgs );\n\n\tconst { data: records, ...rest } = useQuerySelect(\n\t\t( query ) => {\n\t\t\tif ( ! options.enabled ) {\n\t\t\t\treturn {\n\t\t\t\t\t// Avoiding returning a new reference on every execution.\n\t\t\t\t\tdata: EMPTY_ARRAY,\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn query( coreStore ).getEntityRecords( kind, name, queryArgs );\n\t\t},\n\t\t[ kind, name, queryAsString, options.enabled ]\n\t);\n\n\tconst { totalItems, totalPages } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! options.enabled ) {\n\t\t\t\treturn {\n\t\t\t\t\ttotalItems: null,\n\t\t\t\t\ttotalPages: null,\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn {\n\t\t\t\ttotalItems: select( coreStore ).getEntityRecordsTotalItems(\n\t\t\t\t\tkind,\n\t\t\t\t\tname,\n\t\t\t\t\tqueryArgs\n\t\t\t\t),\n\t\t\t\ttotalPages: select( coreStore ).getEntityRecordsTotalPages(\n\t\t\t\t\tkind,\n\t\t\t\t\tname,\n\t\t\t\t\tqueryArgs\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ kind, name, queryAsString, options.enabled ]\n\t);\n\n\treturn {\n\t\trecords,\n\t\ttotalItems,\n\t\ttotalPages,\n\t\t...rest,\n\t};\n}\n\nexport function __experimentalUseEntityRecords(\n\tkind: string,\n\tname: string,\n\tqueryArgs: any,\n\toptions: any\n) {\n\tdeprecated( `wp.data.__experimentalUseEntityRecords`, {\n\t\talternative: 'wp.data.useEntityRecords',\n\t\tsince: '6.1',\n\t} );\n\treturn useEntityRecords( kind, name, queryArgs, options );\n}\n\nexport function useEntityRecordsWithPermissions< RecordType >(\n\tkind: string,\n\tname: string,\n\tqueryArgs: Record< string, unknown > = {},\n\toptions: Options = { enabled: true }\n): EntityRecordsResolution< RecordType > {\n\tconst entityConfig = useSelect(\n\t\t( select ) => select( coreStore ).getEntityConfig( kind, name ),\n\t\t[ kind, name ]\n\t);\n\tconst { records: data, ...ret } = useEntityRecords(\n\t\tkind,\n\t\tname,\n\t\tqueryArgs,\n\t\toptions\n\t);\n\tconst ids = useMemo(\n\t\t() =>\n\t\t\tdata?.map(\n\t\t\t\t// @ts-ignore\n\t\t\t\t( record: RecordType ) => record[ entityConfig?.key ?? 'id' ]\n\t\t\t) ?? [],\n\t\t[ data, entityConfig?.key ]\n\t);\n\n\tconst permissions = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecordsPermissions } = unlock(\n\t\t\t\tselect( coreStore )\n\t\t\t);\n\t\t\treturn getEntityRecordsPermissions( kind, name, ids );\n\t\t},\n\t\t[ ids, kind, name ]\n\t);\n\n\tconst dataWithPermissions = useMemo(\n\t\t() =>\n\t\t\tdata?.map( ( record, index ) => ( {\n\t\t\t\t// @ts-ignore\n\t\t\t\t...record,\n\t\t\t\tpermissions: permissions[ index ],\n\t\t\t} ) ) ?? [],\n\t\t[ data, permissions ]\n\t);\n\n\treturn { records: dataWithPermissions, ...ret };\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAKA,IAAAK,eAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,CAAA,GAAAN,OAAA;AAGA,IAAAO,WAAA,GAAAP,OAAA;AAfA;AACA;AACA;;AAMA;AACA;AACA;;AAmCA,MAAMQ,WAAW,GAAG,EAAE;;AAEtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,gBAAgBA,CACvCC,IAAY,EACZC,IAAY,EACZC,SAAoC,GAAG,CAAC,CAAC,EACzCC,OAAgB,GAAG;EAAEC,OAAO,EAAE;AAAK,CAAC,EACI;EACxC;EACA;EACA;EACA;EACA,MAAMC,aAAa,GAAG,IAAAC,iBAAY,EAAE,EAAE,EAAEJ,SAAU,CAAC;EAEnD,MAAM;IAAEK,IAAI,EAAEC,OAAO;IAAE,GAAGC;EAAK,CAAC,GAAG,IAAAC,uBAAc,EAC9CC,KAAK,IAAM;IACZ,IAAK,CAAER,OAAO,CAACC,OAAO,EAAG;MACxB,OAAO;QACN;QACAG,IAAI,EAAET;MACP,CAAC;IACF;IACA,OAAOa,KAAK,CAAEC,OAAU,CAAC,CAACC,gBAAgB,CAAEb,IAAI,EAAEC,IAAI,EAAEC,SAAU,CAAC;EACpE,CAAC,EACD,CAAEF,IAAI,EAAEC,IAAI,EAAEI,aAAa,EAAEF,OAAO,CAACC,OAAO,CAC7C,CAAC;EAED,MAAM;IAAEU,UAAU;IAAEC;EAAW,CAAC,GAAG,IAAAC,eAAS,EACzCC,MAAM,IAAM;IACb,IAAK,CAAEd,OAAO,CAACC,OAAO,EAAG;MACxB,OAAO;QACNU,UAAU,EAAE,IAAI;QAChBC,UAAU,EAAE;MACb,CAAC;IACF;IACA,OAAO;MACND,UAAU,EAAEG,MAAM,CAAEL,OAAU,CAAC,CAACM,0BAA0B,CACzDlB,IAAI,EACJC,IAAI,EACJC,SACD,CAAC;MACDa,UAAU,EAAEE,MAAM,CAAEL,OAAU,CAAC,CAACO,0BAA0B,CACzDnB,IAAI,EACJC,IAAI,EACJC,SACD;IACD,CAAC;EACF,CAAC,EACD,CAAEF,IAAI,EAAEC,IAAI,EAAEI,aAAa,EAAEF,OAAO,CAACC,OAAO,CAC7C,CAAC;EAED,OAAO;IACNI,OAAO;IACPM,UAAU;IACVC,UAAU;IACV,GAAGN;EACJ,CAAC;AACF;AAEO,SAASW,8BAA8BA,CAC7CpB,IAAY,EACZC,IAAY,EACZC,SAAc,EACdC,OAAY,EACX;EACD,IAAAkB,mBAAU,EAAE,wCAAwC,EAAE;IACrDC,WAAW,EAAE,0BAA0B;IACvCC,KAAK,EAAE;EACR,CAAE,CAAC;EACH,OAAOxB,gBAAgB,CAAEC,IAAI,EAAEC,IAAI,EAAEC,SAAS,EAAEC,OAAQ,CAAC;AAC1D;AAEO,SAASqB,+BAA+BA,CAC9CxB,IAAY,EACZC,IAAY,EACZC,SAAoC,GAAG,CAAC,CAAC,EACzCC,OAAgB,GAAG;EAAEC,OAAO,EAAE;AAAK,CAAC,EACI;EACxC,MAAMqB,YAAY,GAAG,IAAAT,eAAS,EAC3BC,MAAM,IAAMA,MAAM,CAAEL,OAAU,CAAC,CAACc,eAAe,CAAE1B,IAAI,EAAEC,IAAK,CAAC,EAC/D,CAAED,IAAI,EAAEC,IAAI,CACb,CAAC;EACD,MAAM;IAAEO,OAAO,EAAED,IAAI;IAAE,GAAGoB;EAAI,CAAC,GAAG5B,gBAAgB,CACjDC,IAAI,EACJC,IAAI,EACJC,SAAS,EACTC,OACD,CAAC;EACD,MAAMyB,GAAG,GAAG,IAAAC,gBAAO,EAClB;IAAA,IAAAC,SAAA;IAAA,QAAAA,SAAA,GACCvB,IAAI,EAAEwB,GAAG;IACR;IACEC,MAAkB;MAAA,IAAAC,iBAAA;MAAA,OAAMD,MAAM,EAAAC,iBAAA,GAAER,YAAY,EAAES,GAAG,cAAAD,iBAAA,cAAAA,iBAAA,GAAI,IAAI,CAAE;IAAA,CAC9D,CAAC,cAAAH,SAAA,cAAAA,SAAA,GAAI,EAAE;EAAA,GACR,CAAEvB,IAAI,EAAEkB,YAAY,EAAES,GAAG,CAC1B,CAAC;EAED,MAAMC,WAAW,GAAG,IAAAnB,eAAS,EAC1BC,MAAM,IAAM;IACb,MAAM;MAAEmB;IAA4B,CAAC,GAAG,IAAAC,kBAAM,EAC7CpB,MAAM,CAAEL,OAAU,CACnB,CAAC;IACD,OAAOwB,2BAA2B,CAAEpC,IAAI,EAAEC,IAAI,EAAE2B,GAAI,CAAC;EACtD,CAAC,EACD,CAAEA,GAAG,EAAE5B,IAAI,EAAEC,IAAI,CAClB,CAAC;EAED,MAAMqC,mBAAmB,GAAG,IAAAT,gBAAO,EAClC;IAAA,IAAAU,UAAA;IAAA,QAAAA,UAAA,GACChC,IAAI,EAAEwB,GAAG,CAAE,CAAEC,MAAM,EAAEQ,KAAK,MAAQ;MACjC;MACA,GAAGR,MAAM;MACTG,WAAW,EAAEA,WAAW,CAAEK,KAAK;IAChC,CAAC,CAAG,CAAC,cAAAD,UAAA,cAAAA,UAAA,GAAI,EAAE;EAAA,GACZ,CAAEhC,IAAI,EAAE4B,WAAW,CACpB,CAAC;EAED,OAAO;IAAE3B,OAAO,EAAE8B,mBAAmB;IAAE,GAAGX;EAAI,CAAC;AAChD","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_url","require","_deprecated","_interopRequireDefault","_data","_element","_useQuerySelect","_","_lockUnlock","_utils","EMPTY_ARRAY","useEntityRecords","kind","name","queryArgs","options","enabled","queryAsString","addQueryArgs","data","records","rest","useQuerySelect","query","coreStore","getEntityRecords","totalItems","totalPages","useSelect","select","getEntityRecordsTotalItems","getEntityRecordsTotalPages","__experimentalUseEntityRecords","deprecated","alternative","since","useEntityRecordsWithPermissions","entityConfig","getEntityConfig","ret","_fields","Set","getNormalizedCommaSeparable","join","ids","useMemo","_data$map","map","record","_entityConfig$key","key","permissions","getEntityRecordsPermissions","unlock","dataWithPermissions","_data$map2","index"],"sources":["@wordpress/core-data/src/hooks/use-entity-records.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addQueryArgs } from '@wordpress/url';\nimport deprecated from '@wordpress/deprecated';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport useQuerySelect from './use-query-select';\nimport { store as coreStore } from '../';\nimport type { Options } from './use-entity-record';\nimport type { Status } from './constants';\nimport { unlock } from '../lock-unlock';\nimport { getNormalizedCommaSeparable } from '../utils';\n\ninterface EntityRecordsResolution< RecordType > {\n\t/** The requested entity record */\n\trecords: RecordType[] | null;\n\n\t/**\n\t * Is the record still being resolved?\n\t */\n\tisResolving: boolean;\n\n\t/**\n\t * Is the record resolved by now?\n\t */\n\thasResolved: boolean;\n\n\t/** Resolution status */\n\tstatus: Status;\n\n\t/**\n\t * The total number of available items (if not paginated).\n\t */\n\ttotalItems: number | null;\n\n\t/**\n\t * The total number of pages.\n\t */\n\ttotalPages: number | null;\n}\n\nconst EMPTY_ARRAY = [];\n\n/**\n * Resolves the specified entity records.\n *\n * @since 6.1.0 Introduced in WordPress core.\n *\n * @param kind Kind of the entity, e.g. `root` or a `postType`. See rootEntitiesConfig in ../entities.ts for a list of available kinds.\n * @param name Name of the entity, e.g. `plugin` or a `post`. See rootEntitiesConfig in ../entities.ts for a list of available names.\n * @param queryArgs Optional HTTP query description for how to fetch the data, passed to the requested API endpoint.\n * @param options Optional hook options.\n * @example\n * ```js\n * import { useEntityRecords } from '@wordpress/core-data';\n *\n * function PageTitlesList() {\n * const { records, isResolving } = useEntityRecords( 'postType', 'page' );\n *\n * if ( isResolving ) {\n * return 'Loading...';\n * }\n *\n * return (\n * <ul>\n * {records.map(( page ) => (\n * <li>{ page.title }</li>\n * ))}\n * </ul>\n * );\n * }\n *\n * // Rendered in the application:\n * // <PageTitlesList />\n * ```\n *\n * In the above example, when `PageTitlesList` is rendered into an\n * application, the list of records and the resolution details will be retrieved from\n * the store state using `getEntityRecords()`, or resolved if missing.\n *\n * @return Entity records data.\n * @template RecordType\n */\nexport default function useEntityRecords< RecordType >(\n\tkind: string,\n\tname: string,\n\tqueryArgs: Record< string, unknown > = {},\n\toptions: Options = { enabled: true }\n): EntityRecordsResolution< RecordType > {\n\t// Serialize queryArgs to a string that can be safely used as a React dep.\n\t// We can't just pass queryArgs as one of the deps, because if it is passed\n\t// as an object literal, then it will be a different object on each call even\n\t// if the values remain the same.\n\tconst queryAsString = addQueryArgs( '', queryArgs );\n\n\tconst { data: records, ...rest } = useQuerySelect(\n\t\t( query ) => {\n\t\t\tif ( ! options.enabled ) {\n\t\t\t\treturn {\n\t\t\t\t\t// Avoiding returning a new reference on every execution.\n\t\t\t\t\tdata: EMPTY_ARRAY,\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn query( coreStore ).getEntityRecords( kind, name, queryArgs );\n\t\t},\n\t\t[ kind, name, queryAsString, options.enabled ]\n\t);\n\n\tconst { totalItems, totalPages } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! options.enabled ) {\n\t\t\t\treturn {\n\t\t\t\t\ttotalItems: null,\n\t\t\t\t\ttotalPages: null,\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn {\n\t\t\t\ttotalItems: select( coreStore ).getEntityRecordsTotalItems(\n\t\t\t\t\tkind,\n\t\t\t\t\tname,\n\t\t\t\t\tqueryArgs\n\t\t\t\t),\n\t\t\t\ttotalPages: select( coreStore ).getEntityRecordsTotalPages(\n\t\t\t\t\tkind,\n\t\t\t\t\tname,\n\t\t\t\t\tqueryArgs\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ kind, name, queryAsString, options.enabled ]\n\t);\n\n\treturn {\n\t\trecords,\n\t\ttotalItems,\n\t\ttotalPages,\n\t\t...rest,\n\t};\n}\n\nexport function __experimentalUseEntityRecords(\n\tkind: string,\n\tname: string,\n\tqueryArgs: any,\n\toptions: any\n) {\n\tdeprecated( `wp.data.__experimentalUseEntityRecords`, {\n\t\talternative: 'wp.data.useEntityRecords',\n\t\tsince: '6.1',\n\t} );\n\treturn useEntityRecords( kind, name, queryArgs, options );\n}\n\nexport function useEntityRecordsWithPermissions< RecordType >(\n\tkind: string,\n\tname: string,\n\tqueryArgs: Record< string, unknown > = {},\n\toptions: Options = { enabled: true }\n): EntityRecordsResolution< RecordType > {\n\tconst entityConfig = useSelect(\n\t\t( select ) => select( coreStore ).getEntityConfig( kind, name ),\n\t\t[ kind, name ]\n\t);\n\tconst { records: data, ...ret } = useEntityRecords(\n\t\tkind,\n\t\tname,\n\t\t{\n\t\t\t...queryArgs,\n\t\t\t// If _fields is provided, we need to include _links in the request for permission caching to work.\n\t\t\t...( queryArgs._fields\n\t\t\t\t? {\n\t\t\t\t\t\t_fields: [\n\t\t\t\t\t\t\t...new Set( [\n\t\t\t\t\t\t\t\t...( getNormalizedCommaSeparable(\n\t\t\t\t\t\t\t\t\tqueryArgs._fields\n\t\t\t\t\t\t\t\t) || [] ),\n\t\t\t\t\t\t\t\t'_links',\n\t\t\t\t\t\t\t] ),\n\t\t\t\t\t\t].join(),\n\t\t\t\t }\n\t\t\t\t: {} ),\n\t\t},\n\t\toptions\n\t);\n\tconst ids = useMemo(\n\t\t() =>\n\t\t\tdata?.map(\n\t\t\t\t// @ts-ignore\n\t\t\t\t( record: RecordType ) => record[ entityConfig?.key ?? 'id' ]\n\t\t\t) ?? [],\n\t\t[ data, entityConfig?.key ]\n\t);\n\n\tconst permissions = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecordsPermissions } = unlock(\n\t\t\t\tselect( coreStore )\n\t\t\t);\n\t\t\treturn getEntityRecordsPermissions( kind, name, ids );\n\t\t},\n\t\t[ ids, kind, name ]\n\t);\n\n\tconst dataWithPermissions = useMemo(\n\t\t() =>\n\t\t\tdata?.map( ( record, index ) => ( {\n\t\t\t\t// @ts-ignore\n\t\t\t\t...record,\n\t\t\t\tpermissions: permissions[ index ],\n\t\t\t} ) ) ?? [],\n\t\t[ data, permissions ]\n\t);\n\n\treturn { records: dataWithPermissions, ...ret };\n}\n"],"mappings":"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","ignoreList":[]}
|
package/build/resolvers.js
CHANGED
|
@@ -289,10 +289,11 @@ const getEntityRecords = (kind, name, query = {}) => async ({
|
|
|
289
289
|
// the `getEntityRecord` and `canUser` selectors in addition to `getEntityRecords`.
|
|
290
290
|
// See https://github.com/WordPress/gutenberg/pull/26575
|
|
291
291
|
// See https://github.com/WordPress/gutenberg/pull/64504
|
|
292
|
-
|
|
293
|
-
|
|
292
|
+
// See https://github.com/WordPress/gutenberg/pull/70738
|
|
293
|
+
if (!query.context) {
|
|
294
|
+
const targetHints = records.filter(record => !!record?.[key] && !!record?._links?.self?.[0]?.targetHints?.allow).map(record => ({
|
|
294
295
|
id: record[key],
|
|
295
|
-
permissions: (0, _utils.getUserPermissionsFromAllowHeader)(record
|
|
296
|
+
permissions: (0, _utils.getUserPermissionsFromAllowHeader)(record._links.self[0].targetHints.allow)
|
|
296
297
|
}));
|
|
297
298
|
const canUserResolutionsArgs = [];
|
|
298
299
|
const receiveUserPermissionArgs = {};
|
|
@@ -310,9 +311,13 @@ const getEntityRecords = (kind, name, query = {}) => async ({
|
|
|
310
311
|
})] = targetHint.permissions[action];
|
|
311
312
|
}
|
|
312
313
|
}
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
314
|
+
if (targetHints.length > 0) {
|
|
315
|
+
dispatch.receiveUserPermissions(receiveUserPermissionArgs);
|
|
316
|
+
dispatch.finishResolutions('canUser', canUserResolutionsArgs);
|
|
317
|
+
}
|
|
318
|
+
if (!query?._fields) {
|
|
319
|
+
dispatch.finishResolutions('getEntityRecord', getResolutionsArgs(records));
|
|
320
|
+
}
|
|
316
321
|
}
|
|
317
322
|
dispatch.__unstableReleaseStoreLock(lock);
|
|
318
323
|
});
|