@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
@@ -1,8 +1,10 @@
1
- import { __export } from "./chunk-BkvOhyD0.js";
2
- import { TangoError } from "./TangoError-DdQVQNZU.js";
3
- import { isArrayBuffer, isBlob, isFile, isFormData, isNil, isReadableStream, isURLSearchParams, isUint8Array } from "./runtime-B8KkgD3R.js";
4
-
1
+ import { t as __exportAll } from "./chunk-D7D4PA-g.js";
2
+ import { t as TangoError } from "./TangoError-Cvgnm026.js";
3
+ import { _ as isNil, d as isURLSearchParams, f as isFormData, g as isArrayBuffer, h as isUint8Array, l as isFile, m as isBlob, u as isReadableStream } from "./runtime-BAG_EKuM.js";
5
4
  //#region src/http/TangoBody.ts
5
+ /**
6
+ * Unified body reader/clone utility for Tango request/response wrappers.
7
+ */
6
8
  var TangoBody = class TangoBody {
7
9
  static BRAND = "tango.http.body";
8
10
  __tangoBrand = TangoBody.BRAND;
@@ -123,17 +125,16 @@ var TangoBody = class TangoBody {
123
125
  */
124
126
  static detectContentType(body, providedType) {
125
127
  if (providedType) return providedType;
126
- if (isNil(body)) return undefined;
128
+ if (isNil(body)) return void 0;
127
129
  if (typeof body === "string") return "text/plain; charset=utf-8";
128
130
  if (isArrayBuffer(body) || isUint8Array(body)) return "application/octet-stream";
129
131
  if (isBlob(body)) {
130
132
  if (body.type) return body.type;
131
133
  return "application/octet-stream";
132
134
  }
133
- if (isFormData(body)) return undefined;
135
+ if (isFormData(body)) return void 0;
134
136
  if (typeof body === "object" && TangoBody.isJsonValue(body)) return "application/json; charset=utf-8";
135
- if (isReadableStream(body)) return undefined;
136
- return undefined;
137
+ if (isReadableStream(body)) return void 0;
137
138
  }
138
139
  /**
139
140
  * Attempt to determine the content length, in bytes, for this body.
@@ -146,7 +147,6 @@ var TangoBody = class TangoBody {
146
147
  if (isArrayBuffer(body)) return body.byteLength;
147
148
  if (isBlob(body)) return body.size;
148
149
  if (TangoBody.isJsonValue(body)) return new TextEncoder().encode(JSON.stringify(body)).length;
149
- return undefined;
150
150
  }
151
151
  /**
152
152
  * Reads the body as an ArrayBuffer.
@@ -204,20 +204,19 @@ var TangoBody = class TangoBody {
204
204
  async formData() {
205
205
  return this.consumeBody(async (input) => {
206
206
  if (isFormData(input)) return input;
207
- let contentType = undefined;
207
+ let contentType = void 0;
208
208
  if (this.headers && typeof this.headers.get === "function") {
209
- const raw$1 = this.headers.get("Content-Type");
210
- if (typeof raw$1 === "string") contentType = raw$1.toLowerCase();
209
+ const raw = this.headers.get("Content-Type");
210
+ if (typeof raw === "string") contentType = raw.toLowerCase();
211
211
  }
212
212
  let raw;
213
213
  if (typeof input === "string") raw = input;
214
- else if (isArrayBuffer(input)) raw = new TextDecoder().decode(input);
215
- else if (isUint8Array(input)) raw = new TextDecoder().decode(input);
216
- else throw new TypeError("Body is not valid for FormData");
214
+ else if (isArrayBuffer(input)) raw = new TextDecoder().decode(input);
215
+ else if (isUint8Array(input)) raw = new TextDecoder().decode(input);
216
+ else throw new TypeError("Body is not valid for FormData");
217
217
  if (contentType && contentType.includes("application/x-www-form-urlencoded")) {
218
218
  const form = new FormData();
219
- const params = new URLSearchParams(raw);
220
- params.forEach((value, key) => form.append(key, value));
219
+ new URLSearchParams(raw).forEach((value, key) => form.append(key, value));
221
220
  return form;
222
221
  }
223
222
  if (contentType && contentType.startsWith("multipart/form-data")) {
@@ -291,8 +290,7 @@ else throw new TypeError("Body is not valid for FormData");
291
290
  this.bodySourceInternal = streamForOriginal;
292
291
  return new TangoBody(streamForClone, this.headers);
293
292
  }
294
- const cloneSource = TangoBody.deepCloneBody(this.bodySourceInternal);
295
- return new TangoBody(cloneSource, this.headers);
293
+ return new TangoBody(TangoBody.deepCloneBody(this.bodySourceInternal), this.headers);
296
294
  }
297
295
  /**
298
296
  * Helper for all readers. Only allows reading once.
@@ -303,9 +301,22 @@ else throw new TypeError("Body is not valid for FormData");
303
301
  return parser(this.bodySourceInternal);
304
302
  }
305
303
  };
306
-
307
304
  //#endregion
308
305
  //#region src/http/TangoHeaders.ts
306
+ /**
307
+ * TangoHeaders extends the Web Headers class, adding ergonomic helpers
308
+ * for common HTTP header patterns, convenience features, and a consistent API for
309
+ * setting, appending, and deleting headers and cookies. This is designed to be
310
+ * used by TangoResponse and other Tango HTTP utilities.
311
+ * Additionally, provides helpers for safely setting Content-Length based on a known body,
312
+ * and setting Content-Disposition for inline or attachment filenames.
313
+ *
314
+ * Includes helpers for request tracing and correlation headers:
315
+ * - X-Request-Id
316
+ * - traceparent (W3C Trace Context)
317
+ * - Server-Timing
318
+ * - X-Response-Time
319
+ */
309
320
  var TangoHeaders = class TangoHeaders extends Headers {
310
321
  static BRAND = "tango.http.headers";
311
322
  __tangoBrand = TangoHeaders.BRAND;
@@ -322,7 +333,7 @@ var TangoHeaders = class TangoHeaders extends Headers {
322
333
  let cookie = encodeURIComponent(name) + "=" + encodeURIComponent(value ?? "");
323
334
  if (options.domain) cookie += `; Domain=${options.domain}`;
324
335
  if (options.path) cookie += `; Path=${options.path}`;
325
- else cookie += "; Path=/";
336
+ else cookie += "; Path=/";
326
337
  if (options.expires) cookie += `; Expires=${options.expires.toUTCString()}`;
327
338
  if (typeof options.maxAge === "number") cookie += `; Max-Age=${options.maxAge}`;
328
339
  if (options.secure) cookie += "; Secure";
@@ -415,7 +426,7 @@ else cookie += "; Path=/";
415
426
  if (fields.length === 0) return;
416
427
  const key = "Vary";
417
428
  const prev = this.get(key);
418
- const nextSet = new Set();
429
+ const nextSet = /* @__PURE__ */ new Set();
419
430
  if (prev) {
420
431
  for (const v of prev.split(",")) if (v.trim()) nextSet.add(v.trim());
421
432
  }
@@ -443,7 +454,7 @@ else cookie += "; Path=/";
443
454
  deleteCookie(name, options) {
444
455
  this.setCookie(name, "", {
445
456
  ...options,
446
- expires: new Date(0),
457
+ expires: /* @__PURE__ */ new Date(0),
447
458
  maxAge: 0
448
459
  });
449
460
  }
@@ -483,8 +494,7 @@ else cookie += "; Path=/";
483
494
  if (this.has("Content-Type")) return;
484
495
  if (typeof file === "string" && filename) {
485
496
  const dotIndex = filename.lastIndexOf(".");
486
- const ext = dotIndex >= 0 ? filename.slice(dotIndex + 1).toLowerCase() : "";
487
- const map = {
497
+ const mime = {
488
498
  txt: "text/plain",
489
499
  text: "text/plain",
490
500
  html: "text/html",
@@ -500,15 +510,14 @@ else cookie += "; Path=/";
500
510
  svg: "image/svg+xml",
501
511
  ico: "image/x-icon",
502
512
  md: "text/markdown"
503
- };
504
- const mime = map[ext];
513
+ }[dotIndex >= 0 ? filename.slice(dotIndex + 1).toLowerCase() : ""];
505
514
  if (mime) this.set("Content-Type", mime);
506
- else this.set("Content-Type", "application/octet-stream");
515
+ else this.set("Content-Type", "application/octet-stream");
507
516
  return;
508
517
  }
509
518
  if (isBlob(file)) {
510
519
  if (file.type && file.type !== "") this.set("Content-Type", file.type);
511
- else this.set("Content-Type", "application/octet-stream");
520
+ else this.set("Content-Type", "application/octet-stream");
512
521
  return;
513
522
  }
514
523
  this.set("Content-Type", "application/octet-stream");
@@ -520,15 +529,15 @@ else this.set("Content-Type", "application/octet-stream");
520
529
  * Mirrors logic from TangoResponse.ts, but generalized for use anywhere.
521
530
  */
522
531
  setContentLengthFromBody(body) {
523
- if (this.has("Content-Length") || body === null || body === undefined) return;
532
+ if (this.has("Content-Length") || body === null || body === void 0) return;
524
533
  let len;
525
534
  if (typeof body === "string") len = new TextEncoder().encode(body).length;
526
- else if (isArrayBuffer(body)) len = body.byteLength;
527
- else if (TangoHeaders.isNodeBuffer(body)) len = body.length;
528
- else if (isUint8Array(body)) len = body.byteLength;
529
- else if (isBlob(body)) len = body.size;
530
- else if (TangoHeaders.hasNumberSize(body)) len = body.size;
531
- else if (TangoHeaders.hasNumberLength(body) && typeof body !== "string" && !isArrayBuffer(body) && !isUint8Array(body)) len = body.length;
535
+ else if (isArrayBuffer(body)) len = body.byteLength;
536
+ else if (TangoHeaders.isNodeBuffer(body)) len = body.length;
537
+ else if (isUint8Array(body)) len = body.byteLength;
538
+ else if (isBlob(body)) len = body.size;
539
+ else if (TangoHeaders.hasNumberSize(body)) len = body.size;
540
+ else if (TangoHeaders.hasNumberLength(body) && typeof body !== "string" && !isArrayBuffer(body) && !isUint8Array(body)) len = body.length;
532
541
  if (typeof len === "number") this.set("Content-Length", len.toString());
533
542
  }
534
543
  /**
@@ -562,7 +571,7 @@ else if (TangoHeaders.hasNumberLength(body) && typeof body !== "string" && !isAr
562
571
  if (desc) metric += `;desc="${desc.replace(/"/g, "\\\"")}"`;
563
572
  const prev = this.get("Server-Timing");
564
573
  if (prev && prev.length > 0) this.set("Server-Timing", prev + ", " + metric);
565
- else this.set("Server-Timing", metric);
574
+ else this.set("Server-Timing", metric);
566
575
  return this;
567
576
  }
568
577
  /**
@@ -573,7 +582,7 @@ else this.set("Server-Timing", metric);
573
582
  appendServerTimingRaw(value) {
574
583
  const prev = this.get("Server-Timing");
575
584
  if (prev && prev.length > 0) this.set("Server-Timing", prev + ", " + value);
576
- else this.set("Server-Timing", value);
585
+ else this.set("Server-Timing", value);
577
586
  return this;
578
587
  }
579
588
  /**
@@ -609,9 +618,12 @@ else this.set("Server-Timing", value);
609
618
  return this.get("X-Response-Time");
610
619
  }
611
620
  };
612
-
613
621
  //#endregion
614
622
  //#region src/http/TangoQueryParams.ts
623
+ /**
624
+ * Immutable query parameter helper that normalizes framework-specific shapes
625
+ * into one Tango-owned API.
626
+ */
615
627
  var TangoQueryParams = class TangoQueryParams {
616
628
  static BRAND = "tango.http.query_params";
617
629
  __tangoBrand = TangoQueryParams.BRAND;
@@ -629,7 +641,7 @@ var TangoQueryParams = class TangoQueryParams {
629
641
  * Build query params from a `URLSearchParams` instance.
630
642
  */
631
643
  static fromURLSearchParams(params) {
632
- const values = new Map();
644
+ const values = /* @__PURE__ */ new Map();
633
645
  for (const [key, value] of params.entries()) {
634
646
  const current = values.get(key);
635
647
  if (current) {
@@ -644,7 +656,7 @@ var TangoQueryParams = class TangoQueryParams {
644
656
  * Build query params from framework record-style search params.
645
657
  */
646
658
  static fromRecord(params) {
647
- const values = new Map();
659
+ const values = /* @__PURE__ */ new Map();
648
660
  for (const [key, value] of Object.entries(params)) {
649
661
  if (Array.isArray(value)) {
650
662
  const normalized = value.filter((entry) => typeof entry === "string");
@@ -712,10 +724,10 @@ var TangoQueryParams = class TangoQueryParams {
712
724
  * `undefined`, `null`, and empty arrays remove the key entirely.
713
725
  */
714
726
  withValues(updates) {
715
- const next = new Map();
727
+ const next = /* @__PURE__ */ new Map();
716
728
  for (const [key, values] of this.values.entries()) next.set(key, [...values]);
717
729
  for (const [key, value] of Object.entries(updates)) {
718
- if (value === undefined || value === null) {
730
+ if (value === void 0 || value === null) {
719
731
  next.delete(key);
720
732
  continue;
721
733
  }
@@ -740,7 +752,7 @@ var TangoQueryParams = class TangoQueryParams {
740
752
  */
741
753
  getTrimmed(name) {
742
754
  const value = this.get(name)?.trim();
743
- return value ? value : undefined;
755
+ return value ? value : void 0;
744
756
  }
745
757
  /**
746
758
  * Get the free-text search param using Tango's default key.
@@ -757,9 +769,12 @@ var TangoQueryParams = class TangoQueryParams {
757
769
  return value.split(",").map((token) => token.trim()).filter((token) => token.length > 0);
758
770
  }
759
771
  };
760
-
761
772
  //#endregion
762
773
  //#region src/http/TangoRequest.ts
774
+ /**
775
+ * Framework request wrapper that normalizes JSON-like bodies and preserves
776
+ * fetch `Request` compatibility for downstream handlers.
777
+ */
763
778
  var TangoRequest = class TangoRequest {
764
779
  static BRAND = "tango.http.request";
765
780
  __tangoBrand = TangoRequest.BRAND;
@@ -767,7 +782,7 @@ var TangoRequest = class TangoRequest {
767
782
  bodySourceValue;
768
783
  queryParamsValue;
769
784
  constructor(input, init = {}) {
770
- const sourceRequest = typeof input === "string" ? undefined : input;
785
+ const sourceRequest = typeof input === "string" ? void 0 : input;
771
786
  const method = (init.method ?? sourceRequest?.method ?? "GET").toUpperCase();
772
787
  const headers = new Headers(init.headers ?? sourceRequest?.headers);
773
788
  const normalizedBody = this.normalizeBody(init.body, headers, method);
@@ -784,7 +799,7 @@ var TangoRequest = class TangoRequest {
784
799
  referrerPolicy: init.referrerPolicy ?? sourceRequest?.referrerPolicy,
785
800
  signal: init.signal ?? sourceRequest?.signal
786
801
  };
787
- if (normalizedBody !== undefined) {
802
+ if (normalizedBody !== void 0) {
788
803
  requestInit.body = normalizedBody;
789
804
  if (isReadableStream(normalizedBody)) requestInit.duplex = "half";
790
805
  }
@@ -946,8 +961,8 @@ var TangoRequest = class TangoRequest {
946
961
  return new TangoRequest(this.request.clone());
947
962
  }
948
963
  normalizeBody(body, headers, method) {
949
- if (method === "GET" || method === "HEAD") return undefined;
950
- if (isNil(body)) return undefined;
964
+ if (method === "GET" || method === "HEAD") return;
965
+ if (isNil(body)) return;
951
966
  if (typeof body === "string") return body;
952
967
  if (isArrayBuffer(body) || isUint8Array(body) || isBlob(body)) return body;
953
968
  if (isURLSearchParams(body) || isFormData(body) || isReadableStream(body)) return body;
@@ -956,9 +971,11 @@ var TangoRequest = class TangoRequest {
956
971
  return serialized;
957
972
  }
958
973
  };
959
-
960
974
  //#endregion
961
975
  //#region src/http/TangoResponse.ts
976
+ /**
977
+ * Framework response wrapper with fetch-compatible surface plus ergonomic helpers.
978
+ */
962
979
  var TangoResponse = class TangoResponse {
963
980
  static BRAND = "tango.http.response";
964
981
  __tangoBrand = TangoResponse.BRAND;
@@ -978,7 +995,7 @@ var TangoResponse = class TangoResponse {
978
995
  this.statusText = init.statusText || "";
979
996
  this.type = init.type || "default";
980
997
  this.url = init.url || "";
981
- this.okValue = typeof init.ok === "boolean" ? init.ok : undefined;
998
+ this.okValue = typeof init.ok === "boolean" ? init.ok : void 0;
982
999
  this.tangoBody = new TangoBody(init.body ?? null, this.headers);
983
1000
  this.body = isReadableStream(this.tangoBody.bodySource) ? this.tangoBody.bodySource : null;
984
1001
  }
@@ -1046,7 +1063,7 @@ var TangoResponse = class TangoResponse {
1046
1063
  headers.set("Location", url);
1047
1064
  return new TangoResponse({
1048
1065
  ...init,
1049
- body: undefined,
1066
+ body: void 0,
1050
1067
  status,
1051
1068
  headers,
1052
1069
  redirected: true,
@@ -1060,7 +1077,7 @@ var TangoResponse = class TangoResponse {
1060
1077
  const headers = new TangoHeaders(init?.headers);
1061
1078
  return new TangoResponse({
1062
1079
  ...init,
1063
- body: undefined,
1080
+ body: void 0,
1064
1081
  status: 204,
1065
1082
  headers
1066
1083
  });
@@ -1072,7 +1089,7 @@ var TangoResponse = class TangoResponse {
1072
1089
  const headers = new TangoHeaders(init?.headers);
1073
1090
  if (location) headers.set("Location", location);
1074
1091
  let respBody;
1075
- if (body !== undefined) {
1092
+ if (body !== void 0) {
1076
1093
  respBody = JSON.stringify(body);
1077
1094
  if (!headers.has("Content-Type")) headers.set("Content-Type", "application/json; charset=utf-8");
1078
1095
  }
@@ -1298,22 +1315,22 @@ var TangoResponse = class TangoResponse {
1298
1315
  if (!headers.has("Content-Type")) headers.set("Content-Type", "application/problem+json; charset=utf-8");
1299
1316
  let code = "error";
1300
1317
  let message = "An error occurred";
1301
- let details = undefined;
1318
+ let details = void 0;
1302
1319
  let fields;
1303
1320
  if (TangoError.isTangoError(problem)) {
1304
- const envelope$1 = problem.toErrorEnvelope();
1321
+ const envelope = problem.toErrorEnvelope();
1305
1322
  status = problem.status;
1306
- code = envelope$1.error.code;
1307
- message = envelope$1.error.message;
1308
- details = envelope$1.error.details;
1309
- fields = envelope$1.error.fields;
1323
+ code = envelope.error.code;
1324
+ message = envelope.error.message;
1325
+ details = envelope.error.details;
1326
+ fields = envelope.error.fields;
1310
1327
  } else if (TangoError.isProblemDetails(problem)) {
1311
1328
  code = problem.code;
1312
1329
  message = problem.message;
1313
1330
  details = problem.details;
1314
1331
  fields = problem.fields;
1315
1332
  } else if (typeof problem === "string") message = problem;
1316
- else if (problem && typeof problem === "object") {
1333
+ else if (problem && typeof problem === "object") {
1317
1334
  const extracted = problem;
1318
1335
  details = extracted.details;
1319
1336
  fields = extracted.fields;
@@ -1321,7 +1338,7 @@ else if (problem && typeof problem === "object") {
1321
1338
  const envelope = { error: {
1322
1339
  code,
1323
1340
  message,
1324
- ...details === undefined ? {} : { details },
1341
+ ...details === void 0 ? {} : { details },
1325
1342
  ...fields ? { fields } : {}
1326
1343
  } };
1327
1344
  const body = JSON.stringify(envelope);
@@ -1340,7 +1357,7 @@ else if (problem && typeof problem === "object") {
1340
1357
  const headers = new TangoHeaders(opts?.init?.headers ?? {});
1341
1358
  if (opts?.filename) headers.setContentDispositionInline(opts.filename);
1342
1359
  if (opts?.contentType && !headers.has("Content-Type")) headers.set("Content-Type", opts.contentType);
1343
- else if (!headers.has("Content-Type")) headers.setContentTypeByFile(file, opts?.filename);
1360
+ else if (!headers.has("Content-Type")) headers.setContentTypeByFile(file, opts?.filename);
1344
1361
  if (!headers.has("Content-Length")) headers.setContentLengthFromBody(file);
1345
1362
  return new TangoResponse({
1346
1363
  ...opts?.init,
@@ -1354,9 +1371,9 @@ else if (!headers.has("Content-Type")) headers.setContentTypeByFile(file, opts?.
1354
1371
  static download(file, opts) {
1355
1372
  const headers = new TangoHeaders(opts?.init?.headers ?? {});
1356
1373
  if (opts?.filename) headers.setContentDispositionAttachment(opts.filename);
1357
- else headers.set("Content-Disposition", "attachment");
1374
+ else headers.set("Content-Disposition", "attachment");
1358
1375
  if (opts?.contentType && !headers.has("Content-Type")) headers.set("Content-Type", opts.contentType);
1359
- else if (!headers.has("Content-Type")) headers.setContentTypeByFile(file, opts?.filename);
1376
+ else if (!headers.has("Content-Type")) headers.setContentTypeByFile(file, opts?.filename);
1360
1377
  if (!headers.has("Content-Length")) headers.setContentLengthFromBody(file);
1361
1378
  return new TangoResponse({
1362
1379
  ...opts?.init,
@@ -1482,7 +1499,7 @@ else if (!headers.has("Content-Type")) headers.setContentTypeByFile(file, opts?.
1482
1499
  */
1483
1500
  withServerTiming(timing) {
1484
1501
  if (Array.isArray(timing)) this.headers.set("Server-Timing", timing.join(", "));
1485
- else if (typeof timing === "string") this.headers.set("Server-Timing", timing);
1502
+ else if (typeof timing === "string") this.headers.set("Server-Timing", timing);
1486
1503
  return this;
1487
1504
  }
1488
1505
  /**
@@ -1492,7 +1509,7 @@ else if (typeof timing === "string") this.headers.set("Server-Timing", timing);
1492
1509
  */
1493
1510
  withResponseTime(time) {
1494
1511
  if (typeof time === "number") this.headers.set("X-Response-Time", `${time}ms`);
1495
- else if (typeof time === "string") this.headers.set("X-Response-Time", time);
1512
+ else if (typeof time === "string") this.headers.set("X-Response-Time", time);
1496
1513
  return this;
1497
1514
  }
1498
1515
  /**
@@ -1502,12 +1519,11 @@ else if (typeof time === "string") this.headers.set("X-Response-Time", time);
1502
1519
  */
1503
1520
  propagateTraceHeaders(input) {
1504
1521
  const incoming = new TangoHeaders(input);
1505
- const traceHeaderNames = [
1522
+ for (const name of [
1506
1523
  "x-request-id",
1507
1524
  "traceparent",
1508
1525
  "server-timing"
1509
- ];
1510
- for (const name of traceHeaderNames) {
1526
+ ]) {
1511
1527
  const value = incoming.get(name);
1512
1528
  if (!isNil(value)) this.headers.set(name, value);
1513
1529
  }
@@ -1518,9 +1534,8 @@ else if (typeof time === "string") this.headers.set("X-Response-Time", time);
1518
1534
  */
1519
1535
  clone() {
1520
1536
  if (this.bodyUsed) throw new TypeError("Body has already been used");
1521
- const clonedBody = this.tangoBody.clone();
1522
1537
  return new TangoResponse({
1523
- body: clonedBody.bodySource,
1538
+ body: this.tangoBody.clone().bodySource,
1524
1539
  headers: this.headers.clone(),
1525
1540
  ok: this.okValue,
1526
1541
  redirected: this.redirected,
@@ -1606,23 +1621,24 @@ else if (typeof time === "string") this.headers.set("X-Response-Time", time);
1606
1621
  * This method is _not_ part of the web Response interface, and is intentionally private/internal.
1607
1622
  */
1608
1623
  __peekBodyForTestOnly() {
1609
- const nodeEnv = typeof process !== "undefined" ? process.env?.NODE_ENV : undefined;
1624
+ const nodeEnv = typeof process !== "undefined" ? process.env?.NODE_ENV : void 0;
1610
1625
  if (nodeEnv === "production" || nodeEnv === "prod") throw new Error("peekBody() is not available in production builds. For test/debug use only.");
1611
1626
  return this.tangoBody.bodySource;
1612
1627
  }
1613
1628
  };
1614
-
1615
1629
  //#endregion
1616
1630
  //#region src/http/index.ts
1617
- var http_exports = {};
1618
- __export(http_exports, {
1631
+ /**
1632
+ * Domain boundary barrel: centralizes this subdomain's public contract.
1633
+ */
1634
+ var http_exports = /* @__PURE__ */ __exportAll({
1619
1635
  TangoBody: () => TangoBody,
1620
1636
  TangoHeaders: () => TangoHeaders,
1621
1637
  TangoQueryParams: () => TangoQueryParams,
1622
1638
  TangoRequest: () => TangoRequest,
1623
1639
  TangoResponse: () => TangoResponse
1624
1640
  });
1625
-
1626
1641
  //#endregion
1627
- export { TangoBody, TangoHeaders, TangoQueryParams, TangoRequest, TangoResponse, http_exports };
1628
- //# sourceMappingURL=http-63cMANMG.js.map
1642
+ export { TangoHeaders as a, TangoQueryParams as i, TangoResponse as n, TangoBody as o, TangoRequest as r, http_exports as t };
1643
+
1644
+ //# sourceMappingURL=http-6e0y_vd6.js.map