Skip to content

sdk/StudioCMSVirtualCache

Defined in: studiocms/packages/studiocms/src/sdk/StudioCMSVirtualCache.ts:35

The StudioCMSVirtualCache class provides caching utilities for the StudioCMS SDK. It supports caching for site configurations, versions, and page data.

This class handles caching operations for the StudioCMS SDK, including fetching, updating, and clearing cache entries for site configurations, versions, and page data.

The configuration for the cache.

The StudioCMS SDK instance.

new StudioCMSVirtualCache(cacheConfig: {
enabled: boolean;
lifetime: number;
}, sdkCore: {
addPageToFolderTree: (tree: FolderNode[], folderId: string, newPage: FolderNode) => FolderNode[];
AUTH: {
oAuth: {
create: (data: {
provider: string;
providerUserId: string;
userId: string;
}) => Promise<{
provider: string;
providerUserId: string;
userId: string;
}>;
delete: (userId: string, provider: string) => Promise<DeletionResponse>;
searchProvidersForId: (providerId: string, userId: string) => Promise<
| undefined
| {
provider: string;
providerUserId: string;
userId: string;
}>;
};
permission: {
currentStatus: (userId: string) => Promise<
| undefined
| {
rank: string;
user: string;
}>;
};
session: {
create: (data: {
expiresAt: Date;
id: string;
userId: string;
}) => Promise<{
expiresAt: Date;
id: string;
userId: string;
}>;
delete: (sessionId: string) => Promise<DeletionResponse>;
sessionWithUser: (sessionId: string) => Promise<{
session: {
expiresAt: Date;
id: string;
userId: string;
};
user: {
avatar: null | string;
createdAt: null | Date;
email: null | string;
id: string;
name: string;
password: null | string;
updatedAt: null | Date;
url: null | string;
username: string;
};
}[]>;
update: (sessionId: string, newDate: Date) => Promise<{
expiresAt: Date;
id: string;
userId: string;
}[]>;
};
user: {
create: (newUserData: {
avatar: null | string;
createdAt: null | Date;
email: null | string;
id: string;
name: string;
password: null | string;
updatedAt: null | Date;
url: null | string;
username: string;
}, rank?: "visitor" | "editor" | "admin" | "owner") => Promise<{
avatar: null | string;
createdAt: null | Date;
email: null | string;
id: string;
name: string;
password: null | string;
updatedAt: null | Date;
url: null | string;
username: string;
}>;
ghost: {
create: () => Promise<any>;
get: () => Promise<any>;
verifyExists: () => Promise<boolean>;
};
searchUsersForUsernameOrEmail: (username: string, email: string) => Promise<{
emailSearch: {
avatar: null | string;
createdAt: null | Date;
email: null | string;
id: string;
name: string;
password: null | string;
updatedAt: null | Date;
url: null | string;
username: string;
}[];
usernameSearch: {
avatar: null | string;
createdAt: null | Date;
email: null | string;
id: string;
name: string;
password: null | string;
updatedAt: null | Date;
url: null | string;
username: string;
}[];
}>;
update: (userId: string, userData: Partial) => Promise<{
avatar: null | string;
createdAt: null | Date;
email: null | string;
id: string;
name: string;
password: null | string;
updatedAt: null | Date;
url: null | string;
username: string;
}>;
};
};
buildFolderTree: () => Promise<FolderNode[]>;
clearUserReferences: (userId: string) => Promise<boolean>;
collectCategories: (categoryIds: number[]) => Promise<{
description: string;
id: number;
meta: unknown;
name: string;
parent: null | number;
slug: string;
}[]>;
collectPageData: (page: {
authorId: null | string;
categories: unknown;
contentLang: string;
contributorIds: unknown;
description: string;
draft: null | boolean;
heroImage: string;
id: string;
package: string;
parentFolder: null | string;
publishedAt: Date;
showAuthor: null | boolean;
showContributors: null | boolean;
showOnNav: boolean;
slug: string;
tags: unknown;
title: string;
updatedAt: null | Date;
}, tree: FolderNode[]) => Promise<CombinedPageData>;
collectTags: (tagIds: number[]) => Promise<{
description: string;
id: number;
meta: unknown;
name: string;
slug: string;
}[]>;
collectUserData: (user: {
avatar: null | string;
createdAt: null | Date;
email: null | string;
id: string;
name: string;
password: null | string;
updatedAt: null | Date;
url: null | string;
username: string;
}) => Promise<CombinedUserData>;
combineRanks: (rank: string, users: SingleRank[]) => CombinedRank[];
db: any;
DELETE: {
categories: (id: number) => Promise<DeletionResponse>;
diffTracking: (id: string) => Promise<DeletionResponse>;
folder: (id: string) => Promise<DeletionResponse>;
page: (id: string) => Promise<DeletionResponse>;
pageContent: (id: string) => Promise<DeletionResponse>;
pageContentLang: (id: string, lang: string) => Promise<DeletionResponse>;
permissions: (userId: string) => Promise<DeletionResponse>;
tags: (id: number) => Promise<DeletionResponse>;
user: (id: string) => Promise<DeletionResponse>;
};
diffTracking: {
clear: (pageId: string) => Promise<void>;
get: {
byPageId: {
all: (pageId: string) => Promise<any>;
latest: (pageId: string, count: number) => Promise<any>;
};
byUserId: {
all: (userId: string) => Promise<any>;
latest: (userId: string, count: number) => Promise<any>;
};
single: (id: string) => Promise<any>;
withHtml: (id: string, options?: any) => Promise<any>;
};
insert: (userId: string, pageId: string, data: {
content: {
end: string;
start: string;
};
metaData: {
end: Partial<{
authorId: null | string;
categories: unknown;
contentLang: string;
contributorIds: unknown;
description: string;
draft: null | boolean;
heroImage: string;
id: string;
package: string;
parentFolder: null | string;
publishedAt: Date;
showAuthor: null | boolean;
showContributors: null | boolean;
showOnNav: boolean;
slug: string;
tags: unknown;
title: string;
updatedAt: null | Date;
}>;
start: Partial<{
authorId: null | string;
categories: unknown;
contentLang: string;
contributorIds: unknown;
description: string;
draft: null | boolean;
heroImage: string;
id: string;
package: string;
parentFolder: null | string;
publishedAt: Date;
showAuthor: null | boolean;
showContributors: null | boolean;
showOnNav: boolean;
slug: string;
tags: unknown;
title: string;
updatedAt: null | Date;
}>;
};
}, diffLength: number) => Promise<any>;
revertToDiff: (id: string, type: "content" | "data" | "both") => Promise<any>;
};
findNodeById: (tree: FolderNode[], id: string) => null | FolderNode;
findNodeByPath: (tree: FolderNode[], path: string[]) => null | FolderNode;
findNodesAlongPath: (tree: FolderNode[], path: string[]) => FolderNode[];
generateRandomIDNumber: (length: number) => number;
generateRandomPassword: (length: number) => string;
generateToken: (userId: string) => string;
GET: {
database: {
config: () => Promise<
| undefined
| {
defaultOgImage: null | string;
description: string;
diffPerPage: number;
enableDiffs: boolean;
gridItems: unknown;
id: number;
loginPageBackground: string;
loginPageCustomImage: null | string;
siteIcon: null | string;
title: string;
}>;
folders: () => Promise<{
id: string;
name: string;
parent: null | string;
}[]>;
pages: (includeDrafts: boolean, tree?: FolderNode[]) => Promise<CombinedPageData[]>;
users: () => Promise<CombinedUserData[]>;
};
databaseEntry: {
folder: (id: string) => Promise<
| undefined
| {
id: string;
name: string;
parent: null | string;
}>;
pages: {
byId: (id: string, tree?: FolderNode[]) => Promise<
| undefined
| CombinedPageData>;
bySlug: (slug: string, tree?: FolderNode[]) => Promise<
| undefined
| CombinedPageData>;
};
users: {
byEmail: (email: string) => Promise<
| undefined
| CombinedUserData>;
byId: (id: string) => Promise<
| undefined
| CombinedUserData>;
byUsername: (username: string) => Promise<
| undefined
| CombinedUserData>;
};
};
databaseTable: {
diffTracking: () => Promise<any>;
oAuthAccounts: () => Promise<any>;
pageContent: () => Promise<any>;
pageData: () => Promise<any>;
pageDataCategories: () => Promise<any>;
pageDataTags: () => Promise<any>;
pageFolderStructure: () => Promise<any>;
permissions: () => Promise<any>;
sessionTable: () => Promise<any>;
siteConfig: () => Promise<any>;
users: () => Promise<any>;
};
packagePages: (packageName: string, tree?: FolderNode[]) => Promise<CombinedPageData[]>;
permissionsLists: {
admins: () => Promise<SingleRank[]>;
all: () => Promise<CombinedRank[]>;
editors: () => Promise<SingleRank[]>;
owners: () => Promise<SingleRank[]>;
visitors: () => Promise<SingleRank[]>;
};
};
getAvailableFolders: () => Promise<FolderListItem[]>;
getFullPath: (tree: FolderNode[], path: string[]) => string[];
INIT: {
ghostUser: () => Promise<{
avatar: null | string;
createdAt: null | Date;
email: null | string;
id: string;
name: string;
password: null | string;
updatedAt: null | Date;
url: null | string;
username: string;
}>;
siteConfig: (config: {
defaultOgImage: null | string;
description: string;
diffPerPage: number;
enableDiffs: boolean;
gridItems: unknown;
id: number;
loginPageBackground: string;
loginPageCustomImage: null | string;
siteIcon: null | string;
title: string;
}) => Promise<{
defaultOgImage: null | string;
description: string;
diffPerPage: number;
enableDiffs: boolean;
gridItems: unknown;
id: number;
loginPageBackground: string;
loginPageCustomImage: null | string;
siteIcon: null | string;
title: string;
}>;
};
parseIdNumberArray: (ids: unknown) => number[];
parseIdStringArray: (ids: unknown) => string[];
POST: {
databaseEntries: {
categories: (data: {
description: string;
id: number;
meta: unknown;
name: string;
parent: null | number;
slug: string;
}[]) => Promise<PageDataCategoriesInsertResponse[]>;
pages: (pages: MultiPageInsert) => Promise<void>;
permissions: (data: {
rank: string;
user: string;
}[]) => Promise<{
rank: string;
user: string;
}[]>;
tags: (data: {
description: string;
id: number;
meta: unknown;
name: string;
slug: string;
}[]) => Promise<PageDataTagsInsertResponse[]>;
};
databaseEntry: {
categories: (category: {
description: string;
id: number;
meta: unknown;
name: string;
parent: null | number;
slug: string;
}) => Promise<any>;
diffTracking: (diff: {
diff: null | string;
id: string;
pageContentStart: string;
pageId: string;
pageMetaData: unknown;
timestamp: null | Date;
userId: string;
}) => Promise<{
diff: null | string;
id: string;
pageContentStart: string;
pageId: string;
pageMetaData: unknown;
timestamp: null | Date;
userId: string;
}[]>;
folder: (folder: {
id: string;
name: string;
parent: null | string;
}) => Promise<{
id: string;
name: string;
parent: null | string;
}[]>;
pageContent: (pageContent: {
content: null | string;
contentId: string;
contentLang: string;
id: string;
}) => Promise<PageContentReturnId[]>;
pages: (pageData: {
authorId: null | string;
categories: unknown;
contentLang: string;
contributorIds: unknown;
description: string;
draft: null | boolean;
heroImage: string;
id: string;
package: string;
parentFolder: null | string;
publishedAt: Date;
showAuthor: null | boolean;
showContributors: null | boolean;
showOnNav: boolean;
slug: string;
tags: unknown;
title: string;
updatedAt: null | Date;
}, pageContent: CombinedInsertContent) => Promise<addDatabaseEntryInsertPage>;
permissions: (userId: string, rank: string) => Promise<{
rank: string;
user: string;
}[]>;
tags: (tag: {
description: string;
id: number;
meta: unknown;
name: string;
slug: string;
}) => Promise<PageDataTagsInsertResponse[]>;
};
};
resetTokenBucket: {
check: (token: string) => Promise<boolean>;
delete: (userId: string) => Promise<void>;
new: (userId: string) => Promise<any>;
};
REST_API: {
tokens: {
delete: (userId: string, tokenId: string) => Promise<void>;
get: (userId: string) => Promise<any>;
new: (userId: string, description: string) => Promise<any>;
verify: (key: string) => Promise<
| false
| {
key: any;
rank: any;
userId: any;
}>;
};
};
testToken: (token: string) => any;
UPDATE: {
categories: (data: {
description: string;
id: number;
meta: unknown;
name: string;
parent: null | number;
slug: string;
}) => Promise<{
description: string;
id: number;
meta: unknown;
name: string;
parent: null | number;
slug: string;
}>;
folder: (data: {
id: string;
name: string;
parent: null | string;
}) => Promise<{
id: string;
name: string;
parent: null | string;
}>;
page: (data: {
authorId: null | string;
categories: unknown;
contentLang: string;
contributorIds: unknown;
description: string;
draft: null | boolean;
heroImage: string;
id: string;
package: string;
parentFolder: null | string;
publishedAt: Date;
showAuthor: null | boolean;
showContributors: null | boolean;
showOnNav: boolean;
slug: string;
tags: unknown;
title: string;
updatedAt: null | Date;
}) => Promise<{
authorId: null | string;
categories: unknown;
contentLang: string;
contributorIds: unknown;
description: string;
draft: null | boolean;
heroImage: string;
id: string;
package: string;
parentFolder: null | string;
publishedAt: Date;
showAuthor: null | boolean;
showContributors: null | boolean;
showOnNav: boolean;
slug: string;
tags: unknown;
title: string;
updatedAt: null | Date;
}>;
pageContent: (data: {
content: null | string;
contentId: string;
contentLang: string;
id: string;
}) => Promise<{
content: null | string;
contentId: string;
contentLang: string;
id: string;
}>;
permissions: (data: {
rank: string;
user: string;
}) => Promise<{
rank: string;
user: string;
}>;
siteConfig: (data: {
defaultOgImage: null | string;
description: string;
diffPerPage: number;
enableDiffs: boolean;
gridItems: unknown;
id: number;
loginPageBackground: string;
loginPageCustomImage: null | string;
siteIcon: null | string;
title: string;
}) => Promise<{
defaultOgImage: null | string;
description: string;
diffPerPage: number;
enableDiffs: boolean;
gridItems: unknown;
id: number;
loginPageBackground: string;
loginPageCustomImage: null | string;
siteIcon: null | string;
title: string;
}>;
tags: (data: {
description: string;
id: number;
meta: unknown;
name: string;
slug: string;
}) => Promise<{
description: string;
id: number;
meta: unknown;
name: string;
slug: string;
}>;
};
verifyRank: (users: {
avatar: null | string;
createdAt: null | Date;
email: null | string;
id: string;
name: string;
password: null | string;
updatedAt: null | Date;
url: null | string;
username: string;
}[], permissions: {
rank: string;
user: string;
}[], rank: string) => SingleRank[];
}): StudioCMSVirtualCache

