@tileflow/static 0.1.0-alpha.16 → 0.1.0-alpha.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/GENERATED_OUTPUT_LICENSE.md +21 -0
- package/LICENSE +201 -0
- package/NOTICE +9 -0
- package/README.md +54 -1
- package/TRADEMARKS.md +10 -0
- package/dist/chunk-35WXL2YI.js +82 -0
- package/dist/chunk-43QGLF6K.js +304 -0
- package/dist/chunk-LGEYA6FQ.js +106 -0
- package/dist/chunk-ROBEGDDY.js +63 -0
- package/dist/chunk-YUG3PBK2.js +198 -0
- package/dist/client.d.ts +58 -0
- package/dist/client.js +25 -0
- package/dist/index.d.ts +6 -248
- package/dist/index.js +43 -383
- package/dist/manifest.d.ts +85 -0
- package/dist/manifest.js +18 -0
- package/dist/overlays.d.ts +14 -0
- package/dist/overlays.js +18 -0
- package/dist/scene-contract-DzsUeJ_V.d.ts +141 -0
- package/dist/scene.d.ts +14 -0
- package/dist/scene.js +16 -0
- package/package.json +28 -3
package/dist/index.js
CHANGED
|
@@ -1,404 +1,64 @@
|
|
|
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
|
-
bounds: z.tuple([z.number().finite(), z.number().finite(), z.number().finite(), z.number().finite()]).refine(
|
|
38
|
-
([west, south, east, north]) => west >= -180 && west <= 180 && east >= -180 && east <= 180 && south >= -90 && south <= 90 && north >= -90 && north <= 90 && west !== east && south !== north,
|
|
39
|
-
{ message: "Expected bounds as [west, south, east, north]" }
|
|
40
|
-
),
|
|
41
|
-
padding: z.number().int().min(0).max(256).optional(),
|
|
42
|
-
type: z.literal("bounds")
|
|
43
|
-
}).refine((camera) => camera.bounds[3] > camera.bounds[1], {
|
|
44
|
-
message: "Bounds north must be greater than south"
|
|
45
|
-
});
|
|
46
|
-
var lineOverlaySchema = z.object({
|
|
47
|
-
color: colorSchema.default("#C6A15B"),
|
|
48
|
-
coordinates: z.array(coordinateSchema).min(2).max(staticSceneLimits.maxPathCoordinates),
|
|
49
|
-
id: z.string().trim().min(1).max(64).optional(),
|
|
50
|
-
opacity: z.number().finite().min(0).max(1).default(1),
|
|
51
|
-
type: z.literal("line"),
|
|
52
|
-
width: z.number().finite().min(0.5).max(32).default(4)
|
|
53
|
-
});
|
|
54
|
-
var circleOverlaySchema = z.object({
|
|
55
|
-
color: colorSchema.default("#C6A15B"),
|
|
56
|
-
coordinate: coordinateSchema,
|
|
57
|
-
id: z.string().trim().min(1).max(64).optional(),
|
|
58
|
-
opacity: z.number().finite().min(0).max(1).default(1),
|
|
59
|
-
radius: z.number().finite().min(1).max(64).default(6),
|
|
60
|
-
strokeColor: colorSchema.optional(),
|
|
61
|
-
strokeWidth: z.number().finite().min(0).max(16).default(0),
|
|
62
|
-
type: z.literal("circle")
|
|
63
|
-
});
|
|
64
|
-
var markerOverlaySchema = z.object({
|
|
65
|
-
color: colorSchema.default("#C6A15B"),
|
|
66
|
-
coordinate: coordinateSchema,
|
|
67
|
-
id: z.string().trim().min(1).max(64).optional(),
|
|
68
|
-
radius: z.number().finite().min(2).max(64).default(8),
|
|
69
|
-
strokeColor: colorSchema.default("#ffffff"),
|
|
70
|
-
strokeWidth: z.number().finite().min(0).max(16).default(2),
|
|
71
|
-
type: z.literal("marker")
|
|
72
|
-
});
|
|
73
|
-
var polygonRingSchema = z.array(coordinateSchema).min(4).max(staticSceneLimits.maxPathCoordinates).refine(
|
|
74
|
-
(ring) => {
|
|
75
|
-
const first = ring[0];
|
|
76
|
-
const last = ring[ring.length - 1];
|
|
77
|
-
return Boolean(first && last && first[0] === last[0] && first[1] === last[1]);
|
|
78
|
-
},
|
|
79
|
-
{ message: "Polygon rings must end at their starting coordinate" }
|
|
80
|
-
);
|
|
81
|
-
var polygonOverlaySchema = z.object({
|
|
82
|
-
coordinates: z.array(polygonRingSchema).min(1).max(16),
|
|
83
|
-
fill: colorSchema.default("#C6A15B"),
|
|
84
|
-
id: z.string().trim().min(1).max(64).optional(),
|
|
85
|
-
opacity: z.number().finite().min(0).max(1).default(0.28),
|
|
86
|
-
stroke: colorSchema.optional(),
|
|
87
|
-
strokeWidth: z.number().finite().min(0).max(16).default(0),
|
|
88
|
-
type: z.literal("polygon")
|
|
89
|
-
});
|
|
90
|
-
var staticOverlaySchema = z.discriminatedUnion("type", [
|
|
91
|
-
lineOverlaySchema,
|
|
92
|
-
circleOverlaySchema,
|
|
93
|
-
markerOverlaySchema,
|
|
94
|
-
polygonOverlaySchema
|
|
95
|
-
]);
|
|
96
|
-
var staticSceneSchema = z.object({
|
|
97
|
-
camera: z.discriminatedUnion("type", [centerCameraSchema, boundsCameraSchema]),
|
|
98
|
-
map: z.string().trim().min(1).max(128),
|
|
99
|
-
overlays: z.array(staticOverlaySchema).max(staticSceneLimits.maxOverlays).default([]),
|
|
100
|
-
size: sizeSchema
|
|
101
|
-
});
|
|
102
|
-
var staticRenderManifestSchema = z.object({
|
|
103
|
-
mapId: z.string().trim().min(1).max(128),
|
|
104
|
-
rendererVersion: z.string().trim().min(1).max(64),
|
|
105
|
-
schemaVersion: z.literal(staticRendererSchemaVersion),
|
|
106
|
-
scene: staticSceneSchema,
|
|
107
|
-
styleId: z.string().trim().min(1).max(128).optional(),
|
|
108
|
-
styleRevision: z.string().trim().min(1).max(128),
|
|
109
|
-
styleUrl: z.string().trim().url().max(512).refine((value) => /^https?:\/\//.test(value), {
|
|
110
|
-
message: "Expected an http(s) style URL"
|
|
111
|
-
})
|
|
112
|
-
});
|
|
113
|
-
function line(input) {
|
|
114
|
-
return normalizeOverlay({ ...input, type: "line" });
|
|
115
|
-
}
|
|
116
|
-
function circle(input) {
|
|
117
|
-
return normalizeOverlay({ ...input, type: "circle" });
|
|
118
|
-
}
|
|
119
|
-
function marker(input) {
|
|
120
|
-
return normalizeOverlay({ ...input, type: "marker" });
|
|
121
|
-
}
|
|
122
|
-
function polygon(input) {
|
|
123
|
-
return normalizeOverlay({ ...input, type: "polygon" });
|
|
124
|
-
}
|
|
125
|
-
function validateStaticScene(input) {
|
|
126
|
-
const parsed = staticSceneSchema.safeParse(input);
|
|
127
|
-
if (!parsed.success) {
|
|
128
|
-
return {
|
|
129
|
-
error: parsed.error.issues.map((issue) => `${issue.path.join(".") || "scene"}: ${issue.message}`).join("; "),
|
|
130
|
-
ok: false
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
if (jsonByteLength(parsed.data.overlays) > staticSceneLimits.maxGeoJsonBytes) {
|
|
134
|
-
return {
|
|
135
|
-
error: `overlays exceed ${staticSceneLimits.maxGeoJsonBytes} bytes`,
|
|
136
|
-
ok: false
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
return { ok: true, scene: normalizeStaticScene(parsed.data) };
|
|
140
|
-
}
|
|
141
|
-
function validateStaticRenderManifest(input) {
|
|
142
|
-
const parsed = staticRenderManifestSchema.safeParse(input);
|
|
143
|
-
if (!parsed.success) {
|
|
144
|
-
return {
|
|
145
|
-
error: parsed.error.issues.map((issue) => `${issue.path.join(".") || "manifest"}: ${issue.message}`).join("; "),
|
|
146
|
-
ok: false
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
const sceneValidation = validateStaticScene(parsed.data.scene);
|
|
150
|
-
if (!sceneValidation.ok) {
|
|
151
|
-
return sceneValidation;
|
|
152
|
-
}
|
|
153
|
-
return {
|
|
154
|
-
manifest: {
|
|
155
|
-
...parsed.data,
|
|
156
|
-
scene: sceneValidation.scene
|
|
157
|
-
},
|
|
158
|
-
ok: true
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
function normalizeStaticScene(scene) {
|
|
162
|
-
const parsed = staticSceneSchema.parse(scene);
|
|
163
|
-
return stripUndefined({
|
|
164
|
-
camera: parsed.camera.type === "center" ? {
|
|
165
|
-
bearing: roundNumber(parsed.camera.bearing ?? 0),
|
|
166
|
-
center: normalizeCoordinate(parsed.camera.center),
|
|
167
|
-
type: "center",
|
|
168
|
-
zoom: roundNumber(parsed.camera.zoom)
|
|
169
|
-
} : {
|
|
170
|
-
bearing: roundNumber(parsed.camera.bearing ?? 0),
|
|
171
|
-
bounds: parsed.camera.bounds.map(roundNumber),
|
|
172
|
-
padding: parsed.camera.padding ?? 32,
|
|
173
|
-
type: "bounds"
|
|
174
|
-
},
|
|
175
|
-
map: parsed.map,
|
|
176
|
-
overlays: parsed.overlays.map(
|
|
177
|
-
(overlay, index) => normalizeOverlay({
|
|
178
|
-
...overlay,
|
|
179
|
-
id: overlay.id ?? `overlay-${index + 1}`
|
|
180
|
-
})
|
|
181
|
-
),
|
|
182
|
-
size: {
|
|
183
|
-
dpr: parsed.size.dpr ?? 1,
|
|
184
|
-
height: parsed.size.height,
|
|
185
|
-
width: parsed.size.width
|
|
186
|
-
}
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
function createRenderManifest(input) {
|
|
190
|
-
return staticRenderManifestSchema.parse(
|
|
191
|
-
stripUndefined({
|
|
192
|
-
mapId: input.mapId,
|
|
193
|
-
rendererVersion: input.rendererVersion,
|
|
194
|
-
schemaVersion: staticRendererSchemaVersion,
|
|
195
|
-
scene: normalizeStaticScene({
|
|
196
|
-
...input.scene,
|
|
197
|
-
map: input.mapId
|
|
198
|
-
}),
|
|
199
|
-
styleId: input.styleId,
|
|
200
|
-
styleRevision: input.styleRevision,
|
|
201
|
-
styleUrl: input.styleUrl
|
|
202
|
-
})
|
|
203
|
-
);
|
|
204
|
-
}
|
|
205
|
-
async function hashRenderManifest(manifest) {
|
|
206
|
-
const normalized = staticRenderManifestSchema.parse({
|
|
207
|
-
...manifest,
|
|
208
|
-
scene: normalizeStaticScene(manifest.scene)
|
|
209
|
-
});
|
|
210
|
-
const bytes = new TextEncoder().encode(stableStringify(normalized));
|
|
211
|
-
const digest = await crypto.subtle.digest("SHA-256", bytes);
|
|
212
|
-
return base64Url(new Uint8Array(digest));
|
|
213
|
-
}
|
|
214
|
-
function compileStaticOverlays(overlays) {
|
|
215
|
-
const sources = {};
|
|
216
|
-
const layers = [];
|
|
217
|
-
for (const [index, overlay] of overlays.entries()) {
|
|
218
|
-
const id = safeLayerId(`overlay-${index + 1}-${overlay.id ?? overlay.type}`);
|
|
219
|
-
const sourceId = `${id}-source`;
|
|
220
|
-
if (overlay.type === "line") {
|
|
221
|
-
sources[sourceId] = {
|
|
222
|
-
data: feature("LineString", overlay.coordinates),
|
|
223
|
-
type: "geojson"
|
|
224
|
-
};
|
|
225
|
-
layers.push({
|
|
226
|
-
id,
|
|
227
|
-
layout: { "line-cap": "round", "line-join": "round" },
|
|
228
|
-
paint: {
|
|
229
|
-
"line-color": overlay.color,
|
|
230
|
-
"line-opacity": overlay.opacity,
|
|
231
|
-
"line-width": overlay.width
|
|
232
|
-
},
|
|
233
|
-
source: sourceId,
|
|
234
|
-
type: "line"
|
|
235
|
-
});
|
|
236
|
-
continue;
|
|
237
|
-
}
|
|
238
|
-
if (overlay.type === "polygon") {
|
|
239
|
-
sources[sourceId] = {
|
|
240
|
-
data: feature("Polygon", overlay.coordinates),
|
|
241
|
-
type: "geojson"
|
|
242
|
-
};
|
|
243
|
-
layers.push({
|
|
244
|
-
id,
|
|
245
|
-
paint: {
|
|
246
|
-
"fill-color": overlay.fill,
|
|
247
|
-
"fill-opacity": overlay.opacity
|
|
248
|
-
},
|
|
249
|
-
source: sourceId,
|
|
250
|
-
type: "fill"
|
|
251
|
-
});
|
|
252
|
-
if (overlay.stroke && overlay.strokeWidth > 0) {
|
|
253
|
-
layers.push({
|
|
254
|
-
id: `${id}-stroke`,
|
|
255
|
-
layout: { "line-cap": "round", "line-join": "round" },
|
|
256
|
-
paint: {
|
|
257
|
-
"line-color": overlay.stroke,
|
|
258
|
-
"line-width": overlay.strokeWidth
|
|
259
|
-
},
|
|
260
|
-
source: sourceId,
|
|
261
|
-
type: "line"
|
|
262
|
-
});
|
|
263
|
-
}
|
|
264
|
-
continue;
|
|
265
|
-
}
|
|
266
|
-
sources[sourceId] = {
|
|
267
|
-
data: feature("Point", overlay.coordinate),
|
|
268
|
-
type: "geojson"
|
|
269
|
-
};
|
|
270
|
-
layers.push({
|
|
271
|
-
id,
|
|
272
|
-
paint: {
|
|
273
|
-
"circle-color": overlay.color,
|
|
274
|
-
"circle-opacity": overlay.type === "circle" ? overlay.opacity : 1,
|
|
275
|
-
"circle-radius": overlay.radius,
|
|
276
|
-
"circle-stroke-color": overlay.strokeColor ?? overlay.color,
|
|
277
|
-
"circle-stroke-width": overlay.strokeWidth
|
|
278
|
-
},
|
|
279
|
-
source: sourceId,
|
|
280
|
-
type: "circle"
|
|
281
|
-
});
|
|
282
|
-
}
|
|
283
|
-
return { layers, sources };
|
|
284
|
-
}
|
|
285
|
-
async function createStaticMap(scene, options = {}) {
|
|
286
|
-
return requestStaticMap(scene, options, "/v1/static/maps");
|
|
287
|
-
}
|
|
288
|
-
async function precacheStaticMap(scene, options = {}) {
|
|
289
|
-
return requestStaticMap(scene, options, "/v1/static/maps/precache");
|
|
290
|
-
}
|
|
291
|
-
async function requestStaticMap(scene, options, path) {
|
|
292
|
-
const validation = validateStaticScene(scene);
|
|
293
|
-
if (!validation.ok) {
|
|
294
|
-
throw new Error(`Invalid Tileflow static scene: ${validation.error}`);
|
|
295
|
-
}
|
|
296
|
-
const fetcher = options.fetch ?? fetch;
|
|
297
|
-
const apiUrl = normalizeUrl(options.apiUrl ?? "https://api.tileflow.dev");
|
|
298
|
-
const headers = {
|
|
299
|
-
"Content-Type": "application/json"
|
|
300
|
-
};
|
|
301
|
-
if (options.apiKey) {
|
|
302
|
-
headers.Authorization = `Bearer ${options.apiKey}`;
|
|
303
|
-
}
|
|
304
|
-
const response = await fetcher(`${apiUrl}${path}`, {
|
|
305
|
-
body: JSON.stringify(validation.scene),
|
|
306
|
-
headers,
|
|
307
|
-
method: "POST"
|
|
308
|
-
});
|
|
309
|
-
if (!response.ok) {
|
|
310
|
-
const error = await response.text();
|
|
311
|
-
throw new Error(`Tileflow static map failed: ${response.status} ${error}`);
|
|
312
|
-
}
|
|
313
|
-
return await response.json();
|
|
314
|
-
}
|
|
315
|
-
function stableStringify(value) {
|
|
316
|
-
return JSON.stringify(sortJson(value));
|
|
317
|
-
}
|
|
318
|
-
function normalizeOverlay(overlay) {
|
|
319
|
-
const parsed = staticOverlaySchema.parse(overlay);
|
|
320
|
-
const normalized = stripUndefined({ ...parsed });
|
|
321
|
-
if ("coordinate" in normalized) {
|
|
322
|
-
normalized.coordinate = normalizeCoordinate(normalized.coordinate);
|
|
323
|
-
}
|
|
324
|
-
if ("coordinates" in normalized) {
|
|
325
|
-
normalized.coordinates = normalizeCoordinates(normalized.coordinates);
|
|
326
|
-
}
|
|
327
|
-
return normalized;
|
|
328
|
-
}
|
|
329
|
-
function normalizeCoordinates(value) {
|
|
330
|
-
if (!Array.isArray(value)) {
|
|
331
|
-
return value;
|
|
332
|
-
}
|
|
333
|
-
if (value.length === 2 && typeof value[0] === "number" && typeof value[1] === "number") {
|
|
334
|
-
return normalizeCoordinate(value);
|
|
335
|
-
}
|
|
336
|
-
return value.map(normalizeCoordinates);
|
|
337
|
-
}
|
|
338
|
-
function normalizeCoordinate(coordinate) {
|
|
339
|
-
return [roundNumber(coordinate[0]), roundNumber(coordinate[1])];
|
|
340
|
-
}
|
|
341
|
-
function roundNumber(value) {
|
|
342
|
-
return Number(value.toFixed(6));
|
|
343
|
-
}
|
|
344
|
-
function stripUndefined(value) {
|
|
345
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
346
|
-
return value;
|
|
347
|
-
}
|
|
348
|
-
return Object.fromEntries(Object.entries(value).filter(([, entry]) => entry !== void 0));
|
|
349
|
-
}
|
|
350
|
-
function sortJson(value) {
|
|
351
|
-
if (Array.isArray(value)) {
|
|
352
|
-
return value.map(sortJson);
|
|
353
|
-
}
|
|
354
|
-
if (value && typeof value === "object") {
|
|
355
|
-
return Object.fromEntries(
|
|
356
|
-
Object.entries(value).sort(([left], [right]) => left.localeCompare(right)).map(([key, entry]) => [key, sortJson(entry)])
|
|
357
|
-
);
|
|
358
|
-
}
|
|
359
|
-
return value;
|
|
360
|
-
}
|
|
361
|
-
function feature(type, coordinates) {
|
|
362
|
-
return {
|
|
363
|
-
geometry: { coordinates, type },
|
|
364
|
-
properties: {},
|
|
365
|
-
type: "Feature"
|
|
366
|
-
};
|
|
367
|
-
}
|
|
368
|
-
function safeLayerId(value) {
|
|
369
|
-
return value.replace(/[^a-zA-Z0-9_-]/g, "-").slice(0, 80);
|
|
370
|
-
}
|
|
371
|
-
function jsonByteLength(value) {
|
|
372
|
-
return new TextEncoder().encode(JSON.stringify(value)).length;
|
|
373
|
-
}
|
|
374
|
-
function base64Url(bytes) {
|
|
375
|
-
let binary = "";
|
|
376
|
-
for (const byte of bytes) {
|
|
377
|
-
binary += String.fromCharCode(byte);
|
|
378
|
-
}
|
|
379
|
-
return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/g, "");
|
|
380
|
-
}
|
|
381
|
-
function normalizeUrl(value) {
|
|
382
|
-
return value.replace(/\/+$/, "");
|
|
383
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
createStaticMap,
|
|
3
|
+
createStaticMapIdempotencyKey,
|
|
4
|
+
precacheStaticMap,
|
|
5
|
+
prepareStaticMapRequest,
|
|
6
|
+
requestStaticMapUntilReady,
|
|
7
|
+
staticMapProcessingResultSchema,
|
|
8
|
+
staticMapReadyResultSchema,
|
|
9
|
+
validateStaticMapIdempotencyKey
|
|
10
|
+
} from "./chunk-43QGLF6K.js";
|
|
11
|
+
import {
|
|
12
|
+
createRenderManifest,
|
|
13
|
+
hashRenderManifest,
|
|
14
|
+
hashStaticSceneRequest,
|
|
15
|
+
staticRenderManifestSchema,
|
|
16
|
+
staticRendererSchemaVersion,
|
|
17
|
+
validateStaticRenderManifest
|
|
18
|
+
} from "./chunk-35WXL2YI.js";
|
|
19
|
+
import {
|
|
20
|
+
circle,
|
|
21
|
+
compileStaticOverlays,
|
|
22
|
+
line,
|
|
23
|
+
marker,
|
|
24
|
+
polygon
|
|
25
|
+
} from "./chunk-LGEYA6FQ.js";
|
|
26
|
+
import {
|
|
27
|
+
normalizeStaticScene,
|
|
28
|
+
validateStaticScene
|
|
29
|
+
} from "./chunk-ROBEGDDY.js";
|
|
30
|
+
import {
|
|
31
|
+
stableStringify,
|
|
32
|
+
staticOverlaySchema,
|
|
33
|
+
staticSceneLimits,
|
|
34
|
+
staticSceneSchema,
|
|
35
|
+
staticSceneSchemaVersion
|
|
36
|
+
} from "./chunk-YUG3PBK2.js";
|
|
384
37
|
export {
|
|
385
38
|
circle,
|
|
386
39
|
compileStaticOverlays,
|
|
387
40
|
createRenderManifest,
|
|
388
41
|
createStaticMap,
|
|
42
|
+
createStaticMapIdempotencyKey,
|
|
389
43
|
hashRenderManifest,
|
|
44
|
+
hashStaticSceneRequest,
|
|
390
45
|
line,
|
|
391
46
|
marker,
|
|
392
47
|
normalizeStaticScene,
|
|
393
48
|
polygon,
|
|
394
49
|
precacheStaticMap,
|
|
50
|
+
prepareStaticMapRequest,
|
|
51
|
+
requestStaticMapUntilReady,
|
|
395
52
|
stableStringify,
|
|
53
|
+
staticMapProcessingResultSchema,
|
|
54
|
+
staticMapReadyResultSchema,
|
|
396
55
|
staticOverlaySchema,
|
|
397
56
|
staticRenderManifestSchema,
|
|
398
57
|
staticRendererSchemaVersion,
|
|
399
58
|
staticSceneLimits,
|
|
400
59
|
staticSceneSchema,
|
|
401
60
|
staticSceneSchemaVersion,
|
|
61
|
+
validateStaticMapIdempotencyKey,
|
|
402
62
|
validateStaticRenderManifest,
|
|
403
63
|
validateStaticScene
|
|
404
64
|
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { d as StaticSceneInput } from './scene-contract-DzsUeJ_V.js';
|
|
3
|
+
|
|
4
|
+
declare const staticRendererSchemaVersion = 1;
|
|
5
|
+
declare const staticRenderManifestSchema: z.ZodObject<{
|
|
6
|
+
mapId: z.ZodString;
|
|
7
|
+
rendererVersion: z.ZodString;
|
|
8
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
9
|
+
scene: z.ZodObject<{
|
|
10
|
+
camera: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
11
|
+
bearing: z.ZodOptional<z.ZodNumber>;
|
|
12
|
+
center: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
13
|
+
type: z.ZodLiteral<"center">;
|
|
14
|
+
zoom: z.ZodNumber;
|
|
15
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
16
|
+
bearing: z.ZodOptional<z.ZodNumber>;
|
|
17
|
+
bounds: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
|
|
18
|
+
padding: z.ZodOptional<z.ZodNumber>;
|
|
19
|
+
type: z.ZodLiteral<"bounds">;
|
|
20
|
+
}, z.core.$strip>], "type">;
|
|
21
|
+
map: z.ZodString;
|
|
22
|
+
overlays: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
23
|
+
color: z.ZodDefault<z.ZodString>;
|
|
24
|
+
coordinates: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
|
|
25
|
+
id: z.ZodOptional<z.ZodString>;
|
|
26
|
+
opacity: z.ZodDefault<z.ZodNumber>;
|
|
27
|
+
type: z.ZodLiteral<"line">;
|
|
28
|
+
width: z.ZodDefault<z.ZodNumber>;
|
|
29
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
30
|
+
color: z.ZodDefault<z.ZodString>;
|
|
31
|
+
coordinate: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
32
|
+
id: z.ZodOptional<z.ZodString>;
|
|
33
|
+
opacity: z.ZodDefault<z.ZodNumber>;
|
|
34
|
+
radius: z.ZodDefault<z.ZodNumber>;
|
|
35
|
+
strokeColor: z.ZodOptional<z.ZodString>;
|
|
36
|
+
strokeWidth: z.ZodDefault<z.ZodNumber>;
|
|
37
|
+
type: z.ZodLiteral<"circle">;
|
|
38
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
39
|
+
color: z.ZodDefault<z.ZodString>;
|
|
40
|
+
coordinate: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
41
|
+
id: z.ZodOptional<z.ZodString>;
|
|
42
|
+
radius: z.ZodDefault<z.ZodNumber>;
|
|
43
|
+
strokeColor: z.ZodDefault<z.ZodString>;
|
|
44
|
+
strokeWidth: z.ZodDefault<z.ZodNumber>;
|
|
45
|
+
type: z.ZodLiteral<"marker">;
|
|
46
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
47
|
+
coordinates: z.ZodArray<z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
|
|
48
|
+
fill: z.ZodDefault<z.ZodString>;
|
|
49
|
+
id: z.ZodOptional<z.ZodString>;
|
|
50
|
+
opacity: z.ZodDefault<z.ZodNumber>;
|
|
51
|
+
stroke: z.ZodOptional<z.ZodString>;
|
|
52
|
+
strokeWidth: z.ZodDefault<z.ZodNumber>;
|
|
53
|
+
type: z.ZodLiteral<"polygon">;
|
|
54
|
+
}, z.core.$strip>], "type">>>;
|
|
55
|
+
size: z.ZodObject<{
|
|
56
|
+
dpr: z.ZodOptional<z.ZodLiteral<1>>;
|
|
57
|
+
height: z.ZodNumber;
|
|
58
|
+
width: z.ZodNumber;
|
|
59
|
+
}, z.core.$strip>;
|
|
60
|
+
theme: z.ZodString;
|
|
61
|
+
}, z.core.$strip>;
|
|
62
|
+
styleId: z.ZodOptional<z.ZodString>;
|
|
63
|
+
styleRevision: z.ZodString;
|
|
64
|
+
styleUrl: z.ZodString;
|
|
65
|
+
}, z.core.$strip>;
|
|
66
|
+
type StaticRenderManifest = z.infer<typeof staticRenderManifestSchema>;
|
|
67
|
+
declare function validateStaticRenderManifest(input: unknown): {
|
|
68
|
+
manifest: StaticRenderManifest;
|
|
69
|
+
ok: true;
|
|
70
|
+
} | {
|
|
71
|
+
error: string;
|
|
72
|
+
ok: false;
|
|
73
|
+
};
|
|
74
|
+
declare function createRenderManifest(input: {
|
|
75
|
+
mapId: string;
|
|
76
|
+
rendererVersion: string;
|
|
77
|
+
scene: StaticSceneInput;
|
|
78
|
+
styleId?: string;
|
|
79
|
+
styleRevision: string;
|
|
80
|
+
styleUrl: string;
|
|
81
|
+
}): StaticRenderManifest;
|
|
82
|
+
declare function hashRenderManifest(manifest: StaticRenderManifest): Promise<string>;
|
|
83
|
+
declare function hashStaticSceneRequest(scene: StaticSceneInput): Promise<string>;
|
|
84
|
+
|
|
85
|
+
export { type StaticRenderManifest, createRenderManifest, hashRenderManifest, hashStaticSceneRequest, staticRenderManifestSchema, staticRendererSchemaVersion, validateStaticRenderManifest };
|
package/dist/manifest.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createRenderManifest,
|
|
3
|
+
hashRenderManifest,
|
|
4
|
+
hashStaticSceneRequest,
|
|
5
|
+
staticRenderManifestSchema,
|
|
6
|
+
staticRendererSchemaVersion,
|
|
7
|
+
validateStaticRenderManifest
|
|
8
|
+
} from "./chunk-35WXL2YI.js";
|
|
9
|
+
import "./chunk-ROBEGDDY.js";
|
|
10
|
+
import "./chunk-YUG3PBK2.js";
|
|
11
|
+
export {
|
|
12
|
+
createRenderManifest,
|
|
13
|
+
hashRenderManifest,
|
|
14
|
+
hashStaticSceneRequest,
|
|
15
|
+
staticRenderManifestSchema,
|
|
16
|
+
staticRendererSchemaVersion,
|
|
17
|
+
validateStaticRenderManifest
|
|
18
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { h as circleOverlaySchema, a as StaticOverlay, l as lineOverlaySchema, m as markerOverlaySchema, p as polygonOverlaySchema } from './scene-contract-DzsUeJ_V.js';
|
|
3
|
+
export { b as StaticOverlayInput, s as staticOverlaySchema } from './scene-contract-DzsUeJ_V.js';
|
|
4
|
+
|
|
5
|
+
declare function line(input: Omit<z.input<typeof lineOverlaySchema>, 'type'>): StaticOverlay;
|
|
6
|
+
declare function circle(input: Omit<z.input<typeof circleOverlaySchema>, 'type'>): StaticOverlay;
|
|
7
|
+
declare function marker(input: Omit<z.input<typeof markerOverlaySchema>, 'type'>): StaticOverlay;
|
|
8
|
+
declare function polygon(input: Omit<z.input<typeof polygonOverlaySchema>, 'type'>): StaticOverlay;
|
|
9
|
+
declare function compileStaticOverlays(overlays: StaticOverlay[]): {
|
|
10
|
+
layers: Record<string, unknown>[];
|
|
11
|
+
sources: Record<string, Record<string, unknown>>;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export { StaticOverlay, circle, compileStaticOverlays, line, marker, polygon };
|
package/dist/overlays.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
circle,
|
|
3
|
+
compileStaticOverlays,
|
|
4
|
+
line,
|
|
5
|
+
marker,
|
|
6
|
+
polygon
|
|
7
|
+
} from "./chunk-LGEYA6FQ.js";
|
|
8
|
+
import {
|
|
9
|
+
staticOverlaySchema
|
|
10
|
+
} from "./chunk-YUG3PBK2.js";
|
|
11
|
+
export {
|
|
12
|
+
circle,
|
|
13
|
+
compileStaticOverlays,
|
|
14
|
+
line,
|
|
15
|
+
marker,
|
|
16
|
+
polygon,
|
|
17
|
+
staticOverlaySchema
|
|
18
|
+
};
|