storyblok
Version:
A simple CLI to start Storyblok from your command line.
70 lines (67 loc) • 2.64 kB
TypeScript
import { Options, JSONSchema } from 'json-schema-to-typescript';
export { ISbStoryData } from 'storyblok-js-client';
type StoryblokProvidedPropertyType = "asset" | "multiasset" | "multilink" | "table" | "richtext";
type ComponentPropertySchemaType = StoryblokProvidedPropertyType | "array" | "bloks" | "boolean" | "custom" | "datetime" | "image" | "markdown" | "number" | "option" | "options" | "text" | "textarea";
type JSONSchemaToTSOptions = Partial<Options>;
interface GenerateTypescriptTypedefsCLIOptions {
sourceFilePaths: string[];
destinationFilePath?: string;
typeNamesPrefix?: string;
typeNamesSuffix?: string;
customFieldTypesParserPath?: string;
JSONSchemaToTSOptionsPath?: string;
}
interface ComponentPropertySchemaOption {
_uid: string;
name: string;
value: string;
}
type ComponentPropertySchema = {
asset_link_type?: boolean;
component_group_whitelist?: string[];
component_whitelist?: string[];
email_link_type?: boolean;
exclude_empty_option?: boolean;
filter_content_type?: string | string[];
key: string;
options?: ComponentPropertySchemaOption[];
pos: number;
restrict_components?: boolean;
restrict_type?: "groups" | "";
source?: "internal" | "external" | "internal_stories" | "internal_languages";
type: ComponentPropertySchemaType;
use_uuid?: boolean;
};
type ComponentPropertyTypeAnnotation = {
tsType: string | string[];
} | {
type: string | string[];
enum: string[];
} | {
type: string | string[];
} | {
type: "array";
items: {
type: string | string[];
};
} | {
type: "array";
items: {
enum: string[];
};
};
type GenerateTSTypedefsFromComponentsJSONSchemasOptions = {
sourceFilePaths: string[];
destinationFilePath: string;
typeNamesPrefix?: string;
typeNamesSuffix?: string;
customFieldTypesParserPath?: string;
JSONSchemaToTSCustomOptions: JSONSchemaToTSOptions;
};
type CustomTypeParser = (_typeName: string, _schema: ComponentPropertySchema) => Record<string, any>;
type GetStoryblokProvidedPropertyTypeSchemaFn = (title: string) => JSONSchema;
type ComponentGroupsAndNamesObject = {
componentGroups: Map<string, Set<string>>;
componentNames: Set<string>;
};
export type { ComponentGroupsAndNamesObject, ComponentPropertySchema, ComponentPropertySchemaOption, ComponentPropertySchemaType, ComponentPropertyTypeAnnotation, CustomTypeParser, GenerateTSTypedefsFromComponentsJSONSchemasOptions, GenerateTypescriptTypedefsCLIOptions, GetStoryblokProvidedPropertyTypeSchemaFn, JSONSchemaToTSOptions, StoryblokProvidedPropertyType };