Defined in: studiocms/packages/studiocms/src/sdk/StudioCMSVirtualCache.ts:103

boolean = ...

Cache Enabled

Default

true

number = ...

Cache Lifetime

{number}{unit} - e.g. ‘5m’ for 5 minutes or ‘1h’ for 1 hour

Default

'5m'

(tree: FolderNode[], folderId: string, newPage: FolderNode) => FolderNode[]

{ oAuth: { create: (data: { provider: string; providerUserId: string; userId: string; }) => Promise<{ provider: string; providerUserId: string; userId: string; }>; delete: (userId: string, provider: string) => Promise<DeletionResponse>; searchProvidersForId: (providerId: string, userId: string) => Promise< | undefined | { provider: string; providerUserId: string; userId: string; }>; }; permission: { currentStatus: (userId: string) => Promise< | undefined | { rank: string; user: string; }>; }; session: { create: (data: { expiresAt: Date; id: string; userId: string; }) => Promise<{ expiresAt: Date; id: string; userId: string; }>; delete: (sessionId: string) => Promise<DeletionResponse>; sessionWithUser: (sessionId: string) => Promise<{ session: { expiresAt: Date; id: string; userId: string; }; user: { avatar: null | string; createdAt: null | Date; email: null | string; id: string; name: string; password: null | string; updatedAt: null | Date; url: null | string; username: string; }; }[]>; update: (sessionId: string, newDate: Date) => Promise<{ expiresAt: Date; id: string; userId: string; }[]>; }; user: { create: (newUserData: { avatar: null | string; createdAt: null | Date; email: null | string; id: string; name: string; password: null | string; updatedAt: null | Date; url: null | string; username: string; }, rank?: "visitor" | "editor" | "admin" | "owner") => Promise<{ avatar: null | string; createdAt: null | Date; email: null | string; id: string; name: string; password: null | string; updatedAt: null | Date; url: null | string; username: string; }>; ghost: { create: () => Promise<any>; get: () => Promise<any>; verifyExists: () => Promise<boolean>; }; searchUsersForUsernameOrEmail: (username: string, email: string) => Promise<{ emailSearch: { avatar: null | string; createdAt: null | Date; email: null | string; id: string; name: string; password: null | string; updatedAt: null | Date; url: null | string; username: string; }[]; usernameSearch: { avatar: null | string; createdAt: null | Date; email: null | string; id: string; name: string; password: null | string; updatedAt: null | Date; url: null | string; username: string; }[]; }>; update: (userId: string, userData: Partial) => Promise<{ avatar: null | string; createdAt: null | Date; email: null | string; id: string; name: string; password: null | string; updatedAt: null | Date; url: null | string; username: string; }>; }; }

