logixia 1.13.3 → 2.0.4

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 (229) hide show
  1. package/README.md +117 -44
  2. package/dist/async-context-B05ArHgM.mjs +134 -0
  3. package/dist/async-context-B05ArHgM.mjs.map +1 -0
  4. package/dist/async-context-DTQgi8f7.js +150 -0
  5. package/dist/async-context-DTQgi8f7.js.map +1 -0
  6. package/dist/{azure-monitor.transport-CHnjVRF-.mjs → azure-monitor.transport-BPbgjATu.mjs} +27 -15
  7. package/dist/azure-monitor.transport-BPbgjATu.mjs.map +1 -0
  8. package/dist/{azure-monitor.transport-BDFO4F-i.d.ts → azure-monitor.transport-C7kYyZUW.d.mts} +3 -6
  9. package/dist/azure-monitor.transport-C7kYyZUW.d.mts.map +1 -0
  10. package/dist/{azure-monitor.transport-CrvfHd9C.js → azure-monitor.transport-CwbOLZHB.js} +32 -20
  11. package/dist/azure-monitor.transport-CwbOLZHB.js.map +1 -0
  12. package/dist/{azure-monitor.transport-D5wQEH04.d.mts → azure-monitor.transport-DV03Z5P4.d.ts} +3 -6
  13. package/dist/azure-monitor.transport-DV03Z5P4.d.ts.map +1 -0
  14. package/dist/azure.d.mts +1 -2
  15. package/dist/azure.d.ts +1 -2
  16. package/dist/azure.js +3 -6
  17. package/dist/azure.mjs +1 -6
  18. package/dist/{batch-buffer-PGvSgbmd.mjs → batch-buffer-0fgLmIPn.mjs} +21 -7
  19. package/dist/batch-buffer-0fgLmIPn.mjs.map +1 -0
  20. package/dist/{batch-buffer-BY-mRWIK.js → batch-buffer-DT4gdXmf.js} +53 -40
  21. package/dist/batch-buffer-DT4gdXmf.js.map +1 -0
  22. package/dist/browser.d.mts +52 -23
  23. package/dist/browser.d.mts.map +1 -1
  24. package/dist/browser.d.ts +52 -23
  25. package/dist/browser.d.ts.map +1 -1
  26. package/dist/browser.js +460 -62
  27. package/dist/browser.js.map +1 -1
  28. package/dist/browser.mjs +461 -65
  29. package/dist/browser.mjs.map +1 -1
  30. package/dist/{nestjs-extras-ImbuDhs1.mjs → builder-D70z6kjj.mjs} +279 -965
  31. package/dist/builder-D70z6kjj.mjs.map +1 -0
  32. package/dist/{nestjs-extras-DnJ6vrIC.js → builder-M7NoaugM.js} +421 -1177
  33. package/dist/builder-M7NoaugM.js.map +1 -0
  34. package/dist/cli/index.js +86 -67
  35. package/dist/cloudwatch.d.mts +1 -2
  36. package/dist/cloudwatch.d.ts +1 -2
  37. package/dist/cloudwatch.js +3 -7
  38. package/dist/cloudwatch.mjs +1 -7
  39. package/dist/{cloudwatch.transport-BO1ahxw-.js → cloudwatch.transport-B2wKQFF7.js} +61 -36
  40. package/dist/cloudwatch.transport-B2wKQFF7.js.map +1 -0
  41. package/dist/{cloudwatch.transport-DZ6ies7g.mjs → cloudwatch.transport-BTvYfLs9.mjs} +54 -28
  42. package/dist/cloudwatch.transport-BTvYfLs9.mjs.map +1 -0
  43. package/dist/{cloudwatch.transport-B00st6Xv.d.ts → cloudwatch.transport-Bf7L4I59.d.ts} +2 -6
  44. package/dist/cloudwatch.transport-Bf7L4I59.d.ts.map +1 -0
  45. package/dist/{cloudwatch.transport-Blc7Gtxt.d.mts → cloudwatch.transport-Rj4yTpRn.d.mts} +2 -6
  46. package/dist/cloudwatch.transport-Rj4yTpRn.d.mts.map +1 -0
  47. package/dist/{coerce.utils-Cu6IUTgX.mjs → coerce.utils-B_rEudCn.mjs} +3 -4
  48. package/dist/{coerce.utils-Cu6IUTgX.mjs.map → coerce.utils-B_rEudCn.mjs.map} +1 -1
  49. package/dist/{coerce.utils-B-LilukN.js → coerce.utils-C1C5sIX0.js} +8 -10
  50. package/dist/{coerce.utils-B-LilukN.js.map → coerce.utils-C1C5sIX0.js.map} +1 -1
  51. package/dist/correlation.d.mts +13 -16
  52. package/dist/correlation.d.mts.map +1 -1
  53. package/dist/correlation.d.ts +13 -16
  54. package/dist/correlation.d.ts.map +1 -1
  55. package/dist/correlation.js +58 -9
  56. package/dist/correlation.js.map +1 -1
  57. package/dist/correlation.mjs +56 -6
  58. package/dist/correlation.mjs.map +1 -1
  59. package/dist/{entry-fields-BJkuPnIg.mjs → entry-fields-CGuvT2R0.mjs} +5 -6
  60. package/dist/entry-fields-CGuvT2R0.mjs.map +1 -0
  61. package/dist/{entry-fields-BvOLFlJ4.js → entry-fields-RLd1jCoR.js} +10 -12
  62. package/dist/entry-fields-RLd1jCoR.js.map +1 -0
  63. package/dist/gcp.d.mts +1 -2
  64. package/dist/gcp.d.ts +1 -2
  65. package/dist/gcp.js +3 -7
  66. package/dist/gcp.mjs +1 -7
  67. package/dist/{gcp.transport-m4fVw0b1.d.ts → gcp.transport-C5D72b1g.d.mts} +3 -6
  68. package/dist/gcp.transport-C5D72b1g.d.mts.map +1 -0
  69. package/dist/{gcp.transport-zzNyIoih.d.mts → gcp.transport-CFQfdAOK.d.ts} +3 -6
  70. package/dist/gcp.transport-CFQfdAOK.d.ts.map +1 -0
  71. package/dist/{gcp.transport-DBX5TPIy.mjs → gcp.transport-CGKopAhQ.mjs} +55 -16
  72. package/dist/gcp.transport-CGKopAhQ.mjs.map +1 -0
  73. package/dist/{gcp.transport-CHV8MGgz.js → gcp.transport-KZe9hCAR.js} +60 -22
  74. package/dist/gcp.transport-KZe9hCAR.js.map +1 -0
  75. package/dist/{index-nZEeCr3X.d.ts → index-DwozbmB4.d.ts} +3 -8
  76. package/dist/index-DwozbmB4.d.ts.map +1 -0
  77. package/dist/{index-BPwEisy4.d.mts → index-xqaJtAZn.d.mts} +3 -8
  78. package/dist/index-xqaJtAZn.d.mts.map +1 -0
  79. package/dist/index.d.mts +141 -203
  80. package/dist/index.d.mts.map +1 -1
  81. package/dist/index.d.ts +140 -202
  82. package/dist/index.d.ts.map +1 -1
  83. package/dist/index.js +196 -381
  84. package/dist/index.js.map +1 -1
  85. package/dist/index.mjs +145 -294
  86. package/dist/index.mjs.map +1 -1
  87. package/dist/internal-log-b0Vp4qrB.js +183 -0
  88. package/dist/internal-log-b0Vp4qrB.js.map +1 -0
  89. package/dist/internal-log-uCSd1PMc.mjs +142 -0
  90. package/dist/internal-log-uCSd1PMc.mjs.map +1 -0
  91. package/dist/logitron-logger-D2B75Oc7.d.ts +365 -0
  92. package/dist/logitron-logger-D2B75Oc7.d.ts.map +1 -0
  93. package/dist/logitron-logger-oEd6wNhf.d.mts +365 -0
  94. package/dist/logitron-logger-oEd6wNhf.d.mts.map +1 -0
  95. package/dist/middleware.d.mts +10 -12
  96. package/dist/middleware.d.mts.map +1 -1
  97. package/dist/middleware.d.ts +10 -12
  98. package/dist/middleware.d.ts.map +1 -1
  99. package/dist/middleware.js +16 -47
  100. package/dist/middleware.js.map +1 -1
  101. package/dist/middleware.mjs +13 -45
  102. package/dist/middleware.mjs.map +1 -1
  103. package/dist/nest.d.mts +467 -10
  104. package/dist/nest.d.mts.map +1 -1
  105. package/dist/nest.d.ts +467 -10
  106. package/dist/nest.d.ts.map +1 -1
  107. package/dist/nest.js +889 -43
  108. package/dist/nest.js.map +1 -0
  109. package/dist/nest.mjs +850 -9
  110. package/dist/nest.mjs.map +1 -0
  111. package/dist/{trace.utils-CvXgaiQT.mjs → request-trace-C_fvIDv4.mjs} +44 -9
  112. package/dist/request-trace-C_fvIDv4.mjs.map +1 -0
  113. package/dist/{trace.utils-DpBOLDtq.js → request-trace-wTJdKp6-.js} +121 -77
  114. package/dist/request-trace-wTJdKp6-.js.map +1 -0
  115. package/dist/rolldown-runtime-D3PmRqjj.mjs +4 -0
  116. package/dist/{safe-stringify-DJ66tW5I.mjs → safe-stringify-BMRl3EX3.mjs} +3 -4
  117. package/dist/safe-stringify-BMRl3EX3.mjs.map +1 -0
  118. package/dist/{safe-stringify-DWo3aZp_.js → safe-stringify-DLz1Kz3o.js} +23 -25
  119. package/dist/safe-stringify-DLz1Kz3o.js.map +1 -0
  120. package/dist/{search-CHUZPl0h.d.ts → search-BH33XhuU.d.mts} +2 -22
  121. package/dist/search-BH33XhuU.d.mts.map +1 -0
  122. package/dist/{search-DjXSn6v5.mjs → search-CWMVYC-R.mjs} +34 -41
  123. package/dist/search-CWMVYC-R.mjs.map +1 -0
  124. package/dist/{search-BfBzDIT9.d.mts → search-CazwyX5Z.d.ts} +2 -22
  125. package/dist/search-CazwyX5Z.d.ts.map +1 -0
  126. package/dist/{search-B0MH1SJJ.js → search-DUfWuzFP.js} +64 -71
  127. package/dist/search-DUfWuzFP.js.map +1 -0
  128. package/dist/search.d.mts +2 -4
  129. package/dist/search.d.ts +2 -4
  130. package/dist/search.js +3 -4
  131. package/dist/search.mjs +1 -4
  132. package/dist/secret-config-BegMLkYl.mjs +209 -0
  133. package/dist/secret-config-BegMLkYl.mjs.map +1 -0
  134. package/dist/secret-config-CBZBs0p1.js +271 -0
  135. package/dist/secret-config-CBZBs0p1.js.map +1 -0
  136. package/dist/slack.transport-Ce96JBDk.mjs +824 -0
  137. package/dist/slack.transport-Ce96JBDk.mjs.map +1 -0
  138. package/dist/slack.transport-Dlx3xvb7.js +847 -0
  139. package/dist/slack.transport-Dlx3xvb7.js.map +1 -0
  140. package/dist/slack.transport-DrirgDNy.d.ts +159 -0
  141. package/dist/slack.transport-DrirgDNy.d.ts.map +1 -0
  142. package/dist/slack.transport-DxHOXlLu.d.mts +159 -0
  143. package/dist/slack.transport-DxHOXlLu.d.mts.map +1 -0
  144. package/dist/testing.d.mts +3 -8
  145. package/dist/testing.d.mts.map +1 -1
  146. package/dist/testing.d.ts +3 -8
  147. package/dist/testing.d.ts.map +1 -1
  148. package/dist/testing.js +3 -4
  149. package/dist/testing.js.map +1 -1
  150. package/dist/testing.mjs +2 -3
  151. package/dist/testing.mjs.map +1 -1
  152. package/dist/{transport.manager-Crau3Rle.js → transport.manager-DkcEOlqV.js} +331 -234
  153. package/dist/transport.manager-DkcEOlqV.js.map +1 -0
  154. package/dist/{transport.manager-CpdVHEGP.mjs → transport.manager-eZ_EeC00.mjs} +274 -178
  155. package/dist/transport.manager-eZ_EeC00.mjs.map +1 -0
  156. package/dist/{transport.types-CtNr3D7S.d.mts → transport.types-BJVL1QQl.d.mts} +5 -4
  157. package/dist/transport.types-BJVL1QQl.d.mts.map +1 -0
  158. package/dist/{transport.types-DqVLZTyf.d.ts → transport.types-BJVL1QQl.d.ts} +5 -4
  159. package/dist/transport.types-BJVL1QQl.d.ts.map +1 -0
  160. package/dist/transports.d.mts +32 -41
  161. package/dist/transports.d.mts.map +1 -1
  162. package/dist/transports.d.ts +32 -41
  163. package/dist/transports.d.ts.map +1 -1
  164. package/dist/transports.js +12 -12
  165. package/dist/transports.mjs +7 -12
  166. package/dist/worker-entry.js +337 -87
  167. package/dist/worker.d.mts +1 -2
  168. package/dist/worker.d.ts +1 -2
  169. package/dist/worker.js +3 -4
  170. package/dist/worker.mjs +1 -4
  171. package/dist/{worker.transport-Bj-i0P9V.d.ts → worker.transport-BuPwBi3d.d.ts} +2 -6
  172. package/dist/worker.transport-BuPwBi3d.d.ts.map +1 -0
  173. package/dist/{worker.transport-JP8YHBuU.js → worker.transport-C6GNl_r2.js} +44 -14
  174. package/dist/worker.transport-C6GNl_r2.js.map +1 -0
  175. package/dist/{worker.transport-otwhJ_Et.mjs → worker.transport-DLVA4y2e.mjs} +39 -9
  176. package/dist/worker.transport-DLVA4y2e.mjs.map +1 -0
  177. package/dist/{worker.transport-Bgv9heDI.d.mts → worker.transport-hJay1wxA.d.mts} +2 -6
  178. package/dist/worker.transport-hJay1wxA.d.mts.map +1 -0
  179. package/package.json +36 -19
  180. package/dist/async-context-BzJrbfQs.mjs +0 -72
  181. package/dist/async-context-BzJrbfQs.mjs.map +0 -1
  182. package/dist/async-context-DyQQYq3I.js +0 -92
  183. package/dist/async-context-DyQQYq3I.js.map +0 -1
  184. package/dist/azure-monitor.transport-BDFO4F-i.d.ts.map +0 -1
  185. package/dist/azure-monitor.transport-CHnjVRF-.mjs.map +0 -1
  186. package/dist/azure-monitor.transport-CrvfHd9C.js.map +0 -1
  187. package/dist/azure-monitor.transport-D5wQEH04.d.mts.map +0 -1
  188. package/dist/batch-buffer-BY-mRWIK.js.map +0 -1
  189. package/dist/batch-buffer-PGvSgbmd.mjs.map +0 -1
  190. package/dist/chunk-DLSkYcPk.mjs +0 -7
  191. package/dist/chunk-nOFOJqeH.js +0 -30
  192. package/dist/cloudwatch.transport-B00st6Xv.d.ts.map +0 -1
  193. package/dist/cloudwatch.transport-BO1ahxw-.js.map +0 -1
  194. package/dist/cloudwatch.transport-Blc7Gtxt.d.mts.map +0 -1
  195. package/dist/cloudwatch.transport-DZ6ies7g.mjs.map +0 -1
  196. package/dist/entry-fields-BJkuPnIg.mjs.map +0 -1
  197. package/dist/entry-fields-BvOLFlJ4.js.map +0 -1
  198. package/dist/gcp.transport-CHV8MGgz.js.map +0 -1
  199. package/dist/gcp.transport-DBX5TPIy.mjs.map +0 -1
  200. package/dist/gcp.transport-m4fVw0b1.d.ts.map +0 -1
  201. package/dist/gcp.transport-zzNyIoih.d.mts.map +0 -1
  202. package/dist/index-BPwEisy4.d.mts.map +0 -1
  203. package/dist/index-nZEeCr3X.d.ts.map +0 -1
  204. package/dist/internal-log-BUJYMZbE.js +0 -70
  205. package/dist/internal-log-BUJYMZbE.js.map +0 -1
  206. package/dist/internal-log-Cm8SOWSV.mjs +0 -52
  207. package/dist/internal-log-Cm8SOWSV.mjs.map +0 -1
  208. package/dist/nestjs-extras-DnJ6vrIC.js.map +0 -1
  209. package/dist/nestjs-extras-ImbuDhs1.mjs.map +0 -1
  210. package/dist/nestjs-extras-OkC796py.d.mts +0 -725
  211. package/dist/nestjs-extras-OkC796py.d.mts.map +0 -1
  212. package/dist/nestjs-extras-mKrHE9S6.d.ts +0 -725
  213. package/dist/nestjs-extras-mKrHE9S6.d.ts.map +0 -1
  214. package/dist/safe-stringify-DJ66tW5I.mjs.map +0 -1
  215. package/dist/safe-stringify-DWo3aZp_.js.map +0 -1
  216. package/dist/search-B0MH1SJJ.js.map +0 -1
  217. package/dist/search-BfBzDIT9.d.mts.map +0 -1
  218. package/dist/search-CHUZPl0h.d.ts.map +0 -1
  219. package/dist/search-DjXSn6v5.mjs.map +0 -1
  220. package/dist/trace.utils-CvXgaiQT.mjs.map +0 -1
  221. package/dist/trace.utils-DpBOLDtq.js.map +0 -1
  222. package/dist/transport.manager-CpdVHEGP.mjs.map +0 -1
  223. package/dist/transport.manager-Crau3Rle.js.map +0 -1
  224. package/dist/transport.types-CtNr3D7S.d.mts.map +0 -1
  225. package/dist/transport.types-DqVLZTyf.d.ts.map +0 -1
  226. package/dist/worker.transport-Bgv9heDI.d.mts.map +0 -1
  227. package/dist/worker.transport-Bj-i0P9V.d.ts.map +0 -1
  228. package/dist/worker.transport-JP8YHBuU.js.map +0 -1
  229. package/dist/worker.transport-otwhJ_Et.mjs.map +0 -1
