axiam-sdk 1.1.3 → 1.2.2

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.
Files changed (50) hide show
  1. package/README.md +73 -3
  2. package/dist/amqp/index.js.map +1 -1
  3. package/dist/amqp/index.mjs.map +1 -1
  4. package/dist/browser/index.d.cts +1 -1
  5. package/dist/browser/index.d.ts +1 -1
  6. package/dist/{client-BGFn1VQh.d.cts → client-Bp7riC4k.d.cts} +147 -3
  7. package/dist/{client-DrQZZ1js.d.ts → client-CaurIxje.d.ts} +147 -3
  8. package/dist/{cookieJar-BTmpjXZe.d.ts → cookieJar-DC4GLKrJ.d.ts} +2 -2
  9. package/dist/{cookieJar-BqYOnNN-.d.cts → cookieJar-oKazfbN1.d.cts} +2 -2
  10. package/dist/{errors-DZ3k8a8i.d.cts → errors-CWlh-wcm.d.cts} +7 -1
  11. package/dist/{errors-DZ3k8a8i.d.ts → errors-CWlh-wcm.d.ts} +7 -1
  12. package/dist/{errors-dlGXAsbh.d.ts → errors-DDo3oxcH.d.ts} +1 -1
  13. package/dist/{errors-RvGlTyUj.d.cts → errors-DHauOsqx.d.cts} +1 -1
  14. package/dist/grpc/index.d.cts +4 -4
  15. package/dist/grpc/index.d.ts +4 -4
  16. package/dist/grpc/index.js +26 -5
  17. package/dist/grpc/index.js.map +1 -1
  18. package/dist/grpc/index.mjs +26 -5
  19. package/dist/grpc/index.mjs.map +1 -1
  20. package/dist/index.d.cts +4 -4
  21. package/dist/index.d.ts +4 -4
  22. package/dist/index.js +26 -5
  23. package/dist/index.js.map +1 -1
  24. package/dist/index.mjs +26 -5
  25. package/dist/index.mjs.map +1 -1
  26. package/dist/middleware/index.d.cts +5 -5
  27. package/dist/middleware/index.d.ts +5 -5
  28. package/dist/middleware/index.js +164 -12
  29. package/dist/middleware/index.js.map +1 -1
  30. package/dist/middleware/index.mjs +164 -12
  31. package/dist/middleware/index.mjs.map +1 -1
  32. package/dist/nestjs/index.js.map +1 -1
  33. package/dist/nestjs/index.mjs.map +1 -1
  34. package/dist/node/index.d.cts +15 -4
  35. package/dist/node/index.d.ts +15 -4
  36. package/dist/node/index.js +186 -14
  37. package/dist/node/index.js.map +1 -1
  38. package/dist/node/index.mjs +185 -15
  39. package/dist/node/index.mjs.map +1 -1
  40. package/dist/{oidcState-C3VLn3eD.d.ts → oidcState-CZhj0MBP.d.ts} +123 -5
  41. package/dist/{oidcState-BaJ-SM_R.d.cts → oidcState-EnEJmoF5.d.cts} +123 -5
  42. package/dist/rest/index.d.cts +6 -6
  43. package/dist/rest/index.d.ts +6 -6
  44. package/dist/rest/index.js +26 -5
  45. package/dist/rest/index.js.map +1 -1
  46. package/dist/rest/index.mjs +26 -5
  47. package/dist/rest/index.mjs.map +1 -1
  48. package/dist/{session-B03NsqVs.d.ts → session-Beo11VT_.d.ts} +9 -0
  49. package/dist/{session-plDr4lFu.d.cts → session-CeIUXgpE.d.cts} +9 -0
  50. package/package.json +1 -1