{ create: (data: { provider: string; providerUserId: string; userId: string; }) => Promise<{ provider: string; providerUserId: string; userId: string; }>; delete: (userId: string, provider: string) => Promise<DeletionResponse>; searchProvidersForId: (providerId: string, userId: string) => Promise< | undefined | { provider: string; providerUserId: string; userId: string; }>; } = ...

Provides various methods to create, delete, and search for OAuth accounts in the StudioCMS database.

(data: { provider: string; providerUserId: string; userId: string; }) => Promise<{ provider: string; providerUserId: string; userId: string; }> = ...

Creates a new OAuth account in the database.

Throws

If an error occurs while creating the OAuth account.

(userId: string, provider: string) => Promise<DeletionResponse> = ...

Deletes an OAuth account from the database.

Throws

If an error occurs while deleting the OAuth account.

(providerId: string, userId: string) => Promise< | undefined | { provider: string; providerUserId: string; userId: string; }> = ...

Searches for OAuth accounts based on the provider ID and user ID.

Throws

If an error occurs while searching for the OAuth account.

{ currentStatus: (userId: string) => Promise< | undefined | { rank: string; user: string; }>; } = ...

Provides various methods to get and update permissions for users in the StudioCMS database.

(userId: string) => Promise< | undefined | { rank: string; user: string; }> = ...

Checks the current status of a user’s permissions.

{ create: (data: { expiresAt: Date; id: string; userId: string; }) => Promise<{ expiresAt: Date; id: string; userId: string; }>; delete: (sessionId: string) => Promise<DeletionResponse>; sessionWithUser: (sessionId: string) => Promise<{ session: { expiresAt: Date; id: string; userId: string; }; user: { avatar: null | string; createdAt: null | Date; email: null | string; id: string; name: string; password: null | string; updatedAt: null | Date; url: null | string; username: string; }; }[]>; update: (sessionId: string, newDate: Date) => Promise<{ expiresAt: Date; id: string; userId: string; }[]>; } = ...

Provides various methods to create, delete, and update sessions in the StudioCMS database.

(data: { expiresAt: Date; id: string; userId: string; }) => Promise<{ expiresAt: Date; id: string; userId: string; }> = ...

Creates a new session in the database.

Throws

If an error occurs while creating the session.

(sessionId: string) => Promise<DeletionResponse> = ...

Deletes a session from the database.

Throws

If an error occurs while deleting the session.

(sessionId: string) => Promise<{ session: { expiresAt: Date; id: string; userId: string; }; user: { avatar: null | string; createdAt: null | Date; email: null | string; id: string; name: string; password: null | string; updatedAt: null | Date; url: null | string; username: string; }; }[]> = ...

Gets a session with the associated user.

Throws

If an error occurs while getting the session with the user.

(sessionId: string, newDate: Date) => Promise<{ expiresAt: Date; id: string; userId: string; }[]> = ...

Updates the expiration date of a session.

Throws

If an error occurs while updating the session.

{ create: (newUserData: { avatar: null | string; createdAt: null | Date; email: null | string; id: string; name: string; password: null | string; updatedAt: null | Date; url: null | string; username: string; }, rank?: "visitor" | "editor" | "admin" | "owner") => Promise<{ avatar: null | string; createdAt: null | Date; email: null | string; id: string; name: string; password: null | string; updatedAt: null | Date; url: null | string; username: string; }>; ghost: { create: () => Promise<any>; get: () => Promise<any>; verifyExists: () => Promise<boolean>; }; searchUsersForUsernameOrEmail: (username: string, email: string) => Promise<{ emailSearch: { avatar: null | string; createdAt: null | Date; email: null | string; id: string; name: string; password: null | string; updatedAt: null | Date; url: null | string; username: string; }[]; usernameSearch: { avatar: null | string; createdAt: null | Date; email: null | string; id: string; name: string; password: null | string; updatedAt: null | Date; url: null | string; username: string; }[]; }>; update: (userId: string, userData: Partial) => Promise<{ avatar: null | string; createdAt: null | Date; email: null | string; id: string; name: string; password: null | string; updatedAt: null | Date; url: null | string; username: string; }>; } = ...

Provides various methods to create, update, and search for users in the StudioCMS database.

(newUserData: { avatar: null | string; createdAt: null | Date; email: null | string; id: string; name: string; password: null | string; updatedAt: null | Date; url: null | string; username: string; }, rank?: "visitor" | "editor" | "admin" | "owner") => Promise<{ avatar: null | string; createdAt: null | Date; email: null | string; id: string; name: string; password: null | string; updatedAt: null | Date; url: null | string; username: string; }> = ...

Creates a new user in the database.

Throws

If an error occurs while creating the user.

{ create: () => Promise<any>; get: () => Promise<any>; verifyExists: () => Promise<boolean>; } = ...

Ghost user utilities.

() => Promise<any> = ...

Creates the ghost user in the database.

Throws

If an error occurs while creating the ghost user.

() => Promise<any> = ...

Gets the ghost user from the database.

Throws

If an error occurs while getting the ghost user.

() => Promise<boolean> = ...

Verifies if the ghost user exists in the database.

Throws

If an error occurs while verifying the ghost user.

(username: string, email: string) => Promise<{ emailSearch: { avatar: null | string; createdAt: null | Date; email: null | string; id: string; name: string; password: null | string; updatedAt: null | Date; url: null | string; username: string; }[]; usernameSearch: { avatar: null | string; createdAt: null | Date; email: null | string; id: string; name: string; password: null | string; updatedAt: null | Date; url: null | string; username: string; }[]; }> = ...

Searches for users based on the provided username or email.

Throws

If an error occurs while searching for the username or email.

(userId: string, userData: Partial) => Promise<{ avatar: null | string; createdAt: null | Date; email: null | string; id: string; name: string; password: null | string; updatedAt: null | Date; url: null | string; username: string; }> = ...

Updates a user in the database.

Throws

If an error occurs while updating the user.

() => Promise<FolderNode[]>

(userId: string) => Promise<boolean>

(categoryIds: number[]) => Promise<{ description: string; id: number; meta: unknown; name: string; parent: null | number; slug: string; }[]>

(page: { authorId: null | string; categories: unknown; contentLang: string; contributorIds: unknown; description: string; draft: null | boolean; heroImage: string; id: string; package: string; parentFolder: null | string; publishedAt: Date; showAuthor: null | boolean; showContributors: null | boolean; showOnNav: boolean; slug: string; tags: unknown; title: string; updatedAt: null | Date; }, tree: FolderNode[]) => Promise<CombinedPageData>

(tagIds: number[]) => Promise<{ description: string; id: number; meta: unknown; name: string; slug: string; }[]>

(user: { avatar: null | string; createdAt: null | Date; email: null | string; id: string; name: string; password: null | string; updatedAt: null | Date; url: null | string; username: string; }) => Promise<CombinedUserData>

(rank: string, users: SingleRank[]) => CombinedRank[]

any

{ categories: (id: number) => Promise<DeletionResponse>; diffTracking: (id: string) => Promise<DeletionResponse>; folder: (id: string) => Promise<DeletionResponse>; page: (id: string) => Promise<DeletionResponse>; pageContent: (id: string) => Promise<DeletionResponse>; pageContentLang: (id: string, lang: string) => Promise<DeletionResponse>; permissions: (userId: string) => Promise<DeletionResponse>; tags: (id: number) => Promise<DeletionResponse>; user: (id: string) => Promise<DeletionResponse>; }

(id: number) => Promise<DeletionResponse> = ...

Deletes a category from the database.

Throws

If an error occurs while deleting the category.

(id: string) => Promise<DeletionResponse> = ...

Deletes a site configuration from the database.

Throws

If an error occurs while deleting the site configuration.

(id: string) => Promise<DeletionResponse> = ...

Deletes a folder from the database.

Throws

If an error occurs while deleting the folder.

(id: string) => Promise<DeletionResponse> = ...

Deletes a page from the database.

Throws

If an error occurs while deleting the page.

(id: string) => Promise<DeletionResponse> = ...

Deletes a page content from the database.

Throws

If an error occurs while deleting the page content.

(id: string, lang: string) => Promise<DeletionResponse> = ...

Deletes a page content lang from the database.

Throws

If an error occurs while deleting the page content lang.

(userId: string) => Promise<DeletionResponse> = ...

Deletes a permission from the database.

Throws

If an error occurs while deleting the permission.

(id: number) => Promise<DeletionResponse> = ...

Deletes a tag from the database.

Throws

If an error occurs while deleting the tag.

(id: string) => Promise<DeletionResponse> = ...

Deletes a user from the database.

Throws

If an error occurs while deleting the user.

