Skip to content

sdk/types

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:319^

Represents a base cache object with a timestamp of the last cache update.

lastCacheUpdate: Date;

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:320^


Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:442^

Represents the combined data for a page, extending the stripped page data.

CombinedPageData

authorData:
| 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;
};

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:449^

authorId: null | string;
PageDataStripped.authorId

categories: {
description: string;
id: number;
meta: unknown;
name: string;
parent: null | number;
slug: string;
}[];

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:444^

An array of categories selected for the page.

description: string;
id: number;
meta: unknown;
name: string;
parent: null | number;
slug: string;

contentLang: string;
PageDataStripped.contentLang

contributorIds: string[];

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:443^

An array of contributor IDs associated with the page.

contributorsData: {
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;
}[];

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:450^

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;

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

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:447^

description: string;
PageDataStripped.description

draft: null | boolean;
PageDataStripped.draft

heroImage: string;
PageDataStripped.heroImage

id: string;
PageDataStripped.id

multiLangContent: {
content: null | string;
contentId: string;
contentLang: string;
id: string;
}[];

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:446^

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

package: string;
PageDataStripped.package

parentFolder: null | string;
PageDataStripped.parentFolder

publishedAt: Date;
PageDataStripped.publishedAt

showAuthor: null | boolean;
PageDataStripped.showAuthor

showContributors: null | boolean;
PageDataStripped.showContributors

showOnNav: boolean;
PageDataStripped.showOnNav

slug: string;
PageDataStripped.slug

tags: {
description: string;
id: number;
meta: unknown;
name: string;
slug: string;
}[];

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:445^

An array of tags selected for the page.

description: string;
id: number;
meta: unknown;
name: string;
slug: string;

title: string;
PageDataStripped.title

updatedAt: null | Date;
PageDataStripped.updatedAt

urlRoute: string;

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:448^


Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:426^

Interface representing combined user data.

This interface extends tsUsersSelect and includes additional properties for OAuth data and permissions data.

CombinedUserData

avatar: null | string;
tsUsersSelect.avatar

createdAt: null | Date;
tsUsersSelect.createdAt

email: null | string;
tsUsersSelect.email

emailVerified: boolean;
tsUsersSelect.emailVerified

id: string;
tsUsersSelect.id

name: string;
tsUsersSelect.name

notifications: null | string;
tsUsersSelect.notifications

oAuthData:
| undefined
| {
provider: string;
providerUserId: string;
userId: string;
}[];

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:427^

An array of OAuth account data or undefined.

password: null | string;
tsUsersSelect.password

permissionsData:
| undefined
| {
rank: string;
user: string;
};

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:428^

Permissions data or undefined.

updatedAt: null | Date;
tsUsersSelect.updatedAt

url: null | string;
tsUsersSelect.url

username: string;
tsUsersSelect.username

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:459^

Interface representing the response received after a deletion operation.

message: string;

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:461^

A message providing additional information about the deletion operation.

status: "success" | "error";

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:460^

The status of the deletion operation.


Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:240^

Represents a single difference item for a page, including metadata and content changes.

diff: null | string;

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:247^

The difference content as a string, or null if not available.

id: string;

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:241^

Unique identifier for the diff item.

pageContentStart: string;

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:246^

The initial content of the page before the diff.

pageId: string;

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:243^

Identifier of the page associated with the diff.

pageMetaData: unknown;

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:245^

Metadata associated with the page; type is unknown.

timestamp: null | Date;

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:244^

The date and time when the diff was created, or null if not set.

userId: string;

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:242^

Identifier of the user who made the change.


Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:260^

Represents the result of a diff operation, extending diffItem but replacing the pageMetaData property.

The pageMetaData property contains the starting and ending states of page metadata, each represented as a partial selection of tsPageDataSelect.

  • diffItem
  • tsPageDataSelect

diff: null | string;

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:247^

Omit.diff

id: string;

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:241^

Omit.id

pageContentStart: string;

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:246^

Omit.pageContentStart

pageId: string;

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:243^

Omit.pageId

pageMetaData: {
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;
}>;
};

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:261^

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;
}>;

timestamp: null | Date;

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:244^

Omit.timestamp

userId: string;

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:242^

Omit.userId

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:94^

Interface representing a validator for an effect schema.

The type of the value that the schema validates.

E extends Schema.Struct<any>

effectSchema: E;

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:95^

The schema used for validation, which takes a value of type T and returns either a ParseError or never.


Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:395^

Represents a cache object for folder list data. Extends the BaseCacheObject interface.

FolderListCacheObject

data: FolderListItem[];

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:396^

The folder list data to be cached.

lastCacheUpdate: Date;

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:320^

BaseCacheObject.lastCacheUpdate


Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:300^

Represents a folder item in a list, including its unique identifier, name, and optional parent folder.

id: string;

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:301^

The unique identifier for the folder.

name: string;

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:302^

The display name of the folder.

optional parent: null | string;

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:303^

The identifier of the parent folder, or null if the folder is at the root level.


Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:285^

Represents a node in a folder structure, which may contain child nodes and page data.

children: FolderNode[];

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:290^

