@wordpress/core-data 4.4.5 → 4.7.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.
Files changed (44) hide show
  1. package/CHANGELOG.md +11 -1
  2. package/README.md +175 -85
  3. package/build/entities.js +3 -0
  4. package/build/entities.js.map +1 -1
  5. package/build/hooks/constants.js +0 -2
  6. package/build/hooks/constants.js.map +1 -1
  7. package/build/hooks/index.js +38 -0
  8. package/build/hooks/index.js.map +1 -0
  9. package/build/hooks/use-entity-record.js +22 -8
  10. package/build/hooks/use-entity-record.js.map +1 -1
  11. package/build/hooks/use-entity-records.js +21 -8
  12. package/build/hooks/use-entity-records.js.map +1 -1
  13. package/build/index.js +17 -21
  14. package/build/index.js.map +1 -1
  15. package/build/selectors.js +163 -163
  16. package/build/selectors.js.map +1 -1
  17. package/build-module/entities.js +3 -0
  18. package/build-module/entities.js.map +1 -1
  19. package/build-module/hooks/constants.js +0 -1
  20. package/build-module/hooks/constants.js.map +1 -1
  21. package/build-module/hooks/index.js +3 -0
  22. package/build-module/hooks/index.js.map +1 -0
  23. package/build-module/hooks/use-entity-record.js +18 -7
  24. package/build-module/hooks/use-entity-record.js.map +1 -1
  25. package/build-module/hooks/use-entity-records.js +17 -7
  26. package/build-module/hooks/use-entity-records.js.map +1 -1
  27. package/build-module/index.js +2 -3
  28. package/build-module/index.js.map +1 -1
  29. package/build-module/selectors.js +164 -163
  30. package/build-module/selectors.js.map +1 -1
  31. package/package.json +11 -11
  32. package/src/entities.ts +1 -0
  33. package/src/hooks/constants.ts +1 -2
  34. package/src/hooks/index.ts +8 -0
  35. package/src/hooks/test/use-entity-record.js +1 -0
  36. package/src/hooks/test/use-entity-records.js +1 -0
  37. package/src/hooks/test/use-query-select.js +1 -0
  38. package/src/hooks/use-entity-record.ts +32 -9
  39. package/src/hooks/use-entity-records.ts +28 -30
  40. package/src/index.js +2 -3
  41. package/src/selectors.ts +406 -216
  42. package/src/test/actions.js +16 -0
  43. package/src/test/entities.js +5 -0
  44. package/src/test/resolvers.js +11 -0
@@ -91,10 +91,10 @@ const EMPTY_OBJECT = {};
91
91
  * Returns true if a request is in progress for embed preview data, or false
92
92
  * otherwise.
93
93
  *
94
- * @param {Object} state Data state.
95
- * @param {string} url URL the preview would be for.
94
+ * @param state Data state.
95
+ * @param url URL the preview would be for.
96
96
  *
97
- * @return {boolean} Whether a request is in progress for an embed preview.
97
+ * @return Whether a request is in progress for an embed preview.
98
98
  */
99
99
 
