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
@@ -1194,6 +1194,9 @@ function installCsrfInterceptor(axiosInstance, session) {
1194
1194
  if (session.isForeignHost(config.url)) {
1195
1195
  return config;
1196
1196
  }
1197
+ if (isOAuth2Endpoint(config.url, session.baseUrl)) {
1198
+ return config;
1199
+ }
1197
1200
  const method = (config.method ?? "get").toLowerCase();
1198
1201
  const cookieString = typeof document !== "undefined" ? document.cookie : "";
1199
1202
  const csrfToken = typeof document !== "undefined" ? csrfHeaderForMethod(method, cookieString) : csrfHeaderForMethod(method, session.csrfToken ? `axiam_csrf=${session.csrfToken}` : "");
@@ -1247,23 +1250,33 @@ function installRefreshInterceptor(axiosInstance, session) {
1247
1250
  }
1248
1251
  );
1249
1252
  }
1250
- function isOAuth2Endpoint(url) {
1253
+ function isOAuth2Endpoint(url, baseUrl) {
1251
1254
  if (!url) {
1252
1255
  return false;
1253
1256
  }
1254
- const path = url.split(/[?#]/, 1)[0] ?? "";
1255
- return path.includes("/oauth2/");
1257
+ try {
1258
+ const base = new URL(baseUrl);
1259
+ let path = new URL(url, base).pathname;
1260
+ const prefix = base.pathname.replace(/\/+$/, "");
1261
+ if (prefix !== "" && path.startsWith(`${prefix}/`)) {
1262
+ path = path.slice(prefix.length);
1263
+ }
1264
+ return path.startsWith("/oauth2/");
1265
+ } catch {
1266
+ return false;
1267
+ }
1256
1268
  }
1257
1269
  function installDeviceTokenInterceptor(axiosInstance, session) {
1258
1270
  axiosInstance.interceptors.request.use((config) => {
1259
1271
  const deviceToken = session.deviceAccessToken;
1260
- if (session.isForeignHost(config.url) || deviceToken === void 0) {
1272
+ const oauth2 = isOAuth2Endpoint(config.url, session.baseUrl);
1273
+ if (session.isForeignHost(config.url) || deviceToken === void 0 && !oauth2) {
1261
1274
  return config;
1262
1275
  }
1263
1276
  const noCred = session.noCredentialsConfig();
1264
1277
  Object.assign(config, noCred);
1265
1278
  config.headers = config.headers ?? {};
1266
- if (isOAuth2Endpoint(config.url)) {
1279
+ if (oauth2) {
1267
1280
  return config;
1268
1281
  }
1269
1282
  config.headers["Authorization"] = `Bearer ${deviceToken.expose()}`;
@@ -3143,6 +3156,11 @@ function validateNetwork(network, problems) {
3143
3156
  problems.push(`network segment ${q(profile.segment)} has more than one profile in the manifest`);
3144
3157
  }
3145
3158
  profiled.add(profile.segment);
3159
+ if (profile.terminationAction === null) {
3160
+ problems.push(
3161
+ `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)`
3162
+ );
3163
+ }
3146
3164
  }
3147
3165
  }
3148
3166
  function duplicates(kind, keys, problems) {
@@ -4100,11 +4118,24 @@ function profileDrifted(spec, read) {
4100
4118
  if (spec.serviceType !== void 0 && !sameOptional(spec.serviceType, read.service_type)) return true;
4101
4119
  return false;
4102
4120
  }
4121
+ var KNOWN_TERMINATION_ACTIONS = ["default", "radius_request"];
4122
+ var KNOWN_SERVICE_TYPES = ["framed_user"];
4123
+ function refuseUnknownCarried(member, stated, read, known) {
4124
+ if (stated !== void 0 || read == null || known.includes(read)) return;
4125
+ throw new ValidationError(
4126
+ "manifest.plan",
4127
+ 400,
4128
+ `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)`,
4129
+ [{ field: member, message: `unknown value ${JSON.stringify(read)} on an unstated member` }]
4130
+ );
4131
+ }
4103
4132
  function profileReplaceInput(spec, read) {
4104
4133
  const profile = {
4105
4134
  dictionary: read.dictionary,
4106
4135
  session_timeout_secs: spec.sessionTimeoutSecs
4107
4136
  };
4137
+ refuseUnknownCarried("termination_action", spec.terminationAction, read.termination_action, KNOWN_TERMINATION_ACTIONS);
4138
+ refuseUnknownCarried("service_type", spec.serviceType, read.service_type, KNOWN_SERVICE_TYPES);
4108
4139
  const termination = spec.terminationAction === void 0 ? read.termination_action : spec.terminationAction;
4109
4140
  if (termination != null) profile.termination_action = termination;
4110
4141
  const idle = spec.idleTimeoutSecs === void 0 ? read.idle_timeout_secs : spec.idleTimeoutSecs;