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,4 +1,4 @@
1
- import { S as SharedSession, A as AxiamClientOptions } from './session-BWUWhhyB.js';
1
+ import { S as SharedSession, A as AxiamClientOptions } from './session-9-H_BWCN.js';
2
2
  import { L as LoginResult, A as AccessCheck, a as AccessDecision } from './types-BVkMoqLU.js';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { S as SharedSession, A as AxiamClientOptions } from './session-BWUWhhyB.cjs';
1
+ import { S as SharedSession, A as AxiamClientOptions } from './session-9-H_BWCN.cjs';
2
2
  import { L as LoginResult, A as AccessCheck, a as AccessDecision } from './types-BVkMoqLU.cjs';
3
3
 
4
4
  /**
@@ -1,6 +1,6 @@
1
1
  import { CookieJar } from 'tough-cookie';
2
- import { S as SharedSession, A as AxiamClientOptions } from './session-BWUWhhyB.js';
3
- import { A as AxiamClient } from './client-Dn1fs5MH.js';
2
+ import { S as SharedSession, A as AxiamClientOptions, N as NodeTlsOptions } from './session-9-H_BWCN.js';
3
+ import { A as AxiamClient } from './client-Bvq888vU.js';
4
4
  import { S as Sensitive } from './sensitive-BC_s7Rrd.js';
5
5
  import { V as Verifier } from './jwks-BgojMGC5.js';
6
6
  import { AxiosInstance } from 'axios';
@@ -106,12 +106,35 @@ declare const CSRF_COOKIE = "axiam_csrf";
106
106
  /** Construct a fresh, per-client-instance cookie jar (§4 — never process-global). */
107
107
  declare function createJar(): CookieJar;
108
108
  /**
109
- * Wrap an axios instance with `axios-cookiejar-support` so the jar persists
109
+ * Attach jar-aware agents to an axios instance so the jar persists
110
110
  * `Set-Cookie` responses across requests and replays them on subsequent
111
111
  * requests to the same origin/path (§4). Mutates and returns the same
112
- * instance (matches `axios-cookiejar-support`'s documented in-place wrap).
112
+ * instance.
113
+ *
114
+ * The agents are constructed HERE rather than via `axios-cookiejar-support`'s
115
+ * `wrapper()`, which used to do it. That wrapper is a thin convenience layer:
116
+ * all cookie handling lives in `http-cookie-agent`'s agents, which it builds
117
+ * for you inside a request interceptor — and that interceptor is hostile to
118
+ * any other agent. It THROWS
119
+ *
120
+ * axios-cookiejar-support does not support for use with other http(s).Agent.
121
+ *
122
+ * when it finds an `httpsAgent` it did not create, and otherwise replaces it.
123
+ * Since `createSession` attaches an `https.Agent` whenever `customCa` or a
124
+ * §6.1 client certificate is configured, the Node persona could never use
125
+ * either: with TLS material configured every request threw, and there was no
126
+ * seam to pass CA/cert/key through the wrapper's own agent construction.
127
+ *
128
+ * Building the agent ourselves closes that: ONE `HttpsCookieAgent` that is
129
+ * both jar-aware and TLS-configured. Cookie behaviour is unchanged — it is
130
+ * the same agent class the wrapper was constructing, just with the TLS
131
+ * options merged in.
132
+ *
133
+ * @param tls §6/§6.1 TLS material, or undefined for the default trust store.
134
+ * Never carries `rejectUnauthorized`: strict server verification
135
+ * is not negotiable (§6).
113
136
  */
114
- declare function wrapAxios(instance: AxiosInstance, jar: CookieJar): AxiosInstance;
137
+ declare function wrapAxios(instance: AxiosInstance, jar: CookieJar, tls?: NodeTlsOptions): AxiosInstance;
115
138
  /**
116
139
  * Read a single cookie's value out of the jar by name, for the given URL.
117
140
  * This is the ONLY token-source path (RESEARCH.md Area 3 — no JSON-body
@@ -1,6 +1,6 @@
1
1
  import { CookieJar } from 'tough-cookie';
2
- import { S as SharedSession, A as AxiamClientOptions } from './session-BWUWhhyB.cjs';
3
- import { A as AxiamClient } from './client-B_FqmZ0i.cjs';
2
+ import { S as SharedSession, A as AxiamClientOptions, N as NodeTlsOptions } from './session-9-H_BWCN.cjs';
3
+ import { A as AxiamClient } from './client-jcu7cvt2.cjs';
4
4
  import { S as Sensitive } from './sensitive-BC_s7Rrd.cjs';
5
5
  import { V as Verifier } from './jwks-BgojMGC5.cjs';
6
6
  import { AxiosInstance } from 'axios';
@@ -106,12 +106,35 @@ declare const CSRF_COOKIE = "axiam_csrf";
106
106
  /** Construct a fresh, per-client-instance cookie jar (§4 — never process-global). */
