@prismicio/client 6.4.2 → 6.4.3

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/src/client.ts CHANGED
@@ -218,7 +218,7 @@ const typePredicate = (documentType: string): string =>
218
218
  * Creates a predicate to filter content by document tags. All tags are required
219
219
  * on the document.
220
220
  *
221
- * @param documentType - Document tags to filter queried content.
221
+ * @param tags - Document tags to filter queried content.
222
222
  *
223
223
  * @returns A predicate that can be used in a Prismic REST API V2 request.
224
224
  */
@@ -229,7 +229,7 @@ const everyTagPredicate = (tags: string | string[]): string =>
229
229
  * Creates a predicate to filter content by document tags. At least one matching
230
230
  * tag is required on the document.
231
231
  *
232
- * @param documentType - Document tags to filter queried content.
232
+ * @param tags - Document tags to filter queried content.
233
233
  *
234
234
  * @returns A predicate that can be used in a Prismic REST API V2 request.
235
235
  */
@@ -547,8 +547,10 @@ export class Client {
547
547
  const { limit = Infinity, ...actualParams } = params;
548
548
  const resolvedParams = {
549
549
  ...actualParams,
550
- pageSize:
550
+ pageSize: Math.min(
551
+ limit,
551
552
  actualParams.pageSize || this.defaultParams?.pageSize || MAX_PAGE_SIZE,
553
+ ),
552
554
  };
553
555
 
554
556
  const documents: TDocument[] = [];
@@ -658,7 +660,7 @@ export class Client {
658
660
  */
659
661
  async getAllByIDs<TDocument extends prismicT.PrismicDocument>(
660
662
  ids: string[],
661
- params?: Partial<BuildQueryURLArgs> & FetchParams,
663
+ params?: Partial<BuildQueryURLArgs> & GetAllParams & FetchParams,
662
664
  ): Promise<TDocument[]> {
663
665
  return await this.dangerouslyGetAll<TDocument>(
664
666
  appendPredicates(params, predicate.in("document.id", ids)),
@@ -764,7 +766,7 @@ export class Client {
764
766
  async getAllByUIDs<TDocument extends prismicT.PrismicDocument>(
765
767
  documentType: string,
766
768
  uids: string[],
767
- params?: Partial<BuildQueryURLArgs> & FetchParams,
769
+ params?: Partial<BuildQueryURLArgs> & GetAllParams & FetchParams,
768
770
  ): Promise<TDocument[]> {
769
771
  return await this.dangerouslyGetAll<TDocument>(
770
772
  appendPredicates(params, [
@@ -849,7 +851,9 @@ export class Client {
849
851
  */
850
852
  async getAllByType<TDocument extends prismicT.PrismicDocument>(
851
853
  documentType: string,
852
- params?: Partial<Omit<BuildQueryURLArgs, "page">> & FetchParams,
854
+ params?: Partial<Omit<BuildQueryURLArgs, "page">> &
855
+ GetAllParams &
856
+ FetchParams,
853
857
  ): Promise<TDocument[]> {
854
858
  return await this.dangerouslyGetAll<TDocument>(
855
859
  appendPredicates(params, typePredicate(documentType)),
@@ -901,7 +905,9 @@ export class Client {
901
905
  */
902
906
  async getAllByTag<TDocument extends prismicT.PrismicDocument>(
903
907
  tag: string,
904
- params?: Partial<Omit<BuildQueryURLArgs, "page">> & FetchParams,
908
+ params?: Partial<Omit<BuildQueryURLArgs, "page">> &
909
+ GetAllParams &
910
+ FetchParams,
905
911
  ): Promise<TDocument[]> {
906
912
  return await this.dangerouslyGetAll<TDocument>(
907
913
  appendPredicates(params, someTagsPredicate(tag)),
@@ -953,7 +959,9 @@ export class Client {
953
959
  */
954
960
  async getAllByEveryTag<TDocument extends prismicT.PrismicDocument>(
955
961
  tags: string[],
956
- params?: Partial<Omit<BuildQueryURLArgs, "page">> & FetchParams,
962
+ params?: Partial<Omit<BuildQueryURLArgs, "page">> &
963
+ GetAllParams &
964
+ FetchParams,
957
965
  ): Promise<TDocument[]> {
958
966
  return await this.dangerouslyGetAll<TDocument>(
959
967
  appendPredicates(params, everyTagPredicate(tags)),
@@ -1005,7 +1013,9 @@ export class Client {
1005
1013
  */
1006
1014
  async getAllBySomeTags<TDocument extends prismicT.PrismicDocument>(
1007
1015
  tags: string[],
1008
- params?: Partial<Omit<BuildQueryURLArgs, "page">> & FetchParams,
1016
+ params?: Partial<Omit<BuildQueryURLArgs, "page">> &
1017
+ GetAllParams &
1018
+ FetchParams,
1009
1019
  ): Promise<TDocument[]> {
1010
1020
  return await this.dangerouslyGetAll<TDocument>(
1011
1021
  appendPredicates(params, someTagsPredicate(tags)),
@@ -1258,7 +1268,7 @@ export class Client {
1258
1268
  * const document = await client.getByID("WW4bKScAAMAqmluX");
1259
1269
  * ```
1260
1270
  *
1261
- * @param id - The ID of the Release.
1271
+ * @param releaseID - The ID of the Release.
1262
1272
  */
1263
1273
  queryContentFromReleaseByID(releaseID: string): void {
1264
1274
  this.refState = {
@@ -1281,7 +1291,7 @@ export class Client {
1281
1291
  * const document = await client.getByID("WW4bKScAAMAqmluX");
1282
1292
  * ```
1283
1293
  *
1284
- * @param label - The label of the Release.
1294
+ * @param releaseLabel - The label of the Release.
1285
1295
  */
1286
1296
  queryContentFromReleaseByLabel(releaseLabel: string): void {
1287
1297
  this.refState = {