콘텐츠로 이동

SDK

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

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

import
module "studiocms:sdk"
SDK
from 'studiocms:sdk';
// 또는
import
import SDKCached
SDKCached
from 'studiocms:sdk/cache';
Error ts(2307) ― Cannot find module 'studiocms:sdk/cache' or its corresponding type declarations.

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

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

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

import
module "studiocms:sdk"
SDK
from 'studiocms:sdk';
const {
const oAuth: any
oAuth
,
const permission: any
permission
,
const session: any
session
,
const user: any
user
,
} =
module "studiocms:sdk"
SDK
.AUTH;
Error ts(2339) ― Property 'AUTH' does not exist on type 'typeof import("studiocms:sdk")'.

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

import
module "studiocms:sdk"
SDK
from 'studiocms:sdk';
const {
const siteConfig: any
siteConfig
,
const ghostUser: any
ghostUser
,
} =
module "studiocms:sdk"
SDK
.INIT;
Error ts(2339) ― Property 'INIT' does not exist on type 'typeof import("studiocms:sdk")'.

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

import
module "studiocms:sdk"
SDK
from 'studiocms:sdk';
const {
const database: any
database
,
const databaseEntry: any
databaseEntry
,
const databaseTable: any
databaseTable
,
const permissionsLists: any
permissionsLists
,
const packagePages: any
packagePages
,
} =
module "studiocms:sdk"
SDK
.GET;
Error ts(2339) ― Property 'GET' does not exist on type 'typeof import("studiocms:sdk")'.

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

import
module "studiocms:sdk"
SDK
from 'studiocms:sdk';
const {
const databaseEntry: any
databaseEntry
,
const databaseEntries: any
databaseEntries
,
} =
module "studiocms:sdk"
SDK
.POST;
Error ts(2339) ― Property 'POST' does not exist on type 'typeof import("studiocms:sdk")'.

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

import
module "studiocms:sdk"
SDK
from 'studiocms:sdk';
const {
const page: any
page
,
const pageContent: any
pageContent
,
const tags: any
tags
,
const categories: any
categories
,
const permissions: any
permissions
,
const siteConfig: any
siteConfig
,
const folder: any
folder
,
} =
module "studiocms:sdk"
SDK
.UPDATE;
Error ts(2339) ― Property 'UPDATE' does not exist on type 'typeof import("studiocms:sdk")'.

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

import
module "studiocms:sdk"
SDK
from 'studiocms:sdk';
const {
const page: any
page
,
const pageContent: any
pageContent
,
const pageContentLang: any
pageContentLang
,
const tags: any
tags
,
const categories: any
categories
,
const permissions: any
permissions
,
const diffTracking: any
diffTracking
,
const folder: any
folder
,
const user: any
user
,
} =
module "studiocms:sdk"
SDK
.DELETE;
Error ts(2339) ― Property 'DELETE' does not exist on type 'typeof import("studiocms:sdk")'.

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

import
module "studiocms:sdk"
SDK
from 'studiocms:sdk';
const { db } =
module "studiocms:sdk"
SDK
;
Error ts(2339) ― Property 'db' does not exist on type 'typeof import("studiocms:sdk")'.
db 사용 방법에 대한 더 자세한 내용은 Astro DB 가이드^를 확인하세요.

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

import
module "studiocms:sdk"
SDK
from 'studiocms:sdk';
const {
any
tokens
: {
any
get
:
const getToken: any
getToken
,
any
new
:
const newToken: any
newToken
,
any
delete
:
const deleteToken: any
deleteToken
,
any
verify
:
const verifyToken: any
verifyToken
,
},
} =
module "studiocms:sdk"
SDK
.REST_API;
Error ts(2339) ― Property 'REST_API' does not exist on type 'typeof import("studiocms:sdk")'.

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

import
module "studiocms:sdk"
SDK
from 'studiocms:sdk';
const {
const insert: any
insert
,
const clear: any
clear
,
const get: any
get
,
const revertToDiff: any
revertToDiff
} =
module "studiocms:sdk"
SDK
.diffTracking;
Error ts(2339) ― Property 'diffTracking' does not exist on type 'typeof import("studiocms:sdk")'.

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