107
107
  declare function createJar(): CookieJar;
108
108
  /**
109
- * Wrap an axios instance with `axios-cookiejar-support` so the jar persists
109
+ * Attach jar-aware agents to an axios instance so the jar persists
110
110
  * `Set-Cookie` responses across requests and replays them on subsequent
111
111
  * requests to the same origin/path (§4). Mutates and returns the same
112
- * instance (matches `axios-cookiejar-support`'s documented in-place wrap).
112
+ * instance.
113
+ *
114
+ * The agents are constructed HERE rather than via `axios-cookiejar-support`'s
115
+ * `wrapper()`, which used to do it. That wrapper is a thin convenience layer:
116
+ * all cookie handling lives in `http-cookie-agent`'s agents, which it builds
117
+ * for you inside a request interceptor — and that interceptor is hostile to
118
+ * any other agent. It THROWS
119
+ *
120
+ * axios-cookiejar-support does not support for use with other http(s).Agent.
121
+ *
122
+ * when it finds an `httpsAgent` it did not create, and otherwise replaces it.
123
+ * Since `createSession` attaches an `https.Agent` whenever `customCa` or a
124
+ * §6.1 client certificate is configured, the Node persona could never use
125
+ * either: with TLS material configured every request threw, and there was no
126
+ * seam to pass CA/cert/key through the wrapper's own agent construction.
127
+ *
128
+ * Building the agent ourselves closes that: ONE `HttpsCookieAgent` that is
129
+ * both jar-aware and TLS-configured. Cookie behaviour is unchanged — it is
130
+ * the same agent class the wrapper was constructing, just with the TLS
131
+ * options merged in.
132
+ *
133
+ * @param tls §6/§6.1 TLS material, or undefined for the default trust store.
134
+ * Never carries `rejectUnauthorized`: strict server verification
135
+ * is not negotiable (§6).
113
136
  */