package/dist/browser.mjs CHANGED
@@ -1,11 +1,262 @@
1
- //#region rolldown:runtime
1
+ // \0rolldown/runtime.js
2
2
  var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { get: (a, b) => (typeof require !== "undefined" ? require : a)[b] }) : x)(function(x) {
3
3
  if (typeof require !== "undefined") return require.apply(this, arguments);
4
- throw Error("Calling `require` for \"" + x + "\" in an environment that doesn't expose the `require` function.");
4
+ throw Error("Calling `require` for \"" + x + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
5
5
  });
6
-
7
- //#endregion
8
- //#region src/utils/safe-stringify.ts
6
+ // src/utils/sensitive-names.ts
7
+ /**
8
+ * The one list of sensitive names. Log redaction (redact.utils), the HTTP logger
9
+ * middleware and transport secret handling (transports/secret-config) all read it,
10
+ * so the lists cannot drift. No imports: safe from any module, including browser code.
11
+ */
12
+ /** Field names redacted by name, wherever they appear in logged data. */
13
+ const SENSITIVE_KEY_NAMES = [
14
+ "password",
15
+ "passwd",
16
+ "secret",
17
+ "token",
18
+ "apiKey",
19
+ "api_key",
20
+ "accessToken",
21
+ "access_token",
22
+ "refreshToken",
23
+ "refresh_token",
24
+ "authorization",
25
+ "credentials",
26
+ "privateKey",
27
+ "private_key",
28
+ "clientSecret",
29
+ "client_secret",
30
+ "cookie",
31
+ "set-cookie",
32
+ "x-api-key",
33
+ "session",
34
+ "proxy-authorization",
35
+ "x-auth-token",
36
+ "x-access-token",
37
+ "aws_secret_access_key",
38
+ "awsSecretAccessKey",
39
+ "secretAccessKey"
40
+ ];
41
+ /**
42
+ * Extra names that only mean "secret" inside transport configuration, where
43
+ * short words like `key` or `signature` are credentials, not log fields.
44
+ */
45
+ const TRANSPORT_CONFIG_SECRET_NAMES = [
46
+ "writeKey",
47
+ "apiSecret",
48
+ "connectionString",
49
+ "sessionToken",
50
+ "passphrase",
51
+ "signature",
52
+ "pwd",
53
+ "pfx",
54
+ "cert",
55
+ "key",
56
+ "auth"
57
+ ];
58
+ /** Query-string parameters whose values are never logged. */
59
+ const DEFAULT_REDACT_QUERY_PARAMS = [
60
+ "token",
61
+ "access_token",
62
+ "refresh_token",
63
+ "code",
64
+ "password",
65
+ "secret",
66
+ "api_key",
67
+ "apikey",
68
+ "key",
69
+ "signature",
70
+ "sig",
71
+ "auth"
72
+ ];
73
+ // src/transports/secret-config.ts
74
+ /**
75
+ * Keeps credentials out of serialized transport output and error text.
76
+ *
77
+ * `protectSecrets()` replaces each listed field with a non-enumerable accessor backed
78
+ * by a WeakMap, whether or not the field is assigned yet, so later assignments (a
79
+ * connection opened on first write, a refreshed token) stay hidden too. It also
80
+ * installs `toJSON()` and a Node inspect hook returning a redacted view: scalar
81
+ * fields stay for debugging, secret-looking keys become '[REDACTED]', URLs lose
82
+ * userinfo, query and fragment. No Node imports, so browser bundles can use it.
83
+ */
84
+ const REDACTED = "[REDACTED]";
85
+ const INSPECT_CUSTOM = Symbol.for("nodejs.util.inspect.custom");
86
+ const MAX_DEPTH = 4;
87
+ const SCHEME_PREFIX = /^[a-z][a-z0-9+.-]*:\/\//i;
88
+ function normalizeName(name) {
89
+ return name.toLowerCase().replaceAll("-", "").replaceAll("_", "");
90
+ }
91
+ const SECRET_NAMES = [...SENSITIVE_KEY_NAMES, ...TRANSPORT_CONFIG_SECRET_NAMES].map(normalizeName);
92
+ new Set(DEFAULT_REDACT_QUERY_PARAMS.map(normalizeName));
93
+ /** Exact match for short names (`key`, `pfx`), suffix match for longer ones (`azureClientSecret`). */
94
+ function isSecretKey(key) {
95
+ const name = normalizeName(key);
96
+ return SECRET_NAMES.some((n) => name === n || n.length >= 5 && name.endsWith(n));
97
+ }
98
+ function isUrlKey(key) {
99
+ return /url|uri|endpoint|href/i.test(key);
100
+ }
101
+ function isPlainObject(value) {
102
+ const proto = Object.getPrototypeOf(value);
103
+ return proto === Object.prototype || proto === null;
104
+ }
105
+ /** Absolute URL: `scheme://host` only. Relative or unparseable: path kept, query and fragment cut. */
106
+ function redactUrl(raw) {
107
+ if (typeof raw !== "string") return `${raw.protocol}//${raw.host}`;
108
+ if (SCHEME_PREFIX.test(raw)) try {
109
+ const url = new URL(raw);
110
+ return `${url.protocol}//${url.host}`;
111
+ } catch {
112
+ return REDACTED;
113
+ }
114
+ return raw.split(/[?#]/, 1)[0] ?? "";
115
+ }
116
+ function redactHeaders(headers) {
117
+ if (!headers || typeof headers !== "object") return headers;
118
+ return Object.fromEntries(Object.keys(headers).map((name) => [name, REDACTED]));
119
+ }
120
+ /** Redacted deep copy of a config-like value. Never throws, never returns a secret. */
121
+ function redactConfig(value, depth = 0, key = "") {
122
+ var _value$constructor;
123
+ if (value === null || value === void 0) return value;
124
+ if (typeof value === "string") return SCHEME_PREFIX.test(value) || isUrlKey(key) ? redactUrl(value) : value;
125
+ if (typeof value === "number" || typeof value === "boolean") return value;
126
+ if (typeof value === "function") return "[Function]";
127
+ if (typeof value !== "object") return "[Unserializable]";
128
+ if (typeof URL !== "undefined" && value instanceof URL) return redactUrl(value);
129
+ if (Array.isArray(value)) return depth >= MAX_DEPTH ? "[Array]" : value.map((v) => redactConfig(v, depth + 1, key));
130
+ if (!isPlainObject(value) || depth >= MAX_DEPTH) return `[${((_value$constructor = value.constructor) === null || _value$constructor === void 0 ? void 0 : _value$constructor.name) ?? "Object"}]`;
131
+ const out = {};
132
+ for (const [name, inner] of Object.entries(value)) if (isSecretKey(name)) out[name] = inner === void 0 ? void 0 : REDACTED;
133
+ else if (name.toLowerCase() === "headers") out[name] = redactHeaders(inner);
134
+ else out[name] = redactConfig(inner, depth + 1, name);
135
+ return out;
136
+ }
137
+ const hiddenKeys = /* @__PURE__ */ new WeakMap();
138
+ const hiddenValues = /* @__PURE__ */ new WeakMap();
139
+ function viewOf(target) {
140
+ var _target$constructor;
141
+ const hidden = hiddenKeys.get(target) ?? /* @__PURE__ */ new Set();
142
+ const values = hiddenValues.get(target);
143
+ const view = { class: (_target$constructor = target.constructor) === null || _target$constructor === void 0 ? void 0 : _target$constructor.name };
144
+ for (const key of /* @__PURE__ */ new Set([...Object.keys(target), ...hidden])) {
145
+ const inner = hidden.has(key) ? values === null || values === void 0 ? void 0 : values.get(key) : target[key];
146
+ if (isSecretKey(key)) view[key] = inner === void 0 ? void 0 : REDACTED;
147
+ else if (key.toLowerCase() === "headers") view[key] = redactHeaders(inner);
148
+ else if (inner !== null && typeof inner === "object" && !hidden.has(key) && !(inner instanceof URL)) view[key] = "[Object]";
149
+ else if (hidden.has(key) && typeof inner === "string" && !isUrlKey(key)) view[key] = REDACTED;
150
+ else view[key] = redactConfig(inner, 0, key);
151
+ }
152
+ return view;
153
+ }
154
+ /**
155
+ * Hides `keys` on `target` (assigned or not yet) and gives it a redacted `toJSON()` /
156
+ * inspect view. Fields stay readable and writable. Safe to call more than once.
157
+ * Throws when the target cannot carry the protection (frozen or sealed), instead of
158
+ * silently leaving the secret enumerable.
159
+ */
160
+ function protectSecrets(target, keys) {
161
+ if (!Object.isExtensible(target)) {
162
+ var _target$constructor2;
163
+ throw new TypeError(`protectSecrets: ${((_target$constructor2 = target.constructor) === null || _target$constructor2 === void 0 ? void 0 : _target$constructor2.name) ?? "object"} is not extensible`);
164
+ }
165
+ let hidden = hiddenKeys.get(target);
166
+ let values = hiddenValues.get(target);
167
+ if (!hidden || !values) {
168
+ hidden = /* @__PURE__ */ new Set();
169
+ values = /* @__PURE__ */ new Map();
170
+ hiddenKeys.set(target, hidden);
171
+ hiddenValues.set(target, values);
172
+ const view = () => viewOf(target);
173
+ Object.defineProperty(target, "toJSON", {
174
+ value: view,
175
+ enumerable: false,
176
+ configurable: true
177
+ });
178
+ Object.defineProperty(target, INSPECT_CUSTOM, {
179
+ value: view,
180
+ enumerable: false,
181
+ configurable: true
182
+ });
183
+ }
184
+ const store = values;
185
+ for (const key of keys) {
186
+ if (hidden.has(key)) continue;
187
+ const desc = Object.getOwnPropertyDescriptor(target, key);
188
+ if (desc && !desc.configurable) throw new TypeError(`protectSecrets: "${key}" is not configurable`);
189
+ if (desc && "value" in desc) store.set(key, desc.value);
190
+ hidden.add(key);
191
+ Object.defineProperty(target, key, {
192
+ enumerable: false,
193
+ configurable: true,
194
+ get: () => store.get(key),
195
+ set: (next) => void store.set(key, next)
196
+ });
197
+ }
198
+ }
199
+ // src/utils/internal-log.ts
200
+ /**
201
+ * Internal logging helpers for use within the logixia library itself.
202
+ *
203
+ * These functions write directly to stderr/stdout without going through
204
+ * LogixiaLogger — this avoids circular dependencies and ensures internal
205
+ * diagnostics still surface even when the logger is misconfigured.
206
+ *
207
+ * Library code must NEVER call console.log/warn/error directly. Use these
208
+ * helpers instead so that internal output can be silenced in tests by setting
209
+ * the LOGIXIA_SILENT_INTERNAL=1 environment variable.
210
+ */
211
+ /**
212
+ * Read the silence flag on each call rather than caching it at import time, so
213
+ * setting LOGIXIA_SILENT_INTERNAL=1 AFTER the module is first imported (e.g. in
214
+ * a test setup file) still takes effect — the documented test-silencing
215
+ * behavior was previously unreliable because the value was frozen at load.
216
+ */
217
+ function isSilent() {
218
+ var _process$env;
219
+ if (typeof process !== "undefined" && ((_process$env = process.env) === null || _process$env === void 0 ? void 0 : _process$env.LOGIXIA_SILENT_INTERNAL) === "1") return true;
220
+ const flag = globalThis["LOGIXIA_SILENT_INTERNAL"];
221
+ return flag === "1" || flag === 1 || flag === true;
222
+ }
223
+ /**
224
+ * Write a line to stderr, falling back to the matching console method where
225
+ * `process` is unavailable (browsers, Cloudflare Workers, Deno without Node compat).
226
+ */
227
+ function writeLine(method, line) {
228
+ var _process$stderr;
229
+ if (typeof process !== "undefined" && typeof ((_process$stderr = process.stderr) === null || _process$stderr === void 0 ? void 0 : _process$stderr.write) === "function") process.stderr.write(`${line}\n`);
230
+ else if (typeof console !== "undefined" && typeof console[method] === "function") console[method](line);
231
+ }
232
+ /**
233
+ * Emit an internal debug/info message to stderr.
234
+ * Use for field-enable/disable notifications that a developer might want to see
235
+ * during development but should not appear in production log streams.
236
+ */
237
+ function internalLog(message) {
238
+ if (!isSilent()) writeLine("log", `[logixia] ${message}`);
239
+ }
240
+ /**
241
+ * Emit an internal warning to stderr.
242
+ * Use when something is misconfigured but logixia can continue operating.
243
+ */
244
+ function internalWarn(message) {
245
+ if (!isSilent()) writeLine("warn", `[logixia:warn] ${message}`);
246
+ }
247
+ /**
248
+ * Emit an internal error to stderr.
249
+ * Use when a transport write fails or a serious internal error occurs.
250
+ */
251
+ function internalError(message, error) {
252
+ if (!isSilent()) {
253
+ let errStr = "";
254
+ if (error instanceof Error) errStr = ` — ${error.message}`;
255
+ else if (error != null) errStr = ` — ${String(error)}`;
256
+ writeLine("error", `[logixia:error] ${message}${errStr}`);
257
+ }
258
+ }
259
+ // src/utils/safe-stringify.ts
9
260
  /** Build a JSONPath like `$["a"][0]["b"]` for a decycle pointer. */
10
261
  function jsonPath(parts) {
11
262
  let path = "$";
@@ -89,9 +340,7 @@ function stringifyForLog(value) {
89
340
  }
90
341
  }
91
342
  }
92
-
93
- //#endregion
94
- //#region src/utils/otel.ts
343
+ // src/utils/otel.ts
95
344
  let _otelApi;
96
345
  function tryLoadOtelApi() {
97
346
  if (_otelApi !== void 0) return _otelApi;
@@ -155,7 +404,6 @@ function getOtelMetaFields(opts = {}) {
155
404
  [traceFlagsField]: ctx.traceFlags
156
405
  };
157
406
  }
158
- let _bridgeOptions = null;
159
407
  /**
160
408
  * Initialise the global OTel bridge.
161
409
  *
@@ -169,48 +417,59 @@ let _bridgeOptions = null;
169
417
  * initOtelBridge();
170
418
  * ```
171
419
  */
172
- function initOtelBridge(opts = {}) {
173
- _bridgeOptions = opts;
174
- }
420
+ function initOtelBridge(opts = {}) {}
175
421
  /**
176
422
  * Disable the OTel bridge (useful for tests).
177
423
  */
178
- function disableOtelBridge() {
179
- _bridgeOptions = null;
180
- }
181
-
182
- //#endregion
183
- //#region src/utils/internal-log.ts
424
+ function disableOtelBridge() {}
425
+ // src/utils/typed-logger.ts
184
426
  /**
185
- * Internal logging helpers for use within the logixia library itself.
427
+ * logixia — TypeScript typed log fields
186
428
  *
187
- * These functions write directly to stderr/stdout without going through
188
- * LogixiaLogger — this avoids circular dependencies and ensures internal
189
- * diagnostics still surface even when the logger is misconfigured.
429
+ * Solves the type-safety gap: standard `Record<string, unknown>` metadata gives
430
+ * zero IDE autocomplete and lets typos slip silently into production logs.
190
431
  *
191
- * Library code must NEVER call console.log/warn/error directly. Use these
192
- * helpers instead so that internal output can be silenced in tests by setting
193
- * the LOGIXIA_SILENT_INTERNAL=1 environment variable.
194
- */
195
- /**
196
- * Read the silence flag on each call rather than caching it at import time, so
197
- * setting LOGIXIA_SILENT_INTERNAL=1 AFTER the module is first imported (e.g. in
198
- * a test setup file) still takes effect — the documented test-silencing
199
- * behavior was previously unreliable because the value was frozen at load.
200
- */
201
- function isSilent() {
202
- return process.env.LOGIXIA_SILENT_INTERNAL === "1";
203
- }
204
- /**
205
- * Emit an internal warning to stderr.
206
- * Use when something is misconfigured but logixia can continue operating.
432
+ * Two complementary utilities:
433
+ *
434
+ * 1. `createTypedLogger<TFields>()` — wraps any IBaseLogger so that the second
435
+ * argument of every log method is constrained to `TFields` (a typed object).
436
+ * Compile-time safety, zero runtime overhead.
437
+ *
438
+ * 2. `defineLogSchema<TFields>(schema)` — declares expected fields with optional
439
+ * validators. In development (NODE_ENV !== 'production') every log call is
440
+ * validated against the schema and a warning is emitted for missing required
441
+ * fields or type mismatches.
442
+ *
443
+ * @example
444
+ * ```ts
445
+ * import { createTypedLogger, defineLogSchema } from 'logixia';
446
+ *
447
+ * interface OrderFields {
448
+ * orderId: string;
449
+ * userId: string;
450
+ * amount?: number;
451
+ * currency?: string;
452
+ * }
453
+ *
454
+ * const schema = defineLogSchema<OrderFields>({
455
+ * orderId: { type: 'string', required: true },
456
+ * userId: { type: 'string', required: true },
457
+ * amount: { type: 'number' },
458
+ * currency: { type: 'string' },
459
+ * });
460
+ *
461
+ * const orderLogger = createTypedLogger<OrderFields>(baseLogger, schema);
462
+ * await orderLogger.info('Order created', { orderId: 'ord_123', userId: 'usr_456', amount: 99.99 });
463
+ * // ^^^^ fully typed autocomplete ^^^^
464
+ * ```
207
465
  */
208
- function internalWarn(message) {
209
- if (!isSilent()) process.stderr.write(`[logixia:warn] ${message}\n`);
466
+ function isProduction() {
467
+ try {
468
+ return process.env.NODE_ENV === "production";
469
+ } catch {
470
+ return false;
471
+ }
210
472
  }
211
-
212
- //#endregion
213
- //#region src/utils/typed-logger.ts
214
473
  /**
215
474
  * Define a typed schema for a category of log entries.
216
475
  *
@@ -221,7 +480,7 @@ function defineLogSchema(fields) {
221
480
  return {
222
481
  fields,
223
482
  validate(payload) {
224
- if (process.env["NODE_ENV"] === "production") return [];
483
+ if (isProduction()) return [];
225
484
  const warnings = [];
226
485
  for (const [key, def] of Object.entries(fields)) {
227
486
  const value = payload[key];
@@ -273,9 +532,42 @@ function createTypedLogger(logger, schema) {
273
532
  trace: (m, d) => withValidation("trace", (logger.trace ?? logger.debug).bind(logger), m, d)
274
533
  };
275
534
  }
276
-
277
- //#endregion
278
- //#region src/browser.ts
535
+ // src/browser.ts
536
+ /**
537
+ * logixia — Browser / Edge Runtime entry point
538
+ *
539
+ * This module is the browser-safe subset of logixia. It contains **no**
540
+ * references to Node.js built-ins (`node:fs`, `node:http`, `node:worker_threads`,
541
+ * `node:crypto`, `node:async_hooks`) so it can be bundled for:
542
+ *
543
+ * - Browser (Webpack / Vite / esbuild)
544
+ * - Cloudflare Workers / Vercel Edge Functions
545
+ * - Deno (via ESM import)
546
+ * - Bun (core subset, no file/DB transports)
547
+ *
548
+ * Excluded from this entry: FileTransport, DatabaseTransport, WorkerTransport,
549
+ * CloudWatchTransport, GCPTransport, AzureMonitorTransport, and anything that
550
+ * requires `AsyncLocalStorage`.
551
+ *
552
+ * @example Basic browser usage
553
+ * ```ts
554
+ * import { createBrowserLogger, BrowserConsoleTransport } from 'logixia/browser';
555
+ *
556
+ * const logger = createBrowserLogger({ appName: 'my-app' });
557
+ * logger.info('Page loaded', { url: location.href });
558
+ * ```
559
+ *
560
+ * @example Custom transport in browser
561
+ * ```ts
562
+ * import { createBrowserLogger, BrowserConsoleTransport } from 'logixia/browser';
563
+ *
564
+ * const logger = createBrowserLogger({
565
+ * appName: 'my-app',
566
+ * json: false, // pretty-print in devtools
567
+ * level: 'debug',
568
+ * });
569
+ * ```
570
+ */
279
571
  const LEVEL_ORDER = {
280
572
  verbose: 0,
281
573
  debug: 1,
@@ -370,7 +662,7 @@ function validateRemoteUrl(raw) {
370
662
  try {
371
663
  parsed = new URL(raw);
372
664
  } catch {
373
- throw new TypeError(`BrowserRemoteTransport: invalid url "${raw}"`);
665
+ throw new TypeError(`BrowserRemoteTransport: invalid url [redacted]`);
374
666
  }
375
667
  if (parsed.protocol !== "http:" && parsed.protocol !== "https:") throw new TypeError(`BrowserRemoteTransport: url scheme "${parsed.protocol}" is not allowed; use http: or https:`);
376
668
  return raw;
@@ -383,6 +675,34 @@ function validateRemoteUrl(raw) {
383
675
  function byteLength(s) {
384
676
  return new TextEncoder().encode(s).length;
385
677
  }
678
+ const FAILURE_REPORT_INTERVAL_MS = 6e4;
679
+ /**
680
+ * Error name/code, HTTP status and host only. The error message is never
681
+ * included: runtimes embed request URLs (absolute or relative) and header
682
+ * values in it.
683
+ */
684
+ function describeFailure(error, url) {
685
+ let host = "relative endpoint";
686
+ try {
687
+ host = `host ${new URL(url).host}`;
688
+ } catch {}
689
+ const e = error;
690
+ const parts = [];
691
+ if (e && typeof e.name === "string") parts.push(e.name);
692
+ if (e && typeof e.code === "string") parts.push(e.code);
693
+ if (e && typeof e.status === "number") parts.push(`HTTP ${e.status}`);
694
+ parts.push(host);
695
+ return parts.join(" ");
696
+ }
697
+ /** True only in a real browser page, where console noise reaches end users. */
698
+ function isBrowserPage() {
699
+ const g = globalThis;
700
+ return typeof g["window"] !== "undefined" && typeof g["document"] !== "undefined";
701
+ }
702
+ function isKeepaliveError(error) {
703
+ const message = error === null || error === void 0 ? void 0 : error.message;
704
+ return typeof message === "string" && /keepalive/i.test(message);
705
+ }
386
706
  /**
387
707
  * Browser transport that batches log entries and sends them to a remote
388
708
  * HTTP endpoint via `fetch` (available in all modern browsers and Edge runtimes).
@@ -404,14 +724,21 @@ var BrowserRemoteTransport = class {
404
724
  constructor(options) {
405
725
  this.name = "browser-remote";
406
726
  this.batch = [];
727
+ this.keepaliveSupported = true;
728
+ this.failedFlushCount = 0;
407
729
  this.timer = null;
408
730
  this.droppedEntries = 0;
731
+ this.reporting = false;
732
+ this.failureReported = false;
733
+ this.silent = options.silent ?? isBrowserPage();
734
+ this.onError = options.onError;
409
735
  this.url = validateRemoteUrl(options.url);
410
736
  this.headers = options.headers ?? {};
411
737
  this.batchSize = options.batchSize ?? 100;
412
738
  this.flushIntervalMs = options.flushIntervalMs ?? 5e3;
413
739
  this.maxBufferSize = options.maxBufferSize ?? 1e3;
414
740
  if (options.level !== void 0) this.level = options.level;
741
+ protectSecrets(this, ["headers", "url"]);
415
742
  this.scheduleFlush();
416
743
  }
417
744
  /**
@@ -422,7 +749,23 @@ var BrowserRemoteTransport = class {
422
749
  get dropped() {
423
750
  return this.droppedEntries;
424
751
  }
752
+ /** Number of flush attempts that failed (network error or non-OK HTTP status). */
753
+ get failedFlushes() {
754
+ return this.failedFlushCount;
755
+ }
756
+ /**
757
+ * The most recent failure from a flush, if any: the raw fetch error (which on
758
+ * some runtimes embeds the request URL, so do not log it blindly) or an
759
+ * `Error` carrying only the HTTP status.
760
+ */
761
+ get lastError() {
762
+ return this.lastFlushError;
763
+ }
425
764
  write(entry) {
765
+ if (this.reporting) {
766
+ this.droppedEntries += 1;
767
+ return;
768
+ }
426
769
  this.batch.push(entry);
427
770
  while (this.batch.length > this.maxBufferSize) {
428
771
  this.batch.shift();
@@ -437,24 +780,75 @@ var BrowserRemoteTransport = class {
437
780
  const keepalive = byteLength(body) < 6e4;
438
781
  let res;
439
782
  try {
440
- res = await fetch(this.url, {
441
- method: "POST",
442
- headers: {
443
- "Content-Type": "application/json",
444
- ...this.headers
445
- },
446
- body,
447
- keepalive
448
- });
449
- } catch {
450
- this.batch.unshift(...entries);
451
- return;
783
+ res = await this.send(body, this.keepaliveSupported ? keepalive : void 0);
784
+ } catch (error) {
785
+ if (this.keepaliveSupported && isKeepaliveError(error)) {
786
+ this.keepaliveSupported = false;
787
+ try {
788
+ res = await this.send(body);
789
+ } catch (retryError) {
790
+ this.recordFailure(entries, retryError);
791
+ return;
792
+ }
793
+ } else {
794
+ this.recordFailure(entries, error);
795
+ return;
796
+ }
452
797
  }
453
798
  if (!res.ok) {
454
- if (res.status >= 500 || res.status === 429) this.batch.unshift(...entries);
455
- else this.droppedEntries += entries.length;
799
+ const failure = Object.assign(/* @__PURE__ */ new Error(`HTTP ${res.status}`), { status: res.status });
800
+ if (res.status >= 500 || res.status === 429) this.recordFailure(entries, failure);
801
+ else {
802
+ this.droppedEntries += entries.length;
803
+ this.recordFailure([], failure);
804
+ }
456
805
  return;
457
806
  }
807
+ this.reportRecovery();
808
+ }
809
+ }
810
+ send(body, keepalive) {
811
+ return fetch(this.url, {
812
+ method: "POST",
813
+ headers: {
814
+ "Content-Type": "application/json",
815
+ ...this.headers
816
+ },
817
+ body,
818
+ ...keepalive !== void 0 ? { keepalive } : {}
819
+ });
820
+ }
821
+ recordFailure(entries, error) {
822
+ this.batch.unshift(...entries);
823
+ this.failedFlushCount += 1;
824
+ this.lastFlushError = error;
825
+ const now = Date.now();
826
+ const shouldReport = this.lastReportAt === void 0 || now - this.lastReportAt >= FAILURE_REPORT_INTERVAL_MS;
827
+ this.guarded(() => {
828
+ if (this.onError) try {
829
+ this.onError(error);
830
+ } catch {}
831
+ if (shouldReport && !this.silent) {
832
+ this.lastReportAt = now;
833
+ this.failureReported = true;
834
+ internalError(`BrowserRemoteTransport flush failed (${describeFailure(error, this.url)})`);
835
+ }
836
+ });
837
+ }
838
+ reportRecovery() {
839
+ if (!this.failureReported) return;
840
+ this.failureReported = false;
841
+ const now = Date.now();
842
+ if (this.lastRecoveryAt !== void 0 && now - this.lastRecoveryAt < FAILURE_REPORT_INTERVAL_MS) return;
843
+ this.lastRecoveryAt = now;
844
+ this.guarded(() => internalLog("BrowserRemoteTransport delivery recovered"));
845
+ }
846
+ guarded(fn) {
847
+ this.reporting = true;
848
+ try {
849
+ fn();
850
+ } finally {
851
+ this.reporting = false;
458
852
  }
459
853
  }
460
854
  scheduleFlush() {
@@ -492,7 +886,10 @@ var BrowserLogger = class BrowserLogger {
492
886
  context: config.context
493
887
  };
494
888
  if (config.silent) this.transports = [];
495
- else this.transports = [new BrowserConsoleTransport({ json: this.config.json }), ...config.transports ?? []];
889
+ else {
890
+ const builtIn = new BrowserConsoleTransport({ json: this.config.json });
891
+ this.transports = [builtIn, ...config.transports ?? []];
892
+ }
496
893
  }
497
894
  verbose(message, payload) {
498
895
  this.emit("verbose", message, payload);
@@ -580,7 +977,6 @@ function createBrowserLogger(config) {
580
977
  * ```
581
978
  */
582
979
  const browserLogger = new BrowserLogger({ appName: "App" });
583
-
584
- //#endregion
585
980
  export { BrowserConsoleTransport, BrowserLogger, BrowserRemoteTransport, browserLogger, createBrowserLogger, createTypedLogger, defineLogSchema, disableOtelBridge, getActiveOtelContext, getOtelMetaFields, initOtelBridge };
981
+
586
982
  //# sourceMappingURL=browser.mjs.map