UNPKG

scrivito

Version:

Scrivito is a professional, yet easy to use SaaS Enterprise Content Management Service, built for digital agencies and medium to large businesses. It is completely maintenance-free, cost-effective, and has unprecedented performance and security.

30 lines (22 loc) 723 B
import { ScrivitoError, onReset } from 'scrivito_sdk/common'; export const IN_MEMORY_TENANT = 'inMemory'; let inMemoryTenant = false; export function isUsingInMemoryTenant(): boolean { return inMemoryTenant; } export function useInMemoryTenant(): void { inMemoryTenant = true; } export function assertNotUsingInMemoryTenant( operationDescription: string ): void { if (inMemoryTenant) { throw new InMemoryTenantUnsupportedOperationError(operationDescription); } } export class InMemoryTenantUnsupportedOperationError extends ScrivitoError { constructor(description: string) { super(`${description} is not supported when using the in-memory tenant`); } } onReset(() => (inMemoryTenant = false));