Skip to content

normalizeSource

normalizeSource(source): SourceModel

Defined in: packages/core/src/model/normalize.ts:141

Normalize one source.

ParameterType
sourceobjectOutputType<{ attribution: ZodOptional<ZodString>; buffer: ZodOptional<ZodNumber>; cache: ZodOptional<ZodObject<{ enabled: ZodDefault<ZodBoolean>; ttl: ZodOptional<ZodNumber>; }, "strip", ZodTypeAny, { enabled: boolean; ttl?: number; }, { enabled?: boolean; ttl?: number; }>>; cluster: ZodOptional<ZodBoolean>; clusterMaxZoom: ZodOptional<ZodNumber>; clusterMinPoints: ZodOptional<ZodNumber>; clusterProperties: ZodOptional<ZodRecord<ZodString, ZodAny>>; clusterRadius: ZodOptional<ZodNumber>; data: ZodOptional<ZodAny>; fetchStrategy: ZodDefault<ZodEnum<["runtime", "build", "hybrid"]>>; generateId: ZodOptional<ZodBoolean>; lineMetrics: ZodOptional<ZodBoolean>; loading: ZodOptional<ZodObject<{ enabled: ZodDefault<ZodBoolean>; message: ZodOptional<ZodString>; showErrorOverlay: ZodDefault<ZodBoolean>; }, "strip", ZodTypeAny, { enabled: boolean; message?: string; showErrorOverlay: boolean; }, { enabled?: boolean; message?: string; showErrorOverlay?: boolean; }>>; prefetchedData: ZodOptional<ZodAny>; promoteId: ZodOptional<ZodUnion<[ZodString, ZodRecord<ZodString, ZodString>]>>; refresh: ZodOptional<ZodEffects<ZodObject<{ refreshInterval: ZodOptional<ZodNumber>; timestampField: ZodOptional<ZodString>; updateKey: ZodOptional<ZodString>; updateStrategy: ZodDefault<ZodEnum<["replace", "merge", "append-window"]>>; windowDuration: ZodOptional<ZodNumber>; windowSize: ZodOptional<ZodNumber>; }, "strip", ZodTypeAny, { refreshInterval?: number; timestampField?: string; updateKey?: string; updateStrategy: "replace" | "merge" | "append-window"; windowDuration?: number; windowSize?: number; }, { refreshInterval?: number; timestampField?: string; updateKey?: string; updateStrategy?: "replace" | "merge" | "append-window"; windowDuration?: number; windowSize?: number; }>, { refreshInterval?: number; timestampField?: string; updateKey?: string; updateStrategy: "replace" | "merge" | "append-window"; windowDuration?: number; windowSize?: number; }, { refreshInterval?: number; timestampField?: string; updateKey?: string; updateStrategy?: "replace" | "merge" | "append-window"; windowDuration?: number; windowSize?: number; }>>; refreshInterval: ZodOptional<ZodNumber>; stream: ZodOptional<ZodObject<{ eventTypes: ZodOptional<ZodArray<ZodString, "many">>; protocols: ZodOptional<ZodUnion<[ZodString, ZodArray<ZodString, "many">]>>; reconnect: ZodDefault<ZodBoolean>; reconnectDelay: ZodDefault<ZodNumber>; reconnectMaxAttempts: ZodDefault<ZodNumber>; reconnectMaxDelay: ZodDefault<ZodNumber>; type: ZodEnum<["websocket", "sse"]>; url: ZodOptional<ZodString>; }, "strip", ZodTypeAny, { eventTypes?: string[]; protocols?: string | string[]; reconnect: boolean; reconnectDelay: number; reconnectMaxAttempts: number; reconnectMaxDelay: number; type: "websocket" | "sse"; url?: string; }, { eventTypes?: string[]; protocols?: string | string[]; reconnect?: boolean; reconnectDelay?: number; reconnectMaxAttempts?: number; reconnectMaxDelay?: number; type: "websocket" | "sse"; url?: string; }>>; tolerance: ZodOptional<ZodNumber>; type: ZodLiteral<"geojson">; updateKey: ZodOptional<ZodString>; updateStrategy: ZodOptional<ZodEnum<["replace", "merge", "append-window"]>>; url: ZodOptional<ZodString>; }, ZodTypeAny, "passthrough"> | objectOutputType<{ attribution: ZodOptional<ZodString>; bounds: ZodOptional<ZodTuple<[ZodNumber, ZodNumber, ZodNumber, ZodNumber], null>>; maxzoom: ZodOptional<ZodNumber>; minzoom: ZodOptional<ZodNumber>; promoteId: ZodOptional<ZodUnion<[ZodString, ZodRecord<ZodString, ZodString>]>>; scheme: ZodOptional<ZodEnum<["xyz", "tms"]>>; tiles: ZodOptional<ZodArray<ZodEffects<ZodString, string, string>, "many">>; type: ZodLiteral<"vector">; url: ZodOptional<ZodString>; volatile: ZodOptional<ZodBoolean>; }, ZodTypeAny, "passthrough"> | objectOutputType<{ attribution: ZodOptional<ZodString>; bounds: ZodOptional<ZodTuple<[ZodNumber, ZodNumber, ZodNumber, ZodNumber], null>>; maxzoom: ZodOptional<ZodNumber>; minzoom: ZodOptional<ZodNumber>; scheme: ZodOptional<ZodEnum<["xyz", "tms"]>>; tiles: ZodOptional<ZodArray<ZodEffects<ZodString, string, string>, "many">>; tileSize: ZodDefault<ZodNumber>; type: ZodLiteral<"raster">; url: ZodOptional<ZodString>; volatile: ZodOptional<ZodBoolean>; }, ZodTypeAny, "passthrough"> | objectOutputType<{ attribution: ZodOptional<ZodString>; bounds: ZodOptional<ZodTuple<[ZodNumber, ZodNumber, ZodNumber, ZodNumber], null>>; encoding: ZodDefault<ZodEnum<["terrarium", "mapbox", "custom"]>>; maxzoom: ZodOptional<ZodNumber>; minzoom: ZodOptional<ZodNumber>; tiles: ZodOptional<ZodArray<ZodEffects<ZodString, string, string>, "many">>; tileSize: ZodDefault<ZodNumber>; type: ZodLiteral<"raster-dem">; url: ZodOptional<ZodString>; volatile: ZodOptional<ZodBoolean>; }, ZodTypeAny, "passthrough"> | objectOutputType<{ coordinates: ZodTuple<[ZodTuple<[ZodNumber, ZodNumber], null>, ZodTuple<[ZodNumber, ZodNumber], null>, ZodTuple<[ZodNumber, ZodNumber], null>, ZodTuple<[ZodNumber, ZodNumber], null>], null>; type: ZodLiteral<"image">; url: ZodString; }, ZodTypeAny, "passthrough"> | objectOutputType<{ coordinates: ZodTuple<[ZodTuple<[ZodNumber, ZodNumber], null>, ZodTuple<[ZodNumber, ZodNumber], null>, ZodTuple<[ZodNumber, ZodNumber], null>, ZodTuple<[ZodNumber, ZodNumber], null>], null>; type: ZodLiteral<"video">; urls: ZodArray<ZodString, "many">; }, ZodTypeAny, "passthrough">

SourceModel

A non-object source is passed through untouched rather than partitioned. It is malformed input, and manufacturing {} out of it would defeat the renderer’s own typeof spec !== "object" guard — turning a value the renderer used to skip into one MapLibre is asked to add.