{ clear: (pageId: string) => Promise<void>; get: { byPageId: { all: (pageId: string) => Promise<any>; latest: (pageId: string, count: number) => Promise<any>; }; byUserId: { all: (userId: string) => Promise<any>; latest: (userId: string, count: number) => Promise<any>; }; single: (id: string) => Promise<any>; withHtml: (id: string, options?: any) => Promise<any>; }; insert: (userId: string, pageId: string, data: { content: { end: string; start: string; }; metaData: { end: Partial<{ authorId: null | string; categories: unknown; contentLang: string; contributorIds: unknown; description: string; draft: null | boolean; heroImage: string; id: string; package: string; parentFolder: null | string; publishedAt: Date; showAuthor: null | boolean; showContributors: null | boolean; showOnNav: boolean; slug: string; tags: unknown; title: string; updatedAt: null | Date; }>; start: Partial<{ authorId: null | string; categories: unknown; contentLang: string; contributorIds: unknown; description: string; draft: null | boolean; heroImage: string; id: string; package: string; parentFolder: null | string; publishedAt: Date; showAuthor: null | boolean; showContributors: null | boolean; showOnNav: boolean; slug: string; tags: unknown; title: string; updatedAt: null | Date; }>; }; }, diffLength: number) => Promise<any>; revertToDiff: (id: string, type: "content" | "data" | "both") => Promise<any>; }

(pageId: string) => Promise<void> = ...

{ byPageId: { all: (pageId: string) => Promise<any>; latest: (pageId: string, count: number) => Promise<any>; }; byUserId: { all: (userId: string) => Promise<any>; latest: (userId: string, count: number) => Promise<any>; }; single: (id: string) => Promise<any>; withHtml: (id: string, options?: any) => Promise<any>; } = ...

{ all: (pageId: string) => Promise<any>; latest: (pageId: string, count: number) => Promise<any>; } = ...

(pageId: string) => Promise<any> = ...

(pageId: string, count: number) => Promise<any> = ...

{ all: (userId: string) => Promise<any>; latest: (userId: string, count: number) => Promise<any>; } = ...

(userId: string) => Promise<any> = ...

(userId: string, count: number) => Promise<any> = ...

(id: string) => Promise<any> = ...

(id: string, options?: any) => Promise<any> = ...

(userId: string, pageId: string, data: { content: { end: string; start: string; }; metaData: { end: Partial<{ authorId: null | string; categories: unknown; contentLang: string; contributorIds: unknown; description: string; draft: null | boolean; heroImage: string; id: string; package: string; parentFolder: null | string; publishedAt: Date; showAuthor: null | boolean; showContributors: null | boolean; showOnNav: boolean; slug: string; tags: unknown; title: string; updatedAt: null | Date; }>; start: Partial<{ authorId: null | string; categories: unknown; contentLang: string; contributorIds: unknown; description: string; draft: null | boolean; heroImage: string; id: string; package: string; parentFolder: null | string; publishedAt: Date; showAuthor: null | boolean; showContributors: null | boolean; showOnNav: boolean; slug: string; tags: unknown; title: string; updatedAt: null | Date; }>; }; }, diffLength: number) => Promise<any> = ...

(id: string, type: "content" | "data" | "both") => Promise<any> = ...

(tree: FolderNode[], id: string) => null | FolderNode

(tree: FolderNode[], path: string[]) => null | FolderNode

(tree: FolderNode[], path: string[]) => FolderNode[]

(length: number) => number

(length: number) => string

(userId: string) => string

{ database: { config: () => Promise< | undefined | { defaultOgImage: null | string; description: string; diffPerPage: number; enableDiffs: boolean; gridItems: unknown; id: number; loginPageBackground: string; loginPageCustomImage: null | string; siteIcon: null | string; title: string; }>; folders: () => Promise<{ id: string; name: string; parent: null | string; }[]>; pages: (includeDrafts: boolean, tree?: FolderNode[]) => Promise<CombinedPageData[]>; users: () => Promise<CombinedUserData[]>; }; databaseEntry: { folder: (id: string) => Promise< | undefined | { id: string; name: string; parent: null | string; }>; pages: { byId: (id: string, tree?: FolderNode[]) => Promise< | undefined | CombinedPageData>; bySlug: (slug: string, tree?: FolderNode[]) => Promise< | undefined | CombinedPageData>; }; users: { byEmail: (email: string) => Promise< | undefined | CombinedUserData>; byId: (id: string) => Promise< | undefined | CombinedUserData>; byUsername: (username: string) => Promise< | undefined | CombinedUserData>; }; }; databaseTable: { diffTracking: () => Promise<any>; oAuthAccounts: () => Promise<any>; pageContent: () => Promise<any>; pageData: () => Promise<any>; pageDataCategories: () => Promise<any>; pageDataTags: () => Promise<any>; pageFolderStructure: () => Promise<any>; permissions: () => Promise<any>; sessionTable: () => Promise<any>; siteConfig: () => Promise<any>; users: () => Promise<any>; }; packagePages: (packageName: string, tree?: FolderNode[]) => Promise<CombinedPageData[]>; permissionsLists: { admins: () => Promise<SingleRank[]>; all: () => Promise<CombinedRank[]>; editors: () => Promise<SingleRank[]>; owners: () => Promise<SingleRank[]>; visitors: () => Promise<SingleRank[]>; }; }

{ config: () => Promise< | undefined | { defaultOgImage: null | string; description: string; diffPerPage: number; enableDiffs: boolean; gridItems: unknown; id: number; loginPageBackground: string; loginPageCustomImage: null | string; siteIcon: null | string; title: string; }>; folders: () => Promise<{ id: string; name: string; parent: null | string; }[]>; pages: (includeDrafts: boolean, tree?: FolderNode[]) => Promise<CombinedPageData[]>; users: () => Promise<CombinedUserData[]>; } = ...

Retrieves data from the database

() => Promise< | undefined | { defaultOgImage: null | string; description: string; diffPerPage: number; enableDiffs: boolean; gridItems: unknown; id: number; loginPageBackground: string; loginPageCustomImage: null | string; siteIcon: null | string; title: string; }> = ...

Retrieves the site configuration from the database.

Throws

If an error occurs while getting the site configuration.

() => Promise<{ id: string; name: string; parent: null | string; }[]> = ...

(includeDrafts: boolean, tree?: FolderNode[]) => Promise<CombinedPageData[]> = ...

Retrieves all pages from the database.

Throws

If an error occurs while getting the pages.

() => Promise<CombinedUserData[]> = ...

Retrieves all users from the database.

Throws

If an error occurs while getting the users.

{ folder: (id: string) => Promise< | undefined | { id: string; name: string; parent: null | string; }>; pages: { byId: (id: string, tree?: FolderNode[]) => Promise< | undefined | CombinedPageData>; bySlug: (slug: string, tree?: FolderNode[]) => Promise< | undefined | CombinedPageData>; }; users: { byEmail: (email: string) => Promise< | undefined | CombinedUserData>; byId: (id: string) => Promise< | undefined | CombinedUserData>; byUsername: (username: string) => Promise< | undefined | CombinedUserData>; }; } = ...

Retrieves data from the database by ID.

(id: string) => Promise< | undefined | { id: string; name: string; parent: null | string; }> = ...

{ byId: (id: string, tree?: FolderNode[]) => Promise< | undefined | CombinedPageData>; bySlug: (slug: string, tree?: FolderNode[]) => Promise< | undefined | CombinedPageData>; } = ...

Retrieves a page from the database

(id: string, tree?: FolderNode[]) => Promise< | undefined | CombinedPageData> = ...

Retrieves a page by ID.

Throws

If an error occurs while getting the page.

(slug: string, tree?: FolderNode[]) => Promise< | undefined | CombinedPageData> = ...

Retrieves a page by slug.

Throws

If an error occurs while getting the page.

{ byEmail: (email: string) => Promise< | undefined | CombinedUserData>; byId: (id: string) => Promise< | undefined | CombinedUserData>; byUsername: (username: string) => Promise< | undefined | CombinedUserData>; } = ...

Retrieves a user from the database

(email: string) => Promise< | undefined | CombinedUserData> = ...

Retrieves a user by email.

Throws

If an error occurs while getting the user.

(id: string) => Promise< | undefined | CombinedUserData> = ...

Retrieves a user by ID.

Throws

If an error occurs while getting the user.

(username: string) => Promise< | undefined | CombinedUserData> = ...

Retrieves a user by username.

Throws

If an error occurs while getting the user.

{ diffTracking: () => Promise<any>; oAuthAccounts: () => Promise<any>; pageContent: () => Promise<any>; pageData: () => Promise<any>; pageDataCategories: () => Promise<any>; pageDataTags: () => Promise<any>; pageFolderStructure: () => Promise<any>; permissions: () => Promise<any>; sessionTable: () => Promise<any>; siteConfig: () => Promise<any>; users: () => Promise<any>; } = ...

Retrieves data from the database tables without any additional processing.

() => Promise<any> = ...

Retrieves all data from the diff tracking table.

Throws

If an error occurs while getting the diff tracking data.

() => Promise<any> = ...

Retrieves all data from the OAuth accounts table.

Throws

If an error occurs while getting the OAuth accounts.

() => Promise<any> = ...

Retrieves all data from the page content table.

Throws

