---
title: "@supertokens-plugins/user-banning-nodejs"
description: "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](https://github.com/supertokens/supertokens-plugins/blob/%40supertokens-plugins%2Fuser-banning-nodejs%400.2.1/packages/user-banning-nodejs/src/index.ts).

:::caution
This release's declaration graph imports unpublished workspace modules (`@shared/js`). The generator detected these imports from the packed declaration graph and strict compiler diagnostics. This upstream packaging defect cannot be fixed by the reference generator; do not enable `skipLibCheck` to hide it.
:::

## Public root exports

| Export | Kind |
| --- | --- |
| `default` | Constant |
| `init` | Constant |
| `PLUGIN_ID` | Constant |

## `default`

Published from the emitted `_default` declaration.

Root export:

```ts check=false reason="Generated API signature"
export { PLUGIN_ID, _default as default, init };
```

Resolved declaration:

```ts check=false reason="Generated API signature"
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:

```ts check=false reason="Generated API signature"
export { PLUGIN_ID, _default as default, init };
```

Resolved declaration:

```ts check=false reason="Generated API signature"
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:

```ts check=false reason="Generated API signature"
export { PLUGIN_ID, _default as default, init };
```

Resolved declaration:

```ts check=false reason="Generated API signature"
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`

```ts check=false reason="Generated API signature"
type SuperTokensPluginUserBanningPluginConfig = {
    userBanningPermission?: string;
    bannedUserRole?: string;
    globalBanning?: boolean;
};
```

### `SuperTokensPluginUserBanningPluginNormalisedConfig`

```ts check=false reason="Generated API signature"
type SuperTokensPluginUserBanningPluginNormalisedConfig = {
    userBanningPermission: string;
    bannedUserRole: string;
    globalBanning: boolean;
};
```

### `UserBanningService`

```ts check=false reason="Generated API signature"
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";
    }>;
}
```
