@allmaps/annotation
Version:
Functions for generating and parsing IIIF georeference annotations
619 lines (618 loc) • 23 kB
TypeScript
import { z } from 'zod';
export declare const GCPSchema: z.ZodObject<{
resource: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
geo: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
}, "strip", z.ZodTypeAny, {
resource: [number, number];
geo: [number, number];
}, {
resource: [number, number];
geo: [number, number];
}>;
export declare const ResourceSchema: z.ZodObject<{
id: z.ZodString;
height: z.ZodOptional<z.ZodNumber>;
width: z.ZodOptional<z.ZodNumber>;
type: z.ZodEnum<["ImageService1", "ImageService2", "ImageService3", "Canvas"]>;
partOf: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodArray<z.ZodType<{
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & {
partOf?: ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & /*elided*/ any)[];
}, z.ZodTypeDef, {
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & {
partOf?: ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & /*elided*/ any)[];
}>, "many">, z.ZodType<{
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & {
partOf?: ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & /*elided*/ any)[];
}, z.ZodTypeDef, {
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & {
partOf?: ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & /*elided*/ any)[];
}>]>, ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & {
partOf?: ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & /*elided*/ any)[];
})[] | undefined, ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & {
partOf?: ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & /*elided*/ any)[];
}) | ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & {
partOf?: ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & /*elided*/ any)[];
})[]>>;
}, "strip", z.ZodTypeAny, {
id: string;
type: "ImageService1" | "ImageService2" | "ImageService3" | "Canvas";
height?: number | undefined;
width?: number | undefined;
partOf?: ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & {
partOf?: ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & /*elided*/ any)[];
})[] | undefined;
}, {
id: string;
type: "ImageService1" | "ImageService2" | "ImageService3" | "Canvas";
height?: number | undefined;
width?: number | undefined;
partOf?: ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & {
partOf?: ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & /*elided*/ any)[];
}) | ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & {
partOf?: ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & /*elided*/ any)[];
})[] | undefined;
}>;
export declare const GeoreferencedMapSchema: z.ZodObject<{
'@context': z.ZodOptional<z.ZodLiteral<"https://schemas.allmaps.org/map/2/context.json">>;
type: z.ZodLiteral<"GeoreferencedMap">;
id: z.ZodOptional<z.ZodString>;
created: z.ZodOptional<z.ZodString>;
modified: z.ZodOptional<z.ZodString>;
resource: z.ZodObject<{
id: z.ZodString;
height: z.ZodOptional<z.ZodNumber>;
width: z.ZodOptional<z.ZodNumber>;
type: z.ZodEnum<["ImageService1", "ImageService2", "ImageService3", "Canvas"]>;
partOf: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodArray<z.ZodType<{
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & {
partOf?: ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & /*elided*/ any)[];
}, z.ZodTypeDef, {
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & {
partOf?: ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & /*elided*/ any)[];
}>, "many">, z.ZodType<{
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & {
partOf?: ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & /*elided*/ any)[];
}, z.ZodTypeDef, {
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & {
partOf?: ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & /*elided*/ any)[];
}>]>, ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & {
partOf?: ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & /*elided*/ any)[];
})[] | undefined, ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & {
partOf?: ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & /*elided*/ any)[];
}) | ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & {
partOf?: ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & /*elided*/ any)[];
})[]>>;
}, "strip", z.ZodTypeAny, {
id: string;
type: "ImageService1" | "ImageService2" | "ImageService3" | "Canvas";
height?: number | undefined;
width?: number | undefined;
partOf?: ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & {
partOf?: ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & /*elided*/ any)[];
})[] | undefined;
}, {
id: string;
type: "ImageService1" | "ImageService2" | "ImageService3" | "Canvas";
height?: number | undefined;
width?: number | undefined;
partOf?: ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & {
partOf?: ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & /*elided*/ any)[];
}) | ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & {
partOf?: ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & /*elided*/ any)[];
})[] | undefined;
}>;
gcps: z.ZodArray<z.ZodObject<{
resource: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
geo: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
}, "strip", z.ZodTypeAny, {
resource: [number, number];
geo: [number, number];
}, {
resource: [number, number];
geo: [number, number];
}>, "many">;
resourceMask: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, "many">;
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>>;
resourceCrs: z.ZodOptional<z.ZodObject<{
id: z.ZodOptional<z.ZodString>;
name: z.ZodOptional<z.ZodString>;
definition: z.ZodUnion<[z.ZodString, z.ZodUnknown]>;
}, "strip", z.ZodTypeAny, {
id?: string | undefined;
name?: string | undefined;
definition?: unknown;
}, {
id?: string | undefined;
name?: string | undefined;
definition?: unknown;
}>>;
}, "strip", z.ZodTypeAny, {
type: "GeoreferencedMap";
resource: {
id: string;
type: "ImageService1" | "ImageService2" | "ImageService3" | "Canvas";
height?: number | undefined;
width?: number | undefined;
partOf?: ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & {
partOf?: ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & /*elided*/ any)[];
})[] | undefined;
};
gcps: {
resource: [number, number];
geo: [number, number];
}[];
resourceMask: [number, number][];
id?: string | undefined;
'@context'?: "https://schemas.allmaps.org/map/2/context.json" | undefined;
transformation?: {
type: "helmert" | "polynomial" | "thinPlateSpline" | "projective" | "straight" | "linear";
options?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
} | undefined;
created?: string | undefined;
modified?: string | undefined;
resourceCrs?: {
id?: string | undefined;
name?: string | undefined;
definition?: unknown;
} | undefined;
}, {
type: "GeoreferencedMap";
resource: {
id: string;
type: "ImageService1" | "ImageService2" | "ImageService3" | "Canvas";
height?: number | undefined;
width?: number | undefined;
partOf?: ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & {
partOf?: ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & /*elided*/ any)[];
}) | ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & {
partOf?: ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & /*elided*/ any)[];
})[] | undefined;
};
gcps: {
resource: [number, number];
geo: [number, number];
}[];
resourceMask: [number, number][];
id?: string | undefined;
'@context'?: "https://schemas.allmaps.org/map/2/context.json" | undefined;
transformation?: unknown;
created?: string | undefined;
modified?: string | undefined;
resourceCrs?: {
id?: string | undefined;
name?: string | undefined;
definition?: unknown;
} | undefined;
}>;
export declare const GeoreferencedMapsSchema: z.ZodArray<z.ZodObject<{
'@context': z.ZodOptional<z.ZodLiteral<"https://schemas.allmaps.org/map/2/context.json">>;
type: z.ZodLiteral<"GeoreferencedMap">;
id: z.ZodOptional<z.ZodString>;
created: z.ZodOptional<z.ZodString>;
modified: z.ZodOptional<z.ZodString>;
resource: z.ZodObject<{
id: z.ZodString;
height: z.ZodOptional<z.ZodNumber>;
width: z.ZodOptional<z.ZodNumber>;
type: z.ZodEnum<["ImageService1", "ImageService2", "ImageService3", "Canvas"]>;
partOf: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodArray<z.ZodType<{
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & {
partOf?: ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & /*elided*/ any)[];
}, z.ZodTypeDef, {
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & {
partOf?: ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & /*elided*/ any)[];
}>, "many">, z.ZodType<{
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & {
partOf?: ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & /*elided*/ any)[];
}, z.ZodTypeDef, {
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & {
partOf?: ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & /*elided*/ any)[];
}>]>, ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & {
partOf?: ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & /*elided*/ any)[];
})[] | undefined, ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & {
partOf?: ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & /*elided*/ any)[];
}) | ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & {
partOf?: ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & /*elided*/ any)[];
})[]>>;
}, "strip", z.ZodTypeAny, {
id: string;
type: "ImageService1" | "ImageService2" | "ImageService3" | "Canvas";
height?: number | undefined;
width?: number | undefined;
partOf?: ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & {
partOf?: ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & /*elided*/ any)[];
})[] | undefined;
}, {
id: string;
type: "ImageService1" | "ImageService2" | "ImageService3" | "Canvas";
height?: number | undefined;
width?: number | undefined;
partOf?: ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & {
partOf?: ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & /*elided*/ any)[];
}) | ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & {
partOf?: ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & /*elided*/ any)[];
})[] | undefined;
}>;
gcps: z.ZodArray<z.ZodObject<{
resource: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
geo: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
}, "strip", z.ZodTypeAny, {
resource: [number, number];
geo: [number, number];
}, {
resource: [number, number];
geo: [number, number];
}>, "many">;
resourceMask: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, "many">;
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>>;
resourceCrs: z.ZodOptional<z.ZodObject<{
id: z.ZodOptional<z.ZodString>;
name: z.ZodOptional<z.ZodString>;
definition: z.ZodUnion<[z.ZodString, z.ZodUnknown]>;
}, "strip", z.ZodTypeAny, {
id?: string | undefined;
name?: string | undefined;
definition?: unknown;
}, {
id?: string | undefined;
name?: string | undefined;
definition?: unknown;
}>>;
}, "strip", z.ZodTypeAny, {
type: "GeoreferencedMap";
resource: {
id: string;
type: "ImageService1" | "ImageService2" | "ImageService3" | "Canvas";
height?: number | undefined;
width?: number | undefined;
partOf?: ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & {
partOf?: ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & /*elided*/ any)[];
})[] | undefined;
};
gcps: {
resource: [number, number];
geo: [number, number];
}[];
resourceMask: [number, number][];
id?: string | undefined;
'@context'?: "https://schemas.allmaps.org/map/2/context.json" | undefined;
transformation?: {
type: "helmert" | "polynomial" | "thinPlateSpline" | "projective" | "straight" | "linear";
options?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
} | undefined;
created?: string | undefined;
modified?: string | undefined;
resourceCrs?: {
id?: string | undefined;
name?: string | undefined;
definition?: unknown;
} | undefined;
}, {
type: "GeoreferencedMap";
resource: {
id: string;
type: "ImageService1" | "ImageService2" | "ImageService3" | "Canvas";
height?: number | undefined;
width?: number | undefined;
partOf?: ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & {
partOf?: ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & /*elided*/ any)[];
}) | ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & {
partOf?: ({
id: string;
type: string;
label?: Record<string, (string | number | boolean)[]> | undefined;
} & /*elided*/ any)[];
})[] | undefined;
};
gcps: {
resource: [number, number];
geo: [number, number];
}[];
resourceMask: [number, number][];
id?: string | undefined;
'@context'?: "https://schemas.allmaps.org/map/2/context.json" | undefined;
transformation?: unknown;
created?: string | undefined;
modified?: string | undefined;
resourceCrs?: {
id?: string | undefined;
name?: string | undefined;
definition?: unknown;
} | undefined;
}>, "many">;