-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathListStylesTool.output.schema.ts
More file actions
53 lines (45 loc) · 1.93 KB
/
Copy pathListStylesTool.output.schema.ts
File metadata and controls
53 lines (45 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Copyright (c) Mapbox, Inc.
// Licensed under the MIT License.
import { z } from 'zod';
/**
* Schema for style metadata returned by the list styles endpoint.
* Note: This is different from a full style specification - it contains
* metadata about the style but may not include all style properties like layers.
*/
const StyleMetadataSchema = z.object({
// Core metadata fields always present
id: z.string().describe('Unique style ID'),
name: z.string().describe('Style name'),
owner: z.string().describe('Username of the style owner'),
created: z.string().describe('ISO 8601 timestamp of creation'),
modified: z.string().describe('ISO 8601 timestamp of last modification'),
visibility: z
.enum(['public', 'private'])
.describe('Style visibility setting'),
// Optional Style Spec fields that may be included
version: z.literal(8).optional().describe('Style specification version'),
center: z
.tuple([z.number(), z.number()])
.optional()
.describe('Default center [longitude, latitude]'),
zoom: z.number().optional().describe('Default zoom level'),
bearing: z.number().optional().describe('Default bearing in degrees'),
pitch: z.number().optional().describe('Default pitch in degrees'),
// Sources and layers may or may not be included in list responses
sources: z
.record(z.string(), z.any())
.optional()
.describe('Style data sources'),
layers: z.array(z.any()).optional().describe('Style layers'),
// Additional metadata fields
protected: z.boolean().optional().describe('Whether style is protected'),
draft: z.boolean().optional().describe('Whether style is a draft')
});
// API returns an array of styles
const StylesArraySchema = z.array(StyleMetadataSchema);
// But structuredContent wraps it in an object
export const ListStylesOutputSchema = z.object({
styles: StylesArraySchema
});
export type ListStylesOutput = z.infer<typeof ListStylesOutputSchema>;
export { StylesArraySchema };