If an error occurs while getting the page content.

() => Promise<any> = ...

Retrieves all data from the page data table.

Throws

If an error occurs while getting the pages.

() => Promise<any> = ...

Retrieves all data from the page data categories table.

Throws

If an error occurs while getting the page data categories.

() => Promise<any> = ...

Retrieves all data from the page data tags table.

Throws

If an error occurs while getting the page data tags.

() => Promise<any> = ...

Retrieves all data from the page folder structure table.

Throws

If an error occurs while getting the page folder structure data.

() => Promise<any> = ...

Retrieves all data from the permissions table.

Throws

If an error occurs while getting the permissions.

() => Promise<any> = ...

Retrieves all data from the session table.

Throws

If an error occurs while getting the sessions.

() => Promise<any> = ...

Retrieves all data from the site config table.

Throws

If an error occurs while getting the site configuration.

() => Promise<any> = ...

Retrieves all data from the users table.

Throws

If an error occurs while getting the users.

(packageName: string, tree?: FolderNode[]) => Promise<CombinedPageData[]> = ...

Retrieves data from the database by package.

{ admins: () => Promise<SingleRank[]>; all: () => Promise<CombinedRank[]>; editors: () => Promise<SingleRank[]>; owners: () => Promise<SingleRank[]>; visitors: () => Promise<SingleRank[]>; } = ...

Retrieve Permission Lists

() => Promise<SingleRank[]> = ...

Retrieves all admins in the database.

Throws

If an error occurs while getting the admins.

() => Promise<CombinedRank[]> = ...

Retrieves all permissions for users in the database.

Throws

If an error occurs while getting the permissions.

() => Promise<SingleRank[]> = ...

Retrieves all editors in the database.

Throws

If an error occurs while getting the editors.

() => Promise<SingleRank[]> = ...

Retrieves all owners in the database.

Throws

If an error occurs while getting the owners.

() => Promise<SingleRank[]> = ...

Retrieves all visitors in the database.

Throws

If an error occurs while getting the visitors.

() => Promise<FolderListItem[]>

(tree: FolderNode[], path: string[]) => string[]

{ ghostUser: () => Promise<{ avatar: null | string; createdAt: null | Date; email: null | string; id: string; name: string; password: null | string; updatedAt: null | Date; url: null | string; username: string; }>; siteConfig: (config: { defaultOgImage: null | string; description: string; diffPerPage: number; enableDiffs: boolean; gridItems: unknown; id: number; loginPageBackground: string; loginPageCustomImage: null | string; siteIcon: null | string; title: string; }) => Promise<{ defaultOgImage: null | string; description: string; diffPerPage: number; enableDiffs: boolean; gridItems: unknown; id: number; loginPageBackground: string; loginPageCustomImage: null | string; siteIcon: null | string; title: string; }>; }

() => Promise<{ avatar: null | string; createdAt: null | Date; email: null | string; id: string; name: string; password: null | string; updatedAt: null | Date; url: null | string; username: string; }> = ...

Initializes the StudioCMS Ghost User.

The ghost user is a default user that is used to perform actions on behalf of the system as well as to replace deleted users.

Throws

If an error occurs while creating the ghost user.

(config: { defaultOgImage: null | string; description: string; diffPerPage: number; enableDiffs: boolean; gridItems: unknown; id: number; loginPageBackground: string; loginPageCustomImage: null | string; siteIcon: null | string; title: string; }) => Promise<{ defaultOgImage: null | string; description: string; diffPerPage: number; enableDiffs: boolean; gridItems: unknown; id: number; loginPageBackground: string; loginPageCustomImage: null | string; siteIcon: null | string; title: string; }> = ...

Initializes the StudioCMS SiteConfig table with the provided configuration.

Throws

If an error occurs while creating the site configuration.

(ids: unknown) => number[]

(ids: unknown) => string[]

{ databaseEntries: { categories: (data: { description: string; id: number; meta: unknown; name: string; parent: null | number; slug: string; }[]) => Promise<PageDataCategoriesInsertResponse[]>; pages: (pages: MultiPageInsert) => Promise<void>; permissions: (data: { rank: string; user: string; }[]) => Promise<{ rank: string; user: string; }[]>; tags: (data: { description: string; id: number; meta: unknown; name: string; slug: string; }[]) => Promise<PageDataTagsInsertResponse[]>; }; databaseEntry: { categories: (category: { description: string; id: number; meta: unknown; name: string; parent: null | number; slug: string; }) => Promise<any>; diffTracking: (diff: { diff: null | string; id: string; pageContentStart: string; pageId: string; pageMetaData: unknown; timestamp: null | Date; userId: string; }) => Promise<{ diff: null | string; id: string; pageContentStart: string; pageId: string; pageMetaData: unknown; timestamp: null | Date; userId: string; }[]>; folder: (folder: { id: string; name: string; parent: null | string; }) => Promise<{ id: string; name: string; parent: null | string; }[]>; pageContent: (pageContent: { content: null | string; contentId: string; contentLang: string; id: string; }) => Promise<PageContentReturnId[]>; pages: (pageData: { authorId: null | string; categories: unknown; contentLang: string; contributorIds: unknown; description: string; draft: null | boolean; heroImage: string; id: string; package: string; parentFolder: null | string; publishedAt: Date; showAuthor: null | boolean; showContributors: null | boolean; showOnNav: boolean; slug: string; tags: unknown; title: string; updatedAt: null | Date; }, pageContent: CombinedInsertContent) => Promise<addDatabaseEntryInsertPage>; permissions: (userId: string, rank: string) => Promise<{ rank: string; user: string; }[]>; tags: (tag: { description: string; id: number; meta: unknown; name: string; slug: string; }) => Promise<PageDataTagsInsertResponse[]>; }; }

{ categories: (data: { description: string; id: number; meta: unknown; name: string; parent: null | number; slug: string; }[]) => Promise<PageDataCategoriesInsertResponse[]>; pages: (pages: MultiPageInsert) => Promise<void>; permissions: (data: { rank: string; user: string; }[]) => Promise<{ rank: string; user: string; }[]>; tags: (data: { description: string; id: number; meta: unknown; name: string; slug: string; }[]) => Promise<PageDataTagsInsertResponse[]>; } = ...

Inserts data into the database by Array of Entries

(data: { description: string; id: number; meta: unknown; name: string; parent: null | number; slug: string; }[]) => Promise<PageDataCategoriesInsertResponse[]> = ...

Inserts multiple categories into the database.

Throws

If an error occurs while inserting the categories.

(pages: MultiPageInsert) => Promise<void> = ...

Inserts multiple pages into the database.

Throws

If an error occurs while inserting the pages.

(data: { rank: string; user: string; }[]) => Promise<{ rank: string; user: string; }[]> = ...

Inserts multiple permissions into the database.

Throws

If an error occurs while inserting the permissions.

(data: { description: string; id: number; meta: unknown; name: string; slug: string; }[]) => Promise<PageDataTagsInsertResponse[]> = ...

Inserts multiple tags into the database.

Throws

If an error occurs while inserting the tags.

{ categories: (category: { description: string; id: number; meta: unknown; name: string; parent: null | number; slug: string; }) => Promise<any>; diffTracking: (diff: { diff: null | string; id: string; pageContentStart: string; pageId: string; pageMetaData: unknown; timestamp: null | Date; userId: string; }) => Promise<{ diff: null | string; id: string; pageContentStart: string; pageId: string; pageMetaData: unknown; timestamp: null | Date; userId: string; }[]>; folder: (folder: { id: string; name: string; parent: null | string; }) => Promise<{ id: string; name: string; parent: null | string; }[]>; pageContent: (pageContent: { content: null | string; contentId: string; contentLang: string; id: string; }) => Promise<PageContentReturnId[]>; pages: (pageData: { authorId: null | string; categories: unknown; contentLang: string; contributorIds: unknown; description: string; draft: null | boolean; heroImage: string; id: string; package: string; parentFolder: null | string; publishedAt: Date; showAuthor: null | boolean; showContributors: null | boolean; showOnNav: boolean; slug: string; tags: unknown; title: string; updatedAt: null | Date; }, pageContent: CombinedInsertContent) => Promise<addDatabaseEntryInsertPage>; permissions: (userId: string, rank: string) => Promise<{ rank: string; user: string; }[]>; tags: (tag: { description: string; id: number; meta: unknown; name: string; slug: string; }) => Promise<PageDataTagsInsertResponse[]>; } = ...

Inserts data into the database by Entry

(category: { description: string; id: number; meta: unknown; name: string; parent: null | number; slug: string; }) => Promise<any> = ...

Inserts a new category into the database.

Throws

If an error occurs while inserting the category.

(diff: { diff: null | string; id: string; pageContentStart: string; pageId: string; pageMetaData: unknown; timestamp: null | Date; userId: string; }) => Promise<{ diff: null | string; id: string; pageContentStart: string; pageId: string; pageMetaData: unknown; timestamp: null | Date; userId: string; }[]> = ...

