@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 CHANGED
@@ -1,5 +1,22 @@
1
1
  # @canopy-io/node
2
2
 
3
+ ## 0.25.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 9ac3465: Follows Canopy's release that makes a retried write safe across the public API's `POST` routes. The generated types add the `Idempotency-Key` header to every operation that honours it (33, up from a handful), with the `409`, `422` and `503` answers it brings. The agent skill says which writes honour the key, that a key names one request (body, `If-Match` and Environment), and that a key cannot retry its own rotation. No caller changes are needed.
8
+
9
+ ## 0.25.0
10
+
11
+ ### Minor Changes
12
+
13
+ - a7d473f: Follows Canopy's hosted page languages and safe retries release.
14
+
15
+ - `@canopy-io/node`: the generated types add `locale` to identities and invitations, `default_language` and `available_languages` to the sign-in settings, the branding `languages`, `default_language`, `page_template` and `page_template_sources`, and the `409` and `503` `Idempotency-Key` answers. A call declared `idempotent` is now also retried on `409 idempotency.request_in_progress`, the answer Canopy gives while an earlier attempt with the same `Idempotency-Key` is still running; `idempotency.outcome_unknown` is never retried.
16
+ - `@canopy-io/browser`: `signIn({ uiLocales })` names the language the hosted pages are shown in, sent as `ui_locales`.
17
+
18
+ The agent skill says how an application names the hosted pages' language, and how to make a create safe to retry with an `Idempotency-Key`.
19
+
3
20
  ## 0.24.1
4
21
 
5
22
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -111,6 +111,7 @@ var DEFAULT_TIMEOUT_MS = 3e4;
111
111
  var DEFAULT_MAX_RETRIES = 2;
112
112
  var DEFAULT_MAX_BACKOFF_MS = 3e4;
113
113
  var IDEMPOTENT_METHODS = /* @__PURE__ */ new Set(["GET", "HEAD", "PUT", "DELETE"]);
114
+ var IDEMPOTENCY_IN_PROGRESS = "idempotency.request_in_progress";
114
115
  var NOT_MODIFIED = 304;
115
116
  var CanopyClient = class {
116
117
  baseUrl;
@@ -216,6 +217,14 @@ var CanopyClient = class {
216
217
  lastError = await this.toError(response, upper, path);
217
218
  continue;
218
219
  }
220
+ if (response.status === 409 && retryable && attempt < maxRetries) {
221
+ const conflict = await this.toError(response, upper, path);
222
+ if (conflict.code !== IDEMPOTENCY_IN_PROGRESS) {
223
+ throw conflict;
224
+ }
225
+ lastError = conflict;
226
+ continue;
227
+ }
219
228
  if (!accept(response.status)) {
220
229
  throw await this.toError(response, upper, path);
221
230
  }