Array of child folder nodes.

id: string;

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:286^

Unique identifier for the folder node.

name: string;

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:287^

Name of the folder node.

page: boolean;

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:288^

Indicates whether this node represents a page.

pageData:
| null
| CombinedPageData;

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:289^

Data associated with the page, or null if not applicable.


Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:382^

Represents a cache object for folder tree data. Extends the BaseCacheObject interface.

FolderTreeCacheObject

data: FolderNode[];

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:383^

The folder tree data to be cached.

lastCacheUpdate: Date;

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:320^

BaseCacheObject.lastCacheUpdate


Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:82^

Represents a JSON validator function for a specific type.

T

The type that the validator function checks for.

jsonFn: (data: unknown) => data is T;

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:83^

A type guard function that determines if the provided data is of type T.

unknown

data is T


Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:345^

Represents a cache object for page data. Extends the BaseCacheObject interface.

MetaOnlyPageDataCacheObject

data: MetaOnlyPageData;

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:346^

The combined page data to be cached.

lastCacheUpdate: Date;

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:320^

BaseCacheObject.lastCacheUpdate


Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:332^

Represents a cache object for page data. Extends the BaseCacheObject interface.

PageDataCacheObject

data: CombinedPageData;

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:333^

The combined page data to be cached.

lastCacheUpdate: Date;

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:320^

BaseCacheObject.lastCacheUpdate


Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:467^

Represents the data required to insert a new page.

pageContent: CombinedInsertContent;

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:469^

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;
};

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:468^

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;

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:399^

Represents a base cache object with a timestamp of the last cache update.

data: {
data: unknown;
id: string;
};

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:400^

data: unknown;
id: string;

lastCacheUpdate: Date;

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:320^

BaseCacheObject.lastCacheUpdate


Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:72^

Represents a plugin data entry with a strongly-typed data property.

T extends object

The type of the data property.

data: T;

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:73^

The plugin-specific data payload.

id: string;
Omit.id

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:358^

Represents a cache object for site configuration. Extends the BaseCacheObject interface.

SiteConfigCacheObject

data: SiteConfig;

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:359^

The site configuration data.

lastCacheUpdate: Date;

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:320^

BaseCacheObject.lastCacheUpdate


Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:49^

Options for using plugin data, extending the base options with an entry identifier.

T extends Schema.Struct<Schema.Struct.Fields> | object

The type of the plugin data object.

entryId: string;

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:51^

The unique identifier for the entry associated with the plugin data.

optional Type: T;

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:37^

An optional type definition for the data.

UsePluginDataOptsBase.Type

optional validator: ValidatorOptions<T>;

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:38^

Optional validator options for the data type.

UsePluginDataOptsBase.validator


Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:36^

Base options for using plugin data.

T extends Schema.Struct<Schema.Struct.Fields> | object

The type of the data object.

optional Type: T;

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:37^

An optional type definition for the data.

optional validator: ValidatorOptions<T>;

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:38^

Optional validator options for the data type.


Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:369^

Represents a cache object that includes version information.

lastCacheUpdate: Date;

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:320^

BaseCacheObject.lastCacheUpdate

version: string;

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:370^

The version of the cache object.


Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:104^

Interface representing a validator that uses a Zod schema to validate data of type T.

T

The type of data to be validated.

zodSchema: ZodType<T>;

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:105^

The Zod schema instance used for validation.

type addDatabaseEntryInsertPage = {
pageContent: PageContentReturnId[];
pageData: PageDataReturnId[];
};

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:409^

Represents the structure for adding a database entry for a page.

pageContent: PageContentReturnId[];

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:411^

An array of page content objects with return IDs.

pageData: PageDataReturnId[];

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:410^

An array of page data objects with return IDs.


type AstroDBVirtualModule = __module;

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:311^

Represents the type of the virtual module imported from ‘astro:db’. This type can be used to reference the shape and exports of the Astro DB virtual module within TypeScript code, enabling type-safe interactions with its API.


type CacheMap<K, V> = ReadonlyMap<K, V> & Map<K, V>;

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:186^

Represents a cache map that combines the immutability of ReadonlyMap with the mutability of Map.

K

The type of keys in the map.

V

The type of values in the map.

This type allows both read-only and mutable operations on the map, which can be useful for scenarios where you need to enforce read-only access in some contexts while allowing mutation in others.


type DiffReturnType<T> = T extends diffItem ? diffReturn : diffReturn[];

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:274^

Determines the return type based on whether the generic type T extends diffItem. If T extends diffItem, returns diffReturn; otherwise, returns an array of diffReturn.

T

The type to check against diffItem.

diffReturn if T extends diffItem, otherwise diffReturn[].


type MetaOnlyPageData = Omit<CombinedPageData, "multiLangContent" | "defaultContent">;

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:204^

Represents page data containing only metadata fields, excluding multilingual and default content.

This type omits the multiLangContent and defaultContent properties from CombinedPageData.


type MultiPageInsert = PageInsert[];

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:475^

Represents an array of PageInsert objects.


