@allmaps/annotation
Version:
Functions for generating and parsing IIIF georeference annotations
613 lines (612 loc) • 21.6 kB
TypeScript
import { z } from 'zod';
export declare const SvgSelectorSchema: z.ZodObject<{
type: z.ZodLiteral<"SvgSelector">;
value: z.ZodString;
}, "strip", z.ZodTypeAny, {
type: "SvgSelector";
value: string;
}, {
type: "SvgSelector";
value: string;
}>;
export declare const TargetSchema: z.ZodObject<{
source: z.ZodString;
service: z.ZodArray<z.ZodObject<{
'@id': z.ZodString;
type: z.ZodEnum<["ImageService1", "ImageService2", "ImageService3", "Canvas"]>;
}, "strip", z.ZodTypeAny, {
type: "ImageService1" | "ImageService2" | "ImageService3" | "Canvas";
'@id': string;
}, {
type: "ImageService1" | "ImageService2" | "ImageService3" | "Canvas";
'@id': string;
}>, "many">;
selector: z.ZodObject<{
type: z.ZodLiteral<"SvgSelector">;
value: z.ZodString;
}, "strip", z.ZodTypeAny, {
type: "SvgSelector";
value: string;
}, {
type: "SvgSelector";
value: string;
}>;
}, "strip", z.ZodTypeAny, {
source: string;
service: {
type: "ImageService1" | "ImageService2" | "ImageService3" | "Canvas";
'@id': string;
}[];
selector: {
type: "SvgSelector";
value: string;
};
}, {
source: string;
service: {
type: "ImageService1" | "ImageService2" | "ImageService3" | "Canvas";
'@id': string;
}[];
selector: {
type: "SvgSelector";
value: string;
};
}>;
export declare const FeaturePropertiesSchema: z.ZodObject<{
pixelCoords: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
}, "strip", z.ZodTypeAny, {
pixelCoords: [number, number];
}, {
pixelCoords: [number, number];
}>;
export declare const BodySchema: z.ZodObject<{
type: z.ZodLiteral<"FeatureCollection">;
transformation: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodObject<{
type: z.ZodEnum<["helmert", "polynomial", "thinPlateSpline", "projective", "straight", "linear"]>;
options: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
}, "strip", z.ZodTypeAny, {
type: "helmert" | "polynomial" | "thinPlateSpline" | "projective" | "straight" | "linear";
options?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
}, {
type: "helmert" | "polynomial" | "thinPlateSpline" | "projective" | "straight" | "linear";
options?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
}>, z.ZodUnknown]>, {
type: "helmert" | "polynomial" | "thinPlateSpline" | "projective" | "straight" | "linear";
options?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
} | undefined, unknown>>;
features: z.ZodArray<z.ZodObject<{
type: z.ZodLiteral<"Feature">;
properties: z.ZodObject<{
pixelCoords: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
}, "strip", z.ZodTypeAny, {
pixelCoords: [number, number];
}, {
pixelCoords: [number, number];
}>;
geometry: z.ZodObject<{
type: z.ZodLiteral<"Point">;
coordinates: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
}, "strip", z.ZodTypeAny, {
type: "Point";
coordinates: [number, number];
}, {
type: "Point";
coordinates: [number, number];
}>;
}, "strip", z.ZodTypeAny, {
type: "Feature";
properties: {
pixelCoords: [number, number];
};
geometry: {
type: "Point";
coordinates: [number, number];
};
}, {
type: "Feature";
properties: {
pixelCoords: [number, number];
};
geometry: {
type: "Point";
coordinates: [number, number];
};
}>, "many">;
}, "strip", z.ZodTypeAny, {
type: "FeatureCollection";
features: {
type: "Feature";
properties: {
pixelCoords: [number, number];
};
geometry: {
type: "Point";
coordinates: [number, number];
};
}[];
transformation?: {
type: "helmert" | "polynomial" | "thinPlateSpline" | "projective" | "straight" | "linear";
options?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
} | undefined;
}, {
type: "FeatureCollection";
features: {
type: "Feature";
properties: {
pixelCoords: [number, number];
};
geometry: {
type: "Point";
coordinates: [number, number];
};
}[];
transformation?: unknown;
}>;
export declare const AnnotationSchema: z.ZodObject<{
id: z.ZodOptional<z.ZodString>;
type: z.ZodLiteral<"Annotation">;
'@context': z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString]>>;
motivation: z.ZodOptional<z.ZodDefault<z.ZodString>>;
target: z.ZodObject<{
source: z.ZodString;
service: z.ZodArray<z.ZodObject<{
'@id': z.ZodString;
type: z.ZodEnum<["ImageService1", "ImageService2", "ImageService3", "Canvas"]>;
}, "strip", z.ZodTypeAny, {
type: "ImageService1" | "ImageService2" | "ImageService3" | "Canvas";
'@id': string;
}, {
type: "ImageService1" | "ImageService2" | "ImageService3" | "Canvas";
'@id': string;
}>, "many">;
selector: z.ZodObject<{
type: z.ZodLiteral<"SvgSelector">;
value: z.ZodString;
}, "strip", z.ZodTypeAny, {
type: "SvgSelector";
value: string;
}, {
type: "SvgSelector";
value: string;
}>;
}, "strip", z.ZodTypeAny, {
source: string;
service: {
type: "ImageService1" | "ImageService2" | "ImageService3" | "Canvas";
'@id': string;
}[];
selector: {
type: "SvgSelector";
value: string;
};
}, {
source: string;
service: {
type: "ImageService1" | "ImageService2" | "ImageService3" | "Canvas";
'@id': string;
}[];
selector: {
type: "SvgSelector";
value: string;
};
}>;
body: z.ZodObject<{
type: z.ZodLiteral<"FeatureCollection">;
transformation: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodObject<{
type: z.ZodEnum<["helmert", "polynomial", "thinPlateSpline", "projective", "straight", "linear"]>;
options: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
}, "strip", z.ZodTypeAny, {
type: "helmert" | "polynomial" | "thinPlateSpline" | "projective" | "straight" | "linear";
options?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
}, {
type: "helmert" | "polynomial" | "thinPlateSpline" | "projective" | "straight" | "linear";
options?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
}>, z.ZodUnknown]>, {
type: "helmert" | "polynomial" | "thinPlateSpline" | "projective" | "straight" | "linear";
options?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
} | undefined, unknown>>;
features: z.ZodArray<z.ZodObject<{
type: z.ZodLiteral<"Feature">;
properties: z.ZodObject<{
pixelCoords: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
}, "strip", z.ZodTypeAny, {
pixelCoords: [number, number];
}, {
pixelCoords: [number, number];
}>;
geometry: z.ZodObject<{
type: z.ZodLiteral<"Point">;
coordinates: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
}, "strip", z.ZodTypeAny, {
type: "Point";
coordinates: [number, number];
}, {
type: "Point";
coordinates: [number, number];
}>;
}, "strip", z.ZodTypeAny, {
type: "Feature";
properties: {
pixelCoords: [number, number];
};
geometry: {
type: "Point";
coordinates: [number, number];
};
}, {
type: "Feature";
properties: {
pixelCoords: [number, number];
};
geometry: {
type: "Point";
coordinates: [number, number];
};
}>, "many">;
}, "strip", z.ZodTypeAny, {
type: "FeatureCollection";
features: {
type: "Feature";
properties: {
pixelCoords: [number, number];
};
geometry: {
type: "Point";
coordinates: [number, number];
};
}[];
transformation?: {
type: "helmert" | "polynomial" | "thinPlateSpline" | "projective" | "straight" | "linear";
options?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
} | undefined;
}, {
type: "FeatureCollection";
features: {
type: "Feature";
properties: {
pixelCoords: [number, number];
};
geometry: {
type: "Point";
coordinates: [number, number];
};
}[];
transformation?: unknown;
}>;
}, "strip", z.ZodTypeAny, {
type: "Annotation";
target: {
source: string;
service: {
type: "ImageService1" | "ImageService2" | "ImageService3" | "Canvas";
'@id': string;
}[];
selector: {
type: "SvgSelector";
value: string;
};
};
body: {
type: "FeatureCollection";
features: {
type: "Feature";
properties: {
pixelCoords: [number, number];
};
geometry: {
type: "Point";
coordinates: [number, number];
};
}[];
transformation?: {
type: "helmert" | "polynomial" | "thinPlateSpline" | "projective" | "straight" | "linear";
options?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
} | undefined;
};
id?: string | undefined;
'@context'?: string | string[] | undefined;
motivation?: string | undefined;
}, {
type: "Annotation";
target: {
source: string;
service: {
type: "ImageService1" | "ImageService2" | "ImageService3" | "Canvas";
'@id': string;
}[];
selector: {
type: "SvgSelector";
value: string;
};
};
body: {
type: "FeatureCollection";
features: {
type: "Feature";
properties: {
pixelCoords: [number, number];
};
geometry: {
type: "Point";
coordinates: [number, number];
};
}[];
transformation?: unknown;
};
id?: string | undefined;
'@context'?: string | string[] | undefined;
motivation?: string | undefined;
}>;
export declare const AnnotationPageSchema: z.ZodObject<{
id: z.ZodOptional<z.ZodString>;
type: z.ZodLiteral<"AnnotationPage">;
'@context': z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString]>>;
items: z.ZodArray<z.ZodObject<{
id: z.ZodOptional<z.ZodString>;
type: z.ZodLiteral<"Annotation">;
'@context': z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString]>>;
motivation: z.ZodOptional<z.ZodDefault<z.ZodString>>;
target: z.ZodObject<{
source: z.ZodString;
service: z.ZodArray<z.ZodObject<{
'@id': z.ZodString;
type: z.ZodEnum<["ImageService1", "ImageService2", "ImageService3", "Canvas"]>;
}, "strip", z.ZodTypeAny, {
type: "ImageService1" | "ImageService2" | "ImageService3" | "Canvas";
'@id': string;
}, {
type: "ImageService1" | "ImageService2" | "ImageService3" | "Canvas";
'@id': string;
}>, "many">;
selector: z.ZodObject<{
type: z.ZodLiteral<"SvgSelector">;
value: z.ZodString;
}, "strip", z.ZodTypeAny, {
type: "SvgSelector";
value: string;
}, {
type: "SvgSelector";
value: string;
}>;
}, "strip", z.ZodTypeAny, {
source: string;
service: {
type: "ImageService1" | "ImageService2" | "ImageService3" | "Canvas";
'@id': string;
}[];
selector: {
type: "SvgSelector";
value: string;
};
}, {
source: string;
service: {
type: "ImageService1" | "ImageService2" | "ImageService3" | "Canvas";
'@id': string;
}[];
selector: {
type: "SvgSelector";
value: string;
};
}>;
body: z.ZodObject<{
type: z.ZodLiteral<"FeatureCollection">;
transformation: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodObject<{
type: z.ZodEnum<["helmert", "polynomial", "thinPlateSpline", "projective", "straight", "linear"]>;
options: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
}, "strip", z.ZodTypeAny, {
type: "helmert" | "polynomial" | "thinPlateSpline" | "projective" | "straight" | "linear";
options?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
}, {
type: "helmert" | "polynomial" | "thinPlateSpline" | "projective" | "straight" | "linear";
options?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
}>, z.ZodUnknown]>, {
type: "helmert" | "polynomial" | "thinPlateSpline" | "projective" | "straight" | "linear";
options?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
} | undefined, unknown>>;
features: z.ZodArray<z.ZodObject<{
type: z.ZodLiteral<"Feature">;
properties: z.ZodObject<{
pixelCoords: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
}, "strip", z.ZodTypeAny, {
pixelCoords: [number, number];
}, {
pixelCoords: [number, number];
}>;
geometry: z.ZodObject<{
type: z.ZodLiteral<"Point">;
coordinates: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
}, "strip", z.ZodTypeAny, {
type: "Point";
coordinates: [number, number];
}, {
type: "Point";
coordinates: [number, number];
}>;
}, "strip", z.ZodTypeAny, {
type: "Feature";
properties: {
pixelCoords: [number, number];
};
geometry: {
type: "Point";
coordinates: [number, number];
};
}, {
type: "Feature";
properties: {
pixelCoords: [number, number];
};
geometry: {
type: "Point";
coordinates: [number, number];
};
}>, "many">;
}, "strip", z.ZodTypeAny, {
type: "FeatureCollection";
features: {
type: "Feature";
properties: {
pixelCoords: [number, number];
};
geometry: {
type: "Point";
coordinates: [number, number];
};
}[];
transformation?: {
type: "helmert" | "polynomial" | "thinPlateSpline" | "projective" | "straight" | "linear";
options?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
} | undefined;
}, {
type: "FeatureCollection";
features: {
type: "Feature";
properties: {
pixelCoords: [number, number];
};
geometry: {
type: "Point";
coordinates: [number, number];
};
}[];
transformation?: unknown;
}>;
}, "strip", z.ZodTypeAny, {
type: "Annotation";
target: {
source: string;
service: {
type: "ImageService1" | "ImageService2" | "ImageService3" | "Canvas";
'@id': string;
}[];
selector: {
type: "SvgSelector";
value: string;
};
};
body: {
type: "FeatureCollection";
features: {
type: "Feature";
properties: {
pixelCoords: [number, number];
};
geometry: {
type: "Point";
coordinates: [number, number];
};
}[];
transformation?: {
type: "helmert" | "polynomial" | "thinPlateSpline" | "projective" | "straight" | "linear";
options?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
} | undefined;
};
id?: string | undefined;
'@context'?: string | string[] | undefined;
motivation?: string | undefined;
}, {
type: "Annotation";
target: {
source: string;
service: {
type: "ImageService1" | "ImageService2" | "ImageService3" | "Canvas";
'@id': string;
}[];
selector: {
type: "SvgSelector";
value: string;
};
};
body: {
type: "FeatureCollection";
features: {
type: "Feature";
properties: {
pixelCoords: [number, number];
};
geometry: {
type: "Point";
coordinates: [number, number];
};
}[];
transformation?: unknown;
};
id?: string | undefined;
'@context'?: string | string[] | undefined;
motivation?: string | undefined;
}>, "many">;
}, "strip", z.ZodTypeAny, {
type: "AnnotationPage";
items: {
type: "Annotation";
target: {
source: string;
service: {
type: "ImageService1" | "ImageService2" | "ImageService3" | "Canvas";
'@id': string;
}[];
selector: {
type: "SvgSelector";
value: string;
};
};
body: {
type: "FeatureCollection";
features: {
type: "Feature";
properties: {
pixelCoords: [number, number];
};
geometry: {
type: "Point";
coordinates: [number, number];
};
}[];
transformation?: {
type: "helmert" | "polynomial" | "thinPlateSpline" | "projective" | "straight" | "linear";
options?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
} | undefined;
};
id?: string | undefined;
'@context'?: string | string[] | undefined;
motivation?: string | undefined;
}[];
id?: string | undefined;
'@context'?: string | string[] | undefined;
}, {
type: "AnnotationPage";
items: {
type: "Annotation";
target: {
source: string;
service: {
type: "ImageService1" | "ImageService2" | "ImageService3" | "Canvas";
'@id': string;
}[];
selector: {
type: "SvgSelector";
value: string;
};
};
body: {
type: "FeatureCollection";
features: {
type: "Feature";
properties: {
pixelCoords: [number, number];
};
geometry: {
type: "Point";
coordinates: [number, number];
};
}[];
transformation?: unknown;
};
id?: string | undefined;
'@context'?: string | string[] | undefined;
motivation?: string | undefined;
}[];
id?: string | undefined;
'@context'?: string | string[] | undefined;
}>;