2023-12-06 22:58:38 +00:00
|
|
|
import z from "zod";
|
|
|
|
|
|
|
|
export const zPublisher = z.object({
|
|
|
|
mbox: z.string().optional(),
|
|
|
|
name: z.string(),
|
|
|
|
});
|
|
|
|
export const zDistribution = z.object({
|
|
|
|
identifier: z.string(),
|
2023-12-08 03:46:17 +00:00
|
|
|
downloadURL: z.string().optional(),
|
2023-12-06 22:58:38 +00:00
|
|
|
fileName: z.string().optional(),
|
|
|
|
format: z.string().optional(),
|
|
|
|
title: z.string(),
|
|
|
|
description: z.string().optional(),
|
|
|
|
});
|
2023-12-08 19:05:25 +00:00
|
|
|
/** @typedef {z.infer<typeof zDistribution>} Distribution */
|
2023-12-06 22:58:38 +00:00
|
|
|
export const zDataset = z.object({
|
|
|
|
identifier: z.string(),
|
|
|
|
title: z.string(),
|
|
|
|
description: z.string(),
|
|
|
|
publisher: zPublisher,
|
|
|
|
distribution: z.array(zDistribution),
|
2023-12-08 04:55:26 +00:00
|
|
|
landingPage: z.string().optional(),
|
2023-12-06 22:58:38 +00:00
|
|
|
});
|
2023-12-08 19:05:25 +00:00
|
|
|
/** @typedef {z.infer<typeof zDataset>} Dataset */
|
2023-12-06 22:58:38 +00:00
|
|
|
export const zData = z.object({
|
|
|
|
title: z.string(),
|
|
|
|
description: z.string(),
|
2023-12-07 21:39:52 +00:00
|
|
|
homepage: z.string().optional(),
|
2023-12-06 22:58:38 +00:00
|
|
|
dataset: z.array(zDataset),
|
|
|
|
});
|
|
|
|
|
|
|
|
export const zError = z.object({
|
2023-12-08 03:46:17 +00:00
|
|
|
url: z.string().optional(),
|
2023-12-06 22:58:38 +00:00
|
|
|
datasetIdentifier: z.string(),
|
|
|
|
distributionIdentifier: z.string(),
|
|
|
|
kind: z.enum(["generic_error", "http_error", "infinite_redirect"]),
|
|
|
|
error: z.string().optional(),
|
|
|
|
});
|
2023-12-08 19:05:25 +00:00
|
|
|
|
|
|
|
export const zDumpMetadata = z.object({
|
|
|
|
sites: z.array(
|
|
|
|
z.object({
|
|
|
|
title: z.string(),
|
|
|
|
description: z.string(),
|
|
|
|
url: z.string(),
|
|
|
|
path: z.string(),
|
|
|
|
})
|
|
|
|
),
|
|
|
|
});
|
|
|
|
/** @typedef {z.infer<typeof zDumpMetadata>} DumpMetadata */
|