@tileflow/static 0.1.0-alpha.21 → 0.1.0-alpha.22

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.
@@ -3,7 +3,7 @@ import { z } from 'zod';
3
3
  declare const staticSceneSchemaVersion = 1;
4
4
  declare const MAX_OVERLAY_LATITUDE = 85.051129;
5
5
  declare const staticSceneLimits: {
6
- readonly maxDimension: 1280;
6
+ readonly maxDimension: 2048;
7
7
  readonly maxGeoJsonBytes: 96000;
8
8
  readonly maxOverlays: 24;
9
9
  readonly maxPathCoordinates: 2000;
@@ -11,6 +11,30 @@ declare const staticSceneLimits: {
11
11
  readonly minDimension: 64;
12
12
  };
13
13
  declare const coordinateSchema: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
14
+ declare const staticMapFormatSchema: z.ZodEnum<{
15
+ png: "png";
16
+ jpeg: "jpeg";
17
+ webp: "webp";
18
+ }>;
19
+ declare const staticAttributionPositionSchema: z.ZodEnum<{
20
+ auto: "auto";
21
+ "top-left": "top-left";
22
+ "top-right": "top-right";
23
+ "bottom-left": "bottom-left";
24
+ "bottom-right": "bottom-right";
25
+ }>;
26
+ declare const staticAttributionRequestSchema: z.ZodUnion<readonly [z.ZodObject<{
27
+ mode: z.ZodOptional<z.ZodLiteral<"embedded">>;
28
+ position: z.ZodOptional<z.ZodEnum<{
29
+ auto: "auto";
30
+ "top-left": "top-left";
31
+ "top-right": "top-right";
32
+ "bottom-left": "bottom-left";
33
+ "bottom-right": "bottom-right";
34
+ }>>;
35
+ }, z.core.$strict>, z.ZodObject<{
36
+ mode: z.ZodLiteral<"external">;
37
+ }, z.core.$strict>]>;
14
38
  declare const staticPaddingSchema: z.ZodObject<{
15
39
  bottom: z.ZodNumber;
16
40
  left: z.ZodNumber;
@@ -87,6 +111,18 @@ declare const staticOverlaySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
87
111
  type: z.ZodLiteral<"polygon">;
88
112
  }, z.core.$strip>], "type">;
89
113
  declare const staticSceneSchema: z.ZodObject<{
114
+ attribution: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
115
+ mode: z.ZodOptional<z.ZodLiteral<"embedded">>;
116
+ position: z.ZodOptional<z.ZodEnum<{
117
+ auto: "auto";
118
+ "top-left": "top-left";
119
+ "top-right": "top-right";
120
+ "bottom-left": "bottom-left";
121
+ "bottom-right": "bottom-right";
122
+ }>>;
123
+ }, z.core.$strict>, z.ZodObject<{
124
+ mode: z.ZodLiteral<"external">;
125
+ }, z.core.$strict>]>>;
90
126
  camera: z.ZodDiscriminatedUnion<[z.ZodObject<{
91
127
  bearing: z.ZodOptional<z.ZodNumber>;
92
128
  center: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
@@ -108,6 +144,11 @@ declare const staticSceneSchema: z.ZodObject<{
108
144
  }, z.core.$strict>]>>;
109
145
  type: z.ZodLiteral<"auto">;
110
146
  }, z.core.$strip>], "type">;
147
+ format: z.ZodOptional<z.ZodEnum<{
148
+ png: "png";
149
+ jpeg: "jpeg";
150
+ webp: "webp";
151
+ }>>;
111
152
  map: z.ZodString;
112
153
  overlays: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
113
154
  color: z.ZodDefault<z.ZodString>;
@@ -143,17 +184,21 @@ declare const staticSceneSchema: z.ZodObject<{
143
184
  type: z.ZodLiteral<"polygon">;
144
185
  }, z.core.$strip>], "type">>>;
145
186
  size: z.ZodObject<{
146
- dpr: z.ZodOptional<z.ZodLiteral<1>>;
187
+ dpr: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>>;
147
188
  height: z.ZodNumber;
148
189
  width: z.ZodNumber;
149
190
  }, z.core.$strip>;
150
191
  theme: z.ZodString;
151
192
  }, z.core.$strip>;
152
193
  type StaticCoordinate = z.infer<typeof coordinateSchema>;
194
+ type StaticAttributionMode = 'embedded' | 'external';
195
+ type StaticAttributionPosition = z.infer<typeof staticAttributionPositionSchema>;
196
+ type StaticAttributionRequest = z.infer<typeof staticAttributionRequestSchema>;
197
+ type StaticMapFormat = z.infer<typeof staticMapFormatSchema>;
153
198
  type StaticPadding = z.infer<typeof staticPaddingSchema>;
154
199
  type StaticSceneInput = z.input<typeof staticSceneSchema>;
155
200
  type StaticScene = z.infer<typeof staticSceneSchema>;
156
201
  type StaticOverlayInput = z.input<typeof staticOverlaySchema>;