Inserts a new diff tracking entry into the database.

Throws

If an error occurs while inserting the diff tracking entry.

(folder: { id: string; name: string; parent: null | string; }) => Promise<{ id: string; name: string; parent: null | string; }[]> = ...

Inserts a new folder into the database.

Throws

If an error occurs while inserting the folder.

(pageContent: { content: null | string; contentId: string; contentLang: string; id: string; }) => Promise<PageContentReturnId[]> = ...

Inserts new page content into the database.

Throws

If an error occurs while inserting the page content.

(pageData: { authorId: null | string; categories: unknown; contentLang: string; contributorIds: unknown; description: string; draft: null | boolean; heroImage: string; id: string; package: string; parentFolder: null | string; publishedAt: Date; showAuthor: null | boolean; showContributors: null | boolean; showOnNav: boolean; slug: string; tags: unknown; title: string; updatedAt: null | Date; }, pageContent: CombinedInsertContent) => Promise<addDatabaseEntryInsertPage> = ...

Insert a new page into the database.

Throws

If an error occurs while inserting the page.

(userId: string, rank: string) => Promise<{ rank: string; user: string; }[]> = ...

Inserts a new permission into the database.

Throws

If an error occurs while inserting the permission.

(tag: { description: string; id: number; meta: unknown; name: string; slug: string; }) => Promise<PageDataTagsInsertResponse[]> = ...

Inserts a new tag into the database.

Throws

If an error occurs while inserting the tag.

{ check: (token: string) => Promise<boolean>; delete: (userId: string) => Promise<void>; new: (userId: string) => Promise<any>; }

(token: string) => Promise<boolean> = ...

(userId: string) => Promise<void> = ...

(userId: string) => Promise<any> = ...

{ tokens: { delete: (userId: string, tokenId: string) => Promise<void>; get: (userId: string) => Promise<any>; new: (userId: string, description: string) => Promise<any>; verify: (key: string) => Promise< | false | { key: any; rank: any; userId: any; }>; }; }

{ delete: (userId: string, tokenId: string) => Promise<void>; get: (userId: string) => Promise<any>; new: (userId: string, description: string) => Promise<any>; verify: (key: string) => Promise< | false | { key: any; rank: any; userId: any; }>; } = ...

(userId: string, tokenId: string) => Promise<void> = ...

(userId: string) => Promise<any> = ...

(userId: string, description: string) => Promise<any> = ...

(key: string) => Promise< | false | { key: any; rank: any; userId: any; }> = ...

(token: string) => any

{ categories: (data: { description: string; id: number; meta: unknown; name: string; parent: null | number; slug: string; }) => Promise<{ description: string; id: number; meta: unknown; name: string; parent: null | number; slug: string; }>; folder: (data: { id: string; name: string; parent: null | string; }) => Promise<{ id: string; name: string; parent: null | string; }>; page: (data: { authorId: null | string; categories: unknown; contentLang: string; contributorIds: unknown; description: string; draft: null | boolean; heroImage: string; id: string; package: string; parentFolder: null | string; publishedAt: Date; showAuthor: null | boolean; showContributors: null | boolean; showOnNav: boolean; slug: string; tags: unknown; title: string; updatedAt: null | Date; }) => Promise<{ authorId: null | string; categories: unknown; contentLang: string; contributorIds: unknown; description: string; draft: null | boolean; heroImage: string; id: string; package: string; parentFolder: null | string; publishedAt: Date; showAuthor: null | boolean; showContributors: null | boolean; showOnNav: boolean; slug: string; tags: unknown; title: string; updatedAt: null | Date; }>; pageContent: (data: { content: null | string; contentId: string; contentLang: string; id: string; }) => Promise<{ content: null | string; contentId: string; contentLang: string; id: string; }>; permissions: (data: { rank: string; user: string; }) => Promise<{ rank: string; user: string; }>; siteConfig: (data: { defaultOgImage: null | string; description: string; diffPerPage: number; enableDiffs: boolean; gridItems: unknown; id: number; loginPageBackground: string; loginPageCustomImage: null | string; siteIcon: null | string; title: string; }) => Promise<{ defaultOgImage: null | string; description: string; diffPerPage: number; enableDiffs: boolean; gridItems: unknown; id: number; loginPageBackground: string; loginPageCustomImage: null | string; siteIcon: null | string; title: string; }>; tags: (data: { description: string; id: number; meta: unknown; name: string; slug: string; }) => Promise<{ description: string; id: number; meta: unknown; name: string; slug: string; }>; }

(data: { description: string; id: number; meta: unknown; name: string; parent: null | number; slug: string; }) => Promise<{ description: string; id: number; meta: unknown; name: string; parent: null | number; slug: string; }> = ...

Updates a category in the database.

Throws

If an error occurs while updating the category.

(data: { id: string; name: string; parent: null | string; }) => Promise<{ id: string; name: string; parent: null | string; }> = ...

(data: { authorId: null | string; categories: unknown; contentLang: string; contributorIds: unknown; description: string; draft: null | boolean; heroImage: string; id: string; package: string; parentFolder: null | string; publishedAt: Date; showAuthor: null | boolean; showContributors: null | boolean; showOnNav: boolean; slug: string; tags: unknown; title: string; updatedAt: null | Date; }) => Promise<{ authorId: null | string; categories: unknown; contentLang: string; contributorIds: unknown; description: string; draft: null | boolean; heroImage: string; id: string; package: string; parentFolder: null | string; publishedAt: Date; showAuthor: null | boolean; showContributors: null | boolean; showOnNav: boolean; slug: string; tags: unknown; title: string; updatedAt: null | Date; }> = ...

Updates a page in the database.

Throws

If an error occurs while updating the page.

(data: { content: null | string; contentId: string; contentLang: string; id: string; }) => Promise<{ content: null | string; contentId: string; contentLang: string; id: string; }> = ...

Updates a page content in the database.

Throws

If an error occurs while updating the page content.

(data: { rank: string; user: string; }) => Promise<{ rank: string; user: string; }> = ...

Updates a permission in the database.

Throws

If an error occurs while updating the permission.

(data: { defaultOgImage: null | string; description: string; diffPerPage: number; enableDiffs: boolean; gridItems: unknown; id: number; loginPageBackground: string; loginPageCustomImage: null | string; siteIcon: null | string; title: string; }) => Promise<{ defaultOgImage: null | string; description: string; diffPerPage: number; enableDiffs: boolean; gridItems: unknown; id: number; loginPageBackground: string; loginPageCustomImage: null | string; siteIcon: null | string; title: string; }> = ...

Updates a site configuration in the database.

Throws

If an error occurs while updating the site configuration.

(data: { description: string; id: number; meta: unknown; name: string; slug: string; }) => Promise<{ description: string; id: number; meta: unknown; name: string; slug: string; }> = ...

Updates a tag in the database.

Throws

If an error occurs while updating the tag.

(users: { avatar: null | string; createdAt: null | Date; email: null | string; id: string; name: string; password: null | string; updatedAt: null | Date; url: null | string; username: string; }[], permissions: { rank: string; user: string; }[], rank: string) => SingleRank[]

StudioCMSVirtualCache

cacheModule: {
CLEAR: {
folderList: () => void;
folderTree: () => void;
latestVersion: () => void;
page: {
byId: (id: string) => void;
bySlug: (slug: string) => void;
};
pages: () => void;
};
db: any;
GET: {
folder: (id: string) => Promise<
| undefined
| {
id: string;
name: string;
parent: null | string;
}>;
folderList: () => Promise<FolderListCacheObject>;
folderTree: () => Promise<FolderTreeCacheObject>;
latestVersion: () => Promise<VersionCacheObject>;
page: {
byId: (id: string) => Promise<PageDataCacheObject>;
bySlug: (slug: string) => Promise<PageDataCacheObject>;
};
pageFolderTree: (includeDrafts?: boolean) => Promise<FolderTreeCacheObject>;
pages: (includeDrafts?: boolean) => Promise<PageDataCacheObject[]>;
siteConfig: () => Promise<SiteConfigCacheObject>;
};
UPDATE: {
folder: (data: {
id: string;
name: string;
parent: null | string;
}) => Promise<{
id: string;
name: string;
parent: null | string;
}>;
folderList: () => Promise<FolderListCacheObject>;
folderTree: () => Promise<FolderTreeCacheObject>;
latestVersion: () => Promise<VersionCacheObject>;
page: {
byId: (id: string, data: {
pageContent: {
content: null | string;
contentId: string;
contentLang: string;
id: string;
};
pageData: {
authorId: null | string;
categories: unknown;
contentLang: string;
contributorIds: unknown;
description: string;
draft: null | boolean;
heroImage: string;
id: string;
package: string;
parentFolder: null | string;
publishedAt: Date;
showAuthor: null | boolean;
showContributors: null | boolean;
showOnNav: boolean;
slug: string;
tags: unknown;
title: string;
updatedAt: null | Date;
};
}) => Promise<PageDataCacheObject>;
bySlug: (slug: string, data: {
pageContent: {
content: null | string;
contentId: string;
contentLang: string;
id: string;
};
pageData: {
authorId: null | string;
categories: unknown;
contentLang: string;
contributorIds: unknown;
description: string;
draft: null | boolean;
heroImage: string;
id: string;
package: string;
parentFolder: null | string;
publishedAt: Date;
showAuthor: null | boolean;
showContributors: null | boolean;
showOnNav: boolean;
slug: string;
tags: unknown;
title: string;
updatedAt: null | Date;
};
}) => Promise<PageDataCacheObject>;
};
siteConfig: (data: SiteConfig) => Promise<SiteConfigCacheObject>;
};
};

