@prismicio/client 6.6.0 → 6.6.2
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/dist/index.cjs +5 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +6 -8
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +19 -14
- package/src/types.ts +0 -4
package/dist/index.d.ts
CHANGED
|
@@ -100,8 +100,6 @@ declare type AbortSignalLike = {
|
|
|
100
100
|
removeEventListener: any;
|
|
101
101
|
dispatchEvent: any;
|
|
102
102
|
onabort: any;
|
|
103
|
-
reason: any;
|
|
104
|
-
throwIfAborted: any;
|
|
105
103
|
};
|
|
106
104
|
/**
|
|
107
105
|
* The minimum required properties from RequestInit.
|
|
@@ -678,7 +676,7 @@ declare class Client<TDocuments extends prismicT.PrismicDocument = prismicT.Pris
|
|
|
678
676
|
* @returns The document with a UID matching the `uid` parameter, if a
|
|
679
677
|
* matching document exists.
|
|
680
678
|
*/
|
|
681
|
-
getByUID<TDocument extends TDocuments, TDocumentType extends TDocument["type"] = TDocument["type"]>(documentType: TDocumentType, uid: string, params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<ExtractDocumentType<
|
|
679
|
+
getByUID<TDocument extends TDocuments, TDocumentType extends TDocument["type"] = TDocument["type"]>(documentType: TDocumentType, uid: string, params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<ExtractDocumentType<TDocument, TDocumentType>>;
|
|
682
680
|
/**
|
|
683
681
|
* Queries document from the Prismic repository with specific UIDs and Custom Type.
|
|
684
682
|
*
|
|
@@ -703,7 +701,7 @@ declare class Client<TDocuments extends prismicT.PrismicDocument = prismicT.Pris
|
|
|
703
701
|
* @returns A paginated response containing documents with UIDs matching the
|
|
704
702
|
* `uids` parameter.
|
|
705
703
|
*/
|
|
706
|
-
getByUIDs<TDocument extends TDocuments, TDocumentType extends TDocument["type"] = TDocument["type"]>(documentType: TDocumentType, uids: string[], params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<prismicT.Query<ExtractDocumentType<
|
|
704
|
+
getByUIDs<TDocument extends TDocuments, TDocumentType extends TDocument["type"] = TDocument["type"]>(documentType: TDocumentType, uids: string[], params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<prismicT.Query<ExtractDocumentType<TDocument, TDocumentType>>>;
|
|
707
705
|
/**
|
|
708
706
|
* Queries all documents from the Prismic repository with specific UIDs and Custom Type.
|
|
709
707
|
*
|
|
@@ -729,7 +727,7 @@ declare class Client<TDocuments extends prismicT.PrismicDocument = prismicT.Pris
|
|
|
729
727
|
*
|
|
730
728
|
* @returns A list of documents with UIDs matching the `uids` parameter.
|
|
731
729
|
*/
|
|
732
|
-
getAllByUIDs<TDocument extends TDocuments, TDocumentType extends TDocument["type"] = TDocument["type"]>(documentType: TDocumentType, uids: string[], params?: Partial<BuildQueryURLArgs> & GetAllParams & FetchParams): Promise<ExtractDocumentType<
|
|
730
|
+
getAllByUIDs<TDocument extends TDocuments, TDocumentType extends TDocument["type"] = TDocument["type"]>(documentType: TDocumentType, uids: string[], params?: Partial<BuildQueryURLArgs> & GetAllParams & FetchParams): Promise<ExtractDocumentType<TDocument, TDocumentType>[]>;
|
|
733
731
|
/**
|
|
734
732
|
* Queries a singleton document from the Prismic repository for a specific Custom Type.
|
|
735
733
|
*
|
|
@@ -750,7 +748,7 @@ declare class Client<TDocuments extends prismicT.PrismicDocument = prismicT.Pris
|
|
|
750
748
|
*
|
|
751
749
|
* @returns The singleton document for the Custom Type, if a matching document exists.
|
|
752
750
|
*/
|
|
753
|
-
getSingle<TDocument extends TDocuments, TDocumentType extends TDocument["type"] = TDocument["type"]>(documentType: TDocumentType, params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<ExtractDocumentType<
|
|
751
|
+
getSingle<TDocument extends TDocuments, TDocumentType extends TDocument["type"] = TDocument["type"]>(documentType: TDocumentType, params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<ExtractDocumentType<TDocument, TDocumentType>>;
|
|
754
752
|
/**
|
|
755
753
|
* Queries documents from the Prismic repository for a specific Custom Type.
|
|
756
754
|
*
|
|
@@ -769,7 +767,7 @@ declare class Client<TDocuments extends prismicT.PrismicDocument = prismicT.Pris
|
|
|
769
767
|
*
|
|
770
768
|
* @returns A paginated response containing documents of the Custom Type.
|
|
771
769
|
*/
|
|
772
|
-
getByType<TDocument extends TDocuments, TDocumentType extends TDocument["type"] = TDocument["type"]>(documentType: TDocumentType, params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<prismicT.Query<ExtractDocumentType<
|
|
770
|
+
getByType<TDocument extends TDocuments, TDocumentType extends TDocument["type"] = TDocument["type"]>(documentType: TDocumentType, params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<prismicT.Query<ExtractDocumentType<TDocument, TDocumentType>>>;
|
|
773
771
|
/**
|
|
774
772
|
* Queries all documents from the Prismic repository for a specific Custom Type.
|
|
775
773
|
*
|
|
@@ -787,7 +785,7 @@ declare class Client<TDocuments extends prismicT.PrismicDocument = prismicT.Pris
|
|
|
787
785
|
*
|
|
788
786
|
* @returns A list of all documents of the Custom Type.
|
|
789
787
|
*/
|
|
790
|
-
getAllByType<TDocument extends TDocuments, TDocumentType extends TDocument["type"] = TDocument["type"]>(documentType: TDocumentType, params?: Partial<Omit<BuildQueryURLArgs, "page">> & GetAllParams & FetchParams): Promise<ExtractDocumentType<
|
|
788
|
+
getAllByType<TDocument extends TDocuments, TDocumentType extends TDocument["type"] = TDocument["type"]>(documentType: TDocumentType, params?: Partial<Omit<BuildQueryURLArgs, "page">> & GetAllParams & FetchParams): Promise<ExtractDocumentType<TDocument, TDocumentType>[]>;
|
|
791
789
|
/**
|
|
792
790
|
* Queries documents from the Prismic repository with a specific tag.
|
|
793
791
|
*
|
package/dist/index.js
CHANGED
|
@@ -278,7 +278,11 @@ class Client {
|
|
|
278
278
|
return await this.fetch(url, params);
|
|
279
279
|
}
|
|
280
280
|
async getFirst(params) {
|
|
281
|
-
|
|
281
|
+
var _a;
|
|
282
|
+
const url = await this.buildQueryURL({
|
|
283
|
+
pageSize: ((_a = this.defaultParams) == null ? void 0 : _a.pageSize) || (params && "page" in params ? void 0 : 1),
|
|
284
|
+
...params
|
|
285
|
+
});
|
|
282
286
|
const result = await this.fetch(url, params);
|
|
283
287
|
const firstResult = result.results[0];
|
|
284
288
|
if (firstResult) {
|