Skip to content

virtuals/sdk/types

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

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

lastCacheUpdate: Date;

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


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

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/virtuals/sdk/types/index.ts:445^

authorId: null | string;

CombinedPageData.authorId

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

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

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/virtuals/sdk/types/index.ts:439^

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/virtuals/sdk/types/index.ts:446^

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/virtuals/sdk/types/index.ts:443^

description: string;
PageDataStripped.description

draft: null | boolean;

CombinedPageData.draft

heroImage: string;

CombinedPageData.heroImage

id: string;
PageDataStripped.id

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

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

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

package: string;

CombinedPageData.package

parentFolder: null | string;

CombinedPageData.parentFolder

publishedAt: Date;

CombinedPageData.publishedAt

showAuthor: null | boolean;

CombinedPageData.showAuthor

showContributors: null | boolean;

CombinedPageData.showContributors

showOnNav: boolean;

CombinedPageData.showOnNav

slug: string;
PageDataStripped.slug

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

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

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;

CombinedUserData.updatedAt

urlRoute: string;

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


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

Interface representing combined user data.

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

CombinedUserData

avatar: null | string;

CombinedUserData.avatar

createdAt: null | Date;

CombinedUserData.createdAt

email: null | string;

CombinedUserData.email

emailVerified: boolean;

CombinedUserData.emailVerified

id: string;
tsUsersSelect.id

name: string;

CombinedUserData.name

notifications: null | string;

CombinedUserData.notifications

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

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

An array of OAuth account data or undefined.

password: null | string;

CombinedUserData.password

permissionsData:
| undefined
| {
rank: "unknown" | "owner" | "admin" | "editor" | "visitor";
user: string;
};

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

Permissions data or undefined.

updatedAt: null | Date;

CombinedUserData.updatedAt

url: null | string;

CombinedUserData.url

username: string;

CombinedUserData.username


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

Interface representing the response received after a deletion operation.

message: string;

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

A message providing additional information about the deletion operation.

status: "success" | "error";

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

The status of the deletion operation.


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

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

diff: null | string;

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

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

id: string;

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

Unique identifier for the diff item.

pageContentStart: string;

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

The initial content of the page before the diff.

pageId: string;

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

Identifier of the page associated with the diff.

pageMetaData: unknown;

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

Metadata associated with the page; type is unknown.

timestamp: null | Date;

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

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

userId: string;

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

Identifier of the user who made the change.


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

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/virtuals/sdk/types/index.ts:243^

diffItem.diff

id: string;

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

diffItem.id

pageContentStart: string;

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

diffItem.pageContentStart

pageId: string;

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

diffItem.pageId

pageMetaData: {
end: Partial<tsPageDataSelect>;
start: Partial<tsPageDataSelect>;
};

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

end: Partial<tsPageDataSelect>;
start: Partial<tsPageDataSelect>;

timestamp: null | Date;

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

diffItem.timestamp

userId: string;

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

diffItem.userId


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

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/virtuals/sdk/types/index.ts:91^

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/virtuals/sdk/types/index.ts:391^

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

FolderListCacheObject

data: FolderListItem[];

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

The folder list data to be cached.

lastCacheUpdate: Date;

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

BaseCacheObject.lastCacheUpdate


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

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

id: string;

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

The unique identifier for the folder.

name: string;

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

The display name of the folder.

optional parent: null | string;

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

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


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

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

children: FolderNode[];

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

Array of child folder nodes.

id: string;

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

Unique identifier for the folder node.

name: string;

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

Name of the folder node.

page: boolean;

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

Indicates whether this node represents a page.

pageData:
| null
| CombinedPageData;

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

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


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

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

FolderTreeCacheObject

data: FolderNode[];

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

The folder tree data to be cached.

lastCacheUpdate: Date;

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

BaseCacheObject.lastCacheUpdate


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

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/virtuals/sdk/types/index.ts:79^

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

unknown

data is T


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

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

MetaOnlyPageDataCacheObject

data: MetaOnlyPageData;

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

The combined page data to be cached.

lastCacheUpdate: Date;

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

BaseCacheObject.lastCacheUpdate


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

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

PageDataCacheObject

data: CombinedPageData;

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

The combined page data to be cached.

lastCacheUpdate: Date;

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

BaseCacheObject.lastCacheUpdate


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

Represents the data required to insert a new page.

pageContent: CombinedInsertContent;

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

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/virtuals/sdk/types/index.ts:464^

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/virtuals/sdk/types/index.ts:395^

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

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

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

data: unknown;
id: string;

lastCacheUpdate: Date;

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

BaseCacheObject.lastCacheUpdate


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

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/virtuals/sdk/types/index.ts:69^

The plugin-specific data payload.

id: string;
Omit.id

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

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

SiteConfigCacheObject

data: StudioCMSSiteConfig;

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

The site configuration data.

lastCacheUpdate: Date;

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

BaseCacheObject.lastCacheUpdate


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

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/virtuals/sdk/types/index.ts:47^

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

optional Type: T;

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

An optional type definition for the data.

UsePluginDataOptsBase.Type

optional validator: ValidatorOptions<T>;

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

Optional validator options for the data type.

UsePluginDataOptsBase.validator


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

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/virtuals/sdk/types/index.ts:33^

An optional type definition for the data.

optional validator: ValidatorOptions<T>;

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

Optional validator options for the data type.


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

Represents a cache object that includes version information.

lastCacheUpdate: Date;

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

BaseCacheObject.lastCacheUpdate

version: string;

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

The version of the cache object.


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

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/virtuals/sdk/types/index.ts:101^

The Zod schema instance used for validation.

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

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

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

pageContent: PageContentReturnId[];

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

An array of page content objects with return IDs.

pageData: PageDataReturnId[];

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

An array of page data objects with return IDs.


type AstroDBVirtualModule = __module;

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

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/virtuals/sdk/types/index.ts:182^

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/virtuals/sdk/types/index.ts:270^

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/virtuals/sdk/types/index.ts:200^

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/virtuals/sdk/types/index.ts:471^

Represents an array of PageInsert objects.


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

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

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/virtuals/sdk/types/index.ts:209^

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/virtuals/sdk/types/index.ts:190^

Input parameters for paginated queries.

limit: number;

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

The maximum number of items to return.

offset: number;

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

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/virtuals/sdk/types/index.ts:57^

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/virtuals/sdk/types/index.ts:168^

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