Skip to content

schemas/config/sdk

type CacheConfig = {
lifetime: number;
};

Defined in: studiocms/packages/studiocms/src/schemas/config/sdk.ts:79

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.

lifetime: number;

Cache Lifetime

{number}{unit} - e.g. ‘5m’ for 5 minutes or ‘1h’ for 1 hour

'5m'

type ProcessedCacheConfig = {
enabled: boolean;
lifetime: number;
};

Defined in: studiocms/packages/studiocms/src/schemas/config/sdk.ts:87

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.

enabled: boolean;

Cache Enabled

true

lifetime: number;

Cache Lifetime

{number}{unit} - e.g. ‘5m’ for 5 minutes or ‘1h’ for 1 hour

'5m'

type ProcessedSDKConfig = {
cacheConfig: {
enabled: boolean;
lifetime: number;
};
};

Defined in: studiocms/packages/studiocms/src/schemas/config/sdk.ts:137

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.

cacheConfig: {
enabled: boolean;
lifetime: number;
} = ProcessedCacheConfigSchema;

Cache Configuration

cacheConfig: { lifetime: '5m' }

enabled: boolean;

Cache Enabled

true

lifetime: number;

Cache Lifetime

{number}{unit} - e.g. ‘5m’ for 5 minutes or ‘1h’ for 1 hour

'5m'

type StudioCMS_SDKConfig = typeof SDKSchema._output;

Defined in: studiocms/packages/studiocms/src/schemas/config/sdk.ts:176


type StudioCMS_SDKOptions = typeof SDKSchema._input;

Defined in: studiocms/packages/studiocms/src/schemas/config/sdk.ts:175


type TimeString = typeof TimeStringSchema._input;

Defined in: studiocms/packages/studiocms/src/schemas/config/sdk.ts:33

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:149

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.