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.
- package/README.md +20 -4
- package/dist/browser/index.d.cts +1 -1
- package/dist/browser/index.d.ts +1 -1
- package/dist/{client-D34sXV8p.d.cts → client-BGFn1VQh.d.cts} +7 -1
- package/dist/{client-BMNQi36J.d.ts → client-DrQZZ1js.d.ts} +7 -1
- package/dist/{cookieJar-DcrMe93Q.d.ts → cookieJar-BTmpjXZe.d.ts} +8 -2
- package/dist/{cookieJar-C_xPuniu.d.cts → cookieJar-BqYOnNN-.d.cts} +8 -2
- package/dist/grpc/index.d.cts +4 -4
- package/dist/grpc/index.d.ts +4 -4
- package/dist/grpc/index.js +32 -2
- package/dist/grpc/index.js.map +1 -1
- package/dist/grpc/index.mjs +32 -2
- 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 +24 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -2
- 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/middleware/index.js +149 -22
- package/dist/middleware/index.js.map +1 -1
- package/dist/middleware/index.mjs +149 -22
- package/dist/middleware/index.mjs.map +1 -1
- package/dist/node/index.d.cts +3 -3
- package/dist/node/index.d.ts +3 -3
- package/dist/node/index.js +178 -23
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +178 -23
- package/dist/node/index.mjs.map +1 -1
- package/dist/{oidcState-BFIHt7_Y.d.cts → oidcState-BaJ-SM_R.d.cts} +37 -6
- package/dist/{oidcState-qoy2vsYG.d.ts → oidcState-C3VLn3eD.d.ts} +37 -6
- package/dist/rest/index.d.cts +3 -3
- package/dist/rest/index.d.ts +3 -3
- package/dist/rest/index.js +24 -2
- package/dist/rest/index.js.map +1 -1
- package/dist/rest/index.mjs +24 -2
- package/dist/rest/index.mjs.map +1 -1
- package/dist/{session-BbPFTpMZ.d.ts → session-B03NsqVs.d.ts} +16 -0
- package/dist/{session-C9WlP6DV.d.cts → session-plDr4lFu.d.cts} +16 -0
- package/package.json +1 -1
package/dist/rest/index.mjs
CHANGED
|
@@ -669,6 +669,24 @@ var SharedSession = class {
|
|
|
669
669
|
noCredentialsConfig() {
|
|
670
670
|
return { withCredentials: false };
|
|
671
671
|
}
|
|
672
|
+
/**
|
|
673
|
+
* Axios config for a request to an `/oauth2/*` endpoint (CONTRACT.md §12.1
|
|
674
|
+
* rule 3, §14.6; C163-12): {@link noCredentialsConfig} and, in the browser
|
|
675
|
+
* persona, the fetch adapter with `credentials: 'omit'`.
|
|
676
|
+
*
|
|
677
|
+
* `withCredentials: false` on axios's default XHR adapter is not enough: that
|
|
678
|
+
* adapter sends a same-origin cookie regardless, so an app served from the
|
|
679
|
+
* AXIAM origin would still present `axiam_*` on a token or device request.
|
|
680
|
+
* The fetch adapter derives its `credentials` from `withCredentials: false`
|
|
681
|
+
* (`'omit'`); `fetchOptions.credentials` is set as well for adapters that
|
|
682
|
+
* read it.
|
|
683
|
+
* `NodeSession` overrides this to {@link noCredentialsConfig}: its jar-free
|
|
684
|
+
* agent pair is what keeps the cookies off there, and the fetch adapter
|
|
685
|
+
* would bypass that pair.
|
|
686
|
+
*/
|
|
687
|
+
oauth2RequestConfig() {
|
|
688
|
+
return { ...this.noCredentialsConfig(), adapter: "fetch", fetchOptions: { credentials: "omit" } };
|
|
689
|
+
}
|
|
672
690
|
};
|
|
673
691
|
function resolveTenantHeaderValue(options) {
|
|
674
692
|
if (options.tenantSlug) {
|
|
@@ -858,7 +876,7 @@ function installDeviceTokenInterceptor(axiosInstance, session) {
|
|
|
858
876
|
if (session.isForeignHost(config.url) || deviceToken === void 0 && !oauth2) {
|
|
859
877
|
return config;
|
|
860
878
|
}
|
|
861
|
-
const noCred = session.noCredentialsConfig();
|
|
879
|
+
const noCred = oauth2 ? session.oauth2RequestConfig() : session.noCredentialsConfig();
|
|
862
880
|
Object.assign(config, noCred);
|
|
863
881
|
config.headers = config.headers ?? {};
|
|
864
882
|
if (oauth2) {
|
|
@@ -1352,6 +1370,7 @@ async function withRetry(fn, options) {
|
|
|
1352
1370
|
}
|
|
1353
1371
|
const retryAfterMs2 = isRetryAfterCarrier(err) ? err.retryAfterMs : void 0;
|
|
1354
1372
|
const delay = delayMs(attempt, retryAfterMs2, random());
|
|
1373
|
+
options.admit?.(delay);
|
|
1355
1374
|
options.telemetry?.emit({
|
|
1356
1375
|
type: "retry",
|
|
1357
1376
|
operation: options.operation ?? "unknown",
|
|
@@ -1884,7 +1903,10 @@ async function bareRequest(session, operation, config) {
|
|
|
1884
1903
|
// jar). Under the Node persona this is the jar-wrapped cookie agent, which
|
|
1885
1904
|
// `noCredentialsConfig()` below replaces with a plain one.
|
|
1886
1905
|
...defaults.httpsAgent !== void 0 ? { httpsAgent: defaults.httpsAgent } : {},
|
|
1887
|
-
|
|
1906
|
+
// The bare transport carries the RFC 7592 registration calls on `/oauth2/register/*`,
|
|
1907
|
+
// so it gets an `/oauth2/*` request's config: in the browser persona the fetch adapter
|
|
1908
|
+
// that omits credentials (C164-06; identical to `noCredentialsConfig()` under Node).
|
|
1909
|
+
...session.oauth2RequestConfig(),
|
|
1888
1910
|
withCredentials: false,
|
|
1889
1911
|
maxRedirects: 0,
|
|
1890
1912
|
validateStatus: () => true
|