UNPKG

@speckle/shared

Version:

Shared code between various Speckle JS packages

547 lines 22 kB
import type { PartialDeep } from 'type-fest'; import { z } from 'zod'; export declare const TRIGGER_DEFINITIONS_SCHEMA_VERSION = 1; export declare const RESULTS_SCHEMA_VERSION = 1; export declare const REDACTED_VALUE = "******"; declare const versionCreatedTriggerDefinition: z.ZodObject<{ type: z.ZodLiteral<"VERSION_CREATED">; modelId: z.ZodString; }, "strip", z.ZodTypeAny, { modelId: string; type: "VERSION_CREATED"; }, { modelId: string; type: "VERSION_CREATED"; }>; export type VersionCreatedTriggerDefinition = z.infer<typeof versionCreatedTriggerDefinition>; declare const triggerDefinitionsSchema: z.ZodObject<{ version: z.ZodLiteral<1>; definitions: z.ZodArray<z.ZodObject<{ type: z.ZodLiteral<"VERSION_CREATED">; modelId: z.ZodString; }, "strip", z.ZodTypeAny, { modelId: string; type: "VERSION_CREATED"; }, { modelId: string; type: "VERSION_CREATED"; }>, "many">; }, "strip", z.ZodTypeAny, { version: 1; definitions: { modelId: string; type: "VERSION_CREATED"; }[]; }, { version: 1; definitions: { modelId: string; type: "VERSION_CREATED"; }[]; }>; export type TriggerDefinitionsSchema = z.infer<typeof triggerDefinitionsSchema>; declare const objectResultLevel: z.ZodUnion<[z.ZodLiteral<"SUCCESS">, z.ZodLiteral<"INFO">, z.ZodLiteral<"WARNING">, z.ZodLiteral<"ERROR">]>; export type ObjectResultLevel = z.infer<typeof objectResultLevel>; export declare const resultSchemaV1: z.ZodObject<{ version: z.ZodLiteral<1>; values: z.ZodObject<{ objectResults: z.ZodArray<z.ZodObject<{ metadata: z.ZodNullable<z.ZodIntersection<z.ZodObject<{ gradient: z.ZodOptional<z.ZodBoolean>; gradientValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{ gradientValue: z.ZodNumber; }, "strip", z.ZodTypeAny, { gradientValue: number; }, { gradientValue: number; }>>>; }, "strip", z.ZodTypeAny, { gradient?: boolean | undefined; gradientValues?: Record<string, { gradientValue: number; }> | undefined; }, { gradient?: boolean | undefined; gradientValues?: Record<string, { gradientValue: number; }> | undefined; }>, z.ZodRecord<z.ZodString, z.ZodUnknown>>>; message: z.ZodNullable<z.ZodString>; category: z.ZodString; level: z.ZodUnion<[z.ZodLiteral<"SUCCESS">, z.ZodLiteral<"INFO">, z.ZodLiteral<"WARNING">, z.ZodLiteral<"ERROR">]>; visualOverrides: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>; objectIds: z.ZodArray<z.ZodString, "many">; }, "strip", z.ZodTypeAny, { metadata: ({ gradient?: boolean | undefined; gradientValues?: Record<string, { gradientValue: number; }> | undefined; } & Record<string, unknown>) | null; message: string | null; category: string; level: "SUCCESS" | "INFO" | "WARNING" | "ERROR"; visualOverrides: Record<string, unknown> | null; objectIds: string[]; }, { metadata: ({ gradient?: boolean | undefined; gradientValues?: Record<string, { gradientValue: number; }> | undefined; } & Record<string, unknown>) | null; message: string | null; category: string; level: "SUCCESS" | "INFO" | "WARNING" | "ERROR"; visualOverrides: Record<string, unknown> | null; objectIds: string[]; }>, "many">; blobIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; }, "strip", z.ZodTypeAny, { objectResults: { metadata: ({ gradient?: boolean | undefined; gradientValues?: Record<string, { gradientValue: number; }> | undefined; } & Record<string, unknown>) | null; message: string | null; category: string; level: "SUCCESS" | "INFO" | "WARNING" | "ERROR"; visualOverrides: Record<string, unknown> | null; objectIds: string[]; }[]; blobIds?: string[] | undefined; }, { objectResults: { metadata: ({ gradient?: boolean | undefined; gradientValues?: Record<string, { gradientValue: number; }> | undefined; } & Record<string, unknown>) | null; message: string | null; category: string; level: "SUCCESS" | "INFO" | "WARNING" | "ERROR"; visualOverrides: Record<string, unknown> | null; objectIds: string[]; }[]; blobIds?: string[] | undefined; }>; }, "strip", z.ZodTypeAny, { values: { objectResults: { metadata: ({ gradient?: boolean | undefined; gradientValues?: Record<string, { gradientValue: number; }> | undefined; } & Record<string, unknown>) | null; message: string | null; category: string; level: "SUCCESS" | "INFO" | "WARNING" | "ERROR"; visualOverrides: Record<string, unknown> | null; objectIds: string[]; }[]; blobIds?: string[] | undefined; }; version: 1; }, { values: { objectResults: { metadata: ({ gradient?: boolean | undefined; gradientValues?: Record<string, { gradientValue: number; }> | undefined; } & Record<string, unknown>) | null; message: string | null; category: string; level: "SUCCESS" | "INFO" | "WARNING" | "ERROR"; visualOverrides: Record<string, unknown> | null; objectIds: string[]; }[]; blobIds?: string[] | undefined; }; version: 1; }>; export type ResultSchemaV1 = z.infer<typeof resultSchemaV1>; export declare const resultSchemaV2: z.ZodObject<{ version: z.ZodLiteral<2>; values: z.ZodObject<{ objectResults: z.ZodArray<z.ZodObject<{ metadata: z.ZodNullable<z.ZodIntersection<z.ZodObject<{ gradient: z.ZodOptional<z.ZodBoolean>; gradientValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{ gradientValue: z.ZodNumber; }, "strip", z.ZodTypeAny, { gradientValue: number; }, { gradientValue: number; }>>>; }, "strip", z.ZodTypeAny, { gradient?: boolean | undefined; gradientValues?: Record<string, { gradientValue: number; }> | undefined; }, { gradient?: boolean | undefined; gradientValues?: Record<string, { gradientValue: number; }> | undefined; }>, z.ZodRecord<z.ZodString, z.ZodUnknown>>>; message: z.ZodNullable<z.ZodString>; category: z.ZodString; level: z.ZodUnion<[z.ZodLiteral<"SUCCESS">, z.ZodLiteral<"INFO">, z.ZodLiteral<"WARNING">, z.ZodLiteral<"ERROR">]>; visualOverrides: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>; objectAppIds: z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodString>>; }, "strip", z.ZodTypeAny, { metadata: ({ gradient?: boolean | undefined; gradientValues?: Record<string, { gradientValue: number; }> | undefined; } & Record<string, unknown>) | null; message: string | null; category: string; level: "SUCCESS" | "INFO" | "WARNING" | "ERROR"; visualOverrides: Record<string, unknown> | null; objectAppIds: Record<string, string | null>; }, { metadata: ({ gradient?: boolean | undefined; gradientValues?: Record<string, { gradientValue: number; }> | undefined; } & Record<string, unknown>) | null; message: string | null; category: string; level: "SUCCESS" | "INFO" | "WARNING" | "ERROR"; visualOverrides: Record<string, unknown> | null; objectAppIds: Record<string, string | null>; }>, "many">; blobIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; }, "strip", z.ZodTypeAny, { objectResults: { metadata: ({ gradient?: boolean | undefined; gradientValues?: Record<string, { gradientValue: number; }> | undefined; } & Record<string, unknown>) | null; message: string | null; category: string; level: "SUCCESS" | "INFO" | "WARNING" | "ERROR"; visualOverrides: Record<string, unknown> | null; objectAppIds: Record<string, string | null>; }[]; blobIds?: string[] | undefined; }, { objectResults: { metadata: ({ gradient?: boolean | undefined; gradientValues?: Record<string, { gradientValue: number; }> | undefined; } & Record<string, unknown>) | null; message: string | null; category: string; level: "SUCCESS" | "INFO" | "WARNING" | "ERROR"; visualOverrides: Record<string, unknown> | null; objectAppIds: Record<string, string | null>; }[]; blobIds?: string[] | undefined; }>; }, "strip", z.ZodTypeAny, { values: { objectResults: { metadata: ({ gradient?: boolean | undefined; gradientValues?: Record<string, { gradientValue: number; }> | undefined; } & Record<string, unknown>) | null; message: string | null; category: string; level: "SUCCESS" | "INFO" | "WARNING" | "ERROR"; visualOverrides: Record<string, unknown> | null; objectAppIds: Record<string, string | null>; }[]; blobIds?: string[] | undefined; }; version: 2; }, { values: { objectResults: { metadata: ({ gradient?: boolean | undefined; gradientValues?: Record<string, { gradientValue: number; }> | undefined; } & Record<string, unknown>) | null; message: string | null; category: string; level: "SUCCESS" | "INFO" | "WARNING" | "ERROR"; visualOverrides: Record<string, unknown> | null; objectAppIds: Record<string, string | null>; }[]; blobIds?: string[] | undefined; }; version: 2; }>; export declare const resultSchema: z.ZodDiscriminatedUnion<"version", [z.ZodObject<{ version: z.ZodLiteral<1>; values: z.ZodObject<{ objectResults: z.ZodArray<z.ZodObject<{ metadata: z.ZodNullable<z.ZodIntersection<z.ZodObject<{ gradient: z.ZodOptional<z.ZodBoolean>; gradientValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{ gradientValue: z.ZodNumber; }, "strip", z.ZodTypeAny, { gradientValue: number; }, { gradientValue: number; }>>>; }, "strip", z.ZodTypeAny, { gradient?: boolean | undefined; gradientValues?: Record<string, { gradientValue: number; }> | undefined; }, { gradient?: boolean | undefined; gradientValues?: Record<string, { gradientValue: number; }> | undefined; }>, z.ZodRecord<z.ZodString, z.ZodUnknown>>>; message: z.ZodNullable<z.ZodString>; category: z.ZodString; level: z.ZodUnion<[z.ZodLiteral<"SUCCESS">, z.ZodLiteral<"INFO">, z.ZodLiteral<"WARNING">, z.ZodLiteral<"ERROR">]>; visualOverrides: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>; objectIds: z.ZodArray<z.ZodString, "many">; }, "strip", z.ZodTypeAny, { metadata: ({ gradient?: boolean | undefined; gradientValues?: Record<string, { gradientValue: number; }> | undefined; } & Record<string, unknown>) | null; message: string | null; category: string; level: "SUCCESS" | "INFO" | "WARNING" | "ERROR"; visualOverrides: Record<string, unknown> | null; objectIds: string[]; }, { metadata: ({ gradient?: boolean | undefined; gradientValues?: Record<string, { gradientValue: number; }> | undefined; } & Record<string, unknown>) | null; message: string | null; category: string; level: "SUCCESS" | "INFO" | "WARNING" | "ERROR"; visualOverrides: Record<string, unknown> | null; objectIds: string[]; }>, "many">; blobIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; }, "strip", z.ZodTypeAny, { objectResults: { metadata: ({ gradient?: boolean | undefined; gradientValues?: Record<string, { gradientValue: number; }> | undefined; } & Record<string, unknown>) | null; message: string | null; category: string; level: "SUCCESS" | "INFO" | "WARNING" | "ERROR"; visualOverrides: Record<string, unknown> | null; objectIds: string[]; }[]; blobIds?: string[] | undefined; }, { objectResults: { metadata: ({ gradient?: boolean | undefined; gradientValues?: Record<string, { gradientValue: number; }> | undefined; } & Record<string, unknown>) | null; message: string | null; category: string; level: "SUCCESS" | "INFO" | "WARNING" | "ERROR"; visualOverrides: Record<string, unknown> | null; objectIds: string[]; }[]; blobIds?: string[] | undefined; }>; }, "strip", z.ZodTypeAny, { values: { objectResults: { metadata: ({ gradient?: boolean | undefined; gradientValues?: Record<string, { gradientValue: number; }> | undefined; } & Record<string, unknown>) | null; message: string | null; category: string; level: "SUCCESS" | "INFO" | "WARNING" | "ERROR"; visualOverrides: Record<string, unknown> | null; objectIds: string[]; }[]; blobIds?: string[] | undefined; }; version: 1; }, { values: { objectResults: { metadata: ({ gradient?: boolean | undefined; gradientValues?: Record<string, { gradientValue: number; }> | undefined; } & Record<string, unknown>) | null; message: string | null; category: string; level: "SUCCESS" | "INFO" | "WARNING" | "ERROR"; visualOverrides: Record<string, unknown> | null; objectIds: string[]; }[]; blobIds?: string[] | undefined; }; version: 1; }>, z.ZodObject<{ version: z.ZodLiteral<2>; values: z.ZodObject<{ objectResults: z.ZodArray<z.ZodObject<{ metadata: z.ZodNullable<z.ZodIntersection<z.ZodObject<{ gradient: z.ZodOptional<z.ZodBoolean>; gradientValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{ gradientValue: z.ZodNumber; }, "strip", z.ZodTypeAny, { gradientValue: number; }, { gradientValue: number; }>>>; }, "strip", z.ZodTypeAny, { gradient?: boolean | undefined; gradientValues?: Record<string, { gradientValue: number; }> | undefined; }, { gradient?: boolean | undefined; gradientValues?: Record<string, { gradientValue: number; }> | undefined; }>, z.ZodRecord<z.ZodString, z.ZodUnknown>>>; message: z.ZodNullable<z.ZodString>; category: z.ZodString; level: z.ZodUnion<[z.ZodLiteral<"SUCCESS">, z.ZodLiteral<"INFO">, z.ZodLiteral<"WARNING">, z.ZodLiteral<"ERROR">]>; visualOverrides: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>; objectAppIds: z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodString>>; }, "strip", z.ZodTypeAny, { metadata: ({ gradient?: boolean | undefined; gradientValues?: Record<string, { gradientValue: number; }> | undefined; } & Record<string, unknown>) | null; message: string | null; category: string; level: "SUCCESS" | "INFO" | "WARNING" | "ERROR"; visualOverrides: Record<string, unknown> | null; objectAppIds: Record<string, string | null>; }, { metadata: ({ gradient?: boolean | undefined; gradientValues?: Record<string, { gradientValue: number; }> | undefined; } & Record<string, unknown>) | null; message: string | null; category: string; level: "SUCCESS" | "INFO" | "WARNING" | "ERROR"; visualOverrides: Record<string, unknown> | null; objectAppIds: Record<string, string | null>; }>, "many">; blobIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; }, "strip", z.ZodTypeAny, { objectResults: { metadata: ({ gradient?: boolean | undefined; gradientValues?: Record<string, { gradientValue: number; }> | undefined; } & Record<string, unknown>) | null; message: string | null; category: string; level: "SUCCESS" | "INFO" | "WARNING" | "ERROR"; visualOverrides: Record<string, unknown> | null; objectAppIds: Record<string, string | null>; }[]; blobIds?: string[] | undefined; }, { objectResults: { metadata: ({ gradient?: boolean | undefined; gradientValues?: Record<string, { gradientValue: number; }> | undefined; } & Record<string, unknown>) | null; message: string | null; category: string; level: "SUCCESS" | "INFO" | "WARNING" | "ERROR"; visualOverrides: Record<string, unknown> | null; objectAppIds: Record<string, string | null>; }[]; blobIds?: string[] | undefined; }>; }, "strip", z.ZodTypeAny, { values: { objectResults: { metadata: ({ gradient?: boolean | undefined; gradientValues?: Record<string, { gradientValue: number; }> | undefined; } & Record<string, unknown>) | null; message: string | null; category: string; level: "SUCCESS" | "INFO" | "WARNING" | "ERROR"; visualOverrides: Record<string, unknown> | null; objectAppIds: Record<string, string | null>; }[]; blobIds?: string[] | undefined; }; version: 2; }, { values: { objectResults: { metadata: ({ gradient?: boolean | undefined; gradientValues?: Record<string, { gradientValue: number; }> | undefined; } & Record<string, unknown>) | null; message: string | null; category: string; level: "SUCCESS" | "INFO" | "WARNING" | "ERROR"; visualOverrides: Record<string, unknown> | null; objectAppIds: Record<string, string | null>; }[]; blobIds?: string[] | undefined; }; version: 2; }>]>; export type ResultSchemaV2 = z.infer<typeof resultSchemaV2>; export type ResultsSchema = z.infer<typeof resultSchema>; type UnformattedTriggerDefinitionSchema = PartialDeep<TriggerDefinitionsSchema>; type UnformattedResultsSchema = PartialDeep<ResultsSchema>; export declare const isVersionCreatedTriggerDefinition: (val: unknown) => val is VersionCreatedTriggerDefinition; export declare const isTriggerDefinitionSchema: (val: unknown) => val is TriggerDefinitionsSchema; export declare const formatTriggerDefinitionSchema: (state: UnformattedTriggerDefinitionSchema) => TriggerDefinitionsSchema; export declare const isResultsSchema: (val: unknown) => val is ResultsSchema; export declare const formatResultsSchema: (state: UnformattedResultsSchema) => ResultsSchema; export {}; //# sourceMappingURL=types.d.ts.map