@danceroutine/tango-core 0.1.0 → 1.0.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/LICENSE +21 -0
- package/README.md +82 -0
- package/dist/{TangoError-NPkVPfuH.js → TangoError-DdQVQNZU.js} +5 -1
- package/dist/TangoError-DdQVQNZU.js.map +1 -0
- package/dist/errors/AuthenticationError.d.ts +6 -1
- package/dist/errors/ConflictError.d.ts +6 -1
- package/dist/errors/NotFoundError.d.ts +6 -1
- package/dist/errors/PermissionDenied.d.ts +6 -1
- package/dist/errors/TangoError.d.ts +13 -1
- package/dist/errors/ValidationError.d.ts +5 -1
- package/dist/errors/factories/HttpErrorFactory.d.ts +20 -11
- package/dist/errors/factories/index.d.ts +1 -1
- package/dist/errors/index.d.ts +2 -2
- package/dist/errors/index.js +4 -4
- package/dist/{errors-CzSQXdgI.js → errors-_tWsmNyZ.js} +81 -34
- package/dist/errors-_tWsmNyZ.js.map +1 -0
- package/dist/http/TangoBody.d.ts +43 -18
- package/dist/http/TangoHeaders.d.ts +10 -5
- package/dist/http/TangoQueryParams.d.ts +69 -0
- package/dist/http/TangoRequest.d.ts +82 -0
- package/dist/http/TangoResponse.d.ts +184 -49
- package/dist/http/index.d.ts +2 -1
- package/dist/http/index.js +4 -4
- package/dist/{http-DOLwwAYt.js → http-D20MQa6p.js} +675 -295
- package/dist/http-D20MQa6p.js.map +1 -0
- package/dist/index.d.ts +9 -7
- package/dist/index.js +7 -6
- package/dist/logging/ConsoleLogger.d.ts +15 -0
- package/dist/logging/Logger.d.ts +13 -0
- package/dist/logging/getLogger.d.ts +23 -0
- package/dist/logging/index.d.ts +3 -0
- package/dist/logging/index.js +3 -0
- package/dist/logging-BWeD4HOO.js +48 -0
- package/dist/logging-BWeD4HOO.js.map +1 -0
- package/dist/runtime/binary/isArrayBuffer.d.ts +3 -0
- package/dist/runtime/binary/isBlob.d.ts +3 -0
- package/dist/runtime/binary/isUint8Array.d.ts +3 -0
- package/dist/runtime/date/isDate.d.ts +3 -0
- package/dist/runtime/error/isError.d.ts +3 -0
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.js +2 -2
- package/dist/runtime/object/index.d.ts +1 -0
- package/dist/runtime/object/isNil.d.ts +4 -0
- package/dist/runtime/object/isObject.d.ts +3 -0
- package/dist/runtime/web/isFile.d.ts +3 -0
- package/dist/runtime/web/isFormData.d.ts +3 -0
- package/dist/runtime/web/isReadableStream.d.ts +3 -0
- package/dist/runtime/web/isURLSearchParams.d.ts +3 -0
- package/dist/{runtime-DPpCYEe_.js → runtime-B8KkgD3R.js} +14 -4
- package/dist/runtime-B8KkgD3R.js.map +1 -0
- package/dist/sql/SqlDialect.d.ts +5 -0
- package/dist/sql/SqlIdentifierRole.d.ts +13 -0
- package/dist/sql/SqlSafetyEngine.d.ts +50 -0
- package/dist/sql/TrustedSqlFragment.d.ts +5 -0
- package/dist/sql/ValidatedSqlIdentifier.d.ts +7 -0
- package/dist/sql/index.d.ts +13 -0
- package/dist/sql/index.js +3 -0
- package/dist/sql/isTrustedSqlFragment.d.ts +5 -0
- package/dist/sql/quoteSqlIdentifier.d.ts +6 -0
- package/dist/sql/trustedSql.d.ts +5 -0
- package/dist/sql/validateSqlIdentifier.d.ts +6 -0
- package/dist/sql-D3frkfy-.js +116 -0
- package/dist/sql-D3frkfy-.js.map +1 -0
- package/package.json +65 -54
- package/dist/TangoError-NPkVPfuH.js.map +0 -1
- package/dist/errors/factories/HttpErrorFactory.js +0 -91
- package/dist/errors-CzSQXdgI.js.map +0 -1
- package/dist/http/TangoHeaders.js +0 -396
- package/dist/http/TangoResponse.js +0 -556
- package/dist/http-DOLwwAYt.js.map +0 -1
- package/dist/result/Err.d.ts +0 -21
- package/dist/result/Ok.d.ts +0 -21
- package/dist/result/Result.d.ts +0 -33
- package/dist/result/index.d.ts +0 -8
- package/dist/result/index.js +0 -3
- package/dist/result-CBqw9Hlg.js +0 -82
- package/dist/result-CBqw9Hlg.js.map +0 -1
- package/dist/runtime-DPpCYEe_.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-D20MQa6p.js","names":["bodySource: TangoBodySource","headers?: HeadersLike","value: unknown","v: unknown","body: TangoBodySource","stream: ReadableStream<Uint8Array>","chunks: Uint8Array[]","providedType?: string","contentType: string | undefined","raw: string","parser: (input: TangoBodySource) => Promise<T>","value: unknown","name: string","value: string","options: {\n domain?: string;\n expires?: Date;\n httpOnly?: boolean;\n maxAge?: number;\n path?: string;\n sameSite?: 'Strict' | 'Lax' | 'None';\n secure?: boolean;\n priority?: 'Low' | 'Medium' | 'High';\n partitioned?: boolean;\n }","filename: string","options?: {\n domain?: string;\n expires?: Date;\n httpOnly?: boolean;\n maxAge?: number;\n path?: string;\n sameSite?: 'Strict' | 'Lax' | 'None';\n secure?: boolean;\n priority?: 'Low' | 'Medium' | 'High';\n partitioned?: boolean;\n }","options?: {\n domain?: string;\n path?: string;\n sameSite?: 'Strict' | 'Lax' | 'None';\n secure?: boolean;\n priority?: 'Low' | 'Medium' | 'High';\n partitioned?: boolean;\n }","control: string | Record<string, string | number | boolean | undefined>","parts: string[]","url: string","mime: string","file: unknown","filename?: string","map: Record<string, string>","body: unknown","len: number | undefined","id: string","dur?: number","desc?: string","ms: number | string","values: Map<string, readonly string[]>","value: unknown","params: URLSearchParams","params: QueryParamRecord","input: string | URL","request: Request | TangoRequest","name: string","key: string","input: string | Request","init: TangoRequestInit","requestInit: RequestInit & { duplex?: 'half' }","value: unknown","body: BodyInit | JsonValue | null | undefined","headers: Headers","method: string","init: TangoResponseInit","value: unknown","data: JsonValue","init?: Omit<TangoResponseInit, 'body' | 'headers'> & { headers?: HeadersInit }","text: string","html: string","stream: ReadableStream<Uint8Array>","url: string","status: number","init?: Omit<TangoResponseInit, 'body' | 'headers' | 'status'> & {\n headers?: HeadersInit;\n }","init?: Omit<TangoResponseInit, 'body' | 'status' | 'headers'> & {\n headers?: HeadersInit;\n }","location?: string","body?: JsonValue","respBody: BodyInit | undefined","allow?: readonly string[]","detail: string","error: TangoError | ProblemDetails<TDetails>","code: string","message: string","details: ErrorDetails","fields: Record<string, string[]> | undefined","detail?: string | TangoError | ProblemDetails<TDetails>","problem?: string | TangoError | ProblemDetails<TDetails> | unknown","init?: Omit<TangoResponseInit, 'body' | 'headers'> & {\n headers?: HeadersInit;\n status?: number;\n }","envelope: ErrorEnvelope<ErrorDetails>","file: Blob | Uint8Array | ArrayBuffer | ReadableStream<Uint8Array> | string","opts?: {\n filename?: string;\n contentType?: string;\n init?: Omit<TangoResponseInit, 'body' | 'headers'> & { headers?: HeadersInit };\n }","body: BodyInit | JsonValue | null","name: string","value: string","options?: Parameters<TangoHeaders['setCookie']>[2]","options?: Parameters<TangoHeaders['appendCookie']>[2]","options?: Parameters<TangoHeaders['deleteCookie']>[1]","control: Parameters<TangoHeaders['cacheControl']>[0]","mime: string","requestId: string | undefined | null","traceparent: string | undefined | null","timing: string | string[]","time: number | string","input: HeadersInit"],"sources":["../src/http/TangoBody.ts","../src/http/TangoHeaders.ts","../src/http/TangoQueryParams.ts","../src/http/TangoRequest.ts","../src/http/TangoResponse.ts","../src/http/index.ts"],"sourcesContent":["import {\n isArrayBuffer,\n isBlob,\n isFile,\n isFormData,\n isNil,\n isReadableStream,\n isUint8Array,\n isURLSearchParams,\n} from '../runtime/index';\n\n/**\n * The full type of body that TangoResponse/TangoBody supports.\n * Unlike the fetch spec BodyInit, this can be directly:\n * - a string, ArrayBuffer, Uint8Array, Blob, FormData, ReadableStream, or JSON-like object, or null/undefined.\n */\n\ntype HeadersLike = { get?: (arg: string) => string | null };\n\ntype TangoBodySource = BodyInit | JsonValue | null;\n\n/** Recursive JSON value contract used by Tango HTTP helpers. */\nexport type JsonValue = string | number | boolean | null | JsonValue[] | { [key: string]: JsonValue };\n\n/**\n * Unified body reader/clone utility for Tango request/response wrappers.\n */\nexport class TangoBody {\n static readonly BRAND = 'tango.http.body' as const;\n readonly __tangoBrand: typeof TangoBody.BRAND = TangoBody.BRAND;\n private bodySourceInternal: TangoBodySource;\n private bodyUsedInternal: boolean;\n private headers?: HeadersLike;\n\n constructor(bodySource: TangoBodySource, headers?: HeadersLike) {\n this.bodySourceInternal = bodySource;\n this.bodyUsedInternal = false;\n this.headers = headers;\n }\n\n /**\n * Narrow an unknown value to `TangoBody`.\n */\n static isTangoBody(value: unknown): value is TangoBody {\n return (\n typeof value === 'object' &&\n value !== null &&\n (value as { __tangoBrand?: unknown }).__tangoBrand === TangoBody.BRAND\n );\n }\n\n /**\n * Expose the original body source for cloning and adapter integration.\n */\n public get bodySource(): TangoBodySource {\n return this.bodySourceInternal;\n }\n\n /**\n * Report whether a reader method has already consumed this body.\n */\n get bodyUsed(): boolean {\n return this.bodyUsedInternal;\n }\n\n /**\n * Describe the current body shape in a way that is useful for diagnostics.\n */\n get bodyType(): string {\n const body = this.bodySourceInternal;\n if (isNil(body)) return 'null';\n if (typeof body === 'string') return 'string';\n if (isArrayBuffer(body)) return 'ArrayBuffer';\n if (isUint8Array(body)) return 'Uint8Array';\n if (isBlob(body)) return 'Blob';\n if (isFormData(body)) return 'FormData';\n if (isURLSearchParams(body)) return 'URLSearchParams';\n if (isReadableStream(body)) return 'ReadableStream';\n if (TangoBody.isJsonValue(body)) return 'JsonValue';\n return typeof body;\n }\n\n /**\n * Returns true if value is a valid JSON value (recursively).\n */\n public static isJsonValue(v: unknown): v is JsonValue {\n if (v === null || typeof v === 'string' || typeof v === 'number' || typeof v === 'boolean') {\n return true;\n }\n if (Array.isArray(v)) {\n return v.every(TangoBody.isJsonValue);\n }\n if (typeof v === 'object' && v !== null && Object.prototype.toString.call(v) === '[object Object]') {\n return Object.values(v).every(TangoBody.isJsonValue);\n }\n return false;\n }\n\n /**\n * Deep clone utility for body values. Preserves types and values as in the legacy implementation.\n * If the source is a stream, the stream will be cloned if readable, otherwise throws.\n */\n static deepCloneBody(body: TangoBodySource): TangoBodySource {\n if (isNil(body)) {\n return null;\n }\n if (typeof body === 'string') {\n return body;\n }\n if (isArrayBuffer(body)) {\n return body.slice(0);\n }\n if (isUint8Array(body)) {\n return new Uint8Array(body);\n }\n if (isBlob(body)) {\n return body.slice(0, body.size, body.type);\n }\n if (isFormData(body)) {\n // Deep clone FormData: only text fields (files not handled)\n // This is the best we can do in cross-platform without File support.\n const cloned = new FormData();\n for (const [k, v] of body) {\n // If value is File, attempt to clone (not fully implemented)\n if (isFile(v)) {\n // Note: Cloning File loses prototype, but rarely needed\n const file = new File([v], v.name, { type: v.type, lastModified: v.lastModified });\n cloned.append(k, file);\n } else {\n cloned.append(k, v as string);\n }\n }\n return cloned;\n }\n if (isReadableStream(body)) {\n throw new TypeError('Cannot deep clone a ReadableStream directly; use TangoBody.clone()');\n }\n if (TangoBody.isJsonValue(body)) {\n return JSON.parse(JSON.stringify(body));\n }\n return null;\n }\n\n /**\n * Read a `ReadableStream` into an `ArrayBuffer`.\n */\n static async readStreamToArrayBuffer(stream: ReadableStream<Uint8Array>): Promise<ArrayBuffer> {\n const chunks: Uint8Array[] = [];\n const reader = stream.getReader();\n let total = 0;\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n chunks.push(value);\n total += value.length;\n }\n const joined = new Uint8Array(total);\n let off = 0;\n for (const chunk of chunks) {\n joined.set(chunk, off);\n off += chunk.length;\n }\n return joined.buffer.slice(0, joined.byteLength) as ArrayBuffer;\n }\n\n /**\n * Read a `ReadableStream` into a `Uint8Array`.\n */\n static async readStreamToUint8Array(stream: ReadableStream<Uint8Array>): Promise<Uint8Array<ArrayBuffer>> {\n const buf = await TangoBody.readStreamToArrayBuffer(stream);\n return new Uint8Array(buf) as Uint8Array<ArrayBuffer>;\n }\n\n /**\n * Read a `ReadableStream` into UTF-8 text.\n */\n static async readStreamToText(stream: ReadableStream<Uint8Array>): Promise<string> {\n const arr = await TangoBody.readStreamToUint8Array(stream);\n return new TextDecoder().decode(arr);\n }\n\n /**\n * Determine the content type for this body, if possible.\n * Respects an explicitly passed header, otherwise infers from value type.\n */\n static detectContentType(body: TangoBodySource, providedType?: string): string | undefined {\n if (providedType) return providedType;\n if (isNil(body)) return undefined;\n if (typeof body === 'string') return 'text/plain; charset=utf-8';\n if (isArrayBuffer(body) || isUint8Array(body)) return 'application/octet-stream';\n if (isBlob(body)) {\n if (body.type) return body.type;\n return 'application/octet-stream';\n }\n if (isFormData(body)) return undefined;\n if (typeof body === 'object' && TangoBody.isJsonValue(body)) return 'application/json; charset=utf-8';\n if (isReadableStream(body)) return undefined;\n return undefined;\n }\n\n /**\n * Attempt to determine the content length, in bytes, for this body.\n * Only available for certain body types, otherwise returns undefined.\n */\n static async getContentLength(body: TangoBodySource): Promise<number | undefined> {\n if (isNil(body)) return 0;\n if (typeof body === 'string') return new TextEncoder().encode(body).length;\n if (isUint8Array(body)) return body.byteLength;\n if (isArrayBuffer(body)) return body.byteLength;\n if (isBlob(body)) return body.size;\n if (TangoBody.isJsonValue(body)) return new TextEncoder().encode(JSON.stringify(body)).length;\n return undefined;\n }\n\n /**\n * Reads the body as an ArrayBuffer.\n */\n async arrayBuffer(): Promise<ArrayBuffer> {\n return this.consumeBody(async (input) => {\n if (isArrayBuffer(input)) return input;\n if (isUint8Array(input)) {\n const copy = new Uint8Array(input.byteLength);\n copy.set(input);\n return copy.buffer;\n }\n if (typeof input === 'string') return new TextEncoder().encode(input).buffer as ArrayBuffer;\n if (isBlob(input)) return input.arrayBuffer();\n if (isReadableStream(input)) {\n return TangoBody.readStreamToArrayBuffer(input);\n }\n if (TangoBody.isJsonValue(input)) {\n // If body is object/array, encode as JSON and return buffer\n return new TextEncoder().encode(JSON.stringify(input)).buffer as ArrayBuffer;\n }\n throw new TypeError('Body is not an ArrayBuffer, Blob, string, stream, or JSON serializable object');\n });\n }\n\n /**\n * Reads the body as a Blob (browser only).\n */\n async blob(): Promise<Blob> {\n return this.consumeBody(async (input) => {\n if (isBlob(input)) return input;\n if (typeof input === 'string') return new Blob([input]);\n if (isArrayBuffer(input)) return new Blob([input]);\n if (isUint8Array(input)) return new Blob([new Uint8Array(input)]);\n if (isReadableStream(input)) {\n const buf = await TangoBody.readStreamToArrayBuffer(input);\n return new Blob([buf]);\n }\n if (TangoBody.isJsonValue(input)) {\n return new Blob([JSON.stringify(input)], { type: 'application/json' });\n }\n throw new TypeError(\n 'Body is not a Blob, string, ArrayBuffer, Uint8Array, stream, or JSON serializable object'\n );\n });\n }\n\n /**\n * Reads the body as a Uint8Array.\n */\n async bytes(): Promise<Uint8Array<ArrayBuffer>> {\n return this.consumeBody(async (input) => {\n if (isUint8Array(input)) return new Uint8Array(input);\n if (isArrayBuffer(input)) return new Uint8Array(input);\n if (typeof input === 'string') return new TextEncoder().encode(input);\n if (isBlob(input)) return new Uint8Array(await input.arrayBuffer());\n if (isReadableStream(input)) {\n return TangoBody.readStreamToUint8Array(input);\n }\n if (TangoBody.isJsonValue(input)) {\n return new TextEncoder().encode(JSON.stringify(input));\n }\n throw new TypeError('Body is not bytes, ArrayBuffer, Blob, string, stream, or JSON serializable object');\n });\n }\n\n /**\n * Reads the body as FormData.\n * Accepts FormData, or if type is urlencoded or multipart parses a string/bytes.\n */\n async formData(): Promise<FormData> {\n return this.consumeBody(async (input) => {\n if (isFormData(input)) return input;\n\n let contentType: string | undefined = undefined;\n if (this.headers && typeof this.headers.get === 'function') {\n const raw = this.headers.get('Content-Type');\n if (typeof raw === 'string') contentType = raw.toLowerCase();\n }\n\n let raw: string;\n if (typeof input === 'string') {\n raw = input;\n } else if (isArrayBuffer(input)) {\n raw = new TextDecoder().decode(input);\n } else if (isUint8Array(input)) {\n raw = new TextDecoder().decode(input);\n } else {\n throw new TypeError('Body is not valid for FormData');\n }\n\n // application/x-www-form-urlencoded\n if (contentType && contentType.includes('application/x-www-form-urlencoded')) {\n const form = new FormData();\n const params = new URLSearchParams(raw);\n params.forEach((value, key) => form.append(key, value));\n return form;\n }\n // multipart/form-data\n if (contentType && contentType.startsWith('multipart/form-data')) {\n const boundaryMatch = /boundary=([^\\s;]+)/i.exec(contentType);\n if (!boundaryMatch) throw new TypeError('Missing boundary in multipart/form-data');\n const boundary = boundaryMatch[1];\n\n // Warning: minimal multipart parsing, no file support\n const parts = raw.split(`--${boundary}`);\n const form = new FormData();\n for (const part of parts) {\n const trimmed = part.trim();\n if (!trimmed || trimmed === '--' || trimmed === '') continue;\n\n const [rawHeaders = '', ...rawBodyParts] = trimmed.split(/\\r?\\n\\r?\\n/);\n const body = rawBodyParts.join('\\n\\n').replace(/\\r?\\n$/, '');\n const dispositionMatch = /Content-Disposition:\\s*form-data;\\s*name=\"([^\"]+)\"/i.exec(rawHeaders);\n if (!dispositionMatch) continue;\n const name = dispositionMatch[1]!;\n form.append(name, body);\n }\n return form;\n }\n throw new TypeError('Body is not FormData, nor a supported form encoding');\n });\n }\n\n /**\n * Reads and parses the body as JSON (if possible).\n */\n async json<T = unknown>(): Promise<T> {\n return this.consumeBody(async (input) => {\n if (typeof input === 'string') return JSON.parse(input) as T;\n if (TangoBody.isJsonValue(input)) return input as T;\n if (isArrayBuffer(input) || isUint8Array(input)) {\n const text = new TextDecoder().decode(isUint8Array(input) ? input : new Uint8Array(input));\n return JSON.parse(text) as T;\n }\n if (isReadableStream(input)) {\n const text = await TangoBody.readStreamToText(input);\n return JSON.parse(text) as T;\n }\n throw new TypeError('Body is not valid JSON');\n });\n }\n\n /**\n * Reads the body as UTF-8 string.\n */\n async text(): Promise<string> {\n return this.consumeBody(async (input) => {\n if (typeof input === 'string') return input;\n if (isArrayBuffer(input)) return new TextDecoder().decode(input);\n if (isUint8Array(input)) return new TextDecoder().decode(input);\n if (isBlob(input)) return await input.text();\n if (isReadableStream(input)) return await TangoBody.readStreamToText(input);\n if (TangoBody.isJsonValue(input)) return JSON.stringify(input);\n throw new TypeError('Body is not text, ArrayBuffer, Uint8Array, Blob, stream, or JSON serializable object');\n });\n }\n\n /**\n * Returns the original body value (may be used for streaming or clone).\n */\n getRawBodyInit(): TangoBodySource {\n return this.bodySourceInternal;\n }\n\n /**\n * Clone the body instance and stream if possible.\n * If the source is a stream, the stream will be cloned if readable, otherwise throws.\n */\n clone(): TangoBody {\n if (this.bodyUsedInternal) throw new TypeError('Body has already been used.');\n if (isReadableStream(this.bodySourceInternal)) {\n if (typeof this.bodySourceInternal.tee !== 'function') {\n throw new TypeError('Cannot clone: body is a ReadableStream and tee() is not available');\n }\n const [streamForOriginal, streamForClone] = this.bodySourceInternal.tee();\n this.bodySourceInternal = streamForOriginal;\n return new TangoBody(streamForClone, this.headers);\n }\n const cloneSource = TangoBody.deepCloneBody(this.bodySourceInternal);\n return new TangoBody(cloneSource, this.headers);\n }\n\n /**\n * Helper for all readers. Only allows reading once.\n */\n private async consumeBody<T>(parser: (input: TangoBodySource) => Promise<T>): Promise<T> {\n if (this.bodyUsedInternal) {\n throw new TypeError('Body has already been consumed.');\n }\n this.bodyUsedInternal = true;\n return parser(this.bodySourceInternal);\n }\n}\n","import { isArrayBuffer, isBlob, isUint8Array } from '../runtime/index';\n\n/**\n * TangoHeaders extends the Web Headers class, adding ergonomic helpers\n * for common HTTP header patterns, convenience features, and a consistent API for\n * setting, appending, and deleting headers and cookies. This is designed to be\n * used by TangoResponse and other Tango HTTP utilities.\n * Additionally, provides helpers for safely setting Content-Length based on a known body,\n * and setting Content-Disposition for inline or attachment filenames.\n *\n * Includes helpers for request tracing and correlation headers:\n * - X-Request-Id\n * - traceparent (W3C Trace Context)\n * - Server-Timing\n * - X-Response-Time\n */\nexport class TangoHeaders extends Headers {\n static readonly BRAND = 'tango.http.headers' as const;\n readonly __tangoBrand: typeof TangoHeaders.BRAND = TangoHeaders.BRAND;\n\n /**\n * Narrow an unknown value to `TangoHeaders`.\n */\n static isTangoHeaders(value: unknown): value is TangoHeaders {\n return (\n typeof value === 'object' &&\n value !== null &&\n (value as { __tangoBrand?: unknown }).__tangoBrand === TangoHeaders.BRAND\n );\n }\n\n /**\n * Serialize a cookie for the Set-Cookie header line.\n */\n private static serializeCookie(\n name: string,\n value: string,\n options: {\n domain?: string;\n expires?: Date;\n httpOnly?: boolean;\n maxAge?: number;\n path?: string;\n sameSite?: 'Strict' | 'Lax' | 'None';\n secure?: boolean;\n priority?: 'Low' | 'Medium' | 'High';\n partitioned?: boolean;\n } = {}\n ): string {\n let cookie = encodeURIComponent(name) + '=' + encodeURIComponent(value ?? '');\n if (options.domain) cookie += `; Domain=${options.domain}`;\n if (options.path) cookie += `; Path=${options.path}`;\n else cookie += '; Path=/';\n if (options.expires) cookie += `; Expires=${options.expires.toUTCString()}`;\n if (typeof options.maxAge === 'number') cookie += `; Max-Age=${options.maxAge}`;\n if (options.secure) cookie += '; Secure';\n if (options.httpOnly) cookie += '; HttpOnly';\n if (options.sameSite) cookie += `; SameSite=${options.sameSite}`;\n if (options.priority) cookie += `; Priority=${options.priority}`;\n if (options.partitioned) cookie += '; Partitioned';\n return cookie;\n }\n\n private static hasNumberSize(value: unknown): value is { size: number } {\n return typeof value === 'object' && value !== null && typeof (value as { size?: unknown }).size === 'number';\n }\n\n private static hasNumberLength(value: unknown): value is { length: number } {\n return (\n typeof value === 'object' && value !== null && typeof (value as { length?: unknown }).length === 'number'\n );\n }\n\n private static isNodeBuffer(value: unknown): value is { length: number } {\n const maybeBuffer = Buffer as unknown as { isBuffer?: (input: unknown) => boolean };\n return (\n typeof Buffer !== 'undefined' && typeof maybeBuffer.isBuffer === 'function' && maybeBuffer.isBuffer(value)\n );\n }\n\n /**\n * Sets the Content-Disposition header with type \"inline\" and the specified filename.\n * This is useful to indicate that the content should be displayed inline in the browser,\n * but with a suggested filename for saving.\n *\n * @param filename The filename to include in the Content-Disposition header.\n */\n setContentDispositionInline(filename: string): void {\n const encoded = encodeURIComponent(filename);\n this.set('Content-Disposition', `inline; filename=\"${encoded}\"; filename*=UTF-8''${encoded}`);\n }\n\n /**\n * Sets the Content-Disposition header with type \"attachment\" and the specified filename.\n * This is useful to indicate that the response should be downloaded as a file.\n *\n * @param filename The filename to include in the Content-Disposition header.\n */\n setContentDispositionAttachment(filename: string): void {\n const encoded = encodeURIComponent(filename);\n this.set('Content-Disposition', `attachment; filename=\"${encoded}\"; filename*=UTF-8''${encoded}`);\n }\n\n /**\n * Create a copy that preserves all header names and values.\n */\n clone(): TangoHeaders {\n const copy = new TangoHeaders();\n for (const [name, value] of this.entries()) {\n copy.append(name, value);\n }\n return copy;\n }\n\n /**\n * Set a header, replacing the existing value.\n */\n setHeader(name: string, value: string): void {\n this.set(name, value);\n }\n\n /**\n * Append a header, adding to existing value(s) for the name.\n */\n appendHeader(name: string, value: string): void {\n this.append(name, value);\n }\n\n /**\n * Get a header value (first value if header is repeated).\n */\n getHeader(name: string): string | null {\n return this.get(name);\n }\n\n /**\n * Check if a header exists.\n */\n hasHeader(name: string): boolean {\n return this.has(name);\n }\n\n /**\n * Delete a header.\n */\n deleteHeader(name: string): void {\n this.delete(name);\n }\n\n /**\n * Ensure a header is present only once and fully replaces the old value.\n */\n ensureUnique(name: string, value: string): void {\n this.delete(name);\n this.set(name, value);\n }\n\n /**\n * Add a field (or fields) to the Vary header, merging with existing values.\n */\n vary(...fields: string[]): void {\n if (fields.length === 0) return;\n const key = 'Vary';\n const prev = this.get(key);\n const nextSet = new Set<string>();\n if (prev) {\n for (const v of prev.split(',')) {\n if (v.trim()) nextSet.add(v.trim());\n }\n }\n for (const f of fields) {\n if (f.trim()) nextSet.add(f.trim());\n }\n this.set(key, Array.from(nextSet).join(', '));\n }\n\n /**\n * Set a cookie header (for Set-Cookie).\n * @param name\n * @param value\n * @param options\n */\n setCookie(\n name: string,\n value: string,\n options?: {\n domain?: string;\n expires?: Date;\n httpOnly?: boolean;\n maxAge?: number;\n path?: string;\n sameSite?: 'Strict' | 'Lax' | 'None';\n secure?: boolean;\n priority?: 'Low' | 'Medium' | 'High';\n partitioned?: boolean;\n }\n ): void {\n this.append('Set-Cookie', TangoHeaders.serializeCookie(name, value, options));\n }\n\n /**\n * Append (additionally) a new cookie.\n */\n appendCookie(\n name: string,\n value: string,\n options?: {\n domain?: string;\n expires?: Date;\n httpOnly?: boolean;\n maxAge?: number;\n path?: string;\n sameSite?: 'Strict' | 'Lax' | 'None';\n secure?: boolean;\n priority?: 'Low' | 'Medium' | 'High';\n partitioned?: boolean;\n }\n ): void {\n this.append('Set-Cookie', TangoHeaders.serializeCookie(name, value, options));\n }\n\n /**\n * Delete a cookie (\"unset\" it via expired date).\n */\n deleteCookie(\n name: string,\n options?: {\n domain?: string;\n path?: string;\n sameSite?: 'Strict' | 'Lax' | 'None';\n secure?: boolean;\n priority?: 'Low' | 'Medium' | 'High';\n partitioned?: boolean;\n }\n ): void {\n this.setCookie(name, '', {\n ...options,\n expires: new Date(0),\n maxAge: 0,\n });\n }\n\n /**\n * Add or override Cache-Control header with helpers for common policies.\n */\n cacheControl(control: string | Record<string, string | number | boolean | undefined>): void {\n if (typeof control === 'string') {\n this.set('Cache-Control', control);\n return;\n }\n // Compose Cache-Control from object\n const parts: string[] = [];\n for (const [k, v] of Object.entries(control)) {\n if (typeof v === 'boolean') {\n if (v) parts.push(k.replace(/[A-Z]/g, (c) => '-' + c.toLowerCase()));\n } else if (typeof v === 'number' || (typeof v === 'string' && v.length > 0)) {\n parts.push(`${k.replace(/[A-Z]/g, (c) => '-' + c.toLowerCase())}=${v}`);\n }\n }\n if (parts.length) {\n this.set('Cache-Control', parts.join(', '));\n }\n }\n\n /**\n * Set the Location header.\n */\n location(url: string): void {\n this.set('Location', url);\n }\n\n /**\n * Set the Content-Type header.\n */\n contentType(mime: string): void {\n this.set('Content-Type', mime);\n }\n\n /**\n * Attempt to guess and set the Content-Type header from a file (string or Blob) and optional filename.\n *\n * @param file File-like input (string or Blob)\n * @param filename Optional filename to help guess mime type by extension\n */\n setContentTypeByFile(file: unknown, filename?: string): void {\n // do not overwrite explicit content-type\n if (this.has('Content-Type')) return;\n\n // If file is a string and a filename is provided or can be guessed from file path\n if (typeof file === 'string' && filename) {\n // Guess type by extension\n const dotIndex = filename.lastIndexOf('.');\n const ext = dotIndex >= 0 ? filename.slice(dotIndex + 1).toLowerCase() : '';\n const map: Record<string, string> = {\n txt: 'text/plain',\n text: 'text/plain',\n html: 'text/html',\n css: 'text/css',\n js: 'application/javascript',\n json: 'application/json',\n jpg: 'image/jpeg',\n jpeg: 'image/jpeg',\n png: 'image/png',\n gif: 'image/gif',\n webp: 'image/webp',\n pdf: 'application/pdf',\n svg: 'image/svg+xml',\n ico: 'image/x-icon',\n md: 'text/markdown',\n };\n const mime = map[ext];\n if (mime) {\n this.set('Content-Type', mime);\n } else {\n this.set('Content-Type', 'application/octet-stream');\n }\n return;\n }\n\n // If it's a Blob, use its type, or fallback\n if (isBlob(file)) {\n if (file.type && file.type !== '') {\n this.set('Content-Type', file.type);\n } else {\n this.set('Content-Type', 'application/octet-stream');\n }\n return;\n }\n\n // Fallback\n this.set('Content-Type', 'application/octet-stream');\n }\n\n /**\n * Sets the Content-Length header, inferring it from the body if not explicitly provided.\n * If the body is a string, ArrayBuffer, Uint8Array, Blob/Buffer (or has a .size or .length property),\n * the length is computed. For unsupported types, does nothing.\n * Mirrors logic from TangoResponse.ts, but generalized for use anywhere.\n */\n setContentLengthFromBody(body: unknown): void {\n if (this.has('Content-Length') || body === null || body === undefined) {\n return;\n }\n\n let len: number | undefined;\n\n if (typeof body === 'string') {\n len = new TextEncoder().encode(body).length;\n } else if (isArrayBuffer(body)) {\n len = body.byteLength;\n }\n // Node.js Buffer support (Buffer.isBuffer and .length)\n else if (TangoHeaders.isNodeBuffer(body)) {\n len = (body as { length: number }).length;\n } else if (isUint8Array(body)) {\n len = body.byteLength;\n } else if (isBlob(body)) {\n len = body.size;\n }\n // Generic \"size\" (number) property\n else if (TangoHeaders.hasNumberSize(body)) {\n len = (body as { size: number }).size;\n }\n // Generic \"length\" (number) property but not string/ArrayBuffer/Uint8Array/etc\n else if (\n TangoHeaders.hasNumberLength(body) &&\n typeof body !== 'string' &&\n !isArrayBuffer(body) &&\n !isUint8Array(body)\n ) {\n len = (body as { length: number }).length;\n }\n\n if (typeof len === 'number') {\n this.set('Content-Length', len.toString());\n }\n }\n\n /**\n * Set or update the X-Request-Id header. Used for associating a request/response with a unique id.\n * @param id The request id value to set.\n */\n withRequestId(id: string): this {\n this.set('X-Request-Id', id);\n return this;\n }\n\n /**\n * Set or update the traceparent header. Used for distributed trace context propagation (W3C Trace Context).\n * @param value The traceparent value (should be a valid traceparent header value).\n */\n withTraceParent(value: string): this {\n this.set('traceparent', value);\n return this;\n }\n\n /**\n * Set or append a value to the Server-Timing header.\n * For a single metric, supply name, and optionally dur and desc.\n * For advanced usage (many metrics), set the value directly or use appendServerTimingRaw.\n *\n * @param name Name of the server-timing metric (e.g., 'total', 'db').\n * @param dur Optional duration in ms.\n * @param desc Optional string description.\n */\n withServerTiming(name: string, dur?: number, desc?: string): this {\n // Build the metric string per spec: <metric>=<value>;dur=<duration>;desc=\"<description>\"\n let metric = name;\n if (typeof dur === 'number') {\n metric += `;dur=${dur}`;\n }\n if (desc) {\n metric += `;desc=\"${desc.replace(/\"/g, '\\\\\"')}\"`;\n }\n\n // Set or append. If header exists, append, separated by comma.\n const prev = this.get('Server-Timing');\n if (prev && prev.length > 0) {\n this.set('Server-Timing', prev + ', ' + metric);\n } else {\n this.set('Server-Timing', metric);\n }\n return this;\n }\n\n /**\n * Directly append a raw Server-Timing metric value.\n * This is useful for advanced cases where you have multiple metrics assembled.\n * @param value The server-timing value chunk to append.\n */\n appendServerTimingRaw(value: string): this {\n const prev = this.get('Server-Timing');\n if (prev && prev.length > 0) {\n this.set('Server-Timing', prev + ', ' + value);\n } else {\n this.set('Server-Timing', value);\n }\n return this;\n }\n\n /**\n * Set or update X-Response-Time header.\n * @param ms Elapsed time in milliseconds (number or string for flexibility).\n */\n withResponseTime(ms: number | string): this {\n this.set('X-Response-Time', typeof ms === 'number' ? `${ms}ms` : ms);\n return this;\n }\n\n /**\n * Return the current value of X-Request-Id.\n */\n getRequestId(): string | null {\n return this.get('X-Request-Id');\n }\n\n /**\n * Return the current value of traceparent header.\n */\n getTraceParent(): string | null {\n return this.get('traceparent');\n }\n\n /**\n * Return the current Server-Timing string, if set.\n */\n getServerTiming(): string | null {\n return this.get('Server-Timing');\n }\n\n /**\n * Return the current X-Response-Time string, if set.\n */\n getResponseTime(): string | null {\n return this.get('X-Response-Time');\n }\n}\n","import type { TangoRequest } from './TangoRequest';\n\ntype QueryParamRecord = Record<string, string | string[] | undefined>;\n\n/**\n * Immutable query parameter helper that normalizes framework-specific shapes\n * into one Tango-owned API.\n */\nexport class TangoQueryParams {\n static readonly BRAND = 'tango.http.query_params' as const;\n readonly __tangoBrand: typeof TangoQueryParams.BRAND = TangoQueryParams.BRAND;\n private readonly values: Map<string, readonly string[]>;\n\n private constructor(values: Map<string, readonly string[]>) {\n this.values = values;\n }\n\n /**\n * Narrow an unknown value to `TangoQueryParams`.\n */\n static isTangoQueryParams(value: unknown): value is TangoQueryParams {\n return (\n typeof value === 'object' &&\n value !== null &&\n (value as { __tangoBrand?: unknown }).__tangoBrand === TangoQueryParams.BRAND\n );\n }\n\n /**\n * Build query params from a `URLSearchParams` instance.\n */\n static fromURLSearchParams(params: URLSearchParams): TangoQueryParams {\n const values = new Map<string, string[]>();\n\n for (const [key, value] of params.entries()) {\n const current = values.get(key);\n if (current) {\n current.push(value);\n continue;\n }\n values.set(key, [value]);\n }\n\n return new TangoQueryParams(values);\n }\n\n /**\n * Build query params from framework record-style search params.\n */\n static fromRecord(params: QueryParamRecord): TangoQueryParams {\n const values = new Map<string, string[]>();\n\n for (const [key, value] of Object.entries(params)) {\n if (Array.isArray(value)) {\n const normalized = value.filter((entry) => typeof entry === 'string');\n if (normalized.length > 0) {\n values.set(key, normalized);\n }\n continue;\n }\n\n if (typeof value === 'string') {\n values.set(key, [value]);\n }\n }\n\n return new TangoQueryParams(values);\n }\n\n /**\n * Build query params from a full URL string or URL object.\n */\n static fromURL(input: string | URL): TangoQueryParams {\n const url = typeof input === 'string' ? new URL(input) : input;\n return TangoQueryParams.fromURLSearchParams(url.searchParams);\n }\n\n /**\n * Build query params from a request-like object with a URL.\n */\n static fromRequest(request: Request | TangoRequest): TangoQueryParams {\n return TangoQueryParams.fromURL(request.url);\n }\n\n /**\n * Get the first value for a query param.\n */\n get(name: string): string | undefined {\n return this.values.get(name)?.[0];\n }\n\n /**\n * Get all values for a query param.\n */\n getAll(name: string): string[] {\n return [...(this.values.get(name) ?? [])];\n }\n\n /**\n * Check whether a query param exists.\n */\n has(name: string): boolean {\n return (this.values.get(name)?.length ?? 0) > 0;\n }\n\n /**\n * Iterate key -> values entries.\n */\n *entries(): IterableIterator<[string, string[]]> {\n for (const [key, values] of this.values.entries()) {\n yield [key, [...values]];\n }\n }\n\n /**\n * Iterate keys present in the query params.\n */\n *keys(): IterableIterator<string> {\n yield* this.values.keys();\n }\n\n /**\n * Convert back to a native `URLSearchParams` object.\n */\n toURLSearchParams(): URLSearchParams {\n const params = new URLSearchParams();\n\n for (const [key, values] of this.values.entries()) {\n for (const value of values) {\n params.append(key, value);\n }\n }\n\n return params;\n }\n\n /**\n * Get a trimmed value, omitting blank strings.\n */\n getTrimmed(name: string): string | undefined {\n const value = this.get(name)?.trim();\n return value ? value : undefined;\n }\n\n /**\n * Get the free-text search param using Tango's default key.\n */\n getSearch(key: string = 'search'): string | undefined {\n return this.getTrimmed(key);\n }\n\n /**\n * Get the ordering param as trimmed field tokens.\n */\n getOrdering(key: string = 'ordering'): string[] {\n const value = this.get(key);\n if (!value) {\n return [];\n }\n\n return value\n .split(',')\n .map((token) => token.trim())\n .filter((token) => token.length > 0);\n }\n}\n","import type { JsonValue } from './TangoBody';\nimport { TangoQueryParams } from './TangoQueryParams';\nimport {\n isArrayBuffer,\n isBlob,\n isFormData,\n isNil,\n isReadableStream,\n isUint8Array,\n isURLSearchParams,\n} from '../runtime/index';\n\ntype TangoRequestInit = {\n method?: string;\n headers?: HeadersInit;\n body?: BodyInit | JsonValue | null;\n redirect?: RequestRedirect;\n cache?: RequestCache;\n credentials?: RequestCredentials;\n integrity?: string;\n keepalive?: boolean;\n mode?: RequestMode;\n referrer?: string;\n referrerPolicy?: ReferrerPolicy;\n signal?: AbortSignal;\n};\n\n/**\n * Framework request wrapper that normalizes JSON-like bodies and preserves\n * fetch `Request` compatibility for downstream handlers.\n */\nexport class TangoRequest implements Request {\n static readonly BRAND = 'tango.http.request' as const;\n readonly __tangoBrand: typeof TangoRequest.BRAND = TangoRequest.BRAND;\n private request: Request;\n private bodySourceValue: BodyInit | JsonValue | null;\n private queryParamsValue?: TangoQueryParams;\n\n constructor(input: string | Request, init: TangoRequestInit = {}) {\n const sourceRequest = typeof input === 'string' ? undefined : input;\n const method = (init.method ?? sourceRequest?.method ?? 'GET').toUpperCase();\n const headers = new Headers(init.headers ?? sourceRequest?.headers);\n const normalizedBody = this.normalizeBody(init.body, headers, method);\n\n const requestInit: RequestInit & { duplex?: 'half' } = {\n method,\n headers,\n redirect: init.redirect ?? sourceRequest?.redirect,\n cache: init.cache ?? sourceRequest?.cache,\n credentials: init.credentials ?? sourceRequest?.credentials,\n integrity: init.integrity ?? sourceRequest?.integrity,\n keepalive: init.keepalive ?? sourceRequest?.keepalive,\n mode: init.mode ?? sourceRequest?.mode,\n referrer: init.referrer ?? sourceRequest?.referrer,\n referrerPolicy: init.referrerPolicy ?? sourceRequest?.referrerPolicy,\n signal: init.signal ?? sourceRequest?.signal,\n };\n\n if (normalizedBody !== undefined) {\n requestInit.body = normalizedBody;\n if (isReadableStream(normalizedBody)) {\n requestInit.duplex = 'half';\n }\n }\n\n this.request = new Request(input, requestInit);\n this.bodySourceValue = normalizedBody ?? null;\n }\n\n /**\n * Narrow an unknown value to `TangoRequest`.\n */\n static isTangoRequest(value: unknown): value is TangoRequest {\n return (\n typeof value === 'object' &&\n value !== null &&\n (value as { __tangoBrand?: unknown }).__tangoBrand === TangoRequest.BRAND\n );\n }\n\n /**\n * Expose the request cache mode from the underlying fetch request.\n */\n get cache(): RequestCache {\n return this.request.cache;\n }\n\n /**\n * Expose the request credentials mode from the underlying fetch request.\n */\n get credentials(): RequestCredentials {\n return this.request.credentials;\n }\n\n /**\n * Expose the request destination from the underlying fetch request.\n */\n get destination(): RequestDestination {\n return this.request.destination;\n }\n\n /**\n * Expose the request headers from the underlying fetch request.\n */\n get headers(): Headers {\n return this.request.headers;\n }\n\n /**\n * Expose the request integrity value from the underlying fetch request.\n */\n get integrity(): string {\n return this.request.integrity;\n }\n\n /**\n * Expose the request keepalive flag from the underlying fetch request.\n */\n get keepalive(): boolean {\n return this.request.keepalive;\n }\n\n /**\n * Expose the normalized HTTP method.\n */\n get method(): string {\n return this.request.method;\n }\n\n /**\n * Expose the request mode from the underlying fetch request.\n */\n get mode(): RequestMode {\n return this.request.mode;\n }\n\n /**\n * Expose the redirect policy from the underlying fetch request.\n */\n get redirect(): RequestRedirect {\n return this.request.redirect;\n }\n\n /**\n * Expose the referrer from the underlying fetch request.\n */\n get referrer(): string {\n return this.request.referrer;\n }\n\n /**\n * Expose the referrer policy from the underlying fetch request.\n */\n get referrerPolicy(): ReferrerPolicy {\n return this.request.referrerPolicy;\n }\n\n /**\n * Expose the abort signal from the underlying fetch request.\n */\n get signal(): AbortSignal {\n return this.request.signal;\n }\n\n /**\n * Expose the absolute request URL.\n */\n get url(): string {\n return this.request.url;\n }\n\n /**\n * Expose the readable request body stream when one exists.\n */\n get body(): Request['body'] {\n return this.request.body;\n }\n\n /**\n * Report whether the body has been consumed.\n */\n get bodyUsed(): boolean {\n return this.request.bodyUsed;\n }\n\n /**\n * Expose the pre-normalized body value used to build the request.\n */\n get bodySource(): BodyInit | JsonValue | null {\n return this.bodySourceValue;\n }\n\n /**\n * Expose normalized query parameters derived from the request URL.\n */\n get queryParams(): TangoQueryParams {\n this.queryParamsValue ??= TangoQueryParams.fromURL(this.request.url);\n return this.queryParamsValue;\n }\n\n /**\n * Read the request body as an array buffer.\n */\n async arrayBuffer(): Promise<ArrayBuffer> {\n return this.request.arrayBuffer();\n }\n\n /**\n * Read the request body as a blob.\n */\n async blob(): Promise<Blob> {\n return this.request.blob();\n }\n\n /**\n * Read the request body as bytes, including runtimes without `Request.bytes()`.\n */\n async bytes(): Promise<Uint8Array<ArrayBuffer>> {\n const requestWithBytes = this.request as Request & { bytes?: () => Promise<Uint8Array<ArrayBuffer>> };\n if (typeof requestWithBytes.bytes === 'function') {\n return requestWithBytes.bytes();\n }\n const buffer = await this.request.arrayBuffer();\n return new Uint8Array(buffer);\n }\n\n /**\n * Read the request body as form data.\n */\n async formData(): Promise<FormData> {\n return this.request.formData();\n }\n\n /**\n * Parse the request body as JSON.\n */\n async json<T = unknown>(): Promise<T> {\n return this.request.json() as Promise<T>;\n }\n\n /**\n * Read the request body as text.\n */\n async text(): Promise<string> {\n return this.request.text();\n }\n\n /**\n * Clone the request so downstream code can consume it independently.\n */\n clone(): TangoRequest {\n return new TangoRequest(this.request.clone());\n }\n\n private normalizeBody(\n body: BodyInit | JsonValue | null | undefined,\n headers: Headers,\n method: string\n ): BodyInit | undefined {\n if (method === 'GET' || method === 'HEAD') {\n return undefined;\n }\n if (isNil(body)) {\n return undefined;\n }\n if (typeof body === 'string') {\n return body;\n }\n if (isArrayBuffer(body) || isUint8Array(body) || isBlob(body)) {\n return body;\n }\n if (isURLSearchParams(body) || isFormData(body) || isReadableStream(body)) {\n return body as BodyInit;\n }\n\n const serialized = JSON.stringify(body);\n if (!headers.has('content-type')) {\n headers.set('content-type', 'application/json; charset=utf-8');\n }\n return serialized;\n }\n}\n","import { TangoError, type ErrorEnvelope, type ErrorDetails, type ProblemDetails } from '../errors/TangoError';\nimport {\n isArrayBuffer,\n isBlob,\n isFormData,\n isNil,\n isReadableStream,\n isUint8Array,\n isURLSearchParams,\n} from '../runtime/index';\nimport { TangoHeaders } from '../http/TangoHeaders';\nimport { TangoBody, type JsonValue } from './TangoBody';\n\ntype TangoResponseInit = {\n body?: BodyInit | JsonValue | null;\n headers?: HeadersInit;\n ok?: boolean;\n redirected?: boolean;\n status?: number;\n statusText?: string;\n type?: ResponseType;\n url?: string;\n};\n\n/**\n * Framework response wrapper with fetch-compatible surface plus ergonomic helpers.\n */\nexport class TangoResponse implements Response {\n static readonly BRAND = 'tango.http.response' as const;\n readonly __tangoBrand: typeof TangoResponse.BRAND = TangoResponse.BRAND;\n readonly headers: TangoHeaders;\n readonly redirected: boolean;\n readonly status: number;\n readonly statusText: string;\n readonly type: ResponseType;\n readonly url: string;\n readonly body: Response['body'];\n private tangoBody: TangoBody;\n private okValue: boolean | undefined;\n\n constructor(init: TangoResponseInit = {}) {\n this.headers = new TangoHeaders(init.headers);\n this.redirected = Boolean(init.redirected);\n this.status = typeof init.status === 'number' ? init.status : 200;\n this.statusText = init.statusText || '';\n this.type = init.type || 'default';\n this.url = init.url || '';\n this.okValue = typeof init.ok === 'boolean' ? init.ok : undefined;\n\n this.tangoBody = new TangoBody(init.body ?? null, this.headers);\n this.body = isReadableStream(this.tangoBody.bodySource) ? this.tangoBody.bodySource : null;\n }\n\n /**\n * Narrow an unknown value to `TangoResponse`.\n */\n static isTangoResponse(value: unknown): value is TangoResponse {\n return (\n typeof value === 'object' &&\n value !== null &&\n (value as { __tangoBrand?: unknown }).__tangoBrand === TangoResponse.BRAND\n );\n }\n\n /**\n * Create a JSON response with sensible content headers.\n */\n static json(\n data: JsonValue,\n init?: Omit<TangoResponseInit, 'body' | 'headers'> & { headers?: HeadersInit }\n ): TangoResponse {\n const headers = new TangoHeaders(init?.headers);\n if (!headers.has('Content-Type')) {\n headers.set('Content-Type', 'application/json; charset=utf-8');\n }\n const body = JSON.stringify(data);\n if (!headers.has('Content-Length')) {\n headers.set('Content-Length', new TextEncoder().encode(body).length.toString());\n }\n return new TangoResponse({\n ...init,\n body,\n headers,\n });\n }\n\n /**\n * Create a plain-text response with sensible content headers.\n */\n static text(\n text: string,\n init?: Omit<TangoResponseInit, 'body' | 'headers'> & { headers?: HeadersInit }\n ): TangoResponse {\n const headers = new TangoHeaders(init?.headers);\n if (!headers.has('Content-Type')) {\n headers.set('Content-Type', 'text/plain; charset=utf-8');\n }\n if (!headers.has('Content-Length')) {\n headers.set('Content-Length', new TextEncoder().encode(text).length.toString());\n }\n return new TangoResponse({\n ...init,\n body: text,\n headers,\n });\n }\n\n /**\n * Create an HTML response with sensible content headers.\n */\n static html(\n html: string,\n init?: Omit<TangoResponseInit, 'body' | 'headers'> & { headers?: HeadersInit }\n ): TangoResponse {\n const headers = new TangoHeaders(init?.headers);\n if (!headers.has('Content-Type')) {\n headers.set('Content-Type', 'text/html; charset=utf-8');\n }\n if (!headers.has('Content-Length')) {\n headers.set('Content-Length', new TextEncoder().encode(html).length.toString());\n }\n return new TangoResponse({\n ...init,\n body: html,\n headers,\n });\n }\n\n /**\n * Create a streaming response without buffering the payload in memory.\n */\n static stream(\n stream: ReadableStream<Uint8Array>,\n init?: Omit<TangoResponseInit, 'body' | 'headers'> & { headers?: HeadersInit }\n ): TangoResponse {\n return new TangoResponse({\n ...init,\n body: stream,\n headers: new TangoHeaders(init?.headers),\n });\n }\n\n /**\n * Create a redirect response and set the `Location` header.\n */\n static redirect(\n url: string,\n status: number = 302,\n init?: Omit<TangoResponseInit, 'body' | 'headers' | 'status'> & {\n headers?: HeadersInit;\n }\n ): TangoResponse {\n const headers = new TangoHeaders(init?.headers);\n headers.set('Location', url);\n return new TangoResponse({\n ...init,\n body: undefined,\n status,\n headers,\n redirected: true,\n url,\n });\n }\n\n /**\n * Create an empty `204 No Content` response.\n */\n static noContent(\n init?: Omit<TangoResponseInit, 'body' | 'status' | 'headers'> & {\n headers?: HeadersInit;\n }\n ): TangoResponse {\n const headers = new TangoHeaders(init?.headers);\n return new TangoResponse({\n ...init,\n body: undefined,\n status: 204,\n headers,\n });\n }\n\n /**\n * Create a `201 Created` response and optionally attach a location or body.\n */\n static created(\n location?: string,\n body?: JsonValue,\n init?: Omit<TangoResponseInit, 'body' | 'status' | 'headers'> & {\n headers?: HeadersInit;\n }\n ): TangoResponse {\n const headers = new TangoHeaders(init?.headers);\n if (location) {\n headers.set('Location', location);\n }\n let respBody: BodyInit | undefined;\n if (body !== undefined) {\n respBody = JSON.stringify(body);\n if (!headers.has('Content-Type')) {\n headers.set('Content-Type', 'application/json; charset=utf-8');\n }\n }\n if (typeof respBody === 'string' && !headers.has('Content-Length')) {\n headers.set('Content-Length', new TextEncoder().encode(respBody).length.toString());\n }\n return new TangoResponse({\n ...init,\n body: respBody,\n status: 201,\n headers,\n });\n }\n\n /**\n * Create a `405 Method Not Allowed` response and optionally populate `Allow`.\n */\n static methodNotAllowed(\n allow?: readonly string[],\n detail: string = 'Method not allowed.',\n init?: Omit<TangoResponseInit, 'body' | 'status' | 'headers'> & {\n headers?: HeadersInit;\n }\n ): TangoResponse {\n const headers = new TangoHeaders(init?.headers);\n if (allow && allow.length > 0) {\n headers.set('Allow', allow.join(', '));\n }\n return TangoResponse.json(\n {\n error: detail,\n },\n {\n ...init,\n status: 405,\n headers,\n }\n );\n }\n\n /**\n * Normalize a Tango error or problem-details object into an error response.\n */\n static error<TDetails extends ErrorDetails = null>(\n error: TangoError | ProblemDetails<TDetails>,\n init?: Omit<TangoResponseInit, 'body' | 'headers'> & { headers?: HeadersInit }\n ): TangoResponse {\n let code: string;\n let message: string;\n let details: ErrorDetails;\n let fields: Record<string, string[]> | undefined;\n let status = init?.status ?? 500;\n\n if (TangoError.isTangoError(error)) {\n const envelope = error.toErrorEnvelope();\n code = envelope.error.code;\n message = envelope.error.message;\n details = envelope.error.details;\n fields = envelope.error.fields;\n status = error.status;\n } else {\n code = error.code;\n message = error.message;\n details = error.details;\n fields = error.fields;\n }\n\n return TangoResponse.problem(\n {\n code,\n message,\n details,\n fields,\n },\n {\n ...init,\n status,\n }\n );\n }\n\n /**\n * Create a `400 Bad Request` response from a string or structured error.\n */\n static badRequest<TDetails extends ErrorDetails = null>(\n detail?: string | TangoError | ProblemDetails<TDetails>,\n init?: Omit<TangoResponseInit, 'body' | 'status' | 'headers'> & {\n headers?: HeadersInit;\n }\n ): TangoResponse {\n if (TangoError.isTangoError(detail) || TangoError.isProblemDetails(detail)) {\n return TangoResponse.error(detail, { ...init, status: 400 });\n }\n\n if (typeof detail === 'string') {\n return TangoResponse.error(\n {\n code: 'bad_request',\n message: detail,\n },\n { ...init, status: 400 }\n );\n }\n\n return TangoResponse.error(\n {\n code: 'bad_request',\n message: 'Bad Request',\n },\n { ...init, status: 400 }\n );\n }\n\n /**\n * Create a `401 Unauthorized` response from a string or structured error.\n */\n static unauthorized<TDetails extends ErrorDetails = null>(\n detail?: string | TangoError | ProblemDetails<TDetails>,\n init?: Omit<TangoResponseInit, 'body' | 'status' | 'headers'> & {\n headers?: HeadersInit;\n }\n ): TangoResponse {\n if (TangoError.isTangoError(detail) || TangoError.isProblemDetails(detail)) {\n return TangoResponse.error(detail, { ...init, status: 401 });\n }\n if (typeof detail === 'string') {\n return TangoResponse.error(\n {\n code: 'unauthorized',\n message: detail,\n },\n { ...init, status: 401 }\n );\n }\n\n return TangoResponse.error(\n {\n code: 'unauthorized',\n message: 'Unauthorized',\n },\n { ...init, status: 401 }\n );\n }\n\n /**\n * Create a `403 Forbidden` response from a string or structured error.\n */\n static forbidden<TDetails extends ErrorDetails = null>(\n detail?: string | TangoError | ProblemDetails<TDetails>,\n init?: Omit<TangoResponseInit, 'body' | 'status' | 'headers'> & {\n headers?: HeadersInit;\n }\n ): TangoResponse {\n if (TangoError.isTangoError(detail) || TangoError.isProblemDetails(detail)) {\n return TangoResponse.error(detail, { ...init, status: 403 });\n }\n\n if (typeof detail === 'string') {\n return TangoResponse.error(\n {\n code: 'forbidden',\n message: detail,\n },\n { ...init, status: 403 }\n );\n }\n\n return TangoResponse.error(\n {\n code: 'forbidden',\n message: 'Forbidden',\n },\n { ...init, status: 403 }\n );\n }\n\n /**\n * Create a `404 Not Found` response from a string or structured error.\n */\n static notFound<TDetails extends ErrorDetails = null>(\n detail?: string | TangoError | ProblemDetails<TDetails>,\n init?: Omit<TangoResponseInit, 'body' | 'status' | 'headers'> & {\n headers?: HeadersInit;\n }\n ): TangoResponse {\n if (TangoError.isTangoError(detail) || TangoError.isProblemDetails(detail)) {\n return TangoResponse.error(detail, { ...init, status: 404 });\n }\n\n if (typeof detail === 'string') {\n return TangoResponse.error(\n {\n code: 'not_found',\n message: detail,\n },\n { ...init, status: 404 }\n );\n }\n\n return TangoResponse.error(\n {\n code: 'not_found',\n message: 'Not Found',\n },\n { ...init, status: 404 }\n );\n }\n\n /**\n * Create a `409 Conflict` response from a string or structured error.\n */\n static conflict<TDetails extends ErrorDetails = null>(\n detail?: string | TangoError | ProblemDetails<TDetails>,\n init?: Omit<TangoResponseInit, 'body' | 'status' | 'headers'> & {\n headers?: HeadersInit;\n }\n ): TangoResponse {\n if (TangoError.isTangoError(detail) || TangoError.isProblemDetails(detail)) {\n return TangoResponse.error(detail, { ...init, status: 409 });\n }\n\n if (typeof detail === 'string') {\n return TangoResponse.error(\n {\n code: 'conflict',\n message: detail,\n },\n { ...init, status: 409 }\n );\n }\n\n return TangoResponse.error(\n {\n code: 'conflict',\n message: 'Conflict',\n },\n { ...init, status: 409 }\n );\n }\n\n /**\n * Create a `422 Unprocessable Entity` response from a string or structured error.\n */\n static unprocessableEntity<TDetails extends ErrorDetails = null>(\n detail?: string | TangoError | ProblemDetails<TDetails>,\n init?: Omit<TangoResponseInit, 'body' | 'status' | 'headers'> & {\n headers?: HeadersInit;\n }\n ): TangoResponse {\n if (TangoError.isTangoError(detail) || TangoError.isProblemDetails(detail)) {\n return TangoResponse.error(detail, { ...init, status: 422 });\n }\n\n if (typeof detail === 'string') {\n return TangoResponse.error(\n {\n code: 'unprocessable_entity',\n message: detail,\n },\n { ...init, status: 422 }\n );\n }\n\n return TangoResponse.error(\n {\n code: 'unprocessable_entity',\n message: 'Unprocessable Entity',\n },\n { ...init, status: 422 }\n );\n }\n\n /**\n * Create a `429 Too Many Requests` response from a string or structured error.\n */\n static tooManyRequests<TDetails extends ErrorDetails = null>(\n detail?: string | TangoError | ProblemDetails<TDetails>,\n init?: Omit<TangoResponseInit, 'body' | 'status' | 'headers'> & {\n headers?: HeadersInit;\n }\n ): TangoResponse {\n if (TangoError.isTangoError(detail) || TangoError.isProblemDetails(detail)) {\n return TangoResponse.error(detail, { ...init, status: 429 });\n }\n\n if (typeof detail === 'string') {\n return TangoResponse.error(\n {\n code: 'too_many_requests',\n message: detail,\n },\n { ...init, status: 429 }\n );\n }\n\n return TangoResponse.error(\n {\n code: 'too_many_requests',\n message: 'Too Many Requests',\n },\n { ...init, status: 429 }\n );\n }\n\n /**\n * Create a problem-details style error response with Tango's envelope shape.\n */\n static problem<TDetails extends ErrorDetails = null>(\n problem?: string | TangoError | ProblemDetails<TDetails> | unknown,\n init?: Omit<TangoResponseInit, 'body' | 'headers'> & {\n headers?: HeadersInit;\n status?: number;\n }\n ): TangoResponse {\n let status = init?.status ?? 500;\n const headers = new TangoHeaders(init?.headers);\n if (!headers.has('Content-Type')) {\n headers.set('Content-Type', 'application/problem+json; charset=utf-8');\n }\n\n let code = 'error';\n let message = 'An error occurred';\n let details: ErrorDetails = undefined;\n let fields: Record<string, string[]> | undefined;\n\n if (TangoError.isTangoError(problem)) {\n const envelope = problem.toErrorEnvelope();\n status = problem.status;\n code = envelope.error.code;\n message = envelope.error.message;\n details = envelope.error.details;\n fields = envelope.error.fields;\n } else if (TangoError.isProblemDetails(problem)) {\n code = problem.code;\n message = problem.message;\n details = problem.details;\n fields = problem.fields;\n } else if (typeof problem === 'string') {\n message = problem;\n } else if (problem && typeof problem === 'object') {\n const extracted = problem as {\n details?: ErrorDetails;\n fields?: Record<string, string[]>;\n };\n details = extracted.details;\n fields = extracted.fields;\n }\n\n const envelope: ErrorEnvelope<ErrorDetails> = {\n error: {\n code,\n message,\n ...(details === undefined ? {} : { details }),\n ...(fields ? { fields } : {}),\n },\n };\n\n const body = JSON.stringify(envelope);\n if (!headers.has('Content-Length')) {\n headers.set('Content-Length', new TextEncoder().encode(body).length.toString());\n }\n return new TangoResponse({\n ...init,\n headers,\n status,\n body,\n });\n }\n\n /**\n * Returns a response for serving a file.\n */\n static file(\n file: Blob | Uint8Array | ArrayBuffer | ReadableStream<Uint8Array> | string,\n opts?: {\n filename?: string;\n contentType?: string;\n init?: Omit<TangoResponseInit, 'body' | 'headers'> & { headers?: HeadersInit };\n }\n ): TangoResponse {\n const headers = new TangoHeaders(opts?.init?.headers ?? {});\n if (opts?.filename) {\n // Serve as an attachment by default, but not 'download'\n headers.setContentDispositionInline(opts.filename);\n }\n if (opts?.contentType && !headers.has('Content-Type')) {\n headers.set('Content-Type', opts.contentType);\n } else if (!headers.has('Content-Type')) {\n headers.setContentTypeByFile(file, opts?.filename);\n }\n if (!headers.has('Content-Length')) {\n headers.setContentLengthFromBody(file);\n }\n return new TangoResponse({\n ...opts?.init,\n body: file as BodyInit,\n headers,\n });\n }\n\n /**\n * Returns a response that prompts the user to download the file.\n */\n static download(\n file: Blob | Uint8Array | ArrayBuffer | ReadableStream<Uint8Array> | string,\n opts?: {\n filename?: string;\n contentType?: string;\n init?: Omit<TangoResponseInit, 'body' | 'headers'> & { headers?: HeadersInit };\n }\n ): TangoResponse {\n const headers = new TangoHeaders(opts?.init?.headers ?? {});\n if (opts?.filename) {\n headers.setContentDispositionAttachment(opts.filename);\n } else {\n headers.set('Content-Disposition', 'attachment');\n }\n if (opts?.contentType && !headers.has('Content-Type')) {\n headers.set('Content-Type', opts.contentType);\n } else if (!headers.has('Content-Type')) {\n headers.setContentTypeByFile(file, opts?.filename);\n }\n if (!headers.has('Content-Length')) {\n headers.setContentLengthFromBody(file);\n }\n return new TangoResponse({\n ...opts?.init,\n body: file as BodyInit,\n headers,\n });\n }\n\n private static normalizeWebBody(body: BodyInit | JsonValue | null): BodyInit | null {\n if (\n isNil(body) ||\n typeof body === 'string' ||\n isBlob(body) ||\n isFormData(body) ||\n isArrayBuffer(body) ||\n isUint8Array(body) ||\n isURLSearchParams(body) ||\n isReadableStream(body)\n ) {\n return body;\n }\n\n return JSON.stringify(body);\n }\n\n /**\n * Expose the original body source for cloning and adapter integration.\n */\n get bodySource(): BodyInit | JsonValue | null {\n return this.tangoBody.bodySource;\n }\n\n /**\n * Report whether the status code falls inside the 2xx range.\n */\n get ok(): boolean {\n if (typeof this.okValue === 'boolean') return this.okValue;\n return this.status >= 200 && this.status < 300;\n }\n\n /**\n * Report whether the body has been consumed.\n */\n get bodyUsed(): boolean {\n return this.tangoBody.bodyUsed;\n }\n\n /**\n * Replace a header value on the response.\n */\n setHeader(name: string, value: string): void {\n this.headers.set(name, value);\n }\n /**\n * Append another value for a repeated response header.\n */\n appendHeader(name: string, value: string): void {\n this.headers.append(name, value);\n }\n /**\n * Read a response header value.\n */\n getHeader(name: string): string | null {\n return this.headers.get(name);\n }\n /**\n * Check whether a response header is present.\n */\n hasHeader(name: string): boolean {\n return this.headers.has(name);\n }\n /**\n * Remove a response header.\n */\n deleteHeader(name: string): void {\n this.headers.delete(name);\n }\n /**\n * Merge one or more values into the `Vary` header.\n */\n vary(...fields: string[]): void {\n this.headers.vary(...fields);\n }\n\n /**\n * Add a `Set-Cookie` header that replaces prior application intent.\n */\n setCookie(name: string, value: string, options?: Parameters<TangoHeaders['setCookie']>[2]): void {\n this.headers.setCookie(name, value, options);\n }\n /**\n * Append another `Set-Cookie` header.\n */\n appendCookie(name: string, value: string, options?: Parameters<TangoHeaders['appendCookie']>[2]): void {\n this.headers.appendCookie(name, value, options);\n }\n /**\n * Expire a cookie by issuing a matching deletion cookie header.\n */\n deleteCookie(name: string, options?: Parameters<TangoHeaders['deleteCookie']>[1]): void {\n this.headers.deleteCookie(name, options);\n }\n\n /**\n * Set the `Cache-Control` header through Tango's higher-level helper.\n */\n cacheControl(control: Parameters<TangoHeaders['cacheControl']>[0]): void {\n this.headers.cacheControl(control);\n }\n\n /**\n * Set the `Location` header on the response.\n */\n location(url: string): void {\n this.headers.location(url);\n }\n\n /**\n * Set the response content type.\n */\n contentType(mime: string): void {\n this.headers.contentType(mime);\n }\n\n // ---- Trace & Correlation helper methods ----\n\n /**\n * Set the X-Request-Id header (request correlation).\n * Returns this for fluent chaining.\n */\n withRequestId(requestId: string | undefined | null): this {\n if (!isNil(requestId) && typeof requestId === 'string' && requestId !== '') {\n this.headers.set('X-Request-Id', requestId);\n }\n return this;\n }\n\n /**\n * Set the traceparent header (W3C Trace Context propagation).\n * Returns this for fluent chaining.\n */\n withTraceparent(traceparent: string | undefined | null): this {\n if (!isNil(traceparent) && typeof traceparent === 'string' && traceparent !== '') {\n this.headers.set('traceparent', traceparent);\n }\n return this;\n }\n\n /**\n * Set the Server-Timing header.\n * Accepts a string or array of timing metrics.\n * Returns this for fluent chaining.\n */\n withServerTiming(timing: string | string[]): this {\n if (Array.isArray(timing)) {\n this.headers.set('Server-Timing', timing.join(', '));\n } else if (typeof timing === 'string') {\n this.headers.set('Server-Timing', timing);\n }\n return this;\n }\n\n /**\n * Set the X-Response-Time header (in ms).\n * Numeric or formatted string (e.g. \"76ms\").\n * Returns this for fluent chaining.\n */\n withResponseTime(time: number | string): this {\n if (typeof time === 'number') {\n this.headers.set('X-Response-Time', `${time}ms`);\n } else if (typeof time === 'string') {\n this.headers.set('X-Response-Time', time);\n }\n return this;\n }\n\n /**\n * Propagate common tracing/correlation headers from provided Headers, TangoHeaders, or plain object.\n * Known headers: x-request-id, traceparent, server-timing\n * Returns this for fluent chaining.\n */\n propagateTraceHeaders(input: HeadersInit): this {\n const incoming = new TangoHeaders(input);\n const traceHeaderNames = [\n 'x-request-id',\n 'traceparent',\n 'server-timing',\n // If you want to propagate response time, add 'x-response-time',\n ];\n for (const name of traceHeaderNames) {\n const value = incoming.get(name);\n if (!isNil(value)) this.headers.set(name, value);\n }\n return this;\n }\n\n /**\n * Clone the response so its body can be consumed independently.\n */\n clone(): TangoResponse {\n if (this.bodyUsed) {\n throw new TypeError('Body has already been used');\n }\n const clonedBody = this.tangoBody.clone();\n return new TangoResponse({\n body: clonedBody.bodySource,\n headers: this.headers.clone(),\n ok: this.okValue,\n redirected: this.redirected,\n status: this.status,\n statusText: this.statusText,\n type: this.type,\n url: this.url,\n });\n }\n\n /**\n * Convert this Tango-owned response into a native web `Response`.\n *\n * Adapters use this at the host-framework boundary so Tango can standardize\n * on `TangoResponse` internally while Next.js and other hosts still receive\n * a platform-native response object.\n */\n toWebResponse(): Response {\n const responseForTransfer = !this.bodyUsed && isReadableStream(this.bodySource) ? this.clone() : this;\n const body = TangoResponse.normalizeWebBody(responseForTransfer.bodySource);\n\n return new Response(body, {\n headers: new Headers(responseForTransfer.headers),\n status: responseForTransfer.status,\n statusText: responseForTransfer.statusText,\n });\n }\n\n //---- Spec Response interface fields and methods ----\n\n /**\n * Read the response body as an array buffer.\n */\n async arrayBuffer(): Promise<ArrayBuffer> {\n return this.tangoBody.arrayBuffer();\n }\n /**\n * Read the response body as a blob.\n */\n async blob(): Promise<Blob> {\n return this.tangoBody.blob();\n }\n /**\n * Read the response body as bytes.\n */\n async bytes(): Promise<Uint8Array<ArrayBuffer>> {\n return this.tangoBody.bytes();\n }\n /**\n * Read the response body as form data.\n */\n async formData(): Promise<FormData> {\n return this.tangoBody.formData();\n }\n /**\n * Parse the response body as JSON.\n */\n async json<T = unknown>(): Promise<T> {\n return this.tangoBody.json<T>();\n }\n /**\n * Read the response body as text.\n */\n async text(): Promise<string> {\n return this.tangoBody.text();\n }\n\n /**\n * Returns a plain object debug representation of this response: { status, headers: { ... }, bodyType: ... }.\n * Intended for testing and debug tooling.\n */\n toJSON(): { status: number; headers: Record<string, string>; bodyType: string } {\n return {\n status: this.status,\n headers: Object.fromEntries(this.headers.entries()),\n bodyType: this.tangoBody.bodyType,\n };\n }\n\n /**\n * Returns the original body for test/debug purposes *without* consuming the stream.\n *\n * @throws {Error} if called in a production environment. Provided only for test or debug.\n * @remarks\n * This method gives direct access to the original body as provided to the constructor,\n * before consumption. It is primarily intended for use in test code, introspection, or\n * advanced debug tools. **Do not rely on this in production.**\n * In production (`process.env.NODE_ENV === 'production'`), using this method will throw.\n *\n * This method is _not_ part of the web Response interface, and is intentionally private/internal.\n */\n\n public __peekBodyForTestOnly(): BodyInit | JsonValue | null {\n // Strong guard against accidental shipping in production\n if (\n typeof process !== 'undefined' &&\n process.env &&\n (process.env.NODE_ENV === 'production' || process.env.NODE_ENV === 'prod')\n ) {\n throw new Error('peekBody() is not available in production builds. For test/debug use only.');\n }\n return this.tangoBody.bodySource;\n }\n}\n","/**\n * Domain boundary barrel: centralizes this subdomain's public contract.\n */\n\nimport { TangoBody, type JsonValue } from './TangoBody';\nimport { TangoHeaders } from './TangoHeaders';\nimport { TangoQueryParams } from './TangoQueryParams';\nimport { TangoRequest } from './TangoRequest';\nimport { TangoResponse } from './TangoResponse';\n\nexport { TangoBody, TangoHeaders, TangoQueryParams, TangoRequest, TangoResponse };\nexport type { JsonValue };\n"],"mappings":";;;;;IA2Ba,YAAN,MAAM,UAAU;CACnB,OAAgB,QAAQ;CACxB,eAAgD,UAAU;CAC1D;CACA;CACA;CAEA,YAAYA,YAA6BC,SAAuB;AAC5D,OAAK,qBAAqB;AAC1B,OAAK,mBAAmB;AACxB,OAAK,UAAU;CAClB;;;;CAKD,OAAO,YAAYC,OAAoC;AACnD,gBACW,UAAU,YACjB,UAAU,QACT,MAAqC,iBAAiB,UAAU;CAExE;;;;CAKD,IAAW,aAA8B;AACrC,SAAO,KAAK;CACf;;;;CAKD,IAAI,WAAoB;AACpB,SAAO,KAAK;CACf;;;;CAKD,IAAI,WAAmB;EACnB,MAAM,OAAO,KAAK;AAClB,MAAI,MAAM,KAAK,CAAE,QAAO;AACxB,aAAW,SAAS,SAAU,QAAO;AACrC,MAAI,cAAc,KAAK,CAAE,QAAO;AAChC,MAAI,aAAa,KAAK,CAAE,QAAO;AAC/B,MAAI,OAAO,KAAK,CAAE,QAAO;AACzB,MAAI,WAAW,KAAK,CAAE,QAAO;AAC7B,MAAI,kBAAkB,KAAK,CAAE,QAAO;AACpC,MAAI,iBAAiB,KAAK,CAAE,QAAO;AACnC,MAAI,UAAU,YAAY,KAAK,CAAE,QAAO;AACxC,gBAAc;CACjB;;;;CAKD,OAAc,YAAYC,GAA4B;AAClD,MAAI,MA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IAAI,MAAM;AAEpB,SAAO,KAAK,UAAU;CACzB;AACJ"}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,16 +3,18 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as errors from './errors/index';
|
|
5
5
|
import * as http from './http/index';
|
|
6
|
-
import * as
|
|
6
|
+
import * as logging from './logging/index';
|
|
7
7
|
import * as runtime from './runtime/index';
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
8
|
+
import * as sql from './sql/index';
|
|
9
|
+
import { AuthenticationError, ConflictError, HttpErrorFactory, NotFoundError, PermissionDenied, TangoError, ValidationError, type ErrorDetails, type ErrorEnvelope, type HttpError, type HttpErrorFactoryConfig, type ProblemDetails } from './errors/index';
|
|
10
|
+
import { TangoBody, type JsonValue, TangoHeaders, TangoQueryParams, TangoRequest, TangoResponse } from './http/index';
|
|
11
|
+
import { ConsoleLogger, getLogger, setLoggerFactory, resetLoggerFactory, type Logger } from './logging/index';
|
|
12
|
+
import { SqlSafetyEngine, isTrustedSqlFragment, quoteSqlIdentifier, trustedSql, validateSqlIdentifier, type SqlDialect, type SqlIdentifierRequest, type SqlIdentifierRole, type SqlLookupTokenRequest, type SqlRawFragmentRequest, type SqlSafetyRequest, type TrustedSqlFragment, type ValidatedSqlIdentifier, type ValidatedSqlLookupToken, type ValidatedSqlSafetyResult } from './sql/index';
|
|
11
13
|
import { isArrayBuffer, isBlob, isDate, isError, isFile, isFormData, isObject, isReadableStream, isUint8Array, isURLSearchParams } from './runtime/index';
|
|
12
14
|
/**
|
|
13
15
|
* Bundled exports for Django-style domain drill-down imports, plus curated
|
|
14
16
|
* top-level symbols for TS-native ergonomic imports.
|
|
15
17
|
*/
|
|
16
|
-
export { errors, http,
|
|
17
|
-
export { AuthenticationError, ConflictError, HttpErrorFactory, NotFoundError, PermissionDenied, TangoBody, TangoError, TangoHeaders, TangoRequest, TangoResponse, ValidationError,
|
|
18
|
-
export type { ErrorDetails, ErrorEnvelope, HttpError, HttpErrorFactoryConfig, JsonValue, ProblemDetails,
|
|
18
|
+
export { errors, http, logging, runtime, sql };
|
|
19
|
+
export { AuthenticationError, ConflictError, HttpErrorFactory, NotFoundError, PermissionDenied, TangoBody, TangoError, TangoHeaders, TangoQueryParams, TangoRequest, TangoResponse, ValidationError, ConsoleLogger, getLogger, setLoggerFactory, resetLoggerFactory, SqlSafetyEngine, trustedSql, isTrustedSqlFragment, validateSqlIdentifier, quoteSqlIdentifier, isArrayBuffer, isBlob, isDate, isError, isFile, isFormData, isObject, isReadableStream, isUint8Array, isURLSearchParams, };
|
|
20
|
+
export type { ErrorDetails, ErrorEnvelope, HttpError, HttpErrorFactoryConfig, JsonValue, Logger, ProblemDetails, SqlDialect, SqlIdentifierRequest, SqlIdentifierRole, SqlLookupTokenRequest, SqlRawFragmentRequest, SqlSafetyRequest, TrustedSqlFragment, ValidatedSqlIdentifier, ValidatedSqlLookupToken, ValidatedSqlSafetyResult, };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { TangoError } from "./TangoError-
|
|
2
|
-
import { isArrayBuffer, isBlob, isDate, isError, isFile, isFormData, isObject, isReadableStream, isURLSearchParams, isUint8Array, runtime_exports } from "./runtime-
|
|
3
|
-
import { AuthenticationError, ConflictError, HttpErrorFactory, NotFoundError, PermissionDenied, ValidationError,
|
|
4
|
-
import { TangoBody, TangoHeaders, TangoRequest, TangoResponse, http_exports } from "./http-
|
|
5
|
-
import {
|
|
1
|
+
import { TangoError } from "./TangoError-DdQVQNZU.js";
|
|
2
|
+
import { isArrayBuffer, isBlob, isDate, isError, isFile, isFormData, isObject, isReadableStream, isURLSearchParams, isUint8Array, runtime_exports } from "./runtime-B8KkgD3R.js";
|
|
3
|
+
import { AuthenticationError, ConflictError, HttpErrorFactory, NotFoundError, PermissionDenied, ValidationError, errors_exports } from "./errors-_tWsmNyZ.js";
|
|
4
|
+
import { TangoBody, TangoHeaders, TangoQueryParams, TangoRequest, TangoResponse, http_exports } from "./http-D20MQa6p.js";
|
|
5
|
+
import { ConsoleLogger, getLogger, logging_exports, resetLoggerFactory, setLoggerFactory } from "./logging-BWeD4HOO.js";
|
|
6
|
+
import { SqlSafetyEngine, isTrustedSqlFragment, quoteSqlIdentifier, sql_exports, trustedSql, validateSqlIdentifier } from "./sql-D3frkfy-.js";
|
|
6
7
|
|
|
7
|
-
export { AuthenticationError, ConflictError,
|
|
8
|
+
export { AuthenticationError, ConflictError, ConsoleLogger, HttpErrorFactory, NotFoundError, PermissionDenied, SqlSafetyEngine, TangoBody, TangoError, TangoHeaders, TangoQueryParams, TangoRequest, TangoResponse, ValidationError, errors_exports as errors, getLogger, http_exports as http, isArrayBuffer, isBlob, isDate, isError, isFile, isFormData, isObject, isReadableStream, isTrustedSqlFragment, isURLSearchParams, isUint8Array, logging_exports as logging, quoteSqlIdentifier, resetLoggerFactory, runtime_exports as runtime, setLoggerFactory, sql_exports as sql, trustedSql, validateSqlIdentifier };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Logger } from './Logger';
|
|
2
|
+
/**
|
|
3
|
+
* Default `Logger` implementation that delegates to `console.*`.
|
|
4
|
+
*
|
|
5
|
+
* Each message is prefixed with the scope string so log output is
|
|
6
|
+
* filterable by origin (e.g. `[tango.adapter.next] Adapter error: …`).
|
|
7
|
+
*/
|
|
8
|
+
export declare class ConsoleLogger implements Logger {
|
|
9
|
+
private readonly scope;
|
|
10
|
+
constructor(scope: string);
|
|
11
|
+
error(message: string, ...args: unknown[]): void;
|
|
12
|
+
warn(message: string, ...args: unknown[]): void;
|
|
13
|
+
info(message: string, ...args: unknown[]): void;
|
|
14
|
+
debug(message: string, ...args: unknown[]): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal logging interface for the Tango framework.
|
|
3
|
+
*
|
|
4
|
+
* Consumers may provide their own implementation (Pino, Winston, etc.)
|
|
5
|
+
* via `TangoConfig.logger`. The framework never makes assumptions about
|
|
6
|
+
* transports, formatting, or log levels beyond these four methods.
|
|
7
|
+
*/
|
|
8
|
+
export interface Logger {
|
|
9
|
+
error(message: string, ...args: unknown[]): void;
|
|
10
|
+
warn(message: string, ...args: unknown[]): void;
|
|
11
|
+
info(message: string, ...args: unknown[]): void;
|
|
12
|
+
debug(message: string, ...args: unknown[]): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Logger } from './Logger';
|
|
2
|
+
type LoggerFactory = (scope: string) => Logger;
|
|
3
|
+
/**
|
|
4
|
+
* Return a `Logger` bound to the given scope name.
|
|
5
|
+
*
|
|
6
|
+
* By default loggers are `ConsoleLogger` instances. Call
|
|
7
|
+
* `setLoggerFactory` to redirect all framework logging
|
|
8
|
+
* to a custom implementation (Pino, Winston, etc.).
|
|
9
|
+
*/
|
|
10
|
+
export declare function getLogger(scope: string): Logger;
|
|
11
|
+
/**
|
|
12
|
+
* Replace the global logger factory used by `getLogger`.
|
|
13
|
+
*
|
|
14
|
+
* Typically called once during application bootstrap from
|
|
15
|
+
* the resolved `TangoConfig.logger` value.
|
|
16
|
+
*/
|
|
17
|
+
export declare function setLoggerFactory(custom: LoggerFactory | Logger): void;
|
|
18
|
+
/**
|
|
19
|
+
* Reset the logger factory to the default `ConsoleLogger`.
|
|
20
|
+
* Primarily useful in tests.
|
|
21
|
+
*/
|
|
22
|
+
export declare function resetLoggerFactory(): void;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { __export } from "./chunk-BkvOhyD0.js";
|
|
2
|
+
|
|
3
|
+
//#region src/logging/ConsoleLogger.ts
|
|
4
|
+
var ConsoleLogger = class {
|
|
5
|
+
constructor(scope) {
|
|
6
|
+
this.scope = scope;
|
|
7
|
+
}
|
|
8
|
+
error(message, ...args) {
|
|
9
|
+
console.error(`[${this.scope}]`, message, ...args);
|
|
10
|
+
}
|
|
11
|
+
warn(message, ...args) {
|
|
12
|
+
console.warn(`[${this.scope}]`, message, ...args);
|
|
13
|
+
}
|
|
14
|
+
info(message, ...args) {
|
|
15
|
+
console.info(`[${this.scope}]`, message, ...args);
|
|
16
|
+
}
|
|
17
|
+
debug(message, ...args) {
|
|
18
|
+
console.debug(`[${this.scope}]`, message, ...args);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/logging/getLogger.ts
|
|
24
|
+
let factory = (scope) => new ConsoleLogger(scope);
|
|
25
|
+
function getLogger(scope) {
|
|
26
|
+
return factory(scope);
|
|
27
|
+
}
|
|
28
|
+
function setLoggerFactory(custom) {
|
|
29
|
+
if (typeof custom === "function") factory = custom;
|
|
30
|
+
else factory = () => custom;
|
|
31
|
+
}
|
|
32
|
+
function resetLoggerFactory() {
|
|
33
|
+
factory = (scope) => new ConsoleLogger(scope);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
//#endregion
|
|
37
|
+
//#region src/logging/index.ts
|
|
38
|
+
var logging_exports = {};
|
|
39
|
+
__export(logging_exports, {
|
|
40
|
+
ConsoleLogger: () => ConsoleLogger,
|
|
41
|
+
getLogger: () => getLogger,
|
|
42
|
+
resetLoggerFactory: () => resetLoggerFactory,
|
|
43
|
+
setLoggerFactory: () => setLoggerFactory
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
//#endregion
|
|
47
|
+
export { ConsoleLogger, getLogger, logging_exports, resetLoggerFactory, setLoggerFactory };
|
|
48
|
+
//# sourceMappingURL=logging-BWeD4HOO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logging-BWeD4HOO.js","names":["scope: string","message: string","factory: LoggerFactory","scope: string","custom: LoggerFactory | Logger"],"sources":["../src/logging/ConsoleLogger.ts","../src/logging/getLogger.ts","../src/logging/index.ts"],"sourcesContent":["import type { Logger } from './Logger';\n\n/**\n * Default `Logger` implementation that delegates to `console.*`.\n *\n * Each message is prefixed with the scope string so log output is\n * filterable by origin (e.g. `[tango.adapter.next] Adapter error: …`).\n */\nexport class ConsoleLogger implements Logger {\n constructor(private readonly scope: string) {}\n\n error(message: string, ...args: unknown[]): void {\n console.error(`[${this.scope}]`, message, ...args);\n }\n\n warn(message: string, ...args: unknown[]): void {\n console.warn(`[${this.scope}]`, message, ...args);\n }\n\n info(message: string, ...args: unknown[]): void {\n console.info(`[${this.scope}]`, message, ...args);\n }\n\n debug(message: string, ...args: unknown[]): void {\n console.debug(`[${this.scope}]`, message, ...args);\n }\n}\n","import type { Logger } from './Logger';\nimport { ConsoleLogger } from './ConsoleLogger';\n\ntype LoggerFactory = (scope: string) => Logger;\n\nlet factory: LoggerFactory = (scope) => new ConsoleLogger(scope);\n\n/**\n * Return a `Logger` bound to the given scope name.\n *\n * By default loggers are `ConsoleLogger` instances. Call\n * `setLoggerFactory` to redirect all framework logging\n * to a custom implementation (Pino, Winston, etc.).\n */\nexport function getLogger(scope: string): Logger {\n return factory(scope);\n}\n\n/**\n * Replace the global logger factory used by `getLogger`.\n *\n * Typically called once during application bootstrap from\n * the resolved `TangoConfig.logger` value.\n */\nexport function setLoggerFactory(custom: LoggerFactory | Logger): void {\n if (typeof custom === 'function') {\n factory = custom;\n } else {\n factory = () => custom;\n }\n}\n\n/**\n * Reset the logger factory to the default `ConsoleLogger`.\n * Primarily useful in tests.\n */\nexport function resetLoggerFactory(): void {\n factory = (scope) => new ConsoleLogger(scope);\n}\n","export type { Logger } from './Logger';\nexport { ConsoleLogger } from './ConsoleLogger';\nexport { getLogger, setLoggerFactory, resetLoggerFactory } from './getLogger';\n"],"mappings":";;;IAQa,gBAAN,MAAsC;CACzC,YAA6BA,OAAe;AAAA,OAAf,QAAA;CAAiB;CAE9C,MAAMC,SAAiB,GAAG,MAAuB;AAC7C,UAAQ,OAAO,GAAG,KAAK,MAAM,IAAI,SAAS,GAAG,KAAK;CACrD;CAED,KAAKA,SAAiB,GAAG,MAAuB;AAC5C,UAAQ,MAAM,GAAG,KAAK,MAAM,IAAI,SAAS,GAAG,KAAK;CACpD;CAED,KAAKA,SAAiB,GAAG,MAAuB;AAC5C,UAAQ,MAAM,GAAG,KAAK,MAAM,IAAI,SAAS,GAAG,KAAK;CACpD;CAED,MAAMA,SAAiB,GAAG,MAAuB;AAC7C,UAAQ,OAAO,GAAG,KAAK,MAAM,IAAI,SAAS,GAAG,KAAK;CACrD;AACJ;;;;ACrBD,IAAIC,UAAyB,CAAC,UAAU,IAAI,cAAc;AASnD,SAAS,UAAUC,OAAuB;AAC7C,QAAO,QAAQ,MAAM;AACxB;AAQM,SAAS,iBAAiBC,QAAsC;AACnE,YAAW,WAAW,WAClB,WAAU;IAEV,WAAU,MAAM;AAEvB;AAMM,SAAS,qBAA2B;AACvC,WAAU,CAAC,UAAU,IAAI,cAAc;AAC1C"}
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -9,6 +9,6 @@ export * as error from './error/index';
|
|
|
9
9
|
export * as date from './date/index';
|
|
10
10
|
export { isArrayBuffer, isBlob, isUint8Array } from './binary/index';
|
|
11
11
|
export { isFile, isFormData, isReadableStream, isURLSearchParams } from './web/index';
|
|
12
|
-
export { isObject } from './object/index';
|
|
12
|
+
export { isNil, isObject } from './object/index';
|
|
13
13
|
export { isError } from './error/index';
|
|
14
14
|
export { isDate } from './date/index';
|
package/dist/runtime/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { binary_exports, date_exports, error_exports, isArrayBuffer, isBlob, isDate, isError, isFile, isFormData, isObject, isReadableStream, isURLSearchParams, isUint8Array, object_exports, web_exports } from "../runtime-
|
|
1
|
+
import { binary_exports, date_exports, error_exports, isArrayBuffer, isBlob, isDate, isError, isFile, isFormData, isNil, isObject, isReadableStream, isURLSearchParams, isUint8Array, object_exports, web_exports } from "../runtime-B8KkgD3R.js";
|
|
2
2
|
|
|
3
|
-
export { binary_exports as binary, date_exports as date, error_exports as error, isArrayBuffer, isBlob, isDate, isError, isFile, isFormData, isObject, isReadableStream, isURLSearchParams, isUint8Array, object_exports as object, web_exports as web };
|
|
3
|
+
export { binary_exports as binary, date_exports as date, error_exports as error, isArrayBuffer, isBlob, isDate, isError, isFile, isFormData, isNil, isObject, isReadableStream, isURLSearchParams, isUint8Array, object_exports as object, web_exports as web };
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { __export } from "./chunk-BkvOhyD0.js";
|
|
2
2
|
|
|
3
|
+
//#region src/runtime/object/isNil.ts
|
|
4
|
+
function isNil(value) {
|
|
5
|
+
return value === null || value === undefined;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
3
9
|
//#region src/runtime/internal/hasTag.ts
|
|
4
10
|
function hasTag(value, tag) {
|
|
5
|
-
return value
|
|
11
|
+
return !isNil(value) && Object.prototype.toString.call(value) === `[object ${tag}]`;
|
|
6
12
|
}
|
|
7
13
|
|
|
8
14
|
//#endregion
|
|
@@ -75,7 +81,10 @@ function isObject(value) {
|
|
|
75
81
|
//#endregion
|
|
76
82
|
//#region src/runtime/object/index.ts
|
|
77
83
|
var object_exports = {};
|
|
78
|
-
__export(object_exports, {
|
|
84
|
+
__export(object_exports, {
|
|
85
|
+
isNil: () => isNil,
|
|
86
|
+
isObject: () => isObject
|
|
87
|
+
});
|
|
79
88
|
|
|
80
89
|
//#endregion
|
|
81
90
|
//#region src/runtime/error/isError.ts
|
|
@@ -112,6 +121,7 @@ __export(runtime_exports, {
|
|
|
112
121
|
isError: () => isError,
|
|
113
122
|
isFile: () => isFile,
|
|
114
123
|
isFormData: () => isFormData,
|
|
124
|
+
isNil: () => isNil,
|
|
115
125
|
isObject: () => isObject,
|
|
116
126
|
isReadableStream: () => isReadableStream,
|
|
117
127
|
isURLSearchParams: () => isURLSearchParams,
|
|
@@ -121,5 +131,5 @@ __export(runtime_exports, {
|
|
|
121
131
|
});
|
|
122
132
|
|
|
123
133
|
//#endregion
|
|
124
|
-
export { binary_exports, date_exports, error_exports, isArrayBuffer, isBlob, isDate, isError, isFile, isFormData, isObject, isReadableStream, isURLSearchParams, isUint8Array, object_exports, runtime_exports, web_exports };
|
|
125
|
-
//# sourceMappingURL=runtime-
|
|
134
|
+
export { binary_exports, date_exports, error_exports, isArrayBuffer, isBlob, isDate, isError, isFile, isFormData, isNil, isObject, isReadableStream, isURLSearchParams, isUint8Array, object_exports, runtime_exports, web_exports };
|
|
135
|
+
//# sourceMappingURL=runtime-B8KkgD3R.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-B8KkgD3R.js","names":["value: unknown","value: unknown","tag: string","value: unknown","value: unknown","value: unknown","value: unknown","value: unknown","value: unknown","value: unknown","value: unknown","value: unknown","value: unknown"],"sources":["../src/runtime/object/isNil.ts","../src/runtime/internal/hasTag.ts","../src/runtime/binary/isArrayBuffer.ts","../src/runtime/binary/isUint8Array.ts","../src/runtime/binary/isBlob.ts","../src/runtime/binary/index.ts","../src/runtime/web/isFormData.ts","../src/runtime/web/isURLSearchParams.ts","../src/runtime/web/isReadableStream.ts","../src/runtime/web/isFile.ts","../src/runtime/web/index.ts","../src/runtime/object/isObject.ts","../src/runtime/object/index.ts","../src/runtime/error/isError.ts","../src/runtime/error/index.ts","../src/runtime/date/isDate.ts","../src/runtime/date/index.ts","../src/runtime/index.ts"],"sourcesContent":["/**\n * Return true when a value is `null` or `undefined`.\n */\nexport function isNil(value: unknown): value is null | undefined {\n return value === null || value === undefined;\n}\n","import { isNil } from '../object/isNil';\n\nexport function hasTag(value: unknown, tag: string): boolean {\n return !isNil(value) && Object.prototype.toString.call(value) === `[object ${tag}]`;\n}\n","import { hasTag } from '../internal/hasTag';\n\n/**\n * Return true when a value is an `ArrayBuffer`.\n */\nexport function isArrayBuffer(value: unknown): value is ArrayBuffer {\n return hasTag(value, 'ArrayBuffer');\n}\n","import { hasTag } from '../internal/hasTag';\n\n/**\n * Return true when a value is a `Uint8Array`.\n */\nexport function isUint8Array(value: unknown): value is Uint8Array<ArrayBuffer> {\n return hasTag(value, 'Uint8Array');\n}\n","import { hasTag } from '../internal/hasTag';\n\n/**\n * Return true when a value is a `Blob`.\n */\nexport function isBlob(value: unknown): value is Blob {\n return hasTag(value, 'Blob');\n}\n","/**\n * Domain boundary barrel: centralizes this subdomain's public contract.\n */\n\nexport { isArrayBuffer } from './isArrayBuffer';\nexport { isUint8Array } from './isUint8Array';\nexport { isBlob } from './isBlob';\n","import { hasTag } from '../internal/hasTag';\n\n/**\n * Return true when a value is `FormData`.\n */\nexport function isFormData(value: unknown): value is FormData {\n return hasTag(value, 'FormData');\n}\n","import { hasTag } from '../internal/hasTag';\n\n/**\n * Return true when a value is `URLSearchParams`.\n */\nexport function isURLSearchParams(value: unknown): value is URLSearchParams {\n return hasTag(value, 'URLSearchParams');\n}\n","import { hasTag } from '../internal/hasTag';\n\n/**\n * Return true when a value is a readable web stream.\n */\nexport function isReadableStream(value: unknown): value is ReadableStream<Uint8Array<ArrayBuffer>> {\n return hasTag(value, 'ReadableStream');\n}\n","import { hasTag } from '../internal/hasTag';\n\n/**\n * Return true when a value is a web `File`.\n */\nexport function isFile(value: unknown): value is File {\n return hasTag(value, 'File');\n}\n","/**\n * Domain boundary barrel: centralizes this subdomain's public contract.\n */\n\nexport { isFormData } from './isFormData';\nexport { isURLSearchParams } from './isURLSearchParams';\nexport { isReadableStream } from './isReadableStream';\nexport { isFile } from './isFile';\n","/**\n * Return true when a value is a non-null object.\n */\nexport function isObject(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null;\n}\n","/**\n * Domain boundary barrel: centralizes this subdomain's public contract.\n */\n\nexport { isObject } from './isObject';\nexport { isNil } from './isNil';\n","import { isObject } from '../object/isObject';\n\n/**\n * Return true when a value looks like an `Error`.\n */\nexport function isError(value: unknown): value is Error {\n return (\n isObject(value) &&\n typeof (value as { name?: unknown }).name === 'string' &&\n typeof (value as { message?: unknown }).message === 'string'\n );\n}\n","/**\n * Domain boundary barrel: centralizes this subdomain's public contract.\n */\n\nexport { isError } from './isError';\n","import { hasTag } from '../internal/hasTag';\n\n/**\n * Return true when a value is a `Date`.\n */\nexport function isDate(value: unknown): value is Date {\n return hasTag(value, 'Date');\n}\n","/**\n * Domain boundary barrel: centralizes this subdomain's public contract.\n */\n\nexport { isDate } from './isDate';\n","/**\n * Domain boundary barrel: exposes namespaced exports for Django-style drill-down\n * imports and curated flat exports for TS-native ergonomics.\n */\n\nexport * as binary from './binary/index';\nexport * as web from './web/index';\nexport * as object from './object/index';\nexport * as error from './error/index';\nexport * as date from './date/index';\n\nexport { isArrayBuffer, isBlob, isUint8Array } from './binary/index';\nexport { isFile, isFormData, isReadableStream, isURLSearchParams } from './web/index';\nexport { isNil, isObject } from './object/index';\nexport { isError } from './error/index';\nexport { isDate } from './date/index';\n"],"mappings":";;;AAGO,SAAS,MAAMA,OAA2C;AAC7D,QAAO,UAAU,QAAQ,UAAU;AACtC;;;;ACHM,SAAS,OAAOC,OAAgBC,KAAsB;AACzD,SAAQ,MAAM,MAAM,IAAI,OAAO,UAAU,SAAS,KAAK,MAAM,MAAM,UAAU,IAAI;AACpF;;;;ACCM,SAAS,cAAcC,OAAsC;AAChE,QAAO,OAAO,OAAO,cAAc;AACtC;;;;ACFM,SAAS,aAAaC,OAAkD;AAC3E,QAAO,OAAO,OAAO,aAAa;AACrC;;;;ACFM,SAAS,OAAOC,OAA+B;AAClD,QAAO,OAAO,OAAO,OAAO;AAC/B;;;;;;;;;;;;;ACFM,SAAS,WAAWC,OAAmC;AAC1D,QAAO,OAAO,OAAO,WAAW;AACnC;;;;ACFM,SAAS,kBAAkBC,OAA0C;AACxE,QAAO,OAAO,OAAO,kBAAkB;AAC1C;;;;ACFM,SAAS,iBAAiBC,OAAkE;AAC/F,QAAO,OAAO,OAAO,iBAAiB;AACzC;;;;ACFM,SAAS,OAAOC,OAA+B;AAClD,QAAO,OAAO,OAAO,OAAO;AAC/B;;;;;;;;;;;;;;ACJM,SAAS,SAASC,OAAkD;AACvE,eAAc,UAAU,YAAY,UAAU;AACjD;;;;;;;;;;;;ACAM,SAAS,QAAQC,OAAgC;AACpD,QACI,SAAS,MAAM,WACP,MAA6B,SAAS,mBACtC,MAAgC,YAAY;AAE3D;;;;;;;;;ACNM,SAAS,OAAOC,OAA+B;AAClD,QAAO,OAAO,OAAO,OAAO;AAC/B"}
|