axiam-sdk 1.1.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 +10 -1
  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-Putxo-yi.d.ts → client-BMNQi36J.d.ts} +28 -24
  9. package/dist/{client-7ZKtfXW-.d.cts → client-D34sXV8p.d.cts} +28 -24
  10. package/dist/{cookieJar-DkGcIr-i.d.cts → cookieJar-C_xPuniu.d.cts} +3 -3
  11. package/dist/{cookieJar-Cw6Zdeec.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-VpViVRSx.d.ts → errors-RvGlTyUj.d.cts} +3 -2
  15. package/dist/{errors-CtP_lviy.d.cts → errors-dlGXAsbh.d.ts} +3 -2
  16. package/dist/grpc/index.d.cts +10 -9
  17. package/dist/grpc/index.d.ts +10 -9
  18. package/dist/grpc/index.js +36 -5
  19. package/dist/grpc/index.js.map +1 -1
  20. package/dist/grpc/index.mjs +36 -5
  21. package/dist/grpc/index.mjs.map +1 -1
  22. package/dist/index.d.cts +6 -6
  23. package/dist/index.d.ts +6 -6
  24. package/dist/index.js +36 -5
  25. package/dist/index.js.map +1 -1
  26. package/dist/index.mjs +36 -5
  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 +27 -9
  33. package/dist/middleware/index.js.map +1 -1
  34. package/dist/middleware/index.mjs +27 -9
  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 +37 -6
  41. package/dist/node/index.js.map +1 -1
  42. package/dist/node/index.mjs +37 -6
  43. package/dist/node/index.mjs.map +1 -1
  44. package/dist/{oidcState-Cz6erz0g.d.cts → oidcState-BFIHt7_Y.d.cts} +5 -4
  45. package/dist/{oidcState-zGt6VU6v.d.ts → oidcState-qoy2vsYG.d.ts} +5 -4
  46. package/dist/rest/index.d.cts +10 -9
  47. package/dist/rest/index.d.ts +10 -9
  48. package/dist/rest/index.js +36 -5
  49. package/dist/rest/index.js.map +1 -1
  50. package/dist/rest/index.mjs +36 -5
  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
@@ -1219,6 +1219,9 @@ function installCsrfInterceptor(axiosInstance, session) {
1219
1219
  if (session.isForeignHost(config.url)) {
1220
1220
  return config;
1221
1221
  }
1222
+ if (isOAuth2Endpoint(config.url, session.baseUrl)) {
1223
+ return config;
1224
+ }
1222
1225
  const method = (config.method ?? "get").toLowerCase();
1223
1226
  const cookieString = typeof document !== "undefined" ? document.cookie : "";
1224
1227
  const csrfToken = typeof document !== "undefined" ? csrfHeaderForMethod(method, cookieString) : csrfHeaderForMethod(method, session.csrfToken ? `axiam_csrf=${session.csrfToken}` : "");
@@ -1272,23 +1275,33 @@ function installRefreshInterceptor(axiosInstance, session) {
1272
1275
  }
1273
1276
  );
1274
1277
  }
1275
- function isOAuth2Endpoint(url) {
1278
+ function isOAuth2Endpoint(url, baseUrl) {
1276
1279
  if (!url) {
1277
1280
  return false;
1278
1281
  }
1279
- const path = url.split(/[?#]/, 1)[0] ?? "";
1280
- return path.includes("/oauth2/");
1282
+ try {
1283
+ const base = new URL(baseUrl);
1284
+ let path = new URL(url, base).pathname;
1285
+ const prefix = base.pathname.replace(/\/+$/, "");
1286
+ if (prefix !== "" && path.startsWith(`${prefix}/`)) {
1287
+ path = path.slice(prefix.length);
1288
+ }
1289
+ return path.startsWith("/oauth2/");
1290
+ } catch {
1291
+ return false;
1292
+ }
1281
1293
  }
1282
1294
  function installDeviceTokenInterceptor(axiosInstance, session) {
1283
1295
  axiosInstance.interceptors.request.use((config) => {
1284
1296
  const deviceToken = session.deviceAccessToken;
1285
- if (session.isForeignHost(config.url) || deviceToken === void 0) {
1297
+ const oauth2 = isOAuth2Endpoint(config.url, session.baseUrl);
1298
+ if (session.isForeignHost(config.url) || deviceToken === void 0 && !oauth2) {
1286
1299
  return config;
1287
1300
  }
1288
1301
  const noCred = session.noCredentialsConfig();
1289
1302
  Object.assign(config, noCred);
1290
1303
  config.headers = config.headers ?? {};
1291
- if (isOAuth2Endpoint(config.url)) {
1304
+ if (oauth2) {
1292
1305
  return config;
1293
1306
  }
1294
1307
  config.headers["Authorization"] = `Bearer ${deviceToken.expose()}`;
@@ -3168,6 +3181,11 @@ function validateNetwork(network, problems) {
3168
3181
  problems.push(`network segment ${q(profile.segment)} has more than one profile in the manifest`);
3169
3182
  }
3170
3183
  profiled.add(profile.segment);
3184
+ if (profile.terminationAction === null) {
3185
+ problems.push(
3186
+ `network profile of segment ${q(profile.segment)} states terminationAction as null; it has no "none" in a manifest (leave it out to keep the server default)`
3187
+ );
3188
+ }
3171
3189
  }
3172
3190
  }
3173
3191
  function duplicates(kind, keys, problems) {
@@ -4125,11 +4143,24 @@ function profileDrifted(spec, read) {
4125
4143
  if (spec.serviceType !== void 0 && !sameOptional(spec.serviceType, read.service_type)) return true;
4126
4144
  return false;
4127
4145
  }
4146
+ var KNOWN_TERMINATION_ACTIONS = ["default", "radius_request"];
4147
+ var KNOWN_SERVICE_TYPES = ["framed_user"];
4148
+ function refuseUnknownCarried(member, stated, read, known) {
4149
+ if (stated !== void 0 || read == null || known.includes(read)) return;
4150
+ throw new ValidationError(
4151
+ "manifest.plan",
4152
+ 400,
4153
+ `network profile: ${member} was read as ${JSON.stringify(read)}, a value this SDK does not know, and the manifest does not state it; state ${member} to update this profile (CONTRACT.md \xA727.6.2 item 4)`,
4154
+ [{ field: member, message: `unknown value ${JSON.stringify(read)} on an unstated member` }]
4155
+ );
4156
+ }
4128
4157
  function profileReplaceInput(spec, read) {
4129
4158
  const profile = {
4130
4159
  dictionary: read.dictionary,
4131
4160
  session_timeout_secs: spec.sessionTimeoutSecs
4132
4161
  };
4162
+ refuseUnknownCarried("termination_action", spec.terminationAction, read.termination_action, KNOWN_TERMINATION_ACTIONS);
4163
+ refuseUnknownCarried("service_type", spec.serviceType, read.service_type, KNOWN_SERVICE_TYPES);
4133
4164
  const termination = spec.terminationAction === void 0 ? read.termination_action : spec.terminationAction;
4134
4165
  if (termination != null) profile.termination_action = termination;
4135
4166
  const idle = spec.idleTimeoutSecs === void 0 ? read.idle_timeout_secs : spec.idleTimeoutSecs;