@frontmcp/sdk 1.14.0-rc.1 → 1.14.0-rc.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.
@@ -12,6 +12,7 @@ import {
12
12
  InvalidInputError,
13
13
  isPublicError
14
14
  } from "../errors/index.mjs";
15
+ import { STATELESS_SESSION_ID } from "../transport/transport.types.mjs";
15
16
  import { eventSubscriberOf } from "./event-subscriber.mjs";
16
17
  var ANONYMOUS_SUBSCRIBER = { sub: "", roles: [], permissions: [], scopes: [], claims: {} };
17
18
  function offeredEventOf(events, eventName, mode, requestContext, codes) {
@@ -30,10 +31,14 @@ function eventReaderOf(scope, authInfo, eventName, codes) {
30
31
  if (authOptions !== void 0 && !isPublicMode(authOptions)) {
31
32
  throw new EventForbiddenError(codes, eventName, "this server needs a signed-in caller");
32
33
  }
33
- const { sessionId } = authInfo;
34
- const quotaKey = typeof sessionId === "string" && sessionId !== "" ? `session:${sessionId}` : void 0;
34
+ const sessionId = verifiedSessionOf(authInfo);
35
+ const quotaKey = sessionId ? `session:${sessionId}` : void 0;
35
36
  return { principalKey: void 0, ...quotaKey && { quotaKey }, subscriber: ANONYMOUS_SUBSCRIBER };
36
37
  }
38
+ function verifiedSessionOf(authInfo) {
39
+ const recorded = authInfo.extra?.["sessionId"];
40
+ return typeof recorded === "string" && recorded !== "" && recorded !== STATELESS_SESSION_ID ? recorded : void 0;
41
+ }
37
42
  async function assertEventAuthorities(scope, event, authInfo, args, codes) {
38
43
  const engine = scope.authoritiesEngine;
39
44
  const contextBuilder = scope.authoritiesContextBuilder;
package/browser/index.cjs CHANGED
@@ -78516,10 +78516,14 @@ function eventReaderOf(scope, authInfo, eventName, codes) {
78516
78516
  if (authOptions !== void 0 && !(0, import_auth59.isPublicMode)(authOptions)) {
78517
78517
  throw new EventForbiddenError(codes, eventName, "this server needs a signed-in caller");
78518
78518
  }
78519
- const { sessionId } = authInfo;
78520
- const quotaKey = typeof sessionId === "string" && sessionId !== "" ? `session:${sessionId}` : void 0;
78519
+ const sessionId = verifiedSessionOf2(authInfo);
78520
+ const quotaKey = sessionId ? `session:${sessionId}` : void 0;
78521
78521
  return { principalKey: void 0, ...quotaKey && { quotaKey }, subscriber: ANONYMOUS_SUBSCRIBER };
78522
78522
  }
78523
+ function verifiedSessionOf2(authInfo) {
78524
+ const recorded = authInfo.extra?.["sessionId"];
78525
+ return typeof recorded === "string" && recorded !== "" && recorded !== STATELESS_SESSION_ID ? recorded : void 0;
78526
+ }
78523
78527
  async function assertEventAuthorities(scope, event, authInfo, args, codes) {
78524
78528
  const engine = scope.authoritiesEngine;
78525
78529
  const contextBuilder = scope.authoritiesContextBuilder;
@@ -78562,6 +78566,7 @@ var init_event_gates = __esm({
78562
78566
  init_authorities_input();
78563
78567
  init_availability();
78564
78568
  init_errors();
78569
+ init_transport_types();
78565
78570
  init_event_subscriber();
78566
78571
  ANONYMOUS_SUBSCRIBER = { sub: "", roles: [], permissions: [], scopes: [], claims: {} };
78567
78572
  }
@@ -93576,7 +93581,7 @@ var init_worker_lifecycle = __esm({
93576
93581
  });
93577
93582
 
93578
93583
  // libs/sdk/src/provider/provider.registry.ts
93579
- function verifiedSessionOf2(requestContext) {
93584
+ function verifiedSessionOf3(requestContext) {
93580
93585
  const { authInfo } = requestContext;
93581
93586
  const verified = authInfo.sessionId ?? authInfo.extra?.["sessionId"];
93582
93587
  return typeof verified === "string" && verified.length > 0 && verified !== STATELESS_SESSION_ID ? verified : void 0;
@@ -94572,7 +94577,7 @@ var init_provider_registry = __esm({
94572
94577
  if (!(requestContext instanceof FrontMcpContext)) {
94573
94578
  return newProviderStore();
94574
94579
  }
94575
- if (!this.sessionCacheEnabled || verifiedSessionOf2(requestContext) !== sessionKey) {
94580
+ if (!this.sessionCacheEnabled || verifiedSessionOf3(requestContext) !== sessionKey) {
94576
94581
  let stores = requestContext.get(REQUEST_PROVIDER_STORES);
94577
94582
  if (!stores) {
94578
94583
  stores = /* @__PURE__ */ new WeakMap();