axiam-sdk 1.0.0 → 1.1.1

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 (60) hide show
  1. package/README.md +100 -12
  2. package/dist/amqp/index.d.cts +3 -2
  3. package/dist/amqp/index.d.ts +3 -2
  4. package/dist/{authzCore-BQfX9qxN.d.cts → authzCore-CqXzLNmT.d.cts} +4 -3
  5. package/dist/{authzCore-BlSHwGnW.d.ts → authzCore-D-hquWSI.d.ts} +4 -3
  6. package/dist/browser/index.d.cts +8 -7
  7. package/dist/browser/index.d.ts +8 -7
  8. package/dist/{client-0WJkblDE.d.ts → client-BMNQi36J.d.ts} +646 -16
  9. package/dist/{client-yD0eMwHQ.d.cts → client-D34sXV8p.d.cts} +646 -16
  10. package/dist/{cookieJar-CTD5jOmd.d.cts → cookieJar-C_xPuniu.d.cts} +3 -3
  11. package/dist/{cookieJar-hWRmZkhe.d.ts → cookieJar-DcrMe93Q.d.ts} +3 -3
  12. package/dist/{errors-DMIlw2lN.d.ts → errors-DZ3k8a8i.d.cts} +2 -1
  13. package/dist/{errors-DMIlw2lN.d.cts → errors-DZ3k8a8i.d.ts} +2 -1
  14. package/dist/{errors-m0Tue_pE.d.cts → errors-RvGlTyUj.d.cts} +18 -3
  15. package/dist/{errors-CmBvsxV0.d.ts → errors-dlGXAsbh.d.ts} +18 -3
  16. package/dist/grpc/index.d.cts +10 -9
  17. package/dist/grpc/index.d.ts +10 -9
  18. package/dist/grpc/index.js +604 -15
  19. package/dist/grpc/index.js.map +1 -1
  20. package/dist/grpc/index.mjs +604 -15
  21. package/dist/grpc/index.mjs.map +1 -1
  22. package/dist/index.d.cts +7 -7
  23. package/dist/index.d.ts +7 -7
  24. package/dist/index.js +626 -16
  25. package/dist/index.js.map +1 -1
  26. package/dist/index.mjs +624 -17
  27. package/dist/index.mjs.map +1 -1
  28. package/dist/{jwks-BR55d7-Z.d.cts → jwks-CTVpOWzI.d.cts} +2 -1
  29. package/dist/{jwks-BR55d7-Z.d.ts → jwks-CTVpOWzI.d.ts} +2 -1
  30. package/dist/middleware/index.d.cts +13 -12
  31. package/dist/middleware/index.d.ts +13 -12
  32. package/dist/middleware/index.js +53 -12
  33. package/dist/middleware/index.js.map +1 -1
  34. package/dist/middleware/index.mjs +53 -12
  35. package/dist/middleware/index.mjs.map +1 -1
  36. package/dist/nestjs/index.d.cts +5 -4
  37. package/dist/nestjs/index.d.ts +5 -4
  38. package/dist/node/index.d.cts +10 -9
  39. package/dist/node/index.d.ts +10 -9
  40. package/dist/node/index.js +631 -19
  41. package/dist/node/index.js.map +1 -1
  42. package/dist/node/index.mjs +631 -19
  43. package/dist/node/index.mjs.map +1 -1
  44. package/dist/{oidcState-mQLVn3-A.d.cts → oidcState-BFIHt7_Y.d.cts} +29 -7
  45. package/dist/{oidcState-DOSCgnMG.d.ts → oidcState-qoy2vsYG.d.ts} +29 -7
  46. package/dist/rest/index.d.cts +64 -12
  47. package/dist/rest/index.d.ts +64 -12
  48. package/dist/rest/index.js +626 -16
  49. package/dist/rest/index.js.map +1 -1
  50. package/dist/rest/index.mjs +624 -17
  51. package/dist/rest/index.mjs.map +1 -1
  52. package/dist/{revocationFeed-CDoD7Twr.d.cts → revocationFeed-KQhvMMl8.d.cts} +2 -1
  53. package/dist/{revocationFeed-CDoD7Twr.d.ts → revocationFeed-KQhvMMl8.d.ts} +2 -1
  54. package/dist/{session-CeG6P9GO.d.ts → session-BbPFTpMZ.d.ts} +3 -2
  55. package/dist/{session-BmjEMowX.d.cts → session-C9WlP6DV.d.cts} +3 -2
  56. package/dist/{telemetry--0DwnNjV.d.cts → telemetry-Du0-zS5f.d.cts} +2 -1
  57. package/dist/{telemetry--0DwnNjV.d.ts → telemetry-Du0-zS5f.d.ts} +2 -1
  58. package/dist/{webauthnErrors-fLgfOflO.d.cts → webauthnErrors-m1LZiaRy.d.cts} +2 -1
  59. package/dist/{webauthnErrors-fLgfOflO.d.ts → webauthnErrors-m1LZiaRy.d.ts} +2 -1
  60. package/package.json +2 -2
