@danceroutine/tango-core 1.11.1 → 1.11.2

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.
Files changed (83) hide show
  1. package/dist/{TangoError-DdQVQNZU.js → TangoError-Cvgnm026.js} +8 -4
  2. package/dist/TangoError-Cvgnm026.js.map +1 -0
  3. package/dist/TangoError-ptR2iApz.d.ts +45 -0
  4. package/dist/chunk-D7D4PA-g.js +13 -0
  5. package/dist/errors/index.d.ts +3 -15
  6. package/dist/errors/index.js +3 -5
  7. package/dist/{errors-VacGsSaj.js → errors-DpI5Dxmr.js} +45 -36
  8. package/dist/errors-DpI5Dxmr.js.map +1 -0
  9. package/dist/http/index.d.ts +2 -10
  10. package/dist/http/index.js +2 -5
  11. package/dist/{http-63cMANMG.js → http-6e0y_vd6.js} +95 -79
  12. package/dist/{http-63cMANMG.js.map → http-6e0y_vd6.js.map} +1 -1
  13. package/dist/index-B5PoK4LH.d.ts +86 -0
  14. package/dist/index-D8o4DOOG.d.ts +824 -0
  15. package/dist/index-DFWodYLS.d.ts +161 -0
  16. package/dist/index-DPABSINz.d.ts +114 -0
  17. package/dist/index-MZzjIxgD.d.ts +59 -0
  18. package/dist/index.d.ts +7 -20
  19. package/dist/index.js +13 -7
  20. package/dist/index.js.map +1 -0
  21. package/dist/logging/index.d.ts +2 -3
  22. package/dist/logging/index.js +2 -3
  23. package/dist/logging-UC5uXHET.js +68 -0
  24. package/dist/logging-UC5uXHET.js.map +1 -0
  25. package/dist/runtime/index.d.ts +2 -14
  26. package/dist/runtime/index.js +2 -3
  27. package/dist/{runtime-B8KkgD3R.js → runtime-BAG_EKuM.js} +44 -35
  28. package/dist/runtime-BAG_EKuM.js.map +1 -0
  29. package/dist/sql/index.d.ts +2 -13
  30. package/dist/sql/index.js +2 -3
  31. package/dist/{sql-BI3ptL9-.js → sql-CIPnuTYO.js} +21 -16
  32. package/dist/{sql-BI3ptL9-.js.map → sql-CIPnuTYO.js.map} +1 -1
  33. package/package.json +2 -2
  34. package/dist/TangoError-DdQVQNZU.js.map +0 -1
  35. package/dist/chunk-BkvOhyD0.js +0 -12
  36. package/dist/errors/AuthenticationError.d.ts +0 -15
  37. package/dist/errors/ConflictError.d.ts +0 -15
  38. package/dist/errors/HttpError.d.ts +0 -7
  39. package/dist/errors/MultipleObjectsReturned.d.ts +0 -11
  40. package/dist/errors/NotFoundError.d.ts +0 -15
  41. package/dist/errors/PermissionDenied.d.ts +0 -15
  42. package/dist/errors/TangoError.d.ts +0 -33
  43. package/dist/errors/ValidationError.d.ts +0 -14
  44. package/dist/errors/factories/HttpErrorFactory.d.ts +0 -59
  45. package/dist/errors/factories/index.d.ts +0 -4
  46. package/dist/errors-VacGsSaj.js.map +0 -1
  47. package/dist/http/TangoBody.d.ts +0 -110
  48. package/dist/http/TangoHeaders.d.ts +0 -191
  49. package/dist/http/TangoQueryParams.d.ts +0 -81
  50. package/dist/http/TangoRequest.d.ts +0 -130
  51. package/dist/http/TangoResponse.d.ts +0 -305
  52. package/dist/logging/ConsoleLogger.d.ts +0 -15
  53. package/dist/logging/Logger.d.ts +0 -13
  54. package/dist/logging/getLogger.d.ts +0 -23
  55. package/dist/logging-BWeD4HOO.js +0 -48
  56. package/dist/logging-BWeD4HOO.js.map +0 -1
  57. package/dist/runtime/binary/index.d.ts +0 -6
  58. package/dist/runtime/binary/isArrayBuffer.d.ts +0 -4
  59. package/dist/runtime/binary/isBlob.d.ts +0 -4
  60. package/dist/runtime/binary/isUint8Array.d.ts +0 -4
  61. package/dist/runtime/date/index.d.ts +0 -4
  62. package/dist/runtime/date/isDate.d.ts +0 -4
  63. package/dist/runtime/error/index.d.ts +0 -4
  64. package/dist/runtime/error/isError.d.ts +0 -4
  65. package/dist/runtime/internal/hasTag.d.ts +0 -1
  66. package/dist/runtime/object/index.d.ts +0 -5
  67. package/dist/runtime/object/isNil.d.ts +0 -4
  68. package/dist/runtime/object/isObject.d.ts +0 -4
  69. package/dist/runtime/web/index.d.ts +0 -7
  70. package/dist/runtime/web/isFile.d.ts +0 -4
  71. package/dist/runtime/web/isFormData.d.ts +0 -4
  72. package/dist/runtime/web/isReadableStream.d.ts +0 -4
  73. package/dist/runtime/web/isURLSearchParams.d.ts +0 -4
  74. package/dist/runtime-B8KkgD3R.js.map +0 -1
  75. package/dist/sql/SqlDialect.d.ts +0 -5
  76. package/dist/sql/SqlIdentifierRole.d.ts +0 -13
  77. package/dist/sql/SqlSafetyEngine.d.ts +0 -50
  78. package/dist/sql/TrustedSqlFragment.d.ts +0 -5
  79. package/dist/sql/ValidatedSqlIdentifier.d.ts +0 -7
  80. package/dist/sql/isTrustedSqlFragment.d.ts +0 -5
  81. package/dist/sql/quoteSqlIdentifier.d.ts +0 -6
  82. package/dist/sql/trustedSql.d.ts +0 -5
  83. package/dist/sql/validateSqlIdentifier.d.ts +0 -6
