Skip to content
Esc
navigateopen⌘Jpreview
Dashboard
On this page

@supertokens-plugins/user-banning-nodejs

Public root exports for @supertokens-plugins/user-banning-nodejs 0.2.1.

Package version: 0.2.1

Generated from the packed release’s root declaration, ./dist/index.d.ts. Only exports reachable from that root are listed. See the immutable release source.

Public root exports

Export Kind
default Constant
init Constant
PLUGIN_ID Constant

default

Published from the emitted _default declaration.

Root export:

export { PLUGIN_ID, _default as default, init };

Resolved declaration:

import * as _shared_js from '@shared/js';
import * as supertokens_node from 'supertokens-node';
declare const _default: {
    init: (config?: (SuperTokensPluginUserBanningPluginConfig & {
        override?: ((oI: _shared_js.OverridableFunctions<UserBanningService>) => _shared_js.OverridableFunctions<UserBanningService>) | undefined;
    }) | undefined) => supertokens_node.SuperTokensPlugin;
};

init

Root export:

export { PLUGIN_ID, _default as default, init };

Resolved declaration:

import * as _shared_js from '@shared/js';
import { UserContext, SuperTokensPlugin } from 'supertokens-node/types';
declare const init: (config?: (SuperTokensPluginUserBanningPluginConfig & {
    override?: ((oI: _shared_js.OverridableFunctions<UserBanningService>) => _shared_js.OverridableFunctions<UserBanningService>) | undefined;
}) | undefined) => SuperTokensPlugin;

PLUGIN_ID

Root export:

export { PLUGIN_ID, _default as default, init };

Resolved declaration:

declare const PLUGIN_ID = "supertokens-plugin-user-banning";

Required signature types

These declarations are not additional package-root exports. They are included because the public signatures above depend on them.

SuperTokensPluginUserBanningPluginConfig

type SuperTokensPluginUserBanningPluginConfig = {
    userBanningPermission?: string;
    bannedUserRole?: string;
    globalBanning?: boolean;
};

SuperTokensPluginUserBanningPluginNormalisedConfig

type SuperTokensPluginUserBanningPluginNormalisedConfig = {
    userBanningPermission: string;
    bannedUserRole: string;
    globalBanning: boolean;
};

UserBanningService

import { UserContext, SuperTokensPlugin } from 'supertokens-node/types';
declare class UserBanningService {
    protected pluginConfig: SuperTokensPluginUserBanningPluginNormalisedConfig;
    protected cache: Map<string, boolean>;
    protected cachePreLoadPromise: Promise<void> | undefined;
    constructor(pluginConfig: SuperTokensPluginUserBanningPluginNormalisedConfig);
    preLoadCacheIfNeeded: (this: UserBanningService, userContext?: UserContext) => Promise<void>;
    addBanToCache: (this: UserBanningService, tenantId: string, userId: string) => Promise<void>;
    removeBanFromCache: (this: UserBanningService, tenantId: string, userId: string) => Promise<void>;
    getBanStatusFromCache: (this: UserBanningService, tenantId: string, userId: string) => Promise<boolean | undefined>;
    preLoadCache: (this: UserBanningService, userContext?: UserContext) => Promise<void>;
    checkAndAddBannedUserRoleIfNeeded: (this: UserBanningService, userContext?: UserContext) => Promise<{
        status: string;
        message: string;
    } | {
        status: string;
        message?: undefined;
    }>;
    getBanStatus: (this: UserBanningService, tenantId: string, userId: string, userContext?: UserContext) => Promise<{
        status: "OK";
        banned: boolean | undefined;
    } | {
        status: "UNKNOWN_ERROR";
        message: string;
    }>;
    updateSessions: (this: UserBanningService, userId: string, tenantId: string, isBanned: boolean, userContext?: UserContext) => Promise<void>;
    setBanStatusAndUpdateSessions: (this: UserBanningService, tenantId: string, userId: string, isBanned: boolean, userContext?: UserContext) => Promise<{
        status: "OK";
    } | {
        status: "UNKNOWN_ROLE_ERROR";
    } | {
        status: "USER_NOT_FOUND";
    }>;
}

API reference

API schema and response details