컨텐츠로 건너뛰기

SDK

StudioCMS SDK는 프로그래밍 방식으로 StudioCMS와 상호 작용할 수 있게 해주는 강력한 도구입니다. Astro DB를 사용하여 콘텐츠를 관리하고 제공할 수 있는 다양한 함수와 유틸리티를 제공합니다. 또한 StudioCMS 대시보드의 기반을 제공합니다.

StudioCMS SDK는 Astro 프로젝트에서 가상 모듈로 제공됩니다. 다음 구문을 사용하여 가져올 수 있습니다.

import
const SDK: {
addPageToFolderTree: (tree: FolderNode[], folderId: string, newPage: FolderNode) => FolderNode[];
... 29 more ...;
notificationSettings: {
site: {
get: () => Promise<{
id: string;
emailVerification: boolean;
requireAdminVerification: boolean;
requireEditorVerification: boolean;
oAuthBypassVerification: boolean;
}>;
update: (settings: {
...;
}) => Promise<{
id: string;
emailVerification: boolean;
requireAdminVerification: boolean;
requireEditorVerification: boolean;
oAuthBypassVerification: boolean;
}>;
};
};
}
SDK
from 'studiocms:sdk';
// 또는
import
const SDKCached: {
GET: {
page: {
byId: {
(id: string): Promise<PageDataCacheObject>;
(id: string, metaOnly?: boolean): Promise<MetaOnlyPageDataCacheObject>;
};
bySlug: {
...;
};
};
pages: {
...;
};
folderPages: {
...;
};
siteConfig: () => Promise<SiteConfigCacheObject>;
latestVersion: () => Promise<VersionCacheObject>;
folderTree: () => Promise<FolderTreeCacheObject>;
pageFolderTree: (includeDrafts?: boolean, hideDefaultIndex?: boolean) => Promise<FolderTreeCacheObject>;
folderList: () => Promise<FolderListCacheObject>;
folder: (id: string) => Promise<tsPageFolderSelect | undefined>;
databaseTable: {
users: () => Promise<{
name: string;
password: string | null;
email: string | null;
url: string | null;
username: string;
id: string;
avatar: string | null;
updatedAt: Date | null;
createdAt: Date | null;
emailVerified: boolean;
notifications: string | null;
}[]>;
oAuthAccounts: () => Promise<{
userId: string;
provider: string;
providerUserId: string;
}[]>;
sessionTable: () => Promise<{
id: string;
userId: string;
expiresAt: Date;
}[ ...
SDKCached
from 'studiocms:sdk/cache';

studioCMSSDK 객체는 StudioCMS와 상호 작용할 수 있는 다양한 함수와 유틸리티를 제공합니다. 이 함수들을 사용하여 Astro 프로젝트에서 콘텐츠를 생성, 읽기, 업데이트 및 삭제할 수 있습니다.

studioCMSSDKCached 객체는 캐싱 계층을 덧붙여 StudioCMS SDK와 상호 작용할 수 있는 다양한 함수와 유틸리티를 제공합니다. 이 함수들을 사용하여 Astro 프로젝트에서 콘텐츠를 캐시할 수 있습니다.

SDK.AUTH 객체는 Astro 프로젝트에서 인증을 관리할 수 있는 다양한 함수와 유틸리티를 제공합니다. 이 함수들을 사용하여 사용자를 인증하고, 세션을 관리하는 등의 작업을 수행할 수 있습니다.

import
const SDK: {
addPageToFolderTree: (tree: FolderNode[], folderId: string, newPage: FolderNode) => FolderNode[];
... 29 more ...;
notificationSettings: {
site: {
get: () => Promise<{
id: string;
emailVerification: boolean;
requireAdminVerification: boolean;
requireEditorVerification: boolean;
oAuthBypassVerification: boolean;
}>;
update: (settings: {
...;
}) => Promise<{
id: string;
emailVerification: boolean;
requireAdminVerification: boolean;
requireEditorVerification: boolean;
oAuthBypassVerification: boolean;
}>;
};
};
}
SDK
from 'studiocms:sdk';
const {
const 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>;
}
oAuth
,
const permission: {
currentStatus: (userId: string) => Promise<{
user: string;
rank: string;
} | undefined>;
}
permission
,
const session: {
create: (data: {
userId: string;
expiresAt: Date;
id?: string;
}) => Promise<{
id: string;
userId: string;
expiresAt: Date;
}>;
sessionWithUser: (sessionId: string) => Promise<{
user: {
...;
};
session: {
...;
};
}[]>;
delete: (sessionId: string) => Promise<DeletionResponse>;
update: (sessionId: string, newDate: Date) => Promise<{
...;
}[]>;
}
session
,
const user: {
create: (newUserData: {
name: string;
username: string;
id?: string;
url?: string | null;
email?: string | null;
avatar?: string | null;
password?: string | null;
updatedAt?: Date | null;
createdAt?: Date | null;
emailVerified?: boolean;
notifications?: string | null;
}, rank?: "visitor" | "editor" | "admin" | "owner") => Promise<{
...;
}>;
update: (userId: string, userData: Partial<...>) => Promise<{
...;
}>;
searchUsersForUsernameOrEmail: (username: string, email: string) => Promise<{
usernameSearch: {
...;
}[];
emailSearch: {
...;
}[];
}>;
ghost: {
verifyExists: () => Promise<boolean>;
create: () => Promise<{
name: string;
password: string | null;
email: string | null;
url: string | null;
username: string;
id: string;
avatar: string | null;
updatedAt: Date | null;
createdAt: Date | null;
emailVerified: boolean;
notifications: string | null;
}>;
get: () => Promise<{
name: string;
password: string | null;
email: string | null;
url: string | null;
username: string;
id: string;
avatar: string | null;
updatedAt: Date | null;
createdAt: Date | null;
emailVerified: boolean;
notifications: string | ...
user
,
} =
const SDK: {
addPageToFolderTree: (tree: FolderNode[], folderId: string, newPage: FolderNode) => FolderNode[];
... 29 more ...;
notificationSettings: {
site: {
get: () => Promise<{
id: string;
emailVerification: boolean;
requireAdminVerification: boolean;
requireEditorVerification: boolean;
oAuthBypassVerification: boolean;
}>;
update: (settings: {
...;
}) => Promise<{
id: string;
emailVerification: boolean;
requireAdminVerification: boolean;
requireEditorVerification: boolean;
oAuthBypassVerification: boolean;
}>;
};
};
}
SDK
.
type AUTH: {
verifyEmail: {
get: (id: string) => Promise<{
id: string;
userId: string;
token: string;
expiresAt: Date;
} | null>;
create: (userId: string) => Promise<{
id: string;
userId: string;
token: string;
expiresAt: Date;
}>;
delete: (userId: string) => Promise<void>;
};
oAuth: {
create: (data: {
...;
}) => Promise<{
...;
}>;
delete: (userId: string, provider: string) => Promise<DeletionResponse>;
searchProvidersForId: (providerId: string, userId: string) => Promise<{
...;
} | undefined>;
};
permission: {
currentStatus: (userId: string) => Promise<{
...;
} | undefined>;
};
session: {
create: (data: {
...;
}) => Promise<{
...;
}>;
sessionWithUser: (sessionId: string) => Promise<{
user: {
...;
};
session: {
...;
};
}[]>;
delete: (sessionId: string) => Promise<DeletionResponse>;
update: (sessionId: string, newDate: Date) => Promise<{
...;
}[]>;
};
user: {
create: (newUserData: {
...;
}, rank?: "visitor" | "editor" | "admin" | "owner") => Promise<{
...;
}>;
update: (userId: string, userData: Partial<...>) => Promise<{
...;
}>;
searchUsersForUsernameOrEmail ...
AUTH
;

SDK.INIT 객체는 Astro 프로젝트에서 StudioCMS SDK를 초기화할 수 있는 다양한 함수와 유틸리티를 제공합니다. 이 함수들을 사용하여 SDK를 설정하고 구성하는 등의 작업을 수행할 수 있습니다.

import
const SDK: {
addPageToFolderTree: (tree: FolderNode[], folderId: string, newPage: FolderNode) => FolderNode[];
... 29 more ...;
notificationSettings: {
site: {
get: () => Promise<{
id: string;
emailVerification: boolean;
requireAdminVerification: boolean;
requireEditorVerification: boolean;
oAuthBypassVerification: boolean;
}>;
update: (settings: {
...;
}) => Promise<{
id: string;
emailVerification: boolean;
requireAdminVerification: boolean;
requireEditorVerification: boolean;
oAuthBypassVerification: boolean;
}>;
};
};
}
SDK
from 'studiocms:sdk';
const {
const siteConfig: (config: {
title: string;
description: string;
id?: number;
defaultOgImage?: string | null;
siteIcon?: string | null;
loginPageBackground?: string;
loginPageCustomImage?: string | null;
enableDiffs?: boolean;
diffPerPage?: number;
gridItems?: unknown;
enableMailer?: boolean;
hideDefaultIndex?: boolean;
}) => Promise<{
...;
}>
siteConfig
,
const ghostUser: () => Promise<{
id: string;
name: string;
url: string | null;
email: string | null;
avatar: string | null;
username: string;
password: string | null;
updatedAt: Date | null;
createdAt: Date | null;
emailVerified: boolean;
notifications: string | null;
}>
ghostUser
,
} =
const SDK: {
addPageToFolderTree: (tree: FolderNode[], folderId: string, newPage: FolderNode) => FolderNode[];
... 29 more ...;
notificationSettings: {
site: {
get: () => Promise<{
id: string;
emailVerification: boolean;
requireAdminVerification: boolean;
requireEditorVerification: boolean;
oAuthBypassVerification: boolean;
}>;
update: (settings: {
...;
}) => Promise<{
id: string;
emailVerification: boolean;
requireAdminVerification: boolean;
requireEditorVerification: boolean;
oAuthBypassVerification: boolean;
}>;
};
};
}
SDK
.
type INIT: {
siteConfig: (config: {
title: string;
description: string;
id?: number;
defaultOgImage?: string | null;
siteIcon?: string | null;
loginPageBackground?: string;
loginPageCustomImage?: string | null;
... 4 more ...;
hideDefaultIndex?: boolean;
}) => Promise<{
...;
}>;
ghostUser: () => Promise<{
...;
}>;
}
INIT
;

SDK.GET 객체는 Astro DB에서 콘텐츠를 검색할 수 있는 다양한 함수와 유틸리티를 제공합니다. 이 함수들을 사용하여 ID, 타입 등으로 콘텐츠를 가져올 수 있습니다.

import
const SDK: {
addPageToFolderTree: (tree: FolderNode[], folderId: string, newPage: FolderNode) => FolderNode[];
... 29 more ...;
notificationSettings: {
site: {
get: () => Promise<{
id: string;
emailVerification: boolean;
requireAdminVerification: boolean;
requireEditorVerification: boolean;
oAuthBypassVerification: boolean;
}>;
update: (settings: {
...;
}) => Promise<{
id: string;
emailVerification: boolean;
requireAdminVerification: boolean;
requireEditorVerification: boolean;
oAuthBypassVerification: boolean;
}>;
};
};
}
SDK
from 'studiocms:sdk';
const {
const database: {
users: () => Promise<CombinedUserData[]>;
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[]>;
};
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[]>;
};
config: () => Promise<{
...;
} | undefined>;
folders: () => Promise<{
...;
}[]>;
}
database
,
const databaseEntry: {
users: {
byId: (id: string) => Promise<CombinedUserData | undefined>;
byUsername: (username: string) => Promise<CombinedUserData | undefined>;
byEmail: (email: string) => Promise<CombinedUserData | undefined>;
};
pages: {
byId: {
(id: string, tree?: FolderNode[]): Promise<CombinedPageData | undefined>;
(id: string, tree?: FolderNode[], metaOnly?: boolean): Promise<MetaOnlyPageData | undefined>;
};
bySlug: {
(slug: string, tree?: FolderNode[]): Promise<CombinedPageData | undefined>;
(slug: string, tree?: FolderNode[], metaOnly?: boolean): Promise<MetaOnlyPageData | undefined>;
};
};
folder: (id: string) => Promise<{
...;
} | undefined>;
}
databaseEntry
,
const databaseTable: {
users: () => Promise<{
name: string;
password: string | null;
email: string | null;
url: string | null;
username: string;
id: string;
avatar: string | null;
updatedAt: Date | null;
createdAt: Date | null;
emailVerified: boolean;
notifications: string | null;
}[]>;
... 11 more ...;
emailVerificationTokens: () => Promise<{
id: string;
userId: string;
token: string;
expiresAt: Date;
}[]>;
}
databaseTable
,
const permissionsLists: {
all: () => Promise<CombinedRank[]>;
owners: () => Promise<SingleRank[]>;
admins: () => Promise<SingleRank[]>;
editors: () => Promise<SingleRank[]>;
visitors: () => Promise<SingleRank[]>;
}
permissionsLists
,
const packagePages: {
(packageName: string, tree?: FolderNode[]): Promise<CombinedPageData[]>;
(packageName: string, tree?: FolderNode[], metaOnly?: boolean): Promise<MetaOnlyPageData[]>;
}
packagePages
,
} =
const SDK: {
addPageToFolderTree: (tree: FolderNode[], folderId: string, newPage: FolderNode) => FolderNode[];
... 29 more ...;
notificationSettings: {
site: {
get: () => Promise<{
id: string;
emailVerification: boolean;
requireAdminVerification: boolean;
requireEditorVerification: boolean;
oAuthBypassVerification: boolean;
}>;
update: (settings: {
...;
}) => Promise<{
id: string;
emailVerification: boolean;
requireAdminVerification: boolean;
requireEditorVerification: boolean;
oAuthBypassVerification: boolean;
}>;
};
};
}
SDK
.
type GET: {
database: {
users: () => Promise<CombinedUserData[]>;
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[]>;
};
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[]>;
};
config: () => Promise<{
...;
} | undefined>;
folders: () => Promise<{
...;
}[]>;
};
databaseEntry: {
users: {
byId: (id: string) => Promise<CombinedUserData | undefined>;
byUsername: (username: string) => Promise<CombinedUserData | undefined>;
byEmail: (email: string) => Promise<CombinedUserData | undefined>;
};
pages: {
byId: {
(id: string, tree?: FolderNode[]): Promise<CombinedPageData | undefined>;
(id: string, tree?: FolderNode[], metaOnly?: boolean): Promise<MetaOnlyPageData | undefined>;
};
bySlug: {
(slug: string, tree?: FolderNode[]): Promise<CombinedPageData | undefined>;
( ...
GET
;

SDK.POST 객체는 Astro DB에 콘텐츠를 생성할 수 있는 다양한 함수와 유틸리티를 제공합니다. 이 함수들을 사용하여 타입, ID 등으로 콘텐츠를 생성할 수 있습니다.

import
const SDK: {
addPageToFolderTree: (tree: FolderNode[], folderId: string, newPage: FolderNode) => FolderNode[];
... 29 more ...;
notificationSettings: {
site: {
get: () => Promise<{
id: string;
emailVerification: boolean;
requireAdminVerification: boolean;
requireEditorVerification: boolean;
oAuthBypassVerification: boolean;
}>;
update: (settings: {
...;
}) => Promise<{
id: string;
emailVerification: boolean;
requireAdminVerification: boolean;
requireEditorVerification: boolean;
oAuthBypassVerification: boolean;
}>;
};
};
}
SDK
from 'studiocms:sdk';
const {
const databaseEntry: {
pages: (pageData: {
title: string;
description: string;
slug: string;
id?: string;
package?: string;
showOnNav?: boolean;
publishedAt?: Date;
updatedAt?: Date | null;
contentLang?: string;
heroImage?: string;
... 7 more ...;
draft?: boolean | null;
}, pageContent: CombinedInsertContent) => Promise<addDatabaseEntryInsertPage>;
... 5 more ...;
folder: (folder: {
...;
}) => Promise<{
...;
}>;
}
databaseEntry
,
const databaseEntries: {
tags: (data: {
name: string;
description: string;
slug: string;
meta: unknown;
id?: number;
}[]) => Promise<PageDataTagsInsertResponse[]>;
categories: (data: {
...;
}[]) => Promise<PageDataCategoriesInsertResponse[]>;
permissions: (data: {
...;
}[]) => Promise<{
...;
}[]>;
pages: (pages: MultiPageInsert) => Promise<void>;
}
databaseEntries
,
} =
const SDK: {
addPageToFolderTree: (tree: FolderNode[], folderId: string, newPage: FolderNode) => FolderNode[];
... 29 more ...;
notificationSettings: {
site: {
get: () => Promise<{
id: string;
emailVerification: boolean;
requireAdminVerification: boolean;
requireEditorVerification: boolean;
oAuthBypassVerification: boolean;
}>;
update: (settings: {
...;
}) => Promise<{
id: string;
emailVerification: boolean;
requireAdminVerification: boolean;
requireEditorVerification: boolean;
oAuthBypassVerification: boolean;
}>;
};
};
}
SDK
.
type POST: {
databaseEntry: {
pages: (pageData: {
title: string;
description: string;
slug: string;
id?: string;
package?: string;
showOnNav?: boolean;
publishedAt?: Date;
updatedAt?: Date | null;
contentLang?: string;
... 8 more ...;
draft?: boolean | null;
}, pageContent: CombinedInsertContent) => Promise<addDatabaseEntryInsertPage>;
pageContent: (pageContent: {
...;
}) => Promise<PageContentReturnId[]>;
tags: (tag: {
...;
}) => Promise<PageDataTagsInsertResponse[]>;
categories: (category: {
...;
}) => Promise<{
id: number;
}[]>;
permissions: (userId: string, rank: string) => Promise<{
...;
}[]>;
diffTracking: (diff: {
...;
}) => Promise<{
...;
}[]>;
folder: (folder: {
...;
}) => Promise<{
...;
}>;
};
databaseEntries: {
tags: (data: {
...;
}[]) => Promise<PageDataTagsInsertResponse[]>;
categories: (data: {
...;
}[]) => Promise<PageDataCategoriesInsertResponse[]>;
permissions: (data: {
...;
}[]) => Promise<{
...;
}[]>;
pages: (pages: MultiPageInsert) => Promise<void>;
};
}
POST
;

SDK.UPDATE 객체는 Astro DB에서 콘텐츠를 업데이트할 수 있는 다양한 함수와 유틸리티를 제공합니다. 이 함수들을 사용하여 ID, 타입 등으로 콘텐츠를 업데이트할 수 있습니다.

import
const SDK: {
addPageToFolderTree: (tree: FolderNode[], folderId: string, newPage: FolderNode) => FolderNode[];
... 29 more ...;
notificationSettings: {
site: {
get: () => Promise<{
id: string;
emailVerification: boolean;
requireAdminVerification: boolean;
requireEditorVerification: boolean;
oAuthBypassVerification: boolean;
}>;
update: (settings: {
...;
}) => Promise<{
id: string;
emailVerification: boolean;
requireAdminVerification: boolean;
requireEditorVerification: boolean;
oAuthBypassVerification: boolean;
}>;
};
};
}
SDK
from 'studiocms:sdk';
const {
const page: (data: {
id: string;
package: string;
title: string;
description: string;
showOnNav: boolean;
publishedAt: Date;
updatedAt: Date | null;
slug: string;
contentLang: string;
heroImage: string;
... 7 more ...;
draft: boolean | null;
}) => Promise<{
...;
}>
page
,
const pageContent: (data: {
id: string;
contentLang: string;
contentId: string;
content: string | null;
}) => Promise<{
id: string;
contentLang: string;
contentId: string;
content: string | null;
}>
pageContent
,
const tags: (data: {
id: number;
name: string;
description: string;
slug: string;
meta: unknown;
}) => Promise<{
id: number;
name: string;
description: string;
slug: string;
meta: unknown;
}>
tags
,
const categories: (data: {
id: number;
name: string;
description: string;
slug: string;
meta: unknown;
parent: number | null;
}) => Promise<{
id: number;
name: string;
description: string;
slug: string;
meta: unknown;
parent: number | null;
}>
categories
,
const permissions: (data: {
user: string;
rank: string;
}) => Promise<{
user: string;
rank: string;
}>
permissions
,
const siteConfig: (data: {
id: number;
title: string;
description: string;
defaultOgImage: string | null;
siteIcon: string | null;
loginPageBackground: string;
loginPageCustomImage: string | null;
enableDiffs: boolean;
diffPerPage: number;
gridItems: unknown;
enableMailer: boolean;
hideDefaultIndex: boolean;
}) => Promise<{
...;
}>
siteConfig
,
const folder: (data: {
id: string;
name: string;
parent: string | null;
}) => Promise<{
id: string;
name: string;
parent: string | null;
}>
folder
,
} =
const SDK: {
addPageToFolderTree: (tree: FolderNode[], folderId: string, newPage: FolderNode) => FolderNode[];
... 29 more ...;
notificationSettings: {
site: {
get: () => Promise<{
id: string;
emailVerification: boolean;
requireAdminVerification: boolean;
requireEditorVerification: boolean;
oAuthBypassVerification: boolean;
}>;
update: (settings: {
...;
}) => Promise<{
id: string;
emailVerification: boolean;
requireAdminVerification: boolean;
requireEditorVerification: boolean;
oAuthBypassVerification: boolean;
}>;
};
};
}
SDK
.
type UPDATE: {
page: (data: {
id: string;
package: string;
title: string;
description: string;
showOnNav: boolean;
publishedAt: Date;
updatedAt: Date | null;
slug: string;
contentLang: string;
heroImage: string;
... 7 more ...;
draft: boolean | null;
}) => Promise<{
...;
}>;
... 5 more ...;
folder: (data: {
...;
}) => Promise<{
...;
}>;
}
UPDATE
;

SDK.DELETE 객체는 Astro DB에서 콘텐츠를 삭제할 수 있는 다양한 함수와 유틸리티를 제공합니다. 이 함수들을 사용하여 ID, 타입 등으로 콘텐츠를 삭제할 수 있습니다.

import
const SDK: {
addPageToFolderTree: (tree: FolderNode[], folderId: string, newPage: FolderNode) => FolderNode[];
... 29 more ...;
notificationSettings: {
site: {
get: () => Promise<{
id: string;
emailVerification: boolean;
requireAdminVerification: boolean;
requireEditorVerification: boolean;
oAuthBypassVerification: boolean;
}>;
update: (settings: {
...;
}) => Promise<{
id: string;
emailVerification: boolean;
requireAdminVerification: boolean;
requireEditorVerification: boolean;
oAuthBypassVerification: boolean;
}>;
};
};
}
SDK
from 'studiocms:sdk';
const {
const page: (id: string) => Promise<DeletionResponse>
page
,
const pageContent: (id: string) => Promise<DeletionResponse>
pageContent
,
const pageContentLang: (id: string, lang: string) => Promise<DeletionResponse>
pageContentLang
,
const tags: (id: number) => Promise<DeletionResponse>
tags
,
const categories: (id: number) => Promise<DeletionResponse>
categories
,
const permissions: (userId: string) => Promise<DeletionResponse>
permissions
,
const diffTracking: (id: string) => Promise<DeletionResponse>
diffTracking
,
const folder: (id: string) => Promise<DeletionResponse>
folder
,
const user: (id: string) => Promise<DeletionResponse>
user
,
} =
const SDK: {
addPageToFolderTree: (tree: FolderNode[], folderId: string, newPage: FolderNode) => FolderNode[];
... 29 more ...;
notificationSettings: {
site: {
get: () => Promise<{
id: string;
emailVerification: boolean;
requireAdminVerification: boolean;
requireEditorVerification: boolean;
oAuthBypassVerification: boolean;
}>;
update: (settings: {
...;
}) => Promise<{
id: string;
emailVerification: boolean;
requireAdminVerification: boolean;
requireEditorVerification: boolean;
oAuthBypassVerification: boolean;
}>;
};
};
}
SDK
.
type DELETE: {
page: (id: string) => Promise<DeletionResponse>;
pageContent: (id: string) => Promise<DeletionResponse>;
... 6 more ...;
user: (id: string) => Promise<DeletionResponse>;
}
DELETE
;

SDK.db 객체는 Astro DB와 직접 상호 작용할 수 있는 다양한 함수와 유틸리티를 제공합니다. 이 함수들을 사용하여 데이터베이스를 쿼리하거나, 사용자 정의 쿼리를 실행하는 등의 작업을 수행할 수 있습니다.

import
const SDK: {
addPageToFolderTree: (tree: FolderNode[], folderId: string, newPage: FolderNode) => FolderNode[];
... 29 more ...;
notificationSettings: {
site: {
get: () => Promise<{
id: string;
emailVerification: boolean;
requireAdminVerification: boolean;
requireEditorVerification: boolean;
oAuthBypassVerification: boolean;
}>;
update: (settings: {
...;
}) => Promise<{
id: string;
emailVerification: boolean;
requireAdminVerification: boolean;
requireEditorVerification: boolean;
oAuthBypassVerification: boolean;
}>;
};
};
}
SDK
from 'studiocms:sdk';
const {
const db: Database
db
} =
const SDK: {
addPageToFolderTree: (tree: FolderNode[], folderId: string, newPage: FolderNode) => FolderNode[];
... 29 more ...;
notificationSettings: {
site: {
get: () => Promise<{
id: string;
emailVerification: boolean;
requireAdminVerification: boolean;
requireEditorVerification: boolean;
oAuthBypassVerification: boolean;
}>;
update: (settings: {
...;
}) => Promise<{
id: string;
emailVerification: boolean;
requireAdminVerification: boolean;
requireEditorVerification: boolean;
oAuthBypassVerification: boolean;
}>;
};
};
}
SDK
;
db 사용 방법에 대한 더 자세한 내용은 Astro DB 가이드^를 확인하세요.

SDK.REST_API 객체는 REST API가 StudioCMS 및 Astro DB와 상호 작용하는 데 사용하는 다양한 함수와 유틸리티를 제공합니다.

import
const SDK: {
addPageToFolderTree: (tree: FolderNode[], folderId: string, newPage: FolderNode) => FolderNode[];
... 29 more ...;
notificationSettings: {
site: {
get: () => Promise<{
id: string;
emailVerification: boolean;
requireAdminVerification: boolean;
requireEditorVerification: boolean;
oAuthBypassVerification: boolean;
}>;
update: (settings: {
...;
}) => Promise<{
id: string;
emailVerification: boolean;
requireAdminVerification: boolean;
requireEditorVerification: boolean;
oAuthBypassVerification: boolean;
}>;
};
};
}
SDK
from 'studiocms:sdk';
const {
tokens: {
get: (userId: string) => Promise<{
key: string;
description: string | null;
id: string;
userId: string;
creationDate: Date;
}[]>;
new: (userId: string, description: string) => Promise<{
key: string;
description: string | null;
id: string;
userId: string;
creationDate: Date;
}>;
delete: (userId: string, tokenId: string) => Promise<void>;
verify: (key: string) => Promise<false | {
userId: string;
key: string;
rank: string;
}>;
}
tokens
: {
get: (userId: string) => Promise<{
key: string;
description: string | null;
id: string;
userId: string;
creationDate: Date;
}[]>
get
:
const getToken: (userId: string) => Promise<{
key: string;
description: string | null;
id: string;
userId: string;
creationDate: Date;
}[]>
getToken
,
new: (userId: string, description: string) => Promise<{
key: string;
description: string | null;
id: string;
userId: string;
creationDate: Date;
}>
new
:
const newToken: (userId: string, description: string) => Promise<{
key: string;
description: string | null;
id: string;
userId: string;
creationDate: Date;
}>
newToken
,
delete: (userId: string, tokenId: string) => Promise<void>
delete
:
const deleteToken: (userId: string, tokenId: string) => Promise<void>
deleteToken
,
verify: (key: string) => Promise<false | {
userId: string;
key: string;
rank: string;
}>
verify
:
const verifyToken: (key: string) => Promise<false | {
userId: string;
key: string;
rank: string;
}>
verifyToken
,
},
} =
const SDK: {
addPageToFolderTree: (tree: FolderNode[], folderId: string, newPage: FolderNode) => FolderNode[];
... 29 more ...;
notificationSettings: {
site: {
get: () => Promise<{
id: string;
emailVerification: boolean;
requireAdminVerification: boolean;
requireEditorVerification: boolean;
oAuthBypassVerification: boolean;
}>;
update: (settings: {
...;
}) => Promise<{
id: string;
emailVerification: boolean;
requireAdminVerification: boolean;
requireEditorVerification: boolean;
oAuthBypassVerification: boolean;
}>;
};
};
}
SDK
.
type REST_API: {
tokens: {
get: (userId: string) => Promise<{
key: string;
description: string | null;
id: string;
userId: string;
creationDate: Date;
}[]>;
new: (userId: string, description: string) => Promise<{
key: string;
description: string | null;
id: string;
userId: string;
creationDate: Date;
}>;
delete: (userId: string, tokenId: string) => Promise<void>;
verify: (key: string) => Promise<false | {
userId: string;
key: string;
rank: string;
}>;
};
}
REST_API
;

SDK.diffTracking 객체는 Astro DB의 변경 사항을 추적할 수 있는 다양한 함수와 유틸리티를 제공합니다. 이 함수들을 사용하여 콘텐츠 변경 사항, 사용자 변경 사항 등을 추적할 수 있습니다.

import
const SDK: {
addPageToFolderTree: (tree: FolderNode[], folderId: string, newPage: FolderNode) => FolderNode[];
... 29 more ...;
notificationSettings: {
site: {
get: () => Promise<{
id: string;
emailVerification: boolean;
requireAdminVerification: boolean;
requireEditorVerification: boolean;
oAuthBypassVerification: boolean;
}>;
update: (settings: {
...;
}) => Promise<{
id: string;
emailVerification: boolean;
requireAdminVerification: boolean;
requireEditorVerification: boolean;
oAuthBypassVerification: boolean;
}>;
};
};
}
SDK
from 'studiocms:sdk';
const {
const insert: (userId: string, pageId: string, data: {
content: {
start: string;
end: string;
};
metaData: {
start: Partial<{
id: string;
package: string;
title: string;
description: string;
showOnNav: boolean;
publishedAt: Date;
updatedAt: Date | null;
slug: string;
... 9 more ...;
draft: boolean | null;
}>;
end: Partial<{
...;
}>;
};
}, diffLength: number) => Promise<diffReturn>
insert
,
const clear: (pageId: string) => Promise<void>
clear
,
const 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<diffReturn | undefined>;
}
get
,
const revertToDiff: (id: string, type: "content" | "data" | "both") => Promise<diffReturn>
revertToDiff
} =
const SDK: {
addPageToFolderTree: (tree: FolderNode[], folderId: string, newPage: FolderNode) => FolderNode[];
... 29 more ...;
notificationSettings: {
site: {
get: () => Promise<{
id: string;
emailVerification: boolean;
requireAdminVerification: boolean;
requireEditorVerification: boolean;
oAuthBypassVerification: boolean;
}>;
update: (settings: {
...;
}) => Promise<{
id: string;
emailVerification: boolean;
requireAdminVerification: boolean;
requireEditorVerification: boolean;
oAuthBypassVerification: boolean;
}>;
};
};
}
SDK
.
diffTracking: {
insert: (userId: string, pageId: string, data: {
content: {
start: string;
end: string;
};
metaData: {
start: Partial<{
id: string;
package: string;
title: string;
description: string;
showOnNav: boolean;
publishedAt: Date;
updatedAt: Date | null;
slug: string;
contentLang: string;
heroImage: string;
... 7 more ...;
draft: boolean | null;
}>;
end: Partial<{
...;
}>;
};
}, diffLength: number) => Promise<diffReturn>;
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<diffReturn | undefined>;
};
revertToDiff: (id: string, type: "content" | "data" | "both") => Promise<diffReturn>;
utils: {
getMetaDataDifferences<T extends Record<string, any>>(obj1: T, obj2: T): {
label: string;
previous: any;
current: any;
}[];
getDiffHTML(diff: string | null, options?: Diff2HtmlConfig): string;
};
}
diffTracking
;

StudioCMS SDK는 SDK와 상호 작용하는 데 사용할 수 있는 다양한 유틸리티 함수도 제공합니다. 이러한 함수는 다음과 같습니다.

import
const SDK: {
addPageToFolderTree: (tree: FolderNode[], folderId: string, newPage: FolderNode) => FolderNode[];
... 29 more ...;
notificationSettings: {
site: {
get: () => Promise<{
id: string;
emailVerification: boolean;
requireAdminVerification: boolean;
requireEditorVerification: boolean;
oAuthBypassVerification: boolean;
}>;
update: (settings: {
...;
}) => Promise<{
id: string;
emailVerification: boolean;
requireAdminVerification: boolean;
requireEditorVerification: boolean;
oAuthBypassVerification: boolean;
}>;
};
};
}
SDK
from 'studiocms:sdk';
const {
const addPageToFolderTree: (tree: FolderNode[], folderId: string, newPage: FolderNode) => FolderNode[]
addPageToFolderTree
,
const findNodeById: (tree: FolderNode[], id: string) => FolderNode | null
findNodeById
,
const findNodeByPath: (tree: FolderNode[], path: string[]) => FolderNode | null
findNodeByPath
,
const findNodesAlongPath: (tree: FolderNode[], path: string[]) => FolderNode[]
findNodesAlongPath
,
const getFullPath: (tree: FolderNode[], path: string[]) => string[]
getFullPath
,
const parseIdNumberArray: (ids: unknown) => number[]
parseIdNumberArray
,
const parseIdStringArray: (ids: unknown) => string[]
parseIdStringArray
,
const generateRandomIDNumber: (length: number) => number
generateRandomIDNumber
,
const generateToken: (userId: string, noExpire?: boolean) => string
generateToken
,
const testToken: (token: string) => JwtVerificationResult
testToken
,
const combineRanks: (rank: string, users: SingleRank[]) => CombinedRank[]
combineRanks
,
const verifyRank: (users: tsUsersSelect[], permissions: tsPermissionsSelect[], rank: string) => SingleRank[]
verifyRank
,
const buildFolderTree: () => Promise<FolderNode[]>
buildFolderTree
,
const getAvailableFolders: () => Promise<FolderListItem[]>
getAvailableFolders
,
const clearUserReferences: (userId: string) => Promise<boolean>
clearUserReferences
,
const collectCategories: (categoryIds: number[]) => Promise<CombinedPageData["categories"]>
collectCategories
,
const collectTags: (tagIds: number[]) => Promise<CombinedPageData["tags"]>
collectTags
,
const collectPageData: {
(page: {
id: string;
updatedAt: Date | null;
categories: unknown;
package: string;
title: string;
description: string;
showOnNav: boolean;
publishedAt: Date;
slug: string;
contentLang: string;
... 7 more ...;
draft: boolean | null;
}, tree: FolderNode[]): Promise<CombinedPageData>;
(page: {
...;
}, tree: FolderNode[], metaOnly: boolean): Promise<MetaOnlyPageData>;
}
collectPageData
,
const collectUserData: (user: {
id: string;
name: string;
url: string | null;
email: string | null;
avatar: string | null;
username: string;
password: string | null;
updatedAt: Date | null;
createdAt: Date | null;
emailVerified: boolean;
notifications: string | null;
}) => Promise<CombinedUserData>
collectUserData
,
const generateRandomPassword: (length: number) => string
generateRandomPassword
,
} =
const SDK: {
addPageToFolderTree: (tree: FolderNode[], folderId: string, newPage: FolderNode) => FolderNode[];
... 29 more ...;
notificationSettings: {
site: {
get: () => Promise<{
id: string;
emailVerification: boolean;
requireAdminVerification: boolean;
requireEditorVerification: boolean;
oAuthBypassVerification: boolean;
}>;
update: (settings: {
...;
}) => Promise<{
id: string;
emailVerification: boolean;
requireAdminVerification: boolean;
requireEditorVerification: boolean;
oAuthBypassVerification: boolean;
}>;
};
};
}
SDK
;

StudioCMS SDK는 표준 SDK 위에 캐싱 계층을 둔, SDK 기능의 제한된 하위 집합을 포함하는 캐시된 버전의 SDK도 제공합니다. 다음 구문을 사용하여 캐시된 SDK를 가져올 수 있습니다.

import
const SDKCached: {
GET: {
page: {
byId: {
(id: string): Promise<PageDataCacheObject>;
(id: string, metaOnly?: boolean): Promise<MetaOnlyPageDataCacheObject>;
};
bySlug: {
...;
};
};
pages: {
...;
};
folderPages: {
...;
};
siteConfig: () => Promise<SiteConfigCacheObject>;
latestVersion: () => Promise<VersionCacheObject>;
folderTree: () => Promise<FolderTreeCacheObject>;
pageFolderTree: (includeDrafts?: boolean, hideDefaultIndex?: boolean) => Promise<FolderTreeCacheObject>;
folderList: () => Promise<FolderListCacheObject>;
folder: (id: string) => Promise<tsPageFolderSelect | undefined>;
databaseTable: {
users: () => Promise<{
name: string;
password: string | null;
email: string | null;
url: string | null;
username: string;
id: string;
avatar: string | null;
updatedAt: Date | null;
createdAt: Date | null;
emailVerified: boolean;
notifications: string | null;
}[]>;
oAuthAccounts: () => Promise<{
userId: string;
provider: string;
providerUserId: string;
}[]>;
sessionTable: () => Promise<{
id: string;
userId: string;
expiresAt: Date;
}[ ...
SDKCached
from 'studiocms:sdk/cache';

SDKCached.GET 객체는 캐싱 계층을 덧붙여 Astro DB에서 콘텐츠를 검색할 수 있는 다양한 함수와 유틸리티를 제공합니다. 이 함수들을 사용하여 ID, 타입 등으로 콘텐츠를 가져올 수 있습니다.

import
const SDKCached: {
GET: {
page: {
byId: {
(id: string): Promise<PageDataCacheObject>;
(id: string, metaOnly?: boolean): Promise<MetaOnlyPageDataCacheObject>;
};
bySlug: {
...;
};
};
pages: {
...;
};
folderPages: {
...;
};
siteConfig: () => Promise<SiteConfigCacheObject>;
latestVersion: () => Promise<VersionCacheObject>;
folderTree: () => Promise<FolderTreeCacheObject>;
pageFolderTree: (includeDrafts?: boolean, hideDefaultIndex?: boolean) => Promise<FolderTreeCacheObject>;
folderList: () => Promise<FolderListCacheObject>;
folder: (id: string) => Promise<tsPageFolderSelect | undefined>;
databaseTable: {
users: () => Promise<{
name: string;
password: string | null;
email: string | null;
url: string | null;
username: string;
id: string;
avatar: string | null;
updatedAt: Date | null;
createdAt: Date | null;
emailVerified: boolean;
notifications: string | null;
}[]>;
oAuthAccounts: () => Promise<{
userId: string;
provider: string;
providerUserId: string;
}[]>;
sessionTable: () => Promise<{
id: string;
userId: string;
expiresAt: Date;
}[ ...
SDKCached
from 'studiocms:sdk/cache';
const {
const page: {
byId: {
(id: string): Promise<PageDataCacheObject>;
(id: string, metaOnly?: boolean): Promise<MetaOnlyPageDataCacheObject>;
};
bySlug: {
...;
};
}
page
,
const pages: {
(includeDrafts?: boolean, hideDefaultIndex?: boolean, metaOnly?: false, paginate?: PaginateInput): Promise<PageDataCacheObject[]>;
(includeDrafts?: boolean, hideDefaultIndex?: boolean, metaOnly?: true, paginate?: PaginateInput): Promise<MetaOnlyPageDataCacheObject[]>;
}
pages
,
const siteConfig: () => Promise<SiteConfigCacheObject>
siteConfig
,
const latestVersion: () => Promise<VersionCacheObject>
latestVersion
,
const folderTree: () => Promise<FolderTreeCacheObject>
folderTree
,
const pageFolderTree: (includeDrafts?: boolean, hideDefaultIndex?: boolean) => Promise<FolderTreeCacheObject>
pageFolderTree
,
const folderList: () => Promise<FolderListCacheObject>
folderList
,
const folder: (id: string) => Promise<tsPageFolderSelect | undefined>
folder
,
} =
const SDKCached: {
GET: {
page: {
byId: {
(id: string): Promise<PageDataCacheObject>;
(id: string, metaOnly?: boolean): Promise<MetaOnlyPageDataCacheObject>;
};
bySlug: {
...;
};
};
pages: {
...;
};
folderPages: {
...;
};
siteConfig: () => Promise<SiteConfigCacheObject>;
latestVersion: () => Promise<VersionCacheObject>;
folderTree: () => Promise<FolderTreeCacheObject>;
pageFolderTree: (includeDrafts?: boolean, hideDefaultIndex?: boolean) => Promise<FolderTreeCacheObject>;
folderList: () => Promise<FolderListCacheObject>;
folder: (id: string) => Promise<tsPageFolderSelect | undefined>;
databaseTable: {
users: () => Promise<{
name: string;
password: string | null;
email: string | null;
url: string | null;
username: string;
id: string;
avatar: string | null;
updatedAt: Date | null;
createdAt: Date | null;
emailVerified: boolean;
notifications: string | null;
}[]>;
oAuthAccounts: () => Promise<{
userId: string;
provider: string;
providerUserId: string;
}[]>;
sessionTable: () => Promise<{
id: string;
userId: string;
expiresAt: Date;
}[ ...
SDKCached
.
type GET: {
page: {
byId: {
(id: string): Promise<PageDataCacheObject>;
(id: string, metaOnly?: boolean): Promise<MetaOnlyPageDataCacheObject>;
};
bySlug: {
...;
};
};
... 8 more ...;
databaseTable: {
users: () => Promise<{
name: string;
password: string | null;
email: string | null;
url: string | null;
username: string;
id: string;
avatar: string | null;
updatedAt: Date | null;
createdAt: Date | null;
emailVerified: boolean;
notifications: string | null;
}[]>;
oAuthAccounts: () => Promise<{
userId: string;
provider: string;
providerUserId: string;
}[]>;
sessionTable: () => Promise<{
id: string;
userId: string;
expiresAt: Date;
}[]>;
permissions: () => Promise<{
user: string;
rank: string;
}[]>;
pageData: () => Promise<{
title: string;
description: string;
slug: string;
id: string;
updatedAt: Date | null;
package: string;
showOnNav: boolean;
publishedAt: Date;
contentLang: string;
heroImage: string;
categories: unknown;
tags: unknown;
authorId: string | null;
contributorIds: unknown;
showAuthor: boolean | null;
showContributors ...
GET
;

SDKCached.CLEAR 객체는 캐시된 SDK의 캐시를 지울 수 있는 다양한 함수와 유틸리티를 제공합니다. 이 함수들을 사용하여 특정 콘텐츠 타입의 캐시를 지우거나, 특정 콘텐츠 ID의 캐시를 지우는 등의 작업을 수행할 수 있습니다.

import
const SDKCached: {
GET: {
page: {
byId: {
(id: string): Promise<PageDataCacheObject>;
(id: string, metaOnly?: boolean): Promise<MetaOnlyPageDataCacheObject>;
};
bySlug: {
...;
};
};
pages: {
...;
};
folderPages: {
...;
};
siteConfig: () => Promise<SiteConfigCacheObject>;
latestVersion: () => Promise<VersionCacheObject>;
folderTree: () => Promise<FolderTreeCacheObject>;
pageFolderTree: (includeDrafts?: boolean, hideDefaultIndex?: boolean) => Promise<FolderTreeCacheObject>;
folderList: () => Promise<FolderListCacheObject>;
folder: (id: string) => Promise<tsPageFolderSelect | undefined>;
databaseTable: {
users: () => Promise<{
name: string;
password: string | null;
email: string | null;
url: string | null;
username: string;
id: string;
avatar: string | null;
updatedAt: Date | null;
createdAt: Date | null;
emailVerified: boolean;
notifications: string | null;
}[]>;
oAuthAccounts: () => Promise<{
userId: string;
provider: string;
providerUserId: string;
}[]>;
sessionTable: () => Promise<{
id: string;
userId: string;
expiresAt: Date;
}[ ...
SDKCached
from 'studiocms:sdk/cache';
const {
const page: {
byId: (id: string) => void;
bySlug: (slug: string) => void;
}
page
,
const pages: () => void
pages
,
const latestVersion: () => void
latestVersion
,
const folderTree: () => void
folderTree
,
const folderList: () => void
folderList
,
} =
const SDKCached: {
GET: {
page: {
byId: {
(id: string): Promise<PageDataCacheObject>;
(id: string, metaOnly?: boolean): Promise<MetaOnlyPageDataCacheObject>;
};
bySlug: {
...;
};
};
pages: {
...;
};
folderPages: {
...;
};
siteConfig: () => Promise<SiteConfigCacheObject>;
latestVersion: () => Promise<VersionCacheObject>;
folderTree: () => Promise<FolderTreeCacheObject>;
pageFolderTree: (includeDrafts?: boolean, hideDefaultIndex?: boolean) => Promise<FolderTreeCacheObject>;
folderList: () => Promise<FolderListCacheObject>;
folder: (id: string) => Promise<tsPageFolderSelect | undefined>;
databaseTable: {
users: () => Promise<{
name: string;
password: string | null;
email: string | null;
url: string | null;
username: string;
id: string;
avatar: string | null;
updatedAt: Date | null;
createdAt: Date | null;
emailVerified: boolean;
notifications: string | null;
}[]>;
oAuthAccounts: () => Promise<{
userId: string;
provider: string;
providerUserId: string;
}[]>;
sessionTable: () => Promise<{
id: string;
userId: string;
expiresAt: Date;
}[ ...
SDKCached
.
type CLEAR: {
page: {
byId: (id: string) => void;
bySlug: (slug: string) => void;
};
pages: () => void;
latestVersion: () => void;
folderTree: () => void;
folderList: () => void;
}
CLEAR
;

SDKCached.UPDATE 객체는 캐싱 계층을 덧붙여 Astro DB에서 콘텐츠를 업데이트할 수 있는 다양한 함수와 유틸리티를 제공합니다. 이 함수들을 사용하여 ID, 타입 등으로 콘텐츠를 업데이트할 수 있습니다.

import
const SDKCached: {
GET: {
page: {
byId: {
(id: string): Promise<PageDataCacheObject>;
(id: string, metaOnly?: boolean): Promise<MetaOnlyPageDataCacheObject>;
};
bySlug: {
...;
};
};
pages: {
...;
};
folderPages: {
...;
};
siteConfig: () => Promise<SiteConfigCacheObject>;
latestVersion: () => Promise<VersionCacheObject>;
folderTree: () => Promise<FolderTreeCacheObject>;
pageFolderTree: (includeDrafts?: boolean, hideDefaultIndex?: boolean) => Promise<FolderTreeCacheObject>;
folderList: () => Promise<FolderListCacheObject>;
folder: (id: string) => Promise<tsPageFolderSelect | undefined>;
databaseTable: {
users: () => Promise<{
name: string;
password: string | null;
email: string | null;
url: string | null;
username: string;
id: string;
avatar: string | null;
updatedAt: Date | null;
createdAt: Date | null;
emailVerified: boolean;
notifications: string | null;
}[]>;
oAuthAccounts: () => Promise<{
userId: string;
provider: string;
providerUserId: string;
}[]>;
sessionTable: () => Promise<{
id: string;
userId: string;
expiresAt: Date;
}[ ...
SDKCached
from 'studiocms:sdk/cache';
const {
const page: {
byId: (id: string, data: {
pageData: tsPageDataSelect;
pageContent: tsPageContentSelect;
}) => Promise<PageDataCacheObject>;
bySlug: (slug: string, data: {
pageData: tsPageDataSelect;
pageContent: tsPageContentSelect;
}) => Promise<PageDataCacheObject>;
}
page
,
const siteConfig: (data: SiteConfig) => Promise<SiteConfigCacheObject>
siteConfig
,
const latestVersion: () => Promise<VersionCacheObject>
latestVersion
,
const folderTree: () => Promise<FolderTreeCacheObject>
folderTree
,
const folderList: () => Promise<FolderListCacheObject>
folderList
,
const folder: (data: tsPageFolderSelect) => Promise<{
name: string;
id: string;
parent: string | null;
}>
folder
,
} =
const SDKCached: {
GET: {
page: {
byId: {
(id: string): Promise<PageDataCacheObject>;
(id: string, metaOnly?: boolean): Promise<MetaOnlyPageDataCacheObject>;
};
bySlug: {
...;
};
};
pages: {
...;
};
folderPages: {
...;
};
siteConfig: () => Promise<SiteConfigCacheObject>;
latestVersion: () => Promise<VersionCacheObject>;
folderTree: () => Promise<FolderTreeCacheObject>;
pageFolderTree: (includeDrafts?: boolean, hideDefaultIndex?: boolean) => Promise<FolderTreeCacheObject>;
folderList: () => Promise<FolderListCacheObject>;
folder: (id: string) => Promise<tsPageFolderSelect | undefined>;
databaseTable: {
users: () => Promise<{
name: string;
password: string | null;
email: string | null;
url: string | null;
username: string;
id: string;
avatar: string | null;
updatedAt: Date | null;
createdAt: Date | null;
emailVerified: boolean;
notifications: string | null;
}[]>;
oAuthAccounts: () => Promise<{
userId: string;
provider: string;
providerUserId: string;
}[]>;
sessionTable: () => Promise<{
id: string;
userId: string;
expiresAt: Date;
}[ ...
SDKCached
.
type UPDATE: {
page: {
byId: (id: string, data: {
pageData: tsPageDataSelect;
pageContent: tsPageContentSelect;
}) => Promise<PageDataCacheObject>;
bySlug: (slug: string, data: {
pageData: tsPageDataSelect;
pageContent: tsPageContentSelect;
}) => Promise<PageDataCacheObject>;
};
... 4 more ...;
folder: (data: tsPageFolderSelect) => Promise<{
name: string;
id: string;
parent: string | null;
}>;
}
UPDATE
;

표준 SDK의 db 객체로 전달됩니다.

자세한 정보는 SDK.db를 확인하세요.