axiam-sdk 1.1.3 → 1.2.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 +73 -3
- package/dist/amqp/index.js.map +1 -1
- package/dist/amqp/index.mjs.map +1 -1
- package/dist/browser/index.d.cts +1 -1
- package/dist/browser/index.d.ts +1 -1
- package/dist/{client-BGFn1VQh.d.cts → client-Bp7riC4k.d.cts} +147 -3
- package/dist/{client-DrQZZ1js.d.ts → client-CaurIxje.d.ts} +147 -3
- package/dist/{cookieJar-BTmpjXZe.d.ts → cookieJar-DC4GLKrJ.d.ts} +2 -2
- package/dist/{cookieJar-BqYOnNN-.d.cts → cookieJar-oKazfbN1.d.cts} +2 -2
- package/dist/{errors-DZ3k8a8i.d.cts → errors-CWlh-wcm.d.cts} +7 -1
- package/dist/{errors-DZ3k8a8i.d.ts → errors-CWlh-wcm.d.ts} +7 -1
- package/dist/{errors-dlGXAsbh.d.ts → errors-DDo3oxcH.d.ts} +1 -1
- package/dist/{errors-RvGlTyUj.d.cts → errors-DHauOsqx.d.cts} +1 -1
- package/dist/grpc/index.d.cts +4 -4
- package/dist/grpc/index.d.ts +4 -4
- package/dist/grpc/index.js +26 -5
- package/dist/grpc/index.js.map +1 -1
- package/dist/grpc/index.mjs +26 -5
- package/dist/grpc/index.mjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +26 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +26 -5
- package/dist/index.mjs.map +1 -1
- package/dist/middleware/index.d.cts +5 -5
- package/dist/middleware/index.d.ts +5 -5
- package/dist/middleware/index.js +164 -12
- package/dist/middleware/index.js.map +1 -1
- package/dist/middleware/index.mjs +164 -12
- package/dist/middleware/index.mjs.map +1 -1
- package/dist/nestjs/index.js.map +1 -1
- package/dist/nestjs/index.mjs.map +1 -1
- package/dist/node/index.d.cts +15 -4
- package/dist/node/index.d.ts +15 -4
- package/dist/node/index.js +186 -14
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +185 -15
- package/dist/node/index.mjs.map +1 -1
- package/dist/{oidcState-C3VLn3eD.d.ts → oidcState-CZhj0MBP.d.ts} +123 -5
- package/dist/{oidcState-BaJ-SM_R.d.cts → oidcState-EnEJmoF5.d.cts} +123 -5
- package/dist/rest/index.d.cts +6 -6
- package/dist/rest/index.d.ts +6 -6
- package/dist/rest/index.js +26 -5
- package/dist/rest/index.js.map +1 -1
- package/dist/rest/index.mjs +26 -5
- package/dist/rest/index.mjs.map +1 -1
- package/dist/{session-B03NsqVs.d.ts → session-Beo11VT_.d.ts} +9 -0
- package/dist/{session-plDr4lFu.d.cts → session-CeIUXgpE.d.cts} +9 -0
- package/package.json +1 -1
|
@@ -68,7 +68,13 @@ declare class OAuthProtocolError extends AuthError {
|
|
|
68
68
|
* OPTIONAL, and §2 (contract 1.53, §28.12.3) dispatches on `error` alone.
|
|
69
69
|
*/
|
|
70
70
|
readonly errorDescription: string;
|
|
71
|
-
|
|
71
|
+
/**
|
|
72
|
+
* The server's `Retry-After` in milliseconds, when this error is a `429` that carried one in
|
|
73
|
+
* delta-seconds form (contract 1.65 §37.3, C165-17). Absent otherwise; an HTTP-date is not read.
|
|
74
|
+
* Additive: honour it before retrying a rate-limited native sign-in or CIBA call.
|
|
75
|
+
*/
|
|
76
|
+
readonly retryAfterMs?: number;
|
|
77
|
+
constructor(error: string, errorDescription?: string, retryAfterMs?: number);
|
|
72
78
|
}
|
|
73
79
|
/**
|
|
74
80
|
* Authorization failure (CONTRACT.md §2): the caller is authenticated but
|
|
@@ -68,7 +68,13 @@ declare class OAuthProtocolError extends AuthError {
|
|
|
68
68
|
* OPTIONAL, and §2 (contract 1.53, §28.12.3) dispatches on `error` alone.
|
|
69
69
|
*/
|
|
70
70
|
readonly errorDescription: string;
|
|
71
|
-
|
|
71
|
+
/**
|
|
72
|
+
* The server's `Retry-After` in milliseconds, when this error is a `429` that carried one in
|
|
73
|
+
* delta-seconds form (contract 1.65 §37.3, C165-17). Absent otherwise; an HTTP-date is not read.
|
|
74
|
+
* Additive: honour it before retrying a rate-limited native sign-in or CIBA call.
|
|
75
|
+
*/
|
|
76
|
+
readonly retryAfterMs?: number;
|
|
77
|
+
constructor(error: string, errorDescription?: string, retryAfterMs?: number);
|
|
72
78
|
}
|
|
73
79
|
/**
|
|
74
80
|
* Authorization failure (CONTRACT.md §2): the caller is authenticated but
|
package/dist/grpc/index.d.cts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import * as grpc from '@grpc/grpc-js';
|
|
2
2
|
import { Interceptor } from '@grpc/grpc-js';
|
|
3
|
-
import { N as NodeSession } from '../cookieJar-
|
|
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-
|
|
3
|
+
import { N as NodeSession } from '../cookieJar-oKazfbN1.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-oKazfbN1.cjs';
|
|
5
5
|
import { Sensitive } from '../amqp/index.cjs';
|
|
6
6
|
import { a as AccessDecision } from '../types-zXSpiQM-.cjs';
|
|
7
7
|
import { CnfClaim } from '../middleware/index.cjs';
|
|
8
8
|
export { A as AxiamClaims, J as JWKS_PATH, V as Verifier, c as createVerifier } from '../jwks-CTVpOWzI.cjs';
|
|
9
9
|
import 'axios';
|
|
10
10
|
import 'tough-cookie';
|
|
11
|
-
import '../session-
|
|
11
|
+
import '../session-CeIUXgpE.cjs';
|
|
12
12
|
import '../telemetry-Du0-zS5f.cjs';
|
|
13
|
-
import '../client-
|
|
13
|
+
import '../client-Bp7riC4k.cjs';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Injects `authorization: Bearer <token>` (when a token is available) and
|
package/dist/grpc/index.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import * as grpc from '@grpc/grpc-js';
|
|
2
2
|
import { Interceptor } from '@grpc/grpc-js';
|
|
3
|
-
import { N as NodeSession } from '../cookieJar-
|
|
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-
|
|
3
|
+
import { N as NodeSession } from '../cookieJar-DC4GLKrJ.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-DC4GLKrJ.js';
|
|
5
5
|
import { Sensitive } from '../amqp/index.js';
|
|
6
6
|
import { a as AccessDecision } from '../types-BOX-6Srv.js';
|
|
7
7
|
import { CnfClaim } from '../middleware/index.js';
|
|
8
8
|
export { A as AxiamClaims, J as JWKS_PATH, V as Verifier, c as createVerifier } from '../jwks-CTVpOWzI.js';
|
|
9
9
|
import 'axios';
|
|
10
10
|
import 'tough-cookie';
|
|
11
|
-
import '../session-
|
|
11
|
+
import '../session-Beo11VT_.js';
|
|
12
12
|
import '../telemetry-Du0-zS5f.js';
|
|
13
|
-
import '../client-
|
|
13
|
+
import '../client-CaurIxje.js';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Injects `authorization: Bearer <token>` (when a token is available) and
|
package/dist/grpc/index.js
CHANGED
|
@@ -84,11 +84,18 @@ var OAuthProtocolError = class _OAuthProtocolError extends AuthError {
|
|
|
84
84
|
* OPTIONAL, and §2 (contract 1.53, §28.12.3) dispatches on `error` alone.
|
|
85
85
|
*/
|
|
86
86
|
errorDescription;
|
|
87
|
-
|
|
87
|
+
/**
|
|
88
|
+
* The server's `Retry-After` in milliseconds, when this error is a `429` that carried one in
|
|
89
|
+
* delta-seconds form (contract 1.65 §37.3, C165-17). Absent otherwise; an HTTP-date is not read.
|
|
90
|
+
* Additive: honour it before retrying a rate-limited native sign-in or CIBA call.
|
|
91
|
+
*/
|
|
92
|
+
retryAfterMs;
|
|
93
|
+
constructor(error, errorDescription = "", retryAfterMs2) {
|
|
88
94
|
super(errorDescription ? `${error}: ${errorDescription}` : error);
|
|
89
95
|
this.name = "OAuthProtocolError";
|
|
90
96
|
this.error = error;
|
|
91
97
|
this.errorDescription = errorDescription;
|
|
98
|
+
if (retryAfterMs2 !== void 0) this.retryAfterMs = retryAfterMs2;
|
|
92
99
|
Object.setPrototypeOf(this, _OAuthProtocolError.prototype);
|
|
93
100
|
}
|
|
94
101
|
};
|
|
@@ -153,7 +160,7 @@ function isOAuth2ErrorBody(body) {
|
|
|
153
160
|
const record = body;
|
|
154
161
|
return typeof record.error === "string" && typeof record.error_description === "string";
|
|
155
162
|
}
|
|
156
|
-
function oauth2ErrorFromBody(body) {
|
|
163
|
+
function oauth2ErrorFromBody(body, retryAfterMs2) {
|
|
157
164
|
if (body === null || typeof body !== "object" || Array.isArray(body)) {
|
|
158
165
|
return void 0;
|
|
159
166
|
}
|
|
@@ -162,7 +169,7 @@ function oauth2ErrorFromBody(body) {
|
|
|
162
169
|
return void 0;
|
|
163
170
|
}
|
|
164
171
|
const description = typeof record.error_description === "string" ? record.error_description : "";
|
|
165
|
-
return new OAuthProtocolError(record.error, description);
|
|
172
|
+
return new OAuthProtocolError(record.error, description, retryAfterMs2);
|
|
166
173
|
}
|
|
167
174
|
var SAFE_RESPONSE_HEADERS = /* @__PURE__ */ new Set([
|
|
168
175
|
"content-type",
|
|
@@ -1109,12 +1116,21 @@ var SharedSession = class {
|
|
|
1109
1116
|
* The fetch adapter derives its `credentials` from `withCredentials: false`
|
|
1110
1117
|
* (`'omit'`); `fetchOptions.credentials` is set as well for adapters that
|
|
1111
1118
|
* read it.
|
|
1119
|
+
*
|
|
1120
|
+
* `fetchOptions.redirect: 'error'` is the browser persona's half of CONTRACT.md §12.1
|
|
1121
|
+
* rule 3 ("No redirect is followed", C165-26). On the main client's `/oauth2/*` requests
|
|
1122
|
+
* it makes `fetch` reject, which every caller maps to a `NetworkError` that carries
|
|
1123
|
+
* neither the `Location` nor the request. Where `maxRedirects: 0` is set (the bare
|
|
1124
|
+
* transport, `bareRequest`), axios's fetch adapter substitutes `redirect: 'manual'`
|
|
1125
|
+
* (`lib/adapters/fetch.js`), so `'error'` is overridden there: the browser hands back an
|
|
1126
|
+
* opaque-redirect (status 0), and `bareRequest` maps status 0 or any `3xx` to a
|
|
1127
|
+
* `NetworkError` without the `Location` (`bareTransport.ts`).
|
|
1112
1128
|
* `NodeSession` overrides this to {@link noCredentialsConfig}: its jar-free
|
|
1113
1129
|
* agent pair is what keeps the cookies off there, and the fetch adapter
|
|
1114
1130
|
* would bypass that pair.
|
|
1115
1131
|
*/
|
|
1116
1132
|
oauth2RequestConfig() {
|
|
1117
|
-
return { ...this.noCredentialsConfig(), adapter: "fetch", fetchOptions: { credentials: "omit" } };
|
|
1133
|
+
return { ...this.noCredentialsConfig(), adapter: "fetch", fetchOptions: { credentials: "omit", redirect: "error" } };
|
|
1118
1134
|
}
|
|
1119
1135
|
};
|
|
1120
1136
|
function resolveTenantHeaderValue(options) {
|
|
@@ -2348,12 +2364,17 @@ async function bareRequest(session, operation, config) {
|
|
|
2348
2364
|
maxRedirects: 0,
|
|
2349
2365
|
validateStatus: () => true
|
|
2350
2366
|
});
|
|
2367
|
+
let response;
|
|
2351
2368
|
try {
|
|
2352
|
-
|
|
2369
|
+
response = await instance.request(config);
|
|
2353
2370
|
} catch (err) {
|
|
2354
2371
|
const code = err && typeof err === "object" && "code" in err && typeof err.code === "string" ? ` (${err.code})` : "";
|
|
2355
2372
|
throw new NetworkError(`${operation}: the request failed before any response arrived${code}`);
|
|
2356
2373
|
}
|
|
2374
|
+
if (response.status === 0 || response.status >= 300 && response.status < 400) {
|
|
2375
|
+
throw new NetworkError(`${operation}: the server answered with a redirect, which is not followed`);
|
|
2376
|
+
}
|
|
2377
|
+
return response;
|
|
2357
2378
|
}
|
|
2358
2379
|
function retryAfterMs(response) {
|
|
2359
2380
|
const raw = response.headers?.["retry-after"];
|