114
- declare function wrapAxios(instance: AxiosInstance, jar: CookieJar): AxiosInstance;
137
+ declare function wrapAxios(instance: AxiosInstance, jar: CookieJar, tls?: NodeTlsOptions): AxiosInstance;
115
138
  /**
116
139
  * Read a single cookie's value out of the jar by name, for the given URL.
117
140
  * This is the ONLY token-source path (RESEARCH.md Area 3 — no JSON-body
@@ -1,13 +1,13 @@
1
1
  import * as grpc from '@grpc/grpc-js';
2
2
  import { Interceptor } from '@grpc/grpc-js';
3
- import { N as NodeSession } from '../cookieJar-BTDnjjbL.cjs';
4
- export { A as ACCESS_COOKIE, C as CSRF_COOKIE, R as REFRESH_COOKIE, T as TokenManager, c as createJar, a as createNodeClient, b as createNodeSession, e as extractCookieValue, w as wrapAxios } from '../cookieJar-BTDnjjbL.cjs';
3
+ import { N as NodeSession } from '../cookieJar-pfVRO-Vj.cjs';
4
+ export { A as ACCESS_COOKIE, C as CSRF_COOKIE, R as REFRESH_COOKIE, T as TokenManager, c as createJar, a as createNodeClient, b as createNodeSession, e as extractCookieValue, w as wrapAxios } from '../cookieJar-pfVRO-Vj.cjs';
5
5
  import { a as AccessDecision } from '../types-BVkMoqLU.cjs';
6
6
  export { A as AxiamClaims, J as JWKS_PATH, V as Verifier, f as createVerifier } from '../jwks-BgojMGC5.cjs';
7
7
  import 'tough-cookie';
8
- import '../session-BWUWhhyB.cjs';
8
+ import '../session-9-H_BWCN.cjs';
9
9
  import 'axios';
10
- import '../client-B_FqmZ0i.cjs';
10
+ import '../client-jcu7cvt2.cjs';
11
11
  import '../sensitive-BC_s7Rrd.cjs';
12
12
 
13
13
  /**
@@ -1,13 +1,13 @@
1
1
  import * as grpc from '@grpc/grpc-js';
2
2
  import { Interceptor } from '@grpc/grpc-js';
3
- import { N as NodeSession } from '../cookieJar-Cl8Lq9dL.js';
4
- export { A as ACCESS_COOKIE, C as CSRF_COOKIE, R as REFRESH_COOKIE, T as TokenManager, c as createJar, a as createNodeClient, b as createNodeSession, e as extractCookieValue, w as wrapAxios } from '../cookieJar-Cl8Lq9dL.js';
3
+ import { N as NodeSession } from '../cookieJar-BNQRJ1-1.js';
4
+ export { A as ACCESS_COOKIE, C as CSRF_COOKIE, R as REFRESH_COOKIE, T as TokenManager, c as createJar, a as createNodeClient, b as createNodeSession, e as extractCookieValue, w as wrapAxios } from '../cookieJar-BNQRJ1-1.js';
5
5
  import { a as AccessDecision } from '../types-BVkMoqLU.js';
6
6
  export { A as AxiamClaims, J as JWKS_PATH, V as Verifier, f as createVerifier } from '../jwks-BgojMGC5.js';
7
7
  import 'tough-cookie';
8
- import '../session-BWUWhhyB.js';
8
+ import '../session-9-H_BWCN.js';
9
9
  import 'axios';
10
- import '../client-Dn1fs5MH.js';
10
+ import '../client-Bvq888vU.js';
11
11
  import '../sensitive-BC_s7Rrd.js';
12
12
 
13
13
  /**
@@ -3,7 +3,7 @@
3
3
  var grpc2 = require('@grpc/grpc-js');
4
4
  var axios = require('axios');
5
5
  var toughCookie = require('tough-cookie');
6
- var axiosCookiejarSupport = require('axios-cookiejar-support');
6
+ var http = require('http-cookie-agent/http');
7
7
  var crypto = require('crypto');
8
8
 
9
9
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
@@ -652,7 +652,20 @@ function resolveTenantHeaderValue(options) {
652
652
  "AxiamClient construction requires a tenant: provide either tenantSlug or tenantId (CONTRACT.md \xA75)."
653
653
  );
654
654
  }
655
- function maybeBuildHttpsAgent(customCa, identity) {
655
+ function loadNodeHttps() {
656
+ const getBuiltinModule = process.getBuiltinModule;
657
+ if (typeof getBuiltinModule === "function") {
658
+ return getBuiltinModule.call(process, "node:https");
659
+ }
660
+ try {
661
+ return __require("https");
662
+ } catch {
663
+ throw new Error(
664
+ `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).`
665
+ );
666
+ }
667
+ }
668
+ function tlsOptionsFrom(customCa, identity) {
656
669
  if (!customCa) {
657
670
  if (!identity) {
658
671
  return void 0;
@@ -662,15 +675,24 @@ function maybeBuildHttpsAgent(customCa, identity) {
662
675
  'customCa must be a PEM-encoded certificate (expected to contain "-----BEGIN CERTIFICATE-----") (CONTRACT.md \xA76).'
663
676
  );
664
677
  }
678
+ return {
679
+ ...customCa ? { ca: customCa } : {},
680
+ ...identity ? { cert: identity.cert, key: identity.key.expose() } : {}
681
+ };
682
+ }
683
+ function resolveNodeTlsOptions(options) {
684
+ return tlsOptionsFrom(options.customCa, resolveClientIdentity(options));
685
+ }
686
+ function maybeBuildHttpsAgent(customCa, identity) {
687
+ const tls = tlsOptionsFrom(customCa, identity);
688
+ if (!tls) {
689
+ return void 0;
690
+ }
665
691
  if (typeof process === "undefined") {
666
692
  return void 0;
667
693
  }
668
- const https = __require("https");
669
- return new https.Agent({
670
- ...customCa ? { ca: customCa } : {},
671
- // rejectUnauthorized is intentionally left at its secure default (true).
672
- ...identity ? { cert: identity.cert, key: identity.key.expose() } : {}
673
- });
694
+ const https = loadNodeHttps();
695
+ return new https.Agent(tls);
674
696
  }
675
697
  function createSession(options) {
676
698
  const tenantHeaderValue = resolveTenantHeaderValue(options);
@@ -993,10 +1015,11 @@ var CSRF_COOKIE = "axiam_csrf";
993
1015
  function createJar() {
994
1016
  return new toughCookie.CookieJar();
995
1017
  }
996
- function wrapAxios(instance, jar) {
997
- const wrapped = axiosCookiejarSupport.wrapper(instance);
998
- wrapped.defaults.jar = jar;
999
- return wrapped;
1018
+ function wrapAxios(instance, jar, tls) {
1019
+ const cookies = { jar };
1020
+ instance.defaults.httpAgent = new http.HttpCookieAgent({ cookies });
1021
+ instance.defaults.httpsAgent = new http.HttpsCookieAgent({ cookies, ...tls ?? {} });
1022
+ return instance;
1000
1023
  }
1001
1024
  async function extractCookieValue(jar, url, name) {
1002
1025
  const cookies = await jar.getCookies(url);
@@ -1294,7 +1317,7 @@ var NodeSession = class extends SharedSession {
1294
1317
  function createNodeSession(options) {
1295
1318
  const base = createSession(options);
1296
1319
  const jar = createJar();
1297
- wrapAxios(base.axios, jar);
1320
+ wrapAxios(base.axios, jar, resolveNodeTlsOptions(options));
1298
1321
  const tokenManager = new TokenManager(jar, options.baseUrl, base.tenantHeaderValue);
1299
1322
  const jwksVerifier = createVerifier(options.baseUrl);
1300
1323
  return new NodeSession(options, base, tokenManager, jwksVerifier, jar);