@prismicio/client 6.6.1-alpha.0 → 6.6.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/dist/index.cjs +5 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/package.json +11 -11
- package/src/client.ts +7 -2
- package/src/types.ts +0 -4
package/src/client.ts
CHANGED
|
@@ -392,7 +392,7 @@ export class Client<
|
|
|
392
392
|
if (typeof options.fetch === "function") {
|
|
393
393
|
this.fetchFn = options.fetch;
|
|
394
394
|
} else if (typeof globalThis.fetch === "function") {
|
|
395
|
-
this.fetchFn = globalThis.fetch;
|
|
395
|
+
this.fetchFn = globalThis.fetch as FetchLike;
|
|
396
396
|
} else {
|
|
397
397
|
throw new PrismicError(
|
|
398
398
|
"A valid fetch implementation was not provided. In environments where fetch is not available (including Node.js), a fetch implementation must be provided via a polyfill or the `fetch` option.",
|
|
@@ -531,7 +531,12 @@ export class Client<
|
|
|
531
531
|
async getFirst<TDocument extends TDocuments>(
|
|
532
532
|
params?: Partial<BuildQueryURLArgs> & FetchParams,
|
|
533
533
|
): Promise<TDocument> {
|
|
534
|
-
const url = await this.buildQueryURL(
|
|
534
|
+
const url = await this.buildQueryURL({
|
|
535
|
+
pageSize:
|
|
536
|
+
this.defaultParams?.pageSize ||
|
|
537
|
+
(params && "page" in params ? undefined : 1),
|
|
538
|
+
...params,
|
|
539
|
+
});
|
|
535
540
|
const result = await this.fetch<prismicT.Query<TDocument>>(url, params);
|
|
536
541
|
|
|
537
542
|
const firstResult = result.results[0];
|
package/src/types.ts
CHANGED
|
@@ -79,10 +79,6 @@ export type AbortSignalLike = {
|
|
|
79
79
|
dispatchEvent: any;
|
|
80
80
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
81
81
|
onabort: any;
|
|
82
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
83
|
-
reason: any;
|
|
84
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
85
|
-
throwIfAborted: any;
|
|
86
82
|
};
|
|
87
83
|
|
|
88
84
|
/**
|