100
100
  const isRequestingEmbedPreview = (0, _data.createRegistrySelector)(select => (state, url) => {
@@ -105,10 +105,10 @@ const isRequestingEmbedPreview = (0, _data.createRegistrySelector)(select => (st
105
105
  *
106
106
  * @deprecated since 11.3. Callers should use `select( 'core' ).getUsers({ who: 'authors' })` instead.
107
107
  *
108
- * @param {Object} state Data state.
109
- * @param {Object|undefined} query Optional object of query parameters to
110
- * include with request.
111
- * @return {Array} Authors list.
108
+ * @param state Data state.
109
+ * @param query Optional object of query parameters to
110
+ * include with request.
111
+ * @return Authors list.
112
112
  */
113
113
 
114
114
  exports.isRequestingEmbedPreview = isRequestingEmbedPreview;
@@ -124,9 +124,9 @@ function getAuthors(state, query) {
124
124
  /**
125
125
  * Returns the current user.
126
126
  *
127
- * @param {Object} state Data state.
127
+ * @param state Data state.
128
128
  *
129
- * @return {Object} Current user object.
129
+ * @return Current user object.
130
130
  */
131
131
 
132
132
 
@@ -136,10 +136,10 @@ function getCurrentUser(state) {
136
136
  /**
137
137
  * Returns all the users returned by a query ID.
138
138
  *
139
- * @param {Object} state Data state.
140
- * @param {string} queryID Query ID.
139
+ * @param state Data state.
140
+ * @param queryID Query ID.
141
141
  *
142
- * @return {Array} Users list.
142
+ * @return Users list.
143
143
  */
144
144
 
145
145
 
@@ -151,10 +151,10 @@ const getUserQueryResults = (0, _rememo.default)((state, queryID) => {
151
151
  * Returns the loaded entities for the given kind.
152
152
  *
153
153
  * @deprecated since WordPress 6.0. Use getEntitiesConfig instead
154
- * @param {Object} state Data state.
155
- * @param {string} kind Entity kind.
154
+ * @param state Data state.
155
+ * @param kind Entity kind.
156
156
  *
157
- * @return {Array<Object>} Array of entities with config matching kind.
157
+ * @return Array of entities with config matching kind.
158
158
  */
159
159
 
160
160
  exports.getUserQueryResults = getUserQueryResults;
@@ -169,10 +169,10 @@ function getEntitiesByKind(state, kind) {
169
169
  /**
170
170
  * Returns the loaded entities for the given kind.
171
171
  *
172
- * @param {Object} state Data state.
173
- * @param {string} kind Entity kind.
172
+ * @param state Data state.
173
+ * @param kind Entity kind.
174
174
  *
175
- * @return {Array<Object>} Array of entities with config matching kind.
175
+ * @return Array of entities with config matching kind.
176
176
  */
177
177
 
178
178
 
@@ -185,11 +185,11 @@ function getEntitiesConfig(state, kind) {
185
185
  * Returns the entity config given its kind and name.
186
186
  *
187
187
  * @deprecated since WordPress 6.0. Use getEntityConfig instead
188
- * @param {Object} state Data state.
189
- * @param {string} kind Entity kind.
190
- * @param {string} name Entity name.
188
+ * @param state Data state.
189
+ * @param kind Entity kind.
190
+ * @param name Entity name.
191
191
  *
192
- * @return {Object} Entity config
192
+ * @return Entity config
193
193
  */
194
194
 
195
195
 
@@ -203,11 +203,11 @@ function getEntity(state, kind, name) {
203
203
  /**
204
204
  * Returns the entity config given its kind and name.
205
205
  *
206
- * @param {Object} state Data state.
207
- * @param {string} kind Entity kind.
208
- * @param {string} name Entity name.
206
+ * @param state Data state.
207
+ * @param kind Entity kind.
208
+ * @param name Entity name.
209
209
  *
210
- * @return {Object} Entity config
210
+ * @return Entity config
211
211
  */
212
212
 
213
213
 
@@ -222,13 +222,13 @@ function getEntityConfig(state, kind, name) {
222
222
  * yet received, undefined if the value entity is known to not exist, or the
223
223
  * entity object if it exists and is received.
224
224
  *
225
- * @param {Object} state State tree
226
- * @param {string} kind Entity kind.
227
- * @param {string} name Entity name.
228
- * @param {number} key Record's key
229
- * @param {?Object} query Optional query.
225
+ * @param state State tree
226
+ * @param kind Entity kind.
227
+ * @param name Entity name.
228
+ * @param key Record's key
229
+ * @param query Optional query.
230
230
  *
231
- * @return {Object|undefined} Record.
231
+ * @return Record.
232
232
  */
233
233
 
234
234
 
@@ -281,12 +281,12 @@ const getEntityRecord = (0, _rememo.default)((state, kind, name, key, query) =>
281
281
  /**
282
282
  * Returns the Entity's record object by key. Doesn't trigger a resolver nor requests the entity records from the API if the entity record isn't available in the local state.
283
283
  *
284
- * @param {Object} state State tree
285
- * @param {string} kind Entity kind.
286
- * @param {string} name Entity name.
287
- * @param {number} key Record's key
284
+ * @param state State tree
285
+ * @param kind Entity kind.
286
+ * @param name Entity name.
287
+ * @param key Record's key
288
288
  *
289
- * @return {Object|null} Record.
289
+ * @return Record.
290
290
  */
291
291
 
292
292
  exports.getEntityRecord = getEntityRecord;
@@ -298,12 +298,12 @@ function __experimentalGetEntityRecordNoResolver(state, kind, name, key) {
298
298
  * Returns the entity's record object by key,
299
299
  * with its attributes mapped to their raw values.
300
300
  *
301
- * @param {Object} state State tree.
302
- * @param {string} kind Entity kind.
303
- * @param {string} name Entity name.
304
- * @param {number} key Record's key.
301
+ * @param state State tree.
302
+ * @param kind Entity kind.
303
+ * @param name Entity name.
304
+ * @param key Record's key.
305
305
  *
306
- * @return {Object?} Object with the entity's raw attributes.
306
+ * @return Object with the entity's raw attributes.
307
307
  */
308
308
 
309
309
 
@@ -331,12 +331,12 @@ const getRawEntityRecord = (0, _rememo.default)((state, kind, name, key) => {
331
331
  * Returns true if records have been received for the given set of parameters,
332
332
  * or false otherwise.
333
333
  *
334
- * @param {Object} state State tree
335
- * @param {string} kind Entity kind.
336
- * @param {string} name Entity name.
337
- * @param {?Object} query Optional terms query.
334
+ * @param state State tree
335
+ * @param kind Entity kind.
336
+ * @param name Entity name.
337
+ * @param query Optional terms query.
338
338
  *
339
- * @return {boolean} Whether entity records have been received.
339
+ * @return Whether entity records have been received.
340
340
  */
341
341
 
342
342
  exports.getRawEntityRecord = getRawEntityRecord;
@@ -347,12 +347,12 @@ function hasEntityRecords(state, kind, name, query) {
347
347
  /**
348
348
  * Returns the Entity's records.
349
349
  *
350
- * @param {Object} state State tree
351
- * @param {string} kind Entity kind.
352
- * @param {string} name Entity name.
353
- * @param {?Object} query Optional terms query.
350
+ * @param state State tree
351
+ * @param kind Entity kind.
352
+ * @param name Entity name.
353
+ * @param query Optional terms query.
354
354
  *
355
- * @return {?Array} Records.
355
+ * @return Records.
356
356
  */
357
357
 
358
358
 
@@ -367,15 +367,14 @@ function getEntityRecords(state, kind, name, query) {
367
367
 
368
368
  return (0, _queriedData.getQueriedItems)(queriedState, query);
369
369
  }
370
+
370
371
  /**
371
- * Returns the list of dirty entity records.
372
+ * Returns the list of dirty entity records.
372
373
  *
373
- * @param {Object} state State tree.
374
+ * @param state State tree.
374
375
  *
375
- * @return {[{ title: string, key: string, name: string, kind: string }]} The list of updated records
376
+ * @return The list of updated records
376
377
  */
377
-
378
-
379
378
  const __experimentalGetDirtyEntityRecords = (0, _rememo.default)(state => {
380
379
  const {
381
380
  entities: {
@@ -412,9 +411,9 @@ const __experimentalGetDirtyEntityRecords = (0, _rememo.default)(state => {
412
411
  /**
413
412
  * Returns the list of entities currently being saved.
414
413
  *
415
- * @param {Object} state State tree.
414
+ * @param state State tree.
416
415
  *
417
- * @return {[{ title: string, key: string, name: string, kind: string }]} The list of records being saved.
416
+ * @return The list of records being saved.
418
417
  */
419
418
 
420
419
 
@@ -454,12 +453,12 @@ const __experimentalGetEntitiesBeingSaved = (0, _rememo.default)(state => {
454
453
  /**
455
454
  * Returns the specified entity record's edits.
456
455
  *
457
- * @param {Object} state State tree.
458
- * @param {string} kind Entity kind.
459
- * @param {string} name Entity name.
460
- * @param {number} recordId Record ID.
456
+ * @param state State tree.
457
+ * @param kind Entity kind.
458
+ * @param name Entity name.
459
+ * @param recordId Record ID.
461
460
  *
462
- * @return {Object?} The entity record's edits.
461
+ * @return The entity record's edits.
463
462
  */
464
463
 
465
464
 
@@ -475,12 +474,12 @@ function getEntityRecordEdits(state, kind, name, recordId) {
475
474
  * are not considered for change detection.
476
475
  * They are defined in the entity's config.
477
476
  *
478
- * @param {Object} state State tree.
479
- * @param {string} kind Entity kind.
480
- * @param {string} name Entity name.
481
- * @param {number} recordId Record ID.
477
+ * @param state State tree.
478
+ * @param kind Entity kind.
479
+ * @param name Entity name.
480
+ * @param recordId Record ID.
482
481
  *
483
- * @return {Object?} The entity record's non transient edits.
482
+ * @return The entity record's non transient edits.
484
483
  */
485
484
 
486
485
 
@@ -506,12 +505,12 @@ const getEntityRecordNonTransientEdits = (0, _rememo.default)((state, kind, name
506
505
  * Returns true if the specified entity record has edits,
507
506
  * and false otherwise.
508
507
  *
509
- * @param {Object} state State tree.
510
- * @param {string} kind Entity kind.
511
- * @param {string} name Entity name.
512
- * @param {number|string} recordId Record ID.
508
+ * @param state State tree.
509
+ * @param kind Entity kind.
510
+ * @param name Entity name.
511
+ * @param recordId Record ID.
513
512
  *
514
- * @return {boolean} Whether the entity record has edits or not.
513
+ * @return Whether the entity record has edits or not.
515
514
  */
516
515
 
517
516
  exports.getEntityRecordNonTransientEdits = getEntityRecordNonTransientEdits;
@@ -522,12 +521,12 @@ function hasEditsForEntityRecord(state, kind, name, recordId) {
522
521
  /**
523
522
  * Returns the specified entity record, merged with its edits.
524
523
  *
525
- * @param {Object} state State tree.
526
- * @param {string} kind Entity kind.
527
- * @param {string} name Entity name.
528
- * @param {number|string} recordId Record ID.
524
+ * @param state State tree.
525
+ * @param kind Entity kind.
526
+ * @param name Entity name.
527
+ * @param recordId Record ID.
529
528
  *
530
- * @return {Object?} The entity record, merged with its edits.
529
+ * @return The entity record, merged with its edits.
531
530
  */
532
531
 
533
532
 
@@ -542,12 +541,12 @@ const getEditedEntityRecord = (0, _rememo.default)((state, kind, name, recordId)
542
541
  /**
543
542
  * Returns true if the specified entity record is autosaving, and false otherwise.
544
543
  *
545
- * @param {Object} state State tree.
546
- * @param {string} kind Entity kind.
547
- * @param {string} name Entity name.
548
- * @param {number} recordId Record ID.
544
+ * @param state State tree.
545
+ * @param kind Entity kind.
546
+ * @param name Entity name.
547
+ * @param recordId Record ID.
549
548
  *
550
- * @return {boolean} Whether the entity record is autosaving or not.
549
+ * @return Whether the entity record is autosaving or not.
551
550
  */
552
551
 
553
552
  exports.getEditedEntityRecord = getEditedEntityRecord;
@@ -562,12 +561,12 @@ function isAutosavingEntityRecord(state, kind, name, recordId) {
562
561
  /**
563
562
  * Returns true if the specified entity record is saving, and false otherwise.
564
563
  *
565
- * @param {Object} state State tree.
566
- * @param {string} kind Entity kind.
567
- * @param {string} name Entity name.
568
- * @param {number|string} recordId Record ID.
564
+ * @param state State tree.
565
+ * @param kind Entity kind.
566
+ * @param name Entity name.
567
+ * @param recordId Record ID.
569
568
  *
570
- * @return {boolean} Whether the entity record is saving or not.
569
+ * @return Whether the entity record is saving or not.
571
570
  */
572
571
 
573
572
 
@@ -577,12 +576,12 @@ function isSavingEntityRecord(state, kind, name, recordId) {
577
576
  /**
578
577
  * Returns true if the specified entity record is deleting, and false otherwise.
579
578
  *
580
- * @param {Object} state State tree.
581
- * @param {string} kind Entity kind.
582
- * @param {string} name Entity name.
583
- * @param {number} recordId Record ID.
579
+ * @param state State tree.
580
+ * @param kind Entity kind.
581
+ * @param name Entity name.
582
+ * @param recordId Record ID.
584
583
  *
585
- * @return {boolean} Whether the entity record is deleting or not.
584
+ * @return Whether the entity record is deleting or not.
586
585
  */
587
586
 
588
587
 
@@ -592,12 +591,12 @@ function isDeletingEntityRecord(state, kind, name, recordId) {
592
591
  /**
593
592
  * Returns the specified entity record's last save error.
594
593
  *
595
- * @param {Object} state State tree.
596
- * @param {string} kind Entity kind.
597
- * @param {string} name Entity name.
598
- * @param {number} recordId Record ID.
594
+ * @param state State tree.
595
+ * @param kind Entity kind.
596
+ * @param name Entity name.
597
+ * @param recordId Record ID.
599
598
  *
600
- * @return {Object?} The entity record's save error.
599
+ * @return The entity record's save error.
601
600
  */
602
601
 
603
602
 
@@ -607,12 +606,12 @@ function getLastEntitySaveError(state, kind, name, recordId) {
607
606
  /**
608
607
  * Returns the specified entity record's last delete error.
609
608
  *
610
- * @param {Object} state State tree.
611
- * @param {string} kind Entity kind.
612
- * @param {string} name Entity name.
613
- * @param {number} recordId Record ID.
609
+ * @param state State tree.
610
+ * @param kind Entity kind.
611
+ * @param name Entity name.
612
+ * @param recordId Record ID.
614
613
  *
615
- * @return {Object?} The entity record's save error.
614
+ * @return The entity record's save error.
616
615
  */
617
616
 
618
617
 
@@ -626,9 +625,9 @@ function getLastEntityDeleteError(state, kind, name, recordId) {
626
625
  * of the history stack we are at. 0 is the
627
626
  * last edit, -1 is the second last, and so on.
628
627
  *
629
- * @param {Object} state State tree.
628
+ * @param state State tree.
630
629
  *
631
- * @return {number} The current undo offset.
630
+ * @return The current undo offset.
632
631
  */
633
632
 
634
633
 
@@ -639,9 +638,9 @@ function getCurrentUndoOffset(state) {
639
638
  * Returns the previous edit from the current undo offset
640
639
  * for the entity records edits history, if any.
641
640
  *
642
- * @param {Object} state State tree.
641
+ * @param state State tree.
643
642
  *
644
- * @return {Object?} The edit.
643
+ * @return The edit.
645
644
  */
646
645
 
647
646
 
@@ -652,9 +651,9 @@ function getUndoEdit(state) {
652
651
  * Returns the next edit from the current undo offset
653
652
  * for the entity records edits history, if any.
654
653
  *
655
- * @param {Object} state State tree.
654
+ * @param state State tree.
656
655
  *
657
- * @return {Object?} The edit.
656
+ * @return The edit.
658
657
  */
659
658
 
660
659
 
@@ -665,9 +664,9 @@ function getRedoEdit(state) {
665
664
  * Returns true if there is a previous edit from the current undo offset
666
665
  * for the entity records edits history, and false otherwise.
667
666
  *
668
- * @param {Object} state State tree.
667
+ * @param state State tree.
669
668
  *
670
- * @return {boolean} Whether there is a previous edit or not.
669
+ * @return Whether there is a previous edit or not.
671
670
  */
672
671
 
673
672
 
@@ -678,9 +677,9 @@ function hasUndo(state) {
678
677
  * Returns true if there is a next edit from the current undo offset
679
678
  * for the entity records edits history, and false otherwise.
680
679
  *
681
- * @param {Object} state State tree.
680
+ * @param state State tree.
682
681
  *
683
- * @return {boolean} Whether there is a next edit or not.
682
+ * @return Whether there is a next edit or not.
684
683
  */
685
684
 
686
685
 
@@ -690,9 +689,9 @@ function hasRedo(state) {
690
689
  /**
691
690
  * Return the current theme.
692
691
  *
693
- * @param {Object} state Data state.
692
+ * @param state Data state.
694
693
  *
695
- * @return {Object} The current theme.
694
+ * @return The current theme.
696
695
  */
697
696
 
698
697
 
@@ -702,9 +701,9 @@ function getCurrentTheme(state) {
702
701
  /**
703
702
  * Return the ID of the current global styles object.
704
703
  *
705
- * @param {Object} state Data state.
704
+ * @param state Data state.
706
705
  *
707
- * @return {string} The current global styles ID.
706
+ * @return The current global styles ID.
708
707
  */
709
708
 
710
709
 
@@ -714,9 +713,9 @@ function __experimentalGetCurrentGlobalStylesId(state) {
714
713
  /**
715
714
  * Return theme supports data in the index.
716
715
  *
717
- * @param {Object} state Data state.
716
+ * @param state Data state.
718
717
  *
719
- * @return {*} Index data.
718
+ * @return Index data.
720
719
  */
721
720
 
722
721
 
@@ -728,10 +727,10 @@ function getThemeSupports(state) {
728
727
  /**
729
728
  * Returns the embed preview for the given URL.
730
729
  *
731
- * @param {Object} state Data state.
732
- * @param {string} url Embedded URL.
730
+ * @param state Data state.
731
+ * @param url Embedded URL.
733
732
  *
734
- * @return {*} Undefined if the preview has not been fetched, otherwise, the preview fetched from the embed preview API.
733
+ * @return Undefined if the preview has not been fetched, otherwise, the preview fetched from the embed preview API.
735
734
  */
736
735
 
737
736
 
@@ -745,10 +744,10 @@ function getEmbedPreview(state, url) {
745
744
  * We need to be able to determine if a URL is embeddable or not, based on what we
746
745
  * get back from the oEmbed preview API.
747
746
  *
748
- * @param {Object} state Data state.
749
- * @param {string} url Embedded URL.
747
+ * @param state Data state.
748
+ * @param url Embedded URL.
750
749
  *
751
- * @return {boolean} Is the preview for the URL an oEmbed link fallback.
750
+ * @return Is the preview for the URL an oEmbed link fallback.
752
751
  */
753
752
 
754
753
 
@@ -771,12 +770,12 @@ function isPreviewEmbedFallback(state, url) {
771
770
  *
772
771
  * https://developer.wordpress.org/rest-api/reference/
773
772
  *
774
- * @param {Object} state Data state.
775
- * @param {string} action Action to check. One of: 'create', 'read', 'update', 'delete'.
776
- * @param {string} resource REST resource to check, e.g. 'media' or 'posts'.
777
- * @param {string=} id Optional ID of the rest resource to check.
773
+ * @param state Data state.
774
+ * @param action Action to check. One of: 'create', 'read', 'update', 'delete'.
775
+ * @param resource REST resource to check, e.g. 'media' or 'posts'.
776
+ * @param id Optional ID of the rest resource to check.
778
777
  *
779
- * @return {boolean|undefined} Whether or not the user can perform the action,
778
+ * @return Whether or not the user can perform the action,
780
779
  * or `undefined` if the OPTIONS request is still being made.
781
780
  */
782
781
 
@@ -793,11 +792,11 @@ function canUser(state, action, resource, id) {
793
792
  *
794
793
  * https://developer.wordpress.org/rest-api/reference/
795
794
  *
796
- * @param {Object} state Data state.
797
- * @param {string} kind Entity kind.
798
- * @param {string} name Entity name.
799
- * @param {string} recordId Record's id.
800
- * @return {boolean|undefined} Whether or not the user can edit,
795
+ * @param state Data state.
796
+ * @param kind Entity kind.
797
+ * @param name Entity name.
798
+ * @param recordId Record's id.
799
+ * @return Whether or not the user can edit,
801
800
  * or `undefined` if the OPTIONS request is still being made.
802
801
  */
803
802
 
@@ -818,11 +817,11 @@ function canUserEditEntityRecord(state, kind, name, recordId) {
818
817
  * May return multiple autosaves since the backend stores one autosave per
819
818
  * author for each post.
820
819
  *
821
- * @param {Object} state State tree.
822
- * @param {string} postType The type of the parent post.
823
- * @param {number} postId The id of the parent post.
820
+ * @param state State tree.
821
+ * @param postType The type of the parent post.
822
+ * @param postId The id of the parent post.
824
823
  *
825
- * @return {?Array} An array of autosaves for the post, or undefined if there is none.
824
+ * @return An array of autosaves for the post, or undefined if there is none.
826
825
  */
827
826
 
828
827
 
@@ -832,12 +831,12 @@ function getAutosaves(state, postType, postId) {
832
831
  /**
833
832
  * Returns the autosave for the post and author.
834
833
  *
835
- * @param {Object} state State tree.
836
- * @param {string} postType The type of the parent post.
837
- * @param {number} postId The id of the parent post.
838
- * @param {number} authorId The id of the author.
834
+ * @param state State tree.
835
+ * @param postType The type of the parent post.
836
+ * @param postId The id of the parent post.
837
+ * @param authorId The id of the author.
839
838
  *
840
- * @return {?Object} The autosave for the post and author.
839
+ * @return The autosave for the post and author.
841
840
  */
842
841
 
843
842
 
@@ -854,11 +853,11 @@ function getAutosave(state, postType, postId, authorId) {
854
853
  /**
855
854
  * Returns true if the REST request for autosaves has completed.
856
855
  *
857
- * @param {Object} state State tree.
858
- * @param {string} postType The type of the parent post.
859
- * @param {number} postId The id of the parent post.
856
+ * @param state State tree.
857
+ * @param postType The type of the parent post.
858
+ * @param postId The id of the parent post.
860
859
  *
861
- * @return {boolean} True if the REST request was completed. False otherwise.
860
+ * @return True if the REST request was completed. False otherwise.
862
861
  */
863
862
 
864
863
 
@@ -879,20 +878,21 @@ const hasFetchedAutosaves = (0, _data.createRegistrySelector)(select => (state,
879
878
  * );
880
879
  * ```
881
880
  *
882
- * @param {Object} state Editor state.
881
+ * @param state Editor state.
883
882
  *
884
- * @return {*} A value whose reference will change only when an edit occurs.
883
+ * @return A value whose reference will change only when an edit occurs.
885
884
  */
886
885
 
887
886
  exports.hasFetchedAutosaves = hasFetchedAutosaves;
888
- const getReferenceByDistinctEdits = (0, _rememo.default)(() => [], state => [state.undo.length, state.undo.offset, state.undo.flattenedUndo]);
887
+ const getReferenceByDistinctEdits = (0, _rememo.default)( // This unused state argument is listed here for the documentation generating tool (docgen).
888
+ state => [], state => [state.undo.length, state.undo.offset, state.undo.flattenedUndo]);
889
889
  /**
890
890
  * Retrieve the frontend template used for a given link.
891
891
  *
892
- * @param {Object} state Editor state.
893
- * @param {string} link Link.
892
+ * @param state Editor state.
893
+ * @param link Link.
894
894
  *
895
- * @return {Object?} The template record.
895
+ * @return The template record.
896
896
  */
897
897
 
898
898
  exports.getReferenceByDistinctEdits = getReferenceByDistinctEdits;
@@ -912,9 +912,9 @@ function __experimentalGetTemplateForLink(state, link) {
912
912
  /**
913
913
  * Retrieve the current theme's base global styles
914
914
  *
915
- * @param {Object} state Editor state.
915
+ * @param state Editor state.
916
916
  *
917
- * @return {Object|null} The Global Styles object.
917
+ * @return The Global Styles object.
918
918
  */
919
919
 
920
920
 
@@ -930,9 +930,9 @@ function __experimentalGetCurrentThemeBaseGlobalStyles(state) {
930
930
  /**
931
931
  * Return the ID of the current global styles object.
932
932
  *
933
- * @param {Object} state Data state.
933
+ * @param state Data state.
934
934
  *
935
- * @return {string|null} The current global styles ID.
935
+ * @return The current global styles ID.
936
936
  */
937
937
 
938
938
 
@@ -948,9 +948,9 @@ function __experimentalGetCurrentThemeGlobalStylesVariations(state) {
948
948
  /**
949
949
  * Retrieve the list of registered block patterns.
950
950
  *
951
- * @param {Object} state Data state.
951
+ * @param state Data state.
952
952
  *
953
- * @return {Array} Block pattern list.
953
+ * @return Block pattern list.
954
954
  */
955
955
 
956
956
 
@@ -960,9 +960,9 @@ function getBlockPatterns(state) {
960
960
  /**
961
961
  * Retrieve the list of registered block pattern categories.
962
962
  *
963
- * @param {Object} state Data state.
963
+ * @param state Data state.
964
964
  *
965
- * @return {Array} Block pattern category list.
965
+ * @return Block pattern category list.
966
966
  */
967
967
 
968
968