sdk/core
Functions
'Read the “', Functions, '” section'studiocmsSDKCore()
'Read the “', studiocmsSDKCore(), '” section'function studiocmsSDKCore(): { 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[];}
Defined in: studiocms/packages/studiocms/src/sdk/core.ts:86
The core SDK for StudioCMS.
This SDK provides access to the core functionality of StudioCMS, including the ability to interact with the database, manage users, and more.
{ 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[];}
An object containing the core functionality of the StudioCMS SDK.
addPageToFolderTree()
'Read the “', addPageToFolderTree(), '” section'addPageToFolderTree: (tree: FolderNode[], folderId: string, newPage: FolderNode) => FolderNode[];
Adds a new page to the folder tree.
Parameters
'Read the “', Parameters, '” section'The root of the folder tree.
string
The ID of the parent folder.
The new page to add.
The updated folder tree
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; }>; };};
AUTH.oAuth
'Read the “', AUTH.oAuth, '” section'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; }>;};
Provides various methods to create, delete, and search for OAuth accounts in the StudioCMS database.
AUTH.oAuth.create()
'Read the “', AUTH.oAuth.create(), '” section'create: (data: { provider: string; providerUserId: string; userId: string; }) => Promise<{ provider: string; providerUserId: string; userId: string;}>;
Creates a new OAuth account in the database.
Parameters
'Read the “', Parameters, '” section'The data to insert into the OAuth account table.
string
providerUserId
'Read the “', providerUserId, '” section'string
string
Promise
<{
provider
: string
;
providerUserId
: string
;
userId
: string
;
}>
A promise that resolves to the inserted OAuth account.
If an error occurs while creating the OAuth account.
AUTH.oAuth.delete()
'Read the “', AUTH.oAuth.delete(), '” section'delete: (userId: string, provider: string) => Promise<DeletionResponse>;
Deletes an OAuth account from the database.
Parameters
'Read the “', Parameters, '” section'string
The ID of the user associated with the OAuth account.
string
The provider of the OAuth account.
Promise
<DeletionResponse
>
A promise that resolves to a deletion response.
If an error occurs while deleting the OAuth account.
AUTH.oAuth.searchProvidersForId()
'Read the “', AUTH.oAuth.searchProvidersForId(), '” section'searchProvidersForId: (providerId: string, userId: string) => Promise< | undefined | { provider: string; providerUserId: string; userId: string;}>;
Searches for OAuth accounts based on the provider ID and user ID.
Parameters
'Read the “', Parameters, '” section'providerId
'Read the “', providerId, '” section'string
The provider ID to search for.
string
The user ID to search for.
Promise
<
| undefined
| {
provider
: string
;
providerUserId
: string
;
userId
: string
;
}>
A promise that resolves to the OAuth account data if found, otherwise undefined.
If an error occurs while searching for the OAuth account.
AUTH.permission
'Read the “', AUTH.permission, '” section'permission: { currentStatus: (userId: string) => Promise< | undefined | { rank: string; user: string; }>;};
Provides various methods to get and update permissions for users in the StudioCMS database.
AUTH.permission.currentStatus()
'Read the “', AUTH.permission.currentStatus(), '” section'currentStatus: (userId: string) => Promise< | undefined | { rank: string; user: string;}>;
Checks the current status of a user’s permissions.
Parameters
'Read the “', Parameters, '” section'string
Promise
<
| undefined
| {
rank
: string
;
user
: string
;
}>
AUTH.session
'Read the “', AUTH.session, '” section'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; }[]>;};
Provides various methods to create, delete, and update sessions in the StudioCMS database.
AUTH.session.create()
'Read the “', AUTH.session.create(), '” section'create: (data: { expiresAt: Date; id: string; userId: string; }) => Promise<{ expiresAt: Date; id: string; userId: string;}>;
Creates a new session in the database.
Parameters
'Read the “', Parameters, '” section'The data to insert into the session table.
expiresAt
'Read the “', expiresAt, '” section'Date
string
string
Promise
<{
expiresAt
: Date
;
id
: string
;
userId
: string
;
}>
A promise that resolves to the inserted session.
If an error occurs while creating the session.
AUTH.session.delete()
'Read the “', AUTH.session.delete(), '” section'delete: (sessionId: string) => Promise<DeletionResponse>;
Deletes a session from the database.
Parameters
'Read the “', Parameters, '” section'sessionId
'Read the “', sessionId, '” section'string
The ID of the session to delete.
Promise
<DeletionResponse
>
A promise that resolves to a deletion response.
If an error occurs while deleting the session.
AUTH.session.sessionWithUser()
'Read the “', AUTH.session.sessionWithUser(), '” section'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; };}[]>;
Gets a session with the associated user.
Parameters
'Read the “', Parameters, '” section'sessionId
'Read the “', sessionId, '” section'string
The ID of the session to search for.
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
;
};
}[]>
A promise that resolves to the session with the associated user.
If an error occurs while getting the session with the user.
AUTH.session.update()
'Read the “', AUTH.session.update(), '” section'update: (sessionId: string, newDate: Date) => Promise<{ expiresAt: Date; id: string; userId: string;}[]>;
Updates the expiration date of a session.
Parameters
'Read the “', Parameters, '” section'sessionId
'Read the “', sessionId, '” section'string
The ID of the session to update.
Date
The new expiration date for the session.
Promise
<{
expiresAt
: Date
;
id
: string
;
userId
: string
;
}[]>
A promise that resolves to the updated session.
If an error occurs while updating the session.
AUTH.user
'Read the “', AUTH.user, '” section'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; }>;};
Provides various methods to create, update, and search for users in the StudioCMS database.
AUTH.user.create()
'Read the “', AUTH.user.create(), '” section'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;}>;
Creates a new user in the database.
Parameters
'Read the “', Parameters, '” section'newUserData
'Read the “', newUserData, '” section'The data to insert into the users table.
null
| string
createdAt?
'Read the “', createdAt?, '” section'null
| Date
null
| string
string
string
password?
'Read the “', password?, '” section'null
| string
updatedAt?
'Read the “', updatedAt?, '” section'null
| Date
null
| string
string
"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
;
}>
A promise that resolves to the inserted user.
If an error occurs while creating the user.
AUTH.user.ghost
'Read the “', AUTH.user.ghost, '” section'ghost: { create: () => Promise<any>; get: () => Promise<any>; verifyExists: () => Promise<boolean>;};
Ghost user utilities.
AUTH.user.ghost.create()
'Read the “', AUTH.user.ghost.create(), '” section'create: () => Promise<any>;
Creates the ghost user in the database.
Promise
<any
>
A promise that resolves to the inserted ghost user.
If an error occurs while creating the ghost user.
AUTH.user.ghost.get()
'Read the “', AUTH.user.ghost.get(), '” section'get: () => Promise<any>;
Gets the ghost user from the database.
Promise
<any
>
A promise that resolves to the ghost user.
If an error occurs while getting the ghost user.
AUTH.user.ghost.verifyExists()
'Read the “', AUTH.user.ghost.verifyExists(), '” section'verifyExists: () => Promise<boolean>;
Verifies if the ghost user exists in the database.
Promise
<boolean
>
A promise that resolves to a boolean indicating if the ghost user exists.
If an error occurs while verifying the ghost user.
AUTH.user.searchUsersForUsernameOrEmail()
'Read the “', AUTH.user.searchUsersForUsernameOrEmail(), '” section'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; }[];}>;
Searches for users based on the provided username or email.
Parameters
'Read the “', Parameters, '” section'string
The username to search for.
string
The email to search for.
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
;
}[];
}>
A promise that resolves to an object containing the search results for the username and email.
If an error occurs while searching for the username or email.
AUTH.user.update()
'Read the “', AUTH.user.update(), '” section'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;}>;
Updates a user in the database.
Parameters
'Read the “', Parameters, '” section'string
The ID of the user to update.
Partial
The data to update the user with.
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
;
}>
A promise that resolves to the updated user.
If an error occurs while updating the user.
buildFolderTree()
'Read the “', buildFolderTree(), '” section'buildFolderTree: () => Promise<FolderNode[]>;
Gets the folder structure from the database.
Promise
<FolderNode
[]>
A promise that resolves to an array of folder nodes representing the folder structure.
clearUserReferences()
'Read the “', clearUserReferences(), '” section'clearUserReferences: (userId: string) => Promise<boolean>;
Parameters
'Read the “', Parameters, '” section'string
Promise
<boolean
>
collectCategories()
'Read the “', collectCategories(), '” section'collectCategories: (categoryIds: number[]) => Promise<{ description: string; id: number; meta: unknown; name: string; parent: null | number; slug: string;}[]>;
Collects categories based on the provided category IDs.
Parameters
'Read the “', Parameters, '” section'categoryIds
'Read the “', categoryIds, '” section'number
[]
An array of category IDs to collect.
Promise
<{
description
: string
;
id
: number
;
meta
: unknown
;
name
: string
;
parent
: null
| number
;
slug
: string
;
}[]>
A promise that resolves to an array of collected categories.
If there is an error while collecting categories.
collectPageData()
'Read the “', collectPageData(), '” section'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>;
Collects and combines various data related to a page.
Parameters
'Read the “', Parameters, '” section'The page data to collect additional information for.
null
| string
categories
'Read the “', categories, '” section'unknown
contentLang
'Read the “', contentLang, '” section'string
contributorIds
'Read the “', contributorIds, '” section'unknown
description
'Read the “', description, '” section'string
null
| boolean
heroImage
'Read the “', heroImage, '” section'string
string
string
parentFolder
'Read the “', parentFolder, '” section'null
| string
publishedAt
'Read the “', publishedAt, '” section'Date
showAuthor
'Read the “', showAuthor, '” section'null
| boolean
showContributors
'Read the “', showContributors, '” section'null
| boolean
showOnNav
'Read the “', showOnNav, '” section'boolean
string
unknown
string
updatedAt
'Read the “', updatedAt, '” section'null
| Date
Promise
<CombinedPageData
>
A promise that resolves to the combined page data.
If an error occurs while collecting page data.
collectTags()
'Read the “', collectTags(), '” section'collectTags: (tagIds: number[]) => Promise<{ description: string; id: number; meta: unknown; name: string; slug: string;}[]>;
Collects tags based on the provided tag IDs.
Parameters
'Read the “', Parameters, '” section'number
[]
An array of tag IDs to collect.
Promise
<{
description
: string
;
id
: number
;
meta
: unknown
;
name
: string
;
slug
: string
;
}[]>
A promise that resolves to an array of tags.
If an error occurs while fetching the tags.
collectUserData()
'Read the “', collectUserData(), '” section'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>;
Collects user data by fetching OAuth data and permission data from the database.
Parameters
'Read the “', Parameters, '” section'The user object containing user information.
null
| string
createdAt
'Read the “', createdAt, '” section'null
| Date
null
| string
string
string
null
| string
updatedAt
'Read the “', updatedAt, '” section'null
| Date
null
| string
string
Promise
<CombinedUserData
>
A promise that resolves to a CombinedUserData object containing the user data, OAuth data, and permissions data.
If an error occurs while collecting user data.
combineRanks()
'Read the “', combineRanks(), '” section'combineRanks: (rank: string, users: SingleRank[]) => CombinedRank[];
Combines a given rank with an array of user ranks.
Parameters
'Read the “', Parameters, '” section'string
The rank to be combined with each user.
An array of user ranks to be combined with the given rank.
An array of combined ranks, where each element includes the given rank and the properties of a user rank.
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>;};
DELETE.categories()
'Read the “', DELETE.categories(), '” section'categories: (id: number) => Promise<DeletionResponse>;
Deletes a category from the database.
Parameters
'Read the “', Parameters, '” section'number
The ID of the category to delete.
Promise
<DeletionResponse
>
A promise that resolves to a deletion response.
If an error occurs while deleting the category.
DELETE.diffTracking()
'Read the “', DELETE.diffTracking(), '” section'diffTracking: (id: string) => Promise<DeletionResponse>;
Deletes a site configuration from the database.
Parameters
'Read the “', Parameters, '” section'string
The ID of the site configuration to delete.
Promise
<DeletionResponse
>
A promise that resolves to a deletion response.
If an error occurs while deleting the site configuration.
DELETE.folder()
'Read the “', DELETE.folder(), '” section'folder: (id: string) => Promise<DeletionResponse>;
Deletes a folder from the database.
Parameters
'Read the “', Parameters, '” section'string
The ID of the folder to delete.
Promise
<DeletionResponse
>
A promise that resolves to a deletion response.
If an error occurs while deleting the folder.
DELETE.page()
'Read the “', DELETE.page(), '” section'page: (id: string) => Promise<DeletionResponse>;
Deletes a page from the database.
Parameters
'Read the “', Parameters, '” section'string
The ID of the page to delete.
Promise
<DeletionResponse
>
A promise that resolves to a deletion response.
If an error occurs while deleting the page.
DELETE.pageContent()
'Read the “', DELETE.pageContent(), '” section'pageContent: (id: string) => Promise<DeletionResponse>;
Deletes a page content from the database.
Parameters
'Read the “', Parameters, '” section'string
The ID of the page content to delete.
Promise
<DeletionResponse
>
A promise that resolves to a deletion response.
If an error occurs while deleting the page content.
DELETE.pageContentLang()
'Read the “', DELETE.pageContentLang(), '” section'pageContentLang: (id: string, lang: string) => Promise<DeletionResponse>;
Deletes a page content lang from the database.
Parameters
'Read the “', Parameters, '” section'string
The ID of the page content to delete.
string
The lang of the page content to delete.
Promise
<DeletionResponse
>
A promise that resolves to a deletion response.
If an error occurs while deleting the page content lang.
DELETE.permissions()
'Read the “', DELETE.permissions(), '” section'permissions: (userId: string) => Promise<DeletionResponse>;
Deletes a permission from the database.
Parameters
'Read the “', Parameters, '” section'string
The ID of the user to delete the permission for.
Promise
<DeletionResponse
>
A promise that resolves to a deletion response.
If an error occurs while deleting the permission.
DELETE.tags()
'Read the “', DELETE.tags(), '” section'tags: (id: number) => Promise<DeletionResponse>;
Deletes a tag from the database.
Parameters
'Read the “', Parameters, '” section'number
The ID of the tag to delete.
Promise
<DeletionResponse
>
A promise that resolves to a deletion response.
If an error occurs while deleting the tag.
DELETE.user()
'Read the “', DELETE.user(), '” section'user: (id: string) => Promise<DeletionResponse>;
Deletes a user from the database.
Parameters
'Read the “', Parameters, '” section'string
The ID of the user to delete.
Promise
<DeletionResponse
>
A promise that resolves to a deletion response.
If an error occurs while deleting the user.
diffTracking
'Read the “', diffTracking, '” section'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>;};
diffTracking.clear()
'Read the “', diffTracking.clear(), '” section'clear: (pageId: string) => Promise<void>;
Parameters
'Read the “', Parameters, '” section'string
Promise
<void
>
diffTracking.get
'Read the “', diffTracking.get, '” section'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>;};
diffTracking.get.byPageId
'Read the “', diffTracking.get.byPageId, '” section'byPageId: { all: (pageId: string) => Promise<any>; latest: (pageId: string, count: number) => Promise<any>;};
diffTracking.get.byPageId.all()
'Read the “', diffTracking.get.byPageId.all(), '” section'all: (pageId: string) => Promise<any>;
Parameters
'Read the “', Parameters, '” section'string
Promise
<any
>
diffTracking.get.byPageId.latest()
'Read the “', diffTracking.get.byPageId.latest(), '” section'latest: (pageId: string, count: number) => Promise<any>;
Parameters
'Read the “', Parameters, '” section'string
number
Promise
<any
>
diffTracking.get.byUserId
'Read the “', diffTracking.get.byUserId, '” section'byUserId: { all: (userId: string) => Promise<any>; latest: (userId: string, count: number) => Promise<any>;};
diffTracking.get.byUserId.all()
'Read the “', diffTracking.get.byUserId.all(), '” section'all: (userId: string) => Promise<any>;
Parameters
'Read the “', Parameters, '” section'string
Promise
<any
>
diffTracking.get.byUserId.latest()
'Read the “', diffTracking.get.byUserId.latest(), '” section'latest: (userId: string, count: number) => Promise<any>;
Parameters
'Read the “', Parameters, '” section'string
number
Promise
<any
>
diffTracking.get.single()
'Read the “', diffTracking.get.single(), '” section'single: (id: string) => Promise<any>;
Parameters
'Read the “', Parameters, '” section'string
Promise
<any
>
diffTracking.get.withHtml()
'Read the “', diffTracking.get.withHtml(), '” section'withHtml: (id: string, options?: any) => Promise<any>;
Parameters
'Read the “', Parameters, '” section'string
any
Promise
<any
>
diffTracking.insert()
'Read the “', diffTracking.insert(), '” section'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>;
Parameters
'Read the “', Parameters, '” section'string
string
{
end
: string
;
start
: string
;
}
content.end
'Read the “', content.end, '” section'string
content.start
'Read the “', content.start, '” section'string
{
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
;
}>;
}
metaData.end
'Read the “', metaData.end, '” section'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
;
}>
metaData.start
'Read the “', metaData.start, '” section'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
'Read the “', diffLength, '” section'number
Promise
<any
>
diffTracking.revertToDiff()
'Read the “', diffTracking.revertToDiff(), '” section'revertToDiff: (id: string, type: "content" | "data" | "both") => Promise<any>;
Parameters
'Read the “', Parameters, '” section'string
"content"
| "data"
| "both"
Promise
<any
>
findNodeById()
'Read the “', findNodeById(), '” section'findNodeById: (tree: FolderNode[], id: string) => null | FolderNode;
Finds a node by its ID in the tree.
Parameters
'Read the “', Parameters, '” section'string
The ID of the node to find.
null
| FolderNode
The node or null if not found.
findNodeByPath()
'Read the “', findNodeByPath(), '” section'findNodeByPath: (tree: FolderNode[], path: string[]) => null | FolderNode;
Finds a node in the tree that matches the given URL path.
Parameters
'Read the “', Parameters, '” section'The root of the folder tree.
string
[]
The URL path to locate.
null
| FolderNode
The matching node or null if not found.
findNodesAlongPath()
'Read the “', findNodesAlongPath(), '” section'findNodesAlongPath: (tree: FolderNode[], path: string[]) => FolderNode[];
Finds all nodes along the path to a given URL.
Parameters
'Read the “', Parameters, '” section'The root of the folder tree.
string
[]
The URL path to locate.
The nodes along the path.
generateRandomIDNumber()
'Read the “', generateRandomIDNumber(), '” section'generateRandomIDNumber: (length: number) => number;
Generates a random ID number with the specified length.
Parameters
'Read the “', Parameters, '” section'number
The length of the random ID number to generate.
number
A random ID number with the specified length.
generateRandomPassword()
'Read the “', generateRandomPassword(), '” section'generateRandomPassword: (length: number) => string;
Generates a random password of the specified length.
Parameters
'Read the “', Parameters, '” section'number
The length of the password to generate.
string
A randomly generated password string containing uppercase letters, lowercase letters, and digits.
generateToken()
'Read the “', generateToken(), '” section'generateToken: (userId: string) => string;
Generates a JSON Web Token (JWT) for a given user ID.
Parameters
'Read the “', Parameters, '” section'string
The unique identifier of the user for whom the token is being generated.
string
A signed JWT string that expires in 3 hours.
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[]>; };};
GET.database
'Read the “', GET.database, '” section'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[]>;};
Retrieves data from the database
GET.database.config()
'Read the “', GET.database.config(), '” section'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;}>;
Retrieves the site configuration 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
;
}>
A promise that resolves to the site configuration.
If an error occurs while getting the site configuration.
GET.database.folders()
'Read the “', GET.database.folders(), '” section'folders: () => Promise<{ id: string; name: string; parent: null | string;}[]>;
Promise
<{
id
: string
;
name
: string
;
parent
: null
| string
;
}[]>
GET.database.pages()
'Read the “', GET.database.pages(), '” section'pages: (includeDrafts: boolean, tree?: FolderNode[]) => Promise<CombinedPageData[]>;
Retrieves all pages from the database.
Parameters
'Read the “', Parameters, '” section'includeDrafts
'Read the “', includeDrafts, '” section'boolean
= false
Promise
<CombinedPageData
[]>
A promise that resolves to an array of combined page data.
If an error occurs while getting the pages.
GET.database.users()
'Read the “', GET.database.users(), '” section'users: () => Promise<CombinedUserData[]>;
Retrieves all users from the database.
Promise
<CombinedUserData
[]>
A promise that resolves to an array of combined user data.
If an error occurs while getting the users.
GET.databaseEntry
'Read the “', GET.databaseEntry, '” section'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>; };};
Retrieves data from the database by ID.
GET.databaseEntry.folder()
'Read the “', GET.databaseEntry.folder(), '” section'folder: (id: string) => Promise< | undefined | { id: string; name: string; parent: null | string;}>;
Parameters
'Read the “', Parameters, '” section'string
Promise
<
| undefined
| {
id
: string
;
name
: string
;
parent
: null
| string
;
}>
GET.databaseEntry.pages
'Read the “', GET.databaseEntry.pages, '” section'pages: { byId: (id: string, tree?: FolderNode[]) => Promise< | undefined | CombinedPageData>; bySlug: (slug: string, tree?: FolderNode[]) => Promise< | undefined | CombinedPageData>;};
Retrieves a page from the database
GET.databaseEntry.pages.byId()
'Read the “', GET.databaseEntry.pages.byId(), '” section'byId: (id: string, tree?: FolderNode[]) => Promise< | undefined| CombinedPageData>;
Retrieves a page by ID.
Parameters
'Read the “', Parameters, '” section'string
The ID of the page to retrieve.
Promise
<
| undefined
| CombinedPageData
>
A promise that resolves to the page data.
If an error occurs while getting the page.
GET.databaseEntry.pages.bySlug()
'Read the “', GET.databaseEntry.pages.bySlug(), '” section'bySlug: (slug: string, tree?: FolderNode[]) => Promise< | undefined| CombinedPageData>;
Retrieves a page by slug.
Parameters
'Read the “', Parameters, '” section'string
The slug of the page to retrieve.
Promise
<
| undefined
| CombinedPageData
>
A promise that resolves to the page data.
If an error occurs while getting the page.
GET.databaseEntry.users
'Read the “', GET.databaseEntry.users, '” section'users: { byEmail: (email: string) => Promise< | undefined | CombinedUserData>; byId: (id: string) => Promise< | undefined | CombinedUserData>; byUsername: (username: string) => Promise< | undefined | CombinedUserData>;};
Retrieves a user from the database
GET.databaseEntry.users.byEmail()
'Read the “', GET.databaseEntry.users.byEmail(), '” section'byEmail: (email: string) => Promise< | undefined| CombinedUserData>;
Retrieves a user by email.
Parameters
'Read the “', Parameters, '” section'string
The email of the user to retrieve.
Promise
<
| undefined
| CombinedUserData
>
A promise that resolves to the user data.
If an error occurs while getting the user.
GET.databaseEntry.users.byId()
'Read the “', GET.databaseEntry.users.byId(), '” section'byId: (id: string) => Promise< | undefined| CombinedUserData>;
Retrieves a user by ID.
Parameters
'Read the “', Parameters, '” section'string
The ID of the user to retrieve.
Promise
<
| undefined
| CombinedUserData
>
A promise that resolves to the user data.
If an error occurs while getting the user.
GET.databaseEntry.users.byUsername()
'Read the “', GET.databaseEntry.users.byUsername(), '” section'byUsername: (username: string) => Promise< | undefined| CombinedUserData>;
Retrieves a user by username.
Parameters
'Read the “', Parameters, '” section'string
The username of the user to retrieve.
Promise
<
| undefined
| CombinedUserData
>
A promise that resolves to the user data.
If an error occurs while getting the user.
GET.databaseTable
'Read the “', GET.databaseTable, '” section'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>;};
Retrieves data from the database tables without any additional processing.
GET.databaseTable.diffTracking()
'Read the “', GET.databaseTable.diffTracking(), '” section'diffTracking: () => Promise<any>;
Retrieves all data from the diff tracking table.
Promise
<any
>
A promise that resolves to an array of diff tracking data.
If an error occurs while getting the diff tracking data.
GET.databaseTable.oAuthAccounts()
'Read the “', GET.databaseTable.oAuthAccounts(), '” section'oAuthAccounts: () => Promise<any>;
Retrieves all data from the OAuth accounts table.
Promise
<any
>
A promise that resolves to an array of OAuth account data.
If an error occurs while getting the OAuth accounts.
GET.databaseTable.pageContent()
'Read the “', GET.databaseTable.pageContent(), '” section'pageContent: () => Promise<any>;
Retrieves all data from the page content table.
Promise
<any
>
A promise that resolves to an array of page content.
If an error occurs while getting the page content.
GET.databaseTable.pageData()
'Read the “', GET.databaseTable.pageData(), '” section'pageData: () => Promise<any>;
Retrieves all data from the page data table.
Promise
<any
>
A promise that resolves to an array of page data.
If an error occurs while getting the pages.
GET.databaseTable.pageDataCategories()
'Read the “', GET.databaseTable.pageDataCategories(), '” section'pageDataCategories: () => Promise<any>;
Retrieves all data from the page data categories table.
Promise
<any
>
A promise that resolves to an array of page data categories.
If an error occurs while getting the page data categories.
GET.databaseTable.pageDataTags()
'Read the “', GET.databaseTable.pageDataTags(), '” section'pageDataTags: () => Promise<any>;
Retrieves all data from the page data tags table.
Promise
<any
>
A promise that resolves to an array of page data tags.
If an error occurs while getting the page data tags.
GET.databaseTable.pageFolderStructure()
'Read the “', GET.databaseTable.pageFolderStructure(), '” section'pageFolderStructure: () => Promise<any>;
Retrieves all data from the page folder structure table.
Promise
<any
>
A promise that resolves to an array of page folder structure data.
If an error occurs while getting the page folder structure data.
GET.databaseTable.permissions()
'Read the “', GET.databaseTable.permissions(), '” section'permissions: () => Promise<any>;
Retrieves all data from the permissions table.
Promise
<any
>
A promise that resolves to an array of permission data.
If an error occurs while getting the permissions.
GET.databaseTable.sessionTable()
'Read the “', GET.databaseTable.sessionTable(), '” section'sessionTable: () => Promise<any>;
Retrieves all data from the session table.
Promise
<any
>
A promise that resolves to an array of session data.
If an error occurs while getting the sessions.
GET.databaseTable.siteConfig()
'Read the “', GET.databaseTable.siteConfig(), '” section'siteConfig: () => Promise<any>;
Retrieves all data from the site config table.
Promise
<any
>
A promise that resolves to an array of site configuration data.
If an error occurs while getting the site configuration.
GET.databaseTable.users()
'Read the “', GET.databaseTable.users(), '” section'users: () => Promise<any>;
Retrieves all data from the users table.
Promise
<any
>
A promise that resolves to an array of user data.
If an error occurs while getting the users.
GET.packagePages()
'Read the “', GET.packagePages(), '” section'packagePages: (packageName: string, tree?: FolderNode[]) => Promise<CombinedPageData[]>;
Retrieves data from the database by package.
Parameters
'Read the “', Parameters, '” section'packageName
'Read the “', packageName, '” section'string
Promise
<CombinedPageData
[]>
GET.permissionsLists
'Read the “', GET.permissionsLists, '” section'permissionsLists: { admins: () => Promise<SingleRank[]>; all: () => Promise<CombinedRank[]>; editors: () => Promise<SingleRank[]>; owners: () => Promise<SingleRank[]>; visitors: () => Promise<SingleRank[]>;};
Retrieve Permission Lists
GET.permissionsLists.admins()
'Read the “', GET.permissionsLists.admins(), '” section'admins: () => Promise<SingleRank[]>;
Retrieves all admins in the database.
Promise
<SingleRank
[]>
A promise that resolves to an array of combined rank data.
If an error occurs while getting the admins.
GET.permissionsLists.all()
'Read the “', GET.permissionsLists.all(), '” section'all: () => Promise<CombinedRank[]>;
Retrieves all permissions for users in the database.
Promise
<CombinedRank
[]>
A promise that resolves to an array of combined rank data.
If an error occurs while getting the permissions.
GET.permissionsLists.editors()
'Read the “', GET.permissionsLists.editors(), '” section'editors: () => Promise<SingleRank[]>;
Retrieves all editors in the database.
Promise
<SingleRank
[]>
A promise that resolves to an array of combined rank data.
If an error occurs while getting the editors.
GET.permissionsLists.owners()
'Read the “', GET.permissionsLists.owners(), '” section'owners: () => Promise<SingleRank[]>;
Retrieves all owners in the database.
Promise
<SingleRank
[]>
A promise that resolves to an array of combined rank data.
If an error occurs while getting the owners.
GET.permissionsLists.visitors()
'Read the “', GET.permissionsLists.visitors(), '” section'visitors: () => Promise<SingleRank[]>;
Retrieves all visitors in the database.
Promise
<SingleRank
[]>
A promise that resolves to an array of combined rank data.
If an error occurs while getting the visitors.
getAvailableFolders()
'Read the “', getAvailableFolders(), '” section'getAvailableFolders: () => Promise<FolderListItem[]>;
Gets the available folders from the database.
Promise
<FolderListItem
[]>
A promise that resolves to an array of folder list items.
getFullPath()
'Read the “', getFullPath(), '” section'getFullPath: (tree: FolderNode[], path: string[]) => string[];
Finds the full path to a node based on its URL.
Parameters
'Read the “', Parameters, '” section'The root of the folder tree.
string
[]
The URL path to locate.
string
[]
The full path as an array of node names.
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; }>;};
INIT.ghostUser()
'Read the “', INIT.ghostUser(), '” section'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;}>;
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.
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
;
}>
A promise that resolves to the ghost user record.
If an error occurs while creating the ghost user.
INIT.siteConfig()
'Read the “', INIT.siteConfig(), '” section'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;}>;
Initializes the StudioCMS SiteConfig table with the provided configuration.
Parameters
'Read the “', Parameters, '” section'The configuration to insert into the SiteConfig table.
defaultOgImage?
'Read the “', defaultOgImage?, '” section'null
| string
description
'Read the “', description, '” section'string
diffPerPage?
'Read the “', diffPerPage?, '” section'number
enableDiffs?
'Read the “', enableDiffs?, '” section'boolean
gridItems?
'Read the “', gridItems?, '” section'unknown
number
loginPageBackground?
'Read the “', loginPageBackground?, '” section'string
loginPageCustomImage?
'Read the “', loginPageCustomImage?, '” section'null
| string
siteIcon?
'Read the “', siteIcon?, '” section'null
| string
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
;
}>
A promise that resolves to the inserted site configuration.
If an error occurs while creating the site configuration.
parseIdNumberArray()
'Read the “', parseIdNumberArray(), '” section'parseIdNumberArray: (ids: unknown) => number[];
Parses an unknown input and casts it to an array of numbers.
Parameters
'Read the “', Parameters, '” section'unknown
The input to be parsed, expected to be an array of numbers.
number
[]
An array of numbers.
parseIdStringArray()
'Read the “', parseIdStringArray(), '” section'parseIdStringArray: (ids: unknown) => string[];
Parses the given input as an array of strings.
Parameters
'Read the “', Parameters, '” section'unknown
The input to be parsed, expected to be an array of unknown type.
string
[]
An array of strings parsed from the input.
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[]>; };};
POST.databaseEntries
'Read the “', POST.databaseEntries, '” section'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[]>;};
Inserts data into the database by Array of Entries
POST.databaseEntries.categories()
'Read the “', POST.databaseEntries.categories(), '” section'categories: (data: { description: string; id: number; meta: unknown; name: string; parent: null | number; slug: string;}[]) => Promise<PageDataCategoriesInsertResponse[]>;
Inserts multiple categories into the database.
Parameters
'Read the “', Parameters, '” section'{
description
: string
;
id
: number
;
meta
: unknown
;
name
: string
;
parent
: null
| number
;
slug
: string
;
}[]
The data to insert into the page data categories table.
Promise
<PageDataCategoriesInsertResponse
[]>
A promise that resolves to the inserted categories.
If an error occurs while inserting the categories.
POST.databaseEntries.pages()
'Read the “', POST.databaseEntries.pages(), '” section'pages: (pages: MultiPageInsert) => Promise<void>;
Inserts multiple pages into the database.
Parameters
'Read the “', Parameters, '” section'The data to insert into the page data and page content tables.
Promise
<void
>
A promise that resolves to the inserted pages.
If an error occurs while inserting the pages.
POST.databaseEntries.permissions()
'Read the “', POST.databaseEntries.permissions(), '” section'permissions: (data: { rank: string; user: string; }[]) => Promise<{ rank: string; user: string;}[]>;
Inserts multiple permissions into the database.
Parameters
'Read the “', Parameters, '” section'{
rank
: string
;
user
: string
;
}[]
The data to insert into the permissions table.
Promise
<{
rank
: string
;
user
: string
;
}[]>
A promise that resolves to the inserted permissions.
If an error occurs while inserting the permissions.
POST.databaseEntries.tags()
'Read the “', POST.databaseEntries.tags(), '” section'tags: (data: { description: string; id: number; meta: unknown; name: string; slug: string;}[]) => Promise<PageDataTagsInsertResponse[]>;
Inserts multiple tags into the database.
Parameters
'Read the “', Parameters, '” section'{
description
: string
;
id
: number
;
meta
: unknown
;
name
: string
;
slug
: string
;
}[]
The data to insert into the page data tags table.
Promise
<PageDataTagsInsertResponse
[]>
A promise that resolves to the inserted tags.
If an error occurs while inserting the tags.
POST.databaseEntry
'Read the “', POST.databaseEntry, '” section'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[]>;};
Inserts data into the database by Entry
POST.databaseEntry.categories()
'Read the “', POST.databaseEntry.categories(), '” section'categories: (category: { description: string; id: number; meta: unknown; name: string; parent: null | number; slug: string;}) => Promise<any>;
Inserts a new category into the database.
Parameters
'Read the “', Parameters, '” section'The data to insert into the page data categories table.
description
'Read the “', description, '” section'string
number
unknown
string
null
| number
string
Promise
<any
>
A promise that resolves to the inserted category.
If an error occurs while inserting the category.
POST.databaseEntry.diffTracking()
'Read the “', POST.databaseEntry.diffTracking(), '” section'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;}[]>;
Inserts a new diff tracking entry into the database.
Parameters
'Read the “', Parameters, '” section'The data to insert into the diff tracking table.
null
| string
string
pageContentStart
'Read the “', pageContentStart, '” section'string
string
pageMetaData?
'Read the “', pageMetaData?, '” section'unknown
timestamp?
'Read the “', timestamp?, '” section'null
| Date
string
Promise
<{
diff
: null
| string
;
id
: string
;
pageContentStart
: string
;
pageId
: string
;
pageMetaData
: unknown
;
timestamp
: null
| Date
;
userId
: string
;
}[]>
A promise that resolves to the inserted diff tracking entry.
If an error occurs while inserting the diff tracking entry.
POST.databaseEntry.folder()
'Read the “', POST.databaseEntry.folder(), '” section'folder: (folder: { id: string; name: string; parent: null | string; }) => Promise<{ id: string; name: string; parent: null | string;}[]>;
Inserts a new folder into the database.
Parameters
'Read the “', Parameters, '” section'The data to insert into the page folder structure table.
string
string
null
| string
Promise
<{
id
: string
;
name
: string
;
parent
: null
| string
;
}[]>
A promise that resolves to the inserted folder.
If an error occurs while inserting the folder.
POST.databaseEntry.pageContent()
'Read the “', POST.databaseEntry.pageContent(), '” section'pageContent: (pageContent: { content: null | string; contentId: string; contentLang: string; id: string;}) => Promise<PageContentReturnId[]>;
Inserts new page content into the database.
Parameters
'Read the “', Parameters, '” section'pageContent
'Read the “', pageContent, '” section'The data to insert into the page content table.
null
| string
contentId
'Read the “', contentId, '” section'string
contentLang?
'Read the “', contentLang?, '” section'string
string
Promise
<PageContentReturnId
[]>
A promise that resolves to the inserted page content.
If an error occurs while inserting the page content.
POST.databaseEntry.pages()
'Read the “', POST.databaseEntry.pages(), '” section'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>;
Insert a new page into the database.
Parameters
'Read the “', Parameters, '” section'The data to insert into the page data table.
authorId?
'Read the “', authorId?, '” section'null
| string
categories?
'Read the “', categories?, '” section'unknown
contentLang?
'Read the “', contentLang?, '” section'string
contributorIds?
'Read the “', contributorIds?, '” section'unknown
description
'Read the “', description, '” section'string
null
| boolean
heroImage?
'Read the “', heroImage?, '” section'string
string
string
parentFolder?
'Read the “', parentFolder?, '” section'null
| string
publishedAt?
'Read the “', publishedAt?, '” section'Date
showAuthor?
'Read the “', showAuthor?, '” section'null
| boolean
showContributors?
'Read the “', showContributors?, '” section'null
| boolean
showOnNav?
'Read the “', showOnNav?, '” section'boolean
string
unknown
string
updatedAt?
'Read the “', updatedAt?, '” section'null
| Date
pageContent
'Read the “', pageContent, '” section'The data to insert into the page content table.
Promise
<addDatabaseEntryInsertPage
>
A promise that resolves to the inserted page data and page content.
If an error occurs while inserting the page.
POST.databaseEntry.permissions()
'Read the “', POST.databaseEntry.permissions(), '” section'permissions: (userId: string, rank: string) => Promise<{ rank: string; user: string;}[]>;
Inserts a new permission into the database.
Parameters
'Read the “', Parameters, '” section'string
The ID of the user to assign the rank to.
string
The rank to assign to the user.
Promise
<{
rank
: string
;
user
: string
;
}[]>
A promise that resolves to the inserted permission.
If an error occurs while inserting the permission.
POST.databaseEntry.tags()
'Read the “', POST.databaseEntry.tags(), '” section'tags: (tag: { description: string; id: number; meta: unknown; name: string; slug: string;}) => Promise<PageDataTagsInsertResponse[]>;
Inserts a new tag into the database.
Parameters
'Read the “', Parameters, '” section'The data to insert into the page data tags table.
description
'Read the “', description, '” section'string
number
unknown
string
string
Promise
<PageDataTagsInsertResponse
[]>
A promise that resolves to the inserted tag.
If an error occurs while inserting the tag.
resetTokenBucket
'Read the “', resetTokenBucket, '” section'resetTokenBucket: { check: (token: string) => Promise<boolean>; delete: (userId: string) => Promise<void>; new: (userId: string) => Promise<any>;};
resetTokenBucket.check()
'Read the “', resetTokenBucket.check(), '” section'check: (token: string) => Promise<boolean>;
Parameters
'Read the “', Parameters, '” section'string
Promise
<boolean
>
resetTokenBucket.delete()
'Read the “', resetTokenBucket.delete(), '” section'delete: (userId: string) => Promise<void>;
Parameters
'Read the “', Parameters, '” section'string
Promise
<void
>
resetTokenBucket.new()
'Read the “', resetTokenBucket.new(), '” section'new: (userId: string) => Promise<any>;
Parameters
'Read the “', Parameters, '” section'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; }>; };};
REST_API.tokens
'Read the “', REST_API.tokens, '” section'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; }>;};
REST_API.tokens.delete()
'Read the “', REST_API.tokens.delete(), '” section'delete: (userId: string, tokenId: string) => Promise<void>;
Parameters
'Read the “', Parameters, '” section'string
string
Promise
<void
>
REST_API.tokens.get()
'Read the “', REST_API.tokens.get(), '” section'get: (userId: string) => Promise<any>;
Parameters
'Read the “', Parameters, '” section'string
Promise
<any
>
REST_API.tokens.new()
'Read the “', REST_API.tokens.new(), '” section'new: (userId: string, description: string) => Promise<any>;
Parameters
'Read the “', Parameters, '” section'string
description
'Read the “', description, '” section'string
Promise
<any
>
REST_API.tokens.verify()
'Read the “', REST_API.tokens.verify(), '” section'verify: (key: string) => Promise< | false | { key: any; rank: any; userId: any;}>;
Parameters
'Read the “', Parameters, '” section'string
Promise
<
| false
| {
key
: any
;
rank
: any
;
userId
: any
;
}>
testToken()
'Read the “', testToken(), '” section'testToken: (token: string) => any;
Verifies the provided JWT token using the CMS encryption key.
Parameters
'Read the “', Parameters, '” section'string
The JWT token to be verified.
any
The decoded token if verification is successful.
Will throw an error if the token is invalid or verification fails.
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; }>;};
UPDATE.categories()
'Read the “', UPDATE.categories(), '” section'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;}>;
Updates a category in the database.
Parameters
'Read the “', Parameters, '” section'The data to update in the page data categories table.
description
'Read the “', description, '” section'string
number
unknown
string
null
| number
string
Promise
<{
description
: string
;
id
: number
;
meta
: unknown
;
name
: string
;
parent
: null
| number
;
slug
: string
;
}>
A promise that resolves to the updated category.
If an error occurs while updating the category.
UPDATE.folder()
'Read the “', UPDATE.folder(), '” section'folder: (data: { id: string; name: string; parent: null | string; }) => Promise<{ id: string; name: string; parent: null | string;}>;
Parameters
'Read the “', Parameters, '” section'string
string
null
| string
Promise
<{
id
: string
;
name
: string
;
parent
: null
| string
;
}>
UPDATE.page()
'Read the “', UPDATE.page(), '” section'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;}>;
Updates a page in the database.
Parameters
'Read the “', Parameters, '” section'The data to update in the page data table.
null
| string
categories
'Read the “', categories, '” section'unknown
contentLang
'Read the “', contentLang, '” section'string
contributorIds
'Read the “', contributorIds, '” section'unknown
description
'Read the “', description, '” section'string
null
| boolean
heroImage
'Read the “', heroImage, '” section'string
string
string
parentFolder
'Read the “', parentFolder, '” section'null
| string
publishedAt
'Read the “', publishedAt, '” section'Date
showAuthor
'Read the “', showAuthor, '” section'null
| boolean
showContributors
'Read the “', showContributors, '” section'null
| boolean
showOnNav
'Read the “', showOnNav, '” section'boolean
string
unknown
string
updatedAt
'Read the “', updatedAt, '” section'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
;
}>
A promise that resolves to the updated page data.
If an error occurs while updating the page.
UPDATE.pageContent()
'Read the “', UPDATE.pageContent(), '” section'pageContent: (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.
Parameters
'Read the “', Parameters, '” section'The data to update in the page content table.
null
| string
contentId
'Read the “', contentId, '” section'string
contentLang
'Read the “', contentLang, '” section'string
string
Promise
<{
content
: null
| string
;
contentId
: string
;
contentLang
: string
;
id
: string
;
}>
A promise that resolves to the updated page content.
If an error occurs while updating the page content.
UPDATE.permissions()
'Read the “', UPDATE.permissions(), '” section'permissions: (data: { rank: string; user: string; }) => Promise<{ rank: string; user: string;}>;
Updates a permission in the database.
Parameters
'Read the “', Parameters, '” section'The data to update in the permissions table.
string
string
Promise
<{
rank
: string
;
user
: string
;
}>
A promise that resolves to the updated permission.
If an error occurs while updating the permission.
UPDATE.siteConfig()
'Read the “', UPDATE.siteConfig(), '” section'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;}>;
Updates a site configuration in the database.
Parameters
'Read the “', Parameters, '” section'The data to update in the site config table.
defaultOgImage
'Read the “', defaultOgImage, '” section'null
| string
description
'Read the “', description, '” section'string
diffPerPage
'Read the “', diffPerPage, '” section'number
enableDiffs
'Read the “', enableDiffs, '” section'boolean
gridItems
'Read the “', gridItems, '” section'unknown
number
loginPageBackground
'Read the “', loginPageBackground, '” section'string
loginPageCustomImage
'Read the “', loginPageCustomImage, '” section'null
| string
null
| string
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
;
}>
A promise that resolves to the updated site configuration.
If an error occurs while updating the site configuration.
UPDATE.tags()
'Read the “', UPDATE.tags(), '” section'tags: (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.
Parameters
'Read the “', Parameters, '” section'The data to update in the page data tags table.
description
'Read the “', description, '” section'string
number
unknown
string
string
Promise
<{
description
: string
;
id
: number
;
meta
: unknown
;
name
: string
;
slug
: string
;
}>
A promise that resolves to the updated tag.
If an error occurs while updating the tag.
verifyRank()
'Read the “', verifyRank(), '” section'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[];
Verifies the rank of users based on the provided permissions and rank.
Parameters
'Read the “', Parameters, '” section'{
avatar
: null
| string
;
createdAt
: null
| Date
;
email
: null
| string
;
id
: string
;
name
: string
;
password
: null
| string
;
updatedAt
: null
| Date
;
url
: null
| string
;
username
: string
;
}[]
An array of user objects to be verified.
permissions
'Read the “', permissions, '” section'{
rank
: string
;
user
: string
;
}[]
An array of permission objects that include user ranks.
string
The rank to be verified against the permissions.
An array of objects containing the id and name of users with the specified rank.
If an error occurs during the verification process.