@supertokens-plugins/tenants-nodejs
Public root exports for @supertokens-plugins/tenants-nodejs 0.2.0.
Package version: 0.2.0
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 |
|---|---|
assignAdminToUserInTenant |
Constant |
assignRoleToUserInTenant |
Constant |
AssociateAllLoginMethodsOfUserWithTenant |
Type |
default |
Constant |
GetAppUrl |
Type |
GetUserIdsInTenantWithRole |
Type |
init |
Constant |
PLUGIN_ID |
Constant |
PluginEmailDeliveryInput |
Type |
PluginSMTPService |
Class |
SendPluginEmail |
Type |
SuperTokensPluginTenantPluginConfig |
Type |
assignAdminToUserInTenant
Root export:
export { type AssociateAllLoginMethodsOfUserWithTenant, type GetAppUrl, type GetUserIdsInTenantWithRole, PLUGIN_ID, type PluginEmailDeliveryInput, PluginSMTPService, type SendPluginEmail, type SuperTokensPluginTenantPluginConfig, assignAdminToUserInTenant, assignRoleToUserInTenant, _default as default, init };
Resolved declaration:
declare const assignAdminToUserInTenant: (tenantId: string, userId: string) => Promise<void>;
assignRoleToUserInTenant
Root export:
export { type AssociateAllLoginMethodsOfUserWithTenant, type GetAppUrl, type GetUserIdsInTenantWithRole, PLUGIN_ID, type PluginEmailDeliveryInput, PluginSMTPService, type SendPluginEmail, type SuperTokensPluginTenantPluginConfig, assignAdminToUserInTenant, assignRoleToUserInTenant, _default as default, init };
Resolved declaration:
declare const assignRoleToUserInTenant: (tenantId: string, userId: string, role: string) => Promise<void>;
AssociateAllLoginMethodsOfUserWithTenant
Root export:
export { type AssociateAllLoginMethodsOfUserWithTenant, type GetAppUrl, type GetUserIdsInTenantWithRole, PLUGIN_ID, type PluginEmailDeliveryInput, PluginSMTPService, type SendPluginEmail, type SuperTokensPluginTenantPluginConfig, assignAdminToUserInTenant, assignRoleToUserInTenant, _default as default, init };
Resolved declaration:
import { LoginMethod } from 'supertokens-node/lib/build/user';
type AssociateAllLoginMethodsOfUserWithTenant = (tenantId: string, userId: string, loginMethodFilter?: (loginMethod: LoginMethod) => boolean) => Promise<void>;
default
Published from the emitted _default declaration.
Root export:
export { type AssociateAllLoginMethodsOfUserWithTenant, type GetAppUrl, type GetUserIdsInTenantWithRole, PLUGIN_ID, type PluginEmailDeliveryInput, PluginSMTPService, type SendPluginEmail, type SuperTokensPluginTenantPluginConfig, assignAdminToUserInTenant, assignRoleToUserInTenant, _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?: (SuperTokensPluginTenantPluginConfig & {
override?: ((oI: _shared_js.OverridableFunctions<OverrideableTenantFunctionImplementation>) => _shared_js.OverridableFunctions<OverrideableTenantFunctionImplementation>) | undefined;
}) | undefined) => supertokens_node.SuperTokensPlugin;
SMTPService: typeof PluginSMTPService;
};
GetAppUrl
Root export:
export { type AssociateAllLoginMethodsOfUserWithTenant, type GetAppUrl, type GetUserIdsInTenantWithRole, PLUGIN_ID, type PluginEmailDeliveryInput, PluginSMTPService, type SendPluginEmail, type SuperTokensPluginTenantPluginConfig, assignAdminToUserInTenant, assignRoleToUserInTenant, _default as default, init };
Resolved declaration:
import { User, UserContext, NormalisedAppinfo, SuperTokensPlugin } from 'supertokens-node/types';
import { BaseRequest } from 'supertokens-node/lib/build/framework/index';
type GetAppUrl = (appInfo: NormalisedAppinfo, request: BaseRequest | undefined, userContext: UserContext) => string;
GetUserIdsInTenantWithRole
Root export:
export { type AssociateAllLoginMethodsOfUserWithTenant, type GetAppUrl, type GetUserIdsInTenantWithRole, PLUGIN_ID, type PluginEmailDeliveryInput, PluginSMTPService, type SendPluginEmail, type SuperTokensPluginTenantPluginConfig, assignAdminToUserInTenant, assignRoleToUserInTenant, _default as default, init };
Resolved declaration:
type GetUserIdsInTenantWithRole = (tenantId: string, role: string) => Promise<string[]>;
init
Root export:
export { type AssociateAllLoginMethodsOfUserWithTenant, type GetAppUrl, type GetUserIdsInTenantWithRole, PLUGIN_ID, type PluginEmailDeliveryInput, PluginSMTPService, type SendPluginEmail, type SuperTokensPluginTenantPluginConfig, assignAdminToUserInTenant, assignRoleToUserInTenant, _default as default, init };
Resolved declaration:
import * as _shared_js from '@shared/js';
import { User, UserContext, NormalisedAppinfo, SuperTokensPlugin } from 'supertokens-node/types';
declare const init: (config?: (SuperTokensPluginTenantPluginConfig & {
override?: ((oI: _shared_js.OverridableFunctions<OverrideableTenantFunctionImplementation>) => _shared_js.OverridableFunctions<OverrideableTenantFunctionImplementation>) | undefined;
}) | undefined) => SuperTokensPlugin;
PLUGIN_ID
Root export:
export { type AssociateAllLoginMethodsOfUserWithTenant, type GetAppUrl, type GetUserIdsInTenantWithRole, PLUGIN_ID, type PluginEmailDeliveryInput, PluginSMTPService, type SendPluginEmail, type SuperTokensPluginTenantPluginConfig, assignAdminToUserInTenant, assignRoleToUserInTenant, _default as default, init };
Resolved declaration:
declare const PLUGIN_ID = "supertokens-plugin-tenants";
PluginEmailDeliveryInput
Root export:
export { type AssociateAllLoginMethodsOfUserWithTenant, type GetAppUrl, type GetUserIdsInTenantWithRole, PLUGIN_ID, type PluginEmailDeliveryInput, PluginSMTPService, type SendPluginEmail, type SuperTokensPluginTenantPluginConfig, assignAdminToUserInTenant, assignRoleToUserInTenant, _default as default, init };
Resolved declaration:
type PluginEmailDeliveryInput = {
type: "TENANT_REQUEST_APPROVAL";
email: string;
tenantId: string;
senderEmail: string;
customData?: Record<string, any>;
appUrl: string;
} | {
type: "TENANT_CREATE_APPROVAL";
email: string;
tenantId: string;
creatorEmail: string;
customData?: Record<string, any>;
appUrl: string;
};
PluginSMTPService
Root export:
export { type AssociateAllLoginMethodsOfUserWithTenant, type GetAppUrl, type GetUserIdsInTenantWithRole, PLUGIN_ID, type PluginEmailDeliveryInput, PluginSMTPService, type SendPluginEmail, type SuperTokensPluginTenantPluginConfig, assignAdminToUserInTenant, assignRoleToUserInTenant, _default as default, init };
Resolved declaration:
import { User, UserContext, NormalisedAppinfo, SuperTokensPlugin } from 'supertokens-node/types';
declare class PluginSMTPService implements EmailDeliveryInterface<PluginEmailDeliveryInput> {
constructor(config: {
smtpSettings: {
host: string;
port: number;
secure?: boolean;
authUsername?: string;
password: string;
from: {
name: string;
email: string;
};
};
});
sendEmail: (input: PluginEmailDeliveryInput & {
userContext: UserContext;
}) => Promise<void>;
}
SendPluginEmail
Root export:
export { type AssociateAllLoginMethodsOfUserWithTenant, type GetAppUrl, type GetUserIdsInTenantWithRole, PLUGIN_ID, type PluginEmailDeliveryInput, PluginSMTPService, type SendPluginEmail, type SuperTokensPluginTenantPluginConfig, assignAdminToUserInTenant, assignRoleToUserInTenant, _default as default, init };
Resolved declaration:
import { User, UserContext, NormalisedAppinfo, SuperTokensPlugin } from 'supertokens-node/types';
type SendPluginEmail = (input: PluginEmailDeliveryInput, userContext: UserContext) => Promise<void>;
SuperTokensPluginTenantPluginConfig
Root export:
export { type AssociateAllLoginMethodsOfUserWithTenant, type GetAppUrl, type GetUserIdsInTenantWithRole, PLUGIN_ID, type PluginEmailDeliveryInput, PluginSMTPService, type SendPluginEmail, type SuperTokensPluginTenantPluginConfig, assignAdminToUserInTenant, assignRoleToUserInTenant, _default as default, init };
Resolved declaration:
import { EmailDeliveryInterface } from 'supertokens-node/lib/build/ingredients/emaildelivery/types';
type SuperTokensPluginTenantPluginConfig = {
requireNonPublicTenantAssociation?: boolean;
requireTenantCreationRequestApproval?: boolean;
enableTenantListAPI?: boolean;
createRolesOnInit?: boolean;
allowPublicTenantAccess?: boolean;
emailDelivery?: {
service?: EmailDeliveryInterface<PluginEmailDeliveryInput>;
override?: (originalImplementation: EmailDeliveryInterface<PluginEmailDeliveryInput>) => EmailDeliveryInterface<PluginEmailDeliveryInput>;
};
};
Required signature types
These declarations are not additional package-root exports. They are included because the public signatures above depend on them.
ErrorResponse
type ErrorResponse = {
status: "ERROR";
message: string;
};
MetadataType
import { pluginUserMetadata } from '@shared/nodejs';
type MetadataType = ReturnType<typeof pluginUserMetadata<TenantMetadata>>;
OverrideableTenantFunctionImplementation
import { SessionContainerInterface } from 'supertokens-node/recipe/session/types';
import { TenantList, TenantCreationRequest, InviteeDetails, TenantCreationRequestWithUser } from '@shared/tenants';
import { User, UserContext, NormalisedAppinfo, SuperTokensPlugin } from 'supertokens-node/types';
type OverrideableTenantFunctionImplementation = {
getTenants: (session: SessionContainerInterface | string) => Promise<({
status: "OK";
} & TenantList) | ErrorResponse>;
isAllowedToJoinTenant: (targetUser: User, session: SessionContainerInterface) => Promise<boolean>;
isAllowedToCreateTenant: (session: SessionContainerInterface) => Promise<boolean>;
doesTenantCreationRequireApproval: (session: SessionContainerInterface) => Promise<boolean>;
canCreateInvitation: (email: string, role: string, tenantId: string, session: SessionContainerInterface) => Promise<boolean>;
canApproveJoinRequest: (targetUser: User, tenantId: string, session: SessionContainerInterface) => Promise<boolean>;
canApproveTenantCreationRequest: (targetUser: User, creationRequest: TenantCreationRequest, session: SessionContainerInterface) => Promise<boolean>;
canRemoveTargetUserFromTenant: (targetUser: User, tenantId: string, session: SessionContainerInterface) => Promise<boolean>;
createTenantAndAssignAdmin: (tenantDetails: {
name: string;
firstFactors?: string[] | null;
}, userId: string) => Promise<{
status: "OK";
createdNew: boolean;
} | ErrorResponse>;
getTenantUsers: (tenantId: string) => Promise<{
status: "OK";
users: (User & {
roles?: string[];
})[];
} | ErrorResponse>;
addInvitation: (email: string, tenantId: string, role: string, metadata: MetadataType) => Promise<{
status: "OK";
code: string;
} | ErrorResponse>;
removeInvitation: (email: string, tenantId: string, metadata: MetadataType) => Promise<{
status: "OK";
} | ErrorResponse>;
acceptInvitation: (code: string, tenantId: string, session: SessionContainerInterface, metadata: MetadataType) => Promise<{
status: "OK";
} | ErrorResponse>;
getInvitations: (tenantId: string, metadata: MetadataType) => Promise<{
status: "OK";
invitees: InviteeDetails[];
} | ErrorResponse>;
associateAllLoginMethodsOfUserWithTenant: AssociateAllLoginMethodsOfUserWithTenant;
addTenantCreationRequest: (session: SessionContainerInterface, tenantDetails: {
name: string;
firstFactors?: string[] | null;
}, metadata: TenantCreationRequestMetadataType, appUrl: string, userContext: UserContext, sendEmail: SendPluginEmail) => Promise<{
status: "OK";
} | ErrorResponse>;
getTenantCreationRequests: (metadata: TenantCreationRequestMetadataType, userContext: UserContext) => Promise<({
status: "OK";
} & {
requests: TenantCreationRequestWithUser[];
}) | ErrorResponse>;
acceptTenantCreationRequest: (requestId: string, session: SessionContainerInterface, metadata: TenantCreationRequestMetadataType) => Promise<{
status: "OK";
} | ErrorResponse>;
rejectTenantCreationRequest: (requestId: string, session: SessionContainerInterface, metadata: TenantCreationRequestMetadataType) => Promise<{
status: "OK";
} | ErrorResponse>;
sendTenantCreationRequestEmail: (tenantId: string, creatorEmail: string, appUrl: string, userContext: UserContext, sendEmail: SendPluginEmail) => Promise<void>;
getAppUrl: GetAppUrl;
rejectRequestToJoinTenant: (tenantId: string, userId: string) => Promise<{
status: "OK";
} | ErrorResponse>;
doesUserHaveTenantCreationRequest: (userId: string, metadata: TenantCreationRequestMetadataType) => Promise<boolean>;
getPreferredTenantId: (tenantIds: string[], inputTenantId: string) => string | undefined;
assignRoleToUserInTenant: (tenantId: string, userId: string, role: string) => Promise<void>;
shouldHaveTenantAccess: (userId: string, tenantId: string, userContext: UserContext) => Promise<{
canAccess: boolean;
reason?: string;
}>;
};
TenantCreationRequestMetadataType
import { pluginUserMetadata } from '@shared/nodejs';
type TenantCreationRequestMetadataType = ReturnType<typeof pluginUserMetadata<TenantCreationRequestMetadata>>;