@@ -41,11 +41,18 @@ var OAuthProtocolError = class _OAuthProtocolError extends AuthError {
41
41
  * OPTIONAL, and §2 (contract 1.53, §28.12.3) dispatches on `error` alone.
42
42
  */
43
43
  errorDescription;
44
- constructor(error, errorDescription = "") {
44
+ /**
45
+ * The server's `Retry-After` in milliseconds, when this error is a `429` that carried one in
46
+ * delta-seconds form (contract 1.65 §37.3, C165-17). Absent otherwise; an HTTP-date is not read.
47
+ * Additive: honour it before retrying a rate-limited native sign-in or CIBA call.
48
+ */
49
+ retryAfterMs;
50
+ constructor(error, errorDescription = "", retryAfterMs2) {
45
51
  super(errorDescription ? `${error}: ${errorDescription}` : error);
46
52
  this.name = "OAuthProtocolError";
47
53
  this.error = error;
48
54
  this.errorDescription = errorDescription;
55
+ if (retryAfterMs2 !== void 0) this.retryAfterMs = retryAfterMs2;
49
56
  Object.setPrototypeOf(this, _OAuthProtocolError.prototype);
50
57
  }
51
58
  };
@@ -106,7 +113,7 @@ function isOAuth2ErrorBody(body) {
106
113
  const record = body;
107
114
  return typeof record.error === "string" && typeof record.error_description === "string";
108
115
  }
109
- function oauth2ErrorFromBody(body) {
116
+ function oauth2ErrorFromBody(body, retryAfterMs2) {
110
117
  if (body === null || typeof body !== "object" || Array.isArray(body)) {
111
118
  return void 0;
112
119
  }
@@ -115,7 +122,7 @@ function oauth2ErrorFromBody(body) {
115
122
  return void 0;
116
123
  }
117
124
  const description = typeof record.error_description === "string" ? record.error_description : "";
118
- return new OAuthProtocolError(record.error, description);
125
+ return new OAuthProtocolError(record.error, description, retryAfterMs2);
119
126
  }
120
127
  var SAFE_RESPONSE_HEADERS = /* @__PURE__ */ new Set([
121
128
  "content-type",
@@ -680,12 +687,21 @@ var SharedSession = class {
680
687
  * The fetch adapter derives its `credentials` from `withCredentials: false`
681
688
  * (`'omit'`); `fetchOptions.credentials` is set as well for adapters that
682
689
  * read it.
690
+ *
691
+ * `fetchOptions.redirect: 'error'` is the browser persona's half of CONTRACT.md §12.1
692
+ * rule 3 ("No redirect is followed", C165-26). On the main client's `/oauth2/*` requests
693
+ * it makes `fetch` reject, which every caller maps to a `NetworkError` that carries
694
+ * neither the `Location` nor the request. Where `maxRedirects: 0` is set (the bare
695
+ * transport, `bareRequest`), axios's fetch adapter substitutes `redirect: 'manual'`
696
+ * (`lib/adapters/fetch.js`), so `'error'` is overridden there: the browser hands back an
697
+ * opaque-redirect (status 0), and `bareRequest` maps status 0 or any `3xx` to a
698
+ * `NetworkError` without the `Location` (`bareTransport.ts`).
683
699
  * `NodeSession` overrides this to {@link noCredentialsConfig}: its jar-free
684
700
  * agent pair is what keeps the cookies off there, and the fetch adapter
685
701
  * would bypass that pair.
686
702
  */
687
703
  oauth2RequestConfig() {
688
- return { ...this.noCredentialsConfig(), adapter: "fetch", fetchOptions: { credentials: "omit" } };
704
+ return { ...this.noCredentialsConfig(), adapter: "fetch", fetchOptions: { credentials: "omit", redirect: "error" } };
689
705
  }
690
706
  };
691
707
  function resolveTenantHeaderValue(options) {
@@ -1911,12 +1927,17 @@ async function bareRequest(session, operation, config) {
1911
1927
  maxRedirects: 0,
1912
1928
  validateStatus: () => true
1913
1929
  });
1930
+ let response;
1914
1931
  try {
1915
- return await instance.request(config);
1932
+ response = await instance.request(config);
1916
1933
  } catch (err) {
1917
1934
  const code = err && typeof err === "object" && "code" in err && typeof err.code === "string" ? ` (${err.code})` : "";
1918
1935
  throw new NetworkError(`${operation}: the request failed before any response arrived${code}`);
1919
1936
  }
1937
+ if (response.status === 0 || response.status >= 300 && response.status < 400) {
1938
+ throw new NetworkError(`${operation}: the server answered with a redirect, which is not followed`);
1939
+ }
1940
+ return response;
1920
1941
  }
1921
1942
  function retryAfterMs(response) {
1922
1943
  const raw = response.headers?.["retry-after"];