axiam-sdk 1.1.1 → 1.1.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 (42) hide show
  1. package/README.md +20 -4
  2. package/dist/browser/index.d.cts +1 -1
  3. package/dist/browser/index.d.ts +1 -1
  4. package/dist/{client-D34sXV8p.d.cts → client-BGFn1VQh.d.cts} +7 -1
  5. package/dist/{client-BMNQi36J.d.ts → client-DrQZZ1js.d.ts} +7 -1
  6. package/dist/{cookieJar-DcrMe93Q.d.ts → cookieJar-BTmpjXZe.d.ts} +8 -2
  7. package/dist/{cookieJar-C_xPuniu.d.cts → cookieJar-BqYOnNN-.d.cts} +8 -2
  8. package/dist/grpc/index.d.cts +4 -4
  9. package/dist/grpc/index.d.ts +4 -4
  10. package/dist/grpc/index.js +32 -2
  11. package/dist/grpc/index.js.map +1 -1
  12. package/dist/grpc/index.mjs +32 -2
  13. package/dist/grpc/index.mjs.map +1 -1
  14. package/dist/index.d.cts +2 -2
  15. package/dist/index.d.ts +2 -2
  16. package/dist/index.js +24 -2
  17. package/dist/index.js.map +1 -1
  18. package/dist/index.mjs +24 -2
  19. package/dist/index.mjs.map +1 -1
  20. package/dist/middleware/index.d.cts +3 -3
  21. package/dist/middleware/index.d.ts +3 -3
  22. package/dist/middleware/index.js +149 -22
  23. package/dist/middleware/index.js.map +1 -1
  24. package/dist/middleware/index.mjs +149 -22
  25. package/dist/middleware/index.mjs.map +1 -1
  26. package/dist/node/index.d.cts +3 -3
  27. package/dist/node/index.d.ts +3 -3
  28. package/dist/node/index.js +178 -23
  29. package/dist/node/index.js.map +1 -1
  30. package/dist/node/index.mjs +178 -23
  31. package/dist/node/index.mjs.map +1 -1
  32. package/dist/{oidcState-BFIHt7_Y.d.cts → oidcState-BaJ-SM_R.d.cts} +37 -6
  33. package/dist/{oidcState-qoy2vsYG.d.ts → oidcState-C3VLn3eD.d.ts} +37 -6
  34. package/dist/rest/index.d.cts +3 -3
  35. package/dist/rest/index.d.ts +3 -3
  36. package/dist/rest/index.js +24 -2
  37. package/dist/rest/index.js.map +1 -1
  38. package/dist/rest/index.mjs +24 -2
  39. package/dist/rest/index.mjs.map +1 -1
  40. package/dist/{session-BbPFTpMZ.d.ts → session-B03NsqVs.d.ts} +16 -0
  41. package/dist/{session-C9WlP6DV.d.cts → session-plDr4lFu.d.cts} +16 -0
  42. package/package.json +1 -1
@@ -1073,6 +1073,24 @@ var SharedSession = class {
1073
1073
  noCredentialsConfig() {
1074
1074
  return { withCredentials: false };
1075
1075
  }
1076
+ /**
1077
+ * Axios config for a request to an `/oauth2/*` endpoint (CONTRACT.md §12.1
1078
+ * rule 3, §14.6; C163-12): {@link noCredentialsConfig} and, in the browser
1079
+ * persona, the fetch adapter with `credentials: 'omit'`.
1080
+ *
1081
+ * `withCredentials: false` on axios's default XHR adapter is not enough: that
1082
+ * adapter sends a same-origin cookie regardless, so an app served from the
1083
+ * AXIAM origin would still present `axiam_*` on a token or device request.
1084
+ * The fetch adapter derives its `credentials` from `withCredentials: false`
1085
+ * (`'omit'`); `fetchOptions.credentials` is set as well for adapters that
1086
+ * read it.
1087
+ * `NodeSession` overrides this to {@link noCredentialsConfig}: its jar-free
1088
+ * agent pair is what keeps the cookies off there, and the fetch adapter
1089
+ * would bypass that pair.
1090
+ */
1091
+ oauth2RequestConfig() {
1092
+ return { ...this.noCredentialsConfig(), adapter: "fetch", fetchOptions: { credentials: "omit" } };
1093
+ }
1076
1094
  };
1077
1095
  function resolveTenantHeaderValue(options) {
1078
1096
  if (options.tenantSlug) {
@@ -1273,7 +1291,7 @@ function installDeviceTokenInterceptor(axiosInstance, session) {
1273
1291
  if (session.isForeignHost(config.url) || deviceToken === void 0 && !oauth2) {
1274
1292
  return config;
1275
1293
  }
1276
- const noCred = session.noCredentialsConfig();
1294
+ const noCred = oauth2 ? session.oauth2RequestConfig() : session.noCredentialsConfig();
1277
1295
  Object.assign(config, noCred);
1278
1296
  config.headers = config.headers ?? {};
1279
1297
  if (oauth2) {
@@ -1767,6 +1785,7 @@ async function withRetry(fn, options) {
1767
1785
  }
1768
1786
  const retryAfterMs2 = isRetryAfterCarrier(err) ? err.retryAfterMs : void 0;
1769
1787
  const delay = delayMs(attempt, retryAfterMs2, random());
1788
+ options.admit?.(delay);
1770
1789
  options.telemetry?.emit({
1771
1790
  type: "retry",
1772
1791
  operation: options.operation ?? "unknown",
@@ -2296,7 +2315,10 @@ async function bareRequest(session, operation, config) {
2296
2315
  // jar). Under the Node persona this is the jar-wrapped cookie agent, which
2297
2316
  // `noCredentialsConfig()` below replaces with a plain one.
2298
2317
  ...defaults.httpsAgent !== void 0 ? { httpsAgent: defaults.httpsAgent } : {},
2299
- ...session.noCredentialsConfig(),
2318
+ // The bare transport carries the RFC 7592 registration calls on `/oauth2/register/*`,
2319
+ // so it gets an `/oauth2/*` request's config: in the browser persona the fetch adapter
2320
+ // that omits credentials (C164-06; identical to `noCredentialsConfig()` under Node).
2321
+ ...session.oauth2RequestConfig(),
2300
2322
  withCredentials: false,
2301
2323
  maxRedirects: 0,
2302
2324
  validateStatus: () => true
@@ -8925,6 +8947,14 @@ var NodeSession = class extends SharedSession {
8925
8947
  withCredentials: false
8926
8948
  };
8927
8949
  }
8950
+ /**
8951
+ * Overrides {@link SharedSession.oauth2RequestConfig}: under Node the
8952
+ * jar-free agent pair of {@link noCredentialsConfig} is what withholds the
8953
+ * cookies; the browser's fetch adapter (`credentials: 'omit'`) is not used.
8954
+ */
8955
+ oauth2RequestConfig() {
8956
+ return this.noCredentialsConfig();
8957
+ }
8928
8958
  /**
8929
8959
  * Drives the actual `POST /api/v1/auth/refresh` HTTP call. Passed to this
8930
8960
  * session's per-instance `refreshGuard` (inherited from SharedSession) by