@@ -0,0 +1,824 @@
1
+ import { i as TangoError, r as ProblemDetails, t as ErrorDetails } from "./TangoError-ptR2iApz.js";
2
+
3
+ //#region src/http/TangoBody.d.ts
4
+ /**
5
+ * The full type of body that TangoResponse/TangoBody supports.
6
+ * Unlike the fetch spec BodyInit, this can be directly:
7
+ * - a string, ArrayBuffer, Uint8Array, Blob, FormData, ReadableStream, or JSON-like object, or null/undefined.
8
+ */
9
+ type HeadersLike = {
10
+ get?: (arg: string) => string | null;
11
+ };
12
+ type TangoBodySource = BodyInit | JsonValue | null;
13
+ /** Recursive JSON value contract used by Tango HTTP helpers. */
14
+ type JsonValue = string | number | boolean | null | JsonValue[] | {
15
+ [key: string]: JsonValue;
16
+ };
17
+ /**
18
+ * Unified body reader/clone utility for Tango request/response wrappers.
19
+ */
20
+ declare class TangoBody {
21
+ static readonly BRAND: "tango.http.body";
22
+ readonly __tangoBrand: typeof TangoBody.BRAND;
23
+ private bodySourceInternal;
24
+ private bodyUsedInternal;
25
+ private headers?;
26
+ constructor(bodySource: TangoBodySource, headers?: HeadersLike);
27
+ /**
28
+ * Narrow an unknown value to `TangoBody`.
29
+ */
30
+ static isTangoBody(value: unknown): value is TangoBody;
31
+ /**
32
+ * Expose the original body source for cloning and adapter integration.
33
+ */
34
+ get bodySource(): TangoBodySource;
35
+ /**
36
+ * Report whether a reader method has already consumed this body.
37
+ */
38
+ get bodyUsed(): boolean;
39
+ /**
40
+ * Describe the current body shape in a way that is useful for diagnostics.
41
+ */
42
+ get bodyType(): string;
43
+ /**
44
+ * Returns true if value is a valid JSON value (recursively).
45
+ */
46
+ static isJsonValue(v: unknown): v is JsonValue;
47
+ /**
48
+ * Deep clone utility for body values. Preserves types and values as in the legacy implementation.
49
+ * If the source is a stream, the stream will be cloned if readable, otherwise throws.
50
+ */
51
+ static deepCloneBody(body: TangoBodySource): TangoBodySource;
52
+ /**
53
+ * Read a `ReadableStream` into an `ArrayBuffer`.
54
+ */
55
+ static readStreamToArrayBuffer(stream: ReadableStream<Uint8Array>): Promise<ArrayBuffer>;
56
+ /**
57
+ * Read a `ReadableStream` into a `Uint8Array`.
58
+ */
59
+ static readStreamToUint8Array(stream: ReadableStream<Uint8Array>): Promise<Uint8Array<ArrayBuffer>>;
60
+ /**
61
+ * Read a `ReadableStream` into UTF-8 text.
62
+ */
63
+ static readStreamToText(stream: ReadableStream<Uint8Array>): Promise<string>;
64
+ /**
65
+ * Determine the content type for this body, if possible.
66
+ * Respects an explicitly passed header, otherwise infers from value type.
67
+ */
68
+ static detectContentType(body: TangoBodySource, providedType?: string): string | undefined;
69
+ /**
70
+ * Attempt to determine the content length, in bytes, for this body.
71
+ * Only available for certain body types, otherwise returns undefined.
72
+ */
73
+ static getContentLength(body: TangoBodySource): Promise<number | undefined>;
74
+ /**
75
+ * Reads the body as an ArrayBuffer.
76
+ */
77
+ arrayBuffer(): Promise<ArrayBuffer>;
78
+ /**
79
+ * Reads the body as a Blob (browser only).
80
+ */
81
+ blob(): Promise<Blob>;
82
+ /**
83
+ * Reads the body as a Uint8Array.
84
+ */
85
+ bytes(): Promise<Uint8Array<ArrayBuffer>>;
86
+ /**
87
+ * Reads the body as FormData.
88
+ * Accepts FormData, or if type is urlencoded or multipart parses a string/bytes.
89
+ */
90
+ formData(): Promise<FormData>;
91
+ /**
92
+ * Reads and parses the body as JSON (if possible).
93
+ */
94
+ json<T = unknown>(): Promise<T>;
95
+ /**
96
+ * Reads the body as UTF-8 string.
97
+ */
98
+ text(): Promise<string>;
99
+ /**
100
+ * Returns the original body value (may be used for streaming or clone).
101
+ */
102
+ getRawBodyInit(): TangoBodySource;
103
+ /**
104
+ * Clone the body instance and stream if possible.
105
+ * If the source is a stream, the stream will be cloned if readable, otherwise throws.
106
+ */
107
+ clone(): TangoBody;
108
+ /**
109
+ * Helper for all readers. Only allows reading once.
110
+ */
111
+ private consumeBody;
112
+ }
113
+ //#endregion
114
+ //#region src/http/TangoHeaders.d.ts
115
+ /**
116
+ * TangoHeaders extends the Web Headers class, adding ergonomic helpers
117
+ * for common HTTP header patterns, convenience features, and a consistent API for
118
+ * setting, appending, and deleting headers and cookies. This is designed to be
119
+ * used by TangoResponse and other Tango HTTP utilities.
120
+ * Additionally, provides helpers for safely setting Content-Length based on a known body,
121
+ * and setting Content-Disposition for inline or attachment filenames.
122
+ *
123
+ * Includes helpers for request tracing and correlation headers:
124
+ * - X-Request-Id
125
+ * - traceparent (W3C Trace Context)
126
+ * - Server-Timing
127
+ * - X-Response-Time
128
+ */
129
+ declare class TangoHeaders extends Headers {
130
+ static readonly BRAND: "tango.http.headers";
131
+ readonly __tangoBrand: typeof TangoHeaders.BRAND;
132
+ /**
133
+ * Narrow an unknown value to `TangoHeaders`.
134
+ */
135
+ static isTangoHeaders(value: unknown): value is TangoHeaders;
136
+ /**
137
+ * Serialize a cookie for the Set-Cookie header line.
138
+ */
139
+ private static serializeCookie;
140
+ private static hasNumberSize;
141
+ private static hasNumberLength;
142
+ private static isNodeBuffer;
143
+ /**
144
+ * Sets the Content-Disposition header with type "inline" and the specified filename.
145
+ * This is useful to indicate that the content should be displayed inline in the browser,
146
+ * but with a suggested filename for saving.
147
+ *
148
+ * @param filename The filename to include in the Content-Disposition header.
149
+ */
150
+ setContentDispositionInline(filename: string): void;
151
+ /**
152
+ * Sets the Content-Disposition header with type "attachment" and the specified filename.
153
+ * This is useful to indicate that the response should be downloaded as a file.
154
+ *
155
+ * @param filename The filename to include in the Content-Disposition header.
156
+ */
157
+ setContentDispositionAttachment(filename: string): void;
158
+ /**
159
+ * Create a copy that preserves all header names and values.
160
+ */
161
+ clone(): TangoHeaders;
162
+ /**
163
+ * Set a header, replacing the existing value.
164
+ */
165
+ setHeader(name: string, value: string): void;
166
+ /**
167
+ * Append a header, adding to existing value(s) for the name.
168
+ */
169
+ appendHeader(name: string, value: string): void;
170
+ /**
171
+ * Get a header value (first value if header is repeated).
172
+ */
173
+ getHeader(name: string): string | null;
174
+ /**
175
+ * Check if a header exists.
176
+ */
177
+ hasHeader(name: string): boolean;
178
+ /**
179
+ * Delete a header.
180
+ */
181
+ deleteHeader(name: string): void;
182
+ /**
183
+ * Ensure a header is present only once and fully replaces the old value.
184
+ */
185
+ ensureUnique(name: string, value: string): void;
186
+ /**
187
+ * Add a field (or fields) to the Vary header, merging with existing values.
188
+ */
189
+ vary(...fields: string[]): void;
190
+ /**
191
+ * Set a cookie header (for Set-Cookie).
192
+ * @param name
193
+ * @param value
194
+ * @param options
195
+ */
196
+ setCookie(name: string, value: string, options?: {
197
+ domain?: string;
198
+ expires?: Date;
199
+ httpOnly?: boolean;
200
+ maxAge?: number;
201
+ path?: string;
202
+ sameSite?: 'Strict' | 'Lax' | 'None';
203
+ secure?: boolean;
204
+ priority?: 'Low' | 'Medium' | 'High';
205
+ partitioned?: boolean;
206
+ }): void;
207
+ /**
208
+ * Append (additionally) a new cookie.
209
+ */
210
+ appendCookie(name: string, value: string, options?: {
211
+ domain?: string;
212
+ expires?: Date;
213
+ httpOnly?: boolean;
214
+ maxAge?: number;
215
+ path?: string;
216
+ sameSite?: 'Strict' | 'Lax' | 'None';
217
+ secure?: boolean;
218
+ priority?: 'Low' | 'Medium' | 'High';
219
+ partitioned?: boolean;
220
+ }): void;
221
+ /**
222
+ * Delete a cookie ("unset" it via expired date).
223
+ */
224
+ deleteCookie(name: string, options?: {
225
+ domain?: string;
226
+ path?: string;
227
+ sameSite?: 'Strict' | 'Lax' | 'None';
228
+ secure?: boolean;
229
+ priority?: 'Low' | 'Medium' | 'High';
230
+ partitioned?: boolean;
231
+ }): void;
232
+ /**
233
+ * Add or override Cache-Control header with helpers for common policies.
234
+ */
235
+ cacheControl(control: string | Record<string, string | number | boolean | undefined>): void;
236
+ /**
237
+ * Set the Location header.
238
+ */
239
+ location(url: string): void;
240
+ /**
241
+ * Set the Content-Type header.
242
+ */
243
+ contentType(mime: string): void;
244
+ /**
245
+ * Attempt to guess and set the Content-Type header from a file (string or Blob) and optional filename.
246
+ *
247
+ * @param file File-like input (string or Blob)
248
+ * @param filename Optional filename to help guess mime type by extension
249
+ */
250
+ setContentTypeByFile(file: unknown, filename?: string): void;
251
+ /**
252
+ * Sets the Content-Length header, inferring it from the body if not explicitly provided.
253
+ * If the body is a string, ArrayBuffer, Uint8Array, Blob/Buffer (or has a .size or .length property),
254
+ * the length is computed. For unsupported types, does nothing.
255
+ * Mirrors logic from TangoResponse.ts, but generalized for use anywhere.
256
+ */
257
+ setContentLengthFromBody(body: unknown): void;
258
+ /**
259
+ * Set or update the X-Request-Id header. Used for associating a request/response with a unique id.
260
+ * @param id The request id value to set.
261
+ */
262
+ withRequestId(id: string): this;
263
+ /**
264
+ * Set or update the traceparent header. Used for distributed trace context propagation (W3C Trace Context).
265
+ * @param value The traceparent value (should be a valid traceparent header value).
266
+ */
267
+ withTraceParent(value: string): this;
268
+ /**
269
+ * Set or append a value to the Server-Timing header.
270
+ * For a single metric, supply name, and optionally dur and desc.
271
+ * For advanced usage (many metrics), set the value directly or use appendServerTimingRaw.
272
+ *
273
+ * @param name Name of the server-timing metric (e.g., 'total', 'db').
274
+ * @param dur Optional duration in ms.
275
+ * @param desc Optional string description.
276
+ */
277
+ withServerTiming(name: string, dur?: number, desc?: string): this;
278
+ /**
279
+ * Directly append a raw Server-Timing metric value.
280
+ * This is useful for advanced cases where you have multiple metrics assembled.
281
+ * @param value The server-timing value chunk to append.
282
+ */
283
+ appendServerTimingRaw(value: string): this;
284
+ /**
285
+ * Set or update X-Response-Time header.
286
+ * @param ms Elapsed time in milliseconds (number or string for flexibility).
287
+ */
288
+ withResponseTime(ms: number | string): this;
289
+ /**
290
+ * Return the current value of X-Request-Id.
291
+ */
292
+ getRequestId(): string | null;
293
+ /**
294
+ * Return the current value of traceparent header.
295
+ */
296
+ getTraceParent(): string | null;
297
+ /**
298
+ * Return the current Server-Timing string, if set.
299
+ */
300
+ getServerTiming(): string | null;
301
+ /**
302
+ * Return the current X-Response-Time string, if set.
303
+ */
304
+ getResponseTime(): string | null;
305
+ }
306
+ //#endregion
307
+ //#region src/http/TangoRequest.d.ts
308
+ type TangoRequestInit = {
309
+ method?: string;
310
+ headers?: HeadersInit;
311
+ body?: BodyInit | JsonValue | null;
312
+ redirect?: RequestRedirect;
313
+ cache?: RequestCache;
314
+ credentials?: RequestCredentials;
315
+ integrity?: string;
316
+ keepalive?: boolean;
317
+ mode?: RequestMode;
318
+ referrer?: string;
319
+ referrerPolicy?: ReferrerPolicy;
320
+ signal?: AbortSignal;
321
+ };
322
+ /**
323
+ * Framework request wrapper that normalizes JSON-like bodies and preserves
324
+ * fetch `Request` compatibility for downstream handlers.
325
+ */
326
+ declare class TangoRequest implements Request {
327
+ static readonly BRAND: "tango.http.request";
328
+ readonly __tangoBrand: typeof TangoRequest.BRAND;
329
+ private request;
330
+ private bodySourceValue;
331
+ private queryParamsValue?;
332
+ constructor(input: string | Request, init?: TangoRequestInit);
333
+ /**
334
+ * Narrow an unknown value to `TangoRequest`.
335
+ */
336
+ static isTangoRequest(value: unknown): value is TangoRequest;
337
+ /**
338
+ * Expose the request cache mode from the underlying fetch request.
339
+ */
340
+ get cache(): RequestCache;
341
+ /**
342
+ * Expose the request credentials mode from the underlying fetch request.
343
+ */
344
+ get credentials(): RequestCredentials;
345
+ /**
346
+ * Expose the request destination from the underlying fetch request.
347
+ */
348
+ get destination(): RequestDestination;
349
+ /**
350
+ * Expose the request headers from the underlying fetch request.
351
+ */
352
+ get headers(): Headers;
353
+ /**
354
+ * Expose the request integrity value from the underlying fetch request.
355
+ */
356
+ get integrity(): string;
357
+ /**
358
+ * Expose the request keepalive flag from the underlying fetch request.
359
+ */
360
+ get keepalive(): boolean;
361
+ /**
362
+ * Expose the normalized HTTP method.
363
+ */
364
+ get method(): string;
365
+ /**
366
+ * Expose the request mode from the underlying fetch request.
367
+ */
368
+ get mode(): RequestMode;
369
+ /**
370
+ * Expose the redirect policy from the underlying fetch request.
371
+ */
372
+ get redirect(): RequestRedirect;
373
+ /**
374
+ * Expose the referrer from the underlying fetch request.
375
+ */
376
+ get referrer(): string;
377
+ /**
378
+ * Expose the referrer policy from the underlying fetch request.
379
+ */
380
+ get referrerPolicy(): ReferrerPolicy;
381
+ /**
382
+ * Expose the abort signal from the underlying fetch request.
383
+ */
384
+ get signal(): AbortSignal;
385
+ /**
386
+ * Expose the absolute request URL.
387
+ */
388
+ get url(): string;
389
+ /**
390
+ * Expose the readable request body stream when one exists.
391
+ */
392
+ get body(): Request['body'];
393
+ /**
394
+ * Report whether the body has been consumed.
395
+ */
396
+ get bodyUsed(): boolean;
397
+ /**
398
+ * Expose the pre-normalized body value used to build the request.
399
+ */
400
+ get bodySource(): BodyInit | JsonValue | null;
401
+ /**
402
+ * Expose normalized query parameters derived from the request URL.
403
+ */
404
+ get queryParams(): TangoQueryParams;
405
+ /**
406
+ * Read the request body as an array buffer.
407
+ */
408
+ arrayBuffer(): Promise<ArrayBuffer>;
409
+ /**
410
+ * Read the request body as a blob.
411
+ */
412
+ blob(): Promise<Blob>;
413
+ /**
414
+ * Read the request body as bytes, including runtimes without `Request.bytes()`.
415
+ */
416
+ bytes(): Promise<Uint8Array<ArrayBuffer>>;
417
+ /**
418
+ * Read the request body as form data.
419
+ */
420
+ formData(): Promise<FormData>;
421
+ /**
422
+ * Parse the request body as JSON.
423
+ */
424
+ json<T = unknown>(): Promise<T>;
425
+ /**
426
+ * Read the request body as text.
427
+ */
428
+ text(): Promise<string>;
429
+ /**
430
+ * Clone the request so downstream code can consume it independently.
431
+ */
432
+ clone(): TangoRequest;
433
+ private normalizeBody;
434
+ }
435
+ //#endregion
436
+ //#region src/http/TangoQueryParams.d.ts
437
+ type QueryParamRecord = Record<string, string | string[] | undefined>;
438
+ type QueryParamMutationValue = string | number | readonly (string | number)[] | null | undefined;
439
+ type QueryParamMutationRecord = Record<string, QueryParamMutationValue>;
440
+ /**
441
+ * Immutable query parameter helper that normalizes framework-specific shapes
442
+ * into one Tango-owned API.
443
+ */
444
+ declare class TangoQueryParams {
445
+ static readonly BRAND: "tango.http.query_params";
446
+ readonly __tangoBrand: typeof TangoQueryParams.BRAND;
447
+ private readonly values;
448
+ private constructor();
449
+ /**
450
+ * Narrow an unknown value to `TangoQueryParams`.
451
+ */
452
+ static isTangoQueryParams(value: unknown): value is TangoQueryParams;
453
+ /**
454
+ * Build query params from a `URLSearchParams` instance.
455
+ */
456
+ static fromURLSearchParams(params: URLSearchParams): TangoQueryParams;
457
+ /**
458
+ * Build query params from framework record-style search params.
459
+ */
460
+ static fromRecord(params: QueryParamRecord): TangoQueryParams;
461
+ /**
462
+ * Build query params from a full URL string or URL object.
463
+ */
464
+ static fromURL(input: string | URL): TangoQueryParams;
465
+ /**
466
+ * Build query params from a request-like object with a URL.
467
+ */
468
+ static fromRequest(request: Request | TangoRequest): TangoQueryParams;
469
+ /**
470
+ * Get the first value for a query param.
471
+ */
472
+ get(name: string): string | undefined;
473
+ /**
474
+ * Get all values for a query param.
475
+ */
476
+ getAll(name: string): string[];
477
+ /**
478
+ * Check whether a query param exists.
479
+ */
480
+ has(name: string): boolean;
481
+ /**
482
+ * Iterate key -> values entries.
483
+ */
484
+ entries(): IterableIterator<[string, string[]]>;
485
+ /**
486
+ * Iterate keys present in the query params.
487
+ */
488
+ keys(): IterableIterator<string>;
489
+ /**
490
+ * Convert back to a native `URLSearchParams` object.
491
+ */
492
+ toURLSearchParams(): URLSearchParams;
493
+ /**
494
+ * Return a new query param set with selected keys replaced or removed.
495
+ *
496
+ * `undefined`, `null`, and empty arrays remove the key entirely.
497
+ */
498
+ withValues(updates: QueryParamMutationRecord): TangoQueryParams;
499
+ /**
500
+ * Convert to a relative query string suitable for links.
501
+ */
502
+ toRelativeURL(): string;
503
+ /**
504
+ * Get a trimmed value, omitting blank strings.
505
+ */
506
+ getTrimmed(name: string): string | undefined;
507
+ /**
508
+ * Get the free-text search param using Tango's default key.
509
+ */
510
+ getSearch(key?: string): string | undefined;
511
+ /**
512
+ * Get the ordering param as trimmed field tokens.
513
+ */
514
+ getOrdering(key?: string): string[];
515
+ }
516
+ //#endregion
517
+ //#region src/http/TangoResponse.d.ts
518
+ type TangoResponseInit = {
519
+ body?: BodyInit | JsonValue | null;
520
+ headers?: HeadersInit;
521
+ ok?: boolean;
522
+ redirected?: boolean;
523
+ status?: number;
524
+ statusText?: string;
525
+ type?: ResponseType;
526
+ url?: string;
527
+ };
528
+ /**
529
+ * Framework response wrapper with fetch-compatible surface plus ergonomic helpers.
530
+ */
531
+ declare class TangoResponse implements Response {
532
+ static readonly BRAND: "tango.http.response";
533
+ readonly __tangoBrand: typeof TangoResponse.BRAND;
534
+ readonly headers: TangoHeaders;
535
+ readonly redirected: boolean;
536
+ readonly status: number;
537
+ readonly statusText: string;
538
+ readonly type: ResponseType;
539
+ readonly url: string;
540
+ readonly body: Response['body'];
541
+ private tangoBody;
542
+ private okValue;
543
+ constructor(init?: TangoResponseInit);
544
+ /**
545
+ * Narrow an unknown value to `TangoResponse`.
546
+ */
547
+ static isTangoResponse(value: unknown): value is TangoResponse;
548
+ /**
549
+ * Create a JSON response with sensible content headers.
550
+ */
551
+ static json(data: JsonValue, init?: Omit<TangoResponseInit, 'body' | 'headers'> & {
552
+ headers?: HeadersInit;
553
+ }): TangoResponse;
554
+ /**
555
+ * Create a plain-text response with sensible content headers.
556
+ */
557
+ static text(text: string, init?: Omit<TangoResponseInit, 'body' | 'headers'> & {
558
+ headers?: HeadersInit;
559
+ }): TangoResponse;
560
+ /**
561
+ * Create an HTML response with sensible content headers.
562
+ */
563
+ static html(html: string, init?: Omit<TangoResponseInit, 'body' | 'headers'> & {
564
+ headers?: HeadersInit;
565
+ }): TangoResponse;
566
+ /**
567
+ * Create a streaming response without buffering the payload in memory.
568
+ */
569
+ static stream(stream: ReadableStream<Uint8Array>, init?: Omit<TangoResponseInit, 'body' | 'headers'> & {
570
+ headers?: HeadersInit;
571
+ }): TangoResponse;
572
+ /**
573
+ * Create a redirect response and set the `Location` header.
574
+ */
575
+ static redirect(url: string, status?: number, init?: Omit<TangoResponseInit, 'body' | 'headers' | 'status'> & {
576
+ headers?: HeadersInit;
577
+ }): TangoResponse;
578
+ /**
579
+ * Create an empty `204 No Content` response.
580
+ */
581
+ static noContent(init?: Omit<TangoResponseInit, 'body' | 'status' | 'headers'> & {
582
+ headers?: HeadersInit;
583
+ }): TangoResponse;
584
+ /**
585
+ * Create a `201 Created` response and optionally attach a location or body.
586
+ */
587
+ static created(location?: string, body?: JsonValue, init?: Omit<TangoResponseInit, 'body' | 'status' | 'headers'> & {
588
+ headers?: HeadersInit;
589
+ }): TangoResponse;
590
+ /**
591
+ * Create a `405 Method Not Allowed` response and optionally populate `Allow`.
592
+ */
593
+ static methodNotAllowed(allow?: readonly string[], detail?: string, init?: Omit<TangoResponseInit, 'body' | 'status' | 'headers'> & {
594
+ headers?: HeadersInit;
595
+ }): TangoResponse;
596
+ /**
597
+ * Normalize a Tango error or problem-details object into an error response.
598
+ */
599
+ static error<TDetails extends ErrorDetails = null>(error: TangoError | ProblemDetails<TDetails>, init?: Omit<TangoResponseInit, 'body' | 'headers'> & {
600
+ headers?: HeadersInit;
601
+ }): TangoResponse;
602
+ /**
603
+ * Create a `400 Bad Request` response from a string or structured error.
604
+ */
605
+ static badRequest<TDetails extends ErrorDetails = null>(detail?: string | TangoError | ProblemDetails<TDetails>, init?: Omit<TangoResponseInit, 'body' | 'status' | 'headers'> & {
606
+ headers?: HeadersInit;
607
+ }): TangoResponse;
608
+ /**
609
+ * Create a `401 Unauthorized` response from a string or structured error.
610
+ */
611
+ static unauthorized<TDetails extends ErrorDetails = null>(detail?: string | TangoError | ProblemDetails<TDetails>, init?: Omit<TangoResponseInit, 'body' | 'status' | 'headers'> & {
612
+ headers?: HeadersInit;
613
+ }): TangoResponse;
614
+ /**
615
+ * Create a `403 Forbidden` response from a string or structured error.
616
+ */
617
+ static forbidden<TDetails extends ErrorDetails = null>(detail?: string | TangoError | ProblemDetails<TDetails>, init?: Omit<TangoResponseInit, 'body' | 'status' | 'headers'> & {
618
+ headers?: HeadersInit;
619
+ }): TangoResponse;
620
+ /**
621
+ * Create a `404 Not Found` response from a string or structured error.
622
+ */
623
+ static notFound<TDetails extends ErrorDetails = null>(detail?: string | TangoError | ProblemDetails<TDetails>, init?: Omit<TangoResponseInit, 'body' | 'status' | 'headers'> & {
624
+ headers?: HeadersInit;
625
+ }): TangoResponse;
626
+ /**
627
+ * Create a `409 Conflict` response from a string or structured error.
628
+ */
629
+ static conflict<TDetails extends ErrorDetails = null>(detail?: string | TangoError | ProblemDetails<TDetails>, init?: Omit<TangoResponseInit, 'body' | 'status' | 'headers'> & {
630
+ headers?: HeadersInit;
631
+ }): TangoResponse;
632
+ /**
633
+ * Create a `422 Unprocessable Entity` response from a string or structured error.
634
+ */
635
+ static unprocessableEntity<TDetails extends ErrorDetails = null>(detail?: string | TangoError | ProblemDetails<TDetails>, init?: Omit<TangoResponseInit, 'body' | 'status' | 'headers'> & {
636
+ headers?: HeadersInit;
637
+ }): TangoResponse;
638
+ /**
639
+ * Create a `429 Too Many Requests` response from a string or structured error.
640
+ */
641
+ static tooManyRequests<TDetails extends ErrorDetails = null>(detail?: string | TangoError | ProblemDetails<TDetails>, init?: Omit<TangoResponseInit, 'body' | 'status' | 'headers'> & {
642
+ headers?: HeadersInit;
643
+ }): TangoResponse;
644
+ /**
645
+ * Create a problem-details style error response with Tango's envelope shape.
646
+ */
647
+ static problem<TDetails extends ErrorDetails = null>(problem?: string | TangoError | ProblemDetails<TDetails> | unknown, init?: Omit<TangoResponseInit, 'body' | 'headers'> & {
648
+ headers?: HeadersInit;
649
+ status?: number;
650
+ }): TangoResponse;
651
+ /**
652
+ * Returns a response for serving a file.
653
+ */
654
+ static file(file: Blob | Uint8Array | ArrayBuffer | ReadableStream<Uint8Array> | string, opts?: {
655
+ filename?: string;
656
+ contentType?: string;
657
+ init?: Omit<TangoResponseInit, 'body' | 'headers'> & {
658
+ headers?: HeadersInit;
659
+ };
660
+ }): TangoResponse;
661
+ /**
662
+ * Returns a response that prompts the user to download the file.
663
+ */
664
+ static download(file: Blob | Uint8Array | ArrayBuffer | ReadableStream<Uint8Array> | string, opts?: {
665
+ filename?: string;
666
+ contentType?: string;
667
+ init?: Omit<TangoResponseInit, 'body' | 'headers'> & {
668
+ headers?: HeadersInit;
669
+ };
670
+ }): TangoResponse;
671
+ private static normalizeWebBody;
672
+ /**
673
+ * Expose the original body source for cloning and adapter integration.
674
+ */
675
+ get bodySource(): BodyInit | JsonValue | null;
676
+ /**
677
+ * Report whether the status code falls inside the 2xx range.
678
+ */
679
+ get ok(): boolean;
680
+ /**
681
+ * Report whether the body has been consumed.
682
+ */
683
+ get bodyUsed(): boolean;
684
+ /**
685
+ * Replace a header value on the response.
686
+ */
687
+ setHeader(name: string, value: string): void;
688
+ /**
689
+ * Append another value for a repeated response header.
690
+ */
691
+ appendHeader(name: string, value: string): void;
692
+ /**
693
+ * Read a response header value.
694
+ */
695
+ getHeader(name: string): string | null;
696
+ /**
697
+ * Check whether a response header is present.
698
+ */
699
+ hasHeader(name: string): boolean;
700
+ /**
701
+ * Remove a response header.
702
+ */
703
+ deleteHeader(name: string): void;
704
+ /**
705
+ * Merge one or more values into the `Vary` header.
706
+ */
707
+ vary(...fields: string[]): void;
708
+ /**
709
+ * Add a `Set-Cookie` header that replaces prior application intent.
710
+ */
711
+ setCookie(name: string, value: string, options?: Parameters<TangoHeaders['setCookie']>[2]): void;
712
+ /**
713
+ * Append another `Set-Cookie` header.
714
+ */
715
+ appendCookie(name: string, value: string, options?: Parameters<TangoHeaders['appendCookie']>[2]): void;
716
+ /**
717
+ * Expire a cookie by issuing a matching deletion cookie header.
718
+ */
719
+ deleteCookie(name: string, options?: Parameters<TangoHeaders['deleteCookie']>[1]): void;
720
+ /**
721
+ * Set the `Cache-Control` header through Tango's higher-level helper.
722
+ */
723
+ cacheControl(control: Parameters<TangoHeaders['cacheControl']>[0]): void;
724
+ /**
725
+ * Set the `Location` header on the response.
726
+ */
727
+ location(url: string): void;
728
+ /**
729
+ * Set the response content type.
730
+ */
731
+ contentType(mime: string): void;
732
+ /**
733
+ * Set the X-Request-Id header (request correlation).
734
+ * Returns this for fluent chaining.
735
+ */
736
+ withRequestId(requestId: string | undefined | null): this;
737
+ /**
738
+ * Set the traceparent header (W3C Trace Context propagation).
739
+ * Returns this for fluent chaining.
740
+ */
741
+ withTraceparent(traceparent: string | undefined | null): this;
742
+ /**
743
+ * Set the Server-Timing header.
744
+ * Accepts a string or array of timing metrics.
745
+ * Returns this for fluent chaining.
746
+ */
747
+ withServerTiming(timing: string | string[]): this;
748
+ /**
749
+ * Set the X-Response-Time header (in ms).
750
+ * Numeric or formatted string (e.g. "76ms").
751
+ * Returns this for fluent chaining.
752
+ */
753
+ withResponseTime(time: number | string): this;
754
+ /**
755
+ * Propagate common tracing/correlation headers from provided Headers, TangoHeaders, or plain object.
756
+ * Known headers: x-request-id, traceparent, server-timing
757
+ * Returns this for fluent chaining.
758
+ */
759
+ propagateTraceHeaders(input: HeadersInit): this;
760
+ /**
761
+ * Clone the response so its body can be consumed independently.
762
+ */
763
+ clone(): TangoResponse;
764
+ /**
765
+ * Convert this Tango-owned response into a native web `Response`.
766
+ *
767
+ * Adapters use this at the host-framework boundary so Tango can standardize
768
+ * on `TangoResponse` internally while Next.js and other hosts still receive
769
+ * a platform-native response object.
770
+ */
771
+ toWebResponse(): Response;
772
+ /**
773
+ * Read the response body as an array buffer.
774
+ */
775
+ arrayBuffer(): Promise<ArrayBuffer>;
776
+ /**
777
+ * Read the response body as a blob.
778
+ */
779
+ blob(): Promise<Blob>;
780
+ /**
781
+ * Read the response body as bytes.
782
+ */
783
+ bytes(): Promise<Uint8Array<ArrayBuffer>>;
784
+ /**
785
+ * Read the response body as form data.
786
+ */
787
+ formData(): Promise<FormData>;
788
+ /**
789
+ * Parse the response body as JSON.
790
+ */
791
+ json<T = unknown>(): Promise<T>;
792
+ /**
793
+ * Read the response body as text.
794
+ */
795
+ text(): Promise<string>;
796
+ /**
797
+ * Returns a plain object debug representation of this response: { status, headers: { ... }, bodyType: ... }.
798
+ * Intended for testing and debug tooling.
799
+ */
800
+ toJSON(): {
801
+ status: number;
802
+ headers: Record<string, string>;
803
+ bodyType: string;
804
+ };
805
+ /**
806
+ * Returns the original body for test/debug purposes *without* consuming the stream.
807
+ *
808
+ * @throws {Error} if called in a production environment. Provided only for test or debug.
809
+ * @remarks
810
+ * This method gives direct access to the original body as provided to the constructor,
811
+ * before consumption. It is primarily intended for use in test code, introspection, or
812
+ * advanced debug tools. **Do not rely on this in production.**
813
+ * In production (`process.env.NODE_ENV === 'production'`), using this method will throw.
814
+ *
815
+ * This method is _not_ part of the web Response interface, and is intentionally private/internal.
816
+ */
817
+ __peekBodyForTestOnly(): BodyInit | JsonValue | null;
818
+ }
819
+ declare namespace index_d_exports {
820
+ export { JsonValue, TangoBody, TangoHeaders, TangoQueryParams, TangoRequest, TangoResponse };
821
+ }
822
+ //#endregion
823
+ export { TangoHeaders as a, TangoRequest as i, TangoResponse as n, JsonValue as o, TangoQueryParams as r, TangoBody as s, index_d_exports as t };
824
+ //# sourceMappingURL=index-D8o4DOOG.d.ts.map