2024-10-13 15:25:30 -07:00
|
|
|
import * as v from 'valibot';
|
2024-08-28 04:43:23 -07:00
|
|
|
|
2024-10-29 14:44:28 -07:00
|
|
|
/**
|
|
|
|
* @category Schemas
|
|
|
|
*/
|
2024-10-13 15:25:30 -07:00
|
|
|
const locationSchema = v.object({
|
2024-10-14 11:54:44 -07:00
|
|
|
url: v.fallback(v.pipe(v.string(), v.url()), ''),
|
2024-10-13 15:25:30 -07:00
|
|
|
description: v.fallback(v.string(), ''),
|
|
|
|
country: v.fallback(v.string(), ''),
|
|
|
|
locality: v.fallback(v.string(), ''),
|
|
|
|
region: v.fallback(v.string(), ''),
|
|
|
|
postal_code: v.fallback(v.string(), ''),
|
|
|
|
street: v.fallback(v.string(), ''),
|
|
|
|
origin_id: v.fallback(v.string(), ''),
|
|
|
|
origin_provider: v.fallback(v.string(), ''),
|
|
|
|
type: v.fallback(v.string(), ''),
|
|
|
|
timezone: v.fallback(v.string(), ''),
|
2024-10-14 11:54:44 -07:00
|
|
|
geom: v.fallback(v.nullable(v.object({
|
2024-10-15 16:08:56 -07:00
|
|
|
coordinates: v.fallback(v.nullable(v.tuple([v.number(), v.number()])), null),
|
2024-10-13 15:25:30 -07:00
|
|
|
srid: v.fallback(v.string(), ''),
|
2024-10-14 11:54:44 -07:00
|
|
|
})), null),
|
2024-08-28 04:43:23 -07:00
|
|
|
});
|
|
|
|
|
2024-10-13 15:25:30 -07:00
|
|
|
type Location = v.InferOutput<typeof locationSchema>;
|
2024-08-28 04:43:23 -07:00
|
|
|
|
|
|
|
export { locationSchema, type Location };
|