@gitbeaker/rest 38.3.0 → 38.4.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.
package/README.md CHANGED
@@ -400,6 +400,7 @@ projectsAPI.create({
400
400
  <td align="center" valign="top" width="3.84%"><a href="https://github.com/claudio-vellage"><img src="https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/28930612?v=4&h=25&w=25&fit=cover&mask=circle&maxage=7d" alt="Claudio Vellage"/></td>
401
401
  <td align="center" valign="top" width="3.84%"><a href="https://github.com/seb0uil"><img src="https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/5122626?v=4&h=25&w=25&fit=cover&mask=circle&maxage=7d" alt="Seb0uil"/></td>
402
402
  <td align="center" valign="top" width="3.84%"><a href="http://merorafael.info/"><img src="https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/3404989?v=4&h=25&w=25&fit=cover&mask=circle&maxage=7d" alt="Rafael Mello"/></td>
403
+ <td align="center" valign="top" width="3.84%"><a href="https://github.com/tbazin"><img src="https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/9104039?v=4&h=25&w=25&fit=cover&mask=circle&maxage=7d" alt="Théis Bazin"/></td>
403
404
  </tr>
404
405
  </p>
405
406
 
package/dist/index.js CHANGED
@@ -50,7 +50,7 @@ async function processBody(response) {
50
50
  if (contentType.startsWith("text/")) {
51
51
  return response.text().then((t) => t || "");
52
52
  }
53
- return response.arrayBuffer();
53
+ return response.blob();
54
54
  }
55
55
  function delay(ms) {
56
56
  return new Promise((resolve) => {
@@ -85,17 +85,23 @@ async function throwFailedRequestError(response) {
85
85
  }
86
86
  });
87
87
  }
88
+ function getConditionalMode(endpoint) {
89
+ if (endpoint.includes("repository/archive"))
90
+ return "same-origin";
91
+ return void 0;
92
+ }
88
93
  async function defaultRequestHandler(endpoint, options) {
89
94
  const retryCodes = [429, 502];
90
95
  const maxRetries = 10;
91
- const { prefixUrl, asStream, searchParams, ...opts } = options;
96
+ const { prefixUrl, asStream, searchParams, ...opts } = options || {};
92
97
  let baseUrl;
93
98
  if (prefixUrl)
94
99
  baseUrl = prefixUrl.endsWith("/") ? prefixUrl : `${prefixUrl}/`;
95
100
  const url = new URL(endpoint, baseUrl);
96
101
  url.search = searchParams || "";
102
+ const mode = getConditionalMode(endpoint);
97
103
  for (let i = 0; i < maxRetries; i += 1) {
98
- const response = await fetch(url, { ...opts, mode: "cors" });
104
+ const response = await fetch(url, { ...opts, mode });
99
105
  if (response.ok)
100
106
  return parseResponse(response, asStream);
101
107
  if (!retryCodes.includes(response.status))
package/dist/index.mjs CHANGED
@@ -28,7 +28,7 @@ async function processBody(response) {
28
28
  if (contentType.startsWith("text/")) {
29
29
  return response.text().then((t) => t || "");
30
30
  }
31
- return response.arrayBuffer();
31
+ return response.blob();
32
32
  }
33
33
  function delay(ms) {
34
34
  return new Promise((resolve) => {
@@ -63,17 +63,23 @@ async function throwFailedRequestError(response) {
63
63
  }
64
64
  });
65
65
  }
66
+ function getConditionalMode(endpoint) {
67
+ if (endpoint.includes("repository/archive"))
68
+ return "same-origin";
69
+ return void 0;
70
+ }
66
71
  async function defaultRequestHandler(endpoint, options) {
67
72
  const retryCodes = [429, 502];
68
73
  const maxRetries = 10;
69
- const { prefixUrl, asStream, searchParams, ...opts } = options;
74
+ const { prefixUrl, asStream, searchParams, ...opts } = options || {};
70
75
  let baseUrl;
71
76
  if (prefixUrl)
72
77
  baseUrl = prefixUrl.endsWith("/") ? prefixUrl : `${prefixUrl}/`;
73
78
  const url = new URL(endpoint, baseUrl);
74
79
  url.search = searchParams || "";
80
+ const mode = getConditionalMode(endpoint);
75
81
  for (let i = 0; i < maxRetries; i += 1) {
76
- const response = await fetch(url, { ...opts, mode: "cors" });
82
+ const response = await fetch(url, { ...opts, mode });
77
83
  if (response.ok)
78
84
  return parseResponse(response, asStream);
79
85
  if (!retryCodes.includes(response.status))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitbeaker/rest",
3
- "version": "38.3.0",
3
+ "version": "38.4.0",
4
4
  "description": "Cross Platform implementation of the GitLab API",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -56,8 +56,8 @@
56
56
  "release": "auto shipit"
57
57
  },
58
58
  "dependencies": {
59
- "@gitbeaker/core": "^38.3.0",
60
- "@gitbeaker/requester-utils": "^38.3.0"
59
+ "@gitbeaker/core": "^38.4.0",
60
+ "@gitbeaker/requester-utils": "^38.4.0"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@playwright/test": "^1.33.0",
@@ -66,5 +66,5 @@
66
66
  "tsup": "^6.7.0",
67
67
  "typescript": "^5.0.4"
68
68
  },
69
- "gitHead": "81fb16c89d0909431c828a219dae199458ea0b3f"
69
+ "gitHead": "83fb26bce5f4cc9c07ad75dda64f1e3e7fbf2e47"
70
70
  }