axiam-sdk 1.0.0-alpha21 → 1.0.0-alpha23

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 (35) hide show
  1. package/dist/{client-Dn1fs5MH.d.ts → client-Bvq888vU.d.ts} +1 -1
  2. package/dist/{client-B_FqmZ0i.d.cts → client-jcu7cvt2.d.cts} +1 -1
  3. package/dist/{cookieJar-Cl8Lq9dL.d.ts → cookieJar-BNQRJ1-1.d.ts} +28 -5
  4. package/dist/{cookieJar-BTDnjjbL.d.cts → cookieJar-pfVRO-Vj.d.cts} +28 -5
  5. package/dist/grpc/index.d.cts +4 -4
  6. package/dist/grpc/index.d.ts +4 -4
  7. package/dist/grpc/index.js +36 -13
  8. package/dist/grpc/index.js.map +1 -1
  9. package/dist/grpc/index.mjs +36 -13
  10. package/dist/grpc/index.mjs.map +1 -1
  11. package/dist/index.d.cts +2 -2
  12. package/dist/index.d.ts +2 -2
  13. package/dist/index.js +26 -7
  14. package/dist/index.js.map +1 -1
  15. package/dist/index.mjs +26 -7
  16. package/dist/index.mjs.map +1 -1
  17. package/dist/middleware/index.d.cts +3 -3
  18. package/dist/middleware/index.d.ts +3 -3
  19. package/dist/node/index.d.cts +4 -4
  20. package/dist/node/index.d.ts +4 -4
  21. package/dist/node/index.js +36 -13
  22. package/dist/node/index.js.map +1 -1
  23. package/dist/node/index.mjs +36 -13
  24. package/dist/node/index.mjs.map +1 -1
  25. package/dist/{oidcState-CkFuCjpM.d.ts → oidcState-BXrGx6Qu.d.ts} +1 -1
  26. package/dist/{oidcState-BGxqWUun.d.cts → oidcState-BeB2oC6X.d.cts} +1 -1
  27. package/dist/rest/index.d.cts +2 -2
  28. package/dist/rest/index.d.ts +2 -2
  29. package/dist/rest/index.js +26 -7
  30. package/dist/rest/index.js.map +1 -1
  31. package/dist/rest/index.mjs +26 -7
  32. package/dist/rest/index.mjs.map +1 -1
  33. package/dist/{session-BWUWhhyB.d.cts → session-9-H_BWCN.d.cts} +9 -1
  34. package/dist/{session-BWUWhhyB.d.ts → session-9-H_BWCN.d.ts} +9 -1
  35. package/package.json +2 -2
@@ -1,7 +1,7 @@
1
1
  import * as grpc2 from '@grpc/grpc-js';
2
2
  import axios from 'axios';
3
3
  import { CookieJar } from 'tough-cookie';
4
- import { wrapper } from 'axios-cookiejar-support';
4
+ import { HttpCookieAgent, HttpsCookieAgent } from 'http-cookie-agent/http';
5
5
  import { timingSafeEqual } from 'crypto';
6
6
 
7
7
  var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
@@ -627,7 +627,20 @@ function resolveTenantHeaderValue(options) {
627
627
  "AxiamClient construction requires a tenant: provide either tenantSlug or tenantId (CONTRACT.md \xA75)."
628
628
  );
629
629
  }
630
- function maybeBuildHttpsAgent(customCa, identity) {
630
+ function loadNodeHttps() {
631
+ const getBuiltinModule = process.getBuiltinModule;
632
+ if (typeof getBuiltinModule === "function") {
633
+ return getBuiltinModule.call(process, "node:https");
634
+ }
635
+ try {
636
+ return __require("https");
637
+ } catch {
638
+ throw new Error(
639
+ `customCa and clientCert require Node's https module, which this ESM build cannot load on Node ${process.version}: process.getBuiltinModule is unavailable (added in Node 20.16 / 22.3) and \`require\` does not exist in an ES module. Upgrade Node to >= 20.16, or load the CommonJS build (CONTRACT.md \xA76 / \xA76.1).`
640
+ );
641
+ }
642
+ }
643
+ function tlsOptionsFrom(customCa, identity) {
631
644
  if (!customCa) {
632
645
  if (!identity) {
633
646
  return void 0;
@@ -637,15 +650,24 @@ function maybeBuildHttpsAgent(customCa, identity) {
637
650
  'customCa must be a PEM-encoded certificate (expected to contain "-----BEGIN CERTIFICATE-----") (CONTRACT.md \xA76).'
638
651
  );
639
652
  }
653
+ return {
654
+ ...customCa ? { ca: customCa } : {},
655
+ ...identity ? { cert: identity.cert, key: identity.key.expose() } : {}
656
+ };
657
+ }
658
+ function resolveNodeTlsOptions(options) {
659
+ return tlsOptionsFrom(options.customCa, resolveClientIdentity(options));
660
+ }
661
+ function maybeBuildHttpsAgent(customCa, identity) {
662
+ const tls = tlsOptionsFrom(customCa, identity);
663
+ if (!tls) {
664
+ return void 0;
665
+ }
640
666
  if (typeof process === "undefined") {
641
667
  return void 0;
642
668
  }
643
- const https = __require("https");
644
- return new https.Agent({
645
- ...customCa ? { ca: customCa } : {},
646
- // rejectUnauthorized is intentionally left at its secure default (true).
647
- ...identity ? { cert: identity.cert, key: identity.key.expose() } : {}
648
- });
669
+ const https = loadNodeHttps();
670
+ return new https.Agent(tls);
649
671
  }
650
672
  function createSession(options) {
651
673
  const tenantHeaderValue = resolveTenantHeaderValue(options);
@@ -968,10 +990,11 @@ var CSRF_COOKIE = "axiam_csrf";
968
990
  function createJar() {
969
991
  return new CookieJar();
970
992
  }
971
- function wrapAxios(instance, jar) {
972
- const wrapped = wrapper(instance);
973
- wrapped.defaults.jar = jar;
974
- return wrapped;
993
+ function wrapAxios(instance, jar, tls) {
994
+ const cookies = { jar };
995
+ instance.defaults.httpAgent = new HttpCookieAgent({ cookies });
996
+ instance.defaults.httpsAgent = new HttpsCookieAgent({ cookies, ...tls ?? {} });
997
+ return instance;
975
998
  }
976
999
  async function extractCookieValue(jar, url, name) {
977
1000
  const cookies = await jar.getCookies(url);
@@ -1269,7 +1292,7 @@ var NodeSession = class extends SharedSession {
1269
1292
  function createNodeSession(options) {
1270
1293
  const base = createSession(options);
1271
1294
  const jar = createJar();
1272
- wrapAxios(base.axios, jar);
1295
+ wrapAxios(base.axios, jar, resolveNodeTlsOptions(options));
1273
1296
  const tokenManager = new TokenManager(jar, options.baseUrl, base.tenantHeaderValue);
1274
1297
  const jwksVerifier = createVerifier(options.baseUrl);
1275
1298
  return new NodeSession(options, base, tokenManager, jwksVerifier, jar);