import { z } from 'zod'; export type MoteId = Id; export type SchemaId = Id; export type UidPoolId = Id; export interface PackedData { commitId: string; uid_pools: { [id: UidPoolId]: UidPool; }; changes?: unknown; motes: { [id: MoteId]: Mote; }; schemas: { [id: SchemaId]: Bschema; }; } export interface UidPool { id: UidPoolId; history: number[]; type: 'u16'; } export interface Mote { id: MoteId; uid: UidPool; /** The actual data, as described by the schema */ data: T; schema_id: S; /** MoteId of the parent mote */ parent?: MoteId; /** Path to the field holding a sprite name */ sprite?: string; /** * path relative to the parent, or to the root if there is not parent * of folders */ folder?: string; } export type BschemaTypeName = 'object' | 'string' | 'null' | '$ref' | 'bConst' | 'enum' | 'boolean' | 'number' | 'integer' | 'array'; export type Bschema = BschemaObject | BschemaL10nString | BschemaString | BschemaMoteId | BschemaNull | BschemaRef | BschemaConst | BschemaEnum | BschemaBoolean | BschemaNumber | BschemaInteger | BschemaBsArray; export declare function getProperties(schema: Bschema | undefined): BschemaObject['properties'] | undefined; export declare function getAdditionalProperties(schema: Bschema | undefined): Bschema | undefined; export declare function isBschemaRef(schema: any): schema is BschemaRef; export declare function isBschemaObject(schema: any): schema is BschemaObject; export declare function isBschemaEnum(schema: any): schema is BschemaEnum; export declare function isBschemaConst(schema: any): schema is BschemaConst; export declare function isBschemaString(schema: any): schema is BschemaString; export declare function isBschemaBoolean(schema: any): schema is BschemaBoolean; export declare function isBschemaNumeric(schema: any): schema is BschemaNumber | BschemaInteger; interface BschemaBase { $id?: SchemaId; type?: BschemaTypeName; defaultValue?: string; hydratorId?: string; /** * A partial schema that will overwrite fields of the current one */ overrides?: any; /** * Internal pointer to the field that holds the mote's name */ name?: string; title?: string; description?: string; access?: string; order?: string; collapsible?: string; copyable?: string; convertible?: string; group?: string; } export interface BschemaObject extends BschemaBase { type: 'object'; properties?: { [key: string]: Bschema; }; required?: string[]; additionalProperties?: Bschema; discriminator?: { propertyName: string; }; minProperties?: number; maxProperties?: number; uniqueValues?: string[]; oneOf?: Bschema[]; } export interface BschemaNull extends BschemaBase { type: 'null'; } export interface BschemaRoot extends BschemaObject { sortPath?: string; status?: string; uidPool?: UidPoolId; subschema?: boolean; sprite?: string; } export interface BschemaRef extends BschemaBase { type?: '$ref'; $ref: string; } export interface BschemaConst extends BschemaBase { type?: 'bConst'; bConst: any; } export interface BschemaEnum extends BschemaBase { type?: 'enum'; enum: any[]; } export interface BschemaString extends BschemaBase { type: 'string'; minLength?: number; maxLength?: number; /** * A substring that the string must contain */ stringContains?: string; } export interface BschemaL10nString extends BschemaString { format: 'l10n'; } export interface BschemaMoteId extends BschemaString { format: 'moteId'; formatProperties?: { blockSchemas?: SchemaId[]; allowSchemas?: SchemaId[]; blockMotes?: MoteId[]; allowMotes?: MoteId[]; allowLooping?: boolean; validationSchema?: Bschema; }; } export interface BschemaBoolean extends BschemaBase { type: 'boolean'; } interface BschemaNumberBase extends BschemaBase { minimum?: number; exclusiveMinimum?: number; maximum?: number; exclusiveMaximum?: number; multipleOf?: number; percent?: boolean; slider?: boolean; percentSlider?: boolean; arrayOrder?: boolean; arraySlot?: boolean; } export interface BschemaNumber extends BschemaNumberBase { type: 'number'; } export interface BschemaInteger extends BschemaNumberBase { type: 'integer'; } export interface BschemaBsArrayElement extends BschemaObject { format: 'bsArrayElement'; type: 'object'; properties: { order: BschemaNumber; element: Bschema; }; } export interface BschemaBsArray extends BschemaObject { format: 'bsArray'; uniqueValue: ['element']; additionalProperties: BschemaBsArrayElement; } export type ChangeType = z.infer; declare const changeTypeSchema: z.ZodUnion, z.ZodLiteral<"deleted">, z.ZodLiteral<"changed">]>; export type Change = z.infer; export declare const changeSchema: z.ZodObject<{ mote_id: z.ZodOptional; schema_id: z.ZodString; type: z.ZodUnion, z.ZodLiteral<"deleted">, z.ZodLiteral<"changed">]>; schema_title: z.ZodOptional; mote_name: z.ZodOptional; allowed: z.ZodDefault>; staged: z.ZodDefault>; diffs: z.ZodOptional>>; }, z.core.$loose>; export type Changes = z.infer; export declare const changesSchema: z.ZodObject<{ commitId: z.ZodString; changes: z.ZodObject<{ message: z.ZodString; motes: z.ZodDefault; schema_id: z.ZodString; type: z.ZodUnion, z.ZodLiteral<"deleted">, z.ZodLiteral<"changed">]>; schema_title: z.ZodOptional; mote_name: z.ZodOptional; allowed: z.ZodDefault>; staged: z.ZodDefault>; diffs: z.ZodOptional>>; }, z.core.$loose>>>; schemas: z.ZodDefault; schema_id: z.ZodString; type: z.ZodUnion, z.ZodLiteral<"deleted">, z.ZodLiteral<"changed">]>; schema_title: z.ZodOptional; mote_name: z.ZodOptional; allowed: z.ZodDefault>; staged: z.ZodDefault>; diffs: z.ZodOptional>>; }, z.core.$loose>>>; conflicts: z.ZodObject<{ motes: z.ZodDefault>; schemas: z.ZodDefault>; }, z.core.$loose>; }, z.core.$strip>; }, z.core.$loose>; export declare function isObject(value: unknown): value is Exclude; export {}; //# sourceMappingURL=types.d.ts.map