sdk/core
이 콘텐츠는 아직 해당 언어로 제공되지 않습니다.
Functions
Section titled “Functions”studiocmsSDKCore()
Section titled “studiocmsSDKCore()”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; emailVerified: boolean; id: string; name: string; notifications: null | 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; emailVerified: boolean; id: string; name: string; notifications: null | 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; emailVerified: boolean; id: string; name: string; notifications: null | string; password: null | string; updatedAt: null | Date; url: null | string; username: string; }>; ghost: { create: () => Promise<{ avatar: null | string; createdAt: null | Date; email: null | string; emailVerified: boolean; id: string; name: string; notifications: null | string; password: null | string; updatedAt: null | Date; url: null | string; username: string; }>; get: () => Promise< | undefined | { avatar: null | string; createdAt: null | Date; email: null | string; emailVerified: boolean; id: string; name: string; notifications: null | string; password: null | string; updatedAt: null | Date; url: null | string; username: string; }>; verifyExists: () => Promise<boolean>; }; searchUsersForUsernameOrEmail: (username: string, email: string) => Promise<{ emailSearch: { avatar: null | string; createdAt: null | Date; email: null | string; emailVerified: boolean; id: string; name: string; notifications: null | string; password: null | string; updatedAt: null | Date; url: null | string; username: string; }[]; usernameSearch: { avatar: null | string; createdAt: null | Date; email: null | string; emailVerified: boolean; id: string; name: string; notifications: null | 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; emailVerified: boolean; id: string; name: string; notifications: null | string; password: null | string; updatedAt: null | Date; url: null | string; username: string; }>; }; verifyEmail: { create: (userId: string) => Promise<{ expiresAt: Date; id: string; token: string; userId: string; }>; delete: (userId: string) => Promise<void>; get: (id: string) => Promise< | null | { expiresAt: Date; id: string; token: string; userId: 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>(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[], metaOnly: boolean) => Promise<MetaOnlyPageData>; 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; emailVerified: boolean; id: string; name: string; notifications: null | string; password: null | string; updatedAt: null | Date; url: null | string; username: string; }) => Promise<CombinedUserData>; combineRanks: (rank: string, users: SingleRank[]) => CombinedRank[]; db: Database; 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<diffReturn[]>; latest: (pageId: string, count: number) => Promise<diffReturn[]>; }; byUserId: { all: (userId: string) => Promise<diffReturn[]>; latest: (userId: string, count: number) => Promise<diffReturn[]>; }; single: (id: string) => Promise<undefined | diffReturn>; }; 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<diffReturn>; revertToDiff: (id: string, type: "content" | "data" | "both") => Promise<diffReturn>; utils: { getDiffHTML: any; getMetaDataDifferences: { current: any; label: string; previous: 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, noExpire?: boolean) => string; GET: { database: { config: () => Promise< | undefined | { defaultOgImage: null | string; description: string; diffPerPage: number; enableDiffs: boolean; enableMailer: boolean; gridItems: unknown; hideDefaultIndex: boolean; id: number; loginPageBackground: string; loginPageCustomImage: null | string; siteIcon: null | string; title: string; }>; folderPages: (id: string, includeDrafts?: boolean, hideDefaultIndex?: boolean, tree?: FolderNode[], metaOnly?: false, paginate?: PaginateInput) => Promise<CombinedPageData[]>(id: string, includeDrafts?: boolean, hideDefaultIndex?: boolean, tree?: FolderNode[], metaOnly?: true, paginate?: PaginateInput) => Promise<MetaOnlyPageData[]>; folders: () => Promise<{ id: string; name: string; parent: null | string; }[]>; pages: (includeDrafts?: boolean, hideDefaultIndex?: boolean, tree?: FolderNode[], metaOnly?: false, paginate?: PaginateInput) => Promise<CombinedPageData[]>(includeDrafts?: boolean, hideDefaultIndex?: boolean, tree?: FolderNode[], metaOnly?: true, paginate?: PaginateInput) => Promise<MetaOnlyPageData[]>; 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>(id: string, tree?: FolderNode[], metaOnly?: boolean) => Promise< | undefined | MetaOnlyPageData>; bySlug: (slug: string, tree?: FolderNode[]) => Promise< | undefined | CombinedPageData>(slug: string, tree?: FolderNode[], metaOnly?: boolean) => Promise< | undefined | MetaOnlyPageData>; }; users: { byEmail: (email: string) => Promise< | undefined | CombinedUserData>; byId: (id: string) => Promise< | undefined | CombinedUserData>; byUsername: (username: string) => Promise< | undefined | CombinedUserData>; }; }; databaseTable: { diffTracking: () => Promise<{ diff: null | string; id: string; pageContentStart: string; pageId: string; pageMetaData: unknown; timestamp: null | Date; userId: string; }[]>; emailVerificationTokens: () => Promise<{ expiresAt: Date; id: string; token: string; userId: string; }[]>; notificationSettings: () => Promise< | undefined | { emailVerification: boolean; id: string; oAuthBypassVerification: boolean; requireAdminVerification: boolean; requireEditorVerification: boolean; }>; oAuthAccounts: () => Promise<{ provider: string; providerUserId: string; userId: string; }[]>; pageContent: () => Promise<{ content: null | string; contentId: string; contentLang: string; id: string; }[]>; pageData: () => 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; }[]>; pageDataCategories: () => Promise<{ description: string; id: number; meta: unknown; name: string; parent: null | number; slug: string; }[]>; pageDataTags: () => Promise<{ description: string; id: number; meta: unknown; name: string; slug: string; }[]>; pageFolderStructure: () => Promise<{ id: string; name: string; parent: null | string; }[]>; permissions: () => Promise<{ rank: string; user: string; }[]>; sessionTable: () => Promise<{ expiresAt: Date; id: string; userId: string; }[]>; siteConfig: () => Promise< | undefined | { defaultOgImage: null | string; description: string; diffPerPage: number; enableDiffs: boolean; enableMailer: boolean; gridItems: unknown; hideDefaultIndex: boolean; id: number; loginPageBackground: string; loginPageCustomImage: null | string; siteIcon: null | string; title: string; }>; users: () => Promise<{ avatar: null | string; createdAt: null | Date; email: null | string; emailVerified: boolean; id: string; name: string; notifications: null | string; password: null | string; updatedAt: null | Date; url: null | string; username: string; }[]>; }; packagePages: (packageName: string, tree?: FolderNode[]) => Promise<CombinedPageData[]>(packageName: string, tree?: FolderNode[], metaOnly?: boolean) => Promise<MetaOnlyPageData[]>; 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; emailVerified: boolean; id: string; name: string; notifications: null | string; password: null | string; updatedAt: null | Date; url: null | string; username: string; }>; siteConfig: (config: { defaultOgImage: null | string; description: string; diffPerPage: number; enableDiffs: boolean; enableMailer: boolean; gridItems: unknown; hideDefaultIndex: boolean; id: number; loginPageBackground: string; loginPageCustomImage: null | string; siteIcon: null | string; title: string; }) => Promise<{ defaultOgImage: null | string; description: string; diffPerPage: number; enableDiffs: boolean; enableMailer: boolean; gridItems: unknown; hideDefaultIndex: boolean; id: number; loginPageBackground: string; loginPageCustomImage: null | string; siteIcon: null | string; title: string; }>; }; notificationSettings: { site: { get: () => Promise<{ emailVerification: boolean; id: string; oAuthBypassVerification: boolean; requireAdminVerification: boolean; requireEditorVerification: boolean; }>; update: (settings: { emailVerification: boolean; id: string; oAuthBypassVerification: boolean; requireAdminVerification: boolean; requireEditorVerification: boolean; }) => Promise<{ emailVerification: boolean; id: string; oAuthBypassVerification: boolean; requireAdminVerification: boolean; requireEditorVerification: boolean; }>; }; }; 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<{ id: number; }[]>; 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<{ id: string; token: string; userId: string; }>; }; REST_API: { tokens: { delete: (userId: string, tokenId: string) => Promise<void>; get: (userId: string) => Promise<{ creationDate: Date; description: null | string; id: string; key: string; userId: string; }[]>; new: (userId: string, description: string) => Promise<{ creationDate: Date; description: null | string; id: string; key: string; userId: string; }>; verify: (key: string) => Promise< | false | { key: string; rank: string; userId: string; }>; }; }; testToken: (token: string) => JwtVerificationResult; 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; enableMailer: boolean; gridItems: unknown; hideDefaultIndex: boolean; id: number; loginPageBackground: string; loginPageCustomImage: null | string; siteIcon: null | string; title: string; }) => Promise<{ defaultOgImage: null | string; description: string; diffPerPage: number; enableDiffs: boolean; enableMailer: boolean; gridItems: unknown; hideDefaultIndex: boolean; 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; emailVerified: boolean; id: string; name: string; notifications: null | 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:94
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.
Returns
Section titled “Returns”{ 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; emailVerified: boolean; id: string; name: string; notifications: null | 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; emailVerified: boolean; id: string; name: string; notifications: null | 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; emailVerified: boolean; id: string; name: string; notifications: null | string; password: null | string; updatedAt: null | Date; url: null | string; username: string; }>; ghost: { create: () => Promise<{ avatar: null | string; createdAt: null | Date; email: null | string; emailVerified: boolean; id: string; name: string; notifications: null | string; password: null | string; updatedAt: null | Date; url: null | string; username: string; }>; get: () => Promise< | undefined | { avatar: null | string; createdAt: null | Date; email: null | string; emailVerified: boolean; id: string; name: string; notifications: null | string; password: null | string; updatedAt: null | Date; url: null | string; username: string; }>; verifyExists: () => Promise<boolean>; }; searchUsersForUsernameOrEmail: (username: string, email: string) => Promise<{ emailSearch: { avatar: null | string; createdAt: null | Date; email: null | string; emailVerified: boolean; id: string; name: string; notifications: null | string; password: null | string; updatedAt: null | Date; url: null | string; username: string; }[]; usernameSearch: { avatar: null | string; createdAt: null | Date; email: null | string; emailVerified: boolean; id: string; name: string; notifications: null | 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; emailVerified: boolean; id: string; name: string; notifications: null | string; password: null | string; updatedAt: null | Date; url: null | string; username: string; }>; }; verifyEmail: { create: (userId: string) => Promise<{ expiresAt: Date; id: string; token: string; userId: string; }>; delete: (userId: string) => Promise<void>; get: (id: string) => Promise< | null | { expiresAt: Date; id: string; token: string; userId: 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>(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[], metaOnly: boolean) => Promise<MetaOnlyPageData>; 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; emailVerified: boolean; id: string; name: string; notifications: null | string; password: null | string; updatedAt: null | Date; url: null | string; username: string; }) => Promise<CombinedUserData>; combineRanks: (rank: string, users: SingleRank[]) => CombinedRank[]; db: Database; 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<diffReturn[]>; latest: (pageId: string, count: number) => Promise<diffReturn[]>; }; byUserId: { all: (userId: string) => Promise<diffReturn[]>; latest: (userId: string, count: number) => Promise<diffReturn[]>; }; single: (id: string) => Promise<undefined | diffReturn>; }; 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<diffReturn>; revertToDiff: (id: string, type: "content" | "data" | "both") => Promise<diffReturn>; utils: { getDiffHTML: any; getMetaDataDifferences: { current: any; label: string; previous: 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, noExpire?: boolean) => string; GET: { database: { config: () => Promise< | undefined | { defaultOgImage: null | string; description: string; diffPerPage: number; enableDiffs: boolean; enableMailer: boolean; gridItems: unknown; hideDefaultIndex: boolean; id: number; loginPageBackground: string; loginPageCustomImage: null | string; siteIcon: null | string; title: string; }>; folderPages: (id: string, includeDrafts?: boolean, hideDefaultIndex?: boolean, tree?: FolderNode[], metaOnly?: false, paginate?: PaginateInput) => Promise<CombinedPageData[]>(id: string, includeDrafts?: boolean, hideDefaultIndex?: boolean, tree?: FolderNode[], metaOnly?: true, paginate?: PaginateInput) => Promise<MetaOnlyPageData[]>; folders: () => Promise<{ id: string; name: string; parent: null | string; }[]>; pages: (includeDrafts?: boolean, hideDefaultIndex?: boolean, tree?: FolderNode[], metaOnly?: false, paginate?: PaginateInput) => Promise<CombinedPageData[]>(includeDrafts?: boolean, hideDefaultIndex?: boolean, tree?: FolderNode[], metaOnly?: true, paginate?: PaginateInput) => Promise<MetaOnlyPageData[]>; 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>(id: string, tree?: FolderNode[], metaOnly?: boolean) => Promise< | undefined | MetaOnlyPageData>; bySlug: (slug: string, tree?: FolderNode[]) => Promise< | undefined | CombinedPageData>(slug: string, tree?: FolderNode[], metaOnly?: boolean) => Promise< | undefined | MetaOnlyPageData>; }; users: { byEmail: (email: string) => Promise< | undefined | CombinedUserData>; byId: (id: string) => Promise< | undefined | CombinedUserData>; byUsername: (username: string) => Promise< | undefined | CombinedUserData>; }; }; databaseTable: { diffTracking: () => Promise<{ diff: null | string; id: string; pageContentStart: string; pageId: string; pageMetaData: unknown; timestamp: null | Date; userId: string; }[]>; emailVerificationTokens: () => Promise<{ expiresAt: Date; id: string; token: string; userId: string; }[]>; notificationSettings: () => Promise< | undefined | { emailVerification: boolean; id: string; oAuthBypassVerification: boolean; requireAdminVerification: boolean; requireEditorVerification: boolean; }>; oAuthAccounts: () => Promise<{ provider: string; providerUserId: string; userId: string; }[]>; pageContent: () => Promise<{ content: null | string; contentId: string; contentLang: string; id: string; }[]>; pageData: () => 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; }[]>; pageDataCategories: () => Promise<{ description: string; id: number; meta: unknown; name: string; parent: null | number; slug: string; }[]>; pageDataTags: () => Promise<{ description: string; id: number; meta: unknown; name: string; slug: string; }[]>; pageFolderStructure: () => Promise<{ id: string; name: string; parent: null | string; }[]>; permissions: () => Promise<{ rank: string; user: string; }[]>; sessionTable: () => Promise<{ expiresAt: Date; id: string; userId: string; }[]>; siteConfig: () => Promise< | undefined | { defaultOgImage: null | string; description: string; diffPerPage: number; enableDiffs: boolean; enableMailer: boolean; gridItems: unknown; hideDefaultIndex: boolean; id: number; loginPageBackground: string; loginPageCustomImage: null | string; siteIcon: null | string; title: string; }>; users: () => Promise<{ avatar: null | string; createdAt: null | Date; email: null | string; emailVerified: boolean; id: string; name: string; notifications: null | string; password: null | string; updatedAt: null | Date; url: null | string; username: string; }[]>; }; packagePages: (packageName: string, tree?: FolderNode[]) => Promise<CombinedPageData[]>(packageName: string, tree?: FolderNode[], metaOnly?: boolean) => Promise<MetaOnlyPageData[]>; 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; emailVerified: boolean; id: string; name: string; notifications: null | string; password: null | string; updatedAt: null | Date; url: null | string; username: string; }>; siteConfig: (config: { defaultOgImage: null | string; description: string; diffPerPage: number; enableDiffs: boolean; enableMailer: boolean; gridItems: unknown; hideDefaultIndex: boolean; id: number; loginPageBackground: string; loginPageCustomImage: null | string; siteIcon: null | string; title: string; }) => Promise<{ defaultOgImage: null | string; description: string; diffPerPage: number; enableDiffs: boolean; enableMailer: boolean; gridItems: unknown; hideDefaultIndex: boolean; id: number; loginPageBackground: string; loginPageCustomImage: null | string; siteIcon: null | string; title: string; }>; }; notificationSettings: { site: { get: () => Promise<{ emailVerification: boolean; id: string; oAuthBypassVerification: boolean; requireAdminVerification: boolean; requireEditorVerification: boolean; }>; update: (settings: { emailVerification: boolean; id: string; oAuthBypassVerification: boolean; requireAdminVerification: boolean; requireEditorVerification: boolean; }) => Promise<{ emailVerification: boolean; id: string; oAuthBypassVerification: boolean; requireAdminVerification: boolean; requireEditorVerification: boolean; }>; }; }; 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<{ id: number; }[]>; 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<{ id: string; token: string; userId: string; }>; }; REST_API: { tokens: { delete: (userId: string, tokenId: string) => Promise<void>; get: (userId: string) => Promise<{ creationDate: Date; description: null | string; id: string; key: string; userId: string; }[]>; new: (userId: string, description: string) => Promise<{ creationDate: Date; description: null | string; id: string; key: string; userId: string; }>; verify: (key: string) => Promise< | false | { key: string; rank: string; userId: string; }>; }; }; testToken: (token: string) => JwtVerificationResult; 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; enableMailer: boolean; gridItems: unknown; hideDefaultIndex: boolean; id: number; loginPageBackground: string; loginPageCustomImage: null | string; siteIcon: null | string; title: string; }) => Promise<{ defaultOgImage: null | string; description: string; diffPerPage: number; enableDiffs: boolean; enableMailer: boolean; gridItems: unknown; hideDefaultIndex: boolean; 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; emailVerified: boolean; id: string; name: string; notifications: null | 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()
Section titled “addPageToFolderTree()”addPageToFolderTree: (tree: FolderNode[], folderId: string, newPage: FolderNode) => FolderNode[];
Adds a new page to the folder tree.
Parameters
Section titled “Parameters”The root of the folder tree.
folderId
Section titled “folderId”string
The ID of the parent folder.
newPage
Section titled “newPage”The new page to add.
Returns
Section titled “Returns”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; emailVerified: boolean; id: string; name: string; notifications: null | 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; emailVerified: boolean; id: string; name: string; notifications: null | 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; emailVerified: boolean; id: string; name: string; notifications: null | string; password: null | string; updatedAt: null | Date; url: null | string; username: string; }>; ghost: { create: () => Promise<{ avatar: null | string; createdAt: null | Date; email: null | string; emailVerified: boolean; id: string; name: string; notifications: null | string; password: null | string; updatedAt: null | Date; url: null | string; username: string; }>; get: () => Promise< | undefined | { avatar: null | string; createdAt: null | Date; email: null | string; emailVerified: boolean; id: string; name: string; notifications: null | string; password: null | string; updatedAt: null | Date; url: null | string; username: string; }>; verifyExists: () => Promise<boolean>; }; searchUsersForUsernameOrEmail: (username: string, email: string) => Promise<{ emailSearch: { avatar: null | string; createdAt: null | Date; email: null | string; emailVerified: boolean; id: string; name: string; notifications: null | string; password: null | string; updatedAt: null | Date; url: null | string; username: string; }[]; usernameSearch: { avatar: null | string; createdAt: null | Date; email: null | string; emailVerified: boolean; id: string; name: string; notifications: null | 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; emailVerified: boolean; id: string; name: string; notifications: null | string; password: null | string; updatedAt: null | Date; url: null | string; username: string; }>; }; verifyEmail: { create: (userId: string) => Promise<{ expiresAt: Date; id: string; token: string; userId: string; }>; delete: (userId: string) => Promise<void>; get: (id: string) => Promise< | null | { expiresAt: Date; id: string; token: string; userId: string; }>; };};
AUTH.oAuth
Section titled “AUTH.oAuth”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()
Section titled “AUTH.oAuth.create()”create: (data: { provider: string; providerUserId: string; userId: string; }) => Promise<{ provider: string; providerUserId: string; userId: string;}>;
Creates a new OAuth account in the database.
Parameters
Section titled “Parameters”The data to insert into the OAuth account table.
provider
Section titled “provider”string
providerUserId
Section titled “providerUserId”string
userId
Section titled “userId”string
Returns
Section titled “Returns”Promise
<{
provider
: string
;
providerUserId
: string
;
userId
: string
;
}>
A promise that resolves to the inserted OAuth account.
Throws
Section titled “Throws”If an error occurs while creating the OAuth account.
AUTH.oAuth.delete()
Section titled “AUTH.oAuth.delete()”delete: (userId: string, provider: string) => Promise<DeletionResponse>;
Deletes an OAuth account from the database.
Parameters
Section titled “Parameters”userId
Section titled “userId”string
The ID of the user associated with the OAuth account.
provider
Section titled “provider”string
The provider of the OAuth account.
Returns
Section titled “Returns”Promise
<DeletionResponse
>
A promise that resolves to a deletion response.
Throws
Section titled “Throws”If an error occurs while deleting the OAuth account.
AUTH.oAuth.searchProvidersForId()
Section titled “AUTH.oAuth.searchProvidersForId()”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
Section titled “Parameters”providerId
Section titled “providerId”string
The provider ID to search for.
userId
Section titled “userId”string
The user ID to search for.
Returns
Section titled “Returns”Promise
<
| undefined
| {
provider
: string
;
providerUserId
: string
;
userId
: string
;
}>
A promise that resolves to the OAuth account data if found, otherwise undefined.
Throws
Section titled “Throws”If an error occurs while searching for the OAuth account.
AUTH.permission
Section titled “AUTH.permission”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()
Section titled “AUTH.permission.currentStatus()”currentStatus: (userId: string) => Promise< | undefined | { rank: string; user: string;}>;
Checks the current status of a user’s permissions.
Parameters
Section titled “Parameters”userId
Section titled “userId”string
Returns
Section titled “Returns”Promise
<
| undefined
| {
rank
: string
;
user
: string
;
}>
AUTH.session
Section titled “AUTH.session”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; emailVerified: boolean; id: string; name: string; notifications: null | 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()
Section titled “AUTH.session.create()”create: (data: { expiresAt: Date; id: string; userId: string; }) => Promise<{ expiresAt: Date; id: string; userId: string;}>;
Creates a new session in the database.
Parameters
Section titled “Parameters”The data to insert into the session table.
expiresAt
Section titled “expiresAt”Date
string
userId
Section titled “userId”string
Returns
Section titled “Returns”Promise
<{
expiresAt
: Date
;
id
: string
;
userId
: string
;
}>
A promise that resolves to the inserted session.
Throws
Section titled “Throws”If an error occurs while creating the session.
AUTH.session.delete()
Section titled “AUTH.session.delete()”delete: (sessionId: string) => Promise<DeletionResponse>;
Deletes a session from the database.
Parameters
Section titled “Parameters”sessionId
Section titled “sessionId”string
The ID of the session to delete.
Returns
Section titled “Returns”Promise
<DeletionResponse
>
A promise that resolves to a deletion response.
Throws
Section titled “Throws”If an error occurs while deleting the session.
AUTH.session.sessionWithUser()
Section titled “AUTH.session.sessionWithUser()”sessionWithUser: (sessionId: string) => Promise<{ session: { expiresAt: Date; id: string; userId: string; }; user: { avatar: null | string; createdAt: null | Date; email: null | string; emailVerified: boolean; id: string; name: string; notifications: null | string; password: null | string; updatedAt: null | Date; url: null | string; username: string; };}[]>;
Gets a session with the associated user.
Parameters
Section titled “Parameters”sessionId
Section titled “sessionId”string
The ID of the session to search for.
Returns
Section titled “Returns”Promise
<{
session
: {
expiresAt
: Date
;
id
: string
;
userId
: string
;
};
user
: {
avatar
: null
| string
;
createdAt
: null
| Date
;
email
: null
| string
;
emailVerified
: boolean
;
id
: string
;
name
: string
;
notifications
: null
| string
;
password
: null
| string
;
updatedAt
: null
| Date
;
url
: null
| string
;
username
: string
;
};
}[]>
A promise that resolves to the session with the associated user.
Throws
Section titled “Throws”If an error occurs while getting the session with the user.
AUTH.session.update()
Section titled “AUTH.session.update()”update: (sessionId: string, newDate: Date) => Promise<{ expiresAt: Date; id: string; userId: string;}[]>;
Updates the expiration date of a session.
Parameters
Section titled “Parameters”sessionId
Section titled “sessionId”string
The ID of the session to update.
newDate
Section titled “newDate”Date
The new expiration date for the session.
Returns
Section titled “Returns”Promise
<{
expiresAt
: Date
;
id
: string
;
userId
: string
;
}[]>
A promise that resolves to the updated session.
Throws
Section titled “Throws”If an error occurs while updating the session.
AUTH.user
Section titled “AUTH.user”user: { create: (newUserData: { avatar: null | string; createdAt: null | Date; email: null | string; emailVerified: boolean; id: string; name: string; notifications: null | 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; emailVerified: boolean; id: string; name: string; notifications: null | string; password: null | string; updatedAt: null | Date; url: null | string; username: string; }>; ghost: { create: () => Promise<{ avatar: null | string; createdAt: null | Date; email: null | string; emailVerified: boolean; id: string; name: string; notifications: null | string; password: null | string; updatedAt: null | Date; url: null | string; username: string; }>; get: () => Promise< | undefined | { avatar: null | string; createdAt: null | Date; email: null | string; emailVerified: boolean; id: string; name: string; notifications: null | string; password: null | string; updatedAt: null | Date; url: null | string; username: string; }>; verifyExists: () => Promise<boolean>; }; searchUsersForUsernameOrEmail: (username: string, email: string) => Promise<{ emailSearch: { avatar: null | string; createdAt: null | Date; email: null | string; emailVerified: boolean; id: string; name: string; notifications: null | string; password: null | string; updatedAt: null | Date; url: null | string; username: string; }[]; usernameSearch: { avatar: null | string; createdAt: null | Date; email: null | string; emailVerified: boolean; id: string; name: string; notifications: null | 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; emailVerified: boolean; id: string; name: string; notifications: null | 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()
Section titled “AUTH.user.create()”create: (newUserData: { avatar: null | string; createdAt: null | Date; email: null | string; emailVerified: boolean; id: string; name: string; notifications: null | 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; emailVerified: boolean; id: string; name: string; notifications: null | string; password: null | string; updatedAt: null | Date; url: null | string; username: string;}>;
Creates a new user in the database.
Parameters
Section titled “Parameters”newUserData
Section titled “newUserData”The data to insert into the users table.
avatar?
Section titled “avatar?”null
| string
createdAt?
Section titled “createdAt?”null
| Date
email?
Section titled “email?”null
| string
emailVerified?
Section titled “emailVerified?”boolean
string
string
notifications?
Section titled “notifications?”null
| string
password?
Section titled “password?”null
| string
updatedAt?
Section titled “updatedAt?”null
| Date
null
| string
username
Section titled “username”string
"visitor"
| "editor"
| "admin"
| "owner"
Returns
Section titled “Returns”Promise
<{
avatar
: null
| string
;
createdAt
: null
| Date
;
email
: null
| string
;
emailVerified
: boolean
;
id
: string
;
name
: string
;
notifications
: null
| string
;
password
: null
| string
;
updatedAt
: null
| Date
;
url
: null
| string
;
username
: string
;
}>
A promise that resolves to the inserted user.
Throws
Section titled “Throws”If an error occurs while creating the user.
AUTH.user.ghost
Section titled “AUTH.user.ghost”ghost: { create: () => Promise<{ avatar: null | string; createdAt: null | Date; email: null | string; emailVerified: boolean; id: string; name: string; notifications: null | string; password: null | string; updatedAt: null | Date; url: null | string; username: string; }>; get: () => Promise< | undefined | { avatar: null | string; createdAt: null | Date; email: null | string; emailVerified: boolean; id: string; name: string; notifications: null | string; password: null | string; updatedAt: null | Date; url: null | string; username: string; }>; verifyExists: () => Promise<boolean>;};
Ghost user utilities.
AUTH.user.ghost.create()
Section titled “AUTH.user.ghost.create()”create: () => Promise<{ avatar: null | string; createdAt: null | Date; email: null | string; emailVerified: boolean; id: string; name: string; notifications: null | string; password: null | string; updatedAt: null | Date; url: null | string; username: string;}>;
Creates the ghost user in the database.
Returns
Section titled “Returns”Promise
<{
avatar
: null
| string
;
createdAt
: null
| Date
;
email
: null
| string
;
emailVerified
: boolean
;
id
: string
;
name
: string
;
notifications
: null
| string
;
password
: null
| string
;
updatedAt
: null
| Date
;
url
: null
| string
;
username
: string
;
}>
A promise that resolves to the inserted ghost user.
Throws
Section titled “Throws”If an error occurs while creating the ghost user.
AUTH.user.ghost.get()
Section titled “AUTH.user.ghost.get()”get: () => Promise< | undefined | { avatar: null | string; createdAt: null | Date; email: null | string; emailVerified: boolean; id: string; name: string; notifications: null | string; password: null | string; updatedAt: null | Date; url: null | string; username: string;}>;
Gets the ghost user from the database.
Returns
Section titled “Returns”Promise
<
| undefined
| {
avatar
: null
| string
;
createdAt
: null
| Date
;
email
: null
| string
;
emailVerified
: boolean
;
id
: string
;
name
: string
;
notifications
: null
| string
;
password
: null
| string
;
updatedAt
: null
| Date
;
url
: null
| string
;
username
: string
;
}>
A promise that resolves to the ghost user.
Throws
Section titled “Throws”If an error occurs while getting the ghost user.
AUTH.user.ghost.verifyExists()
Section titled “AUTH.user.ghost.verifyExists()”verifyExists: () => Promise<boolean>;
Verifies if the ghost user exists in the database.
Returns
Section titled “Returns”Promise
<boolean
>
A promise that resolves to a boolean indicating if the ghost user exists.
Throws
Section titled “Throws”If an error occurs while verifying the ghost user.
AUTH.user.searchUsersForUsernameOrEmail()
Section titled “AUTH.user.searchUsersForUsernameOrEmail()”searchUsersForUsernameOrEmail: (username: string, email: string) => Promise<{ emailSearch: { avatar: null | string; createdAt: null | Date; email: null | string; emailVerified: boolean; id: string; name: string; notifications: null | string; password: null | string; updatedAt: null | Date; url: null | string; username: string; }[]; usernameSearch: { avatar: null | string; createdAt: null | Date; email: null | string; emailVerified: boolean; id: string; name: string; notifications: null | string; password: null | string; updatedAt: null | Date; url: null | string; username: string; }[];}>;
Searches for users based on the provided username or email.
Parameters
Section titled “Parameters”username
Section titled “username”string
The username to search for.
string
The email to search for.
Returns
Section titled “Returns”Promise
<{
emailSearch
: {
avatar
: null
| string
;
createdAt
: null
| Date
;
email
: null
| string
;
emailVerified
: boolean
;
id
: string
;
name
: string
;
notifications
: null
| string
;
password
: null
| string
;
updatedAt
: null
| Date
;
url
: null
| string
;
username
: string
;
}[];
usernameSearch
: {
avatar
: null
| string
;
createdAt
: null
| Date
;
email
: null
| string
;
emailVerified
: boolean
;
id
: string
;
name
: string
;
notifications
: null
| 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.
Throws
Section titled “Throws”If an error occurs while searching for the username or email.
AUTH.user.update()
Section titled “AUTH.user.update()”update: (userId: string, userData: Partial) => Promise<{ avatar: null | string; createdAt: null | Date; email: null | string; emailVerified: boolean; id: string; name: string; notifications: null | string; password: null | string; updatedAt: null | Date; url: null | string; username: string;}>;
Updates a user in the database.
Parameters
Section titled “Parameters”userId
Section titled “userId”string
The ID of the user to update.
userData
Section titled “userData”Partial
The data to update the user with.
Returns
Section titled “Returns”Promise
<{
avatar
: null
| string
;
createdAt
: null
| Date
;
email
: null
| string
;
emailVerified
: boolean
;
id
: string
;
name
: string
;
notifications
: null
| string
;
password
: null
| string
;
updatedAt
: null
| Date
;
url
: null
| string
;
username
: string
;
}>
A promise that resolves to the updated user.
Throws
Section titled “Throws”If an error occurs while updating the user.
AUTH.verifyEmail
Section titled “AUTH.verifyEmail”verifyEmail: { create: (userId: string) => Promise<{ expiresAt: Date; id: string; token: string; userId: string; }>; delete: (userId: string) => Promise<void>; get: (id: string) => Promise< | null | { expiresAt: Date; id: string; token: string; userId: string; }>;};
AUTH.verifyEmail.create()
Section titled “AUTH.verifyEmail.create()”create: (userId: string) => Promise<{ expiresAt: Date; id: string; token: string; userId: string;}>;
Parameters
Section titled “Parameters”userId
Section titled “userId”string
Returns
Section titled “Returns”Promise
<{
expiresAt
: Date
;
id
: string
;
token
: string
;
userId
: string
;
}>
AUTH.verifyEmail.delete()
Section titled “AUTH.verifyEmail.delete()”delete: (userId: string) => Promise<void>;
Parameters
Section titled “Parameters”userId
Section titled “userId”string
Returns
Section titled “Returns”Promise
<void
>
AUTH.verifyEmail.get()
Section titled “AUTH.verifyEmail.get()”get: (id: string) => Promise< | null | { expiresAt: Date; id: string; token: string; userId: string;}>;
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise
<
| null
| {
expiresAt
: Date
;
id
: string
;
token
: string
;
userId
: string
;
}>
buildFolderTree()
Section titled “buildFolderTree()”buildFolderTree: () => Promise<FolderNode[]>;
Gets the folder structure from the database.
Returns
Section titled “Returns”Promise
<FolderNode
[]>
A promise that resolves to an array of folder nodes representing the folder structure.
clearUserReferences()
Section titled “clearUserReferences()”clearUserReferences: (userId: string) => Promise<boolean>;
Parameters
Section titled “Parameters”userId
Section titled “userId”string
Returns
Section titled “Returns”Promise
<boolean
>
collectCategories()
Section titled “collectCategories()”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
Section titled “Parameters”categoryIds
Section titled “categoryIds”number
[]
An array of category IDs to collect.
Returns
Section titled “Returns”Promise
<{
description
: string
;
id
: number
;
meta
: unknown
;
name
: string
;
parent
: null
| number
;
slug
: string
;
}[]>
A promise that resolves to an array of collected categories.
Throws
Section titled “Throws”If there is an error while collecting categories.
collectPageData()
Section titled “collectPageData()”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>(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[], metaOnly: boolean) => Promise<MetaOnlyPageData>;
Parameters
Section titled “Parameters”authorId
Section titled “authorId”null
| string
categories
Section titled “categories”unknown
contentLang
Section titled “contentLang”string
contributorIds
Section titled “contributorIds”unknown
description
Section titled “description”string
null
| boolean
heroImage
Section titled “heroImage”string
string
package
Section titled “package”string
parentFolder
Section titled “parentFolder”null
| string
publishedAt
Section titled “publishedAt”Date
showAuthor
Section titled “showAuthor”null
| boolean
showContributors
Section titled “showContributors”null
| boolean
showOnNav
Section titled “showOnNav”boolean
string
unknown
string
updatedAt
Section titled “updatedAt”null
| Date
Returns
Section titled “Returns”Promise
<CombinedPageData
>
Parameters
Section titled “Parameters”authorId
Section titled “authorId”null
| string
categories
Section titled “categories”unknown
contentLang
Section titled “contentLang”string
contributorIds
Section titled “contributorIds”unknown
description
Section titled “description”string
null
| boolean
heroImage
Section titled “heroImage”string
string
package
Section titled “package”string
parentFolder
Section titled “parentFolder”null
| string
publishedAt
Section titled “publishedAt”Date
showAuthor
Section titled “showAuthor”null
| boolean
showContributors
Section titled “showContributors”null
| boolean
showOnNav
Section titled “showOnNav”boolean
string
unknown
string
updatedAt
Section titled “updatedAt”null
| Date
metaOnly
Section titled “metaOnly”boolean
Returns
Section titled “Returns”Promise
<MetaOnlyPageData
>
collectTags()
Section titled “collectTags()”collectTags: (tagIds: number[]) => Promise<{ description: string; id: number; meta: unknown; name: string; slug: string;}[]>;
Collects tags based on the provided tag IDs.
Parameters
Section titled “Parameters”tagIds
Section titled “tagIds”number
[]
An array of tag IDs to collect.
Returns
Section titled “Returns”Promise
<{
description
: string
;
id
: number
;
meta
: unknown
;
name
: string
;
slug
: string
;
}[]>
A promise that resolves to an array of tags.
Throws
Section titled “Throws”If an error occurs while fetching the tags.
collectUserData()
Section titled “collectUserData()”collectUserData: (user: { avatar: null | string; createdAt: null | Date; email: null | string; emailVerified: boolean; id: string; name: string; notifications: null | 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
Section titled “Parameters”The user object containing user information.
avatar
Section titled “avatar”null
| string
createdAt
Section titled “createdAt”null
| Date
null
| string
emailVerified
Section titled “emailVerified”boolean
string
string
notifications
Section titled “notifications”null
| string
password
Section titled “password”null
| string
updatedAt
Section titled “updatedAt”null
| Date
null
| string
username
Section titled “username”string
Returns
Section titled “Returns”Promise
<CombinedUserData
>
A promise that resolves to a CombinedUserData object containing the user data, OAuth data, and permissions data.
Throws
Section titled “Throws”If an error occurs while collecting user data.
combineRanks()
Section titled “combineRanks()”combineRanks: (rank: string, users: SingleRank[]) => CombinedRank[];
Combines a given rank with an array of user ranks.
Parameters
Section titled “Parameters”string
The rank to be combined with each user.
An array of user ranks to be combined with the given rank.
Returns
Section titled “Returns”An array of combined ranks, where each element includes the given rank and the properties of a user rank.
db: Database;
DELETE
Section titled “DELETE”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()
Section titled “DELETE.categories()”categories: (id: number) => Promise<DeletionResponse>;
Deletes a category from the database.
Parameters
Section titled “Parameters”number
The ID of the category to delete.
Returns
Section titled “Returns”Promise
<DeletionResponse
>
A promise that resolves to a deletion response.
Throws
Section titled “Throws”If an error occurs while deleting the category.
DELETE.diffTracking()
Section titled “DELETE.diffTracking()”diffTracking: (id: string) => Promise<DeletionResponse>;
Deletes a site configuration from the database.
Parameters
Section titled “Parameters”string
The ID of the site configuration to delete.
Returns
Section titled “Returns”Promise
<DeletionResponse
>
A promise that resolves to a deletion response.
Throws
Section titled “Throws”If an error occurs while deleting the site configuration.
DELETE.folder()
Section titled “DELETE.folder()”folder: (id: string) => Promise<DeletionResponse>;
Deletes a folder from the database.
Parameters
Section titled “Parameters”string
The ID of the folder to delete.
Returns
Section titled “Returns”Promise
<DeletionResponse
>
A promise that resolves to a deletion response.
Throws
Section titled “Throws”If an error occurs while deleting the folder.
DELETE.page()
Section titled “DELETE.page()”page: (id: string) => Promise<DeletionResponse>;
Deletes a page from the database.
Parameters
Section titled “Parameters”string
The ID of the page to delete.
Returns
Section titled “Returns”Promise
<DeletionResponse
>
A promise that resolves to a deletion response.
Throws
Section titled “Throws”If an error occurs while deleting the page.
DELETE.pageContent()
Section titled “DELETE.pageContent()”pageContent: (id: string) => Promise<DeletionResponse>;
Deletes a page content from the database.
Parameters
Section titled “Parameters”string
The ID of the page content to delete.
Returns
Section titled “Returns”Promise
<DeletionResponse
>
A promise that resolves to a deletion response.
Throws
Section titled “Throws”If an error occurs while deleting the page content.
DELETE.pageContentLang()
Section titled “DELETE.pageContentLang()”pageContentLang: (id: string, lang: string) => Promise<DeletionResponse>;
Deletes a page content lang from the database.
Parameters
Section titled “Parameters”string
The ID of the page content to delete.
string
The lang of the page content to delete.
Returns
Section titled “Returns”Promise
<DeletionResponse
>
A promise that resolves to a deletion response.
Throws
Section titled “Throws”If an error occurs while deleting the page content lang.
DELETE.permissions()
Section titled “DELETE.permissions()”permissions: (userId: string) => Promise<DeletionResponse>;
Deletes a permission from the database.
Parameters
Section titled “Parameters”userId
Section titled “userId”string
The ID of the user to delete the permission for.
Returns
Section titled “Returns”Promise
<DeletionResponse
>
A promise that resolves to a deletion response.
Throws
Section titled “Throws”If an error occurs while deleting the permission.
DELETE.tags()
Section titled “DELETE.tags()”tags: (id: number) => Promise<DeletionResponse>;
Deletes a tag from the database.
Parameters
Section titled “Parameters”number
The ID of the tag to delete.
Returns
Section titled “Returns”Promise
<DeletionResponse
>
A promise that resolves to a deletion response.
Throws
Section titled “Throws”If an error occurs while deleting the tag.
DELETE.user()
Section titled “DELETE.user()”user: (id: string) => Promise<DeletionResponse>;
Deletes a user from the database.
Parameters
Section titled “Parameters”string
The ID of the user to delete.
Returns
Section titled “Returns”Promise
<DeletionResponse
>
A promise that resolves to a deletion response.
Throws
Section titled “Throws”If an error occurs while deleting the user.
diffTracking
Section titled “diffTracking”diffTracking: { clear: (pageId: string) => Promise<void>; get: { byPageId: { all: (pageId: string) => Promise<diffReturn[]>; latest: (pageId: string, count: number) => Promise<diffReturn[]>; }; byUserId: { all: (userId: string) => Promise<diffReturn[]>; latest: (userId: string, count: number) => Promise<diffReturn[]>; }; single: (id: string) => Promise<undefined | diffReturn>; }; 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<diffReturn>; revertToDiff: (id: string, type: "content" | "data" | "both") => Promise<diffReturn>; utils: { getDiffHTML: any; getMetaDataDifferences: { current: any; label: string; previous: any; }[]; };};
diffTracking.clear()
Section titled “diffTracking.clear()”clear: (pageId: string) => Promise<void>;
Parameters
Section titled “Parameters”pageId
Section titled “pageId”string
Returns
Section titled “Returns”Promise
<void
>
diffTracking.get
Section titled “diffTracking.get”get: { byPageId: { all: (pageId: string) => Promise<diffReturn[]>; latest: (pageId: string, count: number) => Promise<diffReturn[]>; }; byUserId: { all: (userId: string) => Promise<diffReturn[]>; latest: (userId: string, count: number) => Promise<diffReturn[]>; }; single: (id: string) => Promise<undefined | diffReturn>;};
diffTracking.get.byPageId
Section titled “diffTracking.get.byPageId”byPageId: { all: (pageId: string) => Promise<diffReturn[]>; latest: (pageId: string, count: number) => Promise<diffReturn[]>;};
diffTracking.get.byPageId.all()
Section titled “diffTracking.get.byPageId.all()”all: (pageId: string) => Promise<diffReturn[]>;
Parameters
Section titled “Parameters”pageId
Section titled “pageId”string
Returns
Section titled “Returns”Promise
<diffReturn
[]>
diffTracking.get.byPageId.latest()
Section titled “diffTracking.get.byPageId.latest()”latest: (pageId: string, count: number) => Promise<diffReturn[]>;
Parameters
Section titled “Parameters”pageId
Section titled “pageId”string
number
Returns
Section titled “Returns”Promise
<diffReturn
[]>
diffTracking.get.byUserId
Section titled “diffTracking.get.byUserId”byUserId: { all: (userId: string) => Promise<diffReturn[]>; latest: (userId: string, count: number) => Promise<diffReturn[]>;};
diffTracking.get.byUserId.all()
Section titled “diffTracking.get.byUserId.all()”all: (userId: string) => Promise<diffReturn[]>;
Parameters
Section titled “Parameters”userId
Section titled “userId”string
Returns
Section titled “Returns”Promise
<diffReturn
[]>
diffTracking.get.byUserId.latest()
Section titled “diffTracking.get.byUserId.latest()”latest: (userId: string, count: number) => Promise<diffReturn[]>;
Parameters
Section titled “Parameters”userId
Section titled “userId”string
number
Returns
Section titled “Returns”Promise
<diffReturn
[]>
diffTracking.get.single()
Section titled “diffTracking.get.single()”single: (id: string) => Promise<undefined | diffReturn>;
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise
<undefined
| diffReturn
>
diffTracking.insert()
Section titled “diffTracking.insert()”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<diffReturn>;
Parameters
Section titled “Parameters”userId
Section titled “userId”string
pageId
Section titled “pageId”string
content
Section titled “content”{
end
: string
;
start
: string
;
}
content.end
Section titled “content.end”string
content.start
Section titled “content.start”string
metaData
Section titled “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
;
}>;
}
metaData.end
Section titled “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
;
}>
metaData.start
Section titled “metaData.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
Section titled “diffLength”number
Returns
Section titled “Returns”Promise
<diffReturn
>
diffTracking.revertToDiff()
Section titled “diffTracking.revertToDiff()”revertToDiff: (id: string, type: "content" | "data" | "both") => Promise<diffReturn>;
Parameters
Section titled “Parameters”string
"content"
| "data"
| "both"
Returns
Section titled “Returns”Promise
<diffReturn
>
diffTracking.utils
Section titled “diffTracking.utils”utils: { getDiffHTML: any; getMetaDataDifferences: { current: any; label: string; previous: any; }[];};
diffTracking.utils.getDiffHTML()
Section titled “diffTracking.utils.getDiffHTML()”Parameters
Section titled “Parameters”null
| string
options?
Section titled “options?”any
Returns
Section titled “Returns”any
diffTracking.utils.getMetaDataDifferences()
Section titled “diffTracking.utils.getMetaDataDifferences()”Type Parameters
Section titled “Type Parameters”T
extends Record
<string
, any
>
Parameters
Section titled “Parameters”T
T
Returns
Section titled “Returns”{
current
: any
;
label
: string
;
previous
: any
;
}[]
findNodeById()
Section titled “findNodeById()”findNodeById: (tree: FolderNode[], id: string) => null | FolderNode;
Finds a node by its ID in the tree.
Parameters
Section titled “Parameters”string
The ID of the node to find.
Returns
Section titled “Returns”null
| FolderNode
The node or null if not found.
findNodeByPath()
Section titled “findNodeByPath()”findNodeByPath: (tree: FolderNode[], path: string[]) => null | FolderNode;
Finds a node in the tree that matches the given URL path.
Parameters
Section titled “Parameters”The root of the folder tree.
string
[]
The URL path to locate.
Returns
Section titled “Returns”null
| FolderNode
The matching node or null if not found.
findNodesAlongPath()
Section titled “findNodesAlongPath()”findNodesAlongPath: (tree: FolderNode[], path: string[]) => FolderNode[];
Finds all nodes along the path to a given URL.
Parameters
Section titled “Parameters”The root of the folder tree.
string
[]
The URL path to locate.
Returns
Section titled “Returns”The nodes along the path.
generateRandomIDNumber()
Section titled “generateRandomIDNumber()”generateRandomIDNumber: (length: number) => number;
Generates a random ID number with the specified length.
Parameters
Section titled “Parameters”length
Section titled “length”number
The length of the random ID number to generate.
Returns
Section titled “Returns”number
A random ID number with the specified length.
generateRandomPassword()
Section titled “generateRandomPassword()”generateRandomPassword: (length: number) => string;
Generates a random password of the specified length.
Parameters
Section titled “Parameters”length
Section titled “length”number
The length of the password to generate.
Returns
Section titled “Returns”string
A randomly generated password string containing uppercase letters, lowercase letters, and digits.
generateToken()
Section titled “generateToken()”generateToken: (userId: string, noExpire?: boolean) => string;
Generates a JSON Web Token (JWT) for a given user ID.
Parameters
Section titled “Parameters”userId
Section titled “userId”string
The unique identifier of the user for whom the token is being generated.
noExpire?
Section titled “noExpire?”boolean
Returns
Section titled “Returns”string
A signed JWT string that expires in 3 hours.
GET: { database: { config: () => Promise< | undefined | { defaultOgImage: null | string; description: string; diffPerPage: number; enableDiffs: boolean; enableMailer: boolean; gridItems: unknown; hideDefaultIndex: boolean; id: number; loginPageBackground: string; loginPageCustomImage: null | string; siteIcon: null | string; title: string; }>; folderPages: (id: string, includeDrafts?: boolean, hideDefaultIndex?: boolean, tree?: FolderNode[], metaOnly?: false, paginate?: PaginateInput) => Promise<CombinedPageData[]>(id: string, includeDrafts?: boolean, hideDefaultIndex?: boolean, tree?: FolderNode[], metaOnly?: true, paginate?: PaginateInput) => Promise<MetaOnlyPageData[]>; folders: () => Promise<{ id: string; name: string; parent: null | string; }[]>; pages: (includeDrafts?: boolean, hideDefaultIndex?: boolean, tree?: FolderNode[], metaOnly?: false, paginate?: PaginateInput) => Promise<CombinedPageData[]>(includeDrafts?: boolean, hideDefaultIndex?: boolean, tree?: FolderNode[], metaOnly?: true, paginate?: PaginateInput) => Promise<MetaOnlyPageData[]>; 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>(id: string, tree?: FolderNode[], metaOnly?: boolean) => Promise< | undefined | MetaOnlyPageData>; bySlug: (slug: string, tree?: FolderNode[]) => Promise< | undefined | CombinedPageData>(slug: string, tree?: FolderNode[], metaOnly?: boolean) => Promise< | undefined | MetaOnlyPageData>; }; users: { byEmail: (email: string) => Promise< | undefined | CombinedUserData>; byId: (id: string) => Promise< | undefined | CombinedUserData>; byUsername: (username: string) => Promise< | undefined | CombinedUserData>; }; }; databaseTable: { diffTracking: () => Promise<{ diff: null | string; id: string; pageContentStart: string; pageId: string; pageMetaData: unknown; timestamp: null | Date; userId: string; }[]>; emailVerificationTokens: () => Promise<{ expiresAt: Date; id: string; token: string; userId: string; }[]>; notificationSettings: () => Promise< | undefined | { emailVerification: boolean; id: string; oAuthBypassVerification: boolean; requireAdminVerification: boolean; requireEditorVerification: boolean; }>; oAuthAccounts: () => Promise<{ provider: string; providerUserId: string; userId: string; }[]>; pageContent: () => Promise<{ content: null | string; contentId: string; contentLang: string; id: string; }[]>; pageData: () => 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; }[]>; pageDataCategories: () => Promise<{ description: string; id: number; meta: unknown; name: string; parent: null | number; slug: string; }[]>; pageDataTags: () => Promise<{ description: string; id: number; meta: unknown; name: string; slug: string; }[]>; pageFolderStructure: () => Promise<{ id: string; name: string; parent: null | string; }[]>; permissions: () => Promise<{ rank: string; user: string; }[]>; sessionTable: () => Promise<{ expiresAt: Date; id: string; userId: string; }[]>; siteConfig: () => Promise< | undefined | { defaultOgImage: null | string; description: string; diffPerPage: number; enableDiffs: boolean; enableMailer: boolean; gridItems: unknown; hideDefaultIndex: boolean; id: number; loginPageBackground: string; loginPageCustomImage: null | string; siteIcon: null | string; title: string; }>; users: () => Promise<{ avatar: null | string; createdAt: null | Date; email: null | string; emailVerified: boolean; id: string; name: string; notifications: null | string; password: null | string; updatedAt: null | Date; url: null | string; username: string; }[]>; }; packagePages: (packageName: string, tree?: FolderNode[]) => Promise<CombinedPageData[]>(packageName: string, tree?: FolderNode[], metaOnly?: boolean) => Promise<MetaOnlyPageData[]>; permissionsLists: { admins: () => Promise<SingleRank[]>; all: () => Promise<CombinedRank[]>; editors: () => Promise<SingleRank[]>; owners: () => Promise<SingleRank[]>; visitors: () => Promise<SingleRank[]>; };};
GET.database
Section titled “GET.database”database: { config: () => Promise< | undefined | { defaultOgImage: null | string; description: string; diffPerPage: number; enableDiffs: boolean; enableMailer: boolean; gridItems: unknown; hideDefaultIndex: boolean; id: number; loginPageBackground: string; loginPageCustomImage: null | string; siteIcon: null | string; title: string; }>; folderPages: (id: string, includeDrafts?: boolean, hideDefaultIndex?: boolean, tree?: FolderNode[], metaOnly?: false, paginate?: PaginateInput) => Promise<CombinedPageData[]>(id: string, includeDrafts?: boolean, hideDefaultIndex?: boolean, tree?: FolderNode[], metaOnly?: true, paginate?: PaginateInput) => Promise<MetaOnlyPageData[]>; folders: () => Promise<{ id: string; name: string; parent: null | string; }[]>; pages: (includeDrafts?: boolean, hideDefaultIndex?: boolean, tree?: FolderNode[], metaOnly?: false, paginate?: PaginateInput) => Promise<CombinedPageData[]>(includeDrafts?: boolean, hideDefaultIndex?: boolean, tree?: FolderNode[], metaOnly?: true, paginate?: PaginateInput) => Promise<MetaOnlyPageData[]>; users: () => Promise<CombinedUserData[]>;};
Retrieves data from the database
GET.database.config()
Section titled “GET.database.config()”config: () => Promise< | undefined | { defaultOgImage: null | string; description: string; diffPerPage: number; enableDiffs: boolean; enableMailer: boolean; gridItems: unknown; hideDefaultIndex: boolean; id: number; loginPageBackground: string; loginPageCustomImage: null | string; siteIcon: null | string; title: string;}>;
Retrieves the site configuration from the database.
Returns
Section titled “Returns”Promise
<
| undefined
| {
defaultOgImage
: null
| string
;
description
: string
;
diffPerPage
: number
;
enableDiffs
: boolean
;
enableMailer
: boolean
;
gridItems
: unknown
;
hideDefaultIndex
: boolean
;
id
: number
;
loginPageBackground
: string
;
loginPageCustomImage
: null
| string
;
siteIcon
: null
| string
;
title
: string
;
}>
A promise that resolves to the site configuration.
Throws
Section titled “Throws”If an error occurs while getting the site configuration.
GET.database.folderPages()
Section titled “GET.database.folderPages()”folderPages: (id: string, includeDrafts?: boolean, hideDefaultIndex?: boolean, tree?: FolderNode[], metaOnly?: false, paginate?: PaginateInput) => Promise<CombinedPageData[]>(id: string, includeDrafts?: boolean, hideDefaultIndex?: boolean, tree?: FolderNode[], metaOnly?: true, paginate?: PaginateInput) => Promise<MetaOnlyPageData[]> = _getPagesByFolderID;
Retrieves all the pages from the database that are related to a specific folder
Parameters
Section titled “Parameters”string
includeDrafts?
Section titled “includeDrafts?”boolean
hideDefaultIndex?
Section titled “hideDefaultIndex?”boolean
metaOnly?
Section titled “metaOnly?”false
paginate?
Section titled “paginate?”Returns
Section titled “Returns”Promise
<CombinedPageData
[]>
Parameters
Section titled “Parameters”string
includeDrafts?
Section titled “includeDrafts?”boolean
hideDefaultIndex?
Section titled “hideDefaultIndex?”boolean
metaOnly?
Section titled “metaOnly?”true
paginate?
Section titled “paginate?”Returns
Section titled “Returns”Promise
<MetaOnlyPageData
[]>
GET.database.folders()
Section titled “GET.database.folders()”folders: () => Promise<{ id: string; name: string; parent: null | string;}[]>;
Returns
Section titled “Returns”Promise
<{
id
: string
;
name
: string
;
parent
: null
| string
;
}[]>
GET.database.pages()
Section titled “GET.database.pages()”pages: (includeDrafts?: boolean, hideDefaultIndex?: boolean, tree?: FolderNode[], metaOnly?: false, paginate?: PaginateInput) => Promise<CombinedPageData[]>(includeDrafts?: boolean, hideDefaultIndex?: boolean, tree?: FolderNode[], metaOnly?: true, paginate?: PaginateInput) => Promise<MetaOnlyPageData[]> = _getAllPages;
Retrieves all pages from the database.
Parameters
Section titled “Parameters”includeDrafts?
Section titled “includeDrafts?”boolean
hideDefaultIndex?
Section titled “hideDefaultIndex?”boolean
metaOnly?
Section titled “metaOnly?”false
paginate?
Section titled “paginate?”Returns
Section titled “Returns”Promise
<CombinedPageData
[]>
Parameters
Section titled “Parameters”includeDrafts?
Section titled “includeDrafts?”boolean
hideDefaultIndex?
Section titled “hideDefaultIndex?”boolean
metaOnly?
Section titled “metaOnly?”true
paginate?
Section titled “paginate?”Returns
Section titled “Returns”Promise
<MetaOnlyPageData
[]>
Returns
Section titled “Returns”A promise that resolves to an array of combined page data.
Throws
Section titled “Throws”If an error occurs while getting the pages.
GET.database.users()
Section titled “GET.database.users()”users: () => Promise<CombinedUserData[]>;
Retrieves all users from the database.
Returns
Section titled “Returns”Promise
<CombinedUserData
[]>
A promise that resolves to an array of combined user data.
Throws
Section titled “Throws”If an error occurs while getting the users.
GET.databaseEntry
Section titled “GET.databaseEntry”databaseEntry: { folder: (id: string) => Promise< | undefined | { id: string; name: string; parent: null | string; }>; pages: { byId: (id: string, tree?: FolderNode[]) => Promise< | undefined | CombinedPageData>(id: string, tree?: FolderNode[], metaOnly?: boolean) => Promise< | undefined | MetaOnlyPageData>; bySlug: (slug: string, tree?: FolderNode[]) => Promise< | undefined | CombinedPageData>(slug: string, tree?: FolderNode[], metaOnly?: boolean) => Promise< | undefined | MetaOnlyPageData>; }; 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()
Section titled “GET.databaseEntry.folder()”folder: (id: string) => Promise< | undefined | { id: string; name: string; parent: null | string;}>;
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise
<
| undefined
| {
id
: string
;
name
: string
;
parent
: null
| string
;
}>
GET.databaseEntry.pages
Section titled “GET.databaseEntry.pages”pages: { byId: (id: string, tree?: FolderNode[]) => Promise< | undefined | CombinedPageData>(id: string, tree?: FolderNode[], metaOnly?: boolean) => Promise< | undefined | MetaOnlyPageData>; bySlug: (slug: string, tree?: FolderNode[]) => Promise< | undefined | CombinedPageData>(slug: string, tree?: FolderNode[], metaOnly?: boolean) => Promise< | undefined | MetaOnlyPageData>;};
Retrieves a page from the database
GET.databaseEntry.pages.byId()
Section titled “GET.databaseEntry.pages.byId()”byId: (id: string, tree?: FolderNode[]) => Promise< | undefined | CombinedPageData>(id: string, tree?: FolderNode[], metaOnly?: boolean) => Promise< | undefined | MetaOnlyPageData> = _getPagesByID;
Retrieves a page by ID.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise
<
| undefined
| CombinedPageData
>
Parameters
Section titled “Parameters”string
metaOnly?
Section titled “metaOnly?”boolean
Returns
Section titled “Returns”Promise
<
| undefined
| MetaOnlyPageData
>
The ID of the page to retrieve.
Returns
Section titled “Returns”A promise that resolves to the page data.
Throws
Section titled “Throws”If an error occurs while getting the page.
GET.databaseEntry.pages.bySlug()
Section titled “GET.databaseEntry.pages.bySlug()”bySlug: (slug: string, tree?: FolderNode[]) => Promise< | undefined | CombinedPageData>(slug: string, tree?: FolderNode[], metaOnly?: boolean) => Promise< | undefined | MetaOnlyPageData> = _getPagesBySlug;
Retrieves a page by slug.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise
<
| undefined
| CombinedPageData
>
Parameters
Section titled “Parameters”string
metaOnly?
Section titled “metaOnly?”boolean
Returns
Section titled “Returns”Promise
<
| undefined
| MetaOnlyPageData
>
The slug of the page to retrieve.
Returns
Section titled “Returns”A promise that resolves to the page data.
Throws
Section titled “Throws”If an error occurs while getting the page.
GET.databaseEntry.users
Section titled “GET.databaseEntry.users”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()
Section titled “GET.databaseEntry.users.byEmail()”byEmail: (email: string) => Promise< | undefined| CombinedUserData>;
Retrieves a user by email.
Parameters
Section titled “Parameters”string
The email of the user to retrieve.
Returns
Section titled “Returns”Promise
<
| undefined
| CombinedUserData
>
A promise that resolves to the user data.
Throws
Section titled “Throws”If an error occurs while getting the user.
GET.databaseEntry.users.byId()
Section titled “GET.databaseEntry.users.byId()”byId: (id: string) => Promise< | undefined| CombinedUserData>;
Retrieves a user by ID.
Parameters
Section titled “Parameters”string
The ID of the user to retrieve.
Returns
Section titled “Returns”Promise
<
| undefined
| CombinedUserData
>
A promise that resolves to the user data.
Throws
Section titled “Throws”If an error occurs while getting the user.
GET.databaseEntry.users.byUsername()
Section titled “GET.databaseEntry.users.byUsername()”byUsername: (username: string) => Promise< | undefined| CombinedUserData>;
Retrieves a user by username.
Parameters
Section titled “Parameters”username
Section titled “username”string
The username of the user to retrieve.
Returns
Section titled “Returns”Promise
<
| undefined
| CombinedUserData
>
A promise that resolves to the user data.
Throws
Section titled “Throws”If an error occurs while getting the user.
GET.databaseTable
Section titled “GET.databaseTable”databaseTable: { diffTracking: () => Promise<{ diff: null | string; id: string; pageContentStart: string; pageId: string; pageMetaData: unknown; timestamp: null | Date; userId: string; }[]>; emailVerificationTokens: () => Promise<{ expiresAt: Date; id: string; token: string; userId: string; }[]>; notificationSettings: () => Promise< | undefined | { emailVerification: boolean; id: string; oAuthBypassVerification: boolean; requireAdminVerification: boolean; requireEditorVerification: boolean; }>; oAuthAccounts: () => Promise<{ provider: string; providerUserId: string; userId: string; }[]>; pageContent: () => Promise<{ content: null | string; contentId: string; contentLang: string; id: string; }[]>; pageData: () => 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; }[]>; pageDataCategories: () => Promise<{ description: string; id: number; meta: unknown; name: string; parent: null | number; slug: string; }[]>; pageDataTags: () => Promise<{ description: string; id: number; meta: unknown; name: string; slug: string; }[]>; pageFolderStructure: () => Promise<{ id: string; name: string; parent: null | string; }[]>; permissions: () => Promise<{ rank: string; user: string; }[]>; sessionTable: () => Promise<{ expiresAt: Date; id: string; userId: string; }[]>; siteConfig: () => Promise< | undefined | { defaultOgImage: null | string; description: string; diffPerPage: number; enableDiffs: boolean; enableMailer: boolean; gridItems: unknown; hideDefaultIndex: boolean; id: number; loginPageBackground: string; loginPageCustomImage: null | string; siteIcon: null | string; title: string; }>; users: () => Promise<{ avatar: null | string; createdAt: null | Date; email: null | string; emailVerified: boolean; id: string; name: string; notifications: null | string; password: null | string; updatedAt: null | Date; url: null | string; username: string; }[]>;};
Retrieves data from the database tables without any additional processing.
GET.databaseTable.diffTracking()
Section titled “GET.databaseTable.diffTracking()”diffTracking: () => Promise<{ diff: null | string; id: string; pageContentStart: string; pageId: string; pageMetaData: unknown; timestamp: null | Date; userId: string;}[]>;
Retrieves all data from the diff tracking table.
Returns
Section titled “Returns”Promise
<{
diff
: null
| string
;
id
: string
;
pageContentStart
: string
;
pageId
: string
;
pageMetaData
: unknown
;
timestamp
: null
| Date
;
userId
: string
;
}[]>
A promise that resolves to an array of diff tracking data.
Throws
Section titled “Throws”If an error occurs while getting the diff tracking data.
GET.databaseTable.emailVerificationTokens()
Section titled “GET.databaseTable.emailVerificationTokens()”emailVerificationTokens: () => Promise<{ expiresAt: Date; id: string; token: string; userId: string;}[]>;
Retrieves all data from the email verification tokens table.
Returns
Section titled “Returns”Promise
<{
expiresAt
: Date
;
id
: string
;
token
: string
;
userId
: string
;
}[]>
A promise that resolves to an array of email verification token data.
GET.databaseTable.notificationSettings()
Section titled “GET.databaseTable.notificationSettings()”notificationSettings: () => Promise< | undefined | { emailVerification: boolean; id: string; oAuthBypassVerification: boolean; requireAdminVerification: boolean; requireEditorVerification: boolean;}>;
Retrieves all data from the notification settings table.
Returns
Section titled “Returns”Promise
<
| undefined
| {
emailVerification
: boolean
;
id
: string
;
oAuthBypassVerification
: boolean
;
requireAdminVerification
: boolean
;
requireEditorVerification
: boolean
;
}>
A promise that resolves to an array of notification settings data.
GET.databaseTable.oAuthAccounts()
Section titled “GET.databaseTable.oAuthAccounts()”oAuthAccounts: () => Promise<{ provider: string; providerUserId: string; userId: string;}[]>;
Retrieves all data from the OAuth accounts table.
Returns
Section titled “Returns”Promise
<{
provider
: string
;
providerUserId
: string
;
userId
: string
;
}[]>
A promise that resolves to an array of OAuth account data.
Throws
Section titled “Throws”If an error occurs while getting the OAuth accounts.
GET.databaseTable.pageContent()
Section titled “GET.databaseTable.pageContent()”pageContent: () => Promise<{ content: null | string; contentId: string; contentLang: string; id: string;}[]>;
Retrieves all data from the page content table.
Returns
Section titled “Returns”Promise
<{
content
: null
| string
;
contentId
: string
;
contentLang
: string
;
id
: string
;
}[]>
A promise that resolves to an array of page content.
Throws
Section titled “Throws”If an error occurs while getting the page content.
GET.databaseTable.pageData()
Section titled “GET.databaseTable.pageData()”pageData: () => 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;}[]>;
Retrieves all data from the page data table.
Returns
Section titled “Returns”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 an array of page data.
Throws
Section titled “Throws”If an error occurs while getting the pages.
GET.databaseTable.pageDataCategories()
Section titled “GET.databaseTable.pageDataCategories()”pageDataCategories: () => Promise<{ description: string; id: number; meta: unknown; name: string; parent: null | number; slug: string;}[]>;
Retrieves all data from the page data categories table.
Returns
Section titled “Returns”Promise
<{
description
: string
;
id
: number
;
meta
: unknown
;
name
: string
;
parent
: null
| number
;
slug
: string
;
}[]>
A promise that resolves to an array of page data categories.
Throws
Section titled “Throws”If an error occurs while getting the page data categories.
GET.databaseTable.pageDataTags()
Section titled “GET.databaseTable.pageDataTags()”pageDataTags: () => Promise<{ description: string; id: number; meta: unknown; name: string; slug: string;}[]>;
Retrieves all data from the page data tags table.
Returns
Section titled “Returns”Promise
<{
description
: string
;
id
: number
;
meta
: unknown
;
name
: string
;
slug
: string
;
}[]>
A promise that resolves to an array of page data tags.
Throws
Section titled “Throws”If an error occurs while getting the page data tags.
GET.databaseTable.pageFolderStructure()
Section titled “GET.databaseTable.pageFolderStructure()”pageFolderStructure: () => Promise<{ id: string; name: string; parent: null | string;}[]>;
Retrieves all data from the page folder structure table.
Returns
Section titled “Returns”Promise
<{
id
: string
;
name
: string
;
parent
: null
| string
;
}[]>
A promise that resolves to an array of page folder structure data.
Throws
Section titled “Throws”If an error occurs while getting the page folder structure data.
GET.databaseTable.permissions()
Section titled “GET.databaseTable.permissions()”permissions: () => Promise<{ rank: string; user: string;}[]>;
Retrieves all data from the permissions table.
Returns
Section titled “Returns”Promise
<{
rank
: string
;
user
: string
;
}[]>
A promise that resolves to an array of permission data.
Throws
Section titled “Throws”If an error occurs while getting the permissions.
GET.databaseTable.sessionTable()
Section titled “GET.databaseTable.sessionTable()”sessionTable: () => Promise<{ expiresAt: Date; id: string; userId: string;}[]>;
Retrieves all data from the session table.
Returns
Section titled “Returns”Promise
<{
expiresAt
: Date
;
id
: string
;
userId
: string
;
}[]>
A promise that resolves to an array of session data.
Throws
Section titled “Throws”If an error occurs while getting the sessions.
GET.databaseTable.siteConfig()
Section titled “GET.databaseTable.siteConfig()”siteConfig: () => Promise< | undefined | { defaultOgImage: null | string; description: string; diffPerPage: number; enableDiffs: boolean; enableMailer: boolean; gridItems: unknown; hideDefaultIndex: boolean; id: number; loginPageBackground: string; loginPageCustomImage: null | string; siteIcon: null | string; title: string;}>;
Retrieves all data from the site config table.
Returns
Section titled “Returns”Promise
<
| undefined
| {
defaultOgImage
: null
| string
;
description
: string
;
diffPerPage
: number
;
enableDiffs
: boolean
;
enableMailer
: boolean
;
gridItems
: unknown
;
hideDefaultIndex
: boolean
;
id
: number
;
loginPageBackground
: string
;
loginPageCustomImage
: null
| string
;
siteIcon
: null
| string
;
title
: string
;
}>
A promise that resolves to an array of site configuration data.
Throws
Section titled “Throws”If an error occurs while getting the site configuration.
GET.databaseTable.users()
Section titled “GET.databaseTable.users()”users: () => Promise<{ avatar: null | string; createdAt: null | Date; email: null | string; emailVerified: boolean; id: string; name: string; notifications: null | string; password: null | string; updatedAt: null | Date; url: null | string; username: string;}[]>;
Retrieves all data from the users table.
Returns
Section titled “Returns”Promise
<{
avatar
: null
| string
;
createdAt
: null
| Date
;
email
: null
| string
;
emailVerified
: boolean
;
id
: string
;
name
: string
;
notifications
: null
| string
;
password
: null
| string
;
updatedAt
: null
| Date
;
url
: null
| string
;
username
: string
;
}[]>
A promise that resolves to an array of user data.
Throws
Section titled “Throws”If an error occurs while getting the users.
GET.packagePages()
Section titled “GET.packagePages()”packagePages: (packageName: string, tree?: FolderNode[]) => Promise<CombinedPageData[]>(packageName: string, tree?: FolderNode[], metaOnly?: boolean) => Promise<MetaOnlyPageData[]> = _getPackagesPages;
Retrieves data from the database by package.
Parameters
Section titled “Parameters”packageName
Section titled “packageName”string
Returns
Section titled “Returns”Promise
<CombinedPageData
[]>
Parameters
Section titled “Parameters”packageName
Section titled “packageName”string
metaOnly?
Section titled “metaOnly?”boolean
Returns
Section titled “Returns”Promise
<MetaOnlyPageData
[]>
GET.permissionsLists
Section titled “GET.permissionsLists”permissionsLists: { admins: () => Promise<SingleRank[]>; all: () => Promise<CombinedRank[]>; editors: () => Promise<SingleRank[]>; owners: () => Promise<SingleRank[]>; visitors: () => Promise<SingleRank[]>;};
Retrieve Permission Lists
GET.permissionsLists.admins()
Section titled “GET.permissionsLists.admins()”admins: () => Promise<SingleRank[]>;
Retrieves all admins in the database.
Returns
Section titled “Returns”Promise
<SingleRank
[]>
A promise that resolves to an array of combined rank data.
Throws
Section titled “Throws”If an error occurs while getting the admins.
GET.permissionsLists.all()
Section titled “GET.permissionsLists.all()”all: () => Promise<CombinedRank[]>;
Retrieves all permissions for users in the database.
Returns
Section titled “Returns”Promise
<CombinedRank
[]>
A promise that resolves to an array of combined rank data.
Throws
Section titled “Throws”If an error occurs while getting the permissions.
GET.permissionsLists.editors()
Section titled “GET.permissionsLists.editors()”editors: () => Promise<SingleRank[]>;
Retrieves all editors in the database.
Returns
Section titled “Returns”Promise
<SingleRank
[]>
A promise that resolves to an array of combined rank data.
Throws
Section titled “Throws”If an error occurs while getting the editors.
GET.permissionsLists.owners()
Section titled “GET.permissionsLists.owners()”owners: () => Promise<SingleRank[]>;
Retrieves all owners in the database.
Returns
Section titled “Returns”Promise
<SingleRank
[]>
A promise that resolves to an array of combined rank data.
Throws
Section titled “Throws”If an error occurs while getting the owners.
GET.permissionsLists.visitors()
Section titled “GET.permissionsLists.visitors()”visitors: () => Promise<SingleRank[]>;
Retrieves all visitors in the database.
Returns
Section titled “Returns”Promise
<SingleRank
[]>
A promise that resolves to an array of combined rank data.
Throws
Section titled “Throws”If an error occurs while getting the visitors.
getAvailableFolders()
Section titled “getAvailableFolders()”getAvailableFolders: () => Promise<FolderListItem[]>;
Gets the available folders from the database.
Returns
Section titled “Returns”Promise
<FolderListItem
[]>
A promise that resolves to an array of folder list items.
getFullPath()
Section titled “getFullPath()”getFullPath: (tree: FolderNode[], path: string[]) => string[];
Finds the full path to a node based on its URL.
Parameters
Section titled “Parameters”The root of the folder tree.
string
[]
The URL path to locate.
Returns
Section titled “Returns”string
[]
The full path as an array of node names.
INIT: { ghostUser: () => Promise<{ avatar: null | string; createdAt: null | Date; email: null | string; emailVerified: boolean; id: string; name: string; notifications: null | string; password: null | string; updatedAt: null | Date; url: null | string; username: string; }>; siteConfig: (config: { defaultOgImage: null | string; description: string; diffPerPage: number; enableDiffs: boolean; enableMailer: boolean; gridItems: unknown; hideDefaultIndex: boolean; id: number; loginPageBackground: string; loginPageCustomImage: null | string; siteIcon: null | string; title: string; }) => Promise<{ defaultOgImage: null | string; description: string; diffPerPage: number; enableDiffs: boolean; enableMailer: boolean; gridItems: unknown; hideDefaultIndex: boolean; id: number; loginPageBackground: string; loginPageCustomImage: null | string; siteIcon: null | string; title: string; }>;};
INIT.ghostUser()
Section titled “INIT.ghostUser()”ghostUser: () => Promise<{ avatar: null | string; createdAt: null | Date; email: null | string; emailVerified: boolean; id: string; name: string; notifications: null | 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.
Returns
Section titled “Returns”Promise
<{
avatar
: null
| string
;
createdAt
: null
| Date
;
email
: null
| string
;
emailVerified
: boolean
;
id
: string
;
name
: string
;
notifications
: null
| string
;
password
: null
| string
;
updatedAt
: null
| Date
;
url
: null
| string
;
username
: string
;
}>
A promise that resolves to the ghost user record.
Throws
Section titled “Throws”If an error occurs while creating the ghost user.
INIT.siteConfig()
Section titled “INIT.siteConfig()”siteConfig: (config: { defaultOgImage: null | string; description: string; diffPerPage: number; enableDiffs: boolean; enableMailer: boolean; gridItems: unknown; hideDefaultIndex: boolean; id: number; loginPageBackground: string; loginPageCustomImage: null | string; siteIcon: null | string; title: string; }) => Promise<{ defaultOgImage: null | string; description: string; diffPerPage: number; enableDiffs: boolean; enableMailer: boolean; gridItems: unknown; hideDefaultIndex: boolean; id: number; loginPageBackground: string; loginPageCustomImage: null | string; siteIcon: null | string; title: string;}>;
Initializes the StudioCMS SiteConfig table with the provided configuration.
Parameters
Section titled “Parameters”config
Section titled “config”The configuration to insert into the SiteConfig table.
defaultOgImage?
Section titled “defaultOgImage?”null
| string
description
Section titled “description”string
diffPerPage?
Section titled “diffPerPage?”number
enableDiffs?
Section titled “enableDiffs?”boolean
enableMailer?
Section titled “enableMailer?”boolean
gridItems?
Section titled “gridItems?”unknown
hideDefaultIndex?
Section titled “hideDefaultIndex?”boolean
number
loginPageBackground?
Section titled “loginPageBackground?”string
loginPageCustomImage?
Section titled “loginPageCustomImage?”null
| string
siteIcon?
Section titled “siteIcon?”null
| string
string
Returns
Section titled “Returns”Promise
<{
defaultOgImage
: null
| string
;
description
: string
;
diffPerPage
: number
;
enableDiffs
: boolean
;
enableMailer
: boolean
;
gridItems
: unknown
;
hideDefaultIndex
: boolean
;
id
: number
;
loginPageBackground
: string
;
loginPageCustomImage
: null
| string
;
siteIcon
: null
| string
;
title
: string
;
}>
A promise that resolves to the inserted site configuration.
Throws
Section titled “Throws”If an error occurs while creating the site configuration.
notificationSettings
Section titled “notificationSettings”notificationSettings: { site: { get: () => Promise<{ emailVerification: boolean; id: string; oAuthBypassVerification: boolean; requireAdminVerification: boolean; requireEditorVerification: boolean; }>; update: (settings: { emailVerification: boolean; id: string; oAuthBypassVerification: boolean; requireAdminVerification: boolean; requireEditorVerification: boolean; }) => Promise<{ emailVerification: boolean; id: string; oAuthBypassVerification: boolean; requireAdminVerification: boolean; requireEditorVerification: boolean; }>; };};
notificationSettings.site
Section titled “notificationSettings.site”site: { get: () => Promise<{ emailVerification: boolean; id: string; oAuthBypassVerification: boolean; requireAdminVerification: boolean; requireEditorVerification: boolean; }>; update: (settings: { emailVerification: boolean; id: string; oAuthBypassVerification: boolean; requireAdminVerification: boolean; requireEditorVerification: boolean; }) => Promise<{ emailVerification: boolean; id: string; oAuthBypassVerification: boolean; requireAdminVerification: boolean; requireEditorVerification: boolean; }>;};
notificationSettings.site.get()
Section titled “notificationSettings.site.get()”get: () => Promise<{ emailVerification: boolean; id: string; oAuthBypassVerification: boolean; requireAdminVerification: boolean; requireEditorVerification: boolean;}>;
Returns
Section titled “Returns”Promise
<{
emailVerification
: boolean
;
id
: string
;
oAuthBypassVerification
: boolean
;
requireAdminVerification
: boolean
;
requireEditorVerification
: boolean
;
}>
notificationSettings.site.update()
Section titled “notificationSettings.site.update()”update: (settings: { emailVerification: boolean; id: string; oAuthBypassVerification: boolean; requireAdminVerification: boolean; requireEditorVerification: boolean; }) => Promise<{ emailVerification: boolean; id: string; oAuthBypassVerification: boolean; requireAdminVerification: boolean; requireEditorVerification: boolean;}>;
Parameters
Section titled “Parameters”settings
Section titled “settings”emailVerification?
Section titled “emailVerification?”boolean
string
oAuthBypassVerification?
Section titled “oAuthBypassVerification?”boolean
requireAdminVerification?
Section titled “requireAdminVerification?”boolean
requireEditorVerification?
Section titled “requireEditorVerification?”boolean
Returns
Section titled “Returns”Promise
<{
emailVerification
: boolean
;
id
: string
;
oAuthBypassVerification
: boolean
;
requireAdminVerification
: boolean
;
requireEditorVerification
: boolean
;
}>
parseIdNumberArray()
Section titled “parseIdNumberArray()”parseIdNumberArray: (ids: unknown) => number[];
Parses an unknown input and casts it to an array of numbers.
Parameters
Section titled “Parameters”unknown
The input to be parsed, expected to be an array of numbers.
Returns
Section titled “Returns”number
[]
An array of numbers.
parseIdStringArray()
Section titled “parseIdStringArray()”parseIdStringArray: (ids: unknown) => string[];
Parses the given input as an array of strings.
Parameters
Section titled “Parameters”unknown
The input to be parsed, expected to be an array of unknown type.
Returns
Section titled “Returns”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<{ id: number; }[]>; 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
Section titled “POST.databaseEntries”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()
Section titled “POST.databaseEntries.categories()”categories: (data: { description: string; id: number; meta: unknown; name: string; parent: null | number; slug: string;}[]) => Promise<PageDataCategoriesInsertResponse[]>;
Inserts multiple categories into the database.
Parameters
Section titled “Parameters”{
description
: string
;
id
: number
;
meta
: unknown
;
name
: string
;
parent
: null
| number
;
slug
: string
;
}[]
The data to insert into the page data categories table.
Returns
Section titled “Returns”Promise
<PageDataCategoriesInsertResponse
[]>
A promise that resolves to the inserted categories.
Throws
Section titled “Throws”If an error occurs while inserting the categories.
POST.databaseEntries.pages()
Section titled “POST.databaseEntries.pages()”pages: (pages: MultiPageInsert) => Promise<void>;
Inserts multiple pages into the database.
Parameters
Section titled “Parameters”The data to insert into the page data and page content tables.
Returns
Section titled “Returns”Promise
<void
>
A promise that resolves to the inserted pages.
Throws
Section titled “Throws”If an error occurs while inserting the pages.
POST.databaseEntries.permissions()
Section titled “POST.databaseEntries.permissions()”permissions: (data: { rank: string; user: string; }[]) => Promise<{ rank: string; user: string;}[]>;
Inserts multiple permissions into the database.
Parameters
Section titled “Parameters”{
rank
: string
;
user
: string
;
}[]
The data to insert into the permissions table.
Returns
Section titled “Returns”Promise
<{
rank
: string
;
user
: string
;
}[]>
A promise that resolves to the inserted permissions.
Throws
Section titled “Throws”If an error occurs while inserting the permissions.
POST.databaseEntries.tags()
Section titled “POST.databaseEntries.tags()”tags: (data: { description: string; id: number; meta: unknown; name: string; slug: string;}[]) => Promise<PageDataTagsInsertResponse[]>;
Inserts multiple tags into the database.
Parameters
Section titled “Parameters”{
description
: string
;
id
: number
;
meta
: unknown
;
name
: string
;
slug
: string
;
}[]
The data to insert into the page data tags table.
Returns
Section titled “Returns”Promise
<PageDataTagsInsertResponse
[]>
A promise that resolves to the inserted tags.
Throws
Section titled “Throws”If an error occurs while inserting the tags.
POST.databaseEntry
Section titled “POST.databaseEntry”databaseEntry: { categories: (category: { description: string; id: number; meta: unknown; name: string; parent: null | number; slug: string; }) => Promise<{ id: number; }[]>; 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()
Section titled “POST.databaseEntry.categories()”categories: (category: { description: string; id: number; meta: unknown; name: string; parent: null | number; slug: string; }) => Promise<{ id: number;}[]>;
Inserts a new category into the database.
Parameters
Section titled “Parameters”category
Section titled “category”The data to insert into the page data categories table.
description
Section titled “description”string
number
unknown
string
parent?
Section titled “parent?”null
| number
string
Returns
Section titled “Returns”Promise
<{
id
: number
;
}[]>
A promise that resolves to the inserted category.
Throws
Section titled “Throws”If an error occurs while inserting the category.
POST.databaseEntry.diffTracking()
Section titled “POST.databaseEntry.diffTracking()”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
Section titled “Parameters”The data to insert into the diff tracking table.
null
| string
string
pageContentStart
Section titled “pageContentStart”string
pageId
Section titled “pageId”string
pageMetaData?
Section titled “pageMetaData?”unknown
timestamp?
Section titled “timestamp?”null
| Date
userId
Section titled “userId”string
Returns
Section titled “Returns”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.
Throws
Section titled “Throws”If an error occurs while inserting the diff tracking entry.
POST.databaseEntry.folder()
Section titled “POST.databaseEntry.folder()”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
Section titled “Parameters”folder
Section titled “folder”The data to insert into the page folder structure table.
string
string
parent?
Section titled “parent?”null
| string
Returns
Section titled “Returns”Promise
<{
id
: string
;
name
: string
;
parent
: null
| string
;
}>
A promise that resolves to the inserted folder.
Throws
Section titled “Throws”If an error occurs while inserting the folder.
POST.databaseEntry.pageContent()
Section titled “POST.databaseEntry.pageContent()”pageContent: (pageContent: { content: null | string; contentId: string; contentLang: string; id: string;}) => Promise<PageContentReturnId[]>;
Inserts new page content into the database.
Parameters
Section titled “Parameters”pageContent
Section titled “pageContent”The data to insert into the page content table.
content?
Section titled “content?”null
| string
contentId
Section titled “contentId”string
contentLang?
Section titled “contentLang?”string
string
Returns
Section titled “Returns”Promise
<PageContentReturnId
[]>
A promise that resolves to the inserted page content.
Throws
Section titled “Throws”If an error occurs while inserting the page content.
POST.databaseEntry.pages()
Section titled “POST.databaseEntry.pages()”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
Section titled “Parameters”pageData
Section titled “pageData”The data to insert into the page data table.
authorId?
Section titled “authorId?”null
| string
categories?
Section titled “categories?”unknown
contentLang?
Section titled “contentLang?”string
contributorIds?
Section titled “contributorIds?”unknown
description
Section titled “description”string
draft?
Section titled “draft?”null
| boolean
heroImage?
Section titled “heroImage?”string
string
package?
Section titled “package?”string
parentFolder?
Section titled “parentFolder?”null
| string
publishedAt?
Section titled “publishedAt?”Date
showAuthor?
Section titled “showAuthor?”null
| boolean
showContributors?
Section titled “showContributors?”null
| boolean
showOnNav?
Section titled “showOnNav?”boolean
string
unknown
string
updatedAt?
Section titled “updatedAt?”null
| Date
pageContent
Section titled “pageContent”The data to insert into the page content table.
Returns
Section titled “Returns”Promise
<addDatabaseEntryInsertPage
>
A promise that resolves to the inserted page data and page content.
Throws
Section titled “Throws”If an error occurs while inserting the page.
POST.databaseEntry.permissions()
Section titled “POST.databaseEntry.permissions()”permissions: (userId: string, rank: string) => Promise<{ rank: string; user: string;}[]>;
Inserts a new permission into the database.
Parameters
Section titled “Parameters”userId
Section titled “userId”string
The ID of the user to assign the rank to.
string
The rank to assign to the user.
Returns
Section titled “Returns”Promise
<{
rank
: string
;
user
: string
;
}[]>
A promise that resolves to the inserted permission.
Throws
Section titled “Throws”If an error occurs while inserting the permission.
POST.databaseEntry.tags()
Section titled “POST.databaseEntry.tags()”tags: (tag: { description: string; id: number; meta: unknown; name: string; slug: string;}) => Promise<PageDataTagsInsertResponse[]>;
Inserts a new tag into the database.
Parameters
Section titled “Parameters”The data to insert into the page data tags table.
description
Section titled “description”string
number
unknown
string
string
Returns
Section titled “Returns”Promise
<PageDataTagsInsertResponse
[]>
A promise that resolves to the inserted tag.
Throws
Section titled “Throws”If an error occurs while inserting the tag.
resetTokenBucket
Section titled “resetTokenBucket”resetTokenBucket: { check: (token: string) => Promise<boolean>; delete: (userId: string) => Promise<void>; new: (userId: string) => Promise<{ id: string; token: string; userId: string; }>;};
resetTokenBucket.check()
Section titled “resetTokenBucket.check()”check: (token: string) => Promise<boolean>;
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise
<boolean
>
resetTokenBucket.delete()
Section titled “resetTokenBucket.delete()”delete: (userId: string) => Promise<void>;
Parameters
Section titled “Parameters”userId
Section titled “userId”string
Returns
Section titled “Returns”Promise
<void
>
resetTokenBucket.new()
Section titled “resetTokenBucket.new()”new: (userId: string) => Promise<{ id: string; token: string; userId: string;}>;
Parameters
Section titled “Parameters”userId
Section titled “userId”string
Returns
Section titled “Returns”Promise
<{
id
: string
;
token
: string
;
userId
: string
;
}>
REST_API
Section titled “REST_API”REST_API: { tokens: { delete: (userId: string, tokenId: string) => Promise<void>; get: (userId: string) => Promise<{ creationDate: Date; description: null | string; id: string; key: string; userId: string; }[]>; new: (userId: string, description: string) => Promise<{ creationDate: Date; description: null | string; id: string; key: string; userId: string; }>; verify: (key: string) => Promise< | false | { key: string; rank: string; userId: string; }>; };};
REST_API.tokens
Section titled “REST_API.tokens”tokens: { delete: (userId: string, tokenId: string) => Promise<void>; get: (userId: string) => Promise<{ creationDate: Date; description: null | string; id: string; key: string; userId: string; }[]>; new: (userId: string, description: string) => Promise<{ creationDate: Date; description: null | string; id: string; key: string; userId: string; }>; verify: (key: string) => Promise< | false | { key: string; rank: string; userId: string; }>;};
REST_API.tokens.delete()
Section titled “REST_API.tokens.delete()”delete: (userId: string, tokenId: string) => Promise<void>;
Parameters
Section titled “Parameters”userId
Section titled “userId”string
tokenId
Section titled “tokenId”string
Returns
Section titled “Returns”Promise
<void
>
REST_API.tokens.get()
Section titled “REST_API.tokens.get()”get: (userId: string) => Promise<{ creationDate: Date; description: null | string; id: string; key: string; userId: string;}[]>;
Parameters
Section titled “Parameters”userId
Section titled “userId”string
Returns
Section titled “Returns”Promise
<{
creationDate
: Date
;
description
: null
| string
;
id
: string
;
key
: string
;
userId
: string
;
}[]>
REST_API.tokens.new()
Section titled “REST_API.tokens.new()”new: (userId: string, description: string) => Promise<{ creationDate: Date; description: null | string; id: string; key: string; userId: string;}>;
Parameters
Section titled “Parameters”userId
Section titled “userId”string
description
Section titled “description”string
Returns
Section titled “Returns”Promise
<{
creationDate
: Date
;
description
: null
| string
;
id
: string
;
key
: string
;
userId
: string
;
}>
REST_API.tokens.verify()
Section titled “REST_API.tokens.verify()”verify: (key: string) => Promise< | false | { key: string; rank: string; userId: string;}>;
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise
<
| false
| {
key
: string
;
rank
: string
;
userId
: string
;
}>
testToken()
Section titled “testToken()”testToken: (token: string) => JwtVerificationResult;
Verifies the provided JWT token using the CMS encryption key.
Parameters
Section titled “Parameters”string
The JWT token to be verified.
Returns
Section titled “Returns”JwtVerificationResult
The decoded token if verification is successful.
Throws
Section titled “Throws”Will throw an error if the token is invalid or verification fails.
UPDATE
Section titled “UPDATE”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; enableMailer: boolean; gridItems: unknown; hideDefaultIndex: boolean; id: number; loginPageBackground: string; loginPageCustomImage: null | string; siteIcon: null | string; title: string; }) => Promise<{ defaultOgImage: null | string; description: string; diffPerPage: number; enableDiffs: boolean; enableMailer: boolean; gridItems: unknown; hideDefaultIndex: boolean; 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()
Section titled “UPDATE.categories()”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
Section titled “Parameters”The data to update in the page data categories table.
description
Section titled “description”string
number
unknown
string
parent
Section titled “parent”null
| number
string
Returns
Section titled “Returns”Promise
<{
description
: string
;
id
: number
;
meta
: unknown
;
name
: string
;
parent
: null
| number
;
slug
: string
;
}>
A promise that resolves to the updated category.
Throws
Section titled “Throws”If an error occurs while updating the category.
UPDATE.folder()
Section titled “UPDATE.folder()”folder: (data: { id: string; name: string; parent: null | string; }) => Promise<{ id: string; name: string; parent: null | string;}>;
Parameters
Section titled “Parameters”string
string
parent
Section titled “parent”null
| string
Returns
Section titled “Returns”Promise
<{
id
: string
;
name
: string
;
parent
: null
| string
;
}>
UPDATE.page()
Section titled “UPDATE.page()”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
Section titled “Parameters”The data to update in the page data table.
authorId
Section titled “authorId”null
| string
categories
Section titled “categories”unknown
contentLang
Section titled “contentLang”string
contributorIds
Section titled “contributorIds”unknown
description
Section titled “description”string
null
| boolean
heroImage
Section titled “heroImage”string
string
package
Section titled “package”string
parentFolder
Section titled “parentFolder”null
| string
publishedAt
Section titled “publishedAt”Date
showAuthor
Section titled “showAuthor”null
| boolean
showContributors
Section titled “showContributors”null
| boolean
showOnNav
Section titled “showOnNav”boolean
string
unknown
string
updatedAt
Section titled “updatedAt”null
| Date
Returns
Section titled “Returns”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.
Throws
Section titled “Throws”If an error occurs while updating the page.
UPDATE.pageContent()
Section titled “UPDATE.pageContent()”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
Section titled “Parameters”The data to update in the page content table.
content
Section titled “content”null
| string
contentId
Section titled “contentId”string
contentLang
Section titled “contentLang”string
string
Returns
Section titled “Returns”Promise
<{
content
: null
| string
;
contentId
: string
;
contentLang
: string
;
id
: string
;
}>
A promise that resolves to the updated page content.
Throws
Section titled “Throws”If an error occurs while updating the page content.
UPDATE.permissions()
Section titled “UPDATE.permissions()”permissions: (data: { rank: string; user: string; }) => Promise<{ rank: string; user: string;}>;
Updates a permission in the database.
Parameters
Section titled “Parameters”The data to update in the permissions table.
string
string
Returns
Section titled “Returns”Promise
<{
rank
: string
;
user
: string
;
}>
A promise that resolves to the updated permission.
Throws
Section titled “Throws”If an error occurs while updating the permission.
UPDATE.siteConfig()
Section titled “UPDATE.siteConfig()”siteConfig: (data: { defaultOgImage: null | string; description: string; diffPerPage: number; enableDiffs: boolean; enableMailer: boolean; gridItems: unknown; hideDefaultIndex: boolean; id: number; loginPageBackground: string; loginPageCustomImage: null | string; siteIcon: null | string; title: string; }) => Promise<{ defaultOgImage: null | string; description: string; diffPerPage: number; enableDiffs: boolean; enableMailer: boolean; gridItems: unknown; hideDefaultIndex: boolean; id: number; loginPageBackground: string; loginPageCustomImage: null | string; siteIcon: null | string; title: string;}>;
Updates a site configuration in the database.
Parameters
Section titled “Parameters”The data to update in the site config table.
defaultOgImage
Section titled “defaultOgImage”null
| string
description
Section titled “description”string
diffPerPage
Section titled “diffPerPage”number
enableDiffs
Section titled “enableDiffs”boolean
enableMailer
Section titled “enableMailer”boolean
gridItems
Section titled “gridItems”unknown
hideDefaultIndex
Section titled “hideDefaultIndex”boolean
number
loginPageBackground
Section titled “loginPageBackground”string
loginPageCustomImage
Section titled “loginPageCustomImage”null
| string
siteIcon
Section titled “siteIcon”null
| string
string
Returns
Section titled “Returns”Promise
<{
defaultOgImage
: null
| string
;
description
: string
;
diffPerPage
: number
;
enableDiffs
: boolean
;
enableMailer
: boolean
;
gridItems
: unknown
;
hideDefaultIndex
: boolean
;
id
: number
;
loginPageBackground
: string
;
loginPageCustomImage
: null
| string
;
siteIcon
: null
| string
;
title
: string
;
}>
A promise that resolves to the updated site configuration.
Throws
Section titled “Throws”If an error occurs while updating the site configuration.
UPDATE.tags()
Section titled “UPDATE.tags()”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
Section titled “Parameters”The data to update in the page data tags table.
description
Section titled “description”string
number
unknown
string
string
Returns
Section titled “Returns”Promise
<{
description
: string
;
id
: number
;
meta
: unknown
;
name
: string
;
slug
: string
;
}>
A promise that resolves to the updated tag.
Throws
Section titled “Throws”If an error occurs while updating the tag.
verifyRank()
Section titled “verifyRank()”verifyRank: (users: { avatar: null | string; createdAt: null | Date; email: null | string; emailVerified: boolean; id: string; name: string; notifications: null | 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
Section titled “Parameters”{
avatar
: null
| string
;
createdAt
: null
| Date
;
email
: null
| string
;
emailVerified
: boolean
;
id
: string
;
name
: string
;
notifications
: null
| string
;
password
: null
| string
;
updatedAt
: null
| Date
;
url
: null
| string
;
username
: string
;
}[]
An array of user objects to be verified.
permissions
Section titled “permissions”{
rank
: string
;
user
: string
;
}[]
An array of permission objects that include user ranks.
string
The rank to be verified against the permissions.
Returns
Section titled “Returns”An array of objects containing the id and name of users with the specified rank.
Throws
Section titled “Throws”If an error occurs during the verification process.