157
202
  type StaticOverlay = z.infer<typeof staticOverlaySchema>;
158
203
 
159
- export { MAX_OVERLAY_LATITUDE as M, type StaticCoordinate as S, type StaticOverlay as a, type StaticOverlayInput as b, type StaticPadding as c, type StaticScene as d, type StaticSceneInput as e, staticSceneLimits as f, staticSceneSchema as g, staticSceneSchemaVersion as h, circleOverlaySchema as i, lineOverlaySchema as l, markerOverlaySchema as m, polygonOverlaySchema as p, staticOverlaySchema as s };
204
+ export { MAX_OVERLAY_LATITUDE as M, type StaticAttributionMode as S, type StaticAttributionPosition as a, type StaticAttributionRequest as b, type StaticCoordinate as c, type StaticMapFormat as d, type StaticOverlay as e, type StaticOverlayInput as f, type StaticPadding as g, type StaticScene as h, type StaticSceneInput as i, staticAttributionRequestSchema as j, staticOverlaySchema as k, staticSceneLimits as l, staticSceneSchema as m, staticSceneSchemaVersion as n, circleOverlaySchema as o, lineOverlaySchema as p, markerOverlaySchema as q, polygonOverlaySchema as r, staticAttributionPositionSchema as s };
package/dist/scene.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
- import { e as StaticSceneInput, d as StaticScene } from './scene-contract-DZMhLDnf.js';
3
- export { M as MAX_OVERLAY_LATITUDE, S as StaticCoordinate, c as StaticPadding, f as staticSceneLimits, g as staticSceneSchema, h as staticSceneSchemaVersion } from './scene-contract-DZMhLDnf.js';
2
+ import { i as StaticSceneInput, h as StaticScene } from './scene-contract-OMIOisSB.js';
3
+ export { M as MAX_OVERLAY_LATITUDE, S as StaticAttributionMode, a as StaticAttributionPosition, b as StaticAttributionRequest, c as StaticCoordinate, d as StaticMapFormat, g as StaticPadding, s as staticAttributionPositionSchema, j as staticAttributionRequestSchema, l as staticSceneLimits, m as staticSceneSchema, n as staticSceneSchemaVersion } from './scene-contract-OMIOisSB.js';
4
4
 
