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.
- package/dist/{client-Dn1fs5MH.d.ts → client-Bvq888vU.d.ts} +1 -1
- package/dist/{client-B_FqmZ0i.d.cts → client-jcu7cvt2.d.cts} +1 -1
- package/dist/{cookieJar-Cl8Lq9dL.d.ts → cookieJar-BNQRJ1-1.d.ts} +28 -5
- package/dist/{cookieJar-BTDnjjbL.d.cts → cookieJar-pfVRO-Vj.d.cts} +28 -5
- package/dist/grpc/index.d.cts +4 -4
- package/dist/grpc/index.d.ts +4 -4
- package/dist/grpc/index.js +36 -13
- package/dist/grpc/index.js.map +1 -1
- package/dist/grpc/index.mjs +36 -13
- package/dist/grpc/index.mjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +26 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +26 -7
- package/dist/index.mjs.map +1 -1
- package/dist/middleware/index.d.cts +3 -3
- package/dist/middleware/index.d.ts +3 -3
- package/dist/node/index.d.cts +4 -4
- package/dist/node/index.d.ts +4 -4
- package/dist/node/index.js +36 -13
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +36 -13
- package/dist/node/index.mjs.map +1 -1
- package/dist/{oidcState-CkFuCjpM.d.ts → oidcState-BXrGx6Qu.d.ts} +1 -1
- package/dist/{oidcState-BGxqWUun.d.cts → oidcState-BeB2oC6X.d.cts} +1 -1
- package/dist/rest/index.d.cts +2 -2
- package/dist/rest/index.d.ts +2 -2
- package/dist/rest/index.js +26 -7
- package/dist/rest/index.js.map +1 -1
- package/dist/rest/index.mjs +26 -7
- package/dist/rest/index.mjs.map +1 -1
- package/dist/{session-BWUWhhyB.d.cts → session-9-H_BWCN.d.cts} +9 -1
- package/dist/{session-BWUWhhyB.d.ts → session-9-H_BWCN.d.ts} +9 -1
- package/package.json +2 -2
package/dist/grpc/index.mjs
CHANGED
|
@@ -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 {
|
|
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
|
|
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 =
|
|
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
|
|
973
|
-
|
|
974
|
-
|
|
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);
|