@builder.io/sdk-svelte 1.0.14 → 1.0.15

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.
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "1.0.14";
1
+ export declare const SDK_VERSION = "1.0.15";
@@ -1 +1 @@
1
- export const SDK_VERSION = "1.0.14";
1
+ export const SDK_VERSION = "1.0.15";
@@ -22,7 +22,8 @@ export async function fetchOneEntry(options) {
22
22
  }
23
23
  const _fetchContent = async (options) => {
24
24
  const url = generateContentUrl(options);
25
- const res = await fetch(url.href);
25
+ const _fetch = options.fetch ?? fetch;
26
+ const res = await _fetch(url.href, options.fetchOptions);
26
27
  const content = await res.json();
27
28
  return content;
28
29
  };
@@ -128,4 +128,12 @@ export interface GetContentOptions {
128
128
  * draft mode and un-archived. Default is false.
129
129
  */
130
130
  includeUnpublished?: boolean;
131
+ /**
132
+ * Optional override of the `fetch` function. (Defaults to global `fetch`)
133
+ */
134
+ fetch?: typeof global.fetch;
135
+ /**
136
+ * Optional fetch options to be passed to the `fetch` function.
137
+ */
138
+ fetchOptions?: RequestInit;
131
139
  }
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "1.0.14";
1
+ export declare const SDK_VERSION = "1.0.15";
@@ -1 +1 @@
1
- export const SDK_VERSION = "1.0.14";
1
+ export const SDK_VERSION = "1.0.15";
@@ -22,7 +22,8 @@ export async function fetchOneEntry(options) {
22
22
  }
23
23
  const _fetchContent = async (options) => {
24
24
  const url = generateContentUrl(options);
25
- const res = await fetch(url.href);
25
+ const _fetch = options.fetch ?? fetch;
26
+ const res = await _fetch(url.href, options.fetchOptions);
26
27
  const content = await res.json();
27
28
  return content;
28
29
  };
@@ -128,4 +128,12 @@ export interface GetContentOptions {
128
128
  * draft mode and un-archived. Default is false.
129
129
  */
130
130
  includeUnpublished?: boolean;
131
+ /**
132
+ * Optional override of the `fetch` function. (Defaults to global `fetch`)
133
+ */
134
+ fetch?: typeof global.fetch;
135
+ /**
136
+ * Optional fetch options to be passed to the `fetch` function.
137
+ */
138
+ fetchOptions?: RequestInit;
131
139
  }
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "1.0.14";
1
+ export declare const SDK_VERSION = "1.0.15";
@@ -1 +1 @@
1
- export const SDK_VERSION = "1.0.14";
1
+ export const SDK_VERSION = "1.0.15";
@@ -22,7 +22,8 @@ export async function fetchOneEntry(options) {
22
22
  }
23
23
  const _fetchContent = async (options) => {
24
24
  const url = generateContentUrl(options);
25
- const res = await fetch(url.href);
25
+ const _fetch = options.fetch ?? fetch;
26
+ const res = await _fetch(url.href, options.fetchOptions);
26
27
  const content = await res.json();
27
28
  return content;
28
29
  };
@@ -128,4 +128,12 @@ export interface GetContentOptions {
128
128
  * draft mode and un-archived. Default is false.
129
129
  */
130
130
  includeUnpublished?: boolean;
131
+ /**
132
+ * Optional override of the `fetch` function. (Defaults to global `fetch`)
133
+ */
134
+ fetch?: typeof global.fetch;
135
+ /**
136
+ * Optional fetch options to be passed to the `fetch` function.
137
+ */
138
+ fetchOptions?: RequestInit;
131
139
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@builder.io/sdk-svelte",
3
3
  "description": "Builder.io SDK for Svelte",
4
- "version": "1.0.14",
4
+ "version": "1.0.15",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "lib",
@@ -1 +1 @@
1
- export const SDK_VERSION = "1.0.14"
1
+ export const SDK_VERSION = "1.0.15"
@@ -32,7 +32,8 @@ type ContentResponse = ContentResults | {
32
32
  };
33
33
  const _fetchContent = async (options: GetContentOptions) => {
34
34
  const url = generateContentUrl(options);
35
- const res = await fetch(url.href);
35
+ const _fetch = options.fetch ?? fetch;
36
+ const res = await _fetch(url.href, options.fetchOptions);
36
37
  const content = await (res.json() as Promise<ContentResponse>);
37
38
  return content;
38
39
  };
@@ -144,4 +144,14 @@ export interface GetContentOptions {
144
144
  * draft mode and un-archived. Default is false.
145
145
  */
146
146
  includeUnpublished?: boolean;
147
+
148
+ /**
149
+ * Optional override of the `fetch` function. (Defaults to global `fetch`)
150
+ */
151
+ fetch?: typeof global.fetch;
152
+
153
+ /**
154
+ * Optional fetch options to be passed to the `fetch` function.
155
+ */
156
+ fetchOptions?: RequestInit;
147
157
  }