5
5
  declare const autoFitDetailsSchema: z.ZodObject<{
6
6
  overlay: z.ZodOptional<z.ZodObject<{
@@ -159,6 +159,24 @@ declare const staticMapRequestErrorResponseSchema: z.ZodDiscriminatedUnion<[z.Zo
159
159
  reason: z.ZodLiteral<"OVERLAY_LATITUDE_OUT_OF_RANGE">;
160
160
  error: z.ZodString;
161
161
  retryable: z.ZodLiteral<false>;
162
+ }, z.core.$strict>, z.ZodObject<{
163
+ code: z.ZodLiteral<"STATIC_MAP_ATTRIBUTION_UNSUPPORTED">;
164
+ reason: z.ZodEnum<{
165
+ UNSUPPORTED_DECLARATION: "UNSUPPORTED_DECLARATION";
166
+ UNSUPPORTED_GLYPH: "UNSUPPORTED_GLYPH";
167
+ }>;
168
+ error: z.ZodString;
169
+ retryable: z.ZodLiteral<false>;
170
+ }, z.core.$strict>, z.ZodObject<{
171
+ code: z.ZodLiteral<"STATIC_MAP_ATTRIBUTION_TOO_LARGE">;
172
+ reason: z.ZodLiteral<"CONTENT_LIMIT_EXCEEDED">;
173
+ error: z.ZodString;
174
+ retryable: z.ZodLiteral<false>;
175
+ }, z.core.$strict>, z.ZodObject<{
176
+ code: z.ZodLiteral<"STATIC_MAP_ATTRIBUTION_DOES_NOT_FIT">;
177
+ reason: z.ZodLiteral<"BLOCK_DOES_NOT_FIT">;
178
+ error: z.ZodString;
179
+ retryable: z.ZodLiteral<false>;
162
180
  }, z.core.$strict>], "code">;
163
181
  type StaticMapRequestErrorResponse = z.infer<typeof staticMapRequestErrorResponseSchema>;
164
182
  type StaticAutoFitErrorResponse = Extract<StaticMapRequestErrorResponse, {
package/dist/scene.js CHANGED
@@ -3,17 +3,21 @@ import {
3
3
  normalizeStaticScene,
4
4
  staticMapRequestErrorResponseSchema,
5
5
  validateStaticScene
6
- } from "./chunk-NHQK5UZ2.js";
6
+ } from "./chunk-EMCKSFZV.js";
7
7
  import {
8
8
  MAX_OVERLAY_LATITUDE,
9
+ staticAttributionPositionSchema,
10
+ staticAttributionRequestSchema,
9
11
  staticSceneLimits,
10
12
  staticSceneSchema,
11
13
  staticSceneSchemaVersion
12
- } from "./chunk-MGQCHCU3.js";
14
+ } from "./chunk-NM2JSFUF.js";
13
15
  export {
14
16
  MAX_OVERLAY_LATITUDE,
15
17
  StaticMapRequestError,
16
18
  normalizeStaticScene,
19
+ staticAttributionPositionSchema,
20
+ staticAttributionRequestSchema,
17
21
  staticMapRequestErrorResponseSchema,
18
22
  staticSceneLimits,
19
23
  staticSceneSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tileflow/static",
3
- "version": "0.1.0-alpha.21",
3
+ "version": "0.1.0-alpha.22",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Static map request schemas and helpers for Tileflow.",
6
6
  "type": "module",
@@ -1,99 +0,0 @@
1
- import {
2
- analyzeStaticAutoFit,
3
- normalizeStaticScene,
4
- staticAutoFitPlanSchema,
5
- validateStaticScene
6
- } from "./chunk-NHQK5UZ2.js";
7
- import {
8
- hashStableValue,
9
- isSafeHttpUrl,
10
- stableStringify,
11
- staticSceneSchema,
12
- stripUndefined
13
- } from "./chunk-MGQCHCU3.js";
14
-
15
- // src/manifest.ts
16
- import { z } from "zod";
17
- var staticRendererSchemaVersion = 1;
18
- var staticRenderManifestSchema = z.object({
19
- autoFit: staticAutoFitPlanSchema.optional(),
20
- mapId: z.string().trim().min(1).max(128),
21
- rendererVersion: z.string().trim().min(1).max(64),
22
- schemaVersion: z.literal(staticRendererSchemaVersion),
23
- scene: staticSceneSchema,
24
- styleId: z.string().trim().min(1).max(128).optional(),
25
- styleRevision: z.string().trim().min(1).max(128),
26
- styleUrl: z.string().trim().url().max(512).refine(isSafeHttpUrl, {
27
- message: "Expected an http(s) style URL without credentials or a fragment"
28
- })
29
- });
30
- function validateStaticRenderManifest(input) {
31
- const rawScene = input && typeof input === "object" && !Array.isArray(input) && "scene" in input ? input.scene : void 0;
32
- const sceneValidation = validateStaticScene(rawScene);
33
- if (!sceneValidation.ok) {
34
- return sceneValidation;
35
- }
36
- const parsed = staticRenderManifestSchema.safeParse({
37
- ...input,
38
- scene: sceneValidation.scene
39
- });
40
- if (!parsed.success) {
41
- return {
42
- error: parsed.error.issues.map((issue) => `${issue.path.join(".") || "manifest"}: ${issue.message}`).join("; "),
43
- ok: false
44
- };
45
- }
46
- const autoFit = expectedAutoFit(sceneValidation.scene);
47
- if (autoFit === void 0 !== (parsed.data.autoFit === void 0) || autoFit !== void 0 && stableStringify(autoFit) !== stableStringify(parsed.data.autoFit)) {
48
- return { error: "manifest.autoFit: Expected the exact plan derived from scene", ok: false };
49
- }
50
- return {
51
- manifest: {
52
- ...parsed.data,
53
- ...autoFit === void 0 ? {} : { autoFit },
54
- scene: sceneValidation.scene
55
- },
56
- ok: true
57
- };
58
- }
59
- function createRenderManifest(input) {
60
- const scene = normalizeStaticScene(input.scene);
61
- const autoFit = expectedAutoFit(scene);
62
- return staticRenderManifestSchema.parse(
63
- stripUndefined({
64
- autoFit,
65
- mapId: input.mapId,
66
- rendererVersion: input.rendererVersion,
67
- schemaVersion: staticRendererSchemaVersion,
68
- scene,
69
- styleId: input.styleId,
70
- styleRevision: input.styleRevision,
71
- styleUrl: input.styleUrl
72
- })
73
- );
74
- }
75
- async function hashRenderManifest(manifest) {
76
- const validation = validateStaticRenderManifest(manifest);
77
- if (!validation.ok) throw new Error(`Invalid Tileflow render manifest: ${validation.error}`);
78
- return hashStableValue(validation.manifest);
79
- }
80
- async function hashStaticSceneRequest(scene) {
81
- const validation = validateStaticScene(scene);
82
- if (!validation.ok) throw new Error(`Invalid Tileflow static scene: ${validation.error}`);
83
- return hashStableValue(validation.scene);
84
- }
85
- function expectedAutoFit(scene) {
86
- if (scene.camera.type !== "auto") return void 0;
87
- const analysis = analyzeStaticAutoFit(scene);
88
- if (!analysis.ok) throw new Error(`Invalid Tileflow auto-fit scene: ${analysis.error}`);
89
- return analysis.plan;
90
- }
91
-
92
- export {
93
- staticRendererSchemaVersion,
94
- staticRenderManifestSchema,
95
- validateStaticRenderManifest,
96
- createRenderManifest,
97
- hashRenderManifest,
98
- hashStaticSceneRequest
99
- };