SettingsStoreScopeFunction
SettingsStoreScopeFunction
A function that determines how a settings store entry should be scoped. Returns a string that will be used as the scope key for storage isolation.
Example
// User-specific scoping
const userScope: SettingsStoreScopeFunction = ({ ctx }) => ctx.activeUserId || '';
// Channel-specific scoping
const channelScope: SettingsStoreScopeFunction = ({ ctx }) => ctx.channelId || '';
// User and channel scoping
const userAndChannelScope: SettingsStoreScopeFunction = ({ ctx }) =>
`${ctx.activeUserId || ''}:${ctx.channelId || ''}`;
Signature
type SettingsStoreScopeFunction = (params: {
key: string;
value?: any;
ctx: RequestContext;
}) => string