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
@@ -59,11 +59,18 @@ var OAuthProtocolError = class _OAuthProtocolError extends AuthError {
59
59
  * OPTIONAL, and §2 (contract 1.53, §28.12.3) dispatches on `error` alone.
60
60
  */
61
61
  errorDescription;
62
- constructor(error, errorDescription = "") {
62
+ /**
63
+ * The server's `Retry-After` in milliseconds, when this error is a `429` that carried one in
64
+ * delta-seconds form (contract 1.65 §37.3, C165-17). Absent otherwise; an HTTP-date is not read.
65
+ * Additive: honour it before retrying a rate-limited native sign-in or CIBA call.
66
+ */
67
+ retryAfterMs;
68
+ constructor(error, errorDescription = "", retryAfterMs2) {
63
69
  super(errorDescription ? `${error}: ${errorDescription}` : error);
64
70
  this.name = "OAuthProtocolError";
65
71
  this.error = error;
66
72
  this.errorDescription = errorDescription;
73
+ if (retryAfterMs2 !== void 0) this.retryAfterMs = retryAfterMs2;
67
74
  Object.setPrototypeOf(this, _OAuthProtocolError.prototype);
68
75
  }
69
76
  };
@@ -128,7 +135,7 @@ function isOAuth2ErrorBody(body) {
128
135
  const record = body;
129
136
  return typeof record.error === "string" && typeof record.error_description === "string";
130
137
  }
131
- function oauth2ErrorFromBody(body) {
138
+ function oauth2ErrorFromBody(body, retryAfterMs2) {
132
139
  if (body === null || typeof body !== "object" || Array.isArray(body)) {
133
140
  return void 0;
134
141
  }
@@ -137,7 +144,7 @@ function oauth2ErrorFromBody(body) {
137
144
  return void 0;
138
145
  }
139
146
  const description = typeof record.error_description === "string" ? record.error_description : "";
140
- return new OAuthProtocolError(record.error, description);
147
+ return new OAuthProtocolError(record.error, description, retryAfterMs2);
141
148
  }
142
149
  var SAFE_RESPONSE_HEADERS = /* @__PURE__ */ new Set([
143
150
  "content-type",
@@ -1084,12 +1091,21 @@ var SharedSession = class {
1084
1091
  * The fetch adapter derives its `credentials` from `withCredentials: false`
1085
1092
  * (`'omit'`); `fetchOptions.credentials` is set as well for adapters that
1086
1093
  * read it.
1094
+ *
1095
+ * `fetchOptions.redirect: 'error'` is the browser persona's half of CONTRACT.md §12.1
1096
+ * rule 3 ("No redirect is followed", C165-26). On the main client's `/oauth2/*` requests
1097
+ * it makes `fetch` reject, which every caller maps to a `NetworkError` that carries
1098
+ * neither the `Location` nor the request. Where `maxRedirects: 0` is set (the bare
1099
+ * transport, `bareRequest`), axios's fetch adapter substitutes `redirect: 'manual'`
1100
+ * (`lib/adapters/fetch.js`), so `'error'` is overridden there: the browser hands back an
1101
+ * opaque-redirect (status 0), and `bareRequest` maps status 0 or any `3xx` to a
1102
+ * `NetworkError` without the `Location` (`bareTransport.ts`).
1087
1103
  * `NodeSession` overrides this to {@link noCredentialsConfig}: its jar-free
1088
1104
  * agent pair is what keeps the cookies off there, and the fetch adapter
1089
1105
  * would bypass that pair.
1090
1106
  */
1091
1107
  oauth2RequestConfig() {
1092
- return { ...this.noCredentialsConfig(), adapter: "fetch", fetchOptions: { credentials: "omit" } };
1108
+ return { ...this.noCredentialsConfig(), adapter: "fetch", fetchOptions: { credentials: "omit", redirect: "error" } };
1093
1109
  }
1094
1110
  };
1095
1111
  function resolveTenantHeaderValue(options) {
@@ -2323,12 +2339,17 @@ async function bareRequest(session, operation, config) {
2323
2339
  maxRedirects: 0,
2324
2340
  validateStatus: () => true
2325
2341
  });
2342
+ let response;
2326
2343
  try {
2327
- return await instance.request(config);
2344
+ response = await instance.request(config);
2328
2345
  } catch (err) {
2329
2346
  const code = err && typeof err === "object" && "code" in err && typeof err.code === "string" ? ` (${err.code})` : "";
2330
2347
  throw new NetworkError(`${operation}: the request failed before any response arrived${code}`);
2331
2348
  }
2349
+ if (response.status === 0 || response.status >= 300 && response.status < 400) {
2350
+ throw new NetworkError(`${operation}: the server answered with a redirect, which is not followed`);
2351
+ }
2352
+ return response;
2332
2353
  }
2333
2354
  function retryAfterMs(response) {
2334
2355
  const raw = response.headers?.["retry-after"];