Defined in: studiocms/packages/studiocms/src/sdk/StudioCMSVirtualCache.ts:55

CLEAR: {
folderList: () => void;
folderTree: () => void;
latestVersion: () => void;
page: {
byId: (id: string) => void;
bySlug: (slug: string) => void;
};
pages: () => void;
};

folderList: () => void;

void

folderTree: () => void;

void

latestVersion: () => void;

void

page: {
byId: (id: string) => void;
bySlug: (slug: string) => void;
};

byId: (id: string) => void;

string

void

bySlug: (slug: string) => void;

string

void

pages: () => void;

void

db: any;

GET: {
folder: (id: string) => Promise<
| undefined
| {
id: string;
name: string;
parent: null | string;
}>;
folderList: () => Promise<FolderListCacheObject>;
folderTree: () => Promise<FolderTreeCacheObject>;
latestVersion: () => Promise<VersionCacheObject>;
page: {
byId: (id: string) => Promise<PageDataCacheObject>;
bySlug: (slug: string) => Promise<PageDataCacheObject>;
};
pageFolderTree: (includeDrafts?: boolean) => Promise<FolderTreeCacheObject>;
pages: (includeDrafts?: boolean) => Promise<PageDataCacheObject[]>;
siteConfig: () => Promise<SiteConfigCacheObject>;
};

folder: (id: string) => Promise<
| undefined
| {
id: string;
name: string;
parent: null | string;
}>;

string

Promise< | undefined | { id: string; name: string; parent: null | string; }>

folderList: () => Promise<FolderListCacheObject>;

Promise<FolderListCacheObject>

folderTree: () => Promise<FolderTreeCacheObject>;

Promise<FolderTreeCacheObject>

latestVersion: () => Promise<VersionCacheObject>;

Promise<VersionCacheObject>

page: {
byId: (id: string) => Promise<PageDataCacheObject>;
bySlug: (slug: string) => Promise<PageDataCacheObject>;
};

byId: (id: string) => Promise<PageDataCacheObject>;

string

Promise<PageDataCacheObject>

bySlug: (slug: string) => Promise<PageDataCacheObject>;

string

Promise<PageDataCacheObject>

pageFolderTree: (includeDrafts?: boolean) => Promise<FolderTreeCacheObject>;

boolean

Promise<FolderTreeCacheObject>

pages: (includeDrafts?: boolean) => Promise<PageDataCacheObject[]>;

boolean

Promise<PageDataCacheObject[]>

siteConfig: () => Promise<SiteConfigCacheObject>;

Promise<SiteConfigCacheObject>

UPDATE: {
folder: (data: {
id: string;
name: string;
parent: null | string;
}) => Promise<{
id: string;
name: string;
parent: null | string;
}>;
folderList: () => Promise<FolderListCacheObject>;
folderTree: () => Promise<FolderTreeCacheObject>;
latestVersion: () => Promise<VersionCacheObject>;
page: {
byId: (id: string, data: {
pageContent: {
content: null | string;
contentId: string;
contentLang: string;
id: string;
};
pageData: {
authorId: null | string;
categories: unknown;
contentLang: string;
contributorIds: unknown;
description: string;
draft: null | boolean;
heroImage: string;
id: string;
package: string;
parentFolder: null | string;
publishedAt: Date;
showAuthor: null | boolean;
showContributors: null | boolean;
showOnNav: boolean;
slug: string;
tags: unknown;
title: string;
updatedAt: null | Date;
};
}) => Promise<PageDataCacheObject>;
bySlug: (slug: string, data: {
pageContent: {
content: null | string;
contentId: string;
contentLang: string;
id: string;
};
pageData: {
authorId: null | string;
categories: unknown;
contentLang: string;
contributorIds: unknown;
description: string;
draft: null | boolean;
heroImage: string;
id: string;
package: string;
parentFolder: null | string;
publishedAt: Date;
showAuthor: null | boolean;
showContributors: null | boolean;
showOnNav: boolean;
slug: string;
tags: unknown;
title: string;
updatedAt: null | Date;
};
}) => Promise<PageDataCacheObject>;
};
siteConfig: (data: SiteConfig) => Promise<SiteConfigCacheObject>;
};

folder: (data: {
id: string;
name: string;
parent: null | string;
}) => Promise<{
id: string;
name: string;
parent: null | string;
}>;

string

string

null | string

Promise<{ id: string; name: string; parent: null | string; }>

folderList: () => Promise<FolderListCacheObject>;

Promise<FolderListCacheObject>

folderTree: () => Promise<FolderTreeCacheObject>;

Promise<FolderTreeCacheObject>

latestVersion: () => Promise<VersionCacheObject>;

Promise<VersionCacheObject>

page: {
byId: (id: string, data: {
pageContent: {
content: null | string;
contentId: string;
contentLang: string;
id: string;
};
pageData: {
authorId: null | string;
categories: unknown;
contentLang: string;
contributorIds: unknown;
description: string;
draft: null | boolean;
heroImage: string;
id: string;
package: string;
parentFolder: null | string;
publishedAt: Date;
showAuthor: null | boolean;
showContributors: null | boolean;
showOnNav: boolean;
slug: string;
tags: unknown;
title: string;
updatedAt: null | Date;
};
}) => Promise<PageDataCacheObject>;
bySlug: (slug: string, data: {
pageContent: {
content: null | string;
contentId: string;
contentLang: string;
id: string;
};
pageData: {
authorId: null | string;
categories: unknown;
contentLang: string;
contributorIds: unknown;
description: string;
draft: null | boolean;
heroImage: string;
id: string;
package: string;
parentFolder: null | string;
publishedAt: Date;
showAuthor: null | boolean;
showContributors: null | boolean;
showOnNav: boolean;
slug: string;
tags: unknown;
title: string;
updatedAt: null | Date;
};
}) => Promise<PageDataCacheObject>;
};

byId: (id: string, data: {
pageContent: {
content: null | string;
contentId: string;
contentLang: string;
id: string;
};
pageData: {
authorId: null | string;
categories: unknown;
contentLang: string;
contributorIds: unknown;
description: string;
draft: null | boolean;
heroImage: string;
id: string;
package: string;
parentFolder: null | string;
publishedAt: Date;
showAuthor: null | boolean;
showContributors: null | boolean;
showOnNav: boolean;
slug: string;
tags: unknown;
title: string;
updatedAt: null | Date;
};
}) => Promise<PageDataCacheObject>;

string

{ content: null | string; contentId: string; contentLang: string; id: string; }

null | string

string

string

string

{ authorId: null | string; categories: unknown; contentLang: string; contributorIds: unknown; description: string; draft: null | boolean; heroImage: string; id: string; package: string; parentFolder: null | string; publishedAt: Date; showAuthor: null | boolean; showContributors: null | boolean; showOnNav: boolean; slug: string; tags: unknown; title: string; updatedAt: null | Date; }

null | string

unknown

string

unknown

string

null | boolean

string

string

string

null | string

Date

null | boolean

null | boolean

boolean

string

unknown

string

null | Date

Promise<PageDataCacheObject>

bySlug: (slug: string, data: {
pageContent: {
content: null | string;
contentId: string;
contentLang: string;
id: string;
};
pageData: {
authorId: null | string;
categories: unknown;
contentLang: string;
contributorIds: unknown;
description: string;
draft: null | boolean;
heroImage: string;
id: string;
package: string;
parentFolder: null | string;
publishedAt: Date;
showAuthor: null | boolean;
showContributors: null | boolean;
showOnNav: boolean;
slug: string;
tags: unknown;
title: string;
updatedAt: null | Date;
};
}) => Promise<PageDataCacheObject>;

string

{ content: null | string; contentId: string; contentLang: string; id: string; }

null | string

string

string

string

{ authorId: null | string; categories: unknown; contentLang: string; contributorIds: unknown; description: string; draft: null | boolean; heroImage: string; id: string; package: string; parentFolder: null | string; publishedAt: Date; showAuthor: null | boolean; showContributors: null | boolean; showOnNav: boolean; slug: string; tags: unknown; title: string; updatedAt: null | Date; }

null | string

unknown

string

unknown

string

null | boolean

string

string

string

null | string

Date

null | boolean

null | boolean

boolean

string

unknown

string

null | Date

Promise<PageDataCacheObject>

