schemas/config/sdk
此内容尚不支持你的语言。
Type Aliases
Section titled “Type Aliases”CacheConfig
Section titled “CacheConfig”type CacheConfig = { lifetime: number;};
Defined in: studiocms/packages/studiocms/src/schemas/config/sdk.ts:81^
Represents the configuration for the cache.
This type is inferred from the CacheConfigSchema
using Zod’s infer
method.
It ensures that the cache configuration adheres to the schema defined in CacheConfigSchema
.
Type Declaration
Section titled “Type Declaration”lifetime
Section titled “lifetime”lifetime: number;
Cache Lifetime
{number}{unit}
- e.g. ‘5m’ for 5 minutes or ‘1h’ for 1 hour
Default
Section titled “Default”'5m'
ProcessedCacheConfig
Section titled “ProcessedCacheConfig”type ProcessedCacheConfig = { enabled: boolean; lifetime: number;};
Defined in: studiocms/packages/studiocms/src/schemas/config/sdk.ts:89^
Represents the processed cache configuration inferred from the ProcessedCacheConfigSchema.
This type is used to define the structure of the cache configuration after it has been processed and validated by the schema.
Type Declaration
Section titled “Type Declaration”enabled
Section titled “enabled”enabled: boolean;
Cache Enabled
Default
Section titled “Default”true
lifetime
Section titled “lifetime”lifetime: number;
Cache Lifetime
{number}{unit}
- e.g. ‘5m’ for 5 minutes or ‘1h’ for 1 hour
Default
Section titled “Default”'5m'
ProcessedSDKConfig
Section titled “ProcessedSDKConfig”type ProcessedSDKConfig = { cacheConfig: { enabled: boolean; lifetime: number; };};
Defined in: studiocms/packages/studiocms/src/schemas/config/sdk.ts:139^
Type definition for the processed SDK configuration.
This type is inferred from the ProcessedSDKSchema
using Zod’s infer
method.
It represents the structure of the SDK configuration after it has been processed.
Type Declaration
Section titled “Type Declaration”cacheConfig
Section titled “cacheConfig”cacheConfig: { enabled: boolean; lifetime: number;} = ProcessedCacheConfigSchema;
Cache Configuration
Default
Section titled “Default”cacheConfig: { lifetime: '5m' }
cacheConfig.enabled
Section titled “cacheConfig.enabled”enabled: boolean;
Cache Enabled
Default
Section titled “Default”true
cacheConfig.lifetime
Section titled “cacheConfig.lifetime”lifetime: number;
Cache Lifetime
{number}{unit}
- e.g. ‘5m’ for 5 minutes or ‘1h’ for 1 hour
Default
Section titled “Default”'5m'
StudioCMS_SDKConfig
Section titled “StudioCMS_SDKConfig”type StudioCMS_SDKConfig = typeof SDKSchema._output;
Defined in: studiocms/packages/studiocms/src/schemas/config/sdk.ts:178^
StudioCMS_SDKOptions
Section titled “StudioCMS_SDKOptions”type StudioCMS_SDKOptions = typeof SDKSchema._input;
Defined in: studiocms/packages/studiocms/src/schemas/config/sdk.ts:177^
TimeString
Section titled “TimeString”type TimeString = typeof TimeStringSchema._input;
Defined in: studiocms/packages/studiocms/src/schemas/config/sdk.ts:35^
Variables
Section titled “Variables”CacheConfigSchema
Section titled “CacheConfigSchema”const CacheConfigSchema: ZodObject<CacheConfig>;
Defined in: studiocms/packages/studiocms/src/schemas/config/sdk.ts:40^
Schema for cache configuration.
ProcessedCacheConfigSchema
Section titled “ProcessedCacheConfigSchema”const ProcessedCacheConfigSchema: ZodObject<ProcessedCacheConfig>;
Defined in: studiocms/packages/studiocms/src/schemas/config/sdk.ts:59^
Schema for processed cache configuration.
Extends the base CacheConfigSchema with additional properties.
Properties:
-
Section titled “enabled (boolean): Indicates if the cache is enabled.”enabled
(boolean): Indicates if the cache is enabled.
Default
Section titled “Default”true
ProcessedSDKSchema
Section titled “ProcessedSDKSchema”const ProcessedSDKSchema: ZodObject<ProcessedSDKConfig>;
Defined in: studiocms/packages/studiocms/src/schemas/config/sdk.ts:124^
Schema for processing SDK configuration.
SDKCacheSchema
Section titled “SDKCacheSchema”const SDKCacheSchema: ZodEffects<ZodDefault<ZodOptional<ZodUnion<[ZodBoolean, ZodObject<{ lifetime: ZodDefault<ZodOptional<ZodEffects<ZodString, number, string>>>;}, "strip", ZodTypeAny, { lifetime: number;}, { lifetime?: string;}>]>>>, { enabled: boolean; lifetime: number;}, | undefined | boolean | { lifetime?: string;}>;
Defined in: studiocms/packages/studiocms/src/schemas/config/sdk.ts:107^
Schema for SDK cache configuration.
This schema allows for either a boolean value or a more detailed cache configuration object.
- If a boolean value is provided:
true
: Enables caching with a default lifetime.false
: Disables caching.
- If a cache configuration object is provided, it must conform to
CacheConfigSchema
.
The schema is optional and defaults to true
(enabled with default lifetime).
The transformation ensures that the resulting configuration is of type ProcessedCacheConfig
:
- If a boolean value is provided, it is transformed into an object with
enabled
andlifetime
properties. - If a cache configuration object is provided, it is transformed to ensure
enabled
is alwaystrue
.
SDKSchema
Section titled “SDKSchema”const SDKSchema: ZodEffects<ZodDefault<ZodOptional<ZodUnion<[ZodBoolean, ZodObject<{ cacheConfig: ZodEffects<ZodDefault<ZodOptional<ZodUnion<...>>>, { enabled: boolean; lifetime: number; }, | undefined | boolean | { lifetime?: ... | ...; }>;}, "strip", ZodTypeAny, { cacheConfig: { enabled: boolean; lifetime: number; };}, { cacheConfig?: | boolean | { lifetime?: string; };}>]>>>, { cacheConfig: { enabled: boolean; lifetime: number; };}, | undefined | boolean | { cacheConfig?: | boolean | { lifetime?: string; };}>;
Defined in: studiocms/packages/studiocms/src/schemas/config/sdk.ts:151^
SDKSchema is a Zod schema that validates the SDK configuration. It can either be a boolean or an object containing cache configuration.
If it is a boolean, it defaults to true
and transforms into an object
with default cache configuration.
If it is an object, it must contain the cacheConfig
property which is
validated by the SDKCacheSchema
.
TimeStringSchema
Section titled “TimeStringSchema”const TimeStringSchema: ZodEffects<ZodString, number, string>;
Defined in: studiocms/packages/studiocms/src/schemas/config/sdk.ts:8^
TimeUnitSchema
Section titled “TimeUnitSchema”const TimeUnitSchema: ZodUnion<[ZodLiteral<"m">, ZodLiteral<"h">]>;
Defined in: studiocms/packages/studiocms/src/schemas/config/sdk.ts:4^