virtuals/sdk/modules/config
이 콘텐츠는 아직 번역되지 않았습니다.
Classes
Section titled “Classes”SDKCore_CONFIG
Section titled “SDKCore_CONFIG”Defined in: studiocms/packages/studiocms/src/virtuals/sdk/modules/config.ts:265^
Extends
Section titled “Extends”any
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new SDKCore_CONFIG(): SDKCore_CONFIG
Returns
Section titled “Returns”Inherited from
Section titled “Inherited from”Effect.Service<SDKCore_CONFIG>()( 'studiocms/sdk/modules/SDKCore_CONFIG', { dependencies: [AstroDB.Default, Deepmerge.Default], effect: Effect.gen(function () { const [dbService, { merge }] = yield Effect.all([AstroDB, Deepmerge]);
/ Inserts a new dynamic configuration entry into the database.
@param entry - The raw dynamic configuration entry to insert. @returns A promise that resolves to the inserted entry.
@remarks This function uses the dbService.makeQuery utility to perform the insertion and returns the newly inserted record from the tsDynamicConfigSettings table. / const _insert = dbService.makeQuery((ex, entry: RawDynamicConfigInsert) => ex((db) => db.insert(tsDynamicConfigSettings).values(entry).returning().get()) );
/ Creates a query function to select a dynamic configuration setting by its ID.
@param ex - The database executor function. @param id - The unique identifier of the dynamic configuration setting. @returns A promise that resolves to the configuration setting matching the provided ID. / const _select = dbService.makeQuery((ex, id: string) => ex((db) => db.select().from(tsDynamicConfigSettings).where(eq(tsDynamicConfigSettings.id, id)).get() ) );
/ Updates a dynamic configuration entry in the database.
@param entry - The RawDynamicConfigEntry object containing the updated configuration data. @returns A promise that resolves to the updated entry from the database.
@remarks This function uses the dbService.makeQuery utility to perform an update operation on the tsDynamicConfigSettings table, setting the fields based on the provided entry where the id matches. The updated entry is returned after the operation. / const _update = dbService.makeQuery((ex, entry: RawDynamicConfigEntry) => ex((db) => db .update(tsDynamicConfigSettings) .set(entry) .where(eq(tsDynamicConfigSettings.id, entry.id)) .returning() .get() ) );
/ Creates a new entry with the specified id and associated data.
@template DataType - The type of the data to associate with the entry. @param id - The unique identifier for the entry. @param data - The data to be stored in the entry. @returns An Effect that, when executed, inserts the entry and yields the result. / const create = Effect.fn(function <DataType>(id: string, data: DataType) { const entry = castType<DataType>({ id, data }); return yield _insert(entry) as Effect.Effect< DynamicConfigEntry<DataType>, LibSQLDatabaseError >; });
/ Retrieves an entry by its ID and casts it to the specified data type.
@template DataType - The expected type of the returned entry. @param id - The unique identifier of the entry to retrieve. @returns The entry cast to the specified type, or undefined if not found. / const get = Effect.fn(function <DataType>(id: string) { const entry = yield _select(id); if (!entry) return undefined; return castType<DataType>(entry); });
/ Updates an entry with the specified id and data.
@template DataType - The type of the data to update. @param id - The unique identifier of the entry to update. @param data - The new data to associate with the entry. @returns An Effect yielding the result of the update operation. / const update = Effect.fn(function <DataType>(id: string, data: DataType) { const entry = castType<DataType>({ id, data }); return yield _update(entry) as Effect.Effect< DynamicConfigEntry<DataType>, LibSQLDatabaseError >; });
/ Runs a migration for a legacy configuration table entry to a new configuration format.
This function retrieves a legacy configuration entry from the specified table using the provided legacy ID, applies a migration function to transform it into the new configuration format, and then creates a new entry with the specified new ID.
@typeParam Table - The legacy table type to migrate from. @typeParam LegacyConfig - The inferred select type of the legacy table. @typeParam Config - The new configuration type to migrate to. @param opts - The migration options. @param opts.table - The legacy table to migrate from. @param opts.legacyId - The ID of the legacy configuration entry. @param opts.migrate - The migration function that transforms the legacy configuration to the new format. @param opts.newId - The ID for the new configuration entry. @returns The result of the creation operation, or undefined if the legacy configuration was not found. / const runMigration = Effect.fn(function < Table extends LegacyTables, LegacyConfig extends Table extends LegacySiteConfig ? LegacySiteConfig['$inferSelect'] : Table extends LegacyMailerConfig ? LegacyMailerConfig['$inferSelect'] : Table extends LegacyNotificationSettings ? LegacyNotificationSettings['$inferSelect'] : never, Config extends Table extends LegacySiteConfig ? StudioCMSSiteConfig : Table extends LegacyMailerConfig ? StudioCMSMailerConfig : Table extends LegacyNotificationSettings ? StudioCMSNotificationSettings : never, >(opts: { table: Table; legacyId: string | number; migrate: (legacyConfig: LegacyConfig) => Config; newId: string; }) { const { table, legacyId, migrate, newId } = opts;
const legacyConfig = (yield dbService.execute((db) => db.select().from(table).where(eq(table.id, legacyId)).get() )) as LegacyConfig | undefined;
if (!legacyConfig) return;
const newConfig = migrate(legacyConfig); return yield create(newId, newConfig); });
/ Retrieves a dynamic configuration entry by its ID. If the entry does not exist or its configuration version does not match the current version, runs a migration using the provided migration options and returns the migrated entry.
@template DataType - The type of the dynamic configuration data. @param id - The unique identifier of the configuration entry to retrieve. @param migrationOpts - Options for migrating legacy configuration entries. @param migrationOpts.table - The legacy table to use for migration. @param migrationOpts.legacyId - The identifier of the legacy configuration entry. @param migrationOpts.migrate - A function that transforms the legacy configuration into the new format. @param migrationOpts.newId - The new identifier to assign to the migrated configuration entry. @returns The configuration entry of type DataType, either retrieved or migrated. / const dynamicGet = Effect.fn(function <DataType extends StudioCMSDynamicConfigBase>( id: string, migrationOpts: { table: LegacyTables; legacyId: string | number; // biome-ignore lint/suspicious/noExplicitAny: the actual type is too complex migrate: (legacyConfig: any) => DataType; newId: string; } ) { const entry = yield get<DataType>(id); // If missing, migrate from legacy (first-time population) if (!entry) { return yield runMigration(migrationOpts) as Effect.Effect< DynamicConfigEntry<DataType> | undefined, LibSQLDatabaseError >; } // If present but outdated, bump in-place to avoid UNIQUE conflicts and preserve user data if (entry.data._config_version !== CURRENT_CONFIG_VERSION) { return yield update<DataType>(id, { ...entry.data, _config_version: CURRENT_CONFIG_VERSION, } as DataType); } return entry; });
/ Updates a dynamic configuration entry by merging new data into the existing entry.
@template DataType - The type of the dynamic configuration data. @param id - The unique identifier of the configuration entry to update. @param data - The new data to merge into the existing configuration entry. @returns The updated configuration entry if it exists, otherwise undefined.
@remarks This function retrieves the existing configuration entry by its ID, merges the provided data into it, and then updates the entry in the data store. If the entry does not exist, it returns undefined. / const dynamicUpdate = Effect.fn(function <DataType extends StudioCMSDynamicConfigBase>( id: string, data: DataType ) { const entry = yield get<DataType>(id); if (!entry) return undefined; const updatedEntry = (yield merge((m) => m(entry.data, data))) as DataType; return yield update<DataType>(id, updatedEntry) as Effect.Effect< DynamicConfigEntry<DataType>, LibSQLDatabaseError, never >; });
/ Provides methods to interact with the site configuration. / const siteConfig = { / Retrieves the current site configuration. / get: () => dynamicGet<StudioCMSSiteConfig>(Next_SiteConfigId, { table: tsSiteConfig, legacyId: CMSSiteConfigId, migrate: migrateLegacySiteConfig, newId: Next_SiteConfigId, }),
/ Updates the site configuration with the provided data. @param data The new configuration data, excluding the internal version field. @returns The updated site configuration. / update: (data: ConfigFinal<StudioCMSSiteConfig>) => dynamicUpdate<StudioCMSSiteConfig>(Next_SiteConfigId, { ...data, _config_version: CURRENT_CONFIG_VERSION, }),
/ Initializes the site configuration with the provided data. @param data The initial configuration data, excluding the internal version field. @returns The created site configuration. / init: (data: ConfigFinal<StudioCMSSiteConfig>) => create<StudioCMSSiteConfig>(Next_SiteConfigId, { ...data, _config_version: CURRENT_CONFIG_VERSION, }), };
/ Provides methods to interact with the StudioCMS mailer configuration. / const mailerConfig = { / Retrieves the current mailer configuration. / get: () => dynamicGet<StudioCMSMailerConfig>(Next_MailerConfigId, { table: tsMailerConfig, legacyId: CMSMailerConfigId, migrate: migrateLegacyMailerConfig, newId: Next_MailerConfigId, }),
/ Updates the mailer configuration with the provided data. @param data The new configuration data, excluding the internal version field. @returns The updated mailer configuration. / update: (data: ConfigFinal<StudioCMSMailerConfig>) => dynamicUpdate<StudioCMSMailerConfig>(Next_MailerConfigId, { ...data, _config_version: CURRENT_CONFIG_VERSION, }),
/ Initializes the mailer configuration with the provided data. @param data The initial configuration data, excluding the internal version field. @returns The created mailer configuration. / init: (data: ConfigFinal<StudioCMSMailerConfig>) => create<StudioCMSMailerConfig>(Next_MailerConfigId, { ...data, _config_version: CURRENT_CONFIG_VERSION, }), };
/ Provides methods to interact with the notification settings configuration. / const notificationConfig = { / Retrieves the current notification settings. / get: () => dynamicGet<StudioCMSNotificationSettings>(Next_NotificationSettingsId, { table: tsNotificationSettings, legacyId: CMSNotificationSettingsId, migrate: migrateLegacyNotificationSettings, newId: Next_NotificationSettingsId, }),
/ Updates the notification settings with the provided data. @param data The new notification settings, excluding the _config_version property. @returns A promise resolving to the updated StudioCMSNotificationSettings. / update: (data: ConfigFinal<StudioCMSNotificationSettings>) => dynamicUpdate<StudioCMSNotificationSettings>(Next_NotificationSettingsId, { ...data, _config_version: CURRENT_CONFIG_VERSION, }),
/ Initializes the notification settings with the provided data. @param data The initial configuration data, excluding the internal version field. @returns The created notification settings. / init: (data: ConfigFinal<StudioCMSNotificationSettings>) => create<StudioCMSNotificationSettings>(Next_NotificationSettingsId, { ...data, _config_version: CURRENT_CONFIG_VERSION, }), };
return { siteConfig, mailerConfig, notificationConfig } as const; }), }).constructor
Interfaces
Section titled “Interfaces”StudioCMSDynamicConfigBase
Section titled “StudioCMSDynamicConfigBase”Defined in: studiocms/packages/studiocms/src/virtuals/sdk/modules/config.ts:90^
Base interface for dynamic configuration objects in StudioCMS.
Extended by
Section titled “Extended by”Properties
Section titled “Properties”_config_version
Section titled “_config_version”_config_version: string;
Defined in: studiocms/packages/studiocms/src/virtuals/sdk/modules/config.ts:91^
The version identifier for the configuration schema.
StudioCMSMailerConfig
Section titled “StudioCMSMailerConfig”Defined in: studiocms/packages/studiocms/src/virtuals/sdk/modules/config.ts:142^
Configuration options for the StudioCMS mailer module.
Extends
Section titled “Extends”Properties
Section titled “Properties”_config_version
Section titled “_config_version”_config_version: string;
Defined in: studiocms/packages/studiocms/src/virtuals/sdk/modules/config.ts:91^
The version identifier for the configuration schema.
Inherited from
Section titled “Inherited from”StudioCMSDynamicConfigBase
._config_version
auth_pass?
Section titled “auth_pass?”optional auth_pass: null | string;
Defined in: studiocms/packages/studiocms/src/virtuals/sdk/modules/config.ts:148^
Optional. Password for mail server authentication.
auth_user?
Section titled “auth_user?”optional auth_user: null | string;
Defined in: studiocms/packages/studiocms/src/virtuals/sdk/modules/config.ts:147^
Optional. Username for mail server authentication.
default_sender
Section titled “default_sender”default_sender: string;
Defined in: studiocms/packages/studiocms/src/virtuals/sdk/modules/config.ts:151^
The default email address to use as the sender.
host: string;
Defined in: studiocms/packages/studiocms/src/virtuals/sdk/modules/config.ts:143^
The hostname or IP address of the mail server.
port: number;
Defined in: studiocms/packages/studiocms/src/virtuals/sdk/modules/config.ts:144^
The port number to connect to the mail server.
proxy?
Section titled “proxy?”optional proxy: null | string;
Defined in: studiocms/packages/studiocms/src/virtuals/sdk/modules/config.ts:146^
Optional. Proxy server URL to use for outgoing mail connections.
secure
Section titled “secure”secure: boolean;
Defined in: studiocms/packages/studiocms/src/virtuals/sdk/modules/config.ts:145^
Whether to use a secure connection (TLS/SSL).
tls_rejectUnauthorized?
Section titled “tls_rejectUnauthorized?”optional tls_rejectUnauthorized: null | boolean;
Defined in: studiocms/packages/studiocms/src/virtuals/sdk/modules/config.ts:149^
Optional. Whether to reject unauthorized TLS certificates.
tls_servername?
Section titled “tls_servername?”optional tls_servername: null | string;
Defined in: studiocms/packages/studiocms/src/virtuals/sdk/modules/config.ts:150^
Optional. Server name for TLS verification.
StudioCMSNotificationSettings
Section titled “StudioCMSNotificationSettings”Defined in: studiocms/packages/studiocms/src/virtuals/sdk/modules/config.ts:163^
Represents the notification settings configuration for StudioCMS. Extends the base dynamic configuration interface.
Extends
Section titled “Extends”Properties
Section titled “Properties”_config_version
Section titled “_config_version”_config_version: string;
Defined in: studiocms/packages/studiocms/src/virtuals/sdk/modules/config.ts:91^
The version identifier for the configuration schema.
Inherited from
Section titled “Inherited from”StudioCMSDynamicConfigBase
._config_version
emailVerification?
Section titled “emailVerification?”optional emailVerification: boolean;
Defined in: studiocms/packages/studiocms/src/virtuals/sdk/modules/config.ts:164^
Optional. If true, enables email verification for users.
oAuthBypassVerification?
Section titled “oAuthBypassVerification?”optional oAuthBypassVerification: boolean;
Defined in: studiocms/packages/studiocms/src/virtuals/sdk/modules/config.ts:167^
Optional. If true, allows OAuth users to bypass verification.
requireAdminVerification?
Section titled “requireAdminVerification?”optional requireAdminVerification: boolean;
Defined in: studiocms/packages/studiocms/src/virtuals/sdk/modules/config.ts:165^
Optional. If true, requires admin verification for certain actions.
requireEditorVerification?
Section titled “requireEditorVerification?”optional requireEditorVerification: boolean;
Defined in: studiocms/packages/studiocms/src/virtuals/sdk/modules/config.ts:166^
Optional. If true, requires editor verification for certain actions.
StudioCMSSiteConfig
Section titled “StudioCMSSiteConfig”Defined in: studiocms/packages/studiocms/src/virtuals/sdk/modules/config.ts:113^
Represents the configuration options for a StudioCMS site.
Extends
Section titled “Extends”Properties
Section titled “Properties”_config_version
Section titled “_config_version”_config_version: string;
Defined in: studiocms/packages/studiocms/src/virtuals/sdk/modules/config.ts:91^
The version identifier for the configuration schema.
Inherited from
Section titled “Inherited from”StudioCMSDynamicConfigBase
._config_version
defaultOgImage?
Section titled “defaultOgImage?”optional defaultOgImage: null | string;
Defined in: studiocms/packages/studiocms/src/virtuals/sdk/modules/config.ts:116^
The default Open Graph image URL for social sharing.
description
Section titled “description”description: string;
Defined in: studiocms/packages/studiocms/src/virtuals/sdk/modules/config.ts:114^
A brief description of the site.
diffPerPage?
Section titled “diffPerPage?”optional diffPerPage: number;
Defined in: studiocms/packages/studiocms/src/virtuals/sdk/modules/config.ts:121^
The number of diffs to display per page.
enableDiffs?
Section titled “enableDiffs?”optional enableDiffs: boolean;
Defined in: studiocms/packages/studiocms/src/virtuals/sdk/modules/config.ts:120^
Whether to enable content diffs.
enableMailer?
Section titled “enableMailer?”optional enableMailer: boolean;
Defined in: studiocms/packages/studiocms/src/virtuals/sdk/modules/config.ts:123^
Whether to enable the mailer functionality.
gridItems?
Section titled “gridItems?”optional gridItems: string[];
Defined in: studiocms/packages/studiocms/src/virtuals/sdk/modules/config.ts:122^
List of grid item identifiers for the site layout.
hideDefaultIndex?
Section titled “hideDefaultIndex?”optional hideDefaultIndex: boolean;
Defined in: studiocms/packages/studiocms/src/virtuals/sdk/modules/config.ts:124^
Whether to hide the default index page.
loginPageBackground?
Section titled “loginPageBackground?”optional loginPageBackground: string;
Defined in: studiocms/packages/studiocms/src/virtuals/sdk/modules/config.ts:118^
The background image or color for the login page.
loginPageCustomImage?
Section titled “loginPageCustomImage?”optional loginPageCustomImage: null | string;
Defined in: studiocms/packages/studiocms/src/virtuals/sdk/modules/config.ts:119^
A custom image for the login page.
siteIcon?
Section titled “siteIcon?”optional siteIcon: null | string;
Defined in: studiocms/packages/studiocms/src/virtuals/sdk/modules/config.ts:117^
The URL or path to the site’s icon.
title: string;
Defined in: studiocms/packages/studiocms/src/virtuals/sdk/modules/config.ts:115^
The title of the site.
Type Aliases
Section titled “Type Aliases”ConfigFinal<T>
Section titled “ConfigFinal<T>”type ConfigFinal<T> = Omit<T, "_config_version">;
Defined in: studiocms/packages/studiocms/src/virtuals/sdk/modules/config.ts:94^
Type Parameters
Section titled “Type Parameters”T
extends StudioCMSDynamicConfigBase
DynamicConfigEntry<T>
Section titled “DynamicConfigEntry<T>”type DynamicConfigEntry<T> = { data: T; id: string;};
Defined in: studiocms/packages/studiocms/src/virtuals/sdk/modules/config.ts:36^
Represents a dynamic configuration entry with a unique identifier and associated data.
Type Parameters
Section titled “Type Parameters”T
The type of the data stored in the configuration entry.
Properties
Section titled “Properties”data: T;
Defined in: studiocms/packages/studiocms/src/virtuals/sdk/modules/config.ts:38^
The configuration data of type T.
id: string;
Defined in: studiocms/packages/studiocms/src/virtuals/sdk/modules/config.ts:37^
A unique string identifier for the configuration entry.
LegacyMailerConfig
Section titled “LegacyMailerConfig”type LegacyMailerConfig = typeof tsMailerConfig;
Defined in: studiocms/packages/studiocms/src/virtuals/sdk/modules/config.ts:58^
Represents the type of the legacy mailer configuration object.
This type is inferred from the shape of tsMailerConfig
, allowing for strong typing
and IntelliSense support wherever the legacy mailer configuration is used.
tsMailerConfig
LegacyNotificationSettings
Section titled “LegacyNotificationSettings”type LegacyNotificationSettings = typeof tsNotificationSettings;
Defined in: studiocms/packages/studiocms/src/virtuals/sdk/modules/config.ts:69^
Represents the type of the legacy notification settings object.
This type is inferred from the shape of tsNotificationSettings
.
It is used to ensure compatibility with legacy notification settings
throughout the codebase.
tsNotificationSettings
LegacySiteConfig
Section titled “LegacySiteConfig”type LegacySiteConfig = typeof tsSiteConfig;
Defined in: studiocms/packages/studiocms/src/virtuals/sdk/modules/config.ts:48^
Represents the legacy site configuration type, inferred from the shape of tsSiteConfig
.
This type is useful for maintaining compatibility with older site configuration structures.
tsSiteConfig
LegacyTables
Section titled “LegacyTables”type LegacyTables = | LegacySiteConfig | LegacyMailerConfig | LegacyNotificationSettings;
Defined in: studiocms/packages/studiocms/src/virtuals/sdk/modules/config.ts:83^
Represents the union of legacy configuration table types.
Remarks
Section titled “Remarks”This type is used to refer to any of the legacy configuration tables that may be present in the system, including site configuration, mailer configuration, and notification settings.
- LegacySiteConfig
- LegacyMailerConfig
- LegacyNotificationSettings
RawDynamicConfigEntry
Section titled “RawDynamicConfigEntry”type RawDynamicConfigEntry = typeof tsDynamicConfigSettings.$inferSelect;
Defined in: studiocms/packages/studiocms/src/virtuals/sdk/modules/config.ts:26^
Represents the inferred selection type for dynamic configuration settings.
This type is derived from the $inferSelect
property of tsDynamicConfigSettings
,
and is typically used to describe the shape of a dynamic configuration entry
as it would be selected from the database or configuration source.
RawDynamicConfigInsert
Section titled “RawDynamicConfigInsert”type RawDynamicConfigInsert = typeof tsDynamicConfigSettings.$inferInsert;
Defined in: studiocms/packages/studiocms/src/virtuals/sdk/modules/config.ts:27^
Variables
Section titled “Variables”CURRENT_CONFIG_VERSION
Section titled “CURRENT_CONFIG_VERSION”const CURRENT_CONFIG_VERSION: "1.0.0" = '1.0.0';
Defined in: studiocms/packages/studiocms/src/virtuals/sdk/modules/config.ts:195^
The current version of the configuration schema used by the SDK.
This constant should be updated whenever breaking changes are made to the configuration format.
Remarks
Section titled “Remarks”Used to ensure compatibility between different versions of configuration files and the SDK.
Functions
Section titled “Functions”castType()
Section titled “castType()”function castType<T>(param0: { data: unknown; id: string;}): DynamicConfigEntry<T>
Defined in: studiocms/packages/studiocms/src/virtuals/sdk/modules/config.ts:180^
Casts the data
property of a RawDynamicConfigEntry
to the specified generic type T
and returns a new DynamicConfigEntry<T>
object.
Type Parameters
Section titled “Type Parameters”T
The type to cast the data
property to.
Parameters
Section titled “Parameters”param0
Section titled “param0”An object containing the data
to cast and its associated id
.
unknown
The raw data to be cast to type T
.
string
The identifier for the config entry.
Returns
Section titled “Returns”A DynamicConfigEntry<T>
object with the data
property cast to type T
.
migrateLegacyMailerConfig()
Section titled “migrateLegacyMailerConfig()”function migrateLegacyMailerConfig(param0: { auth_pass: null | string; auth_user: null | string; default_sender: string; host: string; id: string; port: number; proxy: null | string; secure: boolean; tls_rejectUnauthorized: null | boolean; tls_servername: null | string; }): StudioCMSMailerConfig
Defined in: studiocms/packages/studiocms/src/virtuals/sdk/modules/config.ts:222^
Migrates a legacy mailer configuration object to the current configuration version.
Parameters
Section titled “Parameters”param0
Section titled “param0”The legacy mailer configuration object, destructured to extract the id
and the rest of the configuration.
auth_pass
Section titled “auth_pass”null
| string
auth_user
Section titled “auth_user”null
| string
default_sender
Section titled “default_sender”string
string
string
number
null
| string
secure
Section titled “secure”boolean
tls_rejectUnauthorized
Section titled “tls_rejectUnauthorized”null
| boolean
tls_servername
Section titled “tls_servername”null
| string
Returns
Section titled “Returns”The updated mailer configuration object with the current configuration version applied.
migrateLegacyNotificationSettings()
Section titled “migrateLegacyNotificationSettings()”function migrateLegacyNotificationSettings(param0: { emailVerification: boolean; id: string; oAuthBypassVerification: boolean; requireAdminVerification: boolean; requireEditorVerification: boolean; }): StudioCMSNotificationSettings
Defined in: studiocms/packages/studiocms/src/virtuals/sdk/modules/config.ts:236^
Migrates legacy notification settings to the current configuration version.
Parameters
Section titled “Parameters”param0
Section titled “param0”An object containing the legacy notification settings, including an id
and other configuration properties.
emailVerification
Section titled “emailVerification”boolean
string
oAuthBypassVerification
Section titled “oAuthBypassVerification”boolean
requireAdminVerification
Section titled “requireAdminVerification”boolean
requireEditorVerification
Section titled “requireEditorVerification”boolean
Returns
Section titled “Returns”The migrated notification settings object with the updated _config_version
.
migrateLegacySiteConfig()
Section titled “migrateLegacySiteConfig()”function migrateLegacySiteConfig(params: { defaultOgImage: null | string; description: string; diffPerPage: number; enableDiffs: boolean; enableMailer: boolean; gridItems: unknown; hideDefaultIndex: boolean; id: number; loginPageBackground: string; loginPageCustomImage: null | string; siteIcon: null | string; title: string; }): StudioCMSSiteConfig
Defined in: studiocms/packages/studiocms/src/virtuals/sdk/modules/config.ts:206^
Migrates a legacy site configuration object to the latest StudioCMSSiteConfig
format.
Parameters
Section titled “Parameters”params
Section titled “params”The legacy site configuration object, destructured to extract id
, gridItems
, and the rest of the config.
defaultOgImage
Section titled “defaultOgImage”null
| string
description
Section titled “description”string
diffPerPage
Section titled “diffPerPage”number
enableDiffs
Section titled “enableDiffs”boolean
enableMailer
Section titled “enableMailer”boolean
gridItems
Section titled “gridItems”unknown
The grid items from the legacy config, which will be cast to a string array.
hideDefaultIndex
Section titled “hideDefaultIndex”boolean
number
The unique identifier of the site (legacy, not used in the new config).
loginPageBackground
Section titled “loginPageBackground”string
loginPageCustomImage
Section titled “loginPageCustomImage”null
| string
siteIcon
Section titled “siteIcon”null
| string
string
Returns
Section titled “Returns”The migrated site configuration object with the latest config version and normalized gridItems
.