import
module "studiocms:sdk"
SDK
from 'studiocms:sdk';
const {
addPageToFolderTree,
Error ts(2339) ― Property 'addPageToFolderTree' does not exist on type 'typeof import("studiocms:sdk")'.
findNodeById,
Error ts(2339) ― Property 'findNodeById' does not exist on type 'typeof import("studiocms:sdk")'.
findNodeByPath,
Error ts(2339) ― Property 'findNodeByPath' does not exist on type 'typeof import("studiocms:sdk")'.
findNodesAlongPath,
Error ts(2339) ― Property 'findNodesAlongPath' does not exist on type 'typeof import("studiocms:sdk")'.
getFullPath,
Error ts(2339) ― Property 'getFullPath' does not exist on type 'typeof import("studiocms:sdk")'.
parseIdNumberArray,
Error ts(2339) ― Property 'parseIdNumberArray' does not exist on type 'typeof import("studiocms:sdk")'.
parseIdStringArray,
Error ts(2339) ― Property 'parseIdStringArray' does not exist on type 'typeof import("studiocms:sdk")'.
generateRandomIDNumber,
Error ts(2339) ― Property 'generateRandomIDNumber' does not exist on type 'typeof import("studiocms:sdk")'.
generateToken,
Error ts(2339) ― Property 'generateToken' does not exist on type 'typeof import("studiocms:sdk")'.
testToken,
Error ts(2339) ― Property 'testToken' does not exist on type 'typeof import("studiocms:sdk")'.
combineRanks,
Error ts(2339) ― Property 'combineRanks' does not exist on type 'typeof import("studiocms:sdk")'.
verifyRank,
Error ts(2339) ― Property 'verifyRank' does not exist on type 'typeof import("studiocms:sdk")'.
buildFolderTree,
Error ts(2339) ― Property 'buildFolderTree' does not exist on type 'typeof import("studiocms:sdk")'.
getAvailableFolders,
Error ts(2339) ― Property 'getAvailableFolders' does not exist on type 'typeof import("studiocms:sdk")'.
clearUserReferences,
Error ts(2339) ― Property 'clearUserReferences' does not exist on type 'typeof import("studiocms:sdk")'.
collectCategories,
Error ts(2339) ― Property 'collectCategories' does not exist on type 'typeof import("studiocms:sdk")'.
collectTags,
Error ts(2339) ― Property 'collectTags' does not exist on type 'typeof import("studiocms:sdk")'.
collectPageData,
Error ts(2339) ― Property 'collectPageData' does not exist on type 'typeof import("studiocms:sdk")'.
collectUserData,
Error ts(2339) ― Property 'collectUserData' does not exist on type 'typeof import("studiocms:sdk")'.
generateRandomPassword,
Error ts(2339) ― Property 'generateRandomPassword' does not exist on type 'typeof import("studiocms:sdk")'.
} =
module "studiocms:sdk"
SDK
;

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

import
import SDKCached
SDKCached
from 'studiocms:sdk/cache';
Error ts(2307) ― Cannot find module 'studiocms:sdk/cache' or its corresponding type declarations.

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

import
import SDKCached
SDKCached
from 'studiocms:sdk/cache';
Error ts(2307) ― Cannot find module 'studiocms:sdk/cache' or its corresponding type declarations.
const {
const page: any
page
,
const pages: any
pages
,
const siteConfig: any
siteConfig
,
const latestVersion: any
latestVersion
,
const folderTree: any
folderTree
,
const pageFolderTree: any
pageFolderTree
,
const folderList: any
folderList
,
const folder: any
folder
,
} =
import SDKCached
SDKCached
.
any
GET
;

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

import
import SDKCached
SDKCached
from 'studiocms:sdk/cache';
Error ts(2307) ― Cannot find module 'studiocms:sdk/cache' or its corresponding type declarations.
const {
const page: any
page
,
const pages: any
pages
,
const latestVersion: any
latestVersion
,
const folderTree: any
folderTree
,
const folderList: any
folderList
,
} =
import SDKCached
SDKCached
.
any
CLEAR
;

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

import
import SDKCached
SDKCached
from 'studiocms:sdk/cache';
Error ts(2307) ― Cannot find module 'studiocms:sdk/cache' or its corresponding type declarations.
const {
const page: any
page
,
const siteConfig: any
siteConfig
,
const latestVersion: any
latestVersion
,
const folderTree: any
folderTree
,
const folderList: any
folderList
,
const folder: any
folder
,
} =
import SDKCached
SDKCached
.
any
UPDATE
;

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

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