@tileflow/static 0.1.0-alpha.26 → 0.1.0-alpha.27

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/README.md CHANGED
@@ -32,9 +32,9 @@ silently share another scene's identity.
32
32
 
33
33
  ```ts
34
34
  import {
35
+ createStaticMap,
35
36
  createStaticMapIdempotencyKey,
36
37
  marker,
37
- createStaticMap,
38
38
  validateStaticScene,
39
39
  } from '@tileflow/static';
40
40
 
@@ -241,9 +241,13 @@ attribution grammar or glyphs, excessive attribution, and a block that cannot fi
241
241
  non-retryable `422` boundary.
242
242
 
243
243
  Other bounded Hosted JSON failures throw `StaticMapError`. It preserves HTTP `status` and any safe
244
- `code`, `retryable`, `requestId`, or `remainingUnits` fields the server supplied; absent fields are
245
- `null`. `StaticMapRequestError` extends the same class. Malformed, oversized, or unsafe remote
246
- documents remain generic errors and are never reflected to the caller.
244
+ `code`, `requiredPlan`, `retryable`, `requestId`, or `remainingUnits` fields the server supplied;
245
+ absent fields are `null`. `StaticMapRequestError` extends the same class. Malformed, oversized, or
246
+ unsafe remote documents remain generic errors and are never reflected to the caller.
247
+
248
+ `STATIC_MAPS_PLAN_UNAVAILABLE` is a non-retryable Starter requirement. Its `requiredPlan` is
249
+ `starter-v1`; select a Starter Team or use a non-static fallback. It occurs before a Static Maps
250
+ operation or API-unit charge. A different `403` is a credential or Map-coverage failure.
247
251
 
248
252
  ## API entry points
249
253
 
@@ -4,7 +4,7 @@ import {
4
4
  staticMapErrorResponseSchema,
5
5
  staticMapRequestErrorResponseSchema,
6
6
  validateStaticScene
7
- } from "./chunk-TBI5AED6.js";
7
+ } from "./chunk-ALFVZ3PC.js";
8
8
  import {
9
9
  isSafeHttpUrl,
10
10
  jsonByteLength,
@@ -3,7 +3,7 @@ import {
3
3
  normalizeStaticScene,
4
4
  staticAutoFitPlanSchema,
5
5
  validateStaticScene
6
- } from "./chunk-TBI5AED6.js";
6
+ } from "./chunk-ALFVZ3PC.js";
7
7
  import {
8
8
  hashStableValue,
9
9
  isSafeHttpUrl,
@@ -130,12 +130,55 @@ var placementAnchorsSchema = z.object({
130
130
  }).strict().refine(anchorsHaveTerminalNulls, {
131
131
  message: "Placement anchors may become null only at the end of semantic order"
132
132
  });
133
+ var iconCoordinate = z.number().int().nonnegative().max(2048);
134
+ var iconStretchRegions = z.array(z.tuple([iconCoordinate, iconCoordinate])).min(1).max(2048);
135
+ var iconLayoutSchema = z.object({
136
+ stretchX: iconStretchRegions.optional(),
137
+ stretchY: iconStretchRegions.optional(),
138
+ content: z.tuple([iconCoordinate, iconCoordinate, iconCoordinate, iconCoordinate]).optional()
139
+ }).strict();
133
140
  var resolvedIconSchema = z.object({
141
+ layout: iconLayoutSchema.optional(),
142
+ // Verified asset defaults supplied by the manifest producer, never scene input.
143
+ appearance: z.object({
144
+ representation: z.literal("sdf"),
145
+ defaults: z.object({
146
+ color: z.string().min(1).max(128).refine(hasNoControlCharacters),
147
+ haloColor: z.string().min(1).max(128).refine(hasNoControlCharacters),
148
+ haloWidth: z.number().finite().min(0).max(2),
149
+ haloBlur: z.number().finite().min(0).max(1)
150
+ }).strict()
151
+ }).strict().optional(),
134
152
  height: z.number().int().positive().max(2048),
135
153
  icon: z.string().max(64).regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/u),
136
154
  overlayIndex: z.number().int().min(0).max(23),
137
155
  width: z.number().int().positive().max(2048)
138
- }).strict();
156
+ }).strict().superRefine((icon, context) => {
157
+ const layout = icon.layout;
158
+ if (!layout) return;
159
+ let valid = Object.values(layout).some((value) => value !== void 0);
160
+ const content = layout.content;
161
+ if (content)
162
+ valid &&= content[0] < content[2] && content[1] < content[3] && content[2] <= icon.width && content[3] <= icon.height;
163
+ for (const [axis, bound, low, high] of [
164
+ ["stretchX", icon.width, content?.[0], content?.[2]],
165
+ ["stretchY", icon.height, content?.[1], content?.[3]]
166
+ ]) {
167
+ let end = 0;
168
+ for (const [from, to] of layout[axis] ?? []) {
169
+ valid &&= from >= end && from < to && to <= bound;
170
+ end = to;
171
+ }
172
+ if (layout[axis] && low !== void 0 && high !== void 0)
173
+ valid &&= layout[axis].some(([from, to]) => from < high && to > low);
174
+ }
175
+ if (!valid)
176
+ context.addIssue({
177
+ code: "custom",
178
+ path: ["layout"],
179
+ message: "Invalid icon layout for the resolved sprite dimensions"
180
+ });
181
+ });
139
182
  var staticRenderCompositionSchema = z.object({
140
183
  anchors: placementAnchorsSchema,
141
184
  icons: z.array(resolvedIconSchema).max(24),
@@ -23,12 +23,14 @@ var staticMapErrorResponseSchema = z.object({
23
23
  error: safeErrorTextSchema,
24
24
  remainingUnits: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER).optional(),
25
25
  requestId: safeErrorIdentifierSchema.optional(),
26
+ requiredPlan: safeErrorIdentifierSchema.optional(),
26
27
  retryable: z.boolean().optional()
27
28
  }).strip();
28
29
  var StaticMapError = class extends Error {
29
30
  code;
30
31
  remainingUnits;
31
32
  requestId;
33
+ requiredPlan;
32
34
  response;
33
35
  retryable;
34
36
  status;
@@ -39,6 +41,7 @@ var StaticMapError = class extends Error {
39
41
  this.code = parsed.code ?? null;
40
42
  this.remainingUnits = parsed.remainingUnits ?? null;
41
43
  this.requestId = parsed.requestId ?? null;
44
+ this.requiredPlan = parsed.requiredPlan ?? null;
42
45
  this.response = Object.freeze(parsed);
43
46
  this.retryable = parsed.retryable ?? null;
44
47
  this.status = status;
package/dist/client.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- export { S as StaticMapError, a as StaticMapErrorResponse, s as staticMapErrorResponseSchema } from './errors-B9rwehK0.js';
2
+ export { S as StaticMapError, a as StaticMapErrorResponse, s as staticMapErrorResponseSchema } from './errors-CSz1xaDx.js';
3
3
  import { a as StaticAttributionPosition, j as StaticSceneInput } from './scene-contract-Cr6BNLz0.js';
4
4
 
5
5
  declare function stableStringify(value: unknown): string;
package/dist/client.js CHANGED
@@ -10,11 +10,11 @@ import {
10
10
  staticMapHostedResultSchema,
11
11
  staticMapProcessingResultSchema,
12
12
  validateStaticMapIdempotencyKey
13
- } from "./chunk-RGXE4HDY.js";
13
+ } from "./chunk-4GPRPR33.js";
14
14
  import {
15
15
  StaticMapError,
16
16
  staticMapErrorResponseSchema
17
- } from "./chunk-TBI5AED6.js";
17
+ } from "./chunk-ALFVZ3PC.js";
18
18
  import {
19
19
  stableStringify
20
20
  } from "./chunk-6DWVCK64.js";
@@ -5,6 +5,7 @@ declare const staticMapErrorResponseSchema: z.ZodObject<{
5
5
  error: z.ZodString;
6
6
  remainingUnits: z.ZodOptional<z.ZodNumber>;
7
7
  requestId: z.ZodOptional<z.ZodString>;
8
+ requiredPlan: z.ZodOptional<z.ZodString>;
8
9
  retryable: z.ZodOptional<z.ZodBoolean>;
9
10
  }, z.core.$strip>;
10
11
  type StaticMapErrorResponse = z.infer<typeof staticMapErrorResponseSchema>;
@@ -12,6 +13,7 @@ declare class StaticMapError extends Error {
12
13
  readonly code: string | null;
13
14
  readonly remainingUnits: number | null;
14
15
  readonly requestId: string | null;
16
+ readonly requiredPlan: string | null;
15
17
  readonly response: StaticMapErrorResponse;
16
18
  readonly retryable: boolean | null;
17
19
  readonly status: number;
package/dist/index.d.ts CHANGED
@@ -3,5 +3,5 @@ export { circle, compileStaticOverlays, line, marker, polygon, symbol } from './
3
3
  export { StaticAttributionEntry, StaticAttributionPlan, StaticAttributionProvenance, StaticAttributionSegment, StaticRenderComposition, StaticRenderManifest, StaticResolvedAttributionPosition, createRenderManifest, hashRenderManifest, hashStaticSceneRequest, staticAttributionEntrySchema, staticAttributionLimits, staticAttributionPlanSchema, staticAttributionPlanSchemaVersion, staticAttributionProvenanceSchema, staticAttributionSegmentSchema, staticRenderCompositionSchema, staticRenderCompositionSchemaVersion, staticRenderManifestSchema, staticRendererSchemaVersion, validateStaticRenderManifest } from './manifest.js';
4
4
  export { PreparedStaticMapRequest, STATIC_MAP_RESULT_MEDIA_TYPE, StaticMapAttributionEntry, StaticMapAttributionResult, StaticMapCreateOptions, StaticMapEndpointRequestOptions, StaticMapHostedResult, StaticMapImageResult, StaticMapResult, createStaticMap, createStaticMapIdempotencyKey, precacheStaticMap, prepareStaticMapRequest, requestStaticMapUntilReady, stableStringify, staticMapAttributionEntrySchema, staticMapAttributionResultSchema, staticMapHostedResultSchema, staticMapProcessingResultSchema, validateStaticMapIdempotencyKey } from './client.js';
5
5
  export { M as MAX_OVERLAY_LATITUDE, S as StaticAttributionMode, a as StaticAttributionPosition, b as StaticAttributionRequest, c as StaticCoordinate, d as StaticMapFormat, e as StaticOverlay, f as StaticOverlayInput, g as StaticOverlayPlacement, h as StaticPadding, i as StaticScene, j as StaticSceneInput, k as StaticSymbolAnchor, l as StaticSymbolCollision, m as StaticSymbolLabelAppearance, n as StaticSymbolLabelPosition, o as StaticSymbolLanguage, p as isSupportedStaticSymbolCodePoint, s as staticAttributionPositionSchema, q as staticAttributionRequestSchema, r as staticOverlayPlacements, t as staticOverlaySchema, u as staticSceneLimits, v as staticSceneSchema, w as staticSceneSchemaVersion, x as staticSymbolAnchors, y as staticSymbolCollisions, z as staticSymbolLabelAppearances, A as staticSymbolLabelPositions, B as staticSymbolLanguages } from './scene-contract-Cr6BNLz0.js';
6
- export { S as StaticMapError, a as StaticMapErrorResponse, s as staticMapErrorResponseSchema } from './errors-B9rwehK0.js';
6
+ export { S as StaticMapError, a as StaticMapErrorResponse, s as staticMapErrorResponseSchema } from './errors-CSz1xaDx.js';
7
7
  import 'zod';
package/dist/index.js CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  staticMapHostedResultSchema,
11
11
  staticMapProcessingResultSchema,
12
12
  validateStaticMapIdempotencyKey
13
- } from "./chunk-RGXE4HDY.js";
13
+ } from "./chunk-4GPRPR33.js";
14
14
  import {
15
15
  createRenderManifest,
16
16
  hashRenderManifest,
@@ -26,7 +26,7 @@ import {
26
26
  staticRenderManifestSchema,
27
27
  staticRendererSchemaVersion,
28
28
  validateStaticRenderManifest
29
- } from "./chunk-XMT7VJL5.js";
29
+ } from "./chunk-4MXFTGQV.js";
30
30
  import {
31
31
  circle,
32
32
  compileStaticOverlays,
@@ -42,7 +42,7 @@ import {
42
42
  staticMapErrorResponseSchema,
43
43
  staticMapRequestErrorResponseSchema,
44
44
  validateStaticScene
45
- } from "./chunk-TBI5AED6.js";
45
+ } from "./chunk-ALFVZ3PC.js";
46
46
  import {
47
47
  MAX_OVERLAY_LATITUDE,
48
48
  isSupportedStaticSymbolCodePoint,
@@ -144,6 +144,20 @@ declare const staticRenderCompositionSchema: z.ZodObject<{
144
144
  'above-labels': z.ZodNull;
145
145
  }, z.core.$strict>;
146
146
  icons: z.ZodArray<z.ZodObject<{
147
+ layout: z.ZodOptional<z.ZodObject<{
148
+ stretchX: z.ZodOptional<z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
149
+ stretchY: z.ZodOptional<z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
150
+ content: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>;
151
+ }, z.core.$strict>>;
152
+ appearance: z.ZodOptional<z.ZodObject<{
153
+ representation: z.ZodLiteral<"sdf">;
154
+ defaults: z.ZodObject<{
155
+ color: z.ZodString;
156
+ haloColor: z.ZodString;
157
+ haloWidth: z.ZodNumber;
158
+ haloBlur: z.ZodNumber;
159
+ }, z.core.$strict>;
160
+ }, z.core.$strict>>;
147
161
  height: z.ZodNumber;
148
162
  icon: z.ZodString;
149
163
  overlayIndex: z.ZodNumber;
@@ -227,6 +241,20 @@ declare const staticRenderManifestSchema: z.ZodObject<{
227
241
  'above-labels': z.ZodNull;
228
242
  }, z.core.$strict>;
229
243
  icons: z.ZodArray<z.ZodObject<{
244
+ layout: z.ZodOptional<z.ZodObject<{
245
+ stretchX: z.ZodOptional<z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
246
+ stretchY: z.ZodOptional<z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
247
+ content: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>;
248
+ }, z.core.$strict>>;
249
+ appearance: z.ZodOptional<z.ZodObject<{
250
+ representation: z.ZodLiteral<"sdf">;
251
+ defaults: z.ZodObject<{
252
+ color: z.ZodString;
253
+ haloColor: z.ZodString;
254
+ haloWidth: z.ZodNumber;
255
+ haloBlur: z.ZodNumber;
256
+ }, z.core.$strict>;
257
+ }, z.core.$strict>>;
230
258
  height: z.ZodNumber;
231
259
  icon: z.ZodString;
232
260
  overlayIndex: z.ZodNumber;
package/dist/manifest.js CHANGED
@@ -13,8 +13,8 @@ import {
13
13
  staticRenderManifestSchema,
14
14
  staticRendererSchemaVersion,
15
15
  validateStaticRenderManifest
16
- } from "./chunk-XMT7VJL5.js";
17
- import "./chunk-TBI5AED6.js";
16
+ } from "./chunk-4MXFTGQV.js";
17
+ import "./chunk-ALFVZ3PC.js";
18
18
  import "./chunk-6DWVCK64.js";
19
19
  export {
20
20
  createRenderManifest,
package/dist/scene.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { S as StaticMapError } from './errors-B9rwehK0.js';
2
+ import { S as StaticMapError } from './errors-CSz1xaDx.js';
3
3
  import { j as StaticSceneInput, i as StaticScene } from './scene-contract-Cr6BNLz0.js';
4
4
  export { M as MAX_OVERLAY_LATITUDE, S as StaticAttributionMode, a as StaticAttributionPosition, b as StaticAttributionRequest, c as StaticCoordinate, d as StaticMapFormat, g as StaticOverlayPlacement, h as StaticPadding, k as StaticSymbolAnchor, l as StaticSymbolCollision, m as StaticSymbolLabelAppearance, n as StaticSymbolLabelPosition, o as StaticSymbolLanguage, p as isSupportedStaticSymbolCodePoint, s as staticAttributionPositionSchema, q as staticAttributionRequestSchema, r as staticOverlayPlacements, u as staticSceneLimits, v as staticSceneSchema, w as staticSceneSchemaVersion, x as staticSymbolAnchors, y as staticSymbolCollisions, z as staticSymbolLabelAppearances, A as staticSymbolLabelPositions, B as staticSymbolLanguages } from './scene-contract-Cr6BNLz0.js';
5
5
 
package/dist/scene.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  normalizeStaticScene,
4
4
  staticMapRequestErrorResponseSchema,
5
5
  validateStaticScene
6
- } from "./chunk-TBI5AED6.js";
6
+ } from "./chunk-ALFVZ3PC.js";
7
7
  import {
8
8
  MAX_OVERLAY_LATITUDE,
9
9
  isSupportedStaticSymbolCodePoint,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tileflow/static",
3
- "version": "0.1.0-alpha.26",
3
+ "version": "0.1.0-alpha.27",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Static map request schemas and helpers for Tileflow.",
6
6
  "type": "module",