siteConfig: (data: SiteConfig) => Promise<SiteConfigCacheObject>;

SiteConfig

Promise<SiteConfigCacheObject>

clearAllPages(): void

Defined in: studiocms/packages/studiocms/src/sdk/StudioCMSVirtualCache.ts:700

Clear all pages from the cache

void

void

clearFolderList(): void

Defined in: studiocms/packages/studiocms/src/sdk/StudioCMSVirtualCache.ts:306

void

clearFolderTree(): void

Defined in: studiocms/packages/studiocms/src/sdk/StudioCMSVirtualCache.ts:471

Clears the folder tree from the cache.

void

clearPageById(id: string): void

Defined in: studiocms/packages/studiocms/src/sdk/StudioCMSVirtualCache.ts:650

Clear a page from the cache by its ID

string

The ID of the page

void

void

clearPageBySlug(slug: string): void

Defined in: studiocms/packages/studiocms/src/sdk/StudioCMSVirtualCache.ts:670

Clear a page from the cache by its slug and package

string

The slug of the page

void

void

clearVersion(): void

Defined in: studiocms/packages/studiocms/src/sdk/StudioCMSVirtualCache.ts:548

Clears the current version from the cache.

This method removes all entries associated with the current version from the cache, effectively resetting it.

void

getAllPages(includeDrafts: boolean): Promise<PageDataCacheObject[]>

Defined in: studiocms/packages/studiocms/src/sdk/StudioCMSVirtualCache.ts:725

Retrieves all pages from the cache or the database.

boolean = false

Promise<PageDataCacheObject[]>

A promise that resolves to an array of page data cache objects.

If the cache is empty and could not be updated, or if the cache is expired and could not be updated.

  • If caching is disabled, the data is retrieved directly from the database.
  • If the cache is empty, the data is retrieved from the database and stored in the cache.
  • If the cache contains data, it checks for expired entries and updates them from the database if necessary.

getFolderList(): Promise<FolderListCacheObject>

Defined in: studiocms/packages/studiocms/src/sdk/StudioCMSVirtualCache.ts:258

Promise<FolderListCacheObject>

getFolderTree(): Promise<FolderTreeCacheObject>

Defined in: studiocms/packages/studiocms/src/sdk/StudioCMSVirtualCache.ts:325

Retrieves the folder tree from the cache or the database.

Promise<FolderTreeCacheObject>

A promise that resolves to the folder tree.

If the folder tree is not found in the database or if there is an error fetching the folder tree.

getPageById(id: string): Promise<PageDataCacheObject>

Defined in: studiocms/packages/studiocms/src/sdk/StudioCMSVirtualCache.ts:785

Retrieves a page by its ID, either from the cache or the database.

string

The ID of the page to retrieve.

Promise<PageDataCacheObject>

  • A promise that resolves to the page data.
  • Throws an error if the page is not found in the database or if there is an error fetching the page.

getPageBySlug(slug: string): Promise<PageDataCacheObject>

Defined in: studiocms/packages/studiocms/src/sdk/StudioCMSVirtualCache.ts:832

Retrieves a page by its slug from the cache or database.

string

The slug of the page to retrieve.

Promise<PageDataCacheObject>

A promise that resolves to the page data.

If the page is not found in the database or if there is an error fetching the page.

getPageFolderTree(includeDrafts: boolean): Promise<FolderTreeCacheObject>

Defined in: studiocms/packages/studiocms/src/sdk/StudioCMSVirtualCache.ts:363

Retrieves the folder tree from the cache or the database.

boolean = false

Promise<FolderTreeCacheObject>

A promise that resolves to the folder tree.

If the folder tree is not found in the database or if there is an error fetching the folder tree.

getSiteConfig(): Promise<SiteConfigCacheObject>

Defined in: studiocms/packages/studiocms/src/sdk/StudioCMSVirtualCache.ts:573

Retrieves the site configuration from the cache or database.

If caching is disabled, it fetches the site configuration directly from the database. If caching is enabled, it first checks the cache for the site configuration. If the cache is expired or not found, it fetches the site configuration from the database, updates the cache, and returns the configuration.

Promise<SiteConfigCacheObject>

A promise that resolves to the site configuration object.

If the site configuration is not found in the database.

getVersion(): Promise<VersionCacheObject>

Defined in: studiocms/packages/studiocms/src/sdk/StudioCMSVirtualCache.ts:491

Retrieves the version information from the cache or fetches the latest version from NPM if the cache is disabled or expired.

Promise<VersionCacheObject>

A promise that resolves to the version information object.

updateFolderList(): Promise<FolderListCacheObject>

Defined in: studiocms/packages/studiocms/src/sdk/StudioCMSVirtualCache.ts:290

Promise<FolderListCacheObject>

updateFolderTree(): Promise<FolderTreeCacheObject>

Defined in: studiocms/packages/studiocms/src/sdk/StudioCMSVirtualCache.ts:452

Updates the folder tree in the cache and database.

Promise<FolderTreeCacheObject>

A promise that resolves to the updated folder tree.

If there is an error updating the folder tree.

updatePageById(id: string, data: {
pageContent: {
content: null | string;
contentId: string;
contentLang: string;
id: string;
};
pageData: {
authorId: null | string;
categories: unknown;
contentLang: string;
contributorIds: unknown;
description: string;
draft: null | boolean;
heroImage: string;
id: string;
package: string;
parentFolder: null | string;
publishedAt: Date;
showAuthor: null | boolean;
showContributors: null | boolean;
showOnNav: boolean;
slug: string;
tags: unknown;
title: string;
updatedAt: null | Date;
};
}): Promise<PageDataCacheObject>

Defined in: studiocms/packages/studiocms/src/sdk/StudioCMSVirtualCache.ts:882

Updates a page by its ID with the provided data.

string

The ID of the page to update.

An object containing the page data and page content to update.

{ content: null | string; contentId: string; contentLang: string; id: string; }

The content of the page to update.

null | string

string

string

string

{ authorId: null | string; categories: unknown; contentLang: string; contributorIds: unknown; description: string; draft: null | boolean; heroImage: string; id: string; package: string; parentFolder: null | string; publishedAt: Date; showAuthor: null | boolean; showContributors: null | boolean; showOnNav: boolean; slug: string; tags: unknown; title: string; updatedAt: null | Date; }

The data of the page to update.

null | string

unknown

string

unknown

string

null | boolean

string

string

string

null | string

Date

null | boolean

null | boolean

boolean

string

unknown

string

null | Date

Promise<PageDataCacheObject>

A promise that resolves to the updated page data cache object.

If the page is not found in the database or if there is an error updating the page.

updatePageBySlug(slug: string, data: {
pageContent: {
content: null | string;
contentId: string;
contentLang: string;
id: string;
};
pageData: {
authorId: null | string;
categories: unknown;
contentLang: string;
contributorIds: unknown;
description: string;
draft: null | boolean;
heroImage: string;
id: string;
package: string;
parentFolder: null | string;
publishedAt: Date;
showAuthor: null | boolean;
showContributors: null | boolean;
showOnNav: boolean;
slug: string;
tags: unknown;
title: string;
updatedAt: null | Date;
};
}): Promise<PageDataCacheObject>

Defined in: studiocms/packages/studiocms/src/sdk/StudioCMSVirtualCache.ts:940

Updates a page by its slug and package name.

string

The slug of the page to update.

An object containing the page data and page content to update.

{ content: null | string; contentId: string; contentLang: string; id: string; }

The content of the page to update.

null | string

string

string

string

{ authorId: null | string; categories: unknown; contentLang: string; contributorIds: unknown; description: string; draft: null | boolean; heroImage: string; id: string; package: string; parentFolder: null | string; publishedAt: Date; showAuthor: null | boolean; showContributors: null | boolean; showOnNav: boolean; slug: string; tags: unknown; title: string; updatedAt: null | Date; }

The data of the page to update.

null | string

unknown

string

unknown

string

null | boolean

string

string

string

null | string

Date

null | boolean

null | boolean

boolean

string

unknown

string

null | Date

Promise<PageDataCacheObject>

A promise that resolves to the updated page data cache object.

If the page is not found in the cache or database, or if there is an error updating the page.

updateSiteConfig(data: SiteConfig): Promise<SiteConfigCacheObject>

Defined in: studiocms/packages/studiocms/src/sdk/StudioCMSVirtualCache.ts:614

Updates the site configuration in the database and cache.

SiteConfig

The new site configuration data to be updated.

Promise<SiteConfigCacheObject>

A promise that resolves to the updated site configuration cache object.

If the updated data could not be retrieved from the database.

updateVersion(): Promise<VersionCacheObject>

Defined in: studiocms/packages/studiocms/src/sdk/StudioCMSVirtualCache.ts:524

Updates the version cache with the latest version from NPM.

Promise<VersionCacheObject>

A promise that resolves to the new version cache object.

If there is an issue retrieving the latest version from NPM.

Renames and re-exports StudioCMSVirtualCache