@@ -521,7 +521,7 @@ function protectedResourceMetadata(options) {
521
521
  if (documentation !== void 0) {
522
522
  requireAbsoluteUri(op, "resource_documentation", documentation, LOCATOR);
523
523
  }
524
- const document = Object.freeze({
524
+ const document2 = Object.freeze({
525
525
  resource,
526
526
  authorization_servers: Object.freeze(authorizationServers),
527
527
  ...scopesSupported.length > 0 ? { scopes_supported: Object.freeze(scopesSupported) } : {},
@@ -530,7 +530,7 @@ function protectedResourceMetadata(options) {
530
530
  });
531
531
  const metadataPath = deriveMetadataPath(parsed.path);
532
532
  return Object.freeze({
533
- document,
533
+ document: document2,
534
534
  metadataPath,
535
535
  metadataUrl: `${parsed.scheme}://${parsed.authority}${metadataPath}`
536
536
  });
@@ -1388,6 +1388,24 @@ function retryableNetworkError(message, response) {
1388
1388
  return error;
1389
1389
  }
1390
1390
 
1391
+ // src/rest/interceptors.ts
1392
+ function isOAuth2Endpoint(url, baseUrl) {
1393
+ if (!url) {
1394
+ return false;
1395
+ }
1396
+ try {
1397
+ const base = new URL(baseUrl);
1398
+ let path = new URL(url, base).pathname;
1399
+ const prefix = base.pathname.replace(/\/+$/, "");
1400
+ if (prefix !== "" && path.startsWith(`${prefix}/`)) {
1401
+ path = path.slice(prefix.length);
1402
+ }
1403
+ return path.startsWith("/oauth2/");
1404
+ } catch {
1405
+ return false;
1406
+ }
1407
+ }
1408
+
1391
1409
  // src/rest/retry.ts
1392
1410
  var MAX_ATTEMPTS = 3;
1393
1411
  var BASE_DELAY_MS = 200;
@@ -1543,9 +1561,9 @@ var DiscoveryCache = class {
1543
1561
  if (pending) {
1544
1562
  return pending;
1545
1563
  }
1546
- const fetch = fetcher().then((document) => {
1547
- this.#documents.set(originKey, { document, expiresAt: Date.now() + this.#ttlMs });
1548
- return document;
1564
+ const fetch = fetcher().then((document2) => {
1565
+ this.#documents.set(originKey, { document: document2, expiresAt: Date.now() + this.#ttlMs });
1566
+ return document2;
1549
1567
  }).finally(() => {
1550
1568
  this.#inFlight.delete(originKey);
1551
1569
  });
@@ -2292,9 +2310,21 @@ var OidcClient = class {
2292
2310
  * and obtain the code pair.
2293
2311
  *
2294
2312
  * @remarks
2295
- * **Unauthenticated by design.** A device that cannot show a browser also
2296
- * cannot hold a client secret, so this never sends `client_secret` and never
2297
- * refuses a client built without one (§14.1).
2313
+ * **The client authenticates as it does at every other token request
2314
+ * (contract 1.62, §14.1 rule 2).** A client built with a `clientSecret` sends
2315
+ * it as `client_secret` in the **form body** — never as `Authorization:
2316
+ * Basic`, whatever the client is registered for (§12.1 rule 3 stands for
2317
+ * this route, and the maintainer's 2026-10-16 "same rules" reading fixes the
2318
+ * form body) — and a client with a §6.1 client certificate presents it on the
2319
+ * connection, through the `mtls_endpoint_aliases` entry when discovery
2320
+ * publishes one (§21.3). **A public client sends no credential at all** and
2321
+ * is never refused client-side, so a device that cannot hold a secret still
2322
+ * works. The SDK sends a credential only when its caller configured one: it
2323
+ * never borrows one from another configuration. `private_key_jwt` client
2324
+ * authentication is not implemented by this SDK.
2325
+ *
2326
+ * A `401` with `{"error":"invalid_client"}` is an {@link OAuthProtocolError}
2327
+ * (§14.2 rule 5), is made once, and does not enter the §9 refresh guard.
2298
2328
  */
2299
2329
  async deviceAuthorize(params = {}) {
2300
2330
  const configuration = params.configuration ?? await this.oidcDiscover();
@@ -2306,6 +2336,7 @@ var OidcClient = class {
2306
2336
  }
2307
2337
  const form = new URLSearchParams();
2308
2338
  form.set("client_id", this.#options.clientId);
2339
+ this.#appendClientSecret(form);
2309
2340
  if (params.scope !== void 0) {
2310
2341
  form.set("scope", Array.isArray(params.scope) ? params.scope.join(" ") : params.scope);
2311
2342
  }
@@ -2416,6 +2447,15 @@ var OidcClient = class {
2416
2447
  * {@link OAuthProtocolError} — `authorization_pending` and `slow_down`
2417
2448
  * included — so a hand-rolled loop sees exactly what {@link deviceLogin}
2418
2449
  * sees. Most callers want {@link deviceLogin}.
2450
+ *
2451
+ * Client authentication is the one {@link deviceAuthorize} describes
2452
+ * (contract 1.62, §14.1 rule 2): a configured `clientSecret` is sent as
2453
+ * `client_secret` in the form body, never as `Authorization: Basic`; a public
2454
+ * client sends none; `client_id` is sent on **every** poll (§14.1 rule 3). A
2455
+ * `401 invalid_client` surfaces as {@link OAuthProtocolError}, is not retried
2456
+ * and does not enter the §9 refresh guard (§14.2 rule 5). This SDK ships no
2457
+ * DPoP proof generator, so it cannot drive a client registered for DPoP; it
2458
+ * surfaces that client's refusal as the same `invalid_client`.
2419
2459
  */
2420
2460
  async devicePoll(params) {
2421
2461
  const configuration = params.configuration ?? await this.oidcDiscover();
@@ -2423,6 +2463,7 @@ var OidcClient = class {
2423
2463
  form.set("grant_type", DEVICE_CODE_GRANT_TYPE);
2424
2464
  form.set("device_code", exposeSecret(params.deviceCode));
2425
2465
  form.set("client_id", this.#options.clientId);
2466
+ this.#appendClientSecret(form);
2426
2467
  const wire = await this.#postToken(configuration, form, params.tenantId);
2427
2468
  return this.#toTokenSet(wire, configuration, void 0);
2428
2469
  }
@@ -3340,7 +3381,7 @@ var OidcClient = class {
3340
3381
  this.#session.axios.interceptors.request.use((config) => {
3341
3382
  const adopted = this.#adoptedCredential;
3342
3383
  const url = config.url ?? "";
3343
- if (!adopted || this.#session.isForeignHost(url) || url.includes("/oauth2/")) {
3384
+ if (!adopted || this.#session.isForeignHost(url) || isOAuth2Endpoint(url, this.#session.baseUrl)) {
3344
3385
  return config;
3345
3386
  }
3346
3387
  config.headers = config.headers ?? {};
@@ -3512,11 +3553,11 @@ var RevocationFeed = class _RevocationFeed {
3512
3553
  if (!response.ok) {
3513
3554
  return void 0;
3514
3555
  }
3515
- const document = await response.json();
3516
- if (typeof document !== "object" || document === null) {
3556
+ const document2 = await response.json();
3557
+ if (typeof document2 !== "object" || document2 === null) {
3517
3558
  return void 0;
3518
3559
  }
3519
- const { alg, revoked } = document;
3560
+ const { alg, revoked } = document2;
3520
3561
  if (alg !== SUPPORTED_ALG) {
3521
3562
  return void 0;
3522
3563
  }