@canopy-io/node 0.24.1 → 0.25.1
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/CHANGELOG.md +17 -0
- package/dist/index.cjs +9 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2667 -806
- package/dist/index.d.ts +2667 -806
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -109,6 +109,7 @@ var DEFAULT_TIMEOUT_MS = 3e4;
|
|
|
109
109
|
var DEFAULT_MAX_RETRIES = 2;
|
|
110
110
|
var DEFAULT_MAX_BACKOFF_MS = 3e4;
|
|
111
111
|
var IDEMPOTENT_METHODS = /* @__PURE__ */ new Set(["GET", "HEAD", "PUT", "DELETE"]);
|
|
112
|
+
var IDEMPOTENCY_IN_PROGRESS = "idempotency.request_in_progress";
|
|
112
113
|
var NOT_MODIFIED = 304;
|
|
113
114
|
var CanopyClient = class {
|
|
114
115
|
baseUrl;
|
|
@@ -214,6 +215,14 @@ var CanopyClient = class {
|
|
|
214
215
|
lastError = await this.toError(response, upper, path);
|
|
215
216
|
continue;
|
|
216
217
|
}
|
|
218
|
+
if (response.status === 409 && retryable && attempt < maxRetries) {
|
|
219
|
+
const conflict = await this.toError(response, upper, path);
|
|
220
|
+
if (conflict.code !== IDEMPOTENCY_IN_PROGRESS) {
|
|
221
|
+
throw conflict;
|
|
222
|
+
}
|
|
223
|
+
lastError = conflict;
|
|
224
|
+
continue;
|
|
225
|
+
}
|
|
217
226
|
if (!accept(response.status)) {
|
|
218
227
|
throw await this.toError(response, upper, path);
|
|
219
228
|
}
|