type PageDataCacheReturnType<T> = T extends PageDataCacheObject ? MetaOnlyPageDataCacheObject : MetaOnlyPageDataCacheObject[];

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:225^

Determines the return type for page data cache operations based on the input type.

If the generic type T extends PageDataCacheObject, the return type is MetaOnlyPageDataCacheObject. Otherwise, the return type is an array of MetaOnlyPageDataCacheObject.

T

The type to check against PageDataCacheObject.


type PageDataReturnType<T> = T extends CombinedPageData ? MetaOnlyPageData : MetaOnlyPageData[];

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:213^

Conditional type that returns either MetaOnlyPageData or an array of MetaOnlyPageData based on whether the generic type T extends CombinedPageData.

T

The type to check against CombinedPageData.

If T extends CombinedPageData, returns MetaOnlyPageData; otherwise, returns MetaOnlyPageData[].


type PaginateInput = {
limit: number;
offset: number;
};

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:194^

Input parameters for paginated queries.

limit: number;

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:195^

The maximum number of items to return.

offset: number;

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:196^

The number of items to skip before starting to collect the result set.


type UserPluginDataOptsImplementation<T> = Partial<UsePluginDataOpts<T>>;

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:61^

Represents a partial implementation of the UsePluginDataOpts type for a given object type T.

This type is useful when you want to provide only a subset of the properties defined in UsePluginDataOpts<T>.

T extends Schema.Struct<Schema.Struct.Fields> | object

The object type for which the plugin data options are defined.


type ValidatorOptions<T> = T extends Schema.Struct<any> ? EffectSchemaValidator<T> :
| JSONValidatorFn<T>
| ZodValidator<T>;

Defined in: studiocms/packages/studiocms/src/sdk/types/index.ts:172^

Represents the available validator options for a given type T.

This type is a union of supported validator types:

  • JSONValidatorFn<T>: A function-based JSON validator for type T.
  • EffectSchemaValidator<T>: A validator using the Effect schema for type T.
  • ZodValidator<T>: A validator using the Zod schema for type T.

T extends Schema.Struct<any> | object

The type to be validated.

// The Interface for a User type
interface User {
id: number;
name: string;
email: string;
}
// Example of defining a JSON validator Fn for a User type
const userValidator: ValidatorOptions<User> = {
jsonFn: (data: unknown): data is User => {
return (
typeof data === 'object' &&
data !== null &&
'id' in data &&
'name' in data &&
'email' in data &&
typeof (data as any).id === 'number' &&
typeof (data as any).name === 'string' &&
typeof (data as any).email === 'string'
);
}
};
// Example of defining an Effect schema validator for a User type
import { Schema } from 'studiocms/effect';
const userEffectSchema = Schema.Struct({
id: Schema.Number,
name: Schema.String,
email: Schema.String
});
type UserEffectSchema = (typeof userEffectSchema)['Type'];
type UserEffectSchemaFields = (typeof userEffectSchema)['fields'];
const userEffectValidator: ValidatorOptions<UserEffectSchema, UserEffectSchemaFields> = {
effectSchema: userEffectSchema
};
// Example of defining a Zod validator for a User type
import { z } from 'astro/zod';
const userZodValidator: ValidatorOptions<User> = {
zodSchema: z.object({
id: z.number(),
name: z.string(),
email: z.string()
})
};

Re-exports AvailableLists


Re-exports CacheConfig


Re-exports CombinedInsertContent


Re-exports CombinedRank


Re-exports DatabaseTables


Re-exports PageContentReturnId


Re-exports PageDataCategoriesInsertResponse


Re-exports PageDataReturnId


Re-exports PageDataStripped


Re-exports PageDataTagsInsertResponse


Re-exports ProcessedCacheConfig


Re-exports ProcessedSDKConfig


Re-exports SingleRank


Re-exports SiteConfig


Re-exports tsDiffTrackingInsert


Re-exports tsDiffTrackingSelect


Re-exports tsEmailVerificationTokensInsert


Re-exports tsEmailVerificationTokensSelect


Re-exports tsNotificationSettingsInsert


Re-exports tsNotificationSettingsSelect


Re-exports tsOAuthAccountsInsert


Re-exports tsOAuthAccountsSelect


Re-exports tsPageContentInsert


Re-exports tsPageContentSelect


Re-exports tsPageDataCategoriesInsert


Re-exports tsPageDataCategoriesSelect


Re-exports tsPageDataInsert


Re-exports tsPageDataSelect


Re-exports tsPageDataTagsInsert


Re-exports tsPageDataTagsSelect


Re-exports tsPageFolderInsert


Re-exports tsPageFolderSelect


Re-exports tsPermissionsInsert


Re-exports tsPermissionsSelect


Re-exports tsPluginDataInsert


Re-exports tsPluginDataSelect


Re-exports tsSessionTableInsert


Re-exports tsSessionTableSelect


Re-exports tsSiteConfigInsert


Re-exports tsSiteConfigSelect


Re-exports tsUserResetTokensInsert


Re-exports tsUserResetTokensSelect


Re-exports tsUsersInsert


Re-exports tsUsersSelect


Re-exports tsUsersUpdate