kmw-sdk 0.0.0-stage → 0.1.0
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/CHANGELOG.md +9 -0
- package/LICENSE +21 -0
- package/README.md +273 -2
- package/dist/index.cjs +965 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +3619 -0
- package/dist/index.d.ts +3619 -0
- package/dist/index.js +938 -0
- package/dist/index.js.map +1 -0
- package/package.json +84 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["BASE","TIME_STEPS"],"sources":["../src/auth.ts","../src/errors.ts","../src/rate-limit.ts","../src/http.ts","../src/internal.ts","../src/normalize.ts","../src/resources/climate.ts","../src/resources/forecast.ts","../src/resources/photos.ts","../src/resources/stations.ts","../src/resources/tools.ts","../src/client.ts","../src/units.ts"],"sourcesContent":["/**\n * HTTP Basic authentication. **Enterprise only**: the API documents it as\n * \"currently for internal and enterprise use only\". Use it only if Meteologix\n * told you to.\n */\nexport interface BasicAuth {\n readonly type: \"basic\";\n /** User name. Must not contain a colon (RFC 7617). */\n readonly username: string;\n readonly password: string;\n}\n\n/**\n * HTTP Bearer authentication with a token issued by Meteologix. **Enterprise\n * only**: the API documents it as \"currently for internal and enterprise use\n * only\". Use it only if Meteologix told you to.\n */\nexport interface BearerAuth {\n readonly type: \"bearer\";\n /** The token, sent as `Authorization: Bearer <token>`. */\n readonly token: string;\n}\n\n/**\n * Alternative authentication for enterprise customers. Everyone else\n * authenticates with an API key.\n */\nexport type EnterpriseAuth = BasicAuth | BearerAuth;\n\n/**\n * The header that carries the credentials.\n * @internal\n */\nexport interface Credentials {\n readonly header: \"X-API-Key\" | \"Authorization\";\n readonly value: string;\n}\n\nconst base64Utf8 = (text: string): string =>\n btoa(Array.from(new TextEncoder().encode(text), (byte) => String.fromCharCode(byte)).join(\"\"));\n\nconst nonEmptyString = (value: unknown, name: string): string => {\n if (typeof value !== \"string\" || value.trim() === \"\") {\n throw new TypeError(`${name} must be a non-empty string`);\n }\n return value;\n};\n\n/**\n * Turns the client options into the header to send. Error messages never\n * contain the credentials.\n * @internal\n */\nexport function resolveCredentials(\n apiKey: string | undefined,\n auth: EnterpriseAuth | undefined,\n envApiKey: () => string | undefined,\n): Credentials | undefined {\n const key = apiKey?.trim();\n if (auth === undefined) {\n const resolved = key || envApiKey();\n return resolved ? { header: \"X-API-Key\", value: resolved } : undefined;\n }\n if (key) throw new TypeError(\"Pass either `apiKey` or `auth`, not both\");\n if (typeof auth !== \"object\" || auth === null) {\n throw new TypeError(\"auth must be an object\");\n }\n switch (auth.type) {\n case \"basic\": {\n const username = nonEmptyString(auth.username, \"auth.username\");\n if (username.includes(\":\")) throw new TypeError(\"auth.username must not contain a colon\");\n if (typeof auth.password !== \"string\") throw new TypeError(\"auth.password must be a string\");\n return {\n header: \"Authorization\",\n value: `Basic ${base64Utf8(`${username}:${auth.password}`)}`,\n };\n }\n case \"bearer\": {\n const token = nonEmptyString(auth.token, \"auth.token\").trim();\n if (!/^[\\x21-\\x7e]+$/.test(token)) {\n throw new TypeError(\"auth.token must not contain whitespace or non-ASCII characters\");\n }\n return { header: \"Authorization\", value: `Bearer ${token}` };\n }\n default:\n throw new TypeError(\n `auth.type must be \"basic\" or \"bearer\", got ${String((auth as { type?: unknown }).type)}`,\n );\n }\n}\n","import type { RateLimitInfo } from \"./rate-limit.js\";\n\n/**\n * Base class of every error thrown by this SDK.\n *\n * Aborts triggered by your own `AbortSignal` are not wrapped: the signal's\n * reason is re-thrown unchanged, exactly like `fetch` does.\n */\nexport class KachelmannError extends Error {\n override name = \"KachelmannError\";\n}\n\n/** Problem details as returned by the API in error responses. */\nexport interface ApiProblem {\n readonly type?: string;\n readonly title?: string;\n readonly status?: number;\n readonly detail?: string;\n}\n\nexport interface ApiErrorInit {\n readonly status: number;\n readonly method: string;\n /** Request URL. The API key is sent as a header and never appears here. */\n readonly url: string;\n readonly body: unknown;\n readonly rateLimit?: RateLimitInfo | undefined;\n}\n\nconst isProblem = (body: unknown): body is ApiProblem =>\n typeof body === \"object\" && body !== null && (\"title\" in body || \"detail\" in body);\n\n/** The API answered with a non-2xx status code. */\nexport class ApiError extends KachelmannError {\n override name = \"ApiError\";\n /** HTTP status code. */\n readonly status: number;\n readonly method: string;\n /** Request URL (without credentials). */\n readonly url: string;\n /** Parsed problem details, if the response body contained any. */\n readonly problem: ApiProblem | undefined;\n /** Raw response body (parsed JSON, or text). */\n readonly body: unknown;\n /** Rate-limit headers of the failed response, if present. */\n readonly rateLimit: RateLimitInfo | undefined;\n\n /**\n * @param init - Status, request and response body.\n * @param hint - Extra explanation appended to the message.\n */\n constructor(init: ApiErrorInit, hint?: string) {\n const problem = isProblem(init.body) ? init.body : undefined;\n const reason = [problem?.title, problem?.detail].filter(Boolean).join(\": \");\n super(\n `${init.method} ${init.url} failed with HTTP ${init.status}${reason ? ` (${reason})` : \"\"}${hint ? `. ${hint}` : \"\"}`,\n );\n this.status = init.status;\n this.method = init.method;\n this.url = init.url;\n this.problem = problem;\n this.body = init.body;\n this.rateLimit = init.rateLimit;\n }\n}\n\n/** HTTP 400: a parameter is invalid or out of bounds. */\nexport class BadRequestError extends ApiError {\n override name = \"BadRequestError\";\n}\n\n/** HTTP 401: the API key is missing or wrong. */\nexport class AuthenticationError extends ApiError {\n override name = \"AuthenticationError\";\n}\n\n/**\n * Appended to the message of every {@link PermissionDeniedError}.\n * @internal\n */\nexport const PERMISSION_DENIED_HINT =\n 'Your API key does not cover this request. Keys of some plans (e.g. Hobby, Smart-Home) only work for the API locations set under \"Manage API locations\" at https://accounts.meteologix.com/subscriptions. Other causes: an endpoint or station outside your plan, or a station search radius above 25 km.';\n\n/**\n * HTTP 403: your subscription does not cover this resource. Typical causes:\n * a location or station outside the API locations set in the account portal\n * (Hobby plans allow two), an endpoint your plan lacks, or a station search\n * radius above 25 km. `problem` contains the API's explanation; `message`\n * contains it too, followed by a hint about these causes.\n */\nexport class PermissionDeniedError extends ApiError {\n override name = \"PermissionDeniedError\";\n constructor(init: ApiErrorInit) {\n super(init, PERMISSION_DENIED_HINT);\n }\n}\n\n/** HTTP 404: the resource does not exist (e.g. an unknown weather symbol). */\nexport class NotFoundError extends ApiError {\n override name = \"NotFoundError\";\n}\n\n/** HTTP 429: the per-minute or per-day request limit was exceeded. */\nexport class RateLimitError extends ApiError {\n override name = \"RateLimitError\";\n /** When requests are allowed again (from `x-ratelimit-retry-after`), if known. */\n get retryAfter(): Date | undefined {\n return this.rateLimit?.retryAfter;\n }\n}\n\n/** HTTP 5xx: the API had an internal problem. */\nexport class ServerError extends ApiError {\n override name = \"ServerError\";\n}\n\n/** The request did not complete within the configured timeout. */\nexport class RequestTimeoutError extends KachelmannError {\n override name = \"RequestTimeoutError\";\n readonly timeout: number;\n constructor(timeout: number, options?: ErrorOptions) {\n super(`Request timed out after ${timeout} ms`, options);\n this.timeout = timeout;\n }\n}\n\n/** The request failed before a response arrived (DNS, TCP, TLS, ...). See `cause`. */\nexport class ConnectionError extends KachelmannError {\n override name = \"ConnectionError\";\n}\n\n/**\n * A request needs an API key, but none was configured (neither `apiKey`,\n * `KACHELMANN_API_KEY` nor enterprise `auth`). Thrown before any network\n * traffic.\n */\nexport class MissingApiKeyError extends KachelmannError {\n override name = \"MissingApiKeyError\";\n constructor(options?: ErrorOptions) {\n super(\n \"No API key configured. Pass `apiKey` to `new Kachelmann()` or set the KACHELMANN_API_KEY environment variable.\",\n options,\n );\n }\n}\n\n/** The API answered with 2xx, but the body could not be parsed or has an unexpected shape. */\nexport class InvalidResponseError extends KachelmannError {\n override name = \"InvalidResponseError\";\n}\n\n/** Maps an HTTP status code to the most specific error class. */\nexport function createApiError(init: ApiErrorInit): ApiError {\n switch (init.status) {\n case 400:\n return new BadRequestError(init);\n case 401:\n return new AuthenticationError(init);\n case 403:\n return new PermissionDeniedError(init);\n case 404:\n return new NotFoundError(init);\n case 429:\n return new RateLimitError(init);\n default:\n return init.status >= 500 ? new ServerError(init) : new ApiError(init);\n }\n}\n","/**\n * Rate-limit state as reported by the API in its response headers.\n *\n * The Hobby plan allows 120 requests per minute and 700 requests per day;\n * Business Starter allows 250 requests per minute.\n */\nexport interface RateLimitInfo {\n /** Value of `x-ratelimit-limit`: the request quota of the current window. */\n readonly limit?: number;\n /** Value of `x-ratelimit-remaining`: requests left in the current window. */\n readonly remaining?: number;\n /** Value of `x-ratelimit-retry-after`: when requests are allowed again after hitting the limit. */\n readonly retryAfter?: Date;\n}\n\nconst toInt = (value: string | null): number | undefined => {\n if (value === null || value.trim() === \"\") return undefined;\n const n = Number(value);\n return Number.isFinite(n) ? n : undefined;\n};\n\nconst toDate = (value: string | null): Date | undefined => {\n if (value === null || value.trim() === \"\") return undefined;\n // The API sends an ISO 8601 timestamp; tolerate a plain number of seconds as well.\n const seconds = Number(value);\n const date = Number.isFinite(seconds) ? new Date(Date.now() + seconds * 1000) : new Date(value);\n return Number.isNaN(date.getTime()) ? undefined : date;\n};\n\n/** Reads the `x-ratelimit-*` headers. Returns `undefined` if none of them is present. */\nexport function parseRateLimit(headers: Headers): RateLimitInfo | undefined {\n const limit = toInt(headers.get(\"x-ratelimit-limit\"));\n const remaining = toInt(headers.get(\"x-ratelimit-remaining\"));\n const retryAfter = toDate(headers.get(\"x-ratelimit-retry-after\"));\n if (limit === undefined && remaining === undefined && retryAfter === undefined) return undefined;\n return {\n ...(limit !== undefined && { limit }),\n ...(remaining !== undefined && { remaining }),\n ...(retryAfter !== undefined && { retryAfter }),\n };\n}\n","import type { Credentials } from \"./auth.js\";\nimport {\n type ApiError,\n ConnectionError,\n createApiError,\n InvalidResponseError,\n KachelmannError,\n MissingApiKeyError,\n RateLimitError,\n RequestTimeoutError,\n ServerError,\n} from \"./errors.js\";\nimport { parseRateLimit, type RateLimitInfo } from \"./rate-limit.js\";\n\n/** Default API base URL. */\nexport const DEFAULT_BASE_URL = \"https://api.kachelmannwetter.com/v02\";\n/** Default per-attempt timeout in milliseconds. */\nexport const DEFAULT_TIMEOUT = 10_000;\n\n/**\n * Retry behaviour for transient failures (connection errors, timeouts,\n * HTTP 429 and 5xx). Retries are **disabled by default** because the Hobby\n * plan has a daily request limit.\n */\nexport interface RetryOptions {\n /** Number of retries after the first attempt. Default: `0`. */\n readonly retries?: number;\n /** Base delay for exponential backoff in ms. Default: `500`. */\n readonly minDelay?: number;\n /**\n * Upper bound for a single delay in ms. Default: `10_000`. A 429 response\n * whose `x-ratelimit-retry-after` lies further in the future is not retried.\n */\n readonly maxDelay?: number;\n}\n\n/**\n * A query parameter value. Arrays and objects are encoded with PHP-style\n * brackets, e.g. `{ threshold: { temp: 0.1 } }` → `threshold[temp]=0.1` and\n * `{ year: [2025, 2026] }` → `year[0]=2025&year[1]=2026`.\n */\nexport type QueryValue =\n | string\n | number\n | boolean\n | undefined\n | readonly QueryValue[]\n | { readonly [key: string]: QueryValue };\n\nexport interface RequestOptions {\n /** Aborts the request. The signal's reason is re-thrown unchanged. */\n readonly signal?: AbortSignal | undefined;\n /** Per-attempt timeout in ms; overrides the client default. */\n readonly timeout?: number | undefined;\n}\n\n/**\n * How a request authenticates (API key, or enterprise Basic/Bearer auth):\n * - `\"required\"`: send the credentials; fail with {@link MissingApiKeyError}\n * before any network traffic if none are configured.\n * - `\"optional\"`: send the credentials if some are configured.\n * - `\"none\"`: never send credentials (endpoints that are public).\n */\nexport type AuthMode = \"required\" | \"optional\" | \"none\";\n\nexport interface InternalRequest extends RequestOptions {\n readonly path: string;\n /** Default: `\"required\"`. */\n readonly auth?: AuthMode;\n readonly query?: Readonly<Record<string, QueryValue>>;\n readonly accept?: string;\n readonly responseType?: \"json\" | \"text\";\n}\n\nexport interface HttpClientConfig {\n readonly credentials: Credentials | undefined;\n readonly baseUrl: string;\n readonly timeout: number;\n readonly retry: Required<RetryOptions>;\n readonly fetch: typeof fetch;\n readonly headers: Readonly<Record<string, string>>;\n}\n\nconst sleep = (ms: number, signal: AbortSignal | undefined): Promise<void> =>\n new Promise((resolve, reject) => {\n if (signal?.aborted) return reject(signal.reason);\n const timer = setTimeout(() => {\n signal?.removeEventListener(\"abort\", onAbort);\n resolve();\n }, ms);\n const onAbort = (): void => {\n clearTimeout(timer);\n reject(signal?.reason);\n };\n signal?.addEventListener(\"abort\", onAbort, { once: true });\n });\n\nfunction appendQuery(params: URLSearchParams, key: string, value: QueryValue): void {\n if (value === undefined) return;\n if (Array.isArray(value)) {\n value.forEach((item: QueryValue, index: number) => {\n appendQuery(params, `${key}[${index}]`, item);\n });\n } else if (typeof value === \"object\") {\n for (const [k, v] of Object.entries(value)) appendQuery(params, `${key}[${k}]`, v);\n } else {\n params.append(key, String(value));\n }\n}\n\n/** Encodes a query object. `undefined` values are skipped. */\nexport function buildQuery(query: Readonly<Record<string, QueryValue>> | undefined): string {\n if (!query) return \"\";\n const params = new URLSearchParams();\n for (const [key, value] of Object.entries(query)) appendQuery(params, key, value);\n const qs = params.toString();\n return qs ? `?${qs}` : \"\";\n}\n\n/**\n * Thin `fetch` wrapper: auth header, timeout, abort, retries and error mapping.\n * @internal\n */\nexport class HttpClient {\n readonly #config: HttpClientConfig;\n #rateLimit: RateLimitInfo | undefined;\n\n constructor(config: HttpClientConfig) {\n this.#config = config;\n }\n\n /** Rate-limit headers of the most recent response, if the API sent any. */\n get rateLimit(): RateLimitInfo | undefined {\n return this.#rateLimit;\n }\n\n /** Absolute URL for a path, without credentials. */\n url(path: string, query?: Readonly<Record<string, QueryValue>>): string {\n return `${this.#config.baseUrl}${path}${buildQuery(query)}`;\n }\n\n async get<T>(request: InternalRequest): Promise<T> {\n const { retries, minDelay, maxDelay } = this.#config.retry;\n for (let attempt = 0; ; attempt++) {\n try {\n return (await this.#attempt(request)) as T;\n } catch (error) {\n const delay =\n attempt < retries ? retryDelay(error, attempt, minDelay, maxDelay) : undefined;\n if (delay === undefined) throw error;\n await sleep(delay, request.signal);\n }\n }\n }\n\n async #attempt(request: InternalRequest): Promise<unknown> {\n const url = this.url(request.path, request.query);\n const timeout = request.timeout ?? this.#config.timeout;\n const userSignal = request.signal;\n userSignal?.throwIfAborted();\n\n const headers: Record<string, string> = {};\n for (const [name, value] of Object.entries(this.#config.headers)) {\n // Credentials are only ever set below, never through custom headers.\n if (!/^(x-api-key|authorization)$/i.test(name)) headers[name] = value;\n }\n headers.Accept = request.accept ?? \"application/json\";\n const auth = request.auth ?? \"required\";\n const credentials = this.#config.credentials;\n if (auth === \"required\" && !credentials) throw new MissingApiKeyError();\n if (auth !== \"none\" && credentials) headers[credentials.header] = credentials.value;\n\n const controller = new AbortController();\n let timedOut = false;\n const timer = setTimeout(() => {\n timedOut = true;\n controller.abort();\n }, timeout);\n const onUserAbort = (): void => controller.abort(userSignal?.reason);\n userSignal?.addEventListener(\"abort\", onUserAbort, { once: true });\n\n try {\n let response: Response;\n try {\n response = await this.#config.fetch(url, {\n method: \"GET\",\n headers,\n signal: controller.signal,\n });\n } catch (cause) {\n if (userSignal?.aborted) throw userSignal.reason;\n if (timedOut) throw new RequestTimeoutError(timeout, { cause });\n throw new ConnectionError(`GET ${url} failed: ${describe(cause)}`, { cause });\n }\n\n const rateLimit = parseRateLimit(response.headers);\n if (rateLimit) this.#rateLimit = rateLimit;\n\n if (!response.ok) {\n throw createApiError({\n status: response.status,\n method: \"GET\",\n url,\n body: await readBody(response),\n rateLimit,\n });\n }\n\n if (request.responseType === \"text\") return await response.text();\n const text = await response.text();\n try {\n return JSON.parse(text) as unknown;\n } catch (cause) {\n throw new InvalidResponseError(`GET ${url} returned a body that is not valid JSON`, {\n cause,\n });\n }\n } catch (error) {\n // A body read can also be interrupted by the timeout or the caller.\n if (userSignal?.aborted) throw userSignal.reason;\n if (timedOut && !(error instanceof KachelmannError)) {\n throw new RequestTimeoutError(timeout, { cause: error });\n }\n throw error;\n } finally {\n clearTimeout(timer);\n userSignal?.removeEventListener(\"abort\", onUserAbort);\n }\n }\n}\n\nconst describe = (error: unknown): string => {\n if (!(error instanceof Error)) return String(error);\n const cause = error.cause instanceof Error ? `: ${error.cause.message}` : \"\";\n return `${error.message}${cause}`;\n};\n\nasync function readBody(response: Response): Promise<unknown> {\n try {\n const text = await response.text();\n if (!text) return undefined;\n try {\n return JSON.parse(text) as unknown;\n } catch {\n return text.length > 2000 ? `${text.slice(0, 2000)}…` : text;\n }\n } catch {\n return undefined;\n }\n}\n\nconst RETRYABLE_STATUS = new Set([500, 502, 503, 504]);\n\n/** Delay before the next attempt, or `undefined` if the error must not be retried. */\nfunction retryDelay(\n error: unknown,\n attempt: number,\n minDelay: number,\n maxDelay: number,\n): number | undefined {\n const backoff = Math.min(maxDelay, minDelay * 2 ** attempt) * (0.5 + Math.random() * 0.5);\n\n if (error instanceof RateLimitError) {\n const retryAfter = error.retryAfter;\n if (!retryAfter) return backoff;\n const wait = retryAfter.getTime() - Date.now();\n return wait <= maxDelay ? Math.max(0, wait) : undefined;\n }\n if (error instanceof ServerError) {\n return RETRYABLE_STATUS.has((error as ApiError).status) ? backoff : undefined;\n }\n if (error instanceof ConnectionError || error instanceof RequestTimeoutError) return backoff;\n return undefined;\n}\n","import { InvalidResponseError } from \"./errors.js\";\nimport type { RequestOptions } from \"./http.js\";\nimport type { Coordinates, UnitSystem } from \"./types/common.js\";\n\n/** @internal */\nexport type Json = Record<string, unknown>;\n\n/** Options accepted by every method. */\nexport type CallOptions = RequestOptions;\n\n/**\n * Pass `{ raw: true }` to get the response exactly as the API sent it, typed\n * after the OpenAPI spec, without normalization.\n */\nexport interface RawOption {\n readonly raw: true;\n}\n\n/** The default: normalized responses. */\nexport interface NormalizedOption {\n /** `true` returns the unmodified API response. Default: `false`. */\n readonly raw?: false | undefined;\n}\n\n/** Implementation-side view of {@link RawOption} / {@link NormalizedOption}. @internal */\nexport type MaybeRaw = { readonly raw?: boolean | undefined };\n\n/** Options of methods whose response depends on the system of units. */\nexport interface UnitOptions<V extends UnitSystem> extends RequestOptions {\n /** Overrides the client's `units` for this call. */\n readonly units?: V;\n}\n\n/**\n * Throws a `RangeError` unless `location` holds valid WGS 84 coordinates, and a\n * `TypeError` if it has both `lon` and `lng` with different values. @internal\n */\nexport function coordinatesPath(location: Coordinates): string {\n const { lat, lon, lng } = (location ?? {}) as { lat?: unknown; lon?: unknown; lng?: unknown };\n if (lon !== undefined && lng !== undefined && lon !== lng) {\n throw new TypeError(`location has both lon (${String(lon)}) and lng (${String(lng)})`);\n }\n const longitude = lon ?? lng;\n if (typeof lat !== \"number\" || !Number.isFinite(lat) || lat < -90 || lat > 90) {\n throw new RangeError(`lat must be a number between -90 and 90, got ${String(lat)}`);\n }\n if (\n typeof longitude !== \"number\" ||\n !Number.isFinite(longitude) ||\n longitude < -180 ||\n longitude > 180\n ) {\n throw new RangeError(`lon must be a number between -180 and 180, got ${String(longitude)}`);\n }\n return `/${lat}/${longitude}`;\n}\n\n/** Encodes a path segment and rejects empty values. @internal */\nexport function segment(value: string | number, name: string): string {\n const text = String(value).trim();\n if (text === \"\") throw new TypeError(`${name} must not be empty`);\n return encodeURIComponent(text);\n}\n\n/** Throws unless one of `allowed` was given. @internal */\nexport function oneOf<T extends string>(value: T, allowed: readonly T[], name: string): T {\n if (!allowed.includes(value)) {\n throw new TypeError(`${name} must be one of ${allowed.join(\", \")}, got ${String(value)}`);\n }\n return value;\n}\n\n/** Ensures the API answered with a JSON object. @internal */\nexport function expectObject(value: unknown, what: string): Json {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n throw new InvalidResponseError(`Unexpected ${what} response: expected a JSON object`);\n }\n return value as Json;\n}\n\n/** Ensures the API answered with a JSON array or object map. @internal */\nexport function expectCollection(value: unknown, what: string): unknown {\n if (typeof value !== \"object\" || value === null) {\n throw new InvalidResponseError(`Unexpected ${what} response: expected a JSON array`);\n }\n return value;\n}\n\n/** Picks `signal` and `timeout` from call options. @internal */\nexport function requestOptions(options: RequestOptions | undefined): RequestOptions {\n return { signal: options?.signal, timeout: options?.timeout };\n}\n","/**\n * The API is served by a PHP backend: a list may be serialized as a JSON\n * array or as an object with numeric keys, and an empty map as `[]`. The spec\n * documents this as `oneOf: [array, object]` on almost every collection.\n * These helpers give every collection one stable shape.\n * @internal\n */\n\nconst isObject = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\n/** Array or object-map → array. `null`/`undefined` → `[]`. */\nexport function toArray<T>(value: unknown): T[] {\n if (Array.isArray(value)) return value as T[];\n if (isObject(value)) return Object.values(value) as T[];\n return [];\n}\n\n/** Like {@link toArray}, but keeps `null` (for fields documented as nullable). */\nexport function toArrayOrNull<T>(value: unknown): T[] | null {\n return value === null ? null : toArray<T>(value);\n}\n\n/**\n * Object-map or array → map keyed by `name`. An empty array (PHP's empty map)\n * becomes `{}`; array items are keyed by their `name` property.\n */\nexport function toRecordByName<T extends { name: string }>(value: unknown): Record<string, T> {\n if (isObject(value)) return value as Record<string, T>;\n const record: Record<string, T> = {};\n if (Array.isArray(value)) {\n for (const item of value) {\n if (isObject(item) && typeof item.name === \"string\") record[item.name] = item as T;\n }\n }\n return record;\n}\n\n/** Numeric strings → numbers; other values are passed through. */\nexport function toNumberish<T>(value: T): T | number {\n if (typeof value !== \"string\" || value.trim() === \"\") return value;\n const n = Number(value);\n return Number.isFinite(n) ? n : value;\n}\n\n/** Numbers and numeric strings → number; anything else → `null`. */\nexport function toNumberOrNull(value: unknown): number | null {\n if (typeof value === \"number\") return Number.isFinite(value) ? value : null;\n const n = toNumberish(value);\n return typeof n === \"number\" ? n : null;\n}\n","import type { HttpClient } from \"../http.js\";\nimport {\n type CallOptions,\n expectCollection,\n expectObject,\n type Json,\n oneOf,\n requestOptions,\n segment,\n} from \"../internal.js\";\nimport { toArray } from \"../normalize.js\";\nimport type {\n ClimateCity,\n ClimateHeatmap,\n ClimateMapStation,\n ClimateParameter,\n ClimatePeriod,\n ClimateSearchResult,\n ClimateSeason,\n ClimateSpaghetti,\n ClimateStation,\n ClimateStationList,\n ClimateStripes,\n ClimateValueType,\n} from \"../types/climate.js\";\n\nconst BASE = \"/_frontend\";\nconst PARAMETERS: readonly ClimateParameter[] = [\"tlmean\", \"rrsum\", \"shsum\"];\n/** The website allows at most this many compared years. */\nconst MAX_COMPARED_YEARS = 5;\n\ninterface ClimateChartOptions extends CallOptions {\n /** `tlmean` (°C), `rrsum` (mm) or `shsum` (h). */\n readonly param: ClimateParameter;\n /** First year. */\n readonly start?: number;\n /** Last year. */\n readonly end?: number;\n /** Reference period, e.g. `\"1961-1990\"`. See `station().station.details.references`. */\n readonly reference?: ClimatePeriod;\n /** `absolute` values or the `difference` to the reference period. */\n readonly type?: ClimateValueType;\n}\n\n/** Options of `climate.stripes()`. */\nexport interface ClimateStripesOptions extends ClimateChartOptions {\n /** One stripe per year (`byYear`, default) or per year for one season (`bySeason`). */\n readonly by?: \"byYear\" | \"bySeason\";\n /** Season for `by: \"bySeason\"`. */\n readonly season?: ClimateSeason;\n}\n\n/** Options of `climate.heatmap()`. */\nexport interface ClimateHeatmapOptions extends ClimateChartOptions {\n /** `byYear` (default): all years; `byMonth`: the months of `year`. */\n readonly by?: \"byYear\" | \"byMonth\";\n /** Year for `by: \"byMonth\"`. */\n readonly year?: number;\n}\n\n/** Options of `climate.spaghetti()`. */\nexport interface ClimateSpaghettiOptions extends ClimateChartOptions {\n /** Years to highlight (`selected: true`), at most 5. */\n readonly comparedYears?: readonly number[];\n}\n\n/**\n * **Experimental.** Climate time series (warming stripes, heatmaps, daily\n * curves) of long-term stations. Access via `client.experimental.climate`.\n *\n * These endpoints are **not part of the documented v02 API**: they power the\n * climate pages of kachelmannwetter.com and may change or disappear at any\n * time. They are called with *your* API key. In a live test (November 2026)\n * a regular customer key was rejected with `PermissionDeniedError` (403).\n *\n * @experimental\n */\nexport class ClimateResource {\n readonly #http: HttpClient;\n\n /** @internal */\n constructor(http: HttpClient) {\n this.#http = http;\n }\n\n /** Climate stations of a country, plus large cities for orientation. */\n async stations(country: string, options?: CallOptions): Promise<ClimateStationList> {\n if (typeof country !== \"string\" || !/^[A-Za-z]{2}$/.test(country)) {\n throw new TypeError('country must be an ISO 3166-1 alpha-2 code, e.g. \"DE\"');\n }\n const raw = expectObject(\n await this.#http.get({\n path: `${BASE}/v2/climate/map`,\n query: { country: country.toUpperCase() },\n ...requestOptions(options),\n }),\n \"climate stations\",\n );\n return {\n stations: toArray<ClimateMapStation>(raw.stations),\n cities: toArray<ClimateCity>(raw.cities),\n };\n }\n\n /** Finds climate stations by station or place name. */\n async search(query: string, options?: CallOptions): Promise<ClimateSearchResult[]> {\n if (typeof query !== \"string\" || query.trim() === \"\") {\n throw new TypeError(\"query must not be empty\");\n }\n const raw = expectCollection(\n await this.#http.get({\n path: `${BASE}/climate/search`,\n query: { query: query.trim() },\n ...requestOptions(options),\n }),\n \"climate search\",\n );\n return toArray<ClimateSearchResult>(raw);\n }\n\n /** Station details, supported charts, data availability and records. */\n async station(stationId: string, options?: CallOptions): Promise<ClimateStation> {\n const raw = expectObject(\n await this.#http.get({\n path: `${BASE}/climate/${segment(stationId, \"stationId\")}`,\n ...requestOptions(options),\n }),\n \"climate station\",\n );\n return raw as unknown as ClimateStation;\n }\n\n /** Warming stripes: one value per year (or per season of each year). */\n async stripes(stationId: string, options: ClimateStripesOptions): Promise<ClimateStripes> {\n const by = oneOf(options.by ?? \"byYear\", [\"byYear\", \"bySeason\"], \"by\");\n const raw = await this.#chart(stationId, `stripes/${by}`, options, { seasons: options.season });\n return {\n ...raw,\n categories: toArray(raw.categories),\n matrix: toArray(raw.matrix),\n } as unknown as ClimateStripes;\n }\n\n /** Heatmap of monthly, seasonal and yearly values. */\n async heatmap(stationId: string, options: ClimateHeatmapOptions): Promise<ClimateHeatmap> {\n const by = oneOf(options.by ?? \"byYear\", [\"byYear\", \"byMonth\"], \"by\");\n return (await this.#chart(stationId, `heatmap/${by}`, options, {\n year: options.year,\n })) as unknown as ClimateHeatmap;\n }\n\n /** Daily values of each year (\"spaghetti\" chart) plus the reference period. */\n async spaghetti(stationId: string, options: ClimateSpaghettiOptions): Promise<ClimateSpaghetti> {\n const years = options.comparedYears;\n if (years && years.length > MAX_COMPARED_YEARS) {\n throw new RangeError(`comparedYears accepts at most ${MAX_COMPARED_YEARS} years`);\n }\n const raw = await this.#chart(stationId, \"spaghetti/daily\", options, {\n comparedYear: years ? [...years] : undefined,\n });\n return { ...raw, series: toArray(raw.series) } as unknown as ClimateSpaghetti;\n }\n\n async #chart(\n stationId: string,\n chart: string,\n options: ClimateChartOptions,\n extra: Record<string, number | string | number[] | undefined>,\n ): Promise<Json> {\n return expectObject(\n await this.#http.get({\n path: `${BASE}/climate/${segment(stationId, \"stationId\")}/${chart}`,\n query: {\n param: oneOf(options.param, PARAMETERS, \"param\"),\n start: options.start,\n end: options.end,\n reference: options.reference,\n type: options.type,\n ...extra,\n },\n ...requestOptions(options),\n }),\n `climate ${chart}`,\n );\n }\n}\n","import type { HttpClient } from \"../http.js\";\nimport {\n coordinatesPath,\n expectObject,\n type Json,\n type MaybeRaw,\n type NormalizedOption,\n oneOf,\n type RawOption,\n requestOptions,\n type UnitOptions,\n} from \"../internal.js\";\nimport { toArray } from \"../normalize.js\";\nimport type { Coordinates, ForecastModel, UnitSystem } from \"../types/common.js\";\nimport type {\n AdvancedForecast,\n DailyForecast,\n ForecastTimeSteps,\n StandardForecast,\n ThreeDayForecast,\n Trend14Days,\n TrendDay,\n} from \"../types/forecast.js\";\nimport type {\n RawAdvancedForecast,\n RawStandardForecast,\n RawThreeDayForecast,\n RawTrend14Days,\n} from \"../types/raw.js\";\n\nconst TIME_STEPS: readonly ForecastTimeSteps[] = [\"1h\", \"3h\", \"6h\"];\n\n/** Options of `forecast.threeDay()`. */\nexport interface ThreeDayOptions<V extends UnitSystem> extends UnitOptions<V> {\n /**\n * Only use forecast models that cover at least this many days. Ignored by\n * the API when `model` is set.\n */\n readonly minDays?: number;\n /** Request a specific forecast model. Omit to let the API pick the best one. */\n readonly model?: ForecastModel;\n}\n\ntype Options = UnitOptions<UnitSystem> & MaybeRaw;\n\nconst withRisks = <T extends Json>(item: T): T => ({ ...item, risks: toArray(item.risks) });\n\n/** Forecast endpoints. Access via `client.forecast`. */\nexport class ForecastResource<U extends UnitSystem = UnitSystem> {\n readonly #http: HttpClient;\n readonly #units: U;\n\n /** @internal */\n constructor(http: HttpClient, units: U) {\n this.#http = http;\n this.#units = units;\n }\n\n /**\n * Standard parameter package: temperature, wind, precipitation, clouds,\n * sunshine and snow per time step.\n *\n * @param timeSteps `\"1h\"` (24 h ahead), `\"3h\"` (120 h) or `\"6h\"` (240 h).\n * @example\n * const forecast = await client.forecast.standard({ lat: 50.1, lon: 8.7 }, \"3h\");\n */\n standard<V extends UnitSystem = U>(\n location: Coordinates,\n timeSteps: ForecastTimeSteps,\n options?: UnitOptions<V> & NormalizedOption,\n ): Promise<StandardForecast<V>>;\n /** Standard parameter package, exactly as the API sent it. */\n standard<V extends UnitSystem = U>(\n location: Coordinates,\n timeSteps: ForecastTimeSteps,\n options: UnitOptions<V> & RawOption,\n ): Promise<RawStandardForecast>;\n async standard(\n location: Coordinates,\n timeSteps: ForecastTimeSteps,\n options?: Options,\n ): Promise<unknown> {\n return this.#series(location, \"standard\", timeSteps, options);\n }\n\n /**\n * Advanced parameter package: everything from `standard()` plus min/max\n * temperatures, cloud layers, global radiation, precipitation and snow sums,\n * WMO code and weather symbol.\n */\n advanced<V extends UnitSystem = U>(\n location: Coordinates,\n timeSteps: ForecastTimeSteps,\n options?: UnitOptions<V> & NormalizedOption,\n ): Promise<AdvancedForecast<V>>;\n /** Advanced parameter package, exactly as the API sent it. */\n advanced<V extends UnitSystem = U>(\n location: Coordinates,\n timeSteps: ForecastTimeSteps,\n options: UnitOptions<V> & RawOption,\n ): Promise<RawAdvancedForecast>;\n async advanced(\n location: Coordinates,\n timeSteps: ForecastTimeSteps,\n options?: Options,\n ): Promise<unknown> {\n return this.#series(location, \"advanced\", timeSteps, options);\n }\n\n /** Daily summaries for three days, each split into night, morning, afternoon and evening. */\n threeDay<V extends UnitSystem = U>(\n location: Coordinates,\n options?: ThreeDayOptions<V> & NormalizedOption,\n ): Promise<ThreeDayForecast<V>>;\n /** Three-day forecast, exactly as the API sent it. */\n threeDay<V extends UnitSystem = U>(\n location: Coordinates,\n options: ThreeDayOptions<V> & RawOption,\n ): Promise<RawThreeDayForecast>;\n async threeDay(\n location: Coordinates,\n options?: ThreeDayOptions<UnitSystem> & MaybeRaw,\n ): Promise<unknown> {\n const units = options?.units ?? this.#units;\n const body = await this.#http.get({\n path: `/forecast${coordinatesPath(location)}/3day`,\n query: { units, minDays: options?.minDays, model: options?.model },\n accept: \"application/vnd.kmw.v2+json\",\n ...requestOptions(options),\n });\n if (options?.raw) return body;\n const raw = expectObject(body, \"3-day forecast\");\n const data = toArray<Json>(raw.data).map((day) => ({\n ...withRisks(day),\n timeOfDay: toArray<Json>(day.timeOfDay).map(withRisks),\n }));\n return {\n ...raw,\n systemOfUnits: raw.systemOfUnits ?? units,\n data: data as unknown as DailyForecast[],\n };\n }\n\n /** Daily trend for 14 days, with the range across forecast models. */\n trend14Days<V extends UnitSystem = U>(\n location: Coordinates,\n options?: UnitOptions<V> & NormalizedOption,\n ): Promise<Trend14Days<V>>;\n /** 14-day trend, exactly as the API sent it. */\n trend14Days<V extends UnitSystem = U>(\n location: Coordinates,\n options: UnitOptions<V> & RawOption,\n ): Promise<RawTrend14Days>;\n async trend14Days(location: Coordinates, options?: Options): Promise<unknown> {\n const units = options?.units ?? this.#units;\n const body = await this.#http.get({\n path: `/forecast${coordinatesPath(location)}/trend14days`,\n query: { units },\n ...requestOptions(options),\n });\n if (options?.raw) return body;\n const raw = expectObject(body, \"14-day trend\");\n return {\n ...raw,\n systemOfUnits: raw.systemOfUnits ?? units,\n data: toArray<Json>(raw.data).map(withRisks) as unknown as TrendDay[],\n };\n }\n\n async #series(\n location: Coordinates,\n kind: \"standard\" | \"advanced\",\n timeSteps: ForecastTimeSteps,\n options: Options | undefined,\n ): Promise<unknown> {\n const units = options?.units ?? this.#units;\n const path = `/forecast${coordinatesPath(location)}/${kind}/${oneOf(timeSteps, TIME_STEPS, \"timeSteps\")}`;\n const body = await this.#http.get({ path, query: { units }, ...requestOptions(options) });\n if (options?.raw) return body;\n const raw = expectObject(body, `${kind} forecast`);\n return { ...raw, systemOfUnits: raw.systemOfUnits ?? units, data: toArray(raw.data) };\n }\n}\n","import { InvalidResponseError } from \"../errors.js\";\nimport type { HttpClient } from \"../http.js\";\nimport { type CallOptions, expectObject, type Json, requestOptions, segment } from \"../internal.js\";\nimport { toArray } from \"../normalize.js\";\nimport type { DateString, UnitSystem } from \"../types/common.js\";\nimport type { PhotoWindUnit, WeatherPhoto } from \"../types/photos.js\";\n\nconst BASE = \"/community/weatherphotos\";\n\n/** Options of `photos.list()`. */\nexport interface PhotoListOptions extends CallOptions {\n /** First day (inclusive), `YYYY-MM-DD` or a `Date` (its UTC date is used). */\n readonly from: DateString | Date;\n /** Last day (inclusive), `YYYY-MM-DD` or a `Date` (its UTC date is used). */\n readonly to: DateString | Date;\n /** Wind unit of the attached weather data. */\n readonly windUnit?: PhotoWindUnit;\n /** Length units of the attached weather data. */\n readonly units?: UnitSystem;\n}\n\nconst DATE_PATTERN = /^\\d{4}-\\d{2}-\\d{2}$/;\n\nconst toDateString = (value: DateString | Date, name: string): string => {\n if (value instanceof Date) {\n if (Number.isNaN(value.getTime())) throw new RangeError(`${name} is an invalid Date`);\n return value.toISOString().slice(0, 10);\n }\n if (typeof value !== \"string\" || !DATE_PATTERN.test(value)) {\n throw new RangeError(`${name} must be a YYYY-MM-DD string or a Date`);\n }\n return value;\n};\n\nconst expectSuccess = (value: unknown, what: string): Json => {\n const raw = expectObject(value, what);\n if (raw.status !== \"success\") {\n throw new InvalidResponseError(`Unexpected ${what} response: status ${String(raw.status)}`);\n }\n return raw;\n};\n\n/**\n * **Experimental.** Read-only access to the community weather photos of\n * kachelmannwetter.com. Access via `client.photos`.\n *\n * These endpoints are **not part of the documented v02 API** and may change\n * at any time. They are public: no API key is sent. Liking, uploading and\n * view counting need a user account and are not supported.\n *\n * Photos are licensed to Kachelmann GmbH and contain personal data (uploader\n * names, locations): respect copyright and data protection law.\n *\n * @experimental\n */\nexport class PhotosResource {\n readonly #http: HttpClient;\n\n /** @internal */\n constructor(http: HttpClient) {\n this.#http = http;\n }\n\n /** Number of photos per day, keyed by `YYYY-MM-DD`. */\n async counts(options?: CallOptions): Promise<Record<DateString, number>> {\n const raw = expectSuccess(\n await this.#http.get({ path: `${BASE}/counts`, auth: \"none\", ...requestOptions(options) }),\n \"photo counts\",\n );\n return expectObject(raw.counts, \"photo counts\") as Record<DateString, number>;\n }\n\n /** Photos taken between two days. */\n async list(options: PhotoListOptions): Promise<WeatherPhoto[]> {\n const lengthUnit =\n options.units === undefined ? undefined : options.units === \"imperial\" ? \"anglo\" : \"metrisch\";\n const raw = expectObject(\n await this.#http.get({\n path: `${BASE}/list`,\n query: {\n startDate: toDateString(options.from, \"from\"),\n endDate: toDateString(options.to, \"to\"),\n format: \"geojson\",\n windUnit: options.windUnit,\n lengthUnit,\n },\n auth: \"none\",\n ...requestOptions(options),\n }),\n \"photo list\",\n );\n return toArray<Json>(raw.features)\n .map((feature) => feature?.properties)\n .filter((props): props is Json => typeof props === \"object\" && props !== null)\n .map((props) => props as unknown as WeatherPhoto);\n }\n\n /** A single photo. Throws `NotFoundError` if it does not exist. */\n async get(id: string, options?: CallOptions): Promise<WeatherPhoto> {\n const raw = expectSuccess(\n await this.#http.get({\n path: `${BASE}/${segment(id, \"id\")}`,\n auth: \"none\",\n ...requestOptions(options),\n }),\n \"photo\",\n );\n return expectObject(raw.photo, \"photo\") as unknown as WeatherPhoto;\n }\n}\n","import type { HttpClient } from \"../http.js\";\nimport {\n type CallOptions,\n coordinatesPath,\n expectCollection,\n expectObject,\n type Json,\n type MaybeRaw,\n type NormalizedOption,\n oneOf,\n type RawOption,\n requestOptions,\n segment,\n} from \"../internal.js\";\nimport { toArray, toNumberOrNull, toRecordByName } from \"../normalize.js\";\nimport type { Coordinates } from \"../types/common.js\";\nimport type { RawObservations, RawStationLatest, RawStationSearch } from \"../types/raw.js\";\nimport type {\n LatestObservationValue,\n ObservationsFor,\n ObservationTimeSteps,\n StationHeader,\n StationInformation,\n StationLatest,\n Threshold,\n} from \"../types/stations.js\";\n\nconst TIME_STEPS: readonly ObservationTimeSteps[] = [\"10min\", \"1h\", \"1d\"];\n\n/** Options of `stations.search()`. */\nexport interface StationSearchOptions extends CallOptions {\n /**\n * Search radius around the location. Unit: km. The API answers HTTP 403\n * (`PermissionDeniedError`) above **25 km**; this limit is not in the spec.\n */\n readonly radius?: number;\n}\n\n/** Options of `stations.observations()`. */\nexport interface ObservationOptions extends CallOptions {\n /**\n * Count how many values exceed a threshold, per parameter. Results appear\n * in each entry's `thresholds`, keyed by parameter name.\n * @example { temp: 25, prec: 0.1 }\n */\n readonly threshold?: Readonly<Record<string, number>>;\n}\n\n/** Station coordinates may arrive as strings. @internal */\nexport const normalizeStation = (raw: Json): StationInformation =>\n ({\n ...raw,\n lat: toNumberOrNull(raw.lat) ?? raw.lat,\n lon: toNumberOrNull(raw.lon) ?? raw.lon,\n }) as unknown as StationInformation;\n\nconst header = (raw: Json): StationHeader => ({\n ...(raw as unknown as StationHeader),\n lat: toNumberOrNull(raw.lat),\n lon: toNumberOrNull(raw.lon),\n ele: toNumberOrNull(raw.ele),\n});\n\nconst observation = (raw: Json): Json => {\n const entry: Json = { ...raw, thresholds: toRecordByName<Threshold>(raw.thresholds) };\n if (\"snowHeight\" in raw) entry.snowHeight = toNumberOrNull(raw.snowHeight);\n return entry;\n};\n\n/** Weather station endpoints. Access via `client.stations`. */\nexport class StationsResource {\n readonly #http: HttpClient;\n\n /** @internal */\n constructor(http: HttpClient) {\n this.#http = http;\n }\n\n /**\n * Stations near a location, closest first.\n * @example\n * const stations = await client.stations.search({ lat: 50.1, lon: 8.7 }, { radius: 20 });\n */\n search(\n location: Coordinates,\n options?: StationSearchOptions & NormalizedOption,\n ): Promise<StationInformation[]>;\n /** Nearby stations, exactly as the API sent them. */\n search(\n location: Coordinates,\n options: StationSearchOptions & RawOption,\n ): Promise<RawStationSearch>;\n async search(location: Coordinates, options?: StationSearchOptions & MaybeRaw): Promise<unknown> {\n const body = await this.#http.get({\n path: `/station/search${coordinatesPath(location)}`,\n query: { radius: options?.radius },\n ...requestOptions(options),\n });\n if (options?.raw) return body;\n return toArray<Json>(expectCollection(body, \"station search\")).map(normalizeStation);\n }\n\n /**\n * Latest measured value of every parameter of a station. Always metric,\n * wind speeds in **knots**.\n */\n latest(stationId: string, options?: CallOptions & NormalizedOption): Promise<StationLatest>;\n /** Latest station values, exactly as the API sent them. */\n latest(stationId: string, options: CallOptions & RawOption): Promise<RawStationLatest>;\n async latest(stationId: string, options?: CallOptions & MaybeRaw): Promise<unknown> {\n const body = await this.#http.get({\n path: `/station/${segment(stationId, \"stationId\")}/observations/latest`,\n ...requestOptions(options),\n });\n if (options?.raw) return body;\n const raw = expectObject(body, \"latest observations\");\n return {\n ...header(raw),\n data: toRecordByName<LatestObservationValue>(raw.data),\n };\n }\n\n /**\n * Observation history of a station. Always metric, wind speeds in **knots**.\n *\n * - `\"10min\"`: raw observations of the last 6 hours\n * - `\"1h\"`: hourly aggregates of the last 24 hours\n * - `\"1d\"`: daily aggregates of the last 7 days\n *\n * Throws `PermissionDeniedError` (HTTP 403) if your plan does not cover the station.\n * @example\n * const { data } = await client.stations.observations(\"106350\", \"1h\", { threshold: { temp: 0 } });\n */\n observations<T extends ObservationTimeSteps>(\n stationId: string,\n timeSteps: T,\n options?: ObservationOptions & NormalizedOption,\n ): Promise<ObservationsFor<T>>;\n /** Observation history, exactly as the API sent it. */\n observations(\n stationId: string,\n timeSteps: ObservationTimeSteps,\n options: ObservationOptions & RawOption,\n ): Promise<RawObservations>;\n async observations(\n stationId: string,\n timeSteps: ObservationTimeSteps,\n options?: ObservationOptions & MaybeRaw,\n ): Promise<unknown> {\n const body = await this.#http.get({\n path: `/station/${segment(stationId, \"stationId\")}/observations/${oneOf<ObservationTimeSteps>(timeSteps, TIME_STEPS, \"timeSteps\")}`,\n query: { threshold: options?.threshold },\n ...requestOptions(options),\n });\n if (options?.raw) return body;\n const raw = expectObject(body, \"observations\");\n return {\n ...header(raw),\n data: toArray<Json>(raw.data).map(observation),\n };\n }\n}\n","import type { HttpClient } from \"../http.js\";\nimport {\n type CallOptions,\n coordinatesPath,\n expectObject,\n type MaybeRaw,\n type NormalizedOption,\n type RawOption,\n requestOptions,\n} from \"../internal.js\";\nimport { toArray } from \"../normalize.js\";\nimport type { Coordinates, WeatherSymbol } from \"../types/common.js\";\nimport type { RawAstronomy } from \"../types/raw.js\";\nimport type { Astronomy, AstronomyDay } from \"../types/tools.js\";\n\nconst SYMBOL_PATTERN = /^[A-Za-z0-9_-]+$/;\n\nconst symbolPath = (symbol: WeatherSymbol): string => {\n if (typeof symbol !== \"string\" || !SYMBOL_PATTERN.test(symbol)) {\n throw new TypeError(`Invalid weather symbol: ${String(symbol)}`);\n }\n return `/tools/weatherSymbol/${symbol}.svg`;\n};\n\n/** Tool endpoints (astronomy, weather symbols). Access via `client.tools`. */\nexport class ToolsResource {\n readonly #http: HttpClient;\n\n /** @internal */\n constructor(http: HttpClient) {\n this.#http = http;\n }\n\n /** Sunrise, sunset, twilight and moon data for the next 14 days. */\n astronomy(location: Coordinates, options?: CallOptions & NormalizedOption): Promise<Astronomy>;\n /** Astronomy data, exactly as the API sent it. */\n astronomy(location: Coordinates, options: CallOptions & RawOption): Promise<RawAstronomy>;\n async astronomy(location: Coordinates, options?: CallOptions & MaybeRaw): Promise<unknown> {\n const body = await this.#http.get({\n path: `/tools/astronomy${coordinatesPath(location)}`,\n ...requestOptions(options),\n });\n if (options?.raw) return body;\n const raw = expectObject(body, \"astronomy\");\n return { ...raw, dailyData: toArray<AstronomyDay>(raw.dailyData) };\n }\n\n /**\n * Downloads the SVG markup of a weather symbol, e.g. `\"partlycloudy_night\"`.\n * The API key is sent if one is configured. The endpoint also works\n * without one (checked live, November 2026).\n */\n async weatherSymbol(symbol: WeatherSymbol, options?: CallOptions): Promise<string> {\n return this.#http.get<string>({\n path: symbolPath(symbol),\n accept: \"image/svg+xml\",\n responseType: \"text\",\n auth: \"optional\",\n ...requestOptions(options),\n });\n }\n\n /**\n * URL of a weather symbol SVG, e.g. for an `<img src>`. The URL contains no\n * credentials; the endpoint answered without an API key in a live test\n * (November 2026).\n */\n weatherSymbolUrl(symbol: WeatherSymbol): string {\n return this.#http.url(symbolPath(symbol));\n }\n}\n","import { type EnterpriseAuth, resolveCredentials } from \"./auth.js\";\nimport { DEFAULT_BASE_URL, DEFAULT_TIMEOUT, HttpClient, type RetryOptions } from \"./http.js\";\nimport {\n coordinatesPath,\n expectObject,\n type Json,\n type MaybeRaw,\n type NormalizedOption,\n type RawOption,\n requestOptions,\n type UnitOptions,\n} from \"./internal.js\";\nimport { toRecordByName } from \"./normalize.js\";\nimport type { RateLimitInfo } from \"./rate-limit.js\";\nimport { ClimateResource } from \"./resources/climate.js\";\nimport { ForecastResource } from \"./resources/forecast.js\";\nimport { PhotosResource } from \"./resources/photos.js\";\nimport { normalizeStation, StationsResource } from \"./resources/stations.js\";\nimport { ToolsResource } from \"./resources/tools.js\";\nimport type { Coordinates, UnitSystem } from \"./types/common.js\";\nimport type { CurrentValue, CurrentWeather, CurrentWeatherData } from \"./types/current.js\";\nimport type { RawCurrentWeather } from \"./types/raw.js\";\n\n/**\n * Experimental modules, accessed via `client.experimental`. They use\n * undocumented endpoints, are not covered by semver and may be removed.\n * @experimental\n */\nexport interface ExperimentalApi {\n /**\n * Climate time series of long-term stations (warming stripes, heatmaps,\n * daily curves). In a live test (November 2026) a regular customer key was\n * rejected with HTTP 403.\n * @experimental\n */\n readonly climate: ClimateResource;\n}\n\n/** Options of `new Kachelmann()`. */\nexport interface KachelmannOptions<U extends UnitSystem = \"metric\"> {\n /**\n * Your API key. Defaults to the `KACHELMANN_API_KEY` environment variable\n * (where `process.env` exists). Only needed for requests that require it;\n * the photo endpoints work without a key.\n */\n readonly apiKey?: string | undefined;\n /**\n * **Enterprise only.** Basic or Bearer authentication instead of an API key.\n * The API documents both as \"currently for internal and enterprise use\n * only\": use them only if Meteologix told you to. When set, `apiKey` must be\n * omitted and `KACHELMANN_API_KEY` is ignored. Not verified against the live\n * API by this SDK's tests.\n * @example\n * new Kachelmann({ auth: { type: \"bearer\", token: \"<token from Meteologix>\" } });\n */\n readonly auth?: EnterpriseAuth | undefined;\n /** Default system of units for forecasts and current weather. Default: `\"metric\"`. */\n readonly units?: U;\n /** API base URL. Default: `https://api.kachelmannwetter.com/v02`. */\n readonly baseUrl?: string;\n /** Per-attempt timeout in ms. Default: `10000`. */\n readonly timeout?: number;\n /**\n * Retries for connection errors, timeouts, HTTP 429 and 5xx: a number of\n * retries or detailed options. Default: `0` (disabled), because plans have\n * a daily request limit.\n */\n readonly retry?: number | RetryOptions;\n /** Custom `fetch` implementation, e.g. for testing or proxies. Default: global `fetch`. */\n readonly fetch?: typeof fetch;\n /** Extra headers sent with every request. Credentials cannot be set here. */\n readonly headers?: Readonly<Record<string, string>>;\n}\n\nconst envApiKey = (): string | undefined => {\n const process = (globalThis as { process?: { env?: Record<string, string | undefined> } })\n .process;\n const key = process?.env?.KACHELMANN_API_KEY;\n return key?.trim() ? key.trim() : undefined;\n};\n\nconst nonNegative = (value: number | undefined, fallback: number, name: string): number => {\n if (value === undefined) return fallback;\n if (!Number.isFinite(value) || value < 0) {\n throw new RangeError(`${name} must be a non-negative number`);\n }\n return value;\n};\n\nconst resolveRetry = (retry: number | RetryOptions | undefined): Required<RetryOptions> => {\n const options = typeof retry === \"number\" ? { retries: retry } : (retry ?? {});\n return {\n retries: Math.floor(nonNegative(options.retries, 0, \"retry.retries\")),\n minDelay: nonNegative(options.minDelay, 500, \"retry.minDelay\"),\n maxDelay: nonNegative(options.maxDelay, 10_000, \"retry.maxDelay\"),\n };\n};\n\n/**\n * Client for the Kachelmannwetter API v02.\n *\n * @typeParam U - Default system of units, inferred from `options.units`.\n * @example\n * import { Kachelmann } from \"kmw-sdk\";\n *\n * const client = new Kachelmann({ apiKey: process.env.KACHELMANN_API_KEY });\n * const forecast = await client.forecast.threeDay({ lat: 50.1, lon: 8.7 });\n */\nexport class Kachelmann<U extends UnitSystem = \"metric\"> {\n /** Forecasts: standard/advanced time series, 3-day summary and 14-day trend. */\n readonly forecast: ForecastResource<U>;\n /** Weather stations: search, latest values and observation history. */\n readonly stations: StationsResource;\n /** Astronomy data and weather symbols. */\n readonly tools: ToolsResource;\n /**\n * Endpoints that are known not to work with regular API keys yet. Not\n * covered by semver. See {@link ExperimentalApi}.\n * @experimental\n */\n readonly experimental: ExperimentalApi;\n /**\n * **Experimental**, undocumented: community weather photos (read-only, no key needed).\n * @experimental\n */\n readonly photos: PhotosResource;\n\n readonly #http: HttpClient;\n readonly #units: U;\n\n constructor(options: KachelmannOptions<U> = {}) {\n const fetchImpl = options.fetch ?? globalThis.fetch;\n if (typeof fetchImpl !== \"function\") {\n throw new TypeError(\"No fetch implementation available. Use Node.js 20+ or pass `fetch`.\");\n }\n const units = (options.units ?? \"metric\") as U;\n if (units !== \"metric\" && units !== \"imperial\") {\n throw new TypeError(`units must be \"metric\" or \"imperial\", got ${String(units)}`);\n }\n this.#units = units;\n this.#http = new HttpClient({\n credentials: resolveCredentials(options.apiKey, options.auth, envApiKey),\n baseUrl: (options.baseUrl ?? DEFAULT_BASE_URL).replace(/\\/+$/, \"\"),\n timeout: nonNegative(options.timeout, DEFAULT_TIMEOUT, \"timeout\"),\n retry: resolveRetry(options.retry),\n fetch: (input, init) => fetchImpl(input, init),\n headers: { ...options.headers },\n });\n this.forecast = new ForecastResource(this.#http, units);\n this.stations = new StationsResource(this.#http);\n this.tools = new ToolsResource(this.#http);\n this.experimental = Object.freeze({ climate: new ClimateResource(this.#http) });\n this.photos = new PhotosResource(this.#http);\n }\n\n /**\n * Rate-limit headers of the most recent response (`x-ratelimit-*`), if the\n * API sent any.\n */\n get rateLimit(): RateLimitInfo | undefined {\n return this.#http.rateLimit;\n }\n\n /**\n * Best available current weather at a location, combining station\n * observations, analysis and forecasts.\n * @example\n * const { data } = await client.current({ lat: 50.1, lon: 8.7 });\n * console.log(data.temp?.value, data.temp?.source);\n */\n current<V extends UnitSystem = U>(\n location: Coordinates,\n options?: UnitOptions<V> & NormalizedOption,\n ): Promise<CurrentWeather<V>>;\n /** Current weather, exactly as the API sent it. */\n current<V extends UnitSystem = U>(\n location: Coordinates,\n options: UnitOptions<V> & RawOption,\n ): Promise<RawCurrentWeather>;\n async current(\n location: Coordinates,\n options?: UnitOptions<UnitSystem> & MaybeRaw,\n ): Promise<unknown> {\n const units = options?.units ?? this.#units;\n const body = await this.#http.get({\n path: `/current${coordinatesPath(location)}`,\n query: { units },\n ...requestOptions(options),\n });\n if (options?.raw) return body;\n const raw = expectObject(body, \"current weather\");\n const data: Record<string, CurrentValue> = {};\n for (const [name, value] of Object.entries(toRecordByName<CurrentValue & Json>(raw.data))) {\n const normalized: CurrentValue = { ...value, value: value.value ?? null };\n if (value.station && typeof value.station === \"object\") {\n Object.assign(normalized, { station: normalizeStation(value.station as unknown as Json) });\n }\n data[name] = normalized;\n }\n return {\n ...raw,\n systemOfUnits: raw.systemOfUnits ?? units,\n data: data as CurrentWeatherData,\n };\n }\n}\n","/**\n * Small unit conversion helpers. Forecasts use m/s for wind (metric), station\n * observations use knots, and most people expect km/h.\n * @module\n */\n\nconst round = (value: number, digits: number | undefined): number => {\n if (digits === undefined) return value;\n const factor = 10 ** digits;\n return Math.round(value * factor) / factor;\n};\n\n/** Knots → km/h. */\nexport const knotsToKmh = (kn: number, digits?: number): number => round(kn * 1.852, digits);\n/** Knots → m/s. */\nexport const knotsToMps = (kn: number, digits?: number): number =>\n round((kn * 1852) / 3600, digits);\n/** Knots → mph. */\nexport const knotsToMph = (kn: number, digits?: number): number =>\n round((kn * 1.852) / 1.609344, digits);\n/** m/s → km/h. */\nexport const mpsToKmh = (mps: number, digits?: number): number => round(mps * 3.6, digits);\n/** m/s → knots. */\nexport const mpsToKnots = (mps: number, digits?: number): number =>\n round((mps * 3600) / 1852, digits);\n/** mph → km/h. */\nexport const mphToKmh = (mph: number, digits?: number): number => round(mph * 1.609344, digits);\n/** km/h → m/s. */\nexport const kmhToMps = (kmh: number, digits?: number): number => round(kmh / 3.6, digits);\n/** °C → °F. */\nexport const celsiusToFahrenheit = (c: number, digits?: number): number =>\n round((c * 9) / 5 + 32, digits);\n/** °F → °C. */\nexport const fahrenheitToCelsius = (f: number, digits?: number): number =>\n round(((f - 32) * 5) / 9, digits);\n/** Millimetres → inches. */\nexport const mmToInch = (mm: number, digits?: number): number => round(mm / 25.4, digits);\n/** Inches → millimetres. */\nexport const inchToMm = (inch: number, digits?: number): number => round(inch * 25.4, digits);\n\n/**\n * Rough group of a WMO present weather code (code table 4677, `0`–`99`):\n *\n * | Category | Codes |\n * | --------------- | ----------------------------------------- |\n * | `none` | 0–3 (no significant weather) |\n * | `haze` | 4–9 (haze, smoke, dust) |\n * | `mist` | 10–12 (mist, shallow fog) |\n * | `nearby` | 13–19 (lightning, squalls, precipitation in sight) |\n * | `recent` | 20–29 (weather in the past hour, not now) |\n * | `duststorm` | 30–35 |\n * | `blowingSnow` | 36–39 |\n * | `fog` | 40–49 |\n * | `drizzle` | 50–59 |\n * | `rain` | 60–69 |\n * | `snow` | 70–79 (solid precipitation, not showers) |\n * | `showers` | 80–90 |\n * | `thunderstorm` | 91–99 |\n */\nexport type WmoCategory =\n | \"none\"\n | \"haze\"\n | \"mist\"\n | \"nearby\"\n | \"recent\"\n | \"duststorm\"\n | \"blowingSnow\"\n | \"fog\"\n | \"drizzle\"\n | \"rain\"\n | \"snow\"\n | \"showers\"\n | \"thunderstorm\";\n\n/** Groups a WMO 4677 present weather code. Returns `undefined` for values outside 0–99. */\nexport function classifyWmoCode(code: number): WmoCategory | undefined {\n if (!Number.isInteger(code) || code < 0 || code > 99) return undefined;\n if (code <= 3) return \"none\";\n if (code <= 9) return \"haze\";\n if (code <= 12) return \"mist\";\n if (code <= 19) return \"nearby\";\n if (code <= 29) return \"recent\";\n if (code <= 35) return \"duststorm\";\n if (code <= 39) return \"blowingSnow\";\n if (code <= 49) return \"fog\";\n if (code <= 59) return \"drizzle\";\n if (code <= 69) return \"rain\";\n if (code <= 79) return \"snow\";\n if (code <= 90) return \"showers\";\n return \"thunderstorm\";\n}\n"],"mappings":";;AAsCA,MAAM,cAAc,SAClB,KAAK,MAAM,KAAK,IAAI,YAAY,CAAC,CAAC,OAAO,IAAI,IAAI,SAAS,OAAO,aAAa,IAAI,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC;AAE/F,MAAM,kBAAkB,OAAgB,SAAyB;CAC/D,IAAI,OAAO,UAAU,YAAY,MAAM,KAAK,MAAM,IAChD,MAAM,IAAI,UAAU,GAAG,KAAK,4BAA4B;CAE1D,OAAO;AACT;;;;;;AAOA,SAAgB,mBACd,QACA,MACA,WACyB;CACzB,MAAM,MAAM,QAAQ,KAAK;CACzB,IAAI,SAAS,KAAA,GAAW;EACtB,MAAM,WAAW,OAAO,UAAU;EAClC,OAAO,WAAW;GAAE,QAAQ;GAAa,OAAO;EAAS,IAAI,KAAA;CAC/D;CACA,IAAI,KAAK,MAAM,IAAI,UAAU,0CAA0C;CACvE,IAAI,OAAO,SAAS,YAAY,SAAS,MACvC,MAAM,IAAI,UAAU,wBAAwB;CAE9C,QAAQ,KAAK,MAAb;EACE,KAAK,SAAS;GACZ,MAAM,WAAW,eAAe,KAAK,UAAU,eAAe;GAC9D,IAAI,SAAS,SAAS,GAAG,GAAG,MAAM,IAAI,UAAU,wCAAwC;GACxF,IAAI,OAAO,KAAK,aAAa,UAAU,MAAM,IAAI,UAAU,gCAAgC;GAC3F,OAAO;IACL,QAAQ;IACR,OAAO,SAAS,WAAW,GAAG,SAAS,GAAG,KAAK,UAAU;GAC3D;EACF;EACA,KAAK,UAAU;GACb,MAAM,QAAQ,eAAe,KAAK,OAAO,YAAY,CAAC,CAAC,KAAK;GAC5D,IAAI,CAAC,iBAAiB,KAAK,KAAK,GAC9B,MAAM,IAAI,UAAU,gEAAgE;GA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