/** * Resolve the inbox tenant/org scope from the auth cookies and build the ctx * ({ event, token, scope }) the REST-backed store needs. Inbox rows are filtered * by AD_Org_ID (the token already enforces the client/tenant). */ import type { InboxScope, InboxCtx } from './inboxDb' export const getInboxScope = (event: any): InboxScope & { userId: number } => ({ clientId: Number(getCookie(event, 'logship_client_id') || 0), orgId: Number(getCookie(event, 'logship_organization_id') || 0), userId: Number(getCookie(event, 'logship_user_id') || 0) }) export const buildInboxCtx = (event: any, token: string): InboxCtx => { const s = getInboxScope(event) return { event, token, scope: { clientId: s.clientId, orgId: s.orgId } } } export default getInboxScope