isomorphic-git 1.40.8 → 1.41.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.
@@ -28,6 +28,7 @@ var get = _interopDefault(require('simple-get'));
28
28
  * @property {AsyncIterableIterator<Uint8Array>} [body] - An async iterator of Uint8Arrays that make up the body of POST requests
29
29
  * @property {ProgressCallback} [onProgress] - Reserved for future use (emitting `GitProgressEvent`s)
30
30
  * @property {object} [signal] - Reserved for future use (canceling a request)
31
+ * @property {Object} [fetchOptions={}] - Additional options to pass to fetch (Web) or simple-get (Node)
31
32
  */
32
33
 
33
34
  /**
@@ -94,6 +95,7 @@ async function forAwait(iterable, cb) {
94
95
  }
95
96
 
96
97
  function asyncIteratorToStream(iter) {
98
+ // @ts-expect-error: readable-stream has PassThrough at runtime, types mismatch
97
99
  const { PassThrough } = require('readable-stream');
98
100
  const stream = new PassThrough();
99
101
  setTimeout(async () => {
@@ -194,10 +196,12 @@ async function request({
194
196
  method = 'GET',
195
197
  headers = {},
196
198
  agent,
199
+ fetchOptions = {},
197
200
  body,
198
201
  }) {
199
202
  // If we can, we should send it as a single buffer so it sets a Content-Length header.
200
203
  if (body && Array.isArray(body)) {
204
+ // @ts-expect-error
201
205
  body = Buffer.from(await collect(body));
202
206
  } else if (body) {
203
207
  body = asyncIteratorToStream(body);
@@ -205,6 +209,7 @@ async function request({
205
209
  return new Promise((resolve, reject) => {
206
210
  get(
207
211
  {
212
+ ...fetchOptions,
208
213
  url,
209
214
  method,
210
215
  headers,
@@ -37,6 +37,10 @@ export type GitHttpRequest = {
37
37
  * - Reserved for future use (canceling a request)
38
38
  */
39
39
  signal?: object;
40
+ /**
41
+ * - Additional options to pass to fetch (Web) or simple-get (Node)
42
+ */
43
+ fetchOptions?: any;
40
44
  };
41
45
  export type GitHttpResponse = {
42
46
  /**
@@ -79,4 +83,4 @@ declare namespace index {
79
83
  * @param {GitHttpRequest} request
80
84
  * @returns {Promise<GitHttpResponse>}
81
85
  */
82
- export function request({ onProgress, url, method, headers, agent, body, }: GitHttpRequest): Promise<GitHttpResponse>;
86
+ export function request({ onProgress, url, method, headers, agent, fetchOptions, body, }: GitHttpRequest): Promise<GitHttpResponse>;
@@ -36,6 +36,10 @@ export type GitHttpRequest = {
36
36
  * - Reserved for future use (canceling a request)
37
37
  */
38
38
  signal?: object;
39
+ /**
40
+ * - Additional options to pass to fetch (Web) or simple-get (Node)
41
+ */
42
+ fetchOptions?: any;
39
43
  };
40
44
  export type GitHttpResponse = {
41
45
  /**
@@ -78,4 +82,4 @@ declare namespace index {
78
82
  * @param {GitHttpRequest} request
79
83
  * @returns {Promise<GitHttpResponse>}
80
84
  */
81
- export function request({ onProgress, url, method, headers, agent, body, }: GitHttpRequest): Promise<GitHttpResponse>;
85
+ export function request({ onProgress, url, method, headers, agent, fetchOptions, body, }: GitHttpRequest): Promise<GitHttpResponse>;
@@ -22,6 +22,7 @@ import get from 'simple-get';
22
22
  * @property {AsyncIterableIterator<Uint8Array>} [body] - An async iterator of Uint8Arrays that make up the body of POST requests
23
23
  * @property {ProgressCallback} [onProgress] - Reserved for future use (emitting `GitProgressEvent`s)
24
24
  * @property {object} [signal] - Reserved for future use (canceling a request)
25
+ * @property {Object} [fetchOptions={}] - Additional options to pass to fetch (Web) or simple-get (Node)
25
26
  */
26
27
 
27
28
  /**
@@ -88,6 +89,7 @@ async function forAwait(iterable, cb) {
88
89
  }
89
90
 
90
91
  function asyncIteratorToStream(iter) {
92
+ // @ts-expect-error: readable-stream has PassThrough at runtime, types mismatch
91
93
  const { PassThrough } = require('readable-stream');
92
94
  const stream = new PassThrough();
93
95
  setTimeout(async () => {
@@ -188,10 +190,12 @@ async function request({
188
190
  method = 'GET',
189
191
  headers = {},
190
192
  agent,
193
+ fetchOptions = {},
191
194
  body,
192
195
  }) {
193
196
  // If we can, we should send it as a single buffer so it sets a Content-Length header.
194
197
  if (body && Array.isArray(body)) {
198
+ // @ts-expect-error
195
199
  body = Buffer.from(await collect(body));
196
200
  } else if (body) {
197
201
  body = asyncIteratorToStream(body);
@@ -199,6 +203,7 @@ async function request({
199
203
  return new Promise((resolve, reject) => {
200
204
  get(
201
205
  {
206
+ ...fetchOptions,
202
207
  url,
203
208
  method,
204
209
  headers,
@@ -24,6 +24,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
24
24
  * @property {AsyncIterableIterator<Uint8Array>} [body] - An async iterator of Uint8Arrays that make up the body of POST requests
25
25
  * @property {ProgressCallback} [onProgress] - Reserved for future use (emitting `GitProgressEvent`s)
26
26
  * @property {object} [signal] - Reserved for future use (canceling a request)
27
+ * @property {Object} [fetchOptions={}] - Additional options to pass to fetch (Web) or simple-get (Node)
27
28
  */
28
29
 
29
30
  /**
@@ -139,24 +140,29 @@ async function request({
139
140
  url,
140
141
  method = 'GET',
141
142
  headers = {},
143
+ fetchOptions = {},
142
144
  body,
143
145
  }) {
144
146
  // streaming uploads aren't possible yet in the browser
145
147
  if (body) {
148
+ // @ts-expect-error
146
149
  body = await collect(body);
147
150
  }
148
- const res = await fetch(url, { method, headers, body });
151
+ const res = await fetch(url, { ...fetchOptions, method, headers, body });
149
152
  const iter =
153
+ // @ts-expect-error
150
154
  res.body && res.body.getReader
151
155
  ? fromStream(res.body)
152
156
  : [new Uint8Array(await res.arrayBuffer())];
153
157
  // convert Header object to ordinary JSON
154
158
  headers = {};
159
+ // @ts-expect-error
155
160
  for (const [key, value] of res.headers.entries()) {
156
161
  headers[key] = value;
157
162
  }
158
163
  return {
159
164
  url: res.url,
165
+ // @ts-expect-error
160
166
  method: res.method,
161
167
  statusCode: res.status,
162
168
  statusMessage: res.statusText,
@@ -37,6 +37,10 @@ export type GitHttpRequest = {
37
37
  * - Reserved for future use (canceling a request)
38
38
  */
39
39
  signal?: object;
40
+ /**
41
+ * - Additional options to pass to fetch (Web) or simple-get (Node)
42
+ */
43
+ fetchOptions?: any;
40
44
  };
41
45
  export type GitHttpResponse = {
42
46
  /**
@@ -79,4 +83,4 @@ declare namespace index {
79
83
  * @param {GitHttpRequest} request
80
84
  * @returns {Promise<GitHttpResponse>}
81
85
  */
82
- export function request({ onProgress, url, method, headers, body, }: GitHttpRequest): Promise<GitHttpResponse>;
86
+ export function request({ onProgress, url, method, headers, fetchOptions, body, }: GitHttpRequest): Promise<GitHttpResponse>;
@@ -36,6 +36,10 @@ export type GitHttpRequest = {
36
36
  * - Reserved for future use (canceling a request)
37
37
  */
38
38
  signal?: object;
39
+ /**
40
+ * - Additional options to pass to fetch (Web) or simple-get (Node)
41
+ */
42
+ fetchOptions?: any;
39
43
  };
40
44
  export type GitHttpResponse = {
41
45
  /**
@@ -78,4 +82,4 @@ declare namespace index {
78
82
  * @param {GitHttpRequest} request
79
83
  * @returns {Promise<GitHttpResponse>}
80
84
  */
81
- export function request({ onProgress, url, method, headers, body, }: GitHttpRequest): Promise<GitHttpResponse>;
85
+ export function request({ onProgress, url, method, headers, fetchOptions, body, }: GitHttpRequest): Promise<GitHttpResponse>;
package/http/web/index.js CHANGED
@@ -20,6 +20,7 @@
20
20
  * @property {AsyncIterableIterator<Uint8Array>} [body] - An async iterator of Uint8Arrays that make up the body of POST requests
21
21
  * @property {ProgressCallback} [onProgress] - Reserved for future use (emitting `GitProgressEvent`s)
22
22
  * @property {object} [signal] - Reserved for future use (canceling a request)
23
+ * @property {Object} [fetchOptions={}] - Additional options to pass to fetch (Web) or simple-get (Node)
23
24
  */
24
25
 
25
26
  /**
@@ -135,24 +136,29 @@ async function request({
135
136
  url,
136
137
  method = 'GET',
137
138
  headers = {},
139
+ fetchOptions = {},
138
140
  body,
139
141
  }) {
140
142
  // streaming uploads aren't possible yet in the browser
141
143
  if (body) {
144
+ // @ts-expect-error
142
145
  body = await collect(body);
143
146
  }
144
- const res = await fetch(url, { method, headers, body });
147
+ const res = await fetch(url, { ...fetchOptions, method, headers, body });
145
148
  const iter =
149
+ // @ts-expect-error
146
150
  res.body && res.body.getReader
147
151
  ? fromStream(res.body)
148
152
  : [new Uint8Array(await res.arrayBuffer())];
149
153
  // convert Header object to ordinary JSON
150
154
  headers = {};
155
+ // @ts-expect-error
151
156
  for (const [key, value] of res.headers.entries()) {
152
157
  headers[key] = value;
153
158
  }
154
159
  return {
155
160
  url: res.url,
161
+ // @ts-expect-error
156
162
  method: res.method,
157
163
  statusCode: res.status,
158
164
  statusMessage: res.statusText,
@@ -26,6 +26,7 @@
26
26
  * @property {AsyncIterableIterator<Uint8Array>} [body] - An async iterator of Uint8Arrays that make up the body of POST requests
27
27
  * @property {ProgressCallback} [onProgress] - Reserved for future use (emitting `GitProgressEvent`s)
28
28
  * @property {object} [signal] - Reserved for future use (canceling a request)
29
+ * @property {Object} [fetchOptions={}] - Additional options to pass to fetch (Web) or simple-get (Node)
29
30
  */
30
31
 
31
32
  /**
@@ -141,24 +142,29 @@
141
142
  url,
142
143
  method = 'GET',
143
144
  headers = {},
145
+ fetchOptions = {},
144
146
  body,
145
147
  }) {
146
148
  // streaming uploads aren't possible yet in the browser
147
149
  if (body) {
150
+ // @ts-expect-error
148
151
  body = await collect(body);
149
152
  }
150
- const res = await fetch(url, { method, headers, body });
153
+ const res = await fetch(url, { ...fetchOptions, method, headers, body });
151
154
  const iter =
155
+ // @ts-expect-error
152
156
  res.body && res.body.getReader
153
157
  ? fromStream(res.body)
154
158
  : [new Uint8Array(await res.arrayBuffer())];
155
159
  // convert Header object to ordinary JSON
156
160
  headers = {};
161
+ // @ts-expect-error
157
162
  for (const [key, value] of res.headers.entries()) {
158
163
  headers[key] = value;
159
164
  }
160
165
  return {
161
166
  url: res.url,
167
+ // @ts-expect-error
162
168
  method: res.method,
163
169
  statusCode: res.status,
164
170
  statusMessage: res.statusText,
package/index.cjs CHANGED
@@ -36,6 +36,7 @@ var diff3Merge = _interopDefault(require('diff3'));
36
36
  * @property {AsyncIterableIterator<Uint8Array>} [body] - An async iterator of Uint8Arrays that make up the body of POST requests
37
37
  * @property {ProgressCallback} [onProgress] - Reserved for future use (emitting `GitProgressEvent`s)
38
38
  * @property {object} [signal] - Reserved for future use (canceling a request)
39
+ * @property {Object} [fetchOptions={}] - Additional options to pass to fetch (Web) or simple-get (Node)
39
40
  */
40
41
 
41
42
  /**
@@ -9629,8 +9630,8 @@ function filterCapabilities(server, client) {
9629
9630
 
9630
9631
  const pkg = {
9631
9632
  name: 'isomorphic-git',
9632
- version: '1.40.8',
9633
- agent: 'git/isomorphic-git@1.40.8',
9633
+ version: '1.41.0',
9634
+ agent: 'git/isomorphic-git@1.41.0',
9634
9635
  };
9635
9636
 
9636
9637
  class FIFO {
package/index.d.cts CHANGED
@@ -305,6 +305,10 @@ export type GitHttpRequest = {
305
305
  * - Reserved for future use (canceling a request)
306
306
  */
307
307
  signal?: object;
308
+ /**
309
+ * - Additional options to pass to fetch (Web) or simple-get (Node)
310
+ */
311
+ fetchOptions?: any;
308
312
  };
309
313
  export type GitHttpResponse = {
310
314
  /**
@@ -4501,6 +4505,7 @@ declare namespace NoCommitError {
4501
4505
  * @property {AsyncIterableIterator<Uint8Array>} [body] - An async iterator of Uint8Arrays that make up the body of POST requests
4502
4506
  * @property {ProgressCallback} [onProgress] - Reserved for future use (emitting `GitProgressEvent`s)
4503
4507
  * @property {object} [signal] - Reserved for future use (canceling a request)
4508
+ * @property {Object} [fetchOptions={}] - Additional options to pass to fetch (Web) or simple-get (Node)
4504
4509
  */
4505
4510
  /**
4506
4511
  * @typedef {Object} GitHttpResponse
package/index.d.ts CHANGED
@@ -304,6 +304,10 @@ export type GitHttpRequest = {
304
304
  * - Reserved for future use (canceling a request)
305
305
  */
306
306
  signal?: object;
307
+ /**
308
+ * - Additional options to pass to fetch (Web) or simple-get (Node)
309
+ */
310
+ fetchOptions?: any;
307
311
  };
308
312
  export type GitHttpResponse = {
309
313
  /**
@@ -4500,6 +4504,7 @@ declare namespace NoCommitError {
4500
4504
  * @property {AsyncIterableIterator<Uint8Array>} [body] - An async iterator of Uint8Arrays that make up the body of POST requests
4501
4505
  * @property {ProgressCallback} [onProgress] - Reserved for future use (emitting `GitProgressEvent`s)
4502
4506
  * @property {object} [signal] - Reserved for future use (canceling a request)
4507
+ * @property {Object} [fetchOptions={}] - Additional options to pass to fetch (Web) or simple-get (Node)
4503
4508
  */
4504
4509
  /**
4505
4510
  * @typedef {Object} GitHttpResponse
package/index.js CHANGED
@@ -29,6 +29,7 @@ import diff3Merge from 'diff3';
29
29
  * @property {AsyncIterableIterator<Uint8Array>} [body] - An async iterator of Uint8Arrays that make up the body of POST requests
30
30
  * @property {ProgressCallback} [onProgress] - Reserved for future use (emitting `GitProgressEvent`s)
31
31
  * @property {object} [signal] - Reserved for future use (canceling a request)
32
+ * @property {Object} [fetchOptions={}] - Additional options to pass to fetch (Web) or simple-get (Node)
32
33
  */
33
34
 
34
35
  /**
@@ -9616,8 +9617,8 @@ function filterCapabilities(server, client) {
9616
9617
 
9617
9618
  const pkg = {
9618
9619
  name: 'isomorphic-git',
9619
- version: '1.40.8',
9620
- agent: 'git/isomorphic-git@1.40.8',
9620
+ version: '1.41.0',
9621
+ agent: 'git/isomorphic-git@1.41.0',
9621
9622
  };
9622
9623
 
9623
9624
  class FIFO {
@@ -304,6 +304,10 @@ export type GitHttpRequest = {
304
304
  * - Reserved for future use (canceling a request)
305
305
  */
306
306
  signal?: object;
307
+ /**
308
+ * - Additional options to pass to fetch (Web) or simple-get (Node)
309
+ */
310
+ fetchOptions?: any;
307
311
  };
308
312
  export type GitHttpResponse = {
309
313
  /**
@@ -4500,6 +4504,7 @@ declare namespace NoCommitError {
4500
4504
  * @property {AsyncIterableIterator<Uint8Array>} [body] - An async iterator of Uint8Arrays that make up the body of POST requests
4501
4505
  * @property {ProgressCallback} [onProgress] - Reserved for future use (emitting `GitProgressEvent`s)
4502
4506
  * @property {object} [signal] - Reserved for future use (canceling a request)
4507
+ * @property {Object} [fetchOptions={}] - Additional options to pass to fetch (Web) or simple-get (Node)
4503
4508
  */
4504
4509
  /**
4505
4510
  * @